Ref T264, application info list model

This commit is contained in:
Klaus Basan
2018-05-18 21:59:25 +02:00
parent a3f12a866b
commit 9fb7ba7592
5 changed files with 91 additions and 1 deletions

View File

@@ -29,6 +29,7 @@
#include "blackmisc/weather/temperaturelayerlist.h"
#include "blackmisc/weather/windlayerlist.h"
#include "blackmisc/input/actionhotkeylist.h"
#include "blackmisc/applicationinfolist.h"
#include "blackmisc/countrylist.h"
#include "blackmisc/namevariantpairlist.h"
#include "blackmisc/statusmessagelist.h"

View File

@@ -16,6 +16,7 @@
#include "blackgui/models/airlineicaolistmodel.h"
#include "blackgui/models/airportlistmodel.h"
#include "blackgui/models/airportlistmodel.h"
#include "blackgui/models/applicationinfolistmodel.h"
#include "blackgui/models/atcstationlistmodel.h"
#include "blackgui/models/clientlistmodel.h"
#include "blackgui/models/cloudlayerlistmodel.h"

View File

@@ -0,0 +1,46 @@
/* Copyright (C) 2018
* 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 "blackgui/models/applicationinfolistmodel.h"
#include "blackgui/models/columnformatters.h"
#include "blackgui/models/columns.h"
#include <QModelIndex>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QString>
#include <Qt>
#include <QtDebug>
#include <QtGlobal>
using namespace BlackMisc;
namespace BlackGui
{
namespace Models
{
CApplicationInfoListModel::CApplicationInfoListModel(QObject *parent) :
CListModelBase("ModelApplicationInfoListModel", parent)
{
m_columns.addColumn(CColumn::standardString("version", CApplicationInfo::IndexVersionString));
m_columns.addColumn(CColumn::standardString("OS", CApplicationInfo::IndexPlatformInfo));
m_columns.addColumn(CColumn::standardString("exe.path", CApplicationInfo::IndexExecutablePath));
m_columns.addColumn(CColumn::standardString("data.path", CApplicationInfo::IndexApplicationDataPath));
// default sort order
this->setSortColumnByPropertyIndex(CApplicationInfo::IndexVersionString);
m_sortOrder = Qt::DescendingOrder;
}
void CApplicationInfoListModel::otherSwiftVersionsFromDataDirectories()
{
this->update(CApplicationInfoList::fromOtherSwiftVersionsFromDataDirectories());
}
} // namespace
} // namespace

View File

@@ -0,0 +1,41 @@
/* Copyright (C) 2018
* 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_MODELS_APPLICATIONINFOLISTMODEL_H
#define BLACKGUI_MODELS_APPLICATIONINFOLISTMODEL_H
#include "blackgui/blackguiexport.h"
#include "blackgui/models/listmodelbase.h"
#include "blackmisc/applicationinfolist.h"
#include <QObject>
class QStandardItemModel;
namespace BlackGui
{
namespace Models
{
//! Application info list model
class BLACKGUI_EXPORT CApplicationInfoListModel : public CListModelBase<BlackMisc::CApplicationInfo, BlackMisc::CApplicationInfoList, true>
{
public:
//! Constructor
explicit CApplicationInfoListModel(QObject *parent = nullptr);
//! Destructor
virtual ~CApplicationInfoListModel() {}
//! \copydoc BlackMisc::CApplicationInfoList::fromOtherSwiftVersionsFromDataDirectories
void otherSwiftVersionsFromDataDirectories();
};
} // ns
} // ns
#endif // guard

View File

@@ -767,11 +767,12 @@ namespace BlackGui
// see here for the reason of thess forward instantiations
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
template class CListModelBase<BlackMisc::Aviation::CLivery, BlackMisc::Aviation::CLiveryList, true>;
template class CListModelBase<BlackMisc::CIdentifier, BlackMisc::CIdentifierList, false>;
template class CListModelBase<BlackMisc::CApplicationInfo, BlackMisc::CApplicationInfoList, true>;
template class CListModelBase<BlackMisc::CStatusMessage, BlackMisc::CStatusMessageList, true>;
template class CListModelBase<BlackMisc::CNameVariantPair, BlackMisc::CNameVariantPairList, false>;
template class CListModelBase<BlackMisc::CCountry, BlackMisc::CCountryList, true>;
template class CListModelBase<BlackMisc::Aviation::CLivery, BlackMisc::Aviation::CLiveryList, true>;
template class CListModelBase<BlackMisc::Aviation::CAtcStation, BlackMisc::Aviation::CAtcStationList, true>;
template class CListModelBase<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList, true>;
template class CListModelBase<BlackMisc::Aviation::CAircraftIcaoCode, BlackMisc::Aviation::CAircraftIcaoCodeList, true>;