fixed: gui "start" button visible even though server/client is running.

This commit is contained in:
Nick Bolton 2013-10-16 15:30:42 +00:00
parent 658a3e3e8f
commit 2520bf4773
5 changed files with 27 additions and 7 deletions

View File

@ -346,7 +346,8 @@ void MainWindow::updateStateFromLogLine(const QString &line)
{
// TODO: implement ipc connection state messages to replace this hack.
if (line.contains("started server") ||
line.contains("connected to server"))
line.contains("connected to server") ||
line.contains("watchdog status: ok"))
{
setSynergyState(synergyConnected);
}
@ -359,7 +360,6 @@ void MainWindow::clearLog()
void MainWindow::startSynergy()
{
// TODO: refactor this out into 2 methods.
bool desktopMode = appConfig().processMode() == Desktop;
bool serviceMode = appConfig().processMode() == Service;
@ -632,7 +632,7 @@ void MainWindow::setSynergyState(qSynergyState state)
disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger()));
m_pButtonToggleStart->setText(tr("&Stop"));
m_pButtonApply->setEnabled((appConfig().processMode() == Service));
m_pButtonApply->setEnabled(true);
}
else
{
@ -656,8 +656,7 @@ void MainWindow::setSynergyState(qSynergyState state)
switch (state)
{
case synergyConnected: {
QString mode(appConfig().processMode() == Service ? tr("service mode") : tr("desktop mode"));
setStatus(tr("Synergy is running (%1).").arg(mode));
setStatus(tr("Synergy is running."));
break;
}
case synergyConnecting:

View File

@ -118,7 +118,7 @@ CMSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
return true;
}
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;
}
}

View File

@ -304,6 +304,12 @@ CMSWindowsWatchdog::startProcess()
throw XArch(new XArchEvalWindows);
}
else {
// wait for program to fail.
ARCH->sleep(1);
if (!isProcessActive()) {
throw XMSWindowsWatchdogError("process immediately stopped");
}
m_processRunning = true;
m_processFailures = 0;

View File

@ -41,6 +41,7 @@ public:
std::string getCommand() const;
void setCommand(const std::string& command, bool elevate);
void stop();
bool isProcessActive();
private:
void mainLoop(void*);
@ -50,7 +51,6 @@ private:
HANDLE duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security);
HANDLE getUserToken(LPSECURITY_ATTRIBUTES security);
void startProcess();
bool isProcessActive();
void sendSas();
private:

View File

@ -347,6 +347,21 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*)
}
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();
break;
}