11 #include "gui/menus/menuaction.h"
18 using namespace swift::misc::aviation;
35 if (!this->stationModel()) {
return; }
41 if (!this->stationModel()) {
return; }
49 if (!this->stationModel()) {
return; }
50 this->stationModel()->
clear();
57 if (this->stationModel()) { this->stationModel()->
setColumns(columns); }
62 void CAtcStationTreeView::fullResizeToContentsImpl()
64 if (this->
isEmpty()) {
return; }
70 return qobject_cast<const CAtcStationTreeModel *>(this->
model());
75 return qobject_cast<CAtcStationTreeModel *>(this->
model());
78 CAtcStation CAtcStationTreeView::selectedObject()
const
81 return this->selectedObject(index);
89 if (!
model) {
return {}; }
90 return model->container().findFirstByCallsign(
CCallsign(callsign, CCallsign::Atc));
99 void CAtcStationTreeView::onExpanded(
const QModelIndex &index)
107 Q_UNUSED(deselected);
108 if (selected.
isEmpty()) {
return; }
114 void CAtcStationTreeView::customMenu(
const QPoint &point)
116 if (!this->stationModel()) {
return; }
117 if (this->stationModel()->container().
isEmpty()) {
return; }
119 auto *menu =
new QMenu(
this);
121 auto *com1 =
new QAction(CIcons::appCockpit16(),
"Tune in COM1 (active)",
this);
122 auto *com2 =
new QAction(CIcons::appCockpit16(),
"Tune in COM2 (active)",
this);
123 auto *com1_stby =
new QAction(CIcons::appCockpit16(),
"Tune in COM1 (standby)",
this);
124 auto *com2_stby =
new QAction(CIcons::appCockpit16(),
"Tune in COM2 (standby)",
this);
125 auto *text =
new QAction(CIcons::appTextMessages16(),
"Show text messages",
this);
126 auto *
resize =
new QAction(CIcons::resize16(),
"Resize",
this);
135 menu->addAction(com1);
136 menu->addAction(com2);
137 menu->addAction(com1_stby);
138 menu->addAction(com2_stby);
139 menu->addAction(text);
140 menu->addSeparator();
146 void CAtcStationTreeView::storeState()
153 const QString suffix = this->suffixForIndex(i);
158 void CAtcStationTreeView::restoreState()
163 const QString suffix = this->suffixForIndex(i);
172 if (s.getCallsign().isEmpty()) {
return; }
176 void CAtcStationTreeView::requestTextMessage()
179 if (s.getCallsign().isEmpty()) {
return; }
Using this class provides a QTableView with the overlay functionality already integrated.
void clear()
Clear everything.
void setColumns(const CColumns &columns)
Set columns.
void updateContainer(const swift::misc::aviation::CAtcStationList &stations)
Update container.
void changedAtcStationConnectionStatus(const swift::misc::aviation::CAtcStation &station, bool added)
Used to quickly update single station (better response for the user)
void requestComFrequency(const swift::misc::physical_quantities::CFrequency &frequency, swift::misc::aviation::CComSystem::ComUnit unit, bool active)
Request COM frequency.
void objectSelected(const swift::misc::aviation::CAtcStation &station)
This object has been selected.
bool isEmpty() const
Empty.
void updateContainer(const swift::misc::aviation::CAtcStationList &stations)
Update container.
void requestTextMessageWidget(const swift::misc::aviation::CCallsign &callsign)
Request a text message to.
void fullResizeToContents()
Resize all columns.
void changedAtcStationConnectionStatus(const swift::misc::aviation::CAtcStation &station, bool added)
Used to quickly update single station (better response for the user)
void setColumns(const models::CColumns &columns)
Set columns.
void inputSignal()
Received input signal, or manually trigger.
Value object encapsulating information about an ATC station.
bool hasCallsign() const
Has callsign?
Value object for a list of ATC stations.
Value object encapsulating information of a callsign.
Models to be used with views, mainly QTableView.
Views, mainly QTableView.
Free functions in swift::misc.
virtual int columnCount(const QModelIndex &parent) const const=0
virtual QVariant data(const QModelIndex &index, int role) const const=0
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
virtual int rowCount(const QModelIndex &parent) const const=0
QModelIndex currentIndex() const const
QAbstractItemModel * model() const const
QItemSelectionModel * selectionModel() const const
void triggered(bool checked)
QModelIndexList indexes() const const
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
bool isEmpty() const const
QMap< Key, T >::iterator insert(QMap< Key, T >::const_iterator pos, const Key &key, const T &value)
T value(const Key &key, const T &defaultValue) const const
QModelIndex siblingAtColumn(int column) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
virtual int rowCount(const QModelIndex &parent) const const override
void expanded(const QModelIndex &index)
bool isExpanded(const QModelIndex &index) const const
void resizeColumnToContents(int column)
void setExpanded(const QModelIndex &index, bool expanded)
virtual void setModel(QAbstractItemModel *model) override
QString toString() const const