Rename `SyncthingDevStatus::OwnDevice` in accordance with UI change
This commit is contained in:
parent
d623dfdf5e
commit
5fa69e4f5a
|
@ -13,7 +13,7 @@ set(META_VERSION_MAJOR 1)
|
|||
set(META_VERSION_MINOR 4)
|
||||
set(META_VERSION_PATCH 7)
|
||||
set(META_RELEASE_DATE "2023-09-05")
|
||||
set(META_SOVERSION 9)
|
||||
set(META_SOVERSION 10)
|
||||
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)
|
||||
|
||||
project(${META_PROJECT_NAME})
|
||||
|
|
|
@ -645,7 +645,7 @@ void Application::printStatus(const ArgumentOccurrence &)
|
|||
if (!m_relevantDevs.empty()) {
|
||||
cout << TextAttribute::Bold << "Devices\n" << TextAttribute::Reset;
|
||||
std::sort(m_relevantDevs.begin(), m_relevantDevs.end(), [](const SyncthingDev *lhs, const SyncthingDev *rhs) {
|
||||
const auto lhsIsOwn = lhs->status == SyncthingDevStatus::OwnDevice, rhsIsOwn = rhs->status == SyncthingDevStatus::OwnDevice;
|
||||
const auto lhsIsOwn = lhs->status == SyncthingDevStatus::ThisDevice, rhsIsOwn = rhs->status == SyncthingDevStatus::ThisDevice;
|
||||
return lhsIsOwn != rhsIsOwn ? lhsIsOwn : lhs->displayName() < rhs->displayName();
|
||||
});
|
||||
std::for_each(m_relevantDevs.cbegin(), m_relevantDevs.cend(), bind(&Application::printDev, this, std::placeholders::_1));
|
||||
|
@ -1009,7 +1009,7 @@ bool Application::checkWhetherIdle() const
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
case SyncthingDevStatus::OwnDevice:
|
||||
case SyncthingDevStatus::ThisDevice:
|
||||
case SyncthingDevStatus::Idle:
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1002,12 +1002,12 @@ void SyncthingConnection::emitMyIdChanged(const QString &newId)
|
|||
int row = 0;
|
||||
for (SyncthingDev &dev : m_devs) {
|
||||
if (dev.id == newId) {
|
||||
if (dev.status != SyncthingDevStatus::OwnDevice) {
|
||||
dev.status = SyncthingDevStatus::OwnDevice;
|
||||
if (dev.status != SyncthingDevStatus::ThisDevice) {
|
||||
dev.status = SyncthingDevStatus::ThisDevice;
|
||||
dev.paused = false;
|
||||
emit devStatusChanged(dev, row);
|
||||
}
|
||||
} else if (dev.status == SyncthingDevStatus::OwnDevice) {
|
||||
} else if (dev.status == SyncthingDevStatus::ThisDevice) {
|
||||
dev.status = SyncthingDevStatus::Unknown;
|
||||
emit devStatusChanged(dev, row);
|
||||
}
|
||||
|
|
|
@ -725,7 +725,7 @@ void SyncthingConnection::readDevs(const QJsonArray &devs)
|
|||
devItem->certName = devObj.value(QLatin1String("certName")).toString();
|
||||
devItem->introducer = devObj.value(QLatin1String("introducer")).toBool(false);
|
||||
if (devItem->id == m_myId) {
|
||||
devItem->status = SyncthingDevStatus::OwnDevice;
|
||||
devItem->status = SyncthingDevStatus::ThisDevice;
|
||||
devItem->paused = false;
|
||||
} else {
|
||||
devItem->status = SyncthingDevStatus::Unknown;
|
||||
|
@ -869,7 +869,7 @@ void SyncthingConnection::readConnections()
|
|||
}
|
||||
|
||||
switch (dev.status) {
|
||||
case SyncthingDevStatus::OwnDevice:
|
||||
case SyncthingDevStatus::ThisDevice:
|
||||
break;
|
||||
case SyncthingDevStatus::Disconnected:
|
||||
case SyncthingDevStatus::Unknown:
|
||||
|
@ -884,7 +884,7 @@ void SyncthingConnection::readConnections()
|
|||
dev.status = SyncthingDevStatus::Disconnected;
|
||||
}
|
||||
}
|
||||
dev.paused = dev.status == SyncthingDevStatus::OwnDevice ? false : connectionObj.value(QLatin1String("paused")).toBool(false);
|
||||
dev.paused = dev.status == SyncthingDevStatus::ThisDevice ? false : connectionObj.value(QLatin1String("paused")).toBool(false);
|
||||
dev.totalIncomingTraffic = jsonValueToInt(connectionObj.value(QLatin1String("inBytesTotal")));
|
||||
dev.totalOutgoingTraffic = jsonValueToInt(connectionObj.value(QLatin1String("outBytesTotal")));
|
||||
dev.connectionAddress = connectionObj.value(QLatin1String("address")).toString();
|
||||
|
@ -2028,7 +2028,7 @@ void SyncthingConnection::readDeviceEvent(SyncthingEventId eventId, DateTime eve
|
|||
// assign new status
|
||||
if (devInfo->status != status || devInfo->paused != paused || devInfo->disconnectReason != disconnectReason) {
|
||||
// don't mess with the status of the own device
|
||||
if (devInfo->status != SyncthingDevStatus::OwnDevice) {
|
||||
if (devInfo->status != SyncthingDevStatus::ThisDevice) {
|
||||
devInfo->status = status;
|
||||
devInfo->paused = paused;
|
||||
devInfo->disconnectReason = disconnectReason;
|
||||
|
|
|
@ -11,7 +11,7 @@ QString statusString(SyncthingDevStatus status)
|
|||
return QCoreApplication::translate("SyncthingDevStatus", "unknown");
|
||||
case SyncthingDevStatus::Disconnected:
|
||||
return QCoreApplication::translate("SyncthingDevStatus", "disconnected");
|
||||
case SyncthingDevStatus::OwnDevice:
|
||||
case SyncthingDevStatus::ThisDevice:
|
||||
return QCoreApplication::translate("SyncthingDevStatus", "this device");
|
||||
case SyncthingDevStatus::Idle:
|
||||
return QCoreApplication::translate("SyncthingDevStatus", "idle");
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Data {
|
|||
enum class SyncthingDevStatus {
|
||||
Unknown, /**< device status is unknown */
|
||||
Disconnected, /**< device is disconnected */
|
||||
OwnDevice, /**< device is the own device; the own device will always have this status assigned */
|
||||
ThisDevice, /**< device is the own device; the own device will always have this status assigned */
|
||||
Idle, /**< device is connected and all shared directories are up-to-date on its end */
|
||||
Synchronizing, /**< device is connected but not all shared directories are up-to-date on its end */
|
||||
OutOfSync, /**< device is connected but not all shared directories are up-to-date on its end due to an error (never set so far; seems not possible to determine) */
|
||||
|
@ -70,7 +70,7 @@ inline bool SyncthingDev::isConnected() const
|
|||
switch (status) {
|
||||
case SyncthingDevStatus::Unknown:
|
||||
case SyncthingDevStatus::Disconnected:
|
||||
case SyncthingDevStatus::OwnDevice:
|
||||
case SyncthingDevStatus::ThisDevice:
|
||||
case SyncthingDevStatus::Rejected:
|
||||
return false;
|
||||
default:
|
||||
|
|
|
@ -269,7 +269,7 @@ QVariant SyncthingDeviceModel::data(const QModelIndex &index, int role) const
|
|||
case SyncthingDevStatus::Unknown:
|
||||
case SyncthingDevStatus::Disconnected:
|
||||
return statusIcons().disconnected;
|
||||
case SyncthingDevStatus::OwnDevice:
|
||||
case SyncthingDevStatus::ThisDevice:
|
||||
case SyncthingDevStatus::Idle:
|
||||
return statusIcons().idling;
|
||||
case SyncthingDevStatus::Synchronizing:
|
||||
|
@ -303,7 +303,7 @@ QVariant SyncthingDeviceModel::data(const QModelIndex &index, int role) const
|
|||
case DevicePaused:
|
||||
return dev.paused;
|
||||
case IsOwnDevice:
|
||||
return dev.status == SyncthingDevStatus::OwnDevice;
|
||||
return dev.status == SyncthingDevStatus::ThisDevice;
|
||||
case DeviceStatusString:
|
||||
return devStatusString(dev);
|
||||
case DeviceStatusColor:
|
||||
|
@ -380,7 +380,7 @@ QString SyncthingDeviceModel::devStatusString(const SyncthingDev &dev)
|
|||
switch (dev.status) {
|
||||
case SyncthingDevStatus::Unknown:
|
||||
return tr("Unknown status");
|
||||
case SyncthingDevStatus::OwnDevice:
|
||||
case SyncthingDevStatus::ThisDevice:
|
||||
return tr("Own device");
|
||||
case SyncthingDevStatus::Idle:
|
||||
return tr("Idle");
|
||||
|
@ -409,7 +409,7 @@ QVariant SyncthingDeviceModel::devStatusColor(const SyncthingDev &dev) const
|
|||
break;
|
||||
case SyncthingDevStatus::Disconnected:
|
||||
break;
|
||||
case SyncthingDevStatus::OwnDevice:
|
||||
case SyncthingDevStatus::ThisDevice:
|
||||
case SyncthingDevStatus::Idle:
|
||||
return Colors::green(m_brightColors);
|
||||
case SyncthingDevStatus::Synchronizing:
|
||||
|
|
|
@ -41,7 +41,7 @@ void DevView::mouseReleaseEvent(QMouseEvent *event)
|
|||
|
||||
const auto itemRect = visualRect(clickedRow.proxyIndex);
|
||||
const auto &device = *clickedRow.data;
|
||||
if (device.status != SyncthingDevStatus::OwnDevice && pos.x() > itemRect.right() - 17) {
|
||||
if (device.status != SyncthingDevStatus::ThisDevice && pos.x() > itemRect.right() - 17) {
|
||||
emit pauseResumeDev(device);
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ void DevView::showContextMenu(const QPoint &position)
|
|||
QIcon(QStringLiteral(":/icons/hicolor/scalable/actions/media-playback-start.svg"))),
|
||||
tr("Resume")),
|
||||
&QAction::triggered, triggerActionForSelectedRow(this, &DevView::pauseResumeDev));
|
||||
} else if (dev->status != SyncthingDevStatus::OwnDevice) {
|
||||
} else if (dev->status != SyncthingDevStatus::ThisDevice) {
|
||||
connect(menu.addAction(QIcon::fromTheme(QStringLiteral("media-playback-pause"),
|
||||
QIcon(QStringLiteral(":/icons/hicolor/scalable/actions/media-playback-pause.svg"))),
|
||||
tr("Pause")),
|
||||
|
|
Loading…
Reference in New Issue