mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Status messages as table view in the GUI, not only text.
Some minor GUI tweaks.
This commit is contained in:
committed by
Mathew Sutcliffe
parent
576952b690
commit
e88bfde3db
@@ -28,6 +28,7 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
// misc
|
||||
m_contextNetworkAvailable(false), m_contextVoiceAvailable(false), m_dBusConnection("dummy"), m_coreRuntime(nullptr),
|
||||
// table view models
|
||||
m_statusMessageList(nullptr),
|
||||
m_atcListOnline(nullptr), m_atcListBooked(nullptr), m_trafficServerList(nullptr), m_aircraftsInRange(nullptr),
|
||||
m_allUsers(nullptr), m_usersVoiceCom1(nullptr), m_usersVoiceCom2(nullptr),
|
||||
// contexts
|
||||
@@ -36,7 +37,7 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr), m_timerUpdateUsers(nullptr),
|
||||
m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr),
|
||||
// context menus
|
||||
m_contextMenuAudio(nullptr)
|
||||
m_contextMenuAudio(nullptr), m_contextMenuStatusMessageList(nullptr)
|
||||
{
|
||||
if (windowMode == GuiModes::WindowFrameless)
|
||||
{
|
||||
@@ -242,9 +243,10 @@ bool MainWindow::isContextVoiceAvailableCheck()
|
||||
void MainWindow::displayStatusMessage(const CStatusMessage &message)
|
||||
{
|
||||
this->ui->sb_MainStatusBar->showMessage(message.getMessage(), 3000);
|
||||
this->ui->te_StatusMessages->insertPlainText(message.toQString(true).append("\n"));
|
||||
this->m_statusMessageList->insert(message);
|
||||
this->ui->tv_StatusMessages->resizeColumnsToContents();
|
||||
this->ui->tv_StatusMessages->resizeRowsToContents();
|
||||
if (message.getSeverity() == CStatusMessage::SeverityError) this->displayOverlayInfo(message);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
#include "blackgui/serverlistmodel.h"
|
||||
#include "blackgui/aircraftlistmodel.h"
|
||||
#include "blackgui/userlistmodel.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackgui/statusmessagelistmodel.h"
|
||||
#include "blackmisc/nwtextmessage.h"
|
||||
#include <QMainWindow>
|
||||
#include <QTextEdit>
|
||||
#include <QTableView>
|
||||
#include <QItemSelection>
|
||||
#include <QTimer>
|
||||
|
||||
@@ -105,7 +106,8 @@ private:
|
||||
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
|
||||
// normal pointers, as these will be deleted by parent
|
||||
BlackGui::CStatusMessageListModel *m_statusMessageList;
|
||||
BlackGui::CAtcListModel *m_atcListOnline;
|
||||
BlackGui::CAtcListModel *m_atcListBooked;
|
||||
BlackGui::CServerListModel *m_trafficServerList;
|
||||
@@ -113,6 +115,7 @@ private:
|
||||
BlackGui::CUserListModel *m_allUsers;
|
||||
BlackGui::CUserListModel *m_usersVoiceCom1;
|
||||
BlackGui::CUserListModel *m_usersVoiceCom2;
|
||||
|
||||
// contexts
|
||||
BlackCore::IContextApplication *m_contextApplication; /*!< overall application state */
|
||||
BlackCore::IContextNetwork *m_contextNetwork;
|
||||
@@ -121,7 +124,7 @@ private:
|
||||
BlackMisc::Aviation::CAircraft m_ownAircraft; /*!< own aircraft's state */
|
||||
QTimer *m_timerUpdateAtcStationsOnline; /*!< timer for update of stations */
|
||||
QTimer *m_timerUpdateAircraftsInRange; /*!< timer for update of aircrafts */
|
||||
QTimer *m_timerUpdateUsers; /*!< timer dor update of users */
|
||||
QTimer *m_timerUpdateUsers; /*!< timer for update of users */
|
||||
QTimer *m_timerCollectedCockpitUpdates; /*!< collect cockpit updates over a short period before sending */
|
||||
QTimer *m_timerContextWatchdog; /*!< core available? */
|
||||
QPixmap m_resPixmapConnectionConnected;
|
||||
@@ -131,7 +134,8 @@ private:
|
||||
QPixmap m_resPixmapVoiceLow;
|
||||
QPixmap m_resPixmapVoiceMuted;
|
||||
QPoint m_dragPosition; /*!< position, if moving is handled with frameless window */
|
||||
QMenu *m_contextMenuAudio; /*! Audio context menu */
|
||||
QMenu *m_contextMenuAudio; /*! audio context menu */
|
||||
QMenu *m_contextMenuStatusMessageList; /*! context menu for status message list */
|
||||
QString m_transponderResetValue; /*! Temp. storage of XPdr mode to reset, req. until timer allows singleShoot with Lambdas */
|
||||
|
||||
/*!
|
||||
@@ -475,6 +479,9 @@ private slots:
|
||||
*/
|
||||
void audioIconContextMenu(const QPoint &position);
|
||||
|
||||
//! \brief Context menu for message list
|
||||
void messageListContextMenu(const QPoint &position);
|
||||
|
||||
/*!
|
||||
* \brief Test SELCAL (code valid? play tone)
|
||||
*/
|
||||
|
||||
@@ -565,7 +565,17 @@ QSizeGrip {
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableView" name="tv_StatusMessages"/>
|
||||
<widget class="QTableView" name="tv_StatusMessages">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -574,8 +584,8 @@ QSizeGrip {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>90</width>
|
||||
<height>55</height>
|
||||
<width>326</width>
|
||||
<height>267</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@@ -598,7 +608,7 @@ QSizeGrip {
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="te_StatusMessages">
|
||||
<widget class="QPlainTextEdit" name="te_StatusPageConsole">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -1980,9 +1990,15 @@ QSizeGrip {
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_SettingsAircraftCallsign">
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhLatinOnly|Qt::ImhUppercaseOnly</set>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>BLACK</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@@ -1993,7 +2009,11 @@ QSizeGrip {
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="le_SettingsIcaoTypeDesignator"/>
|
||||
<widget class="QLineEdit" name="le_SettingsIcaoTypeDesignator">
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhUppercaseOnly</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsIcaoAirline">
|
||||
@@ -2061,7 +2081,7 @@ QSizeGrip {
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_SettingsAudio">
|
||||
<attribute name="title">
|
||||
<string>Voice</string>
|
||||
<string>Audio</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<property name="leftMargin">
|
||||
|
||||
@@ -47,6 +47,9 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
}
|
||||
|
||||
// init models, the delete allows to re-init
|
||||
if (this->m_statusMessageList != nullptr) this->m_statusMessageList->deleteLater();
|
||||
this->m_statusMessageList = new CStatusMessageListModel(this);
|
||||
|
||||
if (this->m_atcListBooked != nullptr) this->m_atcListBooked->deleteLater();
|
||||
this->m_atcListBooked = new CAtcListModel(this);
|
||||
|
||||
@@ -72,6 +75,11 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
// enable first, otherwise order in the model will be reset
|
||||
this->ui->tv_SettingsTnServers->setModel(this->m_trafficServerList);
|
||||
|
||||
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_AtcStationsOnline->setSortingEnabled(true);
|
||||
this->ui->tv_AtcStationsOnline->setModel(this->m_atcListOnline);
|
||||
|
||||
@@ -54,21 +54,24 @@ void MainWindow::menuClicked()
|
||||
void MainWindow::initContextMenus()
|
||||
{
|
||||
this->ui->lbl_VoiceStatus->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this->ui->lbl_VoiceStatus, SIGNAL(customContextMenuRequested(const QPoint &)),
|
||||
this, SLOT(audioIconContextMenu(const QPoint &)));
|
||||
connect(this->ui->lbl_VoiceStatus, &QLabel::customContextMenuRequested, this, &MainWindow::audioIconContextMenu);
|
||||
this->ui->tv_StatusMessages->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this->ui->tv_StatusMessages, &QTableView::customContextMenuRequested, this, &MainWindow::messageListContextMenu);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reload settings
|
||||
* Audio context menu
|
||||
*/
|
||||
void MainWindow::audioIconContextMenu(const QPoint &position)
|
||||
{
|
||||
// for most widgets
|
||||
// position for most widgets
|
||||
QPoint globalPosition = this->ui->lbl_VoiceStatus->mapToGlobal(position);
|
||||
|
||||
if (!this->m_contextMenuAudio)
|
||||
{
|
||||
this->m_contextMenuAudio = new QMenu(this);
|
||||
this->m_contextMenuAudio->addAction("Toogle mute");
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
if (QSysInfo::WindowsVersion && QSysInfo::WV_NT_based)
|
||||
{
|
||||
@@ -82,7 +85,40 @@ void MainWindow::audioIconContextMenu(const QPoint &position)
|
||||
{
|
||||
// http://forum.technical-assistance.co.uk/sndvol32exe-command-line-parameters-vt1348.html
|
||||
const QList<QAction *> actions = this->m_contextMenuAudio->actions();
|
||||
QStringList parameterlist;
|
||||
if (selectedItem == actions.at(0)) QProcess::startDetached("SndVol.exe", parameterlist);
|
||||
if (selectedItem == actions.at(0)) this->ui->pb_SoundMute->click();
|
||||
else if (actions.size() > 1 && selectedItem == actions.at(1))
|
||||
{
|
||||
QStringList parameterlist;
|
||||
QProcess::startDetached("SndVol.exe", parameterlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user