Show "Connecting …" status via "Connect/Resume/Pause" button
This makes it more obvious that Syncthing Tray is currently connecting to Syncthing (instead of just hiding the button completely).
This commit is contained in:
parent
b8b7986086
commit
c6b03ae0aa
|
@ -24,14 +24,16 @@ RowLayout {
|
|||
target: connectButton
|
||||
text: qsTr("Connect")
|
||||
icon.source: plasmoid.nativeInterface.faUrl + "refresh"
|
||||
visible: true
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "connecting"
|
||||
PropertyChanges {
|
||||
target: connectButton
|
||||
visible: false
|
||||
text: qsTr("Connecting …")
|
||||
icon.source: plasmoid.nativeInterface.faUrl + "refresh"
|
||||
enabled: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
|
@ -40,7 +42,7 @@ RowLayout {
|
|||
target: connectButton
|
||||
text: qsTr("Resume")
|
||||
icon.source: plasmoid.nativeInterface.faUrl + "play"
|
||||
visible: true
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
State {
|
||||
|
@ -49,14 +51,14 @@ RowLayout {
|
|||
target: connectButton
|
||||
text: qsTr("Pause")
|
||||
icon.source: plasmoid.nativeInterface.faUrl + "pause"
|
||||
visible: true
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
]
|
||||
state: {
|
||||
switch (plasmoid.nativeInterface.connection.status) {
|
||||
case SyncthingPlasmoid.Data.Disconnected:
|
||||
return "disconnected"
|
||||
return plasmoid.nativeInterface.connection.connecting ? "connecting" : "disconnected"
|
||||
case SyncthingPlasmoid.Data.Reconnecting:
|
||||
return "connecting";
|
||||
case SyncthingPlasmoid.Data.Paused:
|
||||
|
|
|
@ -456,17 +456,22 @@ void TrayWidget::handleStatusChanged(SyncthingStatus status)
|
|||
{
|
||||
switch (status) {
|
||||
case SyncthingStatus::Disconnected:
|
||||
m_ui->statusPushButton->setText(tr("Connect"));
|
||||
m_ui->statusPushButton->setToolTip(tr("Not connected to Syncthing, click to connect"));
|
||||
m_ui->statusPushButton->setIcon(QIcon(QStringLiteral("refresh.fa")));
|
||||
m_ui->statusPushButton->setHidden(false);
|
||||
updateTraffic(); // ensure previous traffic statistics are no longer shown
|
||||
if (m_applyingSettingsForWizard) {
|
||||
concludeWizard(tr("Unable to establish connection to Syncthing."));
|
||||
}
|
||||
return;
|
||||
case SyncthingStatus::Reconnecting:
|
||||
m_ui->statusPushButton->setHidden(true);
|
||||
if (status == SyncthingStatus::Reconnecting || m_connection.isConnecting()) {
|
||||
m_ui->statusPushButton->setText(tr("Connecting …"));
|
||||
m_ui->statusPushButton->setToolTip(tr("Establishing connection to Syncthing …"));
|
||||
m_ui->statusPushButton->setIcon(QIcon(QStringLiteral("refresh.fa")));
|
||||
m_ui->statusPushButton->setEnabled(false);
|
||||
} else {
|
||||
m_ui->statusPushButton->setText(tr("Connect"));
|
||||
m_ui->statusPushButton->setToolTip(tr("Not connected to Syncthing, click to connect"));
|
||||
m_ui->statusPushButton->setIcon(QIcon(QStringLiteral("refresh.fa")));
|
||||
m_ui->statusPushButton->setEnabled(true);
|
||||
updateTraffic(); // ensure previous traffic statistics are no longer shown
|
||||
if (m_applyingSettingsForWizard) {
|
||||
concludeWizard(tr("Unable to establish connection to Syncthing."));
|
||||
}
|
||||
}
|
||||
return;
|
||||
case SyncthingStatus::Idle:
|
||||
case SyncthingStatus::Scanning:
|
||||
|
@ -475,13 +480,13 @@ void TrayWidget::handleStatusChanged(SyncthingStatus status)
|
|||
m_ui->statusPushButton->setText(tr("Pause"));
|
||||
m_ui->statusPushButton->setToolTip(tr("Syncthing is running, click to pause all devices"));
|
||||
m_ui->statusPushButton->setIcon(QIcon(QStringLiteral("pause.fa")));
|
||||
m_ui->statusPushButton->setHidden(false);
|
||||
m_ui->statusPushButton->setEnabled(true);
|
||||
break;
|
||||
case SyncthingStatus::Paused:
|
||||
m_ui->statusPushButton->setText(tr("Continue"));
|
||||
m_ui->statusPushButton->setToolTip(tr("At least one device is paused, click to resume"));
|
||||
m_ui->statusPushButton->setIcon(QIcon(QStringLiteral("play.fa")));
|
||||
m_ui->statusPushButton->setHidden(false);
|
||||
m_ui->statusPushButton->setEnabled(true);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue