fixed: gui "start" button visible even though server/client is running.
This commit is contained in:
parent
658a3e3e8f
commit
2520bf4773
|
@ -346,7 +346,8 @@ void MainWindow::updateStateFromLogLine(const QString &line)
|
||||||
{
|
{
|
||||||
// TODO: implement ipc connection state messages to replace this hack.
|
// TODO: implement ipc connection state messages to replace this hack.
|
||||||
if (line.contains("started server") ||
|
if (line.contains("started server") ||
|
||||||
line.contains("connected to server"))
|
line.contains("connected to server") ||
|
||||||
|
line.contains("watchdog status: ok"))
|
||||||
{
|
{
|
||||||
setSynergyState(synergyConnected);
|
setSynergyState(synergyConnected);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +360,6 @@ void MainWindow::clearLog()
|
||||||
|
|
||||||
void MainWindow::startSynergy()
|
void MainWindow::startSynergy()
|
||||||
{
|
{
|
||||||
// TODO: refactor this out into 2 methods.
|
|
||||||
bool desktopMode = appConfig().processMode() == Desktop;
|
bool desktopMode = appConfig().processMode() == Desktop;
|
||||||
bool serviceMode = appConfig().processMode() == Service;
|
bool serviceMode = appConfig().processMode() == Service;
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ void MainWindow::setSynergyState(qSynergyState state)
|
||||||
disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
|
disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
|
||||||
connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger()));
|
connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger()));
|
||||||
m_pButtonToggleStart->setText(tr("&Stop"));
|
m_pButtonToggleStart->setText(tr("&Stop"));
|
||||||
m_pButtonApply->setEnabled((appConfig().processMode() == Service));
|
m_pButtonApply->setEnabled(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -656,8 +656,7 @@ void MainWindow::setSynergyState(qSynergyState state)
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case synergyConnected: {
|
case synergyConnected: {
|
||||||
QString mode(appConfig().processMode() == Service ? tr("service mode") : tr("desktop mode"));
|
setStatus(tr("Synergy is running."));
|
||||||
setStatus(tr("Synergy is running (%1).").arg(mode));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case synergyConnecting:
|
case synergyConnecting:
|
||||||
|
|
|
@ -118,7 +118,7 @@ CMSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG((CLOG_ERR "could not find %s in session %i", name, m_activeSessionId));
|
LOG((CLOG_DEBUG "did not find %s in session %i", name, m_activeSessionId));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,6 +304,12 @@ CMSWindowsWatchdog::startProcess()
|
||||||
throw XArch(new XArchEvalWindows);
|
throw XArch(new XArchEvalWindows);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// wait for program to fail.
|
||||||
|
ARCH->sleep(1);
|
||||||
|
if (!isProcessActive()) {
|
||||||
|
throw XMSWindowsWatchdogError("process immediately stopped");
|
||||||
|
}
|
||||||
|
|
||||||
m_processRunning = true;
|
m_processRunning = true;
|
||||||
m_processFailures = 0;
|
m_processFailures = 0;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
std::string getCommand() const;
|
std::string getCommand() const;
|
||||||
void setCommand(const std::string& command, bool elevate);
|
void setCommand(const std::string& command, bool elevate);
|
||||||
void stop();
|
void stop();
|
||||||
|
bool isProcessActive();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void mainLoop(void*);
|
void mainLoop(void*);
|
||||||
|
@ -50,7 +51,6 @@ private:
|
||||||
HANDLE duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security);
|
HANDLE duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security);
|
||||||
HANDLE getUserToken(LPSECURITY_ATTRIBUTES security);
|
HANDLE getUserToken(LPSECURITY_ATTRIBUTES security);
|
||||||
void startProcess();
|
void startProcess();
|
||||||
bool isProcessActive();
|
|
||||||
void sendSas();
|
void sendSas();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -347,6 +347,21 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
case kIpcHello:
|
case kIpcHello:
|
||||||
|
CIpcHelloMessage* hm = static_cast<CIpcHelloMessage*>(m);
|
||||||
|
CString type;
|
||||||
|
switch (hm->clientType()) {
|
||||||
|
case kIpcClientGui: type = "gui"; break;
|
||||||
|
case kIpcClientNode: type = "node"; break;
|
||||||
|
default: type = "unknown"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG((CLOG_DEBUG "ipc hello, type=%s", type.c_str()));
|
||||||
|
|
||||||
|
#if SYSAPI_WIN32
|
||||||
|
CString watchdogStatus = m_watchdog->isProcessActive() ? "ok" : "error";
|
||||||
|
LOG((CLOG_INFO "watchdog status: %s", watchdogStatus.c_str()));
|
||||||
|
#endif
|
||||||
|
|
||||||
m_ipcLogOutputter->notifyBuffer();
|
m_ipcLogOutputter->notifyBuffer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue