refs #195, updated GUI with new specialized views

As a result, all models for TableViews are gone, as well as the context menu for status messages
This commit is contained in:
Klaus Basan
2014-04-20 18:33:41 +02:00
parent 60f1b285ec
commit 05a7cbcb26
9 changed files with 77 additions and 212 deletions

View File

@@ -26,10 +26,6 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
ui(new Ui::MainWindow), ui(new Ui::MainWindow),
m_infoWindow(nullptr), m_infoWindow(nullptr),
m_init(false), m_windowMode(windowMode), m_audioTestRunning(NoAudioTest), m_init(false), m_windowMode(windowMode), m_audioTestRunning(NoAudioTest),
// table view models
m_statusMessageList(nullptr),
m_modelAtcListOnline(nullptr), m_modelAtcListBooked(nullptr), m_modelTrafficServerList(nullptr), m_modelAircraftsInRange(nullptr),
m_modelAllUsers(nullptr), m_modelUsersVoiceCom1(nullptr), m_modelUsersVoiceCom2(nullptr), m_modelSettingsHotKeys(nullptr),
// contexts and runtime // contexts and runtime
m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextAudioAvailable(false), m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextAudioAvailable(false),
@@ -263,9 +259,7 @@ void MainWindow::displayStatusMessage(const CStatusMessage &statusMessage)
this->m_statusBarLabel->setText(statusMessage.getMessage()); this->m_statusBarLabel->setText(statusMessage.getMessage());
// list // list
this->m_statusMessageList->insert(statusMessage); this->ui->tvp_StatusMessages->insert(statusMessage);
this->ui->tv_StatusMessages->resizeColumnsToContents();
this->ui->tv_StatusMessages->resizeRowsToContents();
if (statusMessage.getSeverity() == CStatusMessage::SeverityError) this->displayOverlayInfo(statusMessage); if (statusMessage.getSeverity() == CStatusMessage::SeverityError) this->displayOverlayInfo(statusMessage);
} }
@@ -388,7 +382,7 @@ void MainWindow::middlePanelChanged(int /* index */)
if (this->ui->sw_MainMiddle->currentWidget() == this->ui->pg_AircraftsInRange) if (this->ui->sw_MainMiddle->currentWidget() == this->ui->pg_AircraftsInRange)
{ {
if (this->m_modelAircraftsInRange->rowCount() < 1) if (this->ui->tvp_AircraftsInRange->rowCount() < 1)
this->reloadAircraftsInRange(); this->reloadAircraftsInRange();
} }
} }
@@ -500,10 +494,7 @@ void MainWindow::displayOverlayInfo(const CStatusMessage &message)
void MainWindow::reloadAllUsers() void MainWindow::reloadAllUsers()
{ {
if (!this->isContextNetworkAvailableCheck()) return; if (!this->isContextNetworkAvailableCheck()) return;
this->m_modelAllUsers->update(this->m_rt->getIContextNetwork()->getUsers()); this->ui->tvp_AllUsers->update(this->m_rt->getIContextNetwork()->getUsers());
this->ui->tv_AllUsers->resizeColumnsToContents();
this->ui->tv_AllUsers->resizeRowsToContents();
this->ui->tv_AllUsers->horizontalHeader()->setStretchLastSection(true);
} }
void MainWindow::updateSimulatorData() void MainWindow::updateSimulatorData()

View File

@@ -99,18 +99,6 @@ private:
GuiModes::WindowMode m_windowMode; GuiModes::WindowMode m_windowMode;
AudioTest m_audioTestRunning; AudioTest m_audioTestRunning;
// the table view models
// normal pointers, as these will be deleted by parent
BlackGui::CStatusMessageListModel *m_statusMessageList;
BlackGui::CAtcListModel *m_modelAtcListOnline;
BlackGui::CAtcListModel *m_modelAtcListBooked;
BlackGui::CServerListModel *m_modelTrafficServerList;
BlackGui::CAircraftListModel *m_modelAircraftsInRange;
BlackGui::CUserListModel *m_modelAllUsers;
BlackGui::CUserListModel *m_modelUsersVoiceCom1;
BlackGui::CUserListModel *m_modelUsersVoiceCom2;
BlackGui::CKeyboardKeyListModel *m_modelSettingsHotKeys;
// contexts // contexts
bool m_coreAvailable; bool m_coreAvailable;
bool m_contextNetworkAvailable; bool m_contextNetworkAvailable;
@@ -412,9 +400,6 @@ private slots:
//! Context menu for audio //! Context menu for audio
void audioIconContextMenu(const QPoint &position); void audioIconContextMenu(const QPoint &position);
//! Context menu for message list
void messageListContextMenu(const QPoint &position);
//! Test SELCAL (code valid? play tone) //! Test SELCAL (code valid? play tone)
void testSelcal(); void testSelcal();

View File

@@ -554,7 +554,7 @@ QStatusBar QLabel {
<item> <item>
<widget class="QToolBox" name="tb_StatusPage"> <widget class="QToolBox" name="tb_StatusPage">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<property name="tabSpacing"> <property name="tabSpacing">
<number>3</number> <number>3</number>
@@ -588,7 +588,7 @@ QStatusBar QLabel {
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="tv_StatusMessages"> <widget class="BlackGui::CStatusMessageView" name="tvp_StatusMessages">
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum> <enum>QAbstractItemView::SingleSelection</enum>
</property> </property>
@@ -735,7 +735,7 @@ QStatusBar QLabel {
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="tv_AtcStationsOnline"> <widget class="BlackGui::CAtcStationView" name="tvp_AtcStationsOnline">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -945,7 +945,7 @@ QStatusBar QLabel {
<number>3</number> <number>3</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="tv_AtcStationsBooked"> <widget class="BlackGui::CAtcStationView" name="tvp_AtcStationsBooked">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
@@ -1006,7 +1006,7 @@ QStatusBar QLabel {
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="tv_AircraftsInRange"> <widget class="BlackGui::CAircraftView" name="tvp_AircraftsInRange">
<attribute name="verticalHeaderVisible"> <attribute name="verticalHeaderVisible">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
@@ -1032,7 +1032,7 @@ QStatusBar QLabel {
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="tv_AllUsers"> <widget class="BlackGui::CUserView" name="tvp_AllUsers">
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum> <enum>QAbstractItemView::SingleSelection</enum>
</property> </property>
@@ -1559,7 +1559,7 @@ QStatusBar QLabel {
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QTableView" name="tv_CockpitVoiceRoom1"> <widget class="BlackGui::CUserView" name="tvp_CockpitVoiceRoom1">
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum> <enum>QAbstractItemView::SingleSelection</enum>
</property> </property>
@@ -1572,7 +1572,7 @@ QStatusBar QLabel {
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QTableView" name="tv_CockpitVoiceRoom2"> <widget class="BlackGui::CUserView" name="tvp_CockpitVoiceRoom2">
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum> <enum>QAbstractItemView::SingleSelection</enum>
</property> </property>
@@ -1793,7 +1793,7 @@ QStatusBar QLabel {
<item> <item>
<widget class="QTabWidget" name="Simulator"> <widget class="QTabWidget" name="Simulator">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tb_SettingsTrafficNetwork"> <widget class="QWidget" name="tb_SettingsTrafficNetwork">
<attribute name="title"> <attribute name="title">
@@ -1816,7 +1816,7 @@ QStatusBar QLabel {
<number>1</number> <number>1</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="tv_SettingsTnServers"> <widget class="BlackGui::CServerView" name="tvp_SettingsTnServers">
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set> <set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
</property> </property>
@@ -2546,7 +2546,7 @@ QStatusBar QLabel {
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="tv_SettingsMiscHotkeys"> <widget class="BlackGui::CKeyboardKeyView" name="tvp_SettingsMiscHotkeys">
<property name="cornerButtonEnabled"> <property name="cornerButtonEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -3256,23 +3256,53 @@ QStatusBar QLabel {
<extends>QComboBox</extends> <extends>QComboBox</extends>
<header>blackgui/transpondermodeselector.h</header> <header>blackgui/transpondermodeselector.h</header>
</customwidget> </customwidget>
<customwidget>
<class>BlackGui::CStatusMessageView</class>
<extends>QTableView</extends>
<header>blackgui/statusmessageview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::CAtcStationView</class>
<extends>QTableView</extends>
<header>blackgui/atcstationview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::CUserView</class>
<extends>QTableView</extends>
<header>blackgui/userview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::CAircraftView</class>
<extends>QTableView</extends>
<header>blackgui/aircraftview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::CKeyboardKeyView</class>
<extends>QTableView</extends>
<header>blackgui/keyboardkeyview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::CServerView</class>
<extends>QTableView</extends>
<header>blackgui/serverview.h</header>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>cb_StatusWithDBus</tabstop> <tabstop>cb_StatusWithDBus</tabstop>
<tabstop>le_StatusNetworkContext</tabstop> <tabstop>le_StatusNetworkContext</tabstop>
<tabstop>le_StatusAudioContext</tabstop> <tabstop>le_StatusAudioContext</tabstop>
<tabstop>tv_StatusMessages</tabstop> <tabstop>tvp_StatusMessages</tabstop>
<tabstop>le_CommandLineInput</tabstop> <tabstop>le_CommandLineInput</tabstop>
<tabstop>tw_AtcStations</tabstop> <tabstop>tw_AtcStations</tabstop>
<tabstop>tv_AtcStationsOnline</tabstop> <tabstop>tvp_AtcStationsOnline</tabstop>
<tabstop>te_AtcStationsOnlineInfo</tabstop> <tabstop>te_AtcStationsOnlineInfo</tabstop>
<tabstop>le_AtcStationsOnlineMetar</tabstop> <tabstop>le_AtcStationsOnlineMetar</tabstop>
<tabstop>pb_AtcStationsLoadMetar</tabstop> <tabstop>pb_AtcStationsLoadMetar</tabstop>
<tabstop>pb_AtcStationsAtisReload</tabstop> <tabstop>pb_AtcStationsAtisReload</tabstop>
<tabstop>tv_AtcStationsBooked</tabstop> <tabstop>tvp_AtcStationsBooked</tabstop>
<tabstop>pb_ReloadAtcStationsBooked</tabstop> <tabstop>pb_ReloadAtcStationsBooked</tabstop>
<tabstop>tv_AircraftsInRange</tabstop> <tabstop>tvp_AircraftsInRange</tabstop>
<tabstop>tv_AllUsers</tabstop> <tabstop>tvp_AllUsers</tabstop>
<tabstop>pb_CockpitToggleCom1</tabstop> <tabstop>pb_CockpitToggleCom1</tabstop>
<tabstop>ds_CockpitCom1Active</tabstop> <tabstop>ds_CockpitCom1Active</tabstop>
<tabstop>ds_CockpitCom1Standby</tabstop> <tabstop>ds_CockpitCom1Standby</tabstop>
@@ -3290,15 +3320,15 @@ QStatusBar QLabel {
<tabstop>cb_CockpitVoiceRoom1Override</tabstop> <tabstop>cb_CockpitVoiceRoom1Override</tabstop>
<tabstop>le_CockpitVoiceRoomCom2</tabstop> <tabstop>le_CockpitVoiceRoomCom2</tabstop>
<tabstop>cb_CockpitVoiceRoom2Override</tabstop> <tabstop>cb_CockpitVoiceRoom2Override</tabstop>
<tabstop>tv_CockpitVoiceRoom1</tabstop> <tabstop>tvp_CockpitVoiceRoom1</tabstop>
<tabstop>tv_CockpitVoiceRoom2</tabstop> <tabstop>tvp_CockpitVoiceRoom2</tabstop>
<tabstop>tw_TextMessages</tabstop> <tabstop>tw_TextMessages</tabstop>
<tabstop>te_TextMessagesAll</tabstop> <tabstop>te_TextMessagesAll</tabstop>
<tabstop>te_TextMessagesUnicom</tabstop> <tabstop>te_TextMessagesUnicom</tabstop>
<tabstop>te_TextMessagesCOM1</tabstop> <tabstop>te_TextMessagesCOM1</tabstop>
<tabstop>te_TextMessagesCOM2</tabstop> <tabstop>te_TextMessagesCOM2</tabstop>
<tabstop>Simulator</tabstop> <tabstop>Simulator</tabstop>
<tabstop>tv_SettingsTnServers</tabstop> <tabstop>tvp_SettingsTnServers</tabstop>
<tabstop>le_SettingsTnCsName</tabstop> <tabstop>le_SettingsTnCsName</tabstop>
<tabstop>le_SettingsTnCsDescription</tabstop> <tabstop>le_SettingsTnCsDescription</tabstop>
<tabstop>le_SettingsTnCsAddress</tabstop> <tabstop>le_SettingsTnCsAddress</tabstop>

View File

@@ -20,9 +20,7 @@ using namespace BlackMisc::Audio;
void MainWindow::reloadAircraftsInRange() void MainWindow::reloadAircraftsInRange()
{ {
if (!this->isContextNetworkAvailableCheck()) return; if (!this->isContextNetworkAvailableCheck()) return;
this->m_modelAircraftsInRange->update(this->m_rt->getIContextNetwork()->getAircraftsInRange()); this->ui->tvp_AircraftsInRange->update(this->m_rt->getIContextNetwork()->getAircraftsInRange());
this->ui->tv_AircraftsInRange->resizeColumnsToContents();
this->ui->tv_AircraftsInRange->resizeRowsToContents();
} }
/* /*

View File

@@ -20,9 +20,7 @@ using namespace BlackMisc::Settings;
void MainWindow::reloadAtcStationsBooked() void MainWindow::reloadAtcStationsBooked()
{ {
if (!this->isContextNetworkAvailableCheck()) return; if (!this->isContextNetworkAvailableCheck()) return;
this->m_modelAtcListBooked->update(this->m_rt->getIContextNetwork()->getAtcStationsBooked()); this->ui->tvp_AtcStationsBooked->update(this->m_rt->getIContextNetwork()->getAtcStationsBooked());
this->ui->tv_AtcStationsBooked->resizeColumnsToContents();
this->ui->tv_AtcStationsBooked->resizeRowsToContents();
} }
/* /*
@@ -31,10 +29,7 @@ void MainWindow::reloadAtcStationsBooked()
void MainWindow::reloadAtcStationsOnline() void MainWindow::reloadAtcStationsOnline()
{ {
if (!this->isContextNetworkAvailableCheck()) return; if (!this->isContextNetworkAvailableCheck()) return;
this->m_modelAtcListOnline->update(this->m_rt->getIContextNetwork()->getAtcStationsOnline()); this->ui->tvp_AtcStationsOnline->update(this->m_rt->getIContextNetwork()->getAtcStationsOnline());
this->ui->tv_AtcStationsOnline->resizeColumnsToContents();
this->ui->tv_AtcStationsOnline->resizeRowsToContents();
if (!this->m_rt->getIContextNetwork()->isConnected()) if (!this->m_rt->getIContextNetwork()->isConnected())
{ {
// clear metar/ATIS // clear metar/ATIS
@@ -51,7 +46,7 @@ void MainWindow::reloadAtcStationsOnline()
void MainWindow::onlineAtcStationSelected(QModelIndex index) void MainWindow::onlineAtcStationSelected(QModelIndex index)
{ {
this->ui->te_AtcStationsOnlineInfo->setText(""); // reset this->ui->te_AtcStationsOnlineInfo->setText(""); // reset
const CAtcStation stationClicked = this->m_modelAtcListOnline->at(index); const CAtcStation stationClicked = this->ui->tvp_AtcStationsBooked->derivedModel()->at(index);
QString infoMessage; QString infoMessage;
if (stationClicked.hasAtis()) if (stationClicked.hasAtis())
@@ -101,7 +96,7 @@ void MainWindow::atcStationTabChanged(int /** tabIndex **/)
{ {
if (this->ui->tw_AtcStations->currentWidget() == this->ui->tb_AtcStationsBooked) if (this->ui->tw_AtcStations->currentWidget() == this->ui->tb_AtcStationsBooked)
{ {
if (this->m_modelAtcListBooked->rowCount() < 1) if (this->ui->tvp_AtcStationsBooked->rowCount() < 1)
this->reloadAtcStationsBooked(); this->reloadAtcStationsBooked();
} }
else if (this->ui->tw_AtcStations->currentWidget() == this->ui->tb_AtcStationsOnline) else if (this->ui->tw_AtcStations->currentWidget() == this->ui->tb_AtcStationsOnline)

View File

@@ -118,8 +118,6 @@ void MainWindow::updateCockpitFromContext()
// these are the ones featuring the real audio status // these are the ones featuring the real audio status
CVoiceRoomList rooms = this->m_rt->getIContextAudio()->getComVoiceRoomsWithAudioStatus(); CVoiceRoomList rooms = this->m_rt->getIContextAudio()->getComVoiceRoomsWithAudioStatus();
Q_ASSERT(rooms.size() == 2); Q_ASSERT(rooms.size() == 2);
Q_ASSERT(this->m_modelUsersVoiceCom1);
Q_ASSERT(this->m_modelUsersVoiceCom2);
CVoiceRoom room1 = rooms[0]; CVoiceRoom room1 = rooms[0];
CVoiceRoom room2 = rooms[1]; CVoiceRoom room2 = rooms[1];
@@ -127,15 +125,8 @@ void MainWindow::updateCockpitFromContext()
bool com2Connected = room2.isConnected(); bool com2Connected = room2.isConnected();
// update views // update views
this->m_modelUsersVoiceCom1->update(this->m_rt->getIContextAudio()->getCom1RoomUsers()); this->ui->tvp_CockpitVoiceRoom1->update(this->m_rt->getIContextAudio()->getCom1RoomUsers());
this->ui->tv_CockpitVoiceRoom1->resizeColumnsToContents(); this->ui->tvp_CockpitVoiceRoom1->update(this->m_rt->getIContextAudio()->getCom1RoomUsers());
this->ui->tv_CockpitVoiceRoom1->resizeRowsToContents();
this->ui->tv_CockpitVoiceRoom1->horizontalHeader()->setStretchLastSection(true);
this->m_modelUsersVoiceCom2->update(this->m_rt->getIContextAudio()->getCom2RoomUsers());
this->ui->tv_CockpitVoiceRoom2->resizeColumnsToContents();
this->ui->tv_CockpitVoiceRoom2->resizeRowsToContents();
this->ui->tv_CockpitVoiceRoom2->horizontalHeader()->setStretchLastSection(true);
// highlite voice room according to status // highlite voice room according to status
QString vrStyle1; QString vrStyle1;

View File

@@ -55,101 +55,10 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
this->ui->sb_MainStatusBar->addPermanentWidget(grip); this->ui->sb_MainStatusBar->addPermanentWidget(grip);
} }
// init models, the delete allows to re-init // init models
if (this->m_statusMessageList != nullptr) this->m_statusMessageList->deleteLater(); this->ui->tvp_AtcStationsBooked->setStationMode(CAtcStationListModel::StationsBooked);
this->m_statusMessageList = new CStatusMessageListModel(this); this->ui->tvp_CockpitVoiceRoom1->setUserMode(CUserListModel::UserShort);
this->ui->tvp_CockpitVoiceRoom2->setUserMode(CUserListModel::UserShort);
if (this->m_modelAtcListBooked != nullptr) this->m_modelAtcListBooked->deleteLater();
this->m_modelAtcListBooked = new CAtcListModel(this);
if (this->m_modelAtcListOnline != nullptr) this->m_modelAtcListOnline->deleteLater();
this->m_modelAtcListOnline = new CAtcListModel(this);
if (this->m_modelTrafficServerList != nullptr) this->m_modelTrafficServerList->deleteLater();
this->m_modelTrafficServerList = new CServerListModel(this);
if (this->m_modelAircraftsInRange != nullptr) this->m_modelAircraftsInRange->deleteLater();
this->m_modelAircraftsInRange = new CAircraftListModel(this);
if (this->m_modelAllUsers != nullptr) this->m_modelAllUsers->deleteLater();
this->m_modelAllUsers = new CUserListModel(this);
if (this->m_modelUsersVoiceCom1 != nullptr) this->m_modelUsersVoiceCom1->deleteLater();
this->m_modelUsersVoiceCom1 = new CUserListModel(this);
if (this->m_modelUsersVoiceCom2 != nullptr) this->m_modelUsersVoiceCom2->deleteLater();
this->m_modelUsersVoiceCom2 = new CUserListModel(this);
if (this->m_modelSettingsHotKeys != nullptr) this->m_modelSettingsHotKeys->deleteLater();
this->m_modelSettingsHotKeys = new CKeyboardKeyListModel(this);
// set sort order and models
// enable sorting first, otherwise order in the model will be reset
this->ui->tv_SettingsTnServers->setModel(this->m_modelTrafficServerList);
this->ui->tv_SettingsTnServers->horizontalHeader()->setStretchLastSection(true);
this->ui->tv_StatusMessages->setSortingEnabled(true);
this->ui->tv_StatusMessages->setModel(this->m_statusMessageList);
this->m_statusMessageList->setSortColumnByPropertyIndex(BlackMisc::CStatusMessage::IndexTimestamp);
if (this->m_statusMessageList->hasValidSortColumn())
this->ui->tv_StatusMessages->horizontalHeader()->setSortIndicator(this->m_statusMessageList->getSortColumn(), this->m_statusMessageList->getSortOrder());
this->ui->tv_StatusMessages->horizontalHeader()->setStretchLastSection(true);
this->ui->tv_AtcStationsOnline->setSortingEnabled(true);
this->ui->tv_AtcStationsOnline->setModel(this->m_modelAtcListOnline);
this->m_modelAtcListBooked->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAtcStation::IndexDistance);
if (this->m_modelAtcListOnline->hasValidSortColumn())
this->ui->tv_AtcStationsOnline->horizontalHeader()->setSortIndicator(this->m_modelAtcListOnline->getSortColumn(), this->m_modelAtcListOnline->getSortOrder());
this->ui->tv_AtcStationsBooked->setSortingEnabled(true);
this->ui->tv_AtcStationsBooked->setModel(this->m_modelAtcListBooked);
this->m_modelAtcListBooked->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAtcStation::IndexBookedFrom);
if (this->m_modelAtcListBooked->hasValidSortColumn())
this->ui->tv_AtcStationsBooked->horizontalHeader()->setSortIndicator(this->m_modelAtcListBooked->getSortColumn(), this->m_modelAtcListBooked->getSortOrder());
this->ui->tv_AircraftsInRange->setSortingEnabled(true);
this->ui->tv_AircraftsInRange->setModel(this->m_modelAircraftsInRange);
this->m_modelAtcListBooked->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAircraft::IndexDistance);
if (this->m_modelAircraftsInRange->hasValidSortColumn())
this->ui->tv_AircraftsInRange->horizontalHeader()->setSortIndicator(this->m_modelAircraftsInRange->getSortColumn(), this->m_modelAircraftsInRange->getSortOrder());
this->ui->tv_AircraftsInRange->resizeColumnsToContents();
this->ui->tv_AircraftsInRange->resizeRowsToContents();
this->ui->tv_AllUsers->setSortingEnabled(true);
this->ui->tv_AllUsers->setModel(this->m_modelAllUsers);
this->m_modelAllUsers->setSortColumnByPropertyIndex(BlackMisc::Network::CUser::IndexRealName);
if (this->m_modelAllUsers->hasValidSortColumn())
this->ui->tv_AllUsers->horizontalHeader()->setSortIndicator(this->m_modelAllUsers->getSortColumn(), this->m_modelAllUsers->getSortOrder());
this->ui->tv_AllUsers->resizeColumnsToContents();
this->ui->tv_AllUsers->resizeRowsToContents();
this->ui->tv_AllUsers->horizontalHeader()->setStretchLastSection(true);
this->ui->tv_CockpitVoiceRoom1->setSortingEnabled(true);
this->ui->tv_CockpitVoiceRoom1->setModel(this->m_modelUsersVoiceCom1);
this->m_modelUsersVoiceCom1->setSortColumnByPropertyIndex(BlackMisc::Network::CUser::IndexRealName);
if (this->m_modelUsersVoiceCom1->hasValidSortColumn())
this->ui->tv_CockpitVoiceRoom1->horizontalHeader()->setSortIndicator(this->m_modelUsersVoiceCom1->getSortColumn(), this->m_modelUsersVoiceCom1->getSortOrder());
this->ui->tv_CockpitVoiceRoom1->resizeColumnsToContents();
this->ui->tv_CockpitVoiceRoom1->resizeRowsToContents();
this->ui->tv_CockpitVoiceRoom1->horizontalHeader()->setStretchLastSection(true);
this->ui->tv_CockpitVoiceRoom2->setSortingEnabled(true);
this->ui->tv_CockpitVoiceRoom2->setModel(this->m_modelUsersVoiceCom2);
this->m_modelUsersVoiceCom2->setSortColumnByPropertyIndex(BlackMisc::Network::CUser::IndexRealName);
if (this->m_modelUsersVoiceCom1->hasValidSortColumn())
this->ui->tv_CockpitVoiceRoom2->horizontalHeader()->setSortIndicator(this->m_modelUsersVoiceCom2->getSortColumn(), this->m_modelUsersVoiceCom2->getSortOrder());
this->ui->tv_CockpitVoiceRoom2->resizeColumnsToContents();
this->ui->tv_CockpitVoiceRoom2->resizeRowsToContents();
this->ui->tv_CockpitVoiceRoom2->horizontalHeader()->setStretchLastSection(true);
this->ui->tv_SettingsMiscHotkeys->setSortingEnabled(true);
this->ui->tv_SettingsMiscHotkeys->setModel(this->m_modelSettingsHotKeys);
this->m_modelSettingsHotKeys->setSortColumnByPropertyIndex(BlackMisc::Hardware::CKeyboardKey::IndexFunctionAsString);
if (this->m_modelSettingsHotKeys->hasValidSortColumn())
this->ui->tv_SettingsMiscHotkeys->horizontalHeader()->setSortIndicator(this->m_modelSettingsHotKeys->getSortColumn(), this->m_modelSettingsHotKeys->getSortOrder());
this->ui->tv_SettingsMiscHotkeys->resizeColumnsToContents();
this->ui->tv_SettingsMiscHotkeys->resizeRowsToContents();
this->ui->tv_SettingsMiscHotkeys->horizontalHeader()->setStretchLastSection(true);
this->ui->tv_SettingsMiscHotkeys->setItemDelegate(new BlackGui::CKeyboardKeyItemDelegate(this->ui->tv_SettingsMiscHotkeys));
// SELCAL pairs in cockpit // SELCAL pairs in cockpit
this->ui->cb_CockpitSelcal1->clear(); this->ui->cb_CockpitSelcal1->clear();
@@ -341,14 +250,14 @@ void MainWindow::initGuiSignals()
Q_ASSERT(connected); Q_ASSERT(connected);
this->connect(this->ui->tw_AtcStations, &QTabWidget::currentChanged, this, &MainWindow::atcStationTabChanged); this->connect(this->ui->tw_AtcStations, &QTabWidget::currentChanged, this, &MainWindow::atcStationTabChanged);
this->connect(this->ui->pb_ReloadAtcStationsBooked, &QPushButton::clicked, this, &MainWindow::reloadAtcStationsBooked); this->connect(this->ui->pb_ReloadAtcStationsBooked, &QPushButton::clicked, this, &MainWindow::reloadAtcStationsBooked);
this->connect(this->ui->tv_AtcStationsOnline, &QTableView::clicked, this, &MainWindow::onlineAtcStationSelected); this->connect(this->ui->tvp_AtcStationsOnline, &QTableView::clicked, this, &MainWindow::onlineAtcStationSelected);
this->connect(this->ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &MainWindow::requestAtis); this->connect(this->ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &MainWindow::requestAtis);
// Settings server // Settings server
this->connect(this->ui->pb_SettingsTnCurrentServer, &QPushButton::released, this, &MainWindow::alterTrafficServer); this->connect(this->ui->pb_SettingsTnCurrentServer, &QPushButton::released, this, &MainWindow::alterTrafficServer);
this->connect(this->ui->pb_SettingsTnRemoveServer, &QPushButton::released, this, &MainWindow::alterTrafficServer); this->connect(this->ui->pb_SettingsTnRemoveServer, &QPushButton::released, this, &MainWindow::alterTrafficServer);
this->connect(this->ui->pb_SettingsTnSaveServer, &QPushButton::released, this, &MainWindow::alterTrafficServer); this->connect(this->ui->pb_SettingsTnSaveServer, &QPushButton::released, this, &MainWindow::alterTrafficServer);
this->connect(this->ui->tv_SettingsTnServers, &QTableView::clicked, this, &MainWindow::networkServerSelected); this->connect(this->ui->tvp_SettingsTnServers, &QTableView::clicked, this, &MainWindow::networkServerSelected);
// Settings // Settings
this->connect(this->ui->hs_SettingsGuiOpacity, &QSlider::valueChanged, this, &MainWindow::changeWindowOpacity); this->connect(this->ui->hs_SettingsGuiOpacity, &QSlider::valueChanged, this, &MainWindow::changeWindowOpacity);

View File

@@ -67,8 +67,6 @@ void MainWindow::initContextMenus()
this->ui->lbl_CockpitVoiceStatus->setContextMenuPolicy(Qt::CustomContextMenu); this->ui->lbl_CockpitVoiceStatus->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this->ui->lbl_StatusVoiceStatus, &QLabel::customContextMenuRequested, this, &MainWindow::audioIconContextMenu); connect(this->ui->lbl_StatusVoiceStatus, &QLabel::customContextMenuRequested, this, &MainWindow::audioIconContextMenu);
connect(this->ui->lbl_CockpitVoiceStatus, &QLabel::customContextMenuRequested, this, &MainWindow::audioIconContextMenu); connect(this->ui->lbl_CockpitVoiceStatus, &QLabel::customContextMenuRequested, this, &MainWindow::audioIconContextMenu);
this->ui->tv_StatusMessages->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this->ui->tv_StatusMessages, &QTableView::customContextMenuRequested, this, &MainWindow::messageListContextMenu);
} }
/* /*
@@ -87,6 +85,7 @@ void MainWindow::audioIconContextMenu(const QPoint &position)
this->m_contextMenuAudio->addAction("Toogle mute"); this->m_contextMenuAudio->addAction("Toogle mute");
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
// #if defined required? seems to be redundant
if (QSysInfo::WindowsVersion && QSysInfo::WV_NT_based) if (QSysInfo::WindowsVersion && QSysInfo::WV_NT_based)
{ {
this->m_contextMenuAudio->addAction("Mixer"); this->m_contextMenuAudio->addAction("Mixer");
@@ -107,32 +106,3 @@ void MainWindow::audioIconContextMenu(const QPoint &position)
} }
} }
} }
/*
* Message list context menu
*/
void MainWindow::messageListContextMenu(const QPoint &position)
{
// position for most widgets
QPoint globalPosition = this->ui->tv_StatusMessages->mapToGlobal(position);
if (!this->m_contextMenuStatusMessageList)
{
this->m_contextMenuStatusMessageList = new QMenu(this);
this->m_contextMenuStatusMessageList->addAction("Clear");
}
QAction *selectedItem = this->m_contextMenuStatusMessageList->exec(globalPosition);
if (selectedItem)
{
// http://forum.technical-assistance.co.uk/sndvol32exe-command-line-parameters-vt1348.html
const QList<QAction *> actions = this->m_contextMenuStatusMessageList->actions();
if (selectedItem == actions.at(0))
{
this->m_statusMessageList->clear();
this->ui->tv_StatusMessages->resizeColumnsToContents();
this->ui->tv_StatusMessages->horizontalHeader()->setStretchLastSection(true);
}
}
}

View File

@@ -28,15 +28,11 @@ void MainWindow::reloadSettings()
CSettingsNetwork nws = this->m_rt->getIContextSettings()->getNetworkSettings(); CSettingsNetwork nws = this->m_rt->getIContextSettings()->getNetworkSettings();
// update servers // update servers
this->m_modelTrafficServerList->setSelectedServer(nws.getCurrentTrafficNetworkServer()); this->ui->tvp_SettingsTnServers->setSelectedServer(nws.getCurrentTrafficNetworkServer());
this->m_modelTrafficServerList->update(nws.getTrafficNetworkServers()); this->ui->tvp_SettingsTnServers->update(nws.getTrafficNetworkServers());
this->ui->tv_SettingsTnServers->resizeColumnsToContents();
this->ui->tv_SettingsTnServers->resizeRowsToContents();
// update hot keys // update hot keys
this->m_modelSettingsHotKeys->update(this->m_rt->getIContextSettings()->getHotkeys()); this->ui->tvp_SettingsMiscHotkeys->update(this->m_rt->getIContextSettings()->getHotkeys());
this->ui->tv_SettingsMiscHotkeys->resizeColumnsToContents();
this->ui->tv_SettingsMiscHotkeys->resizeRowsToContents();
// fake setting for sound notifications // fake setting for sound notifications
this->ui->cb_SettingsAudioPlayNotificationSounds->setChecked(true); this->ui->cb_SettingsAudioPlayNotificationSounds->setChecked(true);
@@ -48,7 +44,7 @@ void MainWindow::reloadSettings()
*/ */
void MainWindow::networkServerSelected(QModelIndex index) void MainWindow::networkServerSelected(QModelIndex index)
{ {
const CServer clickedServer = this->m_modelTrafficServerList->at(index); const CServer clickedServer = this->ui->tvp_SettingsTnServers->at<CServer>(index);
this->updateGuiSelectedServerTextboxes(clickedServer); this->updateGuiSelectedServerTextboxes(clickedServer);
} }
@@ -136,7 +132,7 @@ CServer MainWindow::selectedServerFromTextboxes() const
void MainWindow::saveHotkeys() void MainWindow::saveHotkeys()
{ {
const QString path = CSettingUtilities::appendPaths(IContextSettings::PathRoot(), IContextSettings::PathHotkeys()); const QString path = CSettingUtilities::appendPaths(IContextSettings::PathRoot(), IContextSettings::PathHotkeys());
CStatusMessageList msgs = this->m_rt->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), this->m_modelSettingsHotKeys->getContainer().toQVariant()); CStatusMessageList msgs = this->m_rt->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), this->ui->tvp_SettingsMiscHotkeys->derivedModel()->getContainer().toQVariant());
// status messages // status messages
this->displayStatusMessages(msgs); this->displayStatusMessages(msgs);
@@ -147,12 +143,12 @@ void MainWindow::saveHotkeys()
*/ */
void MainWindow::clearHotkey() void MainWindow::clearHotkey()
{ {
QModelIndex i = this->ui->tv_SettingsMiscHotkeys->currentIndex(); QModelIndex i = this->ui->tvp_SettingsMiscHotkeys->currentIndex();
if (i.row() < 0 || i.row() >= this->m_modelSettingsHotKeys->rowCount()) return; if (i.row() < 0 || i.row() >= this->ui->tvp_SettingsMiscHotkeys->rowCount()) return;
BlackMisc::Hardware::CKeyboardKey key = this->m_modelSettingsHotKeys->at(i); BlackMisc::Hardware::CKeyboardKey key = this->ui->tvp_SettingsMiscHotkeys->at<BlackMisc::Hardware::CKeyboardKey>(i);
BlackMisc::Hardware::CKeyboardKey defKey; BlackMisc::Hardware::CKeyboardKey defaultKey;
defKey.setFunction(key.getFunction()); defaultKey.setFunction(key.getFunction());
this->m_modelSettingsHotKeys->update(i, defKey); this->ui->tvp_SettingsMiscHotkeys->derivedModel()->update(i, defaultKey);
} }
/* /*