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;
}
}
}

View File

@@ -20,6 +20,7 @@
#include "blackcore/coremodeenums.h"
#include "blackcore/application/applicationsettings.h"
#include <QDialog>
#include <QTimer>
#include <QScopedPointer>
#include <QNetworkReply>
@@ -77,10 +78,13 @@ private slots:
private:
QScopedPointer<Ui::CSwiftLauncher> ui;
BlackMisc::CData<BlackCore::Data::TUpdateInfo> m_updateInfo { this, &CSwiftLauncher::ps_changedUpdateInfoCache }; //!< version cache
BlackMisc::CData<BlackCore::Data::TUpdateInfo> m_updateInfo { this, &CSwiftLauncher::ps_changedUpdateInfoCache }; //!< version cache
BlackMisc::CSetting<BlackCore::Application::TDBusServerAddress> m_dbusServerAddress { this }; //!< DBus address
QString m_executable;
QStringList m_executableArgs;
QString m_executable;
QStringList m_executableArgs;
QTimer m_checkTimer { this };
int m_startCoreWaitCycles = 0;
int m_startMappingToolWaitCycles = 0;
//! Get core mode
BlackCore::CoreModes::CoreMode getCoreMode() const;
@@ -166,6 +170,9 @@ private slots:
//! Show the log page
void ps_showLogPage();
//! Check if applicationas are already running
void ps_checkRunningApplications();
};
#endif // guard

View File

@@ -78,7 +78,7 @@
<item>
<widget class="QToolBox" name="tb_Launcher">
<property name="currentIndex">
<number>0</number>
<number>4</number>
</property>
<property name="tabSpacing">
<number>6</number>
@@ -708,7 +708,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="tb_SwiftData">
<widget class="QToolButton" name="tb_SwiftMappingTool">
<property name="toolTip">
<string>start swift data (the mapping tool)</string>
</property>
@@ -837,8 +837,8 @@ p, li { white-space: pre-wrap; }
</customwidget>
</customwidgets>
<resources>
<include location="swiftlauncher.qrc"/>
<include location="../blackmisc/blackmisc.qrc"/>
<include location="swiftlauncher.qrc"/>
</resources>
<connections/>
<buttongroups>