Rename `SyncthingDeviceModel::IsOwnDevice` in accordance with recent UI changes
This commit is contained in:
parent
f5795d45c2
commit
abf1dd0748
|
@ -62,7 +62,7 @@ Item {
|
||||||
icon.source: plasmoid.nativeInterface.faUrl + (paused ? "play" : "pause")
|
icon.source: plasmoid.nativeInterface.faUrl + (paused ? "play" : "pause")
|
||||||
icon.cache: false
|
icon.cache: false
|
||||||
tooltip: paused ? qsTr("Resume") : qsTr("Pause")
|
tooltip: paused ? qsTr("Resume") : qsTr("Pause")
|
||||||
enabled: !isOwnDevice
|
enabled: !isThisDevice
|
||||||
onClicked: {
|
onClicked: {
|
||||||
paused ? plasmoid.nativeInterface.connection.resumeDevice(
|
paused ? plasmoid.nativeInterface.connection.resumeDevice(
|
||||||
[devId]) : plasmoid.nativeInterface.connection.pauseDevice(
|
[devId]) : plasmoid.nativeInterface.connection.pauseDevice(
|
||||||
|
|
|
@ -63,7 +63,7 @@ Item {
|
||||||
icon.source: plasmoid.faUrl + (paused ? "play" : "pause")
|
icon.source: plasmoid.faUrl + (paused ? "play" : "pause")
|
||||||
icon.cache: false
|
icon.cache: false
|
||||||
tooltip: paused ? qsTr("Resume") : qsTr("Pause")
|
tooltip: paused ? qsTr("Resume") : qsTr("Pause")
|
||||||
enabled: !isOwnDevice
|
enabled: !isThisDevice
|
||||||
onClicked: {
|
onClicked: {
|
||||||
paused ? plasmoid.connection.resumeDevice(
|
paused ? plasmoid.connection.resumeDevice(
|
||||||
[devId]) : plasmoid.connection.pauseDevice(
|
[devId]) : plasmoid.connection.pauseDevice(
|
||||||
|
|
|
@ -28,7 +28,7 @@ QHash<int, QByteArray> SyncthingDeviceModel::roleNames() const
|
||||||
{ DeviceStatus, "status" },
|
{ DeviceStatus, "status" },
|
||||||
{ Qt::DecorationRole, "statusIcon" },
|
{ Qt::DecorationRole, "statusIcon" },
|
||||||
{ DevicePaused, "paused" },
|
{ DevicePaused, "paused" },
|
||||||
{ IsOwnDevice, "isOwnDevice" },
|
{ IsThisDevice, "isThisDevice" },
|
||||||
{ IsPinned, "isPinned" },
|
{ IsPinned, "isPinned" },
|
||||||
{ DeviceStatusString, "statusString" },
|
{ DeviceStatusString, "statusString" },
|
||||||
{ DeviceStatusColor, "statusColor" },
|
{ DeviceStatusColor, "statusColor" },
|
||||||
|
@ -300,7 +300,7 @@ QVariant SyncthingDeviceModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IsPinned:
|
case IsPinned:
|
||||||
case IsOwnDevice:
|
case IsThisDevice:
|
||||||
return dev.status == SyncthingDevStatus::ThisDevice;
|
return dev.status == SyncthingDevStatus::ThisDevice;
|
||||||
case DeviceStatus:
|
case DeviceStatus:
|
||||||
return static_cast<int>(dev.status);
|
return static_cast<int>(dev.status);
|
||||||
|
@ -352,8 +352,8 @@ int SyncthingDeviceModel::columnCount(const QModelIndex &parent) const
|
||||||
void SyncthingDeviceModel::devStatusChanged(const SyncthingDev &, int index)
|
void SyncthingDeviceModel::devStatusChanged(const SyncthingDev &, int index)
|
||||||
{
|
{
|
||||||
const QModelIndex modelIndex1(this->index(index, 0, QModelIndex()));
|
const QModelIndex modelIndex1(this->index(index, 0, QModelIndex()));
|
||||||
static const QVector<int> modelRoles1(
|
static const QVector<int> modelRoles1({ Qt::DisplayRole, Qt::EditRole, Qt::DecorationRole, DevicePaused, DeviceStatus, DeviceStatusString,
|
||||||
{ Qt::DisplayRole, Qt::EditRole, Qt::DecorationRole, DevicePaused, DeviceStatus, DeviceStatusString, DeviceStatusColor, DeviceId });
|
DeviceStatusColor, DeviceId, IsThisDevice, IsPinned });
|
||||||
emit dataChanged(modelIndex1, modelIndex1, modelRoles1);
|
emit dataChanged(modelIndex1, modelIndex1, modelRoles1);
|
||||||
const QModelIndex modelIndex2(this->index(index, 1, QModelIndex()));
|
const QModelIndex modelIndex2(this->index(index, 1, QModelIndex()));
|
||||||
static const QVector<int> modelRoles2({ Qt::DisplayRole, Qt::EditRole, Qt::ForegroundRole });
|
static const QVector<int> modelRoles2({ Qt::DisplayRole, Qt::EditRole, Qt::ForegroundRole });
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
enum SyncthingDeviceModelRole {
|
enum SyncthingDeviceModelRole {
|
||||||
DeviceStatus = SyncthingModelUserRole + 1,
|
DeviceStatus = SyncthingModelUserRole + 1,
|
||||||
DevicePaused,
|
DevicePaused,
|
||||||
IsOwnDevice,
|
IsThisDevice,
|
||||||
DeviceStatusString,
|
DeviceStatusString,
|
||||||
DeviceStatusColor,
|
DeviceStatusColor,
|
||||||
DeviceId,
|
DeviceId,
|
||||||
|
|
|
@ -53,7 +53,7 @@ void DevButtonsItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||||
painter->drawText(textRect, displayText(index.data(Qt::DisplayRole), option.locale), textOption);
|
painter->drawText(textRect, displayText(index.data(Qt::DisplayRole), option.locale), textOption);
|
||||||
|
|
||||||
// draw buttons
|
// draw buttons
|
||||||
if (index.data(SyncthingDeviceModel::IsOwnDevice).toBool()) {
|
if (index.data(SyncthingDeviceModel::IsThisDevice).toBool()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const int buttonY = option.rect.y() + centerObj(option.rect.height(), 16);
|
const int buttonY = option.rect.y() + centerObj(option.rect.height(), 16);
|
||||||
|
|
Loading…
Reference in New Issue