diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f0200f..5dd9f10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ set(META_APP_DESCRIPTION "Tray application for Syncthing") set(META_APP_CATEGORIES "Network;FileTransfer") set(META_GUI_OPTIONAL false) set(META_VERSION_MAJOR 1) -set(META_VERSION_MINOR 0) -set(META_VERSION_PATCH 1) +set(META_VERSION_MINOR 1) +set(META_VERSION_PATCH 0) set(META_VERSION_EXACT_SONAME ON) set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON) diff --git a/plasmoid/CMakeLists.txt b/plasmoid/CMakeLists.txt index 340fba5..afee7be 100644 --- a/plasmoid/CMakeLists.txt +++ b/plasmoid/CMakeLists.txt @@ -23,8 +23,6 @@ set(PLASMOID_FILES package/contents/ui/ToolTipTrigger.qml package/contents/ui/ToolTipView.qml package/contents/ui/TinyButton.qml - package/contents/ui/TinyButtonStyle.qml - package/contents/ui/ButtonShadow.qml package/contents/ui/IconLabel.qml package/contents/ui/StatisticsView.qml package/contents/ui/main.qml) diff --git a/plasmoid/package/contents/ui/ButtonShadow.qml b/plasmoid/package/contents/ui/ButtonShadow.qml deleted file mode 100644 index 2e93e91..0000000 --- a/plasmoid/package/contents/ui/ButtonShadow.qml +++ /dev/null @@ -1,138 +0,0 @@ - -// Imported from Plasma 5.38.0 for TinyButtonStyle.qml which is a customized -// version of Plasma's ToolButtonStyle.qml - -/* - * Copyright (C) 2011 by Daker Fernandes Pinheiro - * Copyright (C) 2011 by Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. - */ - -/**Documented API -Inherits: - Item - -Imports: - QtQuick 2.1 - org.kde.plasma.core - -Description: -TODO i need more info here - - -Properties: -**/ -import QtQuick 2.1 -import org.kde.plasma.core 2.0 as PlasmaCore - -Item { - id: main - state: parent.state - //used to tell apart this implementation with the touch components one - property bool hasOverState: true - property alias enabledBorders: shadow.enabledBorders - - PlasmaCore.FrameSvgItem { - id: hover - - anchors { - fill: parent - leftMargin: -margins.left - topMargin: -margins.top - rightMargin: -margins.right - bottomMargin: -margins.bottom - } - opacity: 0 - imagePath: "widgets/button" - prefix: "hover" - } - - PlasmaCore.FrameSvgItem { - id: shadow - - anchors { - fill: parent - leftMargin: -margins.left - topMargin: -margins.top - rightMargin: -margins.right - bottomMargin: -margins.bottom - } - imagePath: "widgets/button" - prefix: "shadow" - } - - states: [ - State { - name: "shadow" - PropertyChanges { - target: shadow - opacity: 1 - } - PropertyChanges { - target: hover - opacity: 0 - prefix: "hover" - } - }, - State { - name: "hover" - PropertyChanges { - target: shadow - opacity: 0 - } - PropertyChanges { - target: hover - opacity: 1 - prefix: "hover" - } - }, - State { - name: "focus" - PropertyChanges { - target: shadow - opacity: 0 - } - PropertyChanges { - target: hover - opacity: 1 - prefix: "focus" - } - }, - State { - name: "hidden" - PropertyChanges { - target: shadow - opacity: 0 - } - PropertyChanges { - target: hover - opacity: 0 - prefix: "hover" - } - } - ] - - transitions: [ - Transition { - PropertyAnimation { - properties: "opacity" - duration: units.longDuration - easing.type: Easing.OutQuad - } - } - ] -} diff --git a/plasmoid/package/contents/ui/DetailItem.qml b/plasmoid/package/contents/ui/DetailItem.qml index 73cb7e5..f7b42da 100644 --- a/plasmoid/package/contents/ui/DetailItem.qml +++ b/plasmoid/package/contents/ui/DetailItem.qml @@ -1,7 +1,7 @@ import QtQuick 2.7 import QtQuick.Layouts 1.1 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 3.0 as PlasmaComponents3 Item { id: detailItem @@ -23,12 +23,12 @@ Item { Layout.preferredHeight: units.iconSizes.small opacity: 0.8 } - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.preferredWidth: 100 text: detailName font.weight: Font.DemiBold } - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.leftMargin: theme.defaultFont.pointSize * 0.9 Layout.fillWidth: true text: detailValue diff --git a/plasmoid/package/contents/ui/DetailView.qml b/plasmoid/package/contents/ui/DetailView.qml index 8b6595a..883fb30 100644 --- a/plasmoid/package/contents/ui/DetailView.qml +++ b/plasmoid/package/contents/ui/DetailView.qml @@ -1,5 +1,5 @@ import QtQuick 2.7 -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 2.0 as PlasmaComponents // for Menu and MenuItem ListView { id: detailView diff --git a/plasmoid/package/contents/ui/DevicesPage.qml b/plasmoid/package/contents/ui/DevicesPage.qml index 09bc0a2..bbc2789 100644 --- a/plasmoid/package/contents/ui/DevicesPage.qml +++ b/plasmoid/package/contents/ui/DevicesPage.qml @@ -1,8 +1,8 @@ import QtQuick 2.3 import QtQuick.Layouts 1.1 import QtQml.Models 2.2 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 2.0 as PlasmaComponents // for Menu and MenuItem +import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.extras 2.0 as PlasmaExtras @@ -40,7 +40,7 @@ Item { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft source: statusIcon } - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft elide: Text.ElideRight @@ -49,7 +49,7 @@ Item { RowLayout { id: toolButtonsLayout spacing: 0 - PlasmaComponents.Label { + PlasmaComponents3.Label { height: implicitHeight text: statusString color: statusColor ? statusColor : PlasmaCore.ColorScope.textColor @@ -60,7 +60,7 @@ Item { } TinyButton { id: resumePauseButton - icon: paused ? "media-playback-start" : "media-playback-pause" + icon.name: paused ? "media-playback-start" : "media-playback-pause" tooltip: paused ? qsTr("Resume") : qsTr("Pause") onClicked: { paused ? plasmoid.nativeInterface.connection.resumeDevice( diff --git a/plasmoid/package/contents/ui/DirectoriesPage.qml b/plasmoid/package/contents/ui/DirectoriesPage.qml index 976fee4..4e5c95d 100644 --- a/plasmoid/package/contents/ui/DirectoriesPage.qml +++ b/plasmoid/package/contents/ui/DirectoriesPage.qml @@ -1,8 +1,8 @@ import QtQuick 2.3 import QtQuick.Layouts 1.1 import QtQml.Models 2.2 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 2.0 as PlasmaComponents // for Menu and MenuItem +import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.extras 2.0 as PlasmaExtras import martchus.syncthingplasmoid 0.6 as SyncthingPlasmoid @@ -46,7 +46,7 @@ ColumnLayout { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft source: statusIcon } - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft elide: Text.ElideRight @@ -56,7 +56,7 @@ ColumnLayout { id: toolButtonsLayout spacing: 0 - PlasmaComponents.Label { + PlasmaComponents3.Label { height: implicitHeight text: statusString color: statusColor ? statusColor : PlasmaCore.ColorScope.textColor @@ -67,7 +67,7 @@ ColumnLayout { } TinyButton { id: errorsButton - icon: ":/icons/hicolor/scalable/emblems/emblem-important-old.svg" + icon.source: ":/icons/hicolor/scalable/emblems/emblem-important-old.svg" tooltip: qsTr("Show errors") visible: pullErrorCount > 0 onClicked: { @@ -78,7 +78,7 @@ ColumnLayout { } TinyButton { id: rescanButton - icon: "view-refresh" + icon.name: "view-refresh" tooltip: qsTr("Rescan") enabled: !paused onClicked: plasmoid.nativeInterface.connection.rescan( @@ -86,7 +86,7 @@ ColumnLayout { } TinyButton { id: resumePauseButton - icon: paused ? "media-playback-start" : "media-playback-pause" + icon.name: paused ? "media-playback-start" : "media-playback-pause" tooltip: paused ? qsTr("Resume") : qsTr("Pause") onClicked: { paused ? plasmoid.nativeInterface.connection.resumeDirectories( @@ -96,7 +96,7 @@ ColumnLayout { } TinyButton { id: openButton - icon: "folder" + icon.name: "folder" tooltip: qsTr("Open in file browser") onClicked: { Qt.openUrlExternally(path) @@ -171,7 +171,7 @@ ColumnLayout { } } - PlasmaComponents.TextField { + PlasmaComponents3.TextField { property bool explicitelyShown: false id: filter clearButtonShown: true diff --git a/plasmoid/package/contents/ui/DownloadsPage.qml b/plasmoid/package/contents/ui/DownloadsPage.qml index b04f7ae..8d86996 100644 --- a/plasmoid/package/contents/ui/DownloadsPage.qml +++ b/plasmoid/package/contents/ui/DownloadsPage.qml @@ -1,8 +1,8 @@ import QtQuick 2.3 import QtQuick.Layouts 1.1 import QtQml.Models 2.2 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 2.0 as PlasmaComponents // for Menu and MenuItem +import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.extras 2.0 as PlasmaExtras @@ -36,24 +36,24 @@ Item { RowLayout { spacing: units.smallSpacing - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft elide: Text.ElideRight text: name ? name : "?" } } - PlasmaComponents.ProgressBar { + PlasmaComponents3.ProgressBar { Layout.fillWidth: true Layout.fillHeight: true - minimumValue: 0 - maximumValue: 100 - value: percentage ? percentage : 0 + from: 0.0 + to: 100.0 + value: percentage ? percentage : 0.0 } RowLayout { id: toolButtonsLayout spacing: 0 - PlasmaComponents.Label { + PlasmaComponents3.Label { height: implicitHeight text: progressLabel ? progressLabel : "" Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft @@ -63,7 +63,7 @@ Item { } TinyButton { id: openButton - icon: "folder" + icon.name: "folder" tooltip: qsTr("Open in file browser") enabled: path !== undefined onClicked: { @@ -97,24 +97,24 @@ Item { RowLayout { spacing: units.smallSpacing Layout.fillWidth: true - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.fillWidth: true text: name font.pointSize: theme.defaultFont.pointSize * 0.8 elide: Text.ElideRight } - PlasmaComponents.Label { + PlasmaComponents3.Label { text: progressLabel font.pointSize: theme.defaultFont.pointSize * 0.8 elide: Text.ElideRight } } - PlasmaComponents.ProgressBar { + PlasmaComponents3.ProgressBar { Layout.fillWidth: true Layout.preferredHeight: 8 Layout.topMargin: 0 - minimumValue: 0 - maximumValue: 100 + from: 0.0 + to: 100.0 value: percentage } } diff --git a/plasmoid/package/contents/ui/FullRepresentation.qml b/plasmoid/package/contents/ui/FullRepresentation.qml index 126a773..30d2c52 100644 --- a/plasmoid/package/contents/ui/FullRepresentation.qml +++ b/plasmoid/package/contents/ui/FullRepresentation.qml @@ -1,11 +1,10 @@ -import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick 2.8 import QtQuick.Layouts 1.1 import QtQml 2.2 -import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.extras 2.0 as PlasmaExtras -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 2.0 as PlasmaComponents // for vertical TabBar +import org.kde.plasma.components 3.0 as PlasmaComponents3 import martchus.syncthingplasmoid 0.6 as SyncthingPlasmoid ColumnLayout { @@ -182,16 +181,15 @@ ColumnLayout { id: toolBar Layout.fillWidth: true - TinyButton { + PlasmaComponents3.ToolButton { id: connectButton - states: [ State { name: "disconnected" PropertyChanges { target: connectButton text: qsTr("Connect") - icon: "view-refresh" + icon.name: "view-refresh" visible: true } }, @@ -207,7 +205,7 @@ ColumnLayout { PropertyChanges { target: connectButton text: qsTr("Resume") - icon: "media-playback-start" + icon.name: "media-playback-start" visible: true } }, @@ -216,7 +214,7 @@ ColumnLayout { PropertyChanges { target: connectButton text: qsTr("Pause") - icon: "media-playback-pause" + icon.name: "media-playback-pause" visible: true } } @@ -233,7 +231,9 @@ ColumnLayout { return "idle" } } - tooltip: text + PlasmaComponents3.ToolTip { + text: connectButton.text + } onClicked: { switch (plasmoid.nativeInterface.connection.status) { case SyncthingPlasmoid.Data.Disconnected: @@ -249,14 +249,14 @@ ColumnLayout { break } } + Shortcut { sequence: "Ctrl+Shift+P" onActivated: connectButton.clicked() } } - TinyButton { + PlasmaComponents3.ToolButton { id: startStopButton - states: [ State { name: "running" @@ -264,9 +264,12 @@ ColumnLayout { target: startStopButton visible: true text: qsTr("Stop") - tooltip: (plasmoid.nativeInterface.service.userScope ? "systemctl --user stop " : "systemctl stop ") + icon.name: "process-stop" + } + PropertyChanges { + target: startStopToolTip + text: (plasmoid.nativeInterface.service.userScope ? "systemctl --user stop " : "systemctl stop ") + plasmoid.nativeInterface.service.unitName - icon: "process-stop" } }, State { @@ -275,9 +278,12 @@ ColumnLayout { target: startStopButton visible: true text: qsTr("Start") - tooltip: (plasmoid.nativeInterface.service.userScope ? "systemctl --user start " : "systemctl start ") + icon.name: "system-run" + } + PropertyChanges { + target: startStopToolTip + text: (plasmoid.nativeInterface.service.userScope ? "systemctl --user start " : "systemctl start ") + plasmoid.nativeInterface.service.unitName - icon: "system-run" } }, State { @@ -303,7 +309,9 @@ ColumnLayout { return service.running ? "running" : "stopped" } onClicked: plasmoid.nativeInterface.service.toggleRunning() - style: TinyButtonStyle {} + PlasmaComponents3.ToolTip { + id: startStopToolTip + } Shortcut { sequence: "Ctrl+Shift+S" onActivated: { @@ -316,15 +324,17 @@ ColumnLayout { Item { Layout.fillWidth: true } - TinyButton { + PlasmaComponents3.ToolButton { id: showNewNotifications - tooltip: qsTr("Show new notifications") - iconSource: "emblem-warning" + icon.name: "emblem-warning" visible: plasmoid.nativeInterface.notificationsAvailable onClicked: { plasmoid.nativeInterface.showNotificationsDialog() plasmoid.expanded = false } + PlasmaComponents3.ToolTip { + text: qsTr("Show new notifications") + } Shortcut { sequence: "Ctrl+N" onActivated: { @@ -334,119 +344,103 @@ ColumnLayout { } } } - TinyButton { - tooltip: qsTr("About Syncthing Tray") - icon: "help-about" + PlasmaComponents3.ToolButton { + icon.name: "help-about" + PlasmaComponents3.ToolTip { + text: qsTr("About Syncthing Tray") + } onClicked: { plasmoid.nativeInterface.showAboutDialog() plasmoid.expanded = false } } - TinyButton { + PlasmaComponents3.ToolButton { id: showOwnIdButton - tooltip: qsTr("Show own device ID") - icon: "view-barcode" + icon.name: "view-barcode" onClicked: { plasmoid.nativeInterface.showOwnDeviceId() plasmoid.expanded = false } + PlasmaComponents3.ToolTip { + text: qsTr("Show own device ID") + } Shortcut { sequence: "Ctrl+I" onActivated: showOwnIdButton.clicked() } } - TinyButton { + PlasmaComponents3.ToolButton { id: showLogButton - tooltip: qsTr("Show Syncthing log") - icon: "text-x-generic" + icon.name: "text-x-generic" onClicked: { plasmoid.nativeInterface.showLog() plasmoid.expanded = false } + PlasmaComponents3.ToolTip { + text: qsTr("Show Syncthing log") + } Shortcut { sequence: "Ctrl+L" onActivated: showLogButton.clicked() } } - TinyButton { + PlasmaComponents3.ToolButton { id: rescanAllDirsButton - tooltip: qsTr("Rescan all directories") - icon: "folder-sync" + icon.name: "folder-sync" onClicked: plasmoid.nativeInterface.connection.rescanAllDirs() + PlasmaComponents3.ToolTip { + text: qsTr("Rescan all directories") + } Shortcut { sequence: "Ctrl+Shift+R" onActivated: rescanAllDirsButton.clicked() } } - TinyButton { + PlasmaComponents3.ToolButton { id: settingsButton - tooltip: qsTr("Settings") - icon: "preferences-other" + icon.name: "preferences-other" onClicked: { plasmoid.nativeInterface.showSettingsDlg() plasmoid.expanded = false } + PlasmaComponents3.ToolTip { + text: qsTr("Settings") + } Shortcut { sequence: "Ctrl+S" onActivated: settingsButton.clicked() } } - TinyButton { + PlasmaComponents3.ToolButton { id: webUIButton - tooltip: qsTr("Open Syncthing") - icon: plasmoid.nativeInterface.syncthingIcon + // use PlasmaCore.IconItem for the icon because I wouldn't know how to show the QIcon otherwise + contentItem: PlasmaCore.IconItem { + source: plasmoid.nativeInterface.syncthingIcon + } + // set preferred size so the tool button is displayed consistently with the previous one despite using PlasmaCore.IconItem + Layout.preferredWidth: settingsButton.width + Layout.preferredHeight: settingsButton.height onClicked: { plasmoid.nativeInterface.showWebUI() plasmoid.expanded = false } + PlasmaComponents3.ToolTip { + text: qsTr("Open Syncthing") + } Shortcut { sequence: "Ctrl+W" onActivated: webUIButton.clicked() } } - TinyButton { - id: connectionsButton - text: plasmoid.nativeInterface.currentConnectionConfigName - icon: "network-connect" - paddingEnabled: true - enforceMenuArrow: true - onClicked: connectionConfigsMenu.toggle(x, y + height) + PlasmaComponents3.ComboBox { + id: connectionConfigsMenu + model: plasmoid.nativeInterface.connectionConfigNames visible: plasmoid.nativeInterface.connectionConfigNames.length > 1 + currentIndex: plasmoid.nativeInterface.currentConnectionConfigIndex + onCurrentIndexChanged: plasmoid.nativeInterface.currentConnectionConfigIndex = currentIndex Shortcut { sequence: "Ctrl+Shift+C" - onActivated: connectionsButton.clicked() - } - } - PlasmaComponents.Menu { - id: connectionConfigsMenu - function toggle(x, y) { - if (connectionConfigsMenu.status === PlasmaComponents.DialogStatus.Open) { - close() - return - } - var nativeInterface = plasmoid.nativeInterface - var configNames = nativeInterface.connectionConfigNames - var currentIndex = nativeInterface.currentConnectionConfigIndex - clearMenuItems() - for (var i = 0, count = configNames.length; i !== count; ++i) { - addMenuItem(menuItem.createObject(connectButton, { - "text": configNames[i], - "checked": i === currentIndex, - "index": i - })) - } - open(x, y) - } - } - Component { - id: menuItem - PlasmaComponents.MenuItem { - property int index: -1 - checkable: true - onClicked: { - plasmoid.nativeInterface.currentConnectionConfigIndex = index - connectionConfigsMenu.close() - } + onActivated: connectionConfigsMenu.popup() } } } @@ -537,25 +531,21 @@ ColumnLayout { PlasmaComponents.TabButton { id: dirsTabButton - //text: qsTr("Directories") iconSource: "folder-symbolic" tab: dirsPage } PlasmaComponents.TabButton { id: devsTabButton - //text: qsTr("Devices") iconSource: "network-server-symbolic" tab: devicesPage } PlasmaComponents.TabButton { id: downloadsTabButton - //text: qsTr("Downloads") iconSource: "folder-download-symbolic" tab: downloadsPage } PlasmaComponents.TabButton { id: recentChangesTabButton - //text: qsTr("Recent changes") iconSource: "document-open-recent-symbolic" tab: recentChangesPage } @@ -565,7 +555,7 @@ ColumnLayout { } TinyButton { id: searchButton - icon: "search" + icon.name: "search" enabled: mainTabGroup.currentTab === dirsPage tooltip: qsTr("Toggle filter") onClicked: { diff --git a/plasmoid/package/contents/ui/IconLabel.qml b/plasmoid/package/contents/ui/IconLabel.qml index 24dcbcd..969adef 100644 --- a/plasmoid/package/contents/ui/IconLabel.qml +++ b/plasmoid/package/contents/ui/IconLabel.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.1 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 3.0 as PlasmaComponents3 Item { property alias iconSource: iconItem.source @@ -22,11 +22,10 @@ Item { Layout.preferredHeight: 16 opacity: 0.7 } - PlasmaComponents.Label { + PlasmaComponents3.Label { id: label } } - ToolTipTrigger { id: tooltipTrigger anchors.fill: layout diff --git a/plasmoid/package/contents/ui/RecentChangesPage.qml b/plasmoid/package/contents/ui/RecentChangesPage.qml index b44d2f6..2b9f1b8 100644 --- a/plasmoid/package/contents/ui/RecentChangesPage.qml +++ b/plasmoid/package/contents/ui/RecentChangesPage.qml @@ -1,8 +1,8 @@ import QtQuick 2.3 import QtQuick.Layouts 1.1 import QtQml.Models 2.2 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 2.0 as PlasmaComponents // for Menu and MenuItem +import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.extras 2.0 as PlasmaExtras @@ -31,7 +31,7 @@ Item { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft source: actionIcon } - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.fillWidth: true elide: Text.ElideRight @@ -46,7 +46,7 @@ Item { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft source: "change-date-symbolic" } - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft elide: Text.ElideRight text: eventTime @@ -60,7 +60,7 @@ Item { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft source: "network-server-symbolic" } - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft elide: Text.ElideRight text: modifiedBy @@ -74,11 +74,11 @@ Item { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft source: itemType === "file" ? "view-refresh-symbolic" : "folder-sync" } - PlasmaComponents.Label { + PlasmaComponents3.Label { text: directoryId + ": " font.weight: Font.DemiBold } - PlasmaComponents.Label { + PlasmaComponents3.Label { Layout.fillWidth: true text: path elide: Text.ElideRight diff --git a/plasmoid/package/contents/ui/StatisticsView.qml b/plasmoid/package/contents/ui/StatisticsView.qml index 1cf7087..8dc3761 100644 --- a/plasmoid/package/contents/ui/StatisticsView.qml +++ b/plasmoid/package/contents/ui/StatisticsView.qml @@ -1,9 +1,6 @@ import QtQuick 2.7 import QtQuick.Layouts 1.1 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents - RowLayout { id: rowLayout property var statistics diff --git a/plasmoid/package/contents/ui/TinyButton.qml b/plasmoid/package/contents/ui/TinyButton.qml index 4bd34f3..6d14bff 100644 --- a/plasmoid/package/contents/ui/TinyButton.qml +++ b/plasmoid/package/contents/ui/TinyButton.qml @@ -1,14 +1,10 @@ -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 3.0 as PlasmaComponents3 -PlasmaComponents.ToolButton { - property int iconSize: units.iconSizes.small - property bool paddingEnabled: false - property bool enforceMenuArrow: false - - // define our own icon property and use that within the style to be able to set QIcon a directly - // note: The iconSource alias defined in org/kde/plasma/components/ToolButton.qml seems to break - // passing a QIcon as iconSource (instead of just the name of an icon) so it can not be used. - property var icon - - style: TinyButtonStyle {} +PlasmaComponents3.ToolButton { + property alias tooltip: tooltip.text + icon.width: units.iconSizes.small + icon.height: units.iconSizes.small + PlasmaComponents3.ToolTip { + id: tooltip + } } diff --git a/plasmoid/package/contents/ui/TinyButtonStyle.qml b/plasmoid/package/contents/ui/TinyButtonStyle.qml deleted file mode 100644 index dea870e..0000000 --- a/plasmoid/package/contents/ui/TinyButtonStyle.qml +++ /dev/null @@ -1,314 +0,0 @@ -// This is a simplified and adjusted version of Plasma's ToolButtonStyle. -// It will make the button only as big as required and allows to disable -// padding. This makes the button a little bit more compact. Additionally, -// the iconSource works also when a menu is present. The ButtonShadow.qml -// file is still used (version from Plasma 5.38.0). -import QtQuick 2.0 -import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle -import QtQuick.Layouts 1.1 -import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate - -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.extras 2.0 as PlasmaExtras -import org.kde.plasma.components 2.0 as PlasmaComponents - -QtQuickControlStyle.ButtonStyle { - id: style - - property int minimumWidth - property int minimumHeight - property bool flat: control.flat !== undefined ? control.flat : !(control.checkable - && control.checked) - property bool controlHovered: control.hovered - && !(QtQuickControlsPrivate.Settings.hasTouchScreen - && QtQuickControlsPrivate.Settings.isMobile) - property bool needsMenuArrow: control.menu || control.enforceMenuArrow - - label: RowLayout { - id: buttonContent - spacing: units.smallSpacing - - Layout.preferredWidth: Math.max(control.iconSize, label.implicitWidth) - Layout.preferredHeight: Math.max(control.iconSize, label.implicitHeight) - - PlasmaCore.IconItem { - id: icon - source: control.icon - Layout.preferredWidth: control.iconSize - Layout.preferredHeight: control.iconSize - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - active: style.controlHovered - colorGroup: controlHovered - || !flat ? PlasmaCore.Theme.ButtonColorGroup : PlasmaCore.ColorScope.colorGroup - } - - //NOTE: this is used only to check elements existence - PlasmaCore.FrameSvgItem { - id: buttonsurfaceChecker - visible: false - imagePath: "widgets/button" - prefix: style.flat ? ["toolbutton-hover", "normal"] : "normal" - } - - PlasmaComponents.Label { - id: label - Layout.alignment: Qt.AlignVCenter - text: control.text - textFormat: Text.StyledText - font: control.font || theme.defaultFont - visible: control.text !== "" - Layout.fillWidth: true - color: (controlHovered || !flat) && buttonsurfaceChecker.usedPrefix - !== "toolbutton-hover" ? theme.buttonTextColor : PlasmaCore.ColorScope.textColor - horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter - elide: Text.ElideRight - } - - PlasmaExtras.ConditionalLoader { - id: arrow - when: needsMenuArrow - visible: when - Layout.preferredWidth: units.iconSizes.small - Layout.preferredHeight: units.iconSizes.small - - source: Component { - PlasmaCore.SvgItem { - visible: needsMenuArrow - svg: PlasmaCore.Svg { - imagePath: "widgets/arrows" - colorGroup: (style.controlHovered || !style.flat) - && buttonsurfaceChecker.usedPrefix - !== "toolbutton-hover" ? PlasmaCore.Theme.ButtonColorGroup : PlasmaCore.ColorScope.colorGroup - } - elementId: "down-arrow" - } - } - } - } - - background: Item { - id: buttonSurface - - Connections { - target: control - onHoveredChanged: { - if (style.controlHovered) { - control.z += 2 - } else { - control.z -= 2 - } - } - } - - ButtonShadow { - id: shadow - visible: !style.flat || control.activeFocus - anchors.fill: parent - enabledBorders: surfaceNormal.enabledBorders - state: { - if (control.pressed) { - return "hidden" - } else if (style.controlHovered) { - return "hover" - } else if (control.activeFocus) { - return "focus" - } else { - return "shadow" - } - } - } - - PlasmaCore.FrameSvgItem { - id: surfaceNormal - anchors.fill: parent - imagePath: "widgets/button" - prefix: style.flat ? ["toolbutton-hover", "normal"] : "normal" - - enabledBorders: { - if (style.flat || !control.parent - || control.parent.width < control.parent.implicitWidth - || control.parent.spacing !== 0 - || !bordersSvg.hasElement( - "pressed-hint-compose-over-border")) { - if (shadows !== null) { - shadows.destroy() - } - return "AllBorders" - } - - var borders = [] - if (control.x === 0) { - borders.push("LeftBorder") - shadow.anchors.leftMargin = 0 - } else { - shadow.anchors.leftMargin = -1 - } - if (control.y === 0) { - borders.push("TopBorder") - shadow.anchors.topMargin = 0 - } else { - shadow.anchors.topMargin = -1 - } - if (control.x + control.width >= control.parent.width) { - borders.push("RightBorder") - shadow.anchors.rightMargin = 0 - } else { - shadow.anchors.rightMargin = -1 - } - if (control.y + control.height >= control.parent.height) { - borders.push("BottomBorder") - shadow.anchors.bottomMargin = 0 - } else { - shadow.anchors.bottomMargin = -1 - } - - if (shadows === null) { - shadows = shadowsComponent.createObject(buttonSurface) - } - - return borders.join("|") - } - - PlasmaCore.Svg { - id: bordersSvg - imagePath: "widgets/button" - } - } - - PlasmaCore.FrameSvgItem { - id: surfacePressed - anchors.fill: parent - imagePath: "widgets/button" - prefix: style.flat ? ["toolbutton-pressed", "pressed"] : "pressed" - enabledBorders: surfaceNormal.enabledBorders - opacity: 0 - } - - property Item shadows - Component { - id: shadowsComponent - Item { - anchors.fill: parent - - PlasmaCore.SvgItem { - svg: bordersSvg - width: naturalSize.width - elementId: (buttonSurface.state == "pressed" ? surfacePressed.prefix : surfaceNormal.prefix) + "-left" - visible: button.x > 0 - anchors { - left: parent.left - top: parent.top - bottom: parent.bottom - margins: 1 - leftMargin: -1 - } - } - PlasmaCore.SvgItem { - svg: bordersSvg - width: naturalSize.width - elementId: (buttonSurface.state == "pressed" ? surfacePressed.prefix : surfaceNormal.prefix) + "-right" - visible: button.x + button.width < button.parent.width - anchors { - right: parent.right - top: parent.top - bottom: parent.bottom - margins: 1 - rightMargin: -1 - } - } - PlasmaCore.SvgItem { - svg: bordersSvg - height: naturalSize.height - elementId: (buttonSurface.state == "pressed" ? surfacePressed.prefix : surfaceNormal.prefix) + "-top" - visible: button.y > 0 - anchors { - left: parent.left - top: parent.top - right: parent.right - margins: 1 - topMargin: -1 - } - } - PlasmaCore.SvgItem { - svg: bordersSvg - height: naturalSize.height - elementId: (buttonSurface.state == "pressed" ? surfacePressed.prefix : surfaceNormal.prefix) + "-bottom" - visible: button.y + button.height < button.parent.height - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - margins: 1 - bottomMargin: -1 - } - } - } - } - - state: (control.pressed - || control.checked ? "pressed" : (style.controlHovered ? "hover" : "normal")) - - states: [ - State { - name: "normal" - PropertyChanges { - target: surfaceNormal - opacity: style.flat ? 0 : 1 - } - PropertyChanges { - target: surfacePressed - opacity: 0 - } - }, - State { - name: "hover" - PropertyChanges { - target: surfaceNormal - opacity: 1 - } - PropertyChanges { - target: surfacePressed - opacity: 0 - } - }, - State { - name: "pressed" - PropertyChanges { - target: surfaceNormal - opacity: 0 - } - PropertyChanges { - target: surfacePressed - opacity: 1 - } - } - ] - - transitions: [ - Transition { - // Cross fade from pressed to normal - ParallelAnimation { - NumberAnimation { - target: surfaceNormal - property: "opacity" - duration: 100 - } - NumberAnimation { - target: surfacePressed - property: "opacity" - duration: 100 - } - } - } - ] - - Component.onCompleted: { - if (control.paddingEnabled) { - padding.top = surfaceNormal.margins.top - padding.left = surfaceNormal.margins.left - padding.right = surfaceNormal.margins.right - padding.bottom = surfaceNormal.margins.bottom - } - } - } -} diff --git a/plasmoid/package/contents/ui/ToolTipTrigger.qml b/plasmoid/package/contents/ui/ToolTipTrigger.qml index d128745..6141503 100644 --- a/plasmoid/package/contents/ui/ToolTipTrigger.qml +++ b/plasmoid/package/contents/ui/ToolTipTrigger.qml @@ -1,17 +1,17 @@ import QtQuick 2.0 -import QtQuick.Controls.Private 1.0 as ControlsPrivate // Why is such a basic thing as a tooltip private?! Let's be evil and just use it. +import org.kde.plasma.components 3.0 as PlasmaComponents3 MouseArea { property alias interval: timer.interval - property string tooltip: "" + property alias tooltip: tooltip.text hoverEnabled: true Timer { id: timer interval: 1000 running: parent.containsMouse && parent.tooltip.length !== 0 - onTriggered: ControlsPrivate.Tooltip.showText(parent, - Qt.point(parent.mouseX, - parent.mouseY), - parent.tooltip) + onTriggered: tooltip.open() + } + PlasmaComponents3.ToolTip { + id: tooltip } } diff --git a/plasmoid/package/contents/ui/ToolTipView.qml b/plasmoid/package/contents/ui/ToolTipView.qml index bdf42c2..0b7de55 100644 --- a/plasmoid/package/contents/ui/ToolTipView.qml +++ b/plasmoid/package/contents/ui/ToolTipView.qml @@ -1,8 +1,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.1 -import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.extras 2.0 as PlasmaExtras RowLayout { @@ -29,8 +28,7 @@ RowLayout { elide: Text.ElideRight text: plasmoid.toolTipMainText } - - PlasmaComponents.Label { + PlasmaComponents3.Label { id: tooltipSubtext text: plasmoid.toolTipSubText opacity: 0.6 diff --git a/plasmoid/package/contents/ui/TopLevelItem.qml b/plasmoid/package/contents/ui/TopLevelItem.qml index a2a5dfd..2e7cd32 100644 --- a/plasmoid/package/contents/ui/TopLevelItem.qml +++ b/plasmoid/package/contents/ui/TopLevelItem.qml @@ -4,7 +4,6 @@ // loop of width and height properties.) import QtQuick 2.7 import QtQuick.Layouts 1.1 -import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore Item { diff --git a/plasmoid/package/contents/ui/TopLevelView.qml b/plasmoid/package/contents/ui/TopLevelView.qml index e6da72a..5b08d39 100644 --- a/plasmoid/package/contents/ui/TopLevelView.qml +++ b/plasmoid/package/contents/ui/TopLevelView.qml @@ -1,6 +1,5 @@ import QtQuick 2.7 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 2.0 as PlasmaComponents // for Highlight and DialogStatus.Closed (used with Menu and MenuItem) ListView { anchors.fill: parent