refs #445, models and views for new value classes

* livery
* distributor
This commit is contained in:
Klaus Basan
2015-07-10 01:11:14 +02:00
committed by Mathew Sutcliffe
parent 3c9f95356e
commit b308014bc2
12 changed files with 336 additions and 28 deletions

View File

@@ -0,0 +1,31 @@
/* Copyright (C) 2013
* 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.
*/
#ifndef BLACKGUI_MODELS_ALLMODELCONTAINERS_H
#define BLACKGUI_MODELS_ALLMODELCONTAINERS_H
#include "blackmisc/aviation/atcstationlist.h"
#include "blackmisc/aviation/aircraftlist.h"
#include "blackmisc/aviation/airportlist.h"
#include "blackmisc/aviation/liverylist.h"
#include "blackmisc/network/serverlist.h"
#include "blackmisc/network/userlist.h"
#include "blackmisc/network/clientlist.h"
#include "blackmisc/network/textmessagelist.h"
#include "blackmisc/network/aircraftmappinglist.h"
#include "blackmisc/setkeyboardhotkeylist.h"
#include "blackmisc/simulation/simulatedaircraftlist.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/simulation/distributorlist.h"
#include "blackmisc/namevariantpairlist.h"
#include "blackmisc/statusmessagelist.h"
#include "blackmisc/identifierlist.h"
#endif // guard

View File

@@ -0,0 +1,30 @@
/* Copyright (C) 2013
* 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.
*/
#ifndef BLACKGUI_MODELS_ALLMODELS_H
#define BLACKGUI_MODELS_ALLMODELS_H
#include "blackgui/models/statusmessagelistmodel.h"
#include "blackgui/models/identifierlistmodel.h"
#include "blackgui/models/namevariantpairlistmodel.h"
#include "blackgui/models/atcstationlistmodel.h"
#include "blackgui/models/aircraftmodellistmodel.h"
#include "blackgui/models/textmessagelistmodel.h"
#include "blackgui/models/airportlistmodel.h"
#include "blackgui/models/airportlistmodel.h"
#include "blackgui/models/serverlistmodel.h"
#include "blackgui/models/userlistmodel.h"
#include "blackgui/models/clientlistmodel.h"
#include "blackgui/models/simulatedaircraftlistmodel.h"
#include "blackgui/models/liverylistmodel.h"
#include "blackgui/models/distributorlistmodel.h"
#include "blackgui/models/keyboardkeylistmodel.h"
#endif // guard

View File

@@ -0,0 +1,36 @@
/* Copyright (C) 2015
* 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 "distributorlistmodel.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include <QMetaProperty>
#include <QBrush>
using namespace BlackMisc::Simulation;
namespace BlackGui
{
namespace Models
{
CDistributorListModel::CDistributorListModel(QObject *parent) :
CListModelBase("ModelDistributorList", parent)
{
this->m_columns.addColumn(CColumn::standardString("key", CDistributor::IndexDbStringKey));
this->m_columns.addColumn(CColumn::standardString("description", CDistributor::IndexDescription));
this->m_columns.addColumn(CColumn::standardString("alias1", CDistributor::IndexAlias1));
this->m_columns.addColumn(CColumn::standardString("alias2", CDistributor::IndexAlias2));
// force strings for translation in resource files
(void)QT_TRANSLATE_NOOP("ModelDistributorList", "key");
(void)QT_TRANSLATE_NOOP("ModelDistributorList", "description");
(void)QT_TRANSLATE_NOOP("ModelDistributorList", "alias1");
(void)QT_TRANSLATE_NOOP("ModelDistributorList", "alias2");
}
} // class
} // namespace

View File

@@ -0,0 +1,38 @@
/* Copyright (C) 2015
* 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_DISTRIBUTORLISTMODEL_H
#define BLACKGUI_DISTRIBUTORLISTMODEL_H
#include "blackgui/blackguiexport.h"
#include "blackmisc/simulation/distributorlist.h"
#include "blackgui/models/listmodelbase.h"
#include <QAbstractItemModel>
namespace BlackGui
{
namespace Models
{
//! Distributor list model
class BLACKGUI_EXPORT CDistributorListModel : public CListModelBase<BlackMisc::Simulation::CDistributor, BlackMisc::Simulation::CDistributorList>
{
public:
//! Constructor
explicit CDistributorListModel(QObject *parent = nullptr);
//! Destructor
virtual ~CDistributorListModel() {}
};
} // ns
} // ns
#endif // guard

View File

@@ -8,20 +8,7 @@
*/
#include "listmodelbase.h"
#include "blackmisc/aviation/atcstationlist.h"
#include "blackmisc/aviation/aircraftlist.h"
#include "blackmisc/aviation/airportlist.h"
#include "blackmisc/network/serverlist.h"
#include "blackmisc/network/userlist.h"
#include "blackmisc/network/clientlist.h"
#include "blackmisc/network/textmessagelist.h"
#include "blackmisc/network/aircraftmappinglist.h"
#include "blackmisc/setkeyboardhotkeylist.h"
#include "blackmisc/simulation/simulatedaircraftlist.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/namevariantpairlist.h"
#include "blackmisc/statusmessagelist.h"
#include "blackmisc/identifierlist.h"
#include "allmodelcontainers.h"
#include "blackmisc/variant.h"
#include "blackmisc/blackmiscfreefunctions.h"
@@ -465,13 +452,15 @@ namespace BlackGui
template class CListModelBase<BlackMisc::Aviation::CAtcStation, BlackMisc::Aviation::CAtcStationList>;
template class CListModelBase<BlackMisc::Aviation::CAircraft, BlackMisc::Aviation::CAircraftList>;
template class CListModelBase<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList>;
template class CListModelBase<BlackMisc::Aviation::CLivery, BlackMisc::Aviation::CLiveryList>;
template class CListModelBase<BlackMisc::Network::CServer, BlackMisc::Network::CServerList>;
template class CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList>;
template class CListModelBase<BlackMisc::Network::CTextMessage, BlackMisc::Network::CTextMessageList>;
template class CListModelBase<BlackMisc::Network::CClient, BlackMisc::Network::CClientList>;
template class CListModelBase<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList>;
template class CListModelBase<BlackMisc::Network::CAircraftMapping, BlackMisc::Network::CAircraftMappingList>;
template class CListModelBase<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList>;
template class CListModelBase<BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::Simulation::CSimulatedAircraftList>;
template class CListModelBase<BlackMisc::Simulation::CDistributor, BlackMisc::Simulation::CDistributorList>;
template class CListModelBase<BlackMisc::Settings::CSettingKeyboardHotkey, BlackMisc::Settings::CSettingKeyboardHotkeyList>;
} // namespace

View File

@@ -0,0 +1,39 @@
/* Copyright (C) 2015
* 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 "liverylistmodel.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include <QMetaProperty>
#include <QBrush>
using namespace BlackMisc::Aviation;
namespace BlackGui
{
namespace Models
{
CLiveryListModel::CLiveryListModel(QObject *parent) :
CListModelBase("ModelLiveryList", parent)
{
this->m_columns.addColumn(CColumn::standardString("code", CLivery::IndexCombinedCode));
this->m_columns.addColumn(CColumn::standardString("description", CLivery::IndexDescription));
this->m_columns.addColumn(CColumn::standardString("fuselage", CLivery::IndexColorFuselage));
this->m_columns.addColumn(CColumn::standardString("tail", CLivery::IndexColorTail));
this->m_columns.addColumn(CColumn("mil.", "military", CLivery::IndexIsMilitary, new CBoolIconFormatter("military", "civil")));
// force strings for translation in resource files
(void)QT_TRANSLATE_NOOP("ModelLiveryList", "key");
(void)QT_TRANSLATE_NOOP("ModelLiveryList", "description");
(void)QT_TRANSLATE_NOOP("ModelLiveryList", "fuselage");
(void)QT_TRANSLATE_NOOP("ModelLiveryList", "tail");
(void)QT_TRANSLATE_NOOP("ModelLiveryList", "mil.");
(void)QT_TRANSLATE_NOOP("ModelLiveryList", "military");
}
} // class
} // namespace

View File

@@ -0,0 +1,38 @@
/* Copyright (C) 2015
* 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_LIVERYLISTMODEL_H
#define BLACKGUI_LIVERYLISTMODEL_H
#include "blackgui/blackguiexport.h"
#include "blackmisc/aviation/liverylist.h"
#include "blackgui/models/listmodelbase.h"
#include <QAbstractItemModel>
namespace BlackGui
{
namespace Models
{
//! Distributor list model
class BLACKGUI_EXPORT CLiveryListModel : public CListModelBase<BlackMisc::Aviation::CLivery, BlackMisc::Aviation::CLiveryList>
{
public:
//! Constructor
explicit CLiveryListModel(QObject *parent = nullptr);
//! Destructor
virtual ~CLiveryListModel() {}
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,24 @@
/* Copyright (C) 2015
* 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 "distributorview.h"
#include <QHeaderView>
using namespace BlackGui::Models;
namespace BlackGui
{
namespace Views
{
CDistributorView::CDistributorView(QWidget *parent) : CViewBase(parent)
{
this->standardInit(new CDistributorListModel(this));
}
}
} // namespace

View File

@@ -0,0 +1,33 @@
/* Copyright (C) 2015
* 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_DISTRIBUTORVIEW_H
#define BLACKGUI_DISTRIBUTORVIEW_H
#include "blackgui/blackguiexport.h"
#include "viewbase.h"
#include "../models/distributorlistmodel.h"
namespace BlackGui
{
namespace Views
{
//! Distributors
class BLACKGUI_EXPORT CDistributorView : public CViewBase<Models::CDistributorListModel, BlackMisc::Simulation::CDistributorList, BlackMisc::Simulation::CDistributor>
{
public:
//! Constructor
explicit CDistributorView(QWidget *parent = nullptr);
};
}
}
#endif // guard

View File

@@ -0,0 +1,24 @@
/* Copyright (C) 2015
* 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 "liveryview.h"
#include <QHeaderView>
using namespace BlackGui::Models;
namespace BlackGui
{
namespace Views
{
CLiveryView::CLiveryView(QWidget *parent) : CViewBase(parent)
{
this->standardInit(new CLiveryListModel(this));
}
}
} // namespace

View File

@@ -0,0 +1,33 @@
/* Copyright (C) 2015
* 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_LIVERYVIEW_H
#define BLACKGUI_LIVERYVIEW_H
#include "blackgui/blackguiexport.h"
#include "viewbase.h"
#include "../models/liverylistmodel.h"
namespace BlackGui
{
namespace Views
{
//! Distributors
class BLACKGUI_EXPORT CLiveryView : public CViewBase<Models::CLiveryListModel, BlackMisc::Aviation::CLiveryList, BlackMisc::Aviation::CLivery>
{
public:
//! Constructor
explicit CLiveryView(QWidget *parent = nullptr);
};
}
}
#endif // guard

View File

@@ -8,19 +8,7 @@
*/
#include "viewbase.h"
#include "../models/statusmessagelistmodel.h"
#include "../models/identifierlistmodel.h"
#include "../models/namevariantpairlistmodel.h"
#include "../models/atcstationlistmodel.h"
#include "../models/aircraftmodellistmodel.h"
#include "../models/textmessagelistmodel.h"
#include "../models/airportlistmodel.h"
#include "../models/airportlistmodel.h"
#include "../models/serverlistmodel.h"
#include "../models/userlistmodel.h"
#include "../models/clientlistmodel.h"
#include "../models/simulatedaircraftlistmodel.h"
#include "../models/keyboardkeylistmodel.h"
#include "blackgui/models/allmodels.h"
#include "../guiutility.h"
#include <QHeaderView>
@@ -406,12 +394,17 @@ namespace BlackGui
template class CViewBase<BlackGui::Models::CAtcStationListModel, BlackMisc::Aviation::CAtcStationList, BlackMisc::Aviation::CAtcStation>;
template class CViewBase<BlackGui::Models::CAirportListModel, BlackMisc::Aviation::CAirportList, BlackMisc::Aviation::CAirport>;
template class CViewBase<BlackGui::Models::CLiveryListModel, BlackMisc::Aviation::CLiveryList, BlackMisc::Aviation::CLivery>;
template class CViewBase<BlackGui::Models::CServerListModel, BlackMisc::Network::CServerList, BlackMisc::Network::CServer>;
template class CViewBase<BlackGui::Models::CUserListModel, BlackMisc::Network::CUserList, BlackMisc::Network::CUser>;
template class CViewBase<BlackGui::Models::CClientListModel, BlackMisc::Network::CClientList, BlackMisc::Network::CClient>;
template class CViewBase<BlackGui::Models::CTextMessageListModel, BlackMisc::Network::CTextMessageList, BlackMisc::Network::CTextMessage>;
template class CViewBase<BlackGui::Models::CSimulatedAircraftListModel, BlackMisc::Simulation::CSimulatedAircraftList, BlackMisc::Simulation::CSimulatedAircraft>;
template class CViewBase<BlackGui::Models::CAircraftModelListModel, BlackMisc::Simulation::CAircraftModelList, BlackMisc::Simulation::CAircraftModel>;
template class CViewBase<BlackGui::Models::CDistributorListModel, BlackMisc::Simulation::CDistributorList, BlackMisc::Simulation::CDistributor>;
template class CViewBase<BlackGui::Models::CKeyboardKeyListModel, BlackMisc::Settings::CSettingKeyboardHotkeyList, BlackMisc::Settings::CSettingKeyboardHotkey>;
} // namespace