mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
refs #849, model/view for statistics
This commit is contained in:
committed by
Mathew Sutcliffe
parent
cb1e213c64
commit
b35bbd8b81
@@ -23,6 +23,7 @@
|
||||
#include "blackgui/models/distributorlistmodel.h"
|
||||
#include "blackgui/models/identifierlistmodel.h"
|
||||
#include "blackgui/models/liverylistmodel.h"
|
||||
#include "blackgui/models/matchingstatisticsmodel.h"
|
||||
#include "blackgui/models/namevariantpairlistmodel.h"
|
||||
#include "blackgui/models/serverlistmodel.h"
|
||||
#include "blackgui/models/simulatedaircraftlistmodel.h"
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/simulation/matchingstatisticsentry.h"
|
||||
#include "blackmisc/simulation/matchingstatistics.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/variant.h"
|
||||
@@ -774,13 +776,14 @@ namespace BlackGui
|
||||
template class CListModelBase<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList, true>;
|
||||
template class CListModelBase<BlackMisc::Aviation::CAircraftIcaoCode, BlackMisc::Aviation::CAircraftIcaoCodeList, true>;
|
||||
template class CListModelBase<BlackMisc::Aviation::CAirlineIcaoCode, BlackMisc::Aviation::CAirlineIcaoCodeList, true>;
|
||||
template class CListModelBase<BlackMisc::Network::CServer, BlackMisc::Network::CServerList, false>;
|
||||
template class CListModelBase<BlackMisc::Network::CServer, BlackMisc::Network::CServerList, true>;
|
||||
template class CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList, true>;
|
||||
template class CListModelBase<BlackMisc::Network::CTextMessage, BlackMisc::Network::CTextMessageList, false>;
|
||||
template class CListModelBase<BlackMisc::Network::CClient, BlackMisc::Network::CClientList, false>;
|
||||
template class CListModelBase<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList, true>;
|
||||
template class CListModelBase<BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::Simulation::CSimulatedAircraftList, true>;
|
||||
template class CListModelBase<BlackMisc::Simulation::CDistributor, BlackMisc::Simulation::CDistributorList, true>;
|
||||
template class CListModelBase<BlackMisc::Simulation::CMatchingStatisticsEntry, BlackMisc::Simulation::CMatchingStatistics, true>;
|
||||
template class CListModelBase<BlackMisc::Weather::CCloudLayer, BlackMisc::Weather::CCloudLayerList, false>;
|
||||
template class CListModelBase<BlackMisc::Weather::CTemperatureLayer, BlackMisc::Weather::CTemperatureLayerList, false>;
|
||||
template class CListModelBase<BlackMisc::Weather::CWindLayer, BlackMisc::Weather::CWindLayerList, false>;
|
||||
|
||||
58
src/blackgui/models/matchingstatisticsmodel.cpp
Normal file
58
src/blackgui/models/matchingstatisticsmodel.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/* Copyright (C) 2017
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "matchingstatisticsmodel.h"
|
||||
#include "blackgui/models/columns.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
CMatchingStatisticsModel::CMatchingStatisticsModel(MatchingStatisticsMode mode, QObject *parent) :
|
||||
CListModelBase("MatchingStatisticsModel", parent)
|
||||
{
|
||||
this->setMode(mode);
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("MatchingStatisticsModel", "session");
|
||||
(void)QT_TRANSLATE_NOOP("MatchingStatisticsModel", "model set");
|
||||
(void)QT_TRANSLATE_NOOP("MatchingStatisticsModel", "combination");
|
||||
(void)QT_TRANSLATE_NOOP("MatchingStatisticsModel", "type");
|
||||
(void)QT_TRANSLATE_NOOP("MatchingStatisticsModel", "aircraft");
|
||||
(void)QT_TRANSLATE_NOOP("MatchingStatisticsModel", "airline");
|
||||
}
|
||||
|
||||
void CMatchingStatisticsModel::setMode(CMatchingStatisticsModel::MatchingStatisticsMode mode)
|
||||
{
|
||||
if (this->m_mode == mode) { return; }
|
||||
this->m_mode = mode;
|
||||
this->m_columns.clear();
|
||||
switch (mode)
|
||||
{
|
||||
case ForMultiSessions:
|
||||
this->m_columns.addColumn(CColumn::standardString("session", CMatchingStatisticsEntry::IndexSessionId));
|
||||
this->m_columns.addColumn(CColumn::standardString("model set", CMatchingStatisticsEntry::IndexModelSetId));
|
||||
// fall thru
|
||||
case ForSingleSession:
|
||||
this->m_columns.addColumn(CColumn("type", CMatchingStatisticsEntry::IndexEntryTypeAsIcon));
|
||||
this->m_columns.addColumn(CColumn::standardString("aircraft", CMatchingStatisticsEntry::IndexAircraftDesignator));
|
||||
this->m_columns.addColumn(CColumn::standardString("airline", CMatchingStatisticsEntry::IndexAirlineDesignator));
|
||||
this->m_columns.addColumn(CColumn::standardString("description", CMatchingStatisticsEntry::IndexDescription));
|
||||
this->m_columns.addColumn(CColumn::standardInteger("#", "count", CMatchingStatisticsEntry::IndexCount));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this->setSortColumnByPropertyIndex(CMatchingStatisticsEntry::IndexAircraftDesignator);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
51
src/blackgui/models/matchingstatisticsmodel.h
Normal file
51
src/blackgui/models/matchingstatisticsmodel.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 2017
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_MATCHINGSTATISTICSMODEL_H
|
||||
#define BLACKGUI_MATCHINGSTATISTICSMODEL_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/models/listmodelbase.h"
|
||||
#include "blackmisc/simulation/matchingstatistics.h"
|
||||
|
||||
class QObject;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
//! Matching statistics entry
|
||||
class BLACKGUI_EXPORT CMatchingStatisticsModel : public CListModelBase<BlackMisc::Simulation::CMatchingStatisticsEntry, BlackMisc::Simulation::CMatchingStatistics, true>
|
||||
{
|
||||
public:
|
||||
//! How to display
|
||||
enum MatchingStatisticsMode
|
||||
{
|
||||
NoSet,
|
||||
ForSingleSession,
|
||||
ForMultiSessions
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
explicit CMatchingStatisticsModel(MatchingStatisticsMode mode, QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CMatchingStatisticsModel() {}
|
||||
|
||||
//! Set mode
|
||||
void setMode(MatchingStatisticsMode mode);
|
||||
|
||||
private:
|
||||
MatchingStatisticsMode m_mode = NoSet;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user