refs #227, changes for user component in GUI

This commit is contained in:
Klaus Basan
2014-05-06 13:25:51 +02:00
parent d163297715
commit 9d2b96c218
4 changed files with 41 additions and 53 deletions

View File

@@ -30,7 +30,7 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextAudioAvailable(false),
// timers
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr), m_timerUpdateUsers(nullptr),
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr),
m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr),
m_timerStatusBar(nullptr), m_timerAudioTests(nullptr), m_timerSimulator(nullptr),
// context menus
@@ -334,12 +334,6 @@ void MainWindow::timerBasedUpdates()
this->m_timerUpdateAircraftsInRange->start(t);
this->reloadAircraftsInRange();
}
else if (sender == this->m_timerUpdateUsers)
{
int t = this->ui->hs_SettingsGuiUserRefreshTime->value() * 1000;
this->m_timerUpdateUsers->start(t);
this->reloadAllUsers();
}
else if (sender == this->m_timerContextWatchdog)
{
this->setContextAvailability();
@@ -485,15 +479,6 @@ void MainWindow::displayOverlayInfo(const CStatusMessage &message)
// further code goes here, such as marking errors as red ...
}
/*
* Read users
*/
void MainWindow::reloadAllUsers()
{
if (!this->isContextNetworkAvailableCheck()) return;
this->ui->tvp_AllUsers->update(this->getIContextNetwork()->getUsers());
}
void MainWindow::updateSimulatorData()
{
if (this->getIContextSimulator()->isConnected())

View File

@@ -104,7 +104,6 @@ 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 for update of users */
QTimer *m_timerCollectedCockpitUpdates; /*!< collect cockpit updates over a short period before sending */
QTimer *m_timerContextWatchdog; /*!< core available? */
QTimer *m_timerStatusBar; /*!< cleaning up status bar */
@@ -265,9 +264,6 @@ private slots:
//! Reload aircrafts in range
void reloadAircraftsInRange();
//! Reload all (online) users
void reloadAllUsers();
//! Reload own aircraft
bool reloadOwnAircraft();

View File

@@ -1039,17 +1039,7 @@ QStatusBar QLabel {
<number>0</number>
</property>
<item>
<widget class="BlackGui::CUserView" name="tvp_AllUsers">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
<widget class="BlackGui::CUserComponent" name="twp_Users"/>
</item>
</layout>
</widget>
@@ -1803,7 +1793,7 @@ QStatusBar QLabel {
<item>
<widget class="QTabWidget" name="tw_Settings">
<property name="currentIndex">
<number>3</number>
<number>1</number>
</property>
<widget class="QWidget" name="tb_SettingsTrafficNetwork">
<attribute name="title">
@@ -2028,38 +2018,49 @@ QStatusBar QLabel {
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_SettingsIcaoTypeDesignator">
<widget class="QLabel" name="lbl_SettingsIcaoAircraftDesignator">
<property name="text">
<string>ICAO type (e.g. A320)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_SettingsIcaoTypeDesignator">
<widget class="QLineEdit" name="le_SettingsIcaoAircraftDesignator">
<property name="inputMethodHints">
<set>Qt::ImhUppercaseOnly</set>
</property>
<property name="text">
<string>C172</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_SettingsIcaoAirline">
<widget class="QLabel" name="lbl_SettingsIcaoAirlineDesignator">
<property name="text">
<string>ICAO airline (e.g.DLH)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="le_SettingsIcaoAirline"/>
<widget class="QLineEdit" name="le_SettingsIcaoAirlineDesignator">
<property name="text">
<string>SGN</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lbl_SettingsIcaoType">
<widget class="QLabel" name="lbl_SettingsIcaoCombinedType">
<property name="text">
<string>Aircraft type (e.g. L2J)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="le_SettingsIcaoType"/>
<widget class="QLineEdit" name="le_SettingsIcaoCombinedType">
<property name="text">
<string>L1P</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbl_SettingsModes">
@@ -3162,6 +3163,11 @@ QStatusBar QLabel {
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>BlackGui::CUserView</class>
<extends>QTableView</extends>
<header>blackgui/userview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::CTransponderModeSelector</class>
<extends>QComboBox</extends>
@@ -3177,11 +3183,6 @@ QStatusBar QLabel {
<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>
@@ -3209,6 +3210,12 @@ QStatusBar QLabel {
<header>blackgui/settingsfsxcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::CUserComponent</class>
<extends>QTabWidget</extends>
<header>blackgui/usercomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>cb_StatusWithDBus</tabstop>
@@ -3225,7 +3232,6 @@ QStatusBar QLabel {
<tabstop>tvp_AtcStationsBooked</tabstop>
<tabstop>pb_ReloadAtcStationsBooked</tabstop>
<tabstop>tvp_AircraftsInRange</tabstop>
<tabstop>tvp_AllUsers</tabstop>
<tabstop>pb_CockpitToggleCom1</tabstop>
<tabstop>ds_CockpitCom1Active</tabstop>
<tabstop>ds_CockpitCom1Standby</tabstop>
@@ -3263,9 +3269,9 @@ QStatusBar QLabel {
<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>le_SettingsIcaoAircraftDesignator</tabstop>
<tabstop>le_SettingsIcaoAirlineDesignator</tabstop>
<tabstop>le_SettingsIcaoCombinedType</tabstop>
<tabstop>cb_SettingsAudioInputDevice</tabstop>
<tabstop>cb_SettingsAudioOutputDevice</tabstop>
<tabstop>hs_SettingsGuiOpacity</tabstop>

View File

@@ -71,7 +71,6 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
// timers
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_timerUpdateUsers == nullptr) this->m_timerUpdateUsers = new QTimer(this);
if (this->m_timerContextWatchdog == nullptr) this->m_timerContextWatchdog = new QTimer(this);
if (this->m_timerCollectedCockpitUpdates == nullptr) this->m_timerCollectedCockpitUpdates = new QTimer(this);
if (this->m_timerAudioTests == nullptr) this->m_timerAudioTests = new QTimer(this);
@@ -119,12 +118,15 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
this->connect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::simulatorConnectionChanged);
this->connect(this->m_timerUpdateAircraftsInRange, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
this->connect(this->m_timerUpdateAtcStationsOnline, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
this->connect(this->m_timerUpdateUsers, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
this->connect(this->m_timerContextWatchdog, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
this->connect(this->m_timerCollectedCockpitUpdates, &QTimer::timeout, this, &MainWindow::sendCockpitUpdates);
this->connect(this->m_timerAudioTests, &QTimer::timeout, this, &MainWindow::audioTestUpdate);
this->connect(this->m_timerSimulator, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
connect = this->connect(this->getIContextAudio(), &IContextAudio::audioTestCompleted, this, &MainWindow::audioTestUpdate);
// sliders
this->connect(this->ui->hs_SettingsGuiUserRefreshTime, &QSlider::valueChanged, this->ui->twp_Users, &BlackGui::CUserComponent::setUpdateIntervalSeconds);
Q_ASSERT(connect);
Q_UNUSED(connect); // suppress GCC warning in release build
@@ -300,9 +302,9 @@ void MainWindow::initialDataReads()
{
// connection is already established
this->reloadAircraftsInRange();
this->reloadAllUsers();
this->reloadAtcStationsOnline();
this->updateGuiStatusInformation();
this->ui->twp_Users->update();
}
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeGui, CStatusMessage::SeverityInfo, "initial data read"));
@@ -315,7 +317,7 @@ void MainWindow::startUpdateTimers()
{
this->m_timerUpdateAircraftsInRange->start(this->ui->hs_SettingsGuiAircraftRefreshTime->value() * 1000);
this->m_timerUpdateAtcStationsOnline->start(this->ui->hs_SettingsGuiAtcRefreshTime->value() * 1000);
this->m_timerUpdateUsers->start(this->ui->hs_SettingsGuiUserRefreshTime->value() * 1000);
this->ui->twp_Users->setUpdateIntervalSeconds(this->ui->hs_SettingsGuiUserRefreshTime->value());
}
/*
@@ -325,11 +327,10 @@ void MainWindow::stopUpdateTimers(bool disconnect)
{
this->m_timerUpdateAircraftsInRange->stop();
this->m_timerUpdateAtcStationsOnline->stop();
this->m_timerUpdateUsers->stop();
this->ui->twp_Users->setUpdateInterval(-1);
if (!disconnect) return;
this->disconnect(this->m_timerUpdateAircraftsInRange);
this->disconnect(this->m_timerUpdateAtcStationsOnline);
this->disconnect(this->m_timerUpdateUsers);
}
void MainWindow::stopAllTimers(bool disconnect)