refs #347, renamed the application main window to swiftguistd

This commit is contained in:
Klaus Basan
2014-11-24 00:54:13 +01:00
committed by Roland Winklmeier
parent e873025455
commit 7507d0f7bb
7 changed files with 108 additions and 87 deletions

View File

@@ -8,7 +8,7 @@
*/ */
#include "introwindow.h" #include "introwindow.h"
#include "mainwindow.h" #include "swiftguistd.h"
#include "guimodeenums.h" #include "guimodeenums.h"
#include "blackgui/stylesheetutility.h" #include "blackgui/stylesheetutility.h"
#include "blackcore/blackcorefreefunctions.h" #include "blackcore/blackcorefreefunctions.h"
@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
a.setStyleSheet(s); a.setStyleSheet(s);
// modes // modes
BlackGui::CMainWindow::WindowMode windowMode; BlackGui::CEnableForFramelessWindow::WindowMode windowMode;
// Dialog to decide external or internal core // Dialog to decide external or internal core
CIntroWindow intro; CIntroWindow intro;
@@ -100,9 +100,10 @@ int main(int argc, char *argv[])
intro.close(); intro.close();
// show window // show window
MainWindow w(windowMode); SwiftGuiStd w(windowMode);
w.show();
w.init(runtimeConfig); // object is complete by now w.init(runtimeConfig); // object is complete by now
w.show();
int r = a.exec(); int r = a.exec();
return r; return r;
} }

View File

@@ -7,8 +7,8 @@
* contained in the LICENSE file. * contained in the LICENSE file.
*/ */
#include "mainwindow.h" #include "swiftguistd.h"
#include "ui_mainwindow.h" #include "ui_swiftguistd.h"
#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"
@@ -21,6 +21,7 @@
#include "blackmisc/logmessage.h" #include "blackmisc/logmessage.h"
#include "blackmisc/notificationsounds.h" #include "blackmisc/notificationsounds.h"
#include <QMouseEvent> #include <QMouseEvent>
#include <QMainWindow>
using namespace BlackCore; using namespace BlackCore;
using namespace BlackSound; using namespace BlackSound;
@@ -38,9 +39,10 @@ using namespace BlackMisc::Hardware;
/* /*
* Constructor * Constructor
*/ */
MainWindow::MainWindow(BlackGui::CMainWindow::WindowMode windowMode, QWidget *parent) : SwiftGuiStd::SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowMode, QWidget *parent) :
BlackGui::CMainWindow(windowMode, parent), QMainWindow(parent, CEnableForFramelessWindow::modeToWindowFlags(windowMode)),
ui(new Ui::MainWindow) CEnableForFramelessWindow(windowMode, true, this),
ui(new Ui::SwiftGuiStd)
{ {
// GUI // GUI
ui->setupUi(this); ui->setupUi(this);
@@ -51,13 +53,13 @@ MainWindow::MainWindow(BlackGui::CMainWindow::WindowMode windowMode, QWidget *pa
/* /*
* Destructor * Destructor
*/ */
MainWindow::~MainWindow() SwiftGuiStd::~SwiftGuiStd()
{ } { }
/* /*
* Graceful shutdown * Graceful shutdown
*/ */
void MainWindow::performGracefulShutdown() void SwiftGuiStd::performGracefulShutdown()
{ {
if (!this->m_init) { return; } if (!this->m_init) { return; }
this->m_init = false; this->m_init = false;
@@ -100,7 +102,7 @@ void MainWindow::performGracefulShutdown()
/* /*
* Close event, window closes * Close event, window closes
*/ */
void MainWindow::closeEvent(QCloseEvent *event) void SwiftGuiStd::closeEvent(QCloseEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
this->performGracefulShutdown(); this->performGracefulShutdown();
@@ -111,12 +113,12 @@ void MainWindow::closeEvent(QCloseEvent *event)
/* /*
* Set main page * Set main page
*/ */
void MainWindow::ps_setMainPage(MainWindow::MainPageIndex mainPage) void SwiftGuiStd::ps_setMainPage(SwiftGuiStd::MainPageIndex mainPage)
{ {
this->ui->sw_MainMiddle->setCurrentIndex(mainPage); this->ui->sw_MainMiddle->setCurrentIndex(mainPage);
} }
void MainWindow::ps_setMainPageInfoArea(CMainInfoAreaComponent::InfoArea infoArea) void SwiftGuiStd::ps_setMainPageInfoArea(CMainInfoAreaComponent::InfoArea infoArea)
{ {
this->ps_setMainPageToInfoArea(); this->ps_setMainPageToInfoArea();
this->ui->comp_MainInfoArea->selectArea(infoArea); this->ui->comp_MainInfoArea->selectArea(infoArea);
@@ -125,12 +127,12 @@ void MainWindow::ps_setMainPageInfoArea(CMainInfoAreaComponent::InfoArea infoAre
/* /*
* Given main page selected? * Given main page selected?
*/ */
bool MainWindow::isMainPageSelected(MainWindow::MainPageIndex mainPage) const bool SwiftGuiStd::isMainPageSelected(SwiftGuiStd::MainPageIndex mainPage) const
{ {
return this->ui->sw_MainMiddle->currentIndex() == static_cast<int>(mainPage); return this->ui->sw_MainMiddle->currentIndex() == static_cast<int>(mainPage);
} }
void MainWindow::ps_loginRequested() void SwiftGuiStd::ps_loginRequested()
{ {
if (this->ui->sw_MainMiddle->currentIndex() == static_cast<int>(MainPageLogin)) if (this->ui->sw_MainMiddle->currentIndex() == static_cast<int>(MainPageLogin))
{ {
@@ -146,7 +148,7 @@ void MainWindow::ps_loginRequested()
/* /*
* Is the network context available? * Is the network context available?
*/ */
bool MainWindow::isContextNetworkAvailableCheck() bool SwiftGuiStd::isContextNetworkAvailableCheck()
{ {
if (this->m_contextNetworkAvailable) return true; if (this->m_contextNetworkAvailable) return true;
this->ps_displayStatusMessageInGui(CLogMessage(this).error("Network context not available, no updates this time")); this->ps_displayStatusMessageInGui(CLogMessage(this).error("Network context not available, no updates this time"));
@@ -156,7 +158,7 @@ bool MainWindow::isContextNetworkAvailableCheck()
/* /*
* Is the audio context available? * Is the audio context available?
*/ */
bool MainWindow::isContextAudioAvailableCheck() bool SwiftGuiStd::isContextAudioAvailableCheck()
{ {
if (this->m_contextAudioAvailable) return true; if (this->m_contextAudioAvailable) return true;
this->ps_displayStatusMessageInGui(CLogMessage(this).error("Voice context not available")); this->ps_displayStatusMessageInGui(CLogMessage(this).error("Voice context not available"));
@@ -166,7 +168,7 @@ bool MainWindow::isContextAudioAvailableCheck()
/* /*
* Display a status message * Display a status message
*/ */
void MainWindow::ps_displayStatusMessageInGui(const CStatusMessage &statusMessage) void SwiftGuiStd::ps_displayStatusMessageInGui(const CStatusMessage &statusMessage)
{ {
if (!this->m_init) return; if (!this->m_init) return;
if (statusMessage.isRedundant()) return; if (statusMessage.isRedundant()) return;
@@ -185,7 +187,7 @@ void MainWindow::ps_displayStatusMessageInGui(const CStatusMessage &statusMessag
} }
} }
void MainWindow::ps_onChangedSetttings(uint typeValue) void SwiftGuiStd::ps_onChangedSetttings(uint typeValue)
{ {
IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue); IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue);
if (type == IContextSettings::SettingsHotKeys) this->ps_registerHotkeyFunctions(); if (type == IContextSettings::SettingsHotKeys) this->ps_registerHotkeyFunctions();
@@ -194,7 +196,7 @@ void MainWindow::ps_onChangedSetttings(uint typeValue)
/* /*
* Connection terminated * Connection terminated
*/ */
void MainWindow::ps_onConnectionTerminated() void SwiftGuiStd::ps_onConnectionTerminated()
{ {
this->updateGuiStatusInformation(); this->updateGuiStatusInformation();
} }
@@ -202,7 +204,7 @@ void MainWindow::ps_onConnectionTerminated()
/* /*
* Connection status changed * Connection status changed
*/ */
void MainWindow::ps_onConnectionStatusChanged(uint /** from **/, uint to, const QString & /* message */) void SwiftGuiStd::ps_onConnectionStatusChanged(uint /** from **/, uint to, const QString & /* message */)
{ {
this->updateGuiStatusInformation(); this->updateGuiStatusInformation();
INetwork::ConnectionStatus newStatus = static_cast<INetwork::ConnectionStatus>(to); INetwork::ConnectionStatus newStatus = static_cast<INetwork::ConnectionStatus>(to);
@@ -227,7 +229,7 @@ void MainWindow::ps_onConnectionStatusChanged(uint /** from **/, uint to, const
/* /*
* Timer event * Timer event
*/ */
void MainWindow::ps_handleTimerBasedUpdates() void SwiftGuiStd::ps_handleTimerBasedUpdates()
{ {
QObject *sender = QObject::sender(); QObject *sender = QObject::sender();
if (sender == this->m_timerContextWatchdog) if (sender == this->m_timerContextWatchdog)
@@ -243,7 +245,7 @@ void MainWindow::ps_handleTimerBasedUpdates()
/* /*
* Context availability * Context availability
*/ */
void MainWindow::setContextAvailability() void SwiftGuiStd::setContextAvailability()
{ {
qint64 t = QDateTime::currentMSecsSinceEpoch(); qint64 t = QDateTime::currentMSecsSinceEpoch();
this->m_coreAvailable = this->getIContextApplication()->ping(t) == t; this->m_coreAvailable = this->getIContextApplication()->ping(t) == t;
@@ -254,7 +256,7 @@ void MainWindow::setContextAvailability()
/* /*
* Update GUI * Update GUI
*/ */
void MainWindow::updateGuiStatusInformation() void SwiftGuiStd::updateGuiStatusInformation()
{ {
const QString now = QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd HH:mm:ss"); const QString now = QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd HH:mm:ss");
QString network("unavailable"); QString network("unavailable");
@@ -273,7 +275,7 @@ void MainWindow::updateGuiStatusInformation()
/* /*
* Opacity 0-100 * Opacity 0-100
*/ */
void MainWindow::ps_changeWindowOpacity(int opacity) void SwiftGuiStd::ps_changeWindowOpacity(int opacity)
{ {
qreal o = opacity / 100.0; qreal o = opacity / 100.0;
o = o < 0.3 ? 0.3 : o; o = o < 0.3 ? 0.3 : o;
@@ -285,7 +287,7 @@ void MainWindow::ps_changeWindowOpacity(int opacity)
/* /*
* Stay on top * Stay on top
*/ */
void MainWindow::ps_toogleWindowStayOnTop() void SwiftGuiStd::ps_toogleWindowStayOnTop()
{ {
Qt::WindowFlags flags = this->windowFlags(); Qt::WindowFlags flags = this->windowFlags();
if (Qt::WindowStaysOnTopHint & flags) if (Qt::WindowStaysOnTopHint & flags)
@@ -307,7 +309,7 @@ void MainWindow::ps_toogleWindowStayOnTop()
/* /*
* Hotkey functions * Hotkey functions
*/ */
void MainWindow::ps_registerHotkeyFunctions() void SwiftGuiStd::ps_registerHotkeyFunctions()
{ {
CInputManager *m_inputManager = BlackCore::CInputManager::getInstance(); CInputManager *m_inputManager = BlackCore::CInputManager::getInstance();
@@ -330,7 +332,7 @@ void MainWindow::ps_registerHotkeyFunctions()
/* /*
* Styles * Styles
*/ */
void MainWindow::ps_onStyleSheetsChanged() void SwiftGuiStd::ps_onStyleSheetsChanged()
{ {
const QString s = CStyleSheetUtility::instance().styles( const QString s = CStyleSheetUtility::instance().styles(
{ {
@@ -341,7 +343,7 @@ void MainWindow::ps_onStyleSheetsChanged()
this->setStyleSheet(s); this->setStyleSheet(s);
} }
void MainWindow::ps_onCurrentMainWidgetChanged(int currentIndex) void SwiftGuiStd::ps_onCurrentMainWidgetChanged(int currentIndex)
{ {
emit currentMainInfoAreaChanged(this->ui->sw_MainMiddle->currentWidget()); emit currentMainInfoAreaChanged(this->ui->sw_MainMiddle->currentWidget());
Q_UNUSED(currentIndex); Q_UNUSED(currentIndex);
@@ -350,7 +352,7 @@ void MainWindow::ps_onCurrentMainWidgetChanged(int currentIndex)
/* /*
* Notification * Notification
*/ */
void MainWindow::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;

View File

@@ -9,8 +9,8 @@
//! \file //! \file
#ifndef STDGUI_SWIFTGUI_H #ifndef STDGUI_SWIFTGUISTD_H
#define STDGUI_SWIFTGUI_H #define STDGUI_SWIFTGUISTD_H
// clash with struct interface in objbase.h used to happen // clash with struct interface in objbase.h used to happen
#pragma push_macro("interface") #pragma push_macro("interface")
@@ -29,7 +29,7 @@
#include "blackgui/models/userlistmodel.h" #include "blackgui/models/userlistmodel.h"
#include "blackgui/models/statusmessagelistmodel.h" #include "blackgui/models/statusmessagelistmodel.h"
#include "blackgui/models/keyboardkeylistmodel.h" #include "blackgui/models/keyboardkeylistmodel.h"
#include "blackgui/mainwindow.h" #include "blackgui/enableforframelesswindow.h"
#include "blackgui/managedstatusbar.h" #include "blackgui/managedstatusbar.h"
#include "blackmisc/nwtextmessage.h" #include "blackmisc/nwtextmessage.h"
#include "blackmisc/loghandler.h" #include "blackmisc/loghandler.h"
@@ -41,11 +41,12 @@
#include <QLabel> #include <QLabel>
#include <QTimer> #include <QTimer>
namespace Ui { class MainWindow; } namespace Ui { class SwiftGuiStd; }
//! swift GUI //! swift GUI
class MainWindow : class SwiftGuiStd :
public BlackGui::CMainWindow, public QMainWindow,
public BlackGui::CEnableForFramelessWindow,
public BlackGui::Components::CEnableForRuntime public BlackGui::Components::CEnableForRuntime
{ {
Q_OBJECT Q_OBJECT
@@ -61,16 +62,16 @@ public:
}; };
//! Constructor //! Constructor
explicit MainWindow(BlackGui::CMainWindow::WindowMode windowMode, QWidget *parent = nullptr); explicit SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowMode, QWidget *parent = nullptr);
//! Destructor //! Destructor
~MainWindow(); ~SwiftGuiStd();
//! Init data //! Init data
void init(const BlackCore::CRuntimeConfig &runtimeConfig); void init(const BlackCore::CRuntimeConfig &runtimeConfig);
//! Log message category //! Log message category
static QString getMessageCategory() { return "swift.gui.component.mainwindow"; } static QString getMessageCategory() { return "swift.gui.stdgui"; }
signals: signals:
//! GUI is shutting down, request graceful shutdown //! GUI is shutting down, request graceful shutdown
@@ -81,16 +82,22 @@ signals:
void currentMainInfoAreaChanged(const QWidget *currentWidget); void currentMainInfoAreaChanged(const QWidget *currentWidget);
protected: protected:
//! Close event, e.g. when window is closed //! \copy QMainWindow::mouseMoveEvent
void closeEvent(QCloseEvent *event); void mouseMoveEvent(QMouseEvent *event) override { if (!handleMouseMoveEvent(event)) { QMainWindow::mouseMoveEvent(event); } ; }
//! \copy QMainWindow::mousePressEvent
void mousePressEvent(QMouseEvent *event) override { if (!handleMousePressEvent(event)) { QMainWindow::mousePressEvent(event); } }
//! \copydoc QMainWindow::closeEvent
void closeEvent(QCloseEvent *event) override;
private: private:
QScopedPointer<Ui::MainWindow> ui; QScopedPointer<Ui::SwiftGuiStd> ui;
bool m_init = false; bool m_init = false;
BlackGui::Components::CInfoWindowComponent *m_compInfoWindow = nullptr; //!< the info window (popup BlackGui::Components::CInfoWindowComponent *m_compInfoWindow = nullptr; //!< the info window (popup
BlackGui::CManagedStatusBar m_statusBar; BlackGui::CManagedStatusBar m_statusBar;
BlackInput::IKeyboard *m_keyboard = nullptr; //!< hotkeys BlackInput::IKeyboard *m_keyboard = nullptr; //!< hotkeys
BlackMisc::CLogSubscriber m_logSubscriber { this, &MainWindow::ps_displayStatusMessageInGui }; BlackMisc::CLogSubscriber m_logSubscriber { this, &SwiftGuiStd::ps_displayStatusMessageInGui };
// contexts // contexts
bool m_coreAvailable = false; bool m_coreAvailable = false;

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MainWindow</class> <class>SwiftGuiStd</class>
<widget class="QMainWindow" name="MainWindow"> <widget class="QMainWindow" name="SwiftGuiStd">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -1,5 +1,13 @@
#include "mainwindow.h" /* Copyright (C) 2013
#include "ui_mainwindow.h" * swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "swiftguistd.h"
#include "blackgui/models/atcstationlistmodel.h" #include "blackgui/models/atcstationlistmodel.h"
#include "blackcore/dbus_server.h" #include "blackcore/dbus_server.h"
#include "blackcore/context_network.h" #include "blackcore/context_network.h"
@@ -17,7 +25,7 @@ using namespace BlackMisc::Audio;
/* /*
* Load own aircraft * Load own aircraft
*/ */
bool MainWindow::ps_reloadOwnAircraft() bool SwiftGuiStd::ps_reloadOwnAircraft()
{ {
if (!this->isContextNetworkAvailableCheck()) return false; if (!this->isContextNetworkAvailableCheck()) return false;
@@ -35,7 +43,7 @@ bool MainWindow::ps_reloadOwnAircraft()
/* /*
* Position * Position
*/ */
void MainWindow::setTestPosition(const QString &wgsLatitude, const QString &wgsLongitude, const CAltitude &altitude) void SwiftGuiStd::setTestPosition(const QString &wgsLatitude, const QString &wgsLongitude, const CAltitude &altitude)
{ {
CCoordinateGeodetic coordinate( CCoordinateGeodetic coordinate(
CLatitude::fromWgs84(wgsLatitude), CLatitude::fromWgs84(wgsLatitude),
@@ -44,5 +52,5 @@ void MainWindow::setTestPosition(const QString &wgsLatitude, const QString &wgsL
this->m_ownAircraft.setPosition(coordinate); this->m_ownAircraft.setPosition(coordinate);
this->m_ownAircraft.setAltitude(altitude); this->m_ownAircraft.setAltitude(altitude);
this->getIContextOwnAircraft()->updateOwnPosition(coordinate, altitude, MainWindow::swiftGuiStandardOriginator()); this->getIContextOwnAircraft()->updateOwnPosition(coordinate, altitude, SwiftGuiStd::swiftGuiStandardOriginator());
} }

View File

@@ -7,8 +7,8 @@
* contained in the LICENSE file. * contained in the LICENSE file.
*/ */
#include "mainwindow.h" #include "swiftguistd.h"
#include "ui_mainwindow.h" #include "ui_swiftguistd.h"
#include "blackcore/dbus_server.h" #include "blackcore/dbus_server.h"
#include "blackcore/context_all_interfaces.h" #include "blackcore/context_all_interfaces.h"
#include "blackgui/stylesheetutility.h" #include "blackgui/stylesheetutility.h"
@@ -36,10 +36,12 @@ using namespace BlackGui::Components;
/* /*
* Init data * Init data
*/ */
void MainWindow::init(const CRuntimeConfig &runtimeConfig) void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
{ {
if (this->m_init) return; if (this->m_init) return;
this->setVisible(false);
// icon, initial position where intro was before // icon, initial position where intro was before
this->setWindowIcon(CIcons::swift24()); this->setWindowIcon(CIcons::swift24());
this->setWindowTitle(CProject::systemNameAndVersion()); this->setWindowTitle(CProject::systemNameAndVersion());
@@ -76,11 +78,11 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
this->m_statusBar.initStatusBar(this->ui->sb_MainStatusBar); this->m_statusBar.initStatusBar(this->ui->sb_MainStatusBar);
// signal / slots contexts / timers // signal / slots contexts / timers
connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &MainWindow::ps_onConnectionTerminated); connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &SwiftGuiStd::ps_onConnectionTerminated);
connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &MainWindow::ps_onConnectionStatusChanged); connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &SwiftGuiStd::ps_onConnectionStatusChanged);
connect(this->getIContextNetwork(), &IContextNetwork::textMessagesReceived, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::onTextMessageReceived); connect(this->getIContextNetwork(), &IContextNetwork::textMessagesReceived, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::onTextMessageReceived);
connect(this->m_timerContextWatchdog, &QTimer::timeout, this, &MainWindow::ps_handleTimerBasedUpdates); connect(this->m_timerContextWatchdog, &QTimer::timeout, this, &SwiftGuiStd::ps_handleTimerBasedUpdates);
connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &MainWindow::ps_onChangedSetttings); connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &SwiftGuiStd::ps_onChangedSetttings);
// log messages // log messages
m_logSubscriber.changeSubscription(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)); m_logSubscriber.changeSubscription(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo));
@@ -113,24 +115,26 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
// do this as last statement, so it can be used as flag // do this as last statement, so it can be used as flag
// whether init has been completed // whether init has been completed
this->setVisible(true);
this->m_init = true; this->m_init = true;
} }
// //
// GUI signals // GUI signals
// //
void MainWindow::initGuiSignals() void SwiftGuiStd::initGuiSignals()
{ {
// Remark: With new style, only methods of same signature can be connected // Remark: With new style, only methods of same signature can be connected
// This is why we still have some "old" SIGNAL/SLOT connections here // This is why we still have some "old" SIGNAL/SLOT connections here
// main window // main window
connect(this->ui->sw_MainMiddle, &QStackedWidget::currentChanged, this, &MainWindow::ps_onCurrentMainWidgetChanged); connect(this->ui->sw_MainMiddle, &QStackedWidget::currentChanged, this, &SwiftGuiStd::ps_onCurrentMainWidgetChanged);
// main keypad // main keypad
connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::selectedMainInfoAreaDockWidget, this, &MainWindow::ps_setMainPageInfoArea); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::selectedMainInfoAreaDockWidget, this, &SwiftGuiStd::ps_setMainPageInfoArea);
connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::connectPressed, this, &MainWindow::ps_loginRequested); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::connectPressed, this, &SwiftGuiStd::ps_loginRequested);
connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &MainWindow::ps_changeWindowOpacity); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &SwiftGuiStd::ps_changeWindowOpacity);
connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::identPressed, this->ui->comp_MainInfoArea->getCockpitComponent(), &CCockpitComponent::setSelectedTransponderModeStateIdent); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::identPressed, this->ui->comp_MainInfoArea->getCockpitComponent(), &CCockpitComponent::setSelectedTransponderModeStateIdent);
connect(this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::changedInfoAreaStatus, ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::onMainInfoAreaChanged); connect(this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::changedInfoAreaStatus, ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::onMainInfoAreaChanged);
@@ -138,23 +142,23 @@ void MainWindow::initGuiSignals()
connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::commandEntered, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::parseCommandLine); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::commandEntered, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::parseCommandLine);
// menu // menu
connect(this->ui->menu_ReloadSettings, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_ReloadSettings, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_TestLocationsEDDF, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_TestLocationsEDDF, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_TestLocationsEDDM, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_TestLocationsEDDM, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_TestLocationsEDNX, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_TestLocationsEDNX, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_TestLocationsEDRY, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_TestLocationsEDRY, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_FileClose, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileClose, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_FileSettingsDirectory, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileSettingsDirectory, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_FileResetSettings, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileResetSettings, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_FileReloadStyleSheets, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileReloadStyleSheets, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
connect(this->ui->menu_FileFont, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileFont, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
// command line / text messages // command line / text messages
connect(this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::displayInInfoWindow, this->m_compInfoWindow, &CInfoWindowComponent::display); connect(this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::displayInInfoWindow, this->m_compInfoWindow, &CInfoWindowComponent::display);
// settings (GUI component), styles // settings (GUI component), styles
connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &MainWindow::ps_changeWindowOpacity); connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &SwiftGuiStd::ps_changeWindowOpacity);
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &MainWindow::ps_onStyleSheetsChanged); connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &SwiftGuiStd::ps_onStyleSheetsChanged);
// sliders // sliders
connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedUsersUpdateInterval, this->ui->comp_MainInfoArea->getUserComponent(), &CUserComponent::setUpdateIntervalSeconds); connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedUsersUpdateInterval, this->ui->comp_MainInfoArea->getUserComponent(), &CUserComponent::setUpdateIntervalSeconds);
@@ -162,10 +166,10 @@ void MainWindow::initGuiSignals()
connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAtcStationsUpdateInterval, this->ui->comp_MainInfoArea->getAtcStationComponent(), &::CAtcStationComponent::setUpdateIntervalSeconds); connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAtcStationsUpdateInterval, this->ui->comp_MainInfoArea->getAtcStationComponent(), &::CAtcStationComponent::setUpdateIntervalSeconds);
// login // login
connect(this->ui->comp_Login, &CLoginComponent::loginOrLogoffCancelled, this, &MainWindow::ps_setMainPageToInfoArea); connect(this->ui->comp_Login, &CLoginComponent::loginOrLogoffCancelled, this, &SwiftGuiStd::ps_setMainPageToInfoArea);
connect(this->ui->comp_Login, &CLoginComponent::loginOrLogoffSuccessful, this, &MainWindow::ps_setMainPageToInfoArea); connect(this->ui->comp_Login, &CLoginComponent::loginOrLogoffSuccessful, this, &SwiftGuiStd::ps_setMainPageToInfoArea);
connect(this->ui->comp_Login, &CLoginComponent::loginOrLogoffSuccessful, this->ui->comp_MainInfoArea->getFlightPlanComponent(), &CFlightPlanComponent::loginDataSet); connect(this->ui->comp_Login, &CLoginComponent::loginOrLogoffSuccessful, this->ui->comp_MainInfoArea->getFlightPlanComponent(), &CFlightPlanComponent::loginDataSet);
connect(this, &MainWindow::currentMainInfoAreaChanged, this->ui->comp_Login, &CLoginComponent::mainInfoAreaChanged); connect(this, &SwiftGuiStd::currentMainInfoAreaChanged, this->ui->comp_Login, &CLoginComponent::mainInfoAreaChanged);
connect(this->ui->comp_Login, &CLoginComponent::requestNetworkSettings, this->ui->comp_MainInfoArea->getFlightPlanComponent(), [ = ]() connect(this->ui->comp_Login, &CLoginComponent::requestNetworkSettings, this->ui->comp_MainInfoArea->getFlightPlanComponent(), [ = ]()
{ {
this->ps_setMainPageInfoArea(CMainInfoAreaComponent::InfoAreaSettings); this->ps_setMainPageInfoArea(CMainInfoAreaComponent::InfoAreaSettings);
@@ -177,7 +181,7 @@ void MainWindow::initGuiSignals()
/* /*
* Init data when started * Init data when started
*/ */
void MainWindow::initialDataReads() void SwiftGuiStd::initialDataReads()
{ {
qint64 t = QDateTime::currentMSecsSinceEpoch(); qint64 t = QDateTime::currentMSecsSinceEpoch();
this->m_coreAvailable = (this->getIContextNetwork()->isUsingImplementingObject() || (this->getIContextApplication()->ping(t) == t)); this->m_coreAvailable = (this->getIContextNetwork()->isUsingImplementingObject() || (this->getIContextApplication()->ping(t) == t));
@@ -195,7 +199,7 @@ void MainWindow::initialDataReads()
/* /*
* Start update timers * Start update timers
*/ */
void MainWindow::startUpdateTimersWhenConnected() void SwiftGuiStd::startUpdateTimersWhenConnected()
{ {
this->ui->comp_MainInfoArea->getAtcStationComponent()->setUpdateIntervalSeconds(this->ui->comp_MainInfoArea->getSettingsComponent()->getAtcUpdateIntervalSeconds()); this->ui->comp_MainInfoArea->getAtcStationComponent()->setUpdateIntervalSeconds(this->ui->comp_MainInfoArea->getSettingsComponent()->getAtcUpdateIntervalSeconds());
this->ui->comp_MainInfoArea->getAircraftComponent()->setUpdateIntervalSeconds(this->ui->comp_MainInfoArea->getSettingsComponent()->getAircraftUpdateIntervalSeconds()); this->ui->comp_MainInfoArea->getAircraftComponent()->setUpdateIntervalSeconds(this->ui->comp_MainInfoArea->getSettingsComponent()->getAircraftUpdateIntervalSeconds());
@@ -205,7 +209,7 @@ void MainWindow::startUpdateTimersWhenConnected()
/* /*
* Stop udate timers * Stop udate timers
*/ */
void MainWindow::stopUpdateTimersWhenDisconnected() void SwiftGuiStd::stopUpdateTimersWhenDisconnected()
{ {
this->ui->comp_MainInfoArea->getAtcStationComponent()->stopTimer(); this->ui->comp_MainInfoArea->getAtcStationComponent()->stopTimer();
this->ui->comp_MainInfoArea->getAircraftComponent()->stopTimer(); this->ui->comp_MainInfoArea->getAircraftComponent()->stopTimer();
@@ -215,7 +219,7 @@ void MainWindow::stopUpdateTimersWhenDisconnected()
/* /*
* Stop all timers * Stop all timers
*/ */
void MainWindow::stopAllTimers(bool disconnect) void SwiftGuiStd::stopAllTimers(bool disconnect)
{ {
this->m_timerContextWatchdog->stop(); this->m_timerContextWatchdog->stop();
this->stopUpdateTimersWhenDisconnected(); this->stopUpdateTimersWhenDisconnected();

View File

@@ -1,5 +1,5 @@
#include "mainwindow.h" #include "swiftguistd.h"
#include "ui_mainwindow.h" #include "ui_swiftguistd.h"
#include "blackgui/stylesheetutility.h" #include "blackgui/stylesheetutility.h"
#include "blackmisc/statusmessagelist.h" #include "blackmisc/statusmessagelist.h"
#include "blackmisc/avaltitude.h" #include "blackmisc/avaltitude.h"
@@ -18,7 +18,7 @@ using namespace BlackMisc::Aviation;
/* /*
* Menu clicked * Menu clicked
*/ */
void MainWindow::ps_onMenuClicked() void SwiftGuiStd::ps_onMenuClicked()
{ {
QObject *sender = QObject::sender(); QObject *sender = QObject::sender();
if (sender == this->ui->menu_TestLocationsEDRY) if (sender == this->ui->menu_TestLocationsEDRY)
@@ -68,8 +68,7 @@ void MainWindow::ps_onMenuClicked()
} }
} }
void SwiftGuiStd::initDynamicMenus()
void MainWindow::initDynamicMenus()
{ {
Q_ASSERT(this->ui->menu_InfoAreas); Q_ASSERT(this->ui->menu_InfoAreas);
Q_ASSERT(this->ui->comp_MainInfoArea); Q_ASSERT(this->ui->comp_MainInfoArea);