From abf1dd074894dc9bb0606db206efe7d3704b8cc7 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 16 Sep 2023 23:09:10 +0200 Subject: [PATCH] Rename `SyncthingDeviceModel::IsOwnDevice` in accordance with recent UI changes --- plasmoid/package5/contents/ui/DevicesPage.qml | 2 +- plasmoid/package6/contents/ui/DevicesPage.qml | 2 +- syncthingmodel/syncthingdevicemodel.cpp | 8 ++++---- syncthingmodel/syncthingdevicemodel.h | 2 +- tray/gui/devbuttonsitemdelegate.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plasmoid/package5/contents/ui/DevicesPage.qml b/plasmoid/package5/contents/ui/DevicesPage.qml index 6de4809..9a1e5df 100644 --- a/plasmoid/package5/contents/ui/DevicesPage.qml +++ b/plasmoid/package5/contents/ui/DevicesPage.qml @@ -62,7 +62,7 @@ Item { icon.source: plasmoid.nativeInterface.faUrl + (paused ? "play" : "pause") icon.cache: false tooltip: paused ? qsTr("Resume") : qsTr("Pause") - enabled: !isOwnDevice + enabled: !isThisDevice onClicked: { paused ? plasmoid.nativeInterface.connection.resumeDevice( [devId]) : plasmoid.nativeInterface.connection.pauseDevice( diff --git a/plasmoid/package6/contents/ui/DevicesPage.qml b/plasmoid/package6/contents/ui/DevicesPage.qml index 4f6f2a1..06e253d 100644 --- a/plasmoid/package6/contents/ui/DevicesPage.qml +++ b/plasmoid/package6/contents/ui/DevicesPage.qml @@ -63,7 +63,7 @@ Item { icon.source: plasmoid.faUrl + (paused ? "play" : "pause") icon.cache: false tooltip: paused ? qsTr("Resume") : qsTr("Pause") - enabled: !isOwnDevice + enabled: !isThisDevice onClicked: { paused ? plasmoid.connection.resumeDevice( [devId]) : plasmoid.connection.pauseDevice( diff --git a/syncthingmodel/syncthingdevicemodel.cpp b/syncthingmodel/syncthingdevicemodel.cpp index 5c79077..506f120 100644 --- a/syncthingmodel/syncthingdevicemodel.cpp +++ b/syncthingmodel/syncthingdevicemodel.cpp @@ -28,7 +28,7 @@ QHash SyncthingDeviceModel::roleNames() const { DeviceStatus, "status" }, { Qt::DecorationRole, "statusIcon" }, { DevicePaused, "paused" }, - { IsOwnDevice, "isOwnDevice" }, + { IsThisDevice, "isThisDevice" }, { IsPinned, "isPinned" }, { DeviceStatusString, "statusString" }, { DeviceStatusColor, "statusColor" }, @@ -300,7 +300,7 @@ QVariant SyncthingDeviceModel::data(const QModelIndex &index, int role) const } break; case IsPinned: - case IsOwnDevice: + case IsThisDevice: return dev.status == SyncthingDevStatus::ThisDevice; case DeviceStatus: return static_cast(dev.status); @@ -352,8 +352,8 @@ int SyncthingDeviceModel::columnCount(const QModelIndex &parent) const void SyncthingDeviceModel::devStatusChanged(const SyncthingDev &, int index) { const QModelIndex modelIndex1(this->index(index, 0, QModelIndex())); - static const QVector modelRoles1( - { Qt::DisplayRole, Qt::EditRole, Qt::DecorationRole, DevicePaused, DeviceStatus, DeviceStatusString, DeviceStatusColor, DeviceId }); + static const QVector modelRoles1({ Qt::DisplayRole, Qt::EditRole, Qt::DecorationRole, DevicePaused, DeviceStatus, DeviceStatusString, + DeviceStatusColor, DeviceId, IsThisDevice, IsPinned }); emit dataChanged(modelIndex1, modelIndex1, modelRoles1); const QModelIndex modelIndex2(this->index(index, 1, QModelIndex())); static const QVector modelRoles2({ Qt::DisplayRole, Qt::EditRole, Qt::ForegroundRole }); diff --git a/syncthingmodel/syncthingdevicemodel.h b/syncthingmodel/syncthingdevicemodel.h index 43a5aec..79997f3 100644 --- a/syncthingmodel/syncthingdevicemodel.h +++ b/syncthingmodel/syncthingdevicemodel.h @@ -17,7 +17,7 @@ public: enum SyncthingDeviceModelRole { DeviceStatus = SyncthingModelUserRole + 1, DevicePaused, - IsOwnDevice, + IsThisDevice, DeviceStatusString, DeviceStatusColor, DeviceId, diff --git a/tray/gui/devbuttonsitemdelegate.cpp b/tray/gui/devbuttonsitemdelegate.cpp index a94899b..a86087e 100644 --- a/tray/gui/devbuttonsitemdelegate.cpp +++ b/tray/gui/devbuttonsitemdelegate.cpp @@ -53,7 +53,7 @@ void DevButtonsItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem painter->drawText(textRect, displayText(index.data(Qt::DisplayRole), option.locale), textOption); // draw buttons - if (index.data(SyncthingDeviceModel::IsOwnDevice).toBool()) { + if (index.data(SyncthingDeviceModel::IsThisDevice).toBool()) { return; } const int buttonY = option.rect.y() + centerObj(option.rect.height(), 16);