refs #777, using feature in launcher

plus bug fix in application
This commit is contained in:
Klaus Basan
2016-10-30 02:50:38 +01:00
parent 4f447cd408
commit a1bea9703d
4 changed files with 50 additions and 9 deletions

View File

@@ -42,7 +42,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
this->init();
connect(ui->pb_CheckForUpdates, &QPushButton::pressed, this, &CSwiftLauncher::ps_loadSetup);
connect(ui->tb_SwiftCore, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
connect(ui->tb_SwiftData, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
connect(ui->tb_SwiftMappingTool, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::ps_showMainPage);
@@ -58,8 +58,14 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
// default from settings
const QString dbus(this->m_dbusServerAddress.getThreadLocal());
this->setDefault(dbus);
// periodically check
connect(&this->m_checkTimer, &QTimer::timeout, this, &CSwiftLauncher::ps_checkRunningApplications);
this->m_checkTimer.setInterval(5000);
this->m_checkTimer.start();
}
CSwiftLauncher::~CSwiftLauncher()
{ }
@@ -344,14 +350,18 @@ void CSwiftLauncher::ps_startButtonPressed()
this->accept();
}
}
else if (sender == ui->tb_SwiftData)
else if (sender == ui->tb_SwiftMappingTool)
{
ui->tb_SwiftMappingTool->setEnabled(false);
this->m_startMappingToolWaitCycles = 2;
this->setSwiftDataExecutable();
this->accept();
}
else if (sender == ui->tb_SwiftCore)
{
if (this->isStandaloneGuiSelected()) { ui->rb_SwiftCoreGuiAudio->setChecked(true); }
ui->tb_SwiftCore->setEnabled(false);
this->m_startCoreWaitCycles = 2;
this->startSwiftCore();
}
else if (sender == ui->tb_Database)
@@ -418,3 +428,27 @@ void CSwiftLauncher::ps_showLogPage()
{
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherLog);
}
void CSwiftLauncher::ps_checkRunningApplications()
{
const CApplicationInfoList runningApps = sGui->getRunningApplications();
if (this->m_startCoreWaitCycles > 0) { this->m_startCoreWaitCycles--; }
else { ui->tb_SwiftCore->setEnabled(true); }
if (this->m_startMappingToolWaitCycles > 0) { this->m_startMappingToolWaitCycles--; }
else { ui->tb_SwiftMappingTool->setEnabled(true); }
for (const CApplicationInfo &info : runningApps)
{
switch (info.application())
{
case CApplicationInfo::PilotClientCore :
ui->tb_SwiftCore->setEnabled(false);
break;
case CApplicationInfo::MappingTool :
ui->tb_SwiftMappingTool->setEnabled(false);
break;
default:
break;
}
}
}