refs #335, reflecting changes in main window

This commit is contained in:
Klaus Basan
2014-10-29 01:37:04 +01:00
committed by Roland Winklmeier
parent 28b99de1da
commit 7a449093dd
3 changed files with 34 additions and 54 deletions

View File

@@ -15,12 +15,7 @@
#undef interface #undef interface
#include "guimodeenums.h" #include "guimodeenums.h"
#include "blackcore/context_audio.h" #include "blackcore/context_all_interfaces.h"
#include "blackcore/context_network.h"
#include "blackcore/context_settings.h"
#include "blackcore/context_application.h"
#include "blackcore/context_simulator.h"
#include "blackcore/context_runtime.h"
#include "blackcore/input_manager.h" #include "blackcore/input_manager.h"
#include "blackgui/components/enableforruntime.h" #include "blackgui/components/enableforruntime.h"
#include "blackgui/components/infowindowcomponent.h" #include "blackgui/components/infowindowcomponent.h"
@@ -80,7 +75,7 @@ protected:
//! \remarks keep the values in sync with the real tab indexes //! \remarks keep the values in sync with the real tab indexes
enum MainPageIndex enum MainPageIndex
{ {
MainPageCockpit = 0, MainPageLogin = 0,
MainPageInfoArea = 1 MainPageInfoArea = 1
}; };
@@ -88,7 +83,7 @@ private:
QScopedPointer<Ui::MainWindow> ui; QScopedPointer<Ui::MainWindow> ui;
BlackGui::Components::CInfoWindowComponent *m_compInfoWindow = nullptr; //!< the info window (popup BlackGui::Components::CInfoWindowComponent *m_compInfoWindow = nullptr; //!< the info window (popup
bool m_init = false; bool m_init = false;
GuiModes::WindowMode m_windowMode; GuiModes::WindowMode m_windowMode = GuiModes::WindowNormal;
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, &MainWindow::ps_displayStatusMessageInGui };

View File

@@ -125,9 +125,9 @@
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="pg_Cockpit"> <widget class="QWidget" name="pg_LoginConfirmation">
<layout class="QVBoxLayout" name="vl_CockpitPage"> <layout class="QVBoxLayout" name="vl_CockpitPage">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -144,9 +144,6 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="BlackGui::Components::CCockpitV1Component" name="comp_Cockpit" native="true"/>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="pg_MainInfoArea"> <widget class="QWidget" name="pg_MainInfoArea">
@@ -354,12 +351,6 @@
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>
<customwidget>
<class>BlackGui::Components::CCockpitV1Component</class>
<extends>QWidget</extends>
<header>blackgui/components/cockpitv1component.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>BlackGui::Components::CMainInfoAreaComponent</class> <class>BlackGui::Components::CMainInfoAreaComponent</class>
<extends>QWidget</extends> <extends>QWidget</extends>

View File

@@ -16,6 +16,7 @@
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <QSizeGrip> #include <QSizeGrip>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QPushButton>
using namespace BlackCore; using namespace BlackCore;
using namespace BlackMisc; using namespace BlackMisc;
@@ -85,34 +86,26 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
} }
// signal / slots contexts / timers // signal / slots contexts / timers
bool connect; connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &MainWindow::ps_onConnectionTerminated);
this->connect(this->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &MainWindow::ps_onConnectionTerminated); connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &MainWindow::ps_onConnectionStatusChanged);
this->connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &MainWindow::ps_onConnectionStatusChanged); connect(this->getIContextNetwork(), &IContextNetwork::textMessagesReceived, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::onTextMessageReceived);
connect = this->connect(this->getIContextNetwork(), SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList)), this->ui->comp_MainInfoArea->getTextMessageComponent(), SLOT(appendTextMessagesToGui(BlackMisc::Network::CTextMessageList))); connect(this->m_timerContextWatchdog, &QTimer::timeout, this, &MainWindow::ps_handleTimerBasedUpdates);
Q_ASSERT(connect); connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &MainWindow::ps_onChangedSetttings);
this->connect(this->m_timerContextWatchdog, &QTimer::timeout, this, &MainWindow::ps_handleTimerBasedUpdates);
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &MainWindow::ps_onChangedSetttings);
// sliders // sliders
this->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);
this->connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAircraftsUpdateInterval, this->ui->comp_MainInfoArea->getAircraftComponent(), &CAircraftComponent::setUpdateIntervalSeconds); connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedAircraftsUpdateInterval, this->ui->comp_MainInfoArea->getAircraftComponent(), &CAircraftComponent::setUpdateIntervalSeconds);
this->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);
// log messages // log messages
m_logSubscriber.changeSubscription(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)); m_logSubscriber.changeSubscription(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo));
Q_ASSERT(connect);
Q_UNUSED(connect); // suppress GCC warning in release build
// start timers, update timers will be started when network is connected // start timers, update timers will be started when network is connected
this->m_timerContextWatchdog->start(2 * 1000); this->m_timerContextWatchdog->start(2 * 1000);
// init availability // init availability
this->setContextAvailability(); this->setContextAvailability();
// key pad area
QObject::connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::selectedMainInfoAreaDockWidget, this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::selectArea);
// data // data
this->initialDataReads(); this->initialDataReads();
@@ -146,31 +139,32 @@ void MainWindow::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 buttons // Main keypad
this->connect(this->ui->comp_MainKeypadArea, SIGNAL(selectedMainInfoAreaDockWidget(CMainInfoAreaComponent::InfoArea)), this, SLOT(ps_setMainPage())); connect(this->ui->comp_MainKeypadArea, SIGNAL(selectedMainInfoAreaDockWidget(CMainInfoAreaComponent::InfoArea)), this, SLOT(ps_setMainPage()));
this->connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::connectPressed, this, &MainWindow::ps_toggleNetworkConnection); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::connectPressed, this, &MainWindow::ps_toggleNetworkConnection);
this->connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &MainWindow::ps_changeWindowOpacity); connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &MainWindow::ps_changeWindowOpacity);
this->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_MainKeypadArea, &CMainKeypadAreaComponent::selectedMainInfoAreaDockWidget, this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::selectArea);
connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::commandEntered, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::parseCommandLine);
// menu // menu
this->connect(this->ui->menu_ReloadSettings, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_ReloadSettings, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_TestLocationsEDDF, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_TestLocationsEDDF, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_TestLocationsEDDM, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_TestLocationsEDDM, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_TestLocationsEDNX, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_TestLocationsEDNX, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_TestLocationsEDRY, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_TestLocationsEDRY, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_FileClose, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileClose, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_FileSettingsDirectory, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileSettingsDirectory, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_FileResetSettings, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileResetSettings, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_FileReloadStyleSheets, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileReloadStyleSheets, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
this->connect(this->ui->menu_FileFont, &QAction::triggered, this, &MainWindow::ps_onMenuClicked); connect(this->ui->menu_FileFont, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
// command line / text messages // command line / text messages
this->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);
this->ui->comp_MainInfoArea->getTextMessageComponent()->setSelcalCallback(std::bind(&CCockpitV1Component::getSelcalCode, this->ui->comp_Cockpit));
// settings (GUI component), styles // settings (GUI component), styles
this->connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &MainWindow::ps_changeWindowOpacity); connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &MainWindow::ps_changeWindowOpacity);
this->connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &MainWindow::ps_onStyleSheetsChanged); connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &MainWindow::ps_onStyleSheetsChanged);
} }
/* /*