Use idle status icon for button to open Syncthing web UI
That looks more consistent, especially when using a dark color theme where the default Syncthing icon doesn't fit in very well.
This commit is contained in:
parent
159255441e
commit
ed4d1fc213
|
@ -11,7 +11,7 @@ set(META_APP_CATEGORIES "Network;FileTransfer")
|
|||
set(META_GUI_OPTIONAL false)
|
||||
set(META_VERSION_MAJOR 0)
|
||||
set(META_VERSION_MINOR 10)
|
||||
set(META_VERSION_PATCH 8)
|
||||
set(META_VERSION_PATCH 9)
|
||||
set(META_VERSION_EXACT_SONAME ON)
|
||||
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)
|
||||
|
||||
|
|
|
@ -132,6 +132,11 @@ QIcon SyncthingApplet::statusIcon() const
|
|||
return m_statusInfo.statusIcon();
|
||||
}
|
||||
|
||||
QIcon SyncthingApplet::syncthingIcon() const
|
||||
{
|
||||
return statusIcons().idling;
|
||||
}
|
||||
|
||||
QString SyncthingApplet::incomingTraffic() const
|
||||
{
|
||||
return trafficString(m_connection.totalIncomingTraffic(), m_connection.totalIncomingRate());
|
||||
|
|
|
@ -47,6 +47,7 @@ class SyncthingApplet : public Plasma::Applet {
|
|||
Q_PROPERTY(QString statusText READ statusText NOTIFY connectionStatusChanged)
|
||||
Q_PROPERTY(QString additionalStatusText READ additionalStatusText NOTIFY connectionStatusChanged)
|
||||
Q_PROPERTY(QIcon statusIcon READ statusIcon NOTIFY connectionStatusChanged)
|
||||
Q_PROPERTY(QIcon syncthingIcon READ syncthingIcon NOTIFY settingsChanged)
|
||||
Q_PROPERTY(QString incomingTraffic READ incomingTraffic NOTIFY trafficChanged)
|
||||
Q_PROPERTY(bool hasIncomingTraffic READ hasIncomingTraffic NOTIFY trafficChanged)
|
||||
Q_PROPERTY(QString outgoingTraffic READ outgoingTraffic NOTIFY trafficChanged)
|
||||
|
@ -79,6 +80,7 @@ public:
|
|||
QString statusText() const;
|
||||
QString additionalStatusText() const;
|
||||
QIcon statusIcon() const;
|
||||
QIcon syncthingIcon() const;
|
||||
QString incomingTraffic() const;
|
||||
bool hasIncomingTraffic() const;
|
||||
QString outgoingTraffic() const;
|
||||
|
|
|
@ -56,7 +56,7 @@ Item {
|
|||
}
|
||||
TinyButton {
|
||||
id: resumePauseButton
|
||||
iconSource: paused ? "media-playback-start" : "media-playback-pause"
|
||||
icon: paused ? "media-playback-start" : "media-playback-pause"
|
||||
tooltip: paused ? qsTr("Resume") : qsTr("Pause")
|
||||
onClicked: {
|
||||
paused ? plasmoid.nativeInterface.connection.resumeDevice(
|
||||
|
|
|
@ -71,7 +71,7 @@ ColumnLayout {
|
|||
}
|
||||
TinyButton {
|
||||
id: errorsButton
|
||||
iconSource: ":/icons/hicolor/scalable/emblems/emblem-important-old.svg"
|
||||
icon: ":/icons/hicolor/scalable/emblems/emblem-important-old.svg"
|
||||
tooltip: qsTr("Show errors")
|
||||
visible: pullErrorCount > 0
|
||||
onClicked: {
|
||||
|
@ -82,7 +82,7 @@ ColumnLayout {
|
|||
}
|
||||
TinyButton {
|
||||
id: rescanButton
|
||||
iconSource: "view-refresh"
|
||||
icon: "view-refresh"
|
||||
tooltip: qsTr("Rescan")
|
||||
enabled: !paused
|
||||
onClicked: plasmoid.nativeInterface.connection.rescan(
|
||||
|
@ -90,7 +90,7 @@ ColumnLayout {
|
|||
}
|
||||
TinyButton {
|
||||
id: resumePauseButton
|
||||
iconSource: paused ? "media-playback-start" : "media-playback-pause"
|
||||
icon: paused ? "media-playback-start" : "media-playback-pause"
|
||||
tooltip: paused ? qsTr("Resume") : qsTr("Pause")
|
||||
onClicked: {
|
||||
paused ? plasmoid.nativeInterface.connection.resumeDirectories(
|
||||
|
@ -100,7 +100,7 @@ ColumnLayout {
|
|||
}
|
||||
TinyButton {
|
||||
id: openButton
|
||||
iconSource: "folder"
|
||||
icon: "folder"
|
||||
tooltip: qsTr("Open in file browser")
|
||||
onClicked: {
|
||||
Qt.openUrlExternally(path)
|
||||
|
|
|
@ -60,7 +60,7 @@ Item {
|
|||
}
|
||||
TinyButton {
|
||||
id: openButton
|
||||
iconSource: "folder"
|
||||
icon: "folder"
|
||||
tooltip: qsTr("Open in file browser")
|
||||
enabled: path !== undefined
|
||||
onClicked: {
|
||||
|
@ -116,7 +116,7 @@ Item {
|
|||
}
|
||||
}
|
||||
TinyButton {
|
||||
iconSource: "folder"
|
||||
icon: "folder"
|
||||
tooltip: qsTr("Open in file browser")
|
||||
onClicked: {
|
||||
Qt.openUrlExternally(path + "/..")
|
||||
|
|
|
@ -186,7 +186,7 @@ ColumnLayout {
|
|||
PropertyChanges {
|
||||
target: connectButton
|
||||
text: qsTr("Connect")
|
||||
iconSource: "view-refresh"
|
||||
icon: "view-refresh"
|
||||
}
|
||||
},
|
||||
State {
|
||||
|
@ -194,7 +194,7 @@ ColumnLayout {
|
|||
PropertyChanges {
|
||||
target: connectButton
|
||||
text: qsTr("Resume")
|
||||
iconSource: "media-playback-start"
|
||||
icon: "media-playback-start"
|
||||
}
|
||||
},
|
||||
State {
|
||||
|
@ -202,7 +202,7 @@ ColumnLayout {
|
|||
PropertyChanges {
|
||||
target: connectButton
|
||||
text: qsTr("Pause")
|
||||
iconSource: "media-playback-pause"
|
||||
icon: "media-playback-pause"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -249,7 +249,7 @@ ColumnLayout {
|
|||
text: qsTr("Stop")
|
||||
tooltip: (plasmoid.nativeInterface.service.userScope ? "systemctl --user stop " : "systemctl stop ")
|
||||
+ plasmoid.nativeInterface.service.unitName
|
||||
iconSource: "process-stop"
|
||||
icon: "process-stop"
|
||||
}
|
||||
},
|
||||
State {
|
||||
|
@ -260,7 +260,7 @@ ColumnLayout {
|
|||
text: qsTr("Start")
|
||||
tooltip: (plasmoid.nativeInterface.service.userScope ? "systemctl --user start " : "systemctl start ")
|
||||
+ plasmoid.nativeInterface.service.unitName
|
||||
iconSource: "system-run"
|
||||
icon: "system-run"
|
||||
}
|
||||
},
|
||||
State {
|
||||
|
@ -286,8 +286,7 @@ ColumnLayout {
|
|||
return service.running ? "running" : "stopped"
|
||||
}
|
||||
onClicked: plasmoid.nativeInterface.service.toggleRunning()
|
||||
style: TinyButtonStyle {
|
||||
}
|
||||
style: TinyButtonStyle {}
|
||||
Shortcut {
|
||||
sequence: "Ctrl+Shift+S"
|
||||
onActivated: {
|
||||
|
@ -320,7 +319,7 @@ ColumnLayout {
|
|||
}
|
||||
TinyButton {
|
||||
tooltip: qsTr("About Syncthing Tray")
|
||||
iconSource: "help-about"
|
||||
icon: "help-about"
|
||||
onClicked: {
|
||||
plasmoid.nativeInterface.showAboutDialog()
|
||||
plasmoid.expanded = false
|
||||
|
@ -329,7 +328,7 @@ ColumnLayout {
|
|||
TinyButton {
|
||||
id: showOwnIdButton
|
||||
tooltip: qsTr("Show own device ID")
|
||||
iconSource: "view-barcode"
|
||||
icon: "view-barcode"
|
||||
onClicked: {
|
||||
plasmoid.nativeInterface.showOwnDeviceId()
|
||||
plasmoid.expanded = false
|
||||
|
@ -342,7 +341,7 @@ ColumnLayout {
|
|||
TinyButton {
|
||||
id: showLogButton
|
||||
tooltip: qsTr("Show Syncthing log")
|
||||
iconSource: "text-x-generic"
|
||||
icon: "text-x-generic"
|
||||
onClicked: {
|
||||
plasmoid.nativeInterface.showLog()
|
||||
plasmoid.expanded = false
|
||||
|
@ -355,7 +354,7 @@ ColumnLayout {
|
|||
TinyButton {
|
||||
id: rescanAllDirsButton
|
||||
tooltip: qsTr("Rescan all directories")
|
||||
iconSource: "folder-sync"
|
||||
icon: "folder-sync"
|
||||
onClicked: plasmoid.nativeInterface.connection.rescanAllDirs()
|
||||
Shortcut {
|
||||
sequence: "Ctrl+Shift+R"
|
||||
|
@ -365,7 +364,7 @@ ColumnLayout {
|
|||
TinyButton {
|
||||
id: settingsButton
|
||||
tooltip: qsTr("Settings")
|
||||
iconSource: "preferences-other"
|
||||
icon: "preferences-other"
|
||||
onClicked: {
|
||||
plasmoid.nativeInterface.showSettingsDlg()
|
||||
plasmoid.expanded = false
|
||||
|
@ -378,7 +377,7 @@ ColumnLayout {
|
|||
TinyButton {
|
||||
id: webUIButton
|
||||
tooltip: qsTr("Open Syncthing")
|
||||
iconSource: ":/icons/hicolor/scalable/status/syncthing-default.svg"
|
||||
icon: plasmoid.nativeInterface.syncthingIcon
|
||||
onClicked: {
|
||||
plasmoid.nativeInterface.showWebUI()
|
||||
plasmoid.expanded = false
|
||||
|
@ -390,7 +389,7 @@ ColumnLayout {
|
|||
}
|
||||
TinyButton {
|
||||
text: plasmoid.nativeInterface.currentConnectionConfigName
|
||||
iconSource: "network-connect"
|
||||
icon: "network-connect"
|
||||
paddingEnabled: true
|
||||
// FIXME: figure out why menu doesn't work in plasmoidviewer using NVIDIA driver
|
||||
// (works with plasmawindowed and plasmashell or always when using Intel graphics)
|
||||
|
@ -529,14 +528,13 @@ ColumnLayout {
|
|||
iconSource: "document-open-recent-symbolic"
|
||||
tab: recentChangesPage
|
||||
}
|
||||
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
TinyButton {
|
||||
id: searchButton
|
||||
iconSource: "search"
|
||||
icon: "search"
|
||||
enabled: mainTabGroup.currentTab === dirsPage
|
||||
tooltip: qsTr("Toggle filter")
|
||||
onClicked: {
|
||||
|
|
|
@ -4,6 +4,10 @@ PlasmaComponents.ToolButton {
|
|||
property int iconSize: units.iconSizes.small
|
||||
property bool paddingEnabled: false
|
||||
|
||||
style: TinyButtonStyle {
|
||||
}
|
||||
// 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 {}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ QtQuickControlStyle.ButtonStyle {
|
|||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
source: control.iconName || control.iconSource
|
||||
source: control.icon
|
||||
Layout.preferredWidth: control.iconSize
|
||||
Layout.preferredHeight: control.iconSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
|
|
|
@ -485,6 +485,7 @@ void TrayWidget::applySettings(const QString &connectionConfig)
|
|||
m_dlModel.setBrightColors(brightColors);
|
||||
m_recentChangesModel.setBrightColors(brightColors);
|
||||
IconManager::instance().applySettings(&settings.icons.status, settings.icons.distinguishTrayIcons ? &settings.icons.tray : nullptr);
|
||||
m_ui->webUiPushButton->setIcon(statusIcons().idling);
|
||||
|
||||
// update status icon and text of tray icon because reconnect interval might have changed
|
||||
if (m_menu && m_menu->icon()) {
|
||||
|
|
|
@ -126,10 +126,6 @@
|
|||
<property name="toolTip">
|
||||
<string>Open Syncthing</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../model/resources/syncthingmodelicons.qrc">
|
||||
<normaloff>:/icons/hicolor/scalable/status/syncthing-default.svg</normaloff>:/icons/hicolor/scalable/status/syncthing-default.svg</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
Loading…
Reference in New Issue