9 #include "ui_usercomponent.h"
19 using namespace swift::misc::network;
22 using namespace swift::gui::settings;
24 using namespace swift::core::context;
28 CUserComponent::CUserComponent(QWidget *parent)
32 this->setCurrentIndex(0);
33 this->tabBar()->setExpanding(
false);
34 this->tabBar()->setUsesScrollButtons(
true);
35 connect(ui->tvp_AllUsers, &CUserView::modelDataChangedDigest,
this, &CUserComponent::onCountChanged);
36 connect(ui->tvp_AllUsers, &CUserView::requestTextMessageWidget,
this,
38 connect(ui->tvp_Clients, &CClientView::modelDataChangedDigest,
this, &CUserComponent::onCountChanged);
40 &CUserComponent::onConnectionStatusChanged);
42 this->onSettingsChanged();
49 Q_ASSERT(ui->tvp_Clients);
50 return ui->tvp_Clients->rowCount();
55 Q_ASSERT(ui->tvp_AllUsers);
56 return ui->tvp_AllUsers->rowCount();
62 Q_ASSERT(ui->tvp_AllUsers);
63 Q_ASSERT(ui->tvp_Clients);
76 ui->tvp_AllUsers->updateContainer(users);
81 void CUserComponent::onCountChanged(
int count,
bool withFilter)
85 int iu = this->indexOf(ui->tb_AllUsers);
86 int ic = this->indexOf(ui->tb_Clients);
87 QString u = this->tabBar()->tabText(iu);
88 QString c = this->tabBar()->tabText(ic);
91 this->tabBar()->setTabText(iu, u);
92 this->tabBar()->setTabText(ic, c);
100 ui->tvp_AllUsers->clear();
101 ui->tvp_Clients->clear();
102 m_updateTimer.stop();
104 else if (to.
isConnected()) { m_updateTimer.start(); }
107 void CUserComponent::onSettingsChanged()
111 m_updateTimer.setInterval(ms);
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
virtual swift::misc::network::CUserList getUsers() const =0
Get all users.
virtual swift::misc::network::CClientList getClientsForCallsigns(const swift::misc::aviation::CCallsignSet &callsigns) const =0
Clients for given callsign, e.g. to test/fetch direct aircraft model.
virtual bool isConnected() const =0
Network connected?
static QString replaceTabCountValue(const QString &oldName, int count)
Replace count in name such as "stations (4)".
User componenet (users, clients)
void requestTextMessageWidget(const swift::misc::aviation::CCallsign &callsign)
Request a text message.
void update()
Update users.
virtual ~CUserComponent()
Destructor.
int countClients() const
Number of clients.
int countUsers() const
Number of users.
Settings about view update rates.
const swift::misc::physical_quantities::CTime & getAtcUpdateTime() const
Get time.
T get() const
Get a copy of the current value.
swift::misc::aviation::CCallsignSet getCallsigns() const
All callsigns.
Value object encapsulating information about a connection status.
bool isConnected() const
Query status.
bool isDisconnected() const
Query status.
Value object encapsulating a list of voice rooms.
int toMs() const
Convenience functions when used with timers etc.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
Views, mainly QTableView.