Add SyncthingDirStatus::Unshared
This commit is contained in:
parent
2071aaa2e7
commit
ad5e724f44
|
@ -304,6 +304,8 @@ void Application::printStatus(const ArgumentOccurrence &)
|
|||
switch(dir->status) {
|
||||
case SyncthingDirStatus::Idle:
|
||||
status = "idle"; break;
|
||||
case SyncthingDirStatus::Unshared:
|
||||
status = "unshared"; break;
|
||||
case SyncthingDirStatus::Scanning:
|
||||
status = "scanning"; break;
|
||||
case SyncthingDirStatus::Synchronizing:
|
||||
|
@ -425,6 +427,7 @@ void Application::waitForIdle()
|
|||
switch(dir->status) {
|
||||
case SyncthingDirStatus::Unknown:
|
||||
case SyncthingDirStatus::Idle:
|
||||
case SyncthingDirStatus::Unshared:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
|
|
@ -24,7 +24,7 @@ bool SyncthingDir::assignStatus(const QString &statusStr, ChronoUtilities::DateT
|
|||
SyncthingDirStatus newStatus;
|
||||
if(statusStr == QLatin1String("idle")) {
|
||||
progressPercentage = 0;
|
||||
newStatus = errors.empty() ? SyncthingDirStatus::Idle : SyncthingDirStatus::OutOfSync;
|
||||
newStatus = SyncthingDirStatus::Idle;
|
||||
} else if(statusStr == QLatin1String("scanning")) {
|
||||
newStatus = SyncthingDirStatus::Scanning;
|
||||
} else if(statusStr == QLatin1String("syncing")) {
|
||||
|
@ -41,7 +41,15 @@ bool SyncthingDir::assignStatus(const QString &statusStr, ChronoUtilities::DateT
|
|||
progressPercentage = 0;
|
||||
newStatus = SyncthingDirStatus::OutOfSync;
|
||||
} else {
|
||||
newStatus = errors.empty() ? SyncthingDirStatus::Idle : SyncthingDirStatus::OutOfSync;
|
||||
newStatus = SyncthingDirStatus::Idle;
|
||||
}
|
||||
if(newStatus == SyncthingDirStatus::Idle) {
|
||||
if(!errors.empty()) {
|
||||
newStatus = SyncthingDirStatus::OutOfSync;
|
||||
} else if(devices.size() < 2) {
|
||||
// FIXME: we can assume only own device is assigned, correct?
|
||||
newStatus = SyncthingDirStatus::Unshared;
|
||||
}
|
||||
}
|
||||
if(newStatus != status) {
|
||||
switch(status) {
|
||||
|
@ -65,10 +73,14 @@ bool SyncthingDir::assignStatus(SyncthingDirStatus newStatus, DateTime time)
|
|||
lastStatusUpdate = time;
|
||||
}
|
||||
switch(newStatus) {
|
||||
case SyncthingDirStatus::Idle:
|
||||
case SyncthingDirStatus::Unknown:
|
||||
case SyncthingDirStatus::Idle:
|
||||
case SyncthingDirStatus::Unshared:
|
||||
if(!errors.empty()) {
|
||||
newStatus = SyncthingDirStatus::OutOfSync;
|
||||
} else if(devices.size() < 2) {
|
||||
// FIXME: we can assume only own device is assigned, correct?
|
||||
newStatus = SyncthingDirStatus::Unshared;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -16,6 +16,7 @@ enum class SyncthingDirStatus
|
|||
{
|
||||
Unknown,
|
||||
Idle,
|
||||
Unshared,
|
||||
Scanning,
|
||||
Synchronizing,
|
||||
Paused,
|
||||
|
|
|
@ -179,6 +179,7 @@ QVariant SyncthingDirectoryModel::data(const QModelIndex &index, int role) const
|
|||
case 1:
|
||||
switch(dir.status) {
|
||||
case SyncthingDirStatus::Unknown: return tr("Unknown status");
|
||||
case SyncthingDirStatus::Unshared: return tr("Unshared");
|
||||
case SyncthingDirStatus::Idle: return tr("Idle");
|
||||
case SyncthingDirStatus::Scanning: return dir.progressPercentage > 0 ? tr("Scanning (%1 %)").arg(dir.progressPercentage) : tr("Scanning");
|
||||
case SyncthingDirStatus::Synchronizing: return dir.progressPercentage > 0 ? tr("Synchronizing (%1 %)").arg(dir.progressPercentage) : tr("Synchronizing");
|
||||
|
@ -193,6 +194,7 @@ QVariant SyncthingDirectoryModel::data(const QModelIndex &index, int role) const
|
|||
case 0:
|
||||
switch(dir.status) {
|
||||
case SyncthingDirStatus::Unknown: return m_unknownIcon;
|
||||
case SyncthingDirStatus::Unshared: return m_unknownIcon;
|
||||
case SyncthingDirStatus::Idle: return m_idleIcon;
|
||||
case SyncthingDirStatus::Scanning: return m_otherIcon;
|
||||
case SyncthingDirStatus::Synchronizing: return m_syncIcon;
|
||||
|
@ -215,6 +217,7 @@ QVariant SyncthingDirectoryModel::data(const QModelIndex &index, int role) const
|
|||
switch(dir.status) {
|
||||
case SyncthingDirStatus::Unknown: break;
|
||||
case SyncthingDirStatus::Idle: return QColor(Qt::darkGreen);
|
||||
case SyncthingDirStatus::Unshared: return QColor(0xA85900);
|
||||
case SyncthingDirStatus::Scanning: return QColor(Qt::blue);
|
||||
case SyncthingDirStatus::Synchronizing: return QColor(Qt::blue);
|
||||
case SyncthingDirStatus::Paused: break;
|
||||
|
|
Loading…
Reference in New Issue