mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 10:15:43 +08:00
refs #432, adjusted GUI
* register / unregister with application contexts * adjusted originator
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
#include "blackmisc/icon.h"
|
#include "blackmisc/icon.h"
|
||||||
#include "blackgui/stylesheetutility.h"
|
#include "blackgui/stylesheetutility.h"
|
||||||
#include "blackgui/models/atcstationlistmodel.h"
|
#include "blackgui/models/atcstationlistmodel.h"
|
||||||
|
#include "blackgui/components/logcomponent.h"
|
||||||
|
#include "blackgui/components/settingscomponent.h"
|
||||||
#include "blackcore/dbus_server.h"
|
#include "blackcore/dbus_server.h"
|
||||||
#include "blackcore/context_network.h"
|
#include "blackcore/context_network.h"
|
||||||
#include "blackcore/context_application.h"
|
#include "blackcore/context_application.h"
|
||||||
@@ -41,6 +43,7 @@ using namespace BlackMisc::Hardware;
|
|||||||
*/
|
*/
|
||||||
SwiftGuiStd::SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowMode, QWidget *parent) :
|
SwiftGuiStd::SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowMode, QWidget *parent) :
|
||||||
QMainWindow(parent, CEnableForFramelessWindow::modeToWindowFlags(windowMode)),
|
QMainWindow(parent, CEnableForFramelessWindow::modeToWindowFlags(windowMode)),
|
||||||
|
COriginatorAware(this),
|
||||||
CEnableForFramelessWindow(windowMode, true, "framelessMainWindow", this),
|
CEnableForFramelessWindow(windowMode, true, "framelessMainWindow", this),
|
||||||
ui(new Ui::SwiftGuiStd)
|
ui(new Ui::SwiftGuiStd)
|
||||||
{
|
{
|
||||||
@@ -112,7 +115,7 @@ void SwiftGuiStd::performGracefulShutdown()
|
|||||||
// tell context GUI is going down
|
// tell context GUI is going down
|
||||||
if (this->getIContextApplication())
|
if (this->getIContextApplication())
|
||||||
{
|
{
|
||||||
this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ApplicationGui, IContextApplication::ApplicationStops);
|
this->getIContextApplication()->unregisterApplication(originator());
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow some other parts to react
|
// allow some other parts to react
|
||||||
@@ -304,8 +307,14 @@ void SwiftGuiStd::ps_handleTimerBasedUpdates()
|
|||||||
|
|
||||||
void SwiftGuiStd::setContextAvailability()
|
void SwiftGuiStd::setContextAvailability()
|
||||||
{
|
{
|
||||||
qint64 t = QDateTime::currentMSecsSinceEpoch();
|
if (this->getIContextApplication()->isUsingImplementingObject())
|
||||||
this->m_coreAvailable = (this->getIContextApplication()->ping(t) == t);
|
{
|
||||||
|
this->m_coreAvailable = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->m_coreAvailable = isMyOriginator(this->getIContextApplication()->registerApplication(getCurrentTimestampOriginator()));
|
||||||
|
}
|
||||||
this->m_contextNetworkAvailable = this->m_coreAvailable || this->getIContextNetwork()->isUsingImplementingObject();
|
this->m_contextNetworkAvailable = this->m_coreAvailable || this->getIContextNetwork()->isUsingImplementingObject();
|
||||||
this->m_contextAudioAvailable = this->m_coreAvailable || this->getIContextAudio()->isUsingImplementingObject();
|
this->m_contextAudioAvailable = this->m_coreAvailable || this->getIContextAudio()->isUsingImplementingObject();
|
||||||
}
|
}
|
||||||
@@ -406,6 +415,7 @@ void SwiftGuiStd::ps_onCurrentMainWidgetChanged(int currentIndex)
|
|||||||
|
|
||||||
void SwiftGuiStd::ps_onChangedMainInfoAreaFloating(bool floating)
|
void SwiftGuiStd::ps_onChangedMainInfoAreaFloating(bool floating)
|
||||||
{
|
{
|
||||||
|
// code for whole floating area goes here
|
||||||
Q_UNUSED(floating);
|
Q_UNUSED(floating);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +433,7 @@ void SwiftGuiStd::ps_showNormal()
|
|||||||
|
|
||||||
void SwiftGuiStd::playNotifcationSound(CNotificationSounds::Notification notification) const
|
void SwiftGuiStd::playNotifcationSound(CNotificationSounds::Notification notification) const
|
||||||
{
|
{
|
||||||
if (!this->m_contextAudioAvailable) return;
|
if (!this->m_contextAudioAvailable) { return; }
|
||||||
if (!this->ui->comp_MainInfoArea->getSettingsComponent()->playNotificationSounds()) return;
|
if (!this->ui->comp_MainInfoArea->getSettingsComponent()->playNotificationSounds()) { return; }
|
||||||
this->getIContextAudio()->playNotification(static_cast<uint>(notification), true);
|
this->getIContextAudio()->playNotification(static_cast<uint>(notification), true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,9 @@
|
|||||||
#include "blackgui/models/keyboardkeylistmodel.h"
|
#include "blackgui/models/keyboardkeylistmodel.h"
|
||||||
#include "blackgui/enableforframelesswindow.h"
|
#include "blackgui/enableforframelesswindow.h"
|
||||||
#include "blackgui/managedstatusbar.h"
|
#include "blackgui/managedstatusbar.h"
|
||||||
#include "blackmisc/originator.h"
|
|
||||||
#include "blackmisc/network/textmessage.h"
|
#include "blackmisc/network/textmessage.h"
|
||||||
#include "blackmisc/loghandler.h"
|
#include "blackmisc/loghandler.h"
|
||||||
|
#include "blackmisc/originatoraware.h"
|
||||||
#include "blacksound/soundgenerator.h"
|
#include "blacksound/soundgenerator.h"
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
@@ -46,6 +46,7 @@ namespace Ui { class SwiftGuiStd; }
|
|||||||
//! swift GUI
|
//! swift GUI
|
||||||
class SwiftGuiStd :
|
class SwiftGuiStd :
|
||||||
public QMainWindow,
|
public QMainWindow,
|
||||||
|
public BlackMisc::COriginatorAware,
|
||||||
public BlackGui::CEnableForFramelessWindow,
|
public BlackGui::CEnableForFramelessWindow,
|
||||||
public BlackGui::Components::CEnableForRuntime
|
public BlackGui::Components::CEnableForRuntime
|
||||||
{
|
{
|
||||||
@@ -129,8 +130,6 @@ private:
|
|||||||
QString m_transponderResetValue; //!< Temp. storage of XPdr mode to reset, req. until timer allows singleShoot with Lambdas
|
QString m_transponderResetValue; //!< Temp. storage of XPdr mode to reset, req. until timer allows singleShoot with Lambdas
|
||||||
QWidget *m_inputFocusedWidget = nullptr; //!< currently used widget for input, mainly used with cockpit
|
QWidget *m_inputFocusedWidget = nullptr; //!< currently used widget for input, mainly used with cockpit
|
||||||
|
|
||||||
BlackMisc::COriginator m_originator;
|
|
||||||
|
|
||||||
//! GUI status update
|
//! GUI status update
|
||||||
void updateGuiStatusInformation();
|
void updateGuiStatusInformation();
|
||||||
|
|
||||||
@@ -177,22 +176,13 @@ private:
|
|||||||
//! Stop all update timers
|
//! Stop all update timers
|
||||||
void stopUpdateTimersWhenDisconnected();
|
void stopUpdateTimersWhenDisconnected();
|
||||||
|
|
||||||
//! \brief Stop all timers
|
//! Stop all timers
|
||||||
//! \param disconnect also disconnect signal/slots
|
//! \param disconnect also disconnect signal/slots
|
||||||
void stopAllTimers(bool disconnectSignalSlots);
|
void stopAllTimers(bool disconnectSignalSlots);
|
||||||
|
|
||||||
//! Play notifcation sound
|
//! Play notifcation sound
|
||||||
void playNotifcationSound(BlackSound::CNotificationSounds::Notification notification) const;
|
void playNotifcationSound(BlackSound::CNotificationSounds::Notification notification) const;
|
||||||
|
|
||||||
//! Originator for aircraft context
|
|
||||||
BlackMisc::COriginator swiftGuiStandardOriginator()
|
|
||||||
{
|
|
||||||
if (m_originator.getName().isEmpty())
|
|
||||||
m_originator = BlackMisc::COriginator(QStringLiteral("SWIFTGUISTANDARD"));
|
|
||||||
|
|
||||||
return m_originator;
|
|
||||||
}
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -13,9 +13,7 @@
|
|||||||
#include "blackcore/context_all_interfaces.h"
|
#include "blackcore/context_all_interfaces.h"
|
||||||
#include "blackgui/stylesheetutility.h"
|
#include "blackgui/stylesheetutility.h"
|
||||||
#include "blackgui/guiutility.h"
|
#include "blackgui/guiutility.h"
|
||||||
#include "blackgui/components/textmessagecomponent.h"
|
#include "blackgui/components/allmaininfoareacomponents.h"
|
||||||
#include "blackgui/components/cockpitcomponent.h"
|
|
||||||
#include "blackgui/components/navigatordockwidget.h"
|
|
||||||
#include "blackgui/models/atcstationlistmodel.h"
|
#include "blackgui/models/atcstationlistmodel.h"
|
||||||
#include "blackgui/models/keyboardkeylistmodel.h"
|
#include "blackgui/models/keyboardkeylistmodel.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
@@ -125,8 +123,6 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
|
|||||||
this->initDynamicMenus();
|
this->initDynamicMenus();
|
||||||
this->initMenuIcons();
|
this->initMenuIcons();
|
||||||
|
|
||||||
// starting
|
|
||||||
this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ApplicationGui, IContextApplication::ApplicationStarts);
|
|
||||||
|
|
||||||
// info
|
// info
|
||||||
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CProject::systemNameAndVersion());
|
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CProject::systemNameAndVersion());
|
||||||
@@ -218,17 +214,16 @@ void SwiftGuiStd::initGuiSignals()
|
|||||||
*/
|
*/
|
||||||
void SwiftGuiStd::initialDataReads()
|
void SwiftGuiStd::initialDataReads()
|
||||||
{
|
{
|
||||||
qint64 t = QDateTime::currentMSecsSinceEpoch();
|
this->setContextAvailability();
|
||||||
this->m_coreAvailable = (this->getIContextNetwork()->isUsingImplementingObject() || (this->getIContextApplication()->ping(t) == t));
|
|
||||||
if (!this->m_coreAvailable)
|
if (!this->m_coreAvailable)
|
||||||
{
|
{
|
||||||
CLogMessage(this).error("no initial data read as network context is not available");
|
CLogMessage(this).error("No initial data read as network context is not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ui->comp_MainInfoArea->getSettingsComponent()->reloadSettings(); // init read
|
this->ui->comp_MainInfoArea->getSettingsComponent()->reloadSettings(); // init read
|
||||||
this->ps_reloadOwnAircraft(); // init read, independent of traffic network
|
this->ps_reloadOwnAircraft(); // init read, independent of traffic network
|
||||||
CLogMessage(this).info("initial data read");
|
CLogMessage(this).info("Initial data read");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include "swiftguistd.h"
|
#include "swiftguistd.h"
|
||||||
#include "ui_swiftguistd.h"
|
#include "ui_swiftguistd.h"
|
||||||
#include "blackgui/stylesheetutility.h"
|
#include "blackgui/stylesheetutility.h"
|
||||||
|
#include "blackgui/components/settingscomponent.h"
|
||||||
|
#include "blackgui/components/logcomponent.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
#include "blackmisc/aviation/altitude.h"
|
#include "blackmisc/aviation/altitude.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user