diff --git a/effects/slideback/slideback.cpp b/effects/slideback/slideback.cpp --- a/effects/slideback/slideback.cpp +++ b/effects/slideback/slideback.cpp @@ -35,12 +35,6 @@ connect(effects, SIGNAL(tabBoxClosed()), SLOT(slotTabBoxClosed())); } -static inline bool windowsShareDesktop(EffectWindow *w1, EffectWindow *w2) -{ - return w1->isOnAllDesktops() || w2->isOnAllDesktops() || w1->desktop() == w2->desktop(); -} - - void SlideBackEffect::slotStackingOrderChanged() { if (effects->activeFullScreenEffect() || m_tabboxActive) { @@ -79,7 +73,7 @@ currentFound = true; } } else { - if (isWindowUsable(tmp) && windowsShareDesktop(tmp, w)) { + if (isWindowUsable(tmp) && tmp->isOnCurrentDesktop() && w->isOnCurrentDesktop()) { // Do we have to move it? if (intersects(w, tmp->geometry())) { QRect slideRect; diff --git a/effects/slidingpopups/slidingpopups.cpp b/effects/slidingpopups/slidingpopups.cpp --- a/effects/slidingpopups/slidingpopups.cpp +++ b/effects/slidingpopups/slidingpopups.cpp @@ -123,7 +123,7 @@ const AnimationData &animData = m_animationsData[w]; const int slideLength = (animData.slideLength > 0) ? animData.slideLength : m_slideLength; - const QRect screenRect = effects->clientArea(FullScreenArea, w->screen(), w->desktop()); + const QRect screenRect = effects->clientArea(FullScreenArea, w->screen(), effects->currentDesktop()); int splitPoint = 0; const QRect geo = w->expandedGeometry(); const qreal t = (*animationIt).timeLine.value(); diff --git a/kcmkwin/kwincompositing/qml/EffectView.qml b/kcmkwin/kwincompositing/qml/EffectView.qml --- a/kcmkwin/kwincompositing/qml/EffectView.qml +++ b/kcmkwin/kwincompositing/qml/EffectView.qml @@ -19,34 +19,14 @@ **************************************************************************/ import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtQuick.Controls 2.0 as QQC2 +import QtQuick.Controls 2.4 import QtQuick.Layouts 1.0 import org.kde.kwin.kwincompositing 1.0 Rectangle { signal changed - implicitWidth: col.implicitWidth - implicitHeight: col.implicitHeight - - Component { - id: sectionHeading - Rectangle { - width: parent.width - implicitHeight: sectionText.implicitHeight + 2 * col.spacing - color: searchModel.backgroundNormalColor - - QQC2.Label { - id: sectionText - x: col.spacing - y: col.spacing - text: section - font.weight: Font.Bold - color: searchModel.sectionColor - anchors.horizontalCenter: parent.horizontalCenter - } - } - } + implicitHeight: 500 + implicitWidth: 400 EffectConfig { id: effectConfig @@ -59,64 +39,62 @@ id: col anchors.fill: parent - QQC2.Label { + Label { id: hint + Layout.fillWidth: true + Layout.alignment: Qt.AlignLeft + text: i18n("Hint: To find out or configure how to activate an effect, look at the effect's settings.") - anchors { - top: parent.top - left: parent.left - } + elide: Text.ElideRight } RowLayout { - QQC2.TextField { + TextField { // TODO: needs clear button, missing in Qt id: searchField - placeholderText: i18n("Search") + placeholderText: i18n("Search...") Layout.fillWidth: true focus: true } Button { - iconName: "configure" - tooltip: i18n("Configure filter") - menu: Menu { - MenuItem { - text: i18n("Exclude Desktop Effects not supported by the Compositor") - checkable: true - checked: searchModel.filterOutUnsupported - onTriggered: { - searchModel.filterOutUnsupported = !searchModel.filterOutUnsupported; - } + id: configureButton + icon.name: "configure" + ToolTip.visible: hovered + ToolTip.text: i18n("Configure filter") + onClicked: menu.opened ? menu.close() : menu.open() + } + Menu { + id: menu + y: configureButton.height + x: parent.width - width + MenuItem { + text: i18n("Exclude Desktop Effects not supported by the Compositor") + checkable: true + checked: searchModel.filterOutUnsupported + onToggled: { + searchModel.filterOutUnsupported = !searchModel.filterOutUnsupported; } - MenuItem { - text: i18n("Exclude internal Desktop Effects") - checkable: true - checked: searchModel.filterOutInternal - onTriggered: { - searchModel.filterOutInternal = !searchModel.filterOutInternal - } + } + MenuItem { + text: i18n("Exclude internal Desktop Effects") + checkable: true + checked: searchModel.filterOutInternal + onToggled: { + searchModel.filterOutInternal = !searchModel.filterOutInternal } } } } - EffectFilterModel { - id: searchModel - objectName: "filterModel" - filter: searchField.text - } - ScrollView { - id: scroll - frameVisible: true - highlightOnFocus: true Layout.fillWidth: true Layout.fillHeight: true - Rectangle { - color: effectView.backgroundNormalColor - anchors.fill: parent - } + clip: true + + // Draw a frame around the scrollview + Component.onCompleted: background.visible = true; + ListView { function exclusiveGroupForCategory(category) { for (var i = 0; i < effectView.exclusiveGroups.length; ++i) { @@ -139,7 +117,11 @@ property color backgroundNormalColor: searchModel.backgroundNormalColor property color backgroundAlternateColor: searchModel.backgroundAlternateColor anchors.fill: parent - model: searchModel + model: EffectFilterModel { + id: searchModel + objectName: "filterModel" + filter: searchField.text + } delegate: Effect{ id: effectDelegate Connections { @@ -155,7 +137,22 @@ } section.property: "CategoryRole" - section.delegate: sectionHeading + section.delegate: Rectangle { + width: parent.width + implicitHeight: sectionText.implicitHeight + 2 * col.spacing + color: searchModel.backgroundNormalColor + + Label { + id: sectionText + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + text: section + font.weight: Font.Bold + color: searchModel.sectionColor + } + } spacing: col.spacing focus: true } @@ -170,13 +167,13 @@ Button { id: ghnsButton text: i18n("Get New Desktop Effects...") - iconName: "get-hot-new-stuff" + icon.name: "get-hot-new-stuff" onClicked: effectConfig.openGHNS() } } }//End ColumnLayout Connections { target: searchModel onDataChanged: changed() } -}//End item +}//End Rectangle diff --git a/kcmkwin/kwindecoration/kcm.cpp b/kcmkwin/kwindecoration/kcm.cpp --- a/kcmkwin/kwindecoration/kcm.cpp +++ b/kcmkwin/kwindecoration/kcm.cpp @@ -106,14 +106,15 @@ m_quickView->rootContext()->setContextProperty("leftButtons", m_leftButtons); m_quickView->rootContext()->setContextProperty("rightButtons", m_rightButtons); m_quickView->rootContext()->setContextProperty("availableButtons", m_availableButtons); + m_quickView->rootContext()->setContextProperty("initialThemeIndex", -1); m_quickView->rootContext()->setContextProperty("titleFont", QFontDatabase::systemFont(QFontDatabase::TitleFont)); m_quickView->setResizeMode(QQuickView::SizeRootObjectToView); m_quickView->setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/kcm_kwindecoration/main.qml")))); if (m_quickView->status() == QQuickView::Ready) { auto listView = m_quickView->rootObject()->findChild("listView"); if (listView) { - connect(listView, SIGNAL(currentIndexChanged()), this, SLOT(changed())); + connect(listView, SIGNAL(userChangedSelection()), this, SLOT(changed())); } } @@ -313,7 +314,7 @@ m_ui->borderSizesCombo->setCurrentIndex(m_ui->borderSizesCombo->findData(border)); int themeIndex = m_proxyModel->mapFromSource(m_model->findDecoration(plugin, theme)).row(); - m_quickView->rootContext()->setContextProperty("savedIndex", themeIndex); + m_quickView->rootContext()->setContextProperty("initialThemeIndex", themeIndex); // buttons const auto &left = readDecorationButtons(config, "ButtonsOnLeft", QVector{ diff --git a/kcmkwin/kwindecoration/qml/Previews.qml b/kcmkwin/kwindecoration/qml/Previews.qml --- a/kcmkwin/kwindecoration/qml/Previews.qml +++ b/kcmkwin/kwindecoration/qml/Previews.qml @@ -28,16 +28,17 @@ GridView { id: gridView objectName: "listView" + signal userChangedSelection() model: decorationsModel cellWidth: 20 * units.gridUnit cellHeight: cellWidth / 1.6 + highlightFollowsCurrentItem: true onContentHeightChanged: { - if (gridView.currentIndex == -1) { - gridView.currentIndex = savedIndex; + if (gridView.currentIndex == -1 && initialThemeIndex != -1) { + gridView.currentIndex = initialThemeIndex } - gridView.positionViewAtIndex(gridView.currentIndex, GridView.Visible); + gridView.positionViewAtIndex(gridView.currentIndex, GridView.Visible) } - Rectangle { z: -1 anchors.fill: parent @@ -63,11 +64,17 @@ bridge: bridgeItem.bridge borderSizesIndex: gridView.borderSizesIndex } + Component.onCompleted: { + if (gridView.currentIndex == -1 && initialThemeIndex != -1) { + gridView.currentIndex = initialThemeIndex + } + } MouseArea { hoverEnabled: false anchors.fill: parent onClicked: { - gridView.currentIndex = index; + gridView.currentIndex = index + gridView.userChangedSelection() } } ColumnLayout { @@ -107,7 +114,8 @@ hoverEnabled: false anchors.fill: parent onClicked: { - gridView.currentIndex = index; + gridView.currentIndex = index + gridView.userChangedSelection() } } Layout.fillWidth: true @@ -138,6 +146,7 @@ text: i18n("Configure %1...", decorationPreviews.themeName) onClicked: { gridView.currentIndex = index + gridView.userChangedSelection() bridgeItem.bridge.configure() } }