Add Window Thumbnail support

icc-effect-5.14.5
Antonis Tsiapaliokas 2013-09-11 14:11:39 +03:00 committed by Martin Gräßlin
parent d33c2afb81
commit e1308f8b40
3 changed files with 35 additions and 3 deletions

View File

@ -71,6 +71,12 @@ int Compositing::animationSpeed() const
return kwinConfig.readEntry("AnimationSpeed", 3); return kwinConfig.readEntry("AnimationSpeed", 3);
} }
int Compositing::windowThumbnail() const
{
KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Compositing");
return kwinConfig.readEntry("HiddenPreviews", 5) - 4;
}
CompositingType::CompositingType(QObject *parent) CompositingType::CompositingType(QObject *parent)
: QAbstractItemModel(parent) { : QAbstractItemModel(parent) {
@ -179,7 +185,7 @@ int CompositingType::currentOpenGLType()
return currentIndex; return currentIndex;
} }
void CompositingType::syncConfig(int openGLType, int animationSpeed) void CompositingType::syncConfig(int openGLType, int animationSpeed, int windowThumbnail)
{ {
QString backend; QString backend;
bool glLegacy; bool glLegacy;
@ -214,6 +220,7 @@ void CompositingType::syncConfig(int openGLType, int animationSpeed)
kwinConfig.writeEntry("GLLegacy", glLegacy); kwinConfig.writeEntry("GLLegacy", glLegacy);
kwinConfig.writeEntry("GLCore", glCore); kwinConfig.writeEntry("GLCore", glCore);
kwinConfig.writeEntry("AnimationSpeed", animationSpeed); kwinConfig.writeEntry("AnimationSpeed", animationSpeed);
kwinConfig.writeEntry("HiddenPreviews", windowThumbnail + 4);
kwinConfig.sync(); kwinConfig.sync();
} }

View File

@ -33,12 +33,14 @@ class Compositing : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(int animationSpeed READ animationSpeed CONSTANT); Q_PROPERTY(int animationSpeed READ animationSpeed CONSTANT);
Q_PROPERTY(int windowThumbnail READ windowThumbnail CONSTANT);
public: public:
explicit Compositing(QObject *parent = 0); explicit Compositing(QObject *parent = 0);
Q_INVOKABLE bool OpenGLIsUnsafe() const; Q_INVOKABLE bool OpenGLIsUnsafe() const;
Q_INVOKABLE bool OpenGLIsBroken(); Q_INVOKABLE bool OpenGLIsBroken();
int animationSpeed() const; int animationSpeed() const;
int windowThumbnail() const;
private: private:
@ -82,7 +84,7 @@ public:
virtual QHash< int, QByteArray > roleNames() const override; virtual QHash< int, QByteArray > roleNames() const override;
Q_INVOKABLE int currentOpenGLType(); Q_INVOKABLE int currentOpenGLType();
Q_INVOKABLE void syncConfig(int openGLType, int animationSpeed); Q_INVOKABLE void syncConfig(int openGLType, int animationSpeed, int windowThumbnail);
private: private:
void generateCompositing(); void generateCompositing();

View File

@ -95,6 +95,29 @@ Item {
} }
} }
Label {
id: windowThumbnailText
text: i18n("Keep Window Thumbnails:")
anchors {
top: animationSpeed.bottom
horizontalCenter: windowManagement.horizontalCenter
topMargin: 20
}
}
ComboBox {
id: windowThumbnail
model: [i18n("Always (Breaks Animations)"), i18n("Only for Shown Windows"), i18n("Never")]
currentIndex: compositing.windowThumbnail
Layout.fillWidth: true
anchors {
top: windowThumbnailText.bottom
left: col.right
right: parent.right
}
onCurrentIndexChanged: apply.enabled = true;
}
ColumnLayout { ColumnLayout {
id: col id: col
height: parent.height height: parent.height
@ -174,7 +197,7 @@ Item {
onClicked: { onClicked: {
searchModel.syncConfig(); searchModel.syncConfig();
apply.enabled = false; apply.enabled = false;
compositingType.syncConfig(openGLType.currentIndex, animationSpeed.value); compositingType.syncConfig(openGLType.currentIndex, animationSpeed.value, windowThumbnail.currentIndex);
} }
} }