mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
GUI, added table view for user lists:
* All users * Voice room COM1/2 users Remark: Not yet updated, just preparation of views
This commit is contained in:
@@ -22,14 +22,19 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
QMainWindow(parent, windowMode == GuiModes::WindowFrameless ? (Qt::Window | Qt::FramelessWindowHint) : Qt::Tool),
|
||||
ui(new Ui::MainWindow),
|
||||
m_infoWindow(nullptr),
|
||||
m_init(false), m_windowMode(windowMode), m_coreMode(GuiModes::CoreExternal),
|
||||
m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextVoiceAvailable(false),
|
||||
m_dBusConnection("dummy"), m_coreRuntime(nullptr),
|
||||
m_atcListOnline(nullptr), m_atcListBooked(nullptr),
|
||||
m_trafficServerList(nullptr), m_aircraftsInRange(nullptr),
|
||||
m_init(false), m_windowMode(windowMode),
|
||||
// core
|
||||
m_coreMode(GuiModes::CoreExternal), m_coreAvailable(false),
|
||||
// misc
|
||||
m_contextNetworkAvailable(false), m_contextVoiceAvailable(false), m_dBusConnection("dummy"), m_coreRuntime(nullptr),
|
||||
// table view models
|
||||
m_atcListOnline(nullptr), m_atcListBooked(nullptr), m_trafficServerList(nullptr), m_aircraftsInRange(nullptr),
|
||||
m_allUsers(nullptr), m_usersVoiceCom1(nullptr), m_usersVoiceCom2(nullptr),
|
||||
// contexts
|
||||
m_contextApplication(nullptr), m_contextNetwork(nullptr), m_contextVoice(nullptr), m_contextSettings(nullptr),
|
||||
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr),
|
||||
m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr),
|
||||
// timers
|
||||
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr), m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr),
|
||||
// context menus
|
||||
m_contextMenuAudio(nullptr)
|
||||
{
|
||||
if (windowMode == GuiModes::WindowFrameless)
|
||||
@@ -150,6 +155,8 @@ void MainWindow::setMainPage(bool start)
|
||||
this->ui->sw_MainMiddle->setCurrentIndex(MainPageAircrafts);
|
||||
else if (sender == this->ui->pb_MainCockpit)
|
||||
this->ui->sw_MainMiddle->setCurrentIndex(MainPageCockpit);
|
||||
else if (sender == this->ui->pb_MainUsers)
|
||||
this->ui->sw_MainMiddle->setCurrentIndex(MainPageUsers);
|
||||
else if (sender == this->ui->pb_MainTextMessages)
|
||||
this->ui->sw_MainMiddle->setCurrentIndex(MainPageTextMessages);
|
||||
else if (sender == this->ui->pb_MainFlightplan)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "blackgui/atcstationlistmodel.h"
|
||||
#include "blackgui/serverlistmodel.h"
|
||||
#include "blackgui/aircraftlistmodel.h"
|
||||
#include "blackgui/userlistmodel.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/nwtextmessage.h"
|
||||
#include <QMainWindow>
|
||||
@@ -84,10 +85,11 @@ protected:
|
||||
MainPageStatus = 0,
|
||||
MainPageAtc = 1,
|
||||
MainPageAircrafts = 2,
|
||||
MainPageCockpit = 3,
|
||||
MainPageTextMessages = 4,
|
||||
MainPageFlightplan = 5,
|
||||
MainPageSettings = 6
|
||||
MainPageUsers = 3,
|
||||
MainPageCockpit = 4,
|
||||
MainPageTextMessages = 5,
|
||||
MainPageFlightplan = 6,
|
||||
MainPageSettings = 7
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -101,10 +103,16 @@ private:
|
||||
bool m_contextVoiceAvailable;
|
||||
QDBusConnection m_dBusConnection;
|
||||
QScopedPointer<BlackCore::CCoreRuntime> m_coreRuntime; /*!< runtime, if working with local core */
|
||||
// the table view models
|
||||
// normal pointers, asl these will be deleted by parent
|
||||
BlackGui::CAtcListModel *m_atcListOnline;
|
||||
BlackGui::CAtcListModel *m_atcListBooked;
|
||||
BlackGui::CServerListModel *m_trafficServerList;
|
||||
BlackGui::CAircraftListModel *m_aircraftsInRange;
|
||||
BlackGui::CUserListModel *m_allUsers;
|
||||
BlackGui::CUserListModel *m_usersVoiceCom1;
|
||||
BlackGui::CUserListModel *m_usersVoiceCom2;
|
||||
// contexts
|
||||
BlackCore::IContextApplication *m_contextApplication; /*!< overall application state */
|
||||
BlackCore::IContextNetwork *m_contextNetwork;
|
||||
BlackCore::IContextVoice *m_contextVoice;
|
||||
@@ -177,21 +185,19 @@ private:
|
||||
bool isCockpitUpdatePending() const;
|
||||
|
||||
/*!
|
||||
* \brief Round the com frequency display
|
||||
* \param com1
|
||||
* \param com2
|
||||
* \brief Round the COM frequency display
|
||||
*/
|
||||
void roundComFrequencyDisplays(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
||||
|
||||
/*!
|
||||
* \brief Add new text message tab
|
||||
* \param tabName
|
||||
* \param tabName name of the new tab, usually the channel name
|
||||
* \return
|
||||
*/
|
||||
QWidget *addNewTextMessageTab(const QString &tabName);
|
||||
|
||||
/*!
|
||||
* \brief Find text message tab by name
|
||||
* \brief Find text message tab by its name
|
||||
* \param name
|
||||
* \return
|
||||
*/
|
||||
@@ -213,7 +219,6 @@ private:
|
||||
|
||||
/*!
|
||||
* \brief Audio device lists
|
||||
* \return
|
||||
*/
|
||||
void setAudioDeviceLists();
|
||||
|
||||
@@ -224,8 +229,8 @@ private:
|
||||
|
||||
/*!
|
||||
* \brief Position of own plane for testing
|
||||
* \param wgsLatitude
|
||||
* \param wgsLongitude
|
||||
* \param wgsLatitude WGS latitude
|
||||
* \param wgsLongitude WGS longitude
|
||||
* \param altitude
|
||||
*/
|
||||
void setTestPosition(const QString &wgsLatitude, const QString &wgsLongitude, const BlackMisc::Aviation::CAltitude &altitude);
|
||||
@@ -236,21 +241,21 @@ private:
|
||||
void displayOverlayInfo(const QString &message = "");
|
||||
|
||||
/*!
|
||||
* \brief Overlay info by status message
|
||||
* \brief Overlay info displaying status message
|
||||
* \param message
|
||||
*/
|
||||
void displayOverlayInfo(const BlackMisc::CStatusMessage &message);
|
||||
|
||||
/*!
|
||||
* \brief Is given main page selected?
|
||||
* \param mainPage
|
||||
* \param mainPage index to be checked
|
||||
* \return
|
||||
*/
|
||||
bool isMainPageSelected(MainPageIndex mainPage) const;
|
||||
|
||||
/*!
|
||||
* \brief For this text message's receiver, is the current tab selected
|
||||
* \param textMessage
|
||||
* \brief For this text message's receipient, is the current tab selected?
|
||||
* \param textMessage to be checked
|
||||
* \return
|
||||
*/
|
||||
bool isCorrespondingTextMessageTabSelected(BlackMisc::Network::CTextMessage textMessage) const;
|
||||
|
||||
@@ -388,7 +388,7 @@ QSizeGrip {
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pg_StatusPage">
|
||||
<property name="sizePolicy">
|
||||
@@ -821,6 +821,19 @@ QSizeGrip {
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_Users">
|
||||
<layout class="QVBoxLayout" name="vl_Users">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableView" name="tv_AllUsers"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_Cockpit">
|
||||
<layout class="QVBoxLayout" name="vl_Cockpit">
|
||||
<property name="spacing">
|
||||
@@ -2320,7 +2333,7 @@ QSizeGrip {
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="pb_MainUsers">
|
||||
<property name="text">
|
||||
<string>Users</string>
|
||||
</property>
|
||||
@@ -2457,6 +2470,87 @@ QSizeGrip {
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<tabstops>
|
||||
<tabstop>cb_StatusWithDBus</tabstop>
|
||||
<tabstop>le_StatusNetworkContext</tabstop>
|
||||
<tabstop>le_StatusVoiceContext</tabstop>
|
||||
<tabstop>te_StatusMessages</tabstop>
|
||||
<tabstop>le_CommandLineInput</tabstop>
|
||||
<tabstop>tw_AtcStations</tabstop>
|
||||
<tabstop>tv_AtcStationsOnline</tabstop>
|
||||
<tabstop>te_AtcStationsOnlineInfo</tabstop>
|
||||
<tabstop>le_AtcStationsOnlineMetar</tabstop>
|
||||
<tabstop>pb_AtcStationsLoadMetar</tabstop>
|
||||
<tabstop>pb_AtcStationsAtisReload</tabstop>
|
||||
<tabstop>tv_AtcStationsBooked</tabstop>
|
||||
<tabstop>pb_ReloadAtcStationsBooked</tabstop>
|
||||
<tabstop>tv_AircraftsInRange</tabstop>
|
||||
<tabstop>pb_CockpitToggleCom1</tabstop>
|
||||
<tabstop>ds_CockpitCom1Active</tabstop>
|
||||
<tabstop>ds_CockpitCom1Standby</tabstop>
|
||||
<tabstop>di_CockpitCom1Volume</tabstop>
|
||||
<tabstop>pb_CockpitToggleCom2</tabstop>
|
||||
<tabstop>ds_CockpitCom2Active</tabstop>
|
||||
<tabstop>ds_CockpitCom2Standby</tabstop>
|
||||
<tabstop>di_CockpitCom2Volume</tabstop>
|
||||
<tabstop>pb_CockpitSelcalTest</tabstop>
|
||||
<tabstop>cb_CockpitSelcal1</tabstop>
|
||||
<tabstop>cb_CockpitSelcal2</tabstop>
|
||||
<tabstop>ds_CockpitTransponder</tabstop>
|
||||
<tabstop>cb_CockpitTransponderMode</tabstop>
|
||||
<tabstop>le_CockpitVoiceRoomCom1</tabstop>
|
||||
<tabstop>cb_CockpitVoiceRoom1Override</tabstop>
|
||||
<tabstop>le_CockpitVoiceRoomCom2</tabstop>
|
||||
<tabstop>cb_CockpitVoiceRoom2Override</tabstop>
|
||||
<tabstop>tv_CockpitVoiceRoom1</tabstop>
|
||||
<tabstop>tv_CockpitVoiceRoom2</tabstop>
|
||||
<tabstop>tw_TextMessages</tabstop>
|
||||
<tabstop>te_TextMessagesAll</tabstop>
|
||||
<tabstop>te_TextMessagesUnicom</tabstop>
|
||||
<tabstop>te_TextMessagesCOM1</tabstop>
|
||||
<tabstop>te_TextMessagesCOM2</tabstop>
|
||||
<tabstop>tb_Settings</tabstop>
|
||||
<tabstop>tv_SettingsTnServers</tabstop>
|
||||
<tabstop>le_SettingsTnCsName</tabstop>
|
||||
<tabstop>le_SettingsTnCsDescription</tabstop>
|
||||
<tabstop>le_SettingsTnCsAddress</tabstop>
|
||||
<tabstop>le_SettingsTnCsPort</tabstop>
|
||||
<tabstop>le_SettingsTnCsRealName</tabstop>
|
||||
<tabstop>le_SettingsTnCsNetworkId</tabstop>
|
||||
<tabstop>le_SettingsTnCsPassword</tabstop>
|
||||
<tabstop>pb_SettingsTnSaveServer</tabstop>
|
||||
<tabstop>pb_SettingsTnRemoveServer</tabstop>
|
||||
<tabstop>pb_SettingsTnCurrentServer</tabstop>
|
||||
<tabstop>le_SettingsAircraftCallsign</tabstop>
|
||||
<tabstop>le_SettingsIcaoTypeDesignator</tabstop>
|
||||
<tabstop>le_SettingsIcaoAirline</tabstop>
|
||||
<tabstop>le_SettingsIcaoType</tabstop>
|
||||
<tabstop>lbl_SettingsStealthMode</tabstop>
|
||||
<tabstop>lbl_SettingsObserver</tabstop>
|
||||
<tabstop>cb_VoiceInputDevice</tabstop>
|
||||
<tabstop>cb_VoiceOutputDevice</tabstop>
|
||||
<tabstop>pb_VoiceStartMicTest</tabstop>
|
||||
<tabstop>pb_VoiceStartSquelchTest</tabstop>
|
||||
<tabstop>hs_SettingsGuiOpacity</tabstop>
|
||||
<tabstop>hs_SettingsGuiAircraftRefreshTime</tabstop>
|
||||
<tabstop>hs_SettingsGuiAtcRefreshTime</tabstop>
|
||||
<tabstop>pb_MainConnect</tabstop>
|
||||
<tabstop>pb_MainStatus</tabstop>
|
||||
<tabstop>pb_MainWeather</tabstop>
|
||||
<tabstop>pb_MainFlightplan</tabstop>
|
||||
<tabstop>pb_MainAtc</tabstop>
|
||||
<tabstop>pb_MainAircrafts</tabstop>
|
||||
<tabstop>pb_MainUsers</tabstop>
|
||||
<tabstop>pb_CockpitIdent</tabstop>
|
||||
<tabstop>pb_MainCockpit</tabstop>
|
||||
<tabstop>pb_MainTextMessages</tabstop>
|
||||
<tabstop>pb_Mappings</tabstop>
|
||||
<tabstop>pb_MainSettings</tabstop>
|
||||
<tabstop>pb_MainKeypadOpacity100</tabstop>
|
||||
<tabstop>pb_MainKeypadOpacity050</tabstop>
|
||||
<tabstop>pb_SoundMute</tabstop>
|
||||
<tabstop>pb_SoundMaxVolume</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../src/blackgui/blackgui.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -58,28 +58,65 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
if (this->m_aircraftsInRange != nullptr) this->m_aircraftsInRange->deleteLater();
|
||||
this->m_aircraftsInRange = new CAircraftListModel(this);
|
||||
|
||||
if (this->m_allUsers != nullptr) this->m_allUsers->deleteLater();
|
||||
this->m_allUsers = new CUserListModel(this);
|
||||
|
||||
if (this->m_usersVoiceCom1 != nullptr) this->m_usersVoiceCom1->deleteLater();
|
||||
this->m_usersVoiceCom1 = new CUserListModel(this);
|
||||
|
||||
if (this->m_usersVoiceCom2 != nullptr) this->m_usersVoiceCom2->deleteLater();
|
||||
this->m_usersVoiceCom2 = new CUserListModel(this);
|
||||
|
||||
// set sort order and models
|
||||
// enable first, otherwise order in the model will be reset
|
||||
this->ui->tv_SettingsTnServers->setModel(this->m_trafficServerList);
|
||||
|
||||
|
||||
this->ui->tv_AtcStationsOnline->setSortingEnabled(true);
|
||||
this->ui->tv_AtcStationsOnline->setModel(this->m_atcListOnline);
|
||||
this->m_atcListBooked->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAtcStation::IndexDistance);
|
||||
if (this->m_atcListOnline->hasValidSortColumn())
|
||||
this->ui->tv_AtcStationsOnline->horizontalHeader()->setSortIndicator(this->m_atcListOnline->getSortColumn(), this->m_atcListOnline->getSortOrder());
|
||||
|
||||
this->m_atcListBooked->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAtcStation::IndexBookedFrom);
|
||||
this->ui->tv_AtcStationsBooked->setSortingEnabled(true);
|
||||
this->ui->tv_AtcStationsBooked->setModel(this->m_atcListBooked);
|
||||
this->m_atcListBooked->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAtcStation::IndexBookedFrom);
|
||||
if (this->m_atcListBooked->hasValidSortColumn())
|
||||
this->ui->tv_AtcStationsBooked->horizontalHeader()->setSortIndicator(this->m_atcListBooked->getSortColumn(), this->m_atcListBooked->getSortOrder());
|
||||
|
||||
this->ui->tv_AircraftsInRange->setSortingEnabled(true);
|
||||
this->ui->tv_AircraftsInRange->setModel(this->m_aircraftsInRange);
|
||||
this->m_atcListBooked->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAircraft::IndexDistance);
|
||||
if (this->m_aircraftsInRange->hasValidSortColumn())
|
||||
this->ui->tv_AircraftsInRange->horizontalHeader()->setSortIndicator(this->m_aircraftsInRange->getSortColumn(), this->m_aircraftsInRange->getSortOrder());
|
||||
|
||||
this->ui->tv_SettingsTnServers->setModel(this->m_trafficServerList);
|
||||
this->ui->tv_AircraftsInRange->resizeColumnsToContents();
|
||||
this->ui->tv_AircraftsInRange->resizeRowsToContents();
|
||||
|
||||
this->ui->tv_AllUsers->setSortingEnabled(true);
|
||||
this->ui->tv_AllUsers->setModel(this->m_allUsers);
|
||||
this->m_allUsers->setSortColumnByPropertyIndex(BlackMisc::Network::CUser::IndexRealName);
|
||||
if (this->m_allUsers->hasValidSortColumn())
|
||||
this->ui->tv_AllUsers->horizontalHeader()->setSortIndicator(this->m_allUsers->getSortColumn(), this->m_allUsers->getSortOrder());
|
||||
this->ui->tv_AllUsers->resizeColumnsToContents();
|
||||
this->ui->tv_AllUsers->resizeRowsToContents();
|
||||
|
||||
this->ui->tv_CockpitVoiceRoom1->setSortingEnabled(true);
|
||||
this->ui->tv_CockpitVoiceRoom1->setModel(this->m_usersVoiceCom1);
|
||||
this->m_usersVoiceCom1->setSortColumnByPropertyIndex(BlackMisc::Network::CUser::IndexRealName);
|
||||
if (this->m_usersVoiceCom1->hasValidSortColumn())
|
||||
this->ui->tv_CockpitVoiceRoom1->horizontalHeader()->setSortIndicator(this->m_usersVoiceCom1->getSortColumn(), this->m_usersVoiceCom1->getSortOrder());
|
||||
this->ui->tv_CockpitVoiceRoom1->resizeColumnsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom1->resizeRowsToContents();
|
||||
|
||||
this->ui->tv_CockpitVoiceRoom2->setSortingEnabled(true);
|
||||
this->ui->tv_CockpitVoiceRoom2->setModel(this->m_usersVoiceCom2);
|
||||
this->m_usersVoiceCom2->setSortColumnByPropertyIndex(BlackMisc::Network::CUser::IndexRealName);
|
||||
if (this->m_usersVoiceCom1->hasValidSortColumn())
|
||||
this->ui->tv_CockpitVoiceRoom2->horizontalHeader()->setSortIndicator(this->m_usersVoiceCom2->getSortColumn(), this->m_usersVoiceCom2->getSortOrder());
|
||||
this->ui->tv_CockpitVoiceRoom2->resizeColumnsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom2->resizeRowsToContents();
|
||||
|
||||
// timer
|
||||
if (this->m_timerUpdateAircraftsInRange == nullptr) this->m_timerUpdateAircraftsInRange = new QTimer(this);
|
||||
if (this->m_timerUpdateAtcStationsOnline == nullptr) this->m_timerUpdateAtcStationsOnline = new QTimer(this);
|
||||
if (this->m_timerContextWatchdog == nullptr) this->m_timerContextWatchdog = new QTimer(this);
|
||||
@@ -181,6 +218,8 @@ void MainWindow::initGuiSignals()
|
||||
Q_ASSERT(connected);
|
||||
connected = this->connect(this->ui->pb_MainStatus, SIGNAL(released()), this, SLOT(setMainPage()));
|
||||
Q_ASSERT(connected);
|
||||
connected = this->connect(this->ui->pb_MainUsers, SIGNAL(released()), this, SLOT(setMainPage()));
|
||||
Q_ASSERT(connected);
|
||||
connected = this->connect(this->ui->pb_MainTextMessages, SIGNAL(released()), this, SLOT(setMainPage()));
|
||||
Q_ASSERT(connected);
|
||||
connected = this->connect(this->ui->pb_MainWeather, SIGNAL(released()), this, SLOT(setMainPage()));
|
||||
|
||||
Reference in New Issue
Block a user