Add support for videos in the model
This commit is contained in:
parent
6006a91e8a
commit
0bd7c5e0e2
2 changed files with 7 additions and 1 deletions
|
@ -63,6 +63,7 @@ QHash< int, QByteArray > EffectModel::roleNames() const
|
|||
roleNames[CategoryRole] = "CategoryRole";
|
||||
roleNames[ServiceNameRole] = "ServiceNameRole";
|
||||
roleNames[EffectStatusRole] = "EffectStatusRole";
|
||||
roleNames[VideoRole] = "VideoRole";
|
||||
return roleNames;
|
||||
}
|
||||
|
||||
|
@ -123,6 +124,8 @@ QVariant EffectModel::data(const QModelIndex &index, int role) const
|
|||
return m_effectsList.at(index.row()).serviceName;
|
||||
case EffectStatusRole:
|
||||
return m_effectsList.at(index.row()).effectStatus;
|
||||
case VideoRole:
|
||||
return m_effectsList.at(index.row()).video;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -179,6 +182,7 @@ void EffectModel::loadEffects()
|
|||
effect.serviceName = plugin.pluginName();
|
||||
effect.effectStatus = kwinConfig.readEntry(effect.serviceName + "Enabled", plugin.isPluginEnabledByDefault());
|
||||
effect.enabledByDefault = plugin.isPluginEnabledByDefault();
|
||||
effect.video = service->property(QStringLiteral("X-KWin-Video-Url"), QVariant::Url).toUrl();
|
||||
|
||||
m_effectsList << effect;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ struct EffectData {
|
|||
QString serviceName;
|
||||
bool effectStatus;
|
||||
bool enabledByDefault;
|
||||
QUrl video;
|
||||
};
|
||||
|
||||
class EffectModel : public QAbstractItemModel
|
||||
|
@ -63,7 +64,8 @@ public:
|
|||
CategoryRole,
|
||||
ServiceNameRole,
|
||||
EffectStatusRole,
|
||||
WindowManagementRole
|
||||
WindowManagementRole,
|
||||
VideoRole
|
||||
};
|
||||
|
||||
explicit EffectModel(QObject *parent = 0);
|
||||
|
|
Loading…
Reference in a new issue