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);
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; }
121 QAction *com1 =
new QAction(CIcons::appCockpit16(),
"Tune in COM1",
this);
122 QAction *com2 =
new QAction(CIcons::appCockpit16(),
"Tune in COM2",
this);
123 QAction *text =
new QAction(CIcons::appTextMessages16(),
"Show text messages",
this);
140 void CAtcStationTreeView::storeState()
147 const QString suffix = this->suffixForIndex(i);
152 void CAtcStationTreeView::restoreState()
157 const QString suffix = this->suffixForIndex(i);
163 void CAtcStationTreeView::tuneInAtcCom1()
166 if (s.getCallsign().isEmpty()) {
return; }
170 void CAtcStationTreeView::tuneInAtcCom2()
173 if (s.getCallsign().isEmpty()) {
return; }
177 void CAtcStationTreeView::requestTextMessage()
180 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 objectSelected(const swift::misc::aviation::CAtcStation &station)
This object has been selected.
bool isEmpty() const
Empty.
void requestComFrequency(const swift::misc::physical_quantities::CFrequency &frequency, swift::misc::aviation::CComSystem::ComUnit unit)
Request COM frequency.
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