mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 12:15:29 +08:00
@@ -207,7 +207,7 @@ namespace BlackCore
|
|||||||
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
||||||
if (a.contains("launcher")) { return CApplicationInfo::Laucher; }
|
if (a.contains("launcher")) { return CApplicationInfo::Laucher; }
|
||||||
if (a.contains("gui")) { return CApplicationInfo::PilotClientGui; }
|
if (a.contains("gui")) { return CApplicationInfo::PilotClientGui; }
|
||||||
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
if (a.contains("data") || a.contains("mapping")) { return CApplicationInfo::MappingTool; }
|
||||||
return CApplicationInfo::Unknown;
|
return CApplicationInfo::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
|||||||
this->init();
|
this->init();
|
||||||
connect(ui->pb_CheckForUpdates, &QPushButton::pressed, this, &CSwiftLauncher::ps_loadSetup);
|
connect(ui->pb_CheckForUpdates, &QPushButton::pressed, this, &CSwiftLauncher::ps_loadSetup);
|
||||||
connect(ui->tb_SwiftCore, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
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_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||||
connect(ui->tb_Database, &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);
|
connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::ps_showMainPage);
|
||||||
@@ -58,8 +58,14 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
|||||||
// default from settings
|
// default from settings
|
||||||
const QString dbus(this->m_dbusServerAddress.getThreadLocal());
|
const QString dbus(this->m_dbusServerAddress.getThreadLocal());
|
||||||
this->setDefault(dbus);
|
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()
|
CSwiftLauncher::~CSwiftLauncher()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -344,14 +350,18 @@ void CSwiftLauncher::ps_startButtonPressed()
|
|||||||
this->accept();
|
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->setSwiftDataExecutable();
|
||||||
this->accept();
|
this->accept();
|
||||||
}
|
}
|
||||||
else if (sender == ui->tb_SwiftCore)
|
else if (sender == ui->tb_SwiftCore)
|
||||||
{
|
{
|
||||||
if (this->isStandaloneGuiSelected()) { ui->rb_SwiftCoreGuiAudio->setChecked(true); }
|
if (this->isStandaloneGuiSelected()) { ui->rb_SwiftCoreGuiAudio->setChecked(true); }
|
||||||
|
ui->tb_SwiftCore->setEnabled(false);
|
||||||
|
this->m_startCoreWaitCycles = 2;
|
||||||
this->startSwiftCore();
|
this->startSwiftCore();
|
||||||
}
|
}
|
||||||
else if (sender == ui->tb_Database)
|
else if (sender == ui->tb_Database)
|
||||||
@@ -418,3 +428,27 @@ void CSwiftLauncher::ps_showLogPage()
|
|||||||
{
|
{
|
||||||
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherLog);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "blackcore/coremodeenums.h"
|
#include "blackcore/coremodeenums.h"
|
||||||
#include "blackcore/application/applicationsettings.h"
|
#include "blackcore/application/applicationsettings.h"
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QTimer>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
@@ -77,10 +78,13 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CSwiftLauncher> ui;
|
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
|
BlackMisc::CSetting<BlackCore::Application::TDBusServerAddress> m_dbusServerAddress { this }; //!< DBus address
|
||||||
QString m_executable;
|
QString m_executable;
|
||||||
QStringList m_executableArgs;
|
QStringList m_executableArgs;
|
||||||
|
QTimer m_checkTimer { this };
|
||||||
|
int m_startCoreWaitCycles = 0;
|
||||||
|
int m_startMappingToolWaitCycles = 0;
|
||||||
|
|
||||||
//! Get core mode
|
//! Get core mode
|
||||||
BlackCore::CoreModes::CoreMode getCoreMode() const;
|
BlackCore::CoreModes::CoreMode getCoreMode() const;
|
||||||
@@ -166,6 +170,9 @@ private slots:
|
|||||||
|
|
||||||
//! Show the log page
|
//! Show the log page
|
||||||
void ps_showLogPage();
|
void ps_showLogPage();
|
||||||
|
|
||||||
|
//! Check if applicationas are already running
|
||||||
|
void ps_checkRunningApplications();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QToolBox" name="tb_Launcher">
|
<widget class="QToolBox" name="tb_Launcher">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="tabSpacing">
|
<property name="tabSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
@@ -708,7 +708,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QToolButton" name="tb_SwiftData">
|
<widget class="QToolButton" name="tb_SwiftMappingTool">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>start swift data (the mapping tool)</string>
|
<string>start swift data (the mapping tool)</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -837,8 +837,8 @@ p, li { white-space: pre-wrap; }
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="swiftlauncher.qrc"/>
|
|
||||||
<include location="../blackmisc/blackmisc.qrc"/>
|
<include location="../blackmisc/blackmisc.qrc"/>
|
||||||
|
<include location="swiftlauncher.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
|
|||||||
Reference in New Issue
Block a user