mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
refs #432, originator list model + view
This commit is contained in:
@@ -8,9 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "listmodelbase.h"
|
#include "listmodelbase.h"
|
||||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
|
||||||
#include "blackmisc/namevariantpairlist.h"
|
|
||||||
#include "blackmisc/statusmessagelist.h"
|
|
||||||
#include "blackmisc/aviation/atcstationlist.h"
|
#include "blackmisc/aviation/atcstationlist.h"
|
||||||
#include "blackmisc/aviation/aircraftlist.h"
|
#include "blackmisc/aviation/aircraftlist.h"
|
||||||
#include "blackmisc/aviation/airportlist.h"
|
#include "blackmisc/aviation/airportlist.h"
|
||||||
@@ -21,6 +18,10 @@
|
|||||||
#include "blackmisc/network/aircraftmappinglist.h"
|
#include "blackmisc/network/aircraftmappinglist.h"
|
||||||
#include "blackmisc/setkeyboardhotkeylist.h"
|
#include "blackmisc/setkeyboardhotkeylist.h"
|
||||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||||
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
|
#include "blackmisc/namevariantpairlist.h"
|
||||||
|
#include "blackmisc/statusmessagelist.h"
|
||||||
|
#include "blackmisc/originatorlist.h"
|
||||||
#include "blackmisc/variant.h"
|
#include "blackmisc/variant.h"
|
||||||
#include "blackmisc/blackmiscfreefunctions.h"
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
|
||||||
@@ -459,6 +460,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
// see here for the reason of thess forward instantiations
|
// see here for the reason of thess forward instantiations
|
||||||
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
||||||
|
template class CListModelBase<BlackMisc::COriginator, BlackMisc::COriginatorList>;
|
||||||
template class CListModelBase<BlackMisc::CStatusMessage, BlackMisc::CStatusMessageList>;
|
template class CListModelBase<BlackMisc::CStatusMessage, BlackMisc::CStatusMessageList>;
|
||||||
template class CListModelBase<BlackMisc::CNameVariantPair, BlackMisc::CNameVariantPairList>;
|
template class CListModelBase<BlackMisc::CNameVariantPair, BlackMisc::CNameVariantPairList>;
|
||||||
template class CListModelBase<BlackMisc::Aviation::CAtcStation, BlackMisc::Aviation::CAtcStationList>;
|
template class CListModelBase<BlackMisc::Aviation::CAtcStation, BlackMisc::Aviation::CAtcStationList>;
|
||||||
|
|||||||
44
src/blackgui/models/originatorlistmodel.cpp
Normal file
44
src/blackgui/models/originatorlistmodel.cpp
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/* 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 "originatorlistmodel.h"
|
||||||
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
#include <QMetaProperty>
|
||||||
|
#include <QBrush>
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Models
|
||||||
|
{
|
||||||
|
COriginatorListModel::COriginatorListModel(QObject *parent) :
|
||||||
|
CListModelBase("ModelOriginatorList", parent)
|
||||||
|
{
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("name", COriginator::IndexName));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("machine", COriginator::IndexMachineName));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("process", COriginator::IndexProcessName));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("p.id", "process id", COriginator::IndexProcessId));
|
||||||
|
this->m_columns.addColumn(CColumn("time", "received", COriginator::IndexUtcTimestamp, new CDateTimeFormatter(CDateTimeFormatter::formatHms())));
|
||||||
|
this->m_columns.addColumn(CColumn("lcl m.", "local machine", COriginator::IndexIsFromLocalMachine, new CBoolIconFormatter("local", "remote")));
|
||||||
|
this->m_columns.addColumn(CColumn("same p.", "same process", COriginator::IndexIsFromSameProcess, new CBoolIconFormatter("same process", "other process")));
|
||||||
|
this->m_columns.addColumn(CColumn::standardString("m.id", "machine id", COriginator::IndexMachineIdBase64));
|
||||||
|
|
||||||
|
// force strings for translation in resource files
|
||||||
|
(void)QT_TRANSLATE_NOOP("ModelOriginatorList", "name");
|
||||||
|
(void)QT_TRANSLATE_NOOP("ModelOriginatorList", "machine");
|
||||||
|
(void)QT_TRANSLATE_NOOP("ModelOriginatorList", "process");
|
||||||
|
(void)QT_TRANSLATE_NOOP("ModelOriginatorList", "p.id");
|
||||||
|
(void)QT_TRANSLATE_NOOP("ModelOriginatorList", "m.id");
|
||||||
|
(void)QT_TRANSLATE_NOOP("ModelOriginatorList", "lcl m.");
|
||||||
|
(void)QT_TRANSLATE_NOOP("ModelOriginatorList", "same p.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // class
|
||||||
|
} // namespace
|
||||||
37
src/blackgui/models/originatorlistmodel.h
Normal file
37
src/blackgui/models/originatorlistmodel.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/* 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_ORIGINATORLISTMODEL_H
|
||||||
|
#define BLACKGUI_ORIGINATORLISTMODEL_H
|
||||||
|
|
||||||
|
#include "blackgui/blackguiexport.h"
|
||||||
|
#include "blackmisc/originatorlist.h"
|
||||||
|
#include "blackgui/models/listmodelbase.h"
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Models
|
||||||
|
{
|
||||||
|
//! Originator list model
|
||||||
|
class BLACKGUI_EXPORT COriginatorListModel : public CListModelBase<BlackMisc::COriginator, BlackMisc::COriginatorList>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
explicit COriginatorListModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~COriginatorListModel() {}
|
||||||
|
};
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
|
#endif // guard
|
||||||
25
src/blackgui/views/originatorview.cpp
Normal file
25
src/blackgui/views/originatorview.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/* 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 "originatorview.h"
|
||||||
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackGui::Models;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Views
|
||||||
|
{
|
||||||
|
COriginatorView::COriginatorView(QWidget *parent) : CViewBase(parent)
|
||||||
|
{
|
||||||
|
this->standardInit(new COriginatorListModel(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
34
src/blackgui/views/originatorview.h
Normal file
34
src/blackgui/views/originatorview.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/* 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_ORIGINATORVIEW_H
|
||||||
|
#define BLACKGUI_ORIGINATORVIEW_H
|
||||||
|
|
||||||
|
#include "blackgui/blackguiexport.h"
|
||||||
|
#include "viewbase.h"
|
||||||
|
#include "../models/originatorlistmodel.h"
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Views
|
||||||
|
{
|
||||||
|
//! Originator servers
|
||||||
|
class BLACKGUI_EXPORT COriginatorView : public CViewBase<Models::COriginatorListModel, BlackMisc::COriginatorList, BlackMisc::COriginator>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
explicit COriginatorView(QWidget *parent = nullptr);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // guard
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "viewbase.h"
|
#include "viewbase.h"
|
||||||
#include "../models/statusmessagelistmodel.h"
|
#include "../models/statusmessagelistmodel.h"
|
||||||
|
#include "../models/originatorlistmodel.h"
|
||||||
#include "../models/namevariantpairlistmodel.h"
|
#include "../models/namevariantpairlistmodel.h"
|
||||||
#include "../models/atcstationlistmodel.h"
|
#include "../models/atcstationlistmodel.h"
|
||||||
#include "../models/aircraftmodellistmodel.h"
|
#include "../models/aircraftmodellistmodel.h"
|
||||||
@@ -402,6 +403,8 @@ namespace BlackGui
|
|||||||
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
||||||
template class CViewBase<BlackGui::Models::CStatusMessageListModel, BlackMisc::CStatusMessageList, BlackMisc::CStatusMessage>;
|
template class CViewBase<BlackGui::Models::CStatusMessageListModel, BlackMisc::CStatusMessageList, BlackMisc::CStatusMessage>;
|
||||||
template class CViewBase<BlackGui::Models::CNameVariantPairModel, BlackMisc::CNameVariantPairList, BlackMisc::CNameVariantPair>;
|
template class CViewBase<BlackGui::Models::CNameVariantPairModel, BlackMisc::CNameVariantPairList, BlackMisc::CNameVariantPair>;
|
||||||
|
template class CViewBase<BlackGui::Models::COriginatorListModel, BlackMisc::COriginatorList, BlackMisc::COriginator>;
|
||||||
|
|
||||||
template class CViewBase<BlackGui::Models::CAtcStationListModel, BlackMisc::Aviation::CAtcStationList, BlackMisc::Aviation::CAtcStation>;
|
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::CAirportListModel, BlackMisc::Aviation::CAirportList, BlackMisc::Aviation::CAirport>;
|
||||||
template class CViewBase<BlackGui::Models::CServerListModel, BlackMisc::Network::CServerList, BlackMisc::Network::CServer>;
|
template class CViewBase<BlackGui::Models::CServerListModel, BlackMisc::Network::CServerList, BlackMisc::Network::CServer>;
|
||||||
|
|||||||
Reference in New Issue
Block a user