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[CategoryRole] = "CategoryRole";
|
||||||
roleNames[ServiceNameRole] = "ServiceNameRole";
|
roleNames[ServiceNameRole] = "ServiceNameRole";
|
||||||
roleNames[EffectStatusRole] = "EffectStatusRole";
|
roleNames[EffectStatusRole] = "EffectStatusRole";
|
||||||
|
roleNames[VideoRole] = "VideoRole";
|
||||||
return roleNames;
|
return roleNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +124,8 @@ QVariant EffectModel::data(const QModelIndex &index, int role) const
|
||||||
return m_effectsList.at(index.row()).serviceName;
|
return m_effectsList.at(index.row()).serviceName;
|
||||||
case EffectStatusRole:
|
case EffectStatusRole:
|
||||||
return m_effectsList.at(index.row()).effectStatus;
|
return m_effectsList.at(index.row()).effectStatus;
|
||||||
|
case VideoRole:
|
||||||
|
return m_effectsList.at(index.row()).video;
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -179,6 +182,7 @@ void EffectModel::loadEffects()
|
||||||
effect.serviceName = plugin.pluginName();
|
effect.serviceName = plugin.pluginName();
|
||||||
effect.effectStatus = kwinConfig.readEntry(effect.serviceName + "Enabled", plugin.isPluginEnabledByDefault());
|
effect.effectStatus = kwinConfig.readEntry(effect.serviceName + "Enabled", plugin.isPluginEnabledByDefault());
|
||||||
effect.enabledByDefault = plugin.isPluginEnabledByDefault();
|
effect.enabledByDefault = plugin.isPluginEnabledByDefault();
|
||||||
|
effect.video = service->property(QStringLiteral("X-KWin-Video-Url"), QVariant::Url).toUrl();
|
||||||
|
|
||||||
m_effectsList << effect;
|
m_effectsList << effect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ struct EffectData {
|
||||||
QString serviceName;
|
QString serviceName;
|
||||||
bool effectStatus;
|
bool effectStatus;
|
||||||
bool enabledByDefault;
|
bool enabledByDefault;
|
||||||
|
QUrl video;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectModel : public QAbstractItemModel
|
class EffectModel : public QAbstractItemModel
|
||||||
|
@ -63,7 +64,8 @@ public:
|
||||||
CategoryRole,
|
CategoryRole,
|
||||||
ServiceNameRole,
|
ServiceNameRole,
|
||||||
EffectStatusRole,
|
EffectStatusRole,
|
||||||
WindowManagementRole
|
WindowManagementRole,
|
||||||
|
VideoRole
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit EffectModel(QObject *parent = 0);
|
explicit EffectModel(QObject *parent = 0);
|
||||||
|
|
Loading…
Reference in a new issue