diff --git a/kcms/lookandfeel/kcm.h b/kcms/lookandfeel/kcm.h --- a/kcms/lookandfeel/kcm.h +++ b/kcms/lookandfeel/kcm.h @@ -51,6 +51,7 @@ enum Roles { PluginNameRole = Qt::UserRole +1, ScreenhotRole, + FullScreenPreviewRole, HasSplashRole, HasLockScreenRole, HasRunCommandRole, diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp --- a/kcms/lookandfeel/kcm.cpp +++ b/kcms/lookandfeel/kcm.cpp @@ -85,6 +85,7 @@ QHash roles = m_model->roleNames(); roles[PluginNameRole] = "pluginName"; roles[ScreenhotRole] = "screenshot"; + roles[FullScreenPreviewRole] = "fullScreenPreview"; roles[HasSplashRole] = "hasSplash"; roles[HasLockScreenRole] = "hasLockScreen"; roles[HasRunCommandRole] = "hasRunCommand"; @@ -186,7 +187,8 @@ } QStandardItem* row = new QStandardItem(pkg.metadata().name()); row->setData(pkg.metadata().pluginName(), PluginNameRole); - row->setData(pkg.filePath("previews", QStringLiteral("preview.png")), ScreenhotRole); + row->setData(pkg.filePath("preview"), ScreenhotRole); + row->setData(pkg.filePath("fullscreenpreview"), FullScreenPreviewRole); //What the package provides row->setData(!pkg.filePath("splashmainscript").isEmpty(), HasSplashRole); diff --git a/kcms/lookandfeel/package/contents/ui/main.qml b/kcms/lookandfeel/package/contents/ui/main.qml --- a/kcms/lookandfeel/package/contents/ui/main.qml +++ b/kcms/lookandfeel/package/contents/ui/main.qml @@ -18,6 +18,7 @@ import QtQuick 2.1 import QtQuick.Layouts 1.1 +import QtQuick.Window 2.2 import QtQuick.Controls 1.0 as QtControls import org.kde.kquickcontrolsaddons 2.0 import QtQuick.Controls.Private 1.0 @@ -141,6 +142,28 @@ Tooltip.showText(parent, Qt.point(parent.mouseX, parent.mouseY), model.display); } } + PlasmaComponents.ToolButton { + anchors { + top: parent.top + right: parent.right + margins: units.smallSpacing + } + visible: model.fullScreenPreview != "" + iconSource: "media-playback-start" + tooltip: i18n("Test Splashscreen") + flat: false + onClicked: { + previewWindow.url = model.fullScreenPreview; + previewWindow.showFullScreen(); + } + opacity: parent.containsMouse ? 1 : 0 + Behavior on opacity { + PropertyAnimation { + duration: units.longDuration + easing.type: Easing.OutQuad + } + } + } } } } @@ -188,4 +211,29 @@ } } } + + Window { + id: previewWindow + property alias url: previewImage.source + color: Qt.rgba(0, 0, 0, 0.7) + MouseArea { + anchors.fill: parent + Image { + id: previewImage + anchors.centerIn: parent + fillMode: Image.PreserveAspectFit + width: Math.min(parent.width, sourceSize.width) + height: Math.min(parent.height, sourceSize.height) + } + onClicked: previewWindow.visible = false; + QtControls.ToolButton { + anchors { + top: parent.top + right: parent.right + } + iconName: "window-close" + onClicked: previewWindow.visible = false; + } + } + } }