refs #319, cleaned up views for formatters, in the same step fixed bug sort column based on view mode was missing

This commit is contained in:
Klaus Basan
2014-08-31 15:52:00 +02:00
parent 983a8d5d30
commit 538cee89b2
10 changed files with 82 additions and 92 deletions

View File

@@ -19,19 +19,27 @@ namespace BlackGui
{
CAtcStationView::CAtcStationView(QWidget *parent) : CViewBase(parent)
{
this->m_model = new CAtcStationListModel(CAtcStationListModel::StationsOnline, this);
this->setModel(this->m_model); // via QTableView
this->m_model->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAtcStation::IndexDistance);
if (this->m_model->hasValidSortColumn())
this->horizontalHeader()->setSortIndicator(
this->m_model->getSortColumn(),
this->m_model->getSortOrder());
this->standardInit(new CAtcStationListModel(CAtcStationListModel::StationsOnline, this));
}
void CAtcStationView::setStationMode(CAtcStationListModel::AtcStationMode stationMode)
{
Q_ASSERT(this->m_model);
this->m_model->setStationMode(stationMode);
switch (stationMode)
{
case CAtcStationListModel::NotSet:
case CAtcStationListModel::StationsOnline:
this->m_model->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAtcStation::IndexDistance);
break;
case CAtcStationListModel::StationsBooked:
this->m_model->setSortColumnByPropertyIndex(BlackMisc::Aviation::CAtcStation::IndexBookedFrom);
break;
default:
break;
}
this->setSortIndicator();
}
void CAtcStationView::changedAtcStationConnectionStatus(const Aviation::CAtcStation &station, bool added)