mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-10 00:11:43 +08:00
Restarted process from GUI in desktop mode #4901
This commit is contained in:
committed by
Jerry (Xinyu Hou)
parent
86d5567e74
commit
fc600efdfe
@@ -96,7 +96,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||
m_pCancelButton(NULL),
|
||||
m_SuppressAutoConfigWarning(false),
|
||||
m_BonjourInstall(NULL),
|
||||
m_SuppressEmptyServerWarning(false)
|
||||
m_SuppressEmptyServerWarning(false),
|
||||
m_ExpectedRunningState(kStopped)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@@ -142,6 +143,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
if (appConfig().processMode() == Desktop) {
|
||||
m_ExpectedRunningState = kStopped;
|
||||
stopDesktop();
|
||||
}
|
||||
|
||||
@@ -777,6 +779,15 @@ void MainWindow::synergyFinished(int exitCode, QProcess::ExitStatus)
|
||||
QMessageBox::critical(this, tr("Synergy terminated with an error"), QString(tr("Synergy terminated unexpectedly with an exit code of %1.<br><br>Please see the log output for details.")).arg(exitCode));
|
||||
stopSynergy();
|
||||
}
|
||||
|
||||
if (appConfig().processMode() == Desktop) {
|
||||
if (m_ExpectedRunningState == kStarted) {
|
||||
stopSynergy();
|
||||
delay(1);
|
||||
startSynergy();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
Q_UNUSED(exitCode);
|
||||
#endif
|
||||
@@ -823,6 +834,7 @@ void MainWindow::setSynergyState(qSynergyState state)
|
||||
}
|
||||
|
||||
setStatus(tr("Synergy is running."));
|
||||
m_ExpectedRunningState = kStarted;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1338,3 +1350,14 @@ void MainWindow::delay(unsigned int s)
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pButtonToggleStart_clicked()
|
||||
{
|
||||
if (m_SynergyState != synergyConnected) {
|
||||
m_ExpectedRunningState = kStarted;
|
||||
}
|
||||
else {
|
||||
m_ExpectedRunningState = kStopped;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,6 +85,11 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
Info
|
||||
};
|
||||
|
||||
enum qRuningState {
|
||||
kStarted,
|
||||
kStopped
|
||||
};
|
||||
|
||||
public:
|
||||
MainWindow(QSettings& settings, AppConfig& appConfig);
|
||||
~MainWindow();
|
||||
@@ -138,7 +143,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
protected:
|
||||
QSettings& settings() { return m_Settings; }
|
||||
AppConfig& appConfig() { return m_AppConfig; }
|
||||
QProcess*& synergyProcess() { return m_pSynergy; }
|
||||
QProcess* synergyProcess() { return m_pSynergy; }
|
||||
void setSynergyProcess(QProcess* p) { m_pSynergy = p; }
|
||||
void initConnections();
|
||||
void createMenuBar();
|
||||
@@ -200,12 +205,14 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
bool m_SuppressAutoConfigWarning;
|
||||
CommandProcess* m_BonjourInstall;
|
||||
bool m_SuppressEmptyServerWarning;
|
||||
qRuningState m_ExpectedRunningState;
|
||||
|
||||
private slots:
|
||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||
void on_m_pComboServerList_currentIndexChanged(QString );
|
||||
void on_m_pButtonApply_clicked();
|
||||
void installBonjour();
|
||||
void on_m_pButtonToggleStart_clicked();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user