Move findImage method from EffectView to EffectModel
This commit is contained in:
parent
2f30411106
commit
f44691b61c
3 changed files with 10 additions and 10 deletions
|
@ -134,6 +134,12 @@ QString EffectModel::serviceName(const QString &effectName) {
|
|||
return "kwin4_effect_" + effectName.toLower().replace(" ", "");
|
||||
}
|
||||
|
||||
QString EffectModel::findImage(const QString &imagePath, int size) {
|
||||
const QString relativePath("icons/oxygen/" + QString::number(size) + 'x' + QString::number(size) + '/' + imagePath);
|
||||
const QString fullImagePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, relativePath, QStandardPaths::LocateFile);
|
||||
return fullImagePath;
|
||||
}
|
||||
|
||||
EffectView::EffectView(QWindow *parent)
|
||||
: QQuickView(parent)
|
||||
{
|
||||
|
@ -171,11 +177,5 @@ void EffectView::syncConfig() {
|
|||
kwinConfig.sync();
|
||||
}
|
||||
|
||||
QString EffectView::findImage(const QString &imagePath, int size) {
|
||||
const QString relativePath("icons/oxygen/" + QString::number(size) + 'x' + QString::number(size) + '/' + imagePath);
|
||||
const QString fullImagePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, relativePath, QStandardPaths::LocateFile);
|
||||
return fullImagePath;
|
||||
}
|
||||
|
||||
}//end namespace Compositing
|
||||
}//end namespace KWin
|
||||
|
|
|
@ -64,10 +64,11 @@ public:
|
|||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QString serviceName(const QString &effectName);
|
||||
|
||||
Q_INVOKABLE QString findImage(const QString &imagePath, int size = 128);
|
||||
|
||||
private:
|
||||
void loadEffects();
|
||||
QList<EffectData> m_effectsList;
|
||||
|
||||
};
|
||||
|
||||
class EffectView : public QQuickView {
|
||||
|
@ -81,7 +82,6 @@ public:
|
|||
|
||||
Q_INVOKABLE void effectStatus(const QString &effectName, bool status);
|
||||
Q_INVOKABLE void syncConfig();
|
||||
Q_INVOKABLE QString findImage(const QString &imagePath, int size = 128);
|
||||
|
||||
private:
|
||||
QHash<QString, bool> m_effectStatus;
|
||||
|
|
|
@ -90,7 +90,7 @@ Component {
|
|||
id: configureButton
|
||||
anchors.left: effectItem.right
|
||||
visible: effectConfig.effectUiConfigExists(model.ServiceNameRole)
|
||||
iconSource: engineObject.findImage("actions/configure.png")
|
||||
iconSource: effectModel.findImage("actions/configure.png")
|
||||
width: 50
|
||||
height: 25
|
||||
enabled: myCheckBox.checked
|
||||
|
@ -104,7 +104,7 @@ Component {
|
|||
anchors.left: configureButton.right
|
||||
width: 50
|
||||
height: 25
|
||||
iconSource: engineObject.findImage("status/dialog-information.png");
|
||||
iconSource: effectModel.findImage("status/dialog-information.png");
|
||||
|
||||
onClicked: {
|
||||
animationAbout.running = true;
|
||||
|
|
Loading…
Reference in a new issue