mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
As of workshop RW/KB
* Allow to "jump" to text message channel from ATC / aircraft * changed timer connections for components to new SLOT syntax * housekeeping: ** new function in network context for station by callsign ** refactored textmessage component, allow to select tab by slot ** wired up signal / slots in main GUI ** removed unused functions ** allow to select area and "myself" in infoarea
This commit is contained in:
@@ -148,6 +148,9 @@ namespace BlackCore
|
||||
//! Aircraft for given callsign
|
||||
virtual BlackMisc::Simulation::CSimulatedAircraft getAircraftForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
||||
|
||||
//! Online station for callsign
|
||||
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
||||
|
||||
//! Get all users
|
||||
virtual BlackMisc::Network::CUserList getUsers() const = 0;
|
||||
|
||||
|
||||
@@ -65,6 +65,14 @@ namespace BlackCore
|
||||
return BlackMisc::Simulation::CSimulatedAircraft();
|
||||
}
|
||||
|
||||
//! \copydoc IContextNetwork::getOnlineStationForCallsign
|
||||
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override
|
||||
{
|
||||
Q_UNUSED(callsign);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return BlackMisc::Aviation::CAtcStation();
|
||||
}
|
||||
|
||||
//! \copydoc IContextNetwork::connectToNetwork
|
||||
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, uint mode) override
|
||||
{
|
||||
|
||||
@@ -483,6 +483,12 @@ namespace BlackCore
|
||||
return this->m_airspace->remoteAircraft().findFirstByCallsign(callsign);
|
||||
}
|
||||
|
||||
CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
return this->m_airspace->getAtcStationsOnline().findFirstByCallsign(callsign);
|
||||
}
|
||||
|
||||
void CContextNetwork::ps_receivedBookings(const CAtcStationList &)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
|
||||
@@ -105,6 +105,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextNetwork::getAircraftForCallsign
|
||||
virtual BlackMisc::Simulation::CSimulatedAircraft getAircraftForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
|
||||
//! \copydoc IContextNetwork::getOnlineStationForCallsign
|
||||
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
|
||||
//! \copydoc IContextNetwork::connectToNetwork()
|
||||
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, uint mode) override;
|
||||
|
||||
|
||||
@@ -114,6 +114,11 @@ namespace BlackCore
|
||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Simulation::CSimulatedAircraft>(QLatin1Literal("getAircraftForCallsign"), callsign);
|
||||
}
|
||||
|
||||
CAtcStation CContextNetworkProxy::getOnlineStationForCallsign(const CCallsign &callsign) const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Aviation::CAtcStation>(QLatin1Literal("getOnlineStationForCallsign"), callsign);
|
||||
}
|
||||
|
||||
BlackMisc::Network::CUserList CContextNetworkProxy::getUsers() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Network::CUserList>(QLatin1Literal("getUsers"));
|
||||
|
||||
@@ -68,6 +68,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextNetwork::getAircraftForCallsign
|
||||
virtual BlackMisc::Simulation::CSimulatedAircraft getAircraftForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
|
||||
//! \copydoc IContextNetwork::getOnlineStationForCallsign
|
||||
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
|
||||
//! \copydoc IContextNetwork::connectToNetwork
|
||||
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, uint mode) override;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
this->tabBar()->setExpanding(false);
|
||||
this->ui->tvp_AirportsInRange->setResizeMode(CAirportView::ResizingOnce);
|
||||
m_updateTimer = new CUpdateTimer(SLOT(update()), this);
|
||||
m_updateTimer = new CUpdateTimer(&CAircraftComponent::update, this);
|
||||
|
||||
connect(this->ui->tvp_AircraftInRange, &CAircraftView::rowCountChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
||||
connect(this->ui->tvp_AirportsInRange, &CAircraftView::rowCountChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->tabBar()->setExpanding(false);
|
||||
this->m_updateTimer = new CUpdateTimer(SLOT(update()), this);
|
||||
this->m_updateTimer = new CUpdateTimer(&CAtcStationComponent::update, this);
|
||||
|
||||
// some icons
|
||||
this->ui->pb_AtcStationsAtisReload->setIcon(CIcons::atis());
|
||||
@@ -275,6 +275,14 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
const QString &CAtcStationComponent::originator()
|
||||
{
|
||||
// string is generated once, the timestamp allows to use multiple
|
||||
// components (as long as they are not generated at the same ms)
|
||||
static const QString o = QString("ATCSTATIOCOMPONENT:").append(QString::number(QDateTime::currentMSecsSinceEpoch()));
|
||||
return o;
|
||||
}
|
||||
|
||||
void CAtcStationComponent::ps_onlineAtcStationSelected(QModelIndex index)
|
||||
{
|
||||
this->ui->te_AtcStationsOnlineInfo->setText(""); // reset
|
||||
|
||||
@@ -118,6 +118,7 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
void updateTreeView();
|
||||
const QString &originator();
|
||||
|
||||
QScopedPointer<Ui::CAtcStationComponent> ui;
|
||||
CUpdateTimer *m_updateTimer = nullptr;
|
||||
@@ -126,14 +127,6 @@ namespace BlackGui
|
||||
QDateTime m_timestampLastReadBookedStations = CUpdateTimer::epoch(); //!< stations read
|
||||
QDateTime m_timestampBookedStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
||||
|
||||
const QString &originator()
|
||||
{
|
||||
// string is generated once, the timestamp allows to use multiple
|
||||
// components (as long as they are not generated at the same ms)
|
||||
static const QString o = QString("ATCSTATIOCOMPONENT:").append(QString::number(QDateTime::currentMSecsSinceEpoch()));
|
||||
return o;
|
||||
}
|
||||
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -79,5 +79,17 @@ namespace BlackGui
|
||||
return mw ? mw->getWidget() : nullptr;
|
||||
}
|
||||
|
||||
void CEnableForDockWidgetInfoArea::displayMyself()
|
||||
{
|
||||
// if we are already visible, we are done
|
||||
if (this->isVisibleWidget()) { return; }
|
||||
|
||||
// select myself
|
||||
if (getParentInfoArea())
|
||||
{
|
||||
getParentInfoArea()->selectArea(this->getDockWidgetInfoArea());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -55,6 +55,9 @@ namespace BlackGui
|
||||
//! Main application window widget if any
|
||||
QWidget *mainApplicationWindowWidget() const;
|
||||
|
||||
//! Display myself
|
||||
void displayMyself();
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
//! \remarks Normally the infoa area will be provided later \sa setParentDockWidgetInfoArea
|
||||
|
||||
@@ -45,6 +45,11 @@ namespace BlackGui
|
||||
return this->ui->comp_Aircraft;
|
||||
}
|
||||
|
||||
CMappingComponent *CMainInfoAreaComponent::getMappingComponet()
|
||||
{
|
||||
return this->ui->comp_Mappings;
|
||||
}
|
||||
|
||||
CUserComponent *CMainInfoAreaComponent::getUserComponent()
|
||||
{
|
||||
return this->ui->comp_Users;
|
||||
|
||||
@@ -62,6 +62,9 @@ namespace BlackGui
|
||||
//! Aircrafts
|
||||
CAircraftComponent *getAircraftComponent();
|
||||
|
||||
//! Mappings
|
||||
CMappingComponent *getMappingComponet();
|
||||
|
||||
//! User component
|
||||
CUserComponent *getUserComponent();
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BlackGui
|
||||
this->ui->tvp_LiveData->setIconMode(true);
|
||||
this->ui->tvp_LiveData->setAutoResizeFrequency(10); // only resize every n-th time
|
||||
this->addOrUpdateByName("info", "no data yet", CIcons::StandardIconWarning16);
|
||||
m_updateTimer = new CUpdateTimer(SLOT(update()), this);
|
||||
m_updateTimer = new CUpdateTimer(&CSimulatorComponent::update, this);
|
||||
}
|
||||
|
||||
CSimulatorComponent::~CSimulatorComponent()
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "blackmisc/notificationsounds.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/simplecommandparser.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QMenu>
|
||||
@@ -26,6 +27,7 @@ using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -48,7 +50,7 @@ namespace BlackGui
|
||||
CTextMessageComponent::~CTextMessageComponent()
|
||||
{ }
|
||||
|
||||
QWidget *CTextMessageComponent::getTabWidget(CTextMessageComponent::Tab tab)
|
||||
QWidget *CTextMessageComponent::getTabWidget(CTextMessageComponent::Tab tab) const
|
||||
{
|
||||
switch (tab)
|
||||
{
|
||||
@@ -67,9 +69,15 @@ namespace BlackGui
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Text messages received or send, append to GUI
|
||||
*/
|
||||
void CTextMessageComponent::selectTabWidget(CTextMessageComponent::Tab tab)
|
||||
{
|
||||
QWidget *w = getTabWidget(tab);
|
||||
if (w)
|
||||
{
|
||||
this->ui->tw_TextMessages->setCurrentWidget(w);
|
||||
}
|
||||
}
|
||||
|
||||
void CTextMessageComponent::displayTextMessage(const CTextMessageList &messages)
|
||||
{
|
||||
if (messages.isEmpty()) return;
|
||||
@@ -178,7 +186,7 @@ namespace BlackGui
|
||||
CCallsign cs = textMessage.getSenderCallsign();
|
||||
if (cs.isEmpty()) return false;
|
||||
QWidget *tab = this->findTextMessageTabByName(cs.getStringAsSet());
|
||||
if (!tab) return false;
|
||||
if (!tab) { return false; }
|
||||
return this->ui->tw_TextMessages->currentWidget() == tab;
|
||||
}
|
||||
else
|
||||
@@ -198,6 +206,11 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
bool CTextMessageComponent::isNetworkConnected() const
|
||||
{
|
||||
return this->getIContextNetwork() && this->getIContextNetwork()->isConnected() ;
|
||||
}
|
||||
|
||||
void CTextMessageComponent::showCurrentFrequenciesFromCockpit()
|
||||
{
|
||||
const CAircraft ownAircraft = this->getOwnAircraft();
|
||||
@@ -212,6 +225,12 @@ namespace BlackGui
|
||||
this->ui->tw_TextMessages->setTabText(this->ui->tw_TextMessages->indexOf(this->ui->tb_TextMessagesCOM2), f2);
|
||||
}
|
||||
|
||||
QWidget *CTextMessageComponent::addNewTextMessageTab(const CCallsign &callsign)
|
||||
{
|
||||
Q_ASSERT(!callsign.isEmpty());
|
||||
return addNewTextMessageTab(callsign.asString());
|
||||
}
|
||||
|
||||
QWidget *CTextMessageComponent::addNewTextMessageTab(const QString &tabName)
|
||||
{
|
||||
QWidget *newTab = new QWidget(this);
|
||||
@@ -242,10 +261,8 @@ namespace BlackGui
|
||||
if (!textMessage.isPrivateMessage()) { return; }
|
||||
CCallsign cs = textMessage.getRecipientCallsign();
|
||||
if (cs.isEmpty()) { return; }
|
||||
QString csStr(cs.asString());
|
||||
QWidget *tab = this->findTextMessageTabByName(csStr);
|
||||
if (tab == nullptr) { tab = this->findTextMessageTabByName(csStr); }
|
||||
if (tab == nullptr) { tab = this->addNewTextMessageTab(csStr); }
|
||||
QWidget *tab = this->findTextMessageTabByCallsign(cs);
|
||||
if (tab == nullptr) { tab = this->addNewTextMessageTab(cs); }
|
||||
Q_ASSERT(tab != nullptr);
|
||||
CTextMessageTextEdit *textEdit = tab->findChild<CTextMessageTextEdit *>();
|
||||
Q_ASSERT(textEdit != nullptr);
|
||||
@@ -259,6 +276,34 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
const CAircraft CTextMessageComponent::getOwnAircraft() const
|
||||
{
|
||||
Q_ASSERT(this->getIContextOwnAircraft());
|
||||
return this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
}
|
||||
|
||||
QWidget *CTextMessageComponent::findTextMessageTabByCallsign(const CCallsign &callsign, bool callsignResolution) const
|
||||
{
|
||||
QWidget *w = findTextMessageTabByName(callsign.asString());
|
||||
if (w) { return w; }
|
||||
if (!callsignResolution) { return nullptr; }
|
||||
|
||||
// resolve callsign
|
||||
CAtcStation station(getIContextNetwork()->getOnlineStationForCallsign(callsign));
|
||||
if (!station.getCallsign().isEmpty())
|
||||
{
|
||||
if (this->getOwnAircraft().getCom1System().isActiveFrequencyWithin25kHzChannel(station.getFrequency()))
|
||||
{
|
||||
return getTabWidget(TextMessagesCom1);
|
||||
}
|
||||
else if (this->getOwnAircraft().getCom2System().isActiveFrequencyWithin25kHzChannel(station.getFrequency()))
|
||||
{
|
||||
return getTabWidget(TextMessagesCom2);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QWidget *CTextMessageComponent::findTextMessageTabByName(const QString &name) const
|
||||
{
|
||||
if (name.isEmpty()) { return nullptr; }
|
||||
@@ -400,5 +445,30 @@ namespace BlackGui
|
||||
return false; // we never handle the message directly, but forward it
|
||||
}
|
||||
|
||||
void CTextMessageComponent::showCorrespondingTab(const CCallsign &callsign)
|
||||
{
|
||||
Q_ASSERT(getIContextOwnAircraft());
|
||||
Q_ASSERT(getIContextNetwork());
|
||||
|
||||
if (callsign.isEmpty())
|
||||
{
|
||||
CLogMessage(this).warning("No callsign to display text message");
|
||||
return;
|
||||
}
|
||||
QWidget *w = findTextMessageTabByCallsign(callsign, true);
|
||||
if (!w && getIContextNetwork())
|
||||
{
|
||||
CSimulatedAircraft aircraft(getIContextNetwork()->getAircraftForCallsign(callsign));
|
||||
if (!aircraft.getCallsign().isEmpty())
|
||||
{
|
||||
// we assume a private message
|
||||
w = this->addNewTextMessageTab(aircraft.getCallsign());
|
||||
}
|
||||
}
|
||||
if (!w) { return; }
|
||||
this->ui->tw_TextMessages->setCurrentWidget(w);
|
||||
this->displayMyself();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -68,7 +68,10 @@ namespace BlackGui
|
||||
void onTextMessageSent(const BlackMisc::Network::CTextMessage &sentMessage);
|
||||
|
||||
//! Used to allow direct input from global command line when visible
|
||||
virtual bool handleGlobalCommandLine(const QString &commandLine, const QString &originator);
|
||||
bool handleGlobalCommandLine(const QString &commandLine, const QString &originator);
|
||||
|
||||
//! Display the tab for given callsign
|
||||
void showCorrespondingTab(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
protected:
|
||||
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
|
||||
@@ -76,16 +79,24 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CTextMessageComponent> ui;
|
||||
CTextMessageTextEdit *m_currentTextEdit = nullptr; //!< text edit currently visible
|
||||
|
||||
//! Enum to widget
|
||||
QWidget *getTabWidget(Tab tab);
|
||||
QWidget *getTabWidget(Tab tab) const;
|
||||
|
||||
//! Select given tab
|
||||
void selectTabWidget(Tab tab);
|
||||
|
||||
//! New message tab for given callsign
|
||||
QWidget *addNewTextMessageTab(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
//! Add new text message tab
|
||||
//! \param tabName name of the new tab, usually the channel name
|
||||
//! \return
|
||||
QWidget *addNewTextMessageTab(const QString &tabName);
|
||||
|
||||
//! Find text message tab by callsign
|
||||
QWidget *findTextMessageTabByCallsign(const BlackMisc::Aviation::CCallsign &callsign, bool callsignResolution = false) const;
|
||||
|
||||
//! Find text message tab by its name
|
||||
QWidget *findTextMessageTabByName(const QString &name) const;
|
||||
|
||||
@@ -93,13 +104,13 @@ namespace BlackGui
|
||||
void addPrivateChannelTextMessage(const BlackMisc::Network::CTextMessage &textMessage);
|
||||
|
||||
//! own aircraft
|
||||
const BlackMisc::Aviation::CAircraft getOwnAircraft() const { Q_ASSERT(this->getIContextOwnAircraft()); return this->getIContextOwnAircraft()->getOwnAircraft(); }
|
||||
const BlackMisc::Aviation::CAircraft getOwnAircraft() const;
|
||||
|
||||
//! For this text message's recepient, is the current tab selected?
|
||||
bool isCorrespondingTextMessageTabSelected(BlackMisc::Network::CTextMessage textMessage) const;
|
||||
|
||||
//! Network connected?
|
||||
bool isNetworkConnected() const { return this->getIContextNetwork() && this->getIContextNetwork()->isConnected() ; }
|
||||
bool isNetworkConnected() const;
|
||||
|
||||
//! Show current frequencies
|
||||
void showCurrentFrequenciesFromCockpit();
|
||||
@@ -124,7 +135,7 @@ namespace BlackGui
|
||||
//! Close text message tab
|
||||
void ps_closeTextMessageTab();
|
||||
|
||||
//! Top level was changed
|
||||
//! Top level was changed (used to enable elements when floating)
|
||||
void ps_topLevelChanged(QWidget *widget, bool topLevel);
|
||||
|
||||
//! Command line entered
|
||||
|
||||
@@ -13,19 +13,11 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CUpdateTimer::CUpdateTimer(const char *slot, QObject *parent) :
|
||||
QObject(parent)
|
||||
void CUpdateTimer::initTimers()
|
||||
{
|
||||
Q_ASSERT(parent);
|
||||
this->m_timer = new QTimer(this);
|
||||
this->m_timerSingleShot = new QTimer(this);
|
||||
this->m_timerSingleShot->setSingleShot(true);
|
||||
|
||||
bool c = this->connect(this->m_timer, SIGNAL(timeout()), parent, slot);
|
||||
Q_ASSERT(c);
|
||||
c = this->connect(this->m_timerSingleShot, SIGNAL(timeout()), parent, slot);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
|
||||
CUpdateTimer::~CUpdateTimer()
|
||||
@@ -54,5 +46,6 @@ namespace BlackGui
|
||||
this->m_timer->start(); // restart other timer
|
||||
this->m_timerSingleShot->start(10);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -25,8 +25,18 @@ namespace BlackGui
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CUpdateTimer(const char *slot, QObject *parent);
|
||||
//! Construct a timer which forwards messages to the given slot of parent.
|
||||
template <typename F, typename P>
|
||||
CUpdateTimer(F slot, P *parent) : QObject(parent)
|
||||
{
|
||||
Q_ASSERT(parent);
|
||||
this->initTimers();
|
||||
bool c = this->connect(this->m_timer, &QTimer::timeout, parent, slot);
|
||||
Q_ASSERT(c);
|
||||
c = this->connect(this->m_timerSingleShot, &QTimer::timeout, parent, slot);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
~CUpdateTimer();
|
||||
@@ -55,6 +65,7 @@ namespace BlackGui
|
||||
void fireTimer();
|
||||
|
||||
private:
|
||||
void initTimers(); //!< init timers
|
||||
QTimer *m_timer = nullptr; //!< periodically updating
|
||||
QTimer *m_timerSingleShot = nullptr; //!< single update
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->tabBar()->setExpanding(false);
|
||||
this->m_updateTimer = new CUpdateTimer(SLOT(update()), this);
|
||||
this->m_updateTimer = new CUpdateTimer(&CUserComponent::update, this);
|
||||
|
||||
connect(this->ui->tvp_AllUsers, &CUserView::rowCountChanged, this, &CUserComponent::ps_onCountChanged);
|
||||
connect(this->ui->tvp_Clients, &CClientView::rowCountChanged, this, &CUserComponent::ps_onCountChanged);
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setCurrentTabIndex(dw);
|
||||
this->selectArea(dw);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ namespace BlackGui
|
||||
return getTabBarIndexByTitle(dockWidgetInfoArea->windowTitle());
|
||||
}
|
||||
|
||||
void CInfoArea::setCurrentTabIndex(const CDockWidgetInfoArea *dockWidgetInfoArea)
|
||||
void CInfoArea::selectArea(const CDockWidgetInfoArea *dockWidgetInfoArea)
|
||||
{
|
||||
if (!this->m_tabBar) { return; }
|
||||
int tabIndex = this->dockWidgetInfoAreaToTabBarIndex(dockWidgetInfoArea);
|
||||
@@ -654,7 +654,7 @@ namespace BlackGui
|
||||
if (!topLevel)
|
||||
{
|
||||
CDockWidgetInfoArea *dwia = dynamic_cast<CDockWidgetInfoArea *>(dockWidget);
|
||||
this->setCurrentTabIndex(dwia);
|
||||
this->selectArea(dwia);
|
||||
}
|
||||
|
||||
// when toplevel is changed, I need a round in the event loop until
|
||||
|
||||
@@ -89,6 +89,9 @@ namespace BlackGui
|
||||
//! Select area
|
||||
void selectArea(int areaIndex);
|
||||
|
||||
//! Set current tab bar index by given widget
|
||||
void selectArea(const CDockWidgetInfoArea *dockWidgetInfoArea);
|
||||
|
||||
//! Select area (sender is QAction)
|
||||
void selectAreaByAction();
|
||||
|
||||
@@ -164,9 +167,6 @@ namespace BlackGui
|
||||
//! Widget to tab bar index
|
||||
int dockWidgetInfoAreaToTabBarIndex(const CDockWidgetInfoArea *dockWidgetInfoArea) const;
|
||||
|
||||
//! Set current tab bar index by given widget
|
||||
void setCurrentTabIndex(const CDockWidgetInfoArea *dockWidgetInfoArea);
|
||||
|
||||
//! Features of the dockable widgets
|
||||
void setFeaturesForDockableWidgets(QDockWidget::DockWidgetFeatures features);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
||||
{
|
||||
menu.addAction(CIcons::appCockpit16(), "Tune in COM1", this, SLOT(ps_tuneInAtcCom1()));
|
||||
menu.addAction(CIcons::appCockpit16(), "Tune in COM2", this, SLOT(ps_tuneInAtcCom2()));
|
||||
menu.addAction(CIcons::appTextMessages16(), "Text message", this, SLOT(ps_requestTextMessage()));
|
||||
menu.addAction(CIcons::appTextMessages16(), "Show text messages", this, SLOT(ps_requestTextMessage()));
|
||||
menu.addSeparator();
|
||||
}
|
||||
CViewBase::customMenu(menu);
|
||||
|
||||
@@ -41,9 +41,9 @@ namespace BlackGui
|
||||
{
|
||||
CSimulatedAircraft aircraft(selectedObject());
|
||||
Q_ASSERT(!aircraft.getCallsign().isEmpty());
|
||||
menu.addAction(CIcons::appTextMessages16(), "Text message", this, SLOT(ps_requestTextMessage()));
|
||||
menu.addAction(CIcons::appAircrafts16(), aircraft.isEnabled() ? "disable aircraft" : "enabled aircraft", this, SLOT(ps_enableAircraft()));
|
||||
menu.addAction(CIcons::globe16(), aircraft.fastPositionUpdates() ? "normal updates" : "fast position updates", this, SLOT(ps_fastPositionUpdates()));
|
||||
menu.addAction(CIcons::appTextMessages16(), "Show text messages", this, SLOT(ps_requestTextMessage()));
|
||||
menu.addAction(CIcons::appAircrafts16(), aircraft.isEnabled() ? "Disable aircraft" : "Enabled aircraft", this, SLOT(ps_enableAircraft()));
|
||||
menu.addAction(CIcons::globe16(), aircraft.fastPositionUpdates() ? "Normal updates" : "Fast position updates", this, SLOT(ps_fastPositionUpdates()));
|
||||
menu.addSeparator();
|
||||
}
|
||||
CViewBase::customMenu(menu);
|
||||
|
||||
@@ -56,9 +56,6 @@ SwiftGuiStd::SwiftGuiStd(BlackGui::CEnableForFramelessWindow::WindowMode windowM
|
||||
SwiftGuiStd::~SwiftGuiStd()
|
||||
{ }
|
||||
|
||||
/*
|
||||
* Graceful shutdown
|
||||
*/
|
||||
void SwiftGuiStd::performGracefulShutdown()
|
||||
{
|
||||
if (!this->m_init) { return; }
|
||||
@@ -99,9 +96,6 @@ void SwiftGuiStd::performGracefulShutdown()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close event, window closes
|
||||
*/
|
||||
void SwiftGuiStd::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
@@ -109,9 +103,6 @@ void SwiftGuiStd::closeEvent(QCloseEvent *event)
|
||||
QApplication::exit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set main page
|
||||
*/
|
||||
void SwiftGuiStd::ps_setMainPage(SwiftGuiStd::MainPageIndex mainPage)
|
||||
{
|
||||
this->ui->sw_MainMiddle->setCurrentIndex(mainPage);
|
||||
@@ -123,26 +114,11 @@ void SwiftGuiStd::ps_setMainPageInfoArea(CMainInfoAreaComponent::InfoArea infoAr
|
||||
this->ui->comp_MainInfoArea->selectArea(infoArea);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given main page selected?
|
||||
*/
|
||||
bool SwiftGuiStd::isMainPageSelected(SwiftGuiStd::MainPageIndex mainPage) const
|
||||
{
|
||||
return this->ui->sw_MainMiddle->currentIndex() == static_cast<int>(mainPage);
|
||||
}
|
||||
|
||||
void SwiftGuiStd::hideMainPage(bool hide)
|
||||
{
|
||||
//! \todo further implement hide main page
|
||||
if (hide)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void SwiftGuiStd::ps_loginRequested()
|
||||
{
|
||||
@@ -157,9 +133,6 @@ void SwiftGuiStd::ps_loginRequested()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Is the network context available?
|
||||
*/
|
||||
bool SwiftGuiStd::isContextNetworkAvailableCheck()
|
||||
{
|
||||
if (this->m_contextNetworkAvailable) return true;
|
||||
@@ -167,9 +140,6 @@ bool SwiftGuiStd::isContextNetworkAvailableCheck()
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is the audio context available?
|
||||
*/
|
||||
bool SwiftGuiStd::isContextAudioAvailableCheck()
|
||||
{
|
||||
if (this->m_contextAudioAvailable) return true;
|
||||
@@ -177,9 +147,6 @@ bool SwiftGuiStd::isContextAudioAvailableCheck()
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a status message
|
||||
*/
|
||||
void SwiftGuiStd::ps_displayStatusMessageInGui(const CStatusMessage &statusMessage)
|
||||
{
|
||||
if (!this->m_init) return;
|
||||
@@ -205,17 +172,11 @@ void SwiftGuiStd::ps_onChangedSetttings(uint typeValue)
|
||||
if (type == IContextSettings::SettingsHotKeys) this->ps_registerHotkeyFunctions();
|
||||
}
|
||||
|
||||
/*
|
||||
* Connection terminated
|
||||
*/
|
||||
void SwiftGuiStd::ps_onConnectionTerminated()
|
||||
{
|
||||
this->updateGuiStatusInformation();
|
||||
}
|
||||
|
||||
/*
|
||||
* Connection status changed
|
||||
*/
|
||||
void SwiftGuiStd::ps_onConnectionStatusChanged(int from, int to)
|
||||
{
|
||||
Q_UNUSED(from);
|
||||
@@ -239,9 +200,6 @@ void SwiftGuiStd::ps_onConnectionStatusChanged(int from, int to)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer event
|
||||
*/
|
||||
void SwiftGuiStd::ps_handleTimerBasedUpdates()
|
||||
{
|
||||
QObject *sender = QObject::sender();
|
||||
@@ -255,9 +213,6 @@ void SwiftGuiStd::ps_handleTimerBasedUpdates()
|
||||
this->ps_reloadOwnAircraft(); // regular updates
|
||||
}
|
||||
|
||||
/*
|
||||
* Context availability
|
||||
*/
|
||||
void SwiftGuiStd::setContextAvailability()
|
||||
{
|
||||
qint64 t = QDateTime::currentMSecsSinceEpoch();
|
||||
@@ -266,9 +221,6 @@ void SwiftGuiStd::setContextAvailability()
|
||||
this->m_contextAudioAvailable = this->m_coreAvailable || this->getIContextAudio()->isUsingImplementingObject();
|
||||
}
|
||||
|
||||
/*
|
||||
* Update GUI
|
||||
*/
|
||||
void SwiftGuiStd::updateGuiStatusInformation()
|
||||
{
|
||||
const QString now = QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -285,9 +237,6 @@ void SwiftGuiStd::updateGuiStatusInformation()
|
||||
this->ui->comp_InfoBarStatus->setDBusTooltip(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Opacity 0-100
|
||||
*/
|
||||
void SwiftGuiStd::ps_onChangedWindowOpacity(int opacity)
|
||||
{
|
||||
qreal o = opacity / 100.0;
|
||||
@@ -297,9 +246,6 @@ void SwiftGuiStd::ps_onChangedWindowOpacity(int opacity)
|
||||
this->ui->comp_MainInfoArea->getSettingsComponent()->setGuiOpacity(o * 100.0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stay on top
|
||||
*/
|
||||
void SwiftGuiStd::ps_toogleWindowStayOnTop()
|
||||
{
|
||||
Qt::WindowFlags flags = this->windowFlags();
|
||||
@@ -319,9 +265,6 @@ void SwiftGuiStd::ps_toogleWindowStayOnTop()
|
||||
this->show();
|
||||
}
|
||||
|
||||
/*
|
||||
* Hotkey functions
|
||||
*/
|
||||
void SwiftGuiStd::ps_registerHotkeyFunctions()
|
||||
{
|
||||
CInputManager *m_inputManager = BlackCore::CInputManager::getInstance();
|
||||
@@ -342,9 +285,6 @@ void SwiftGuiStd::ps_registerHotkeyFunctions()
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Styles
|
||||
*/
|
||||
void SwiftGuiStd::ps_onStyleSheetsChanged()
|
||||
{
|
||||
const QString s = CStyleSheetUtility::instance().styles(
|
||||
@@ -357,26 +297,17 @@ void SwiftGuiStd::ps_onStyleSheetsChanged()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Main widget (login, main info area...)
|
||||
*/
|
||||
void SwiftGuiStd::ps_onCurrentMainWidgetChanged(int currentIndex)
|
||||
{
|
||||
emit currentMainInfoAreaChanged(this->ui->sw_MainMiddle->currentWidget());
|
||||
Q_UNUSED(currentIndex);
|
||||
}
|
||||
|
||||
/*
|
||||
* Main info area floating?
|
||||
*/
|
||||
void SwiftGuiStd::ps_onChangedMainInfoAreaFloating(bool floating)
|
||||
{
|
||||
this->hideMainPage(floating);
|
||||
Q_UNUSED(floating);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notification
|
||||
*/
|
||||
void SwiftGuiStd::playNotifcationSound(CNotificationSounds::Notification notification) const
|
||||
{
|
||||
if (!this->m_contextAudioAvailable) return;
|
||||
|
||||
@@ -155,9 +155,6 @@ private:
|
||||
*/
|
||||
bool isMainPageSelected(MainPageIndex mainPage) const;
|
||||
|
||||
//! Show or hide the main Page
|
||||
void hideMainPage(bool hide);
|
||||
|
||||
//! Start all update timers
|
||||
void startUpdateTimersWhenConnected();
|
||||
|
||||
|
||||
@@ -182,6 +182,10 @@ void SwiftGuiStd::initGuiSignals()
|
||||
this->ui->comp_MainInfoArea->getSettingsComponent()->setSettingsTab(CSettingsComponent::SettingTabNetworkServers);
|
||||
});
|
||||
|
||||
// textmessages
|
||||
connect(this->ui->comp_MainInfoArea->getAtcStationComponent(), &CAtcStationComponent::requestTextMessage, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::showCorrespondingTab);
|
||||
connect(this->ui->comp_MainInfoArea->getMappingComponet(), &CMappingComponent::requestTextMessage, this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::showCorrespondingTab);
|
||||
|
||||
// main info area
|
||||
connect(this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::changedWholeInfoAreaFloating, this, &SwiftGuiStd::ps_onChangedMainInfoAreaFloating);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user