mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Formatting
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
#include "blackgui/models/clientlistmodel.h"
|
||||
#include "blackgui/models/columnformatters.h"
|
||||
#include "blackgui/models/columns.h"
|
||||
#include "blackmisc/compare.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/network/user.h"
|
||||
#include "blackmisc/compare.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/propertyindexvariantmap.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
@@ -27,21 +27,18 @@ namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CClientListModel::CClientListModel(QObject *parent) :
|
||||
CListModelBase<BlackMisc::Network::CClient, BlackMisc::Network::CClientList>("ViewClientList", parent)
|
||||
CListModelBase<CClient, CClientList>("ViewClientList", parent)
|
||||
{
|
||||
this->m_columns.addColumn(CColumn("client", CClient::IndexIcon));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("callsign", CClient::IndexCallsign));
|
||||
this->m_columns.addColumn(CColumn::standardString("realname", { CClient::IndexUser, CUser::IndexRealName }));
|
||||
this->m_columns.addColumn(CColumn("vo.", "voice capabilities", CClient::IndexVoiceCapabilitiesIcon, new CPixmapFormatter()));
|
||||
this->m_columns.addColumn(CColumn::standardString("capabilities", CClient::IndexCapabilitiesString));
|
||||
this->m_columns.addColumn(CColumn::standardString("model", CClient::IndexModelString));
|
||||
this->m_columns.addColumn(CColumn("q.?", "queried", {CClient::IndexModelString, CAircraftModel::IndexHasQueriedModelString},
|
||||
new CBoolIconFormatter("queried", "not queried")));
|
||||
this->m_columns.addColumn(CColumn::standardString("server", CClient::IndexServer));
|
||||
m_columns.addColumn(CColumn("client", CClient::IndexIcon));
|
||||
m_columns.addColumn(CColumn::standardValueObject("callsign", CClient::IndexCallsign));
|
||||
m_columns.addColumn(CColumn::standardString("realname", { CClient::IndexUser, CUser::IndexRealName }));
|
||||
m_columns.addColumn(CColumn("vo.", "voice capabilities", CClient::IndexVoiceCapabilitiesIcon, new CPixmapFormatter()));
|
||||
m_columns.addColumn(CColumn::standardString("capabilities", CClient::IndexCapabilitiesString));
|
||||
m_columns.addColumn(CColumn::standardString("model", CClient::IndexModelString));
|
||||
m_columns.addColumn(CColumn("q.?", "queried", {CClient::IndexModelString, CAircraftModel::IndexHasQueriedModelString},
|
||||
new CBoolIconFormatter("queried", "not queried")));
|
||||
m_columns.addColumn(CColumn::standardString("server", CClient::IndexServer));
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ViewClientList", "callsign");
|
||||
@@ -56,26 +53,20 @@ namespace BlackGui
|
||||
static const CPropertyIndex ms({CClient::IndexModelString, CAircraftModel::IndexModelString});
|
||||
static const CPropertyIndex qf({CClient::IndexModelString, CAircraftModel::IndexHasQueriedModelString});
|
||||
if (role != Qt::DisplayRole && role != Qt::DecorationRole) { return CListModelBase::data(index, role); }
|
||||
CPropertyIndex pi = modelIndexToPropertyIndex(index);
|
||||
const CPropertyIndex pi = modelIndexToPropertyIndex(index);
|
||||
if (pi == ms && role == Qt::DisplayRole)
|
||||
{
|
||||
// no model string for ATC
|
||||
const CClient client = this->at(index);
|
||||
bool atc = client.isAtc();
|
||||
if (atc)
|
||||
{
|
||||
return QVariant("ATC");
|
||||
}
|
||||
const bool atc = client.isAtc();
|
||||
if (atc) { return QVariant("ATC"); }
|
||||
}
|
||||
else if (pi == qf && role == Qt::DecorationRole)
|
||||
{
|
||||
// no symbol for ATC
|
||||
const CClient client = this->at(index);
|
||||
bool atc = client.isAtc();
|
||||
if (atc)
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
const bool atc = client.isAtc();
|
||||
if (atc) { return QVariant(); }
|
||||
}
|
||||
return CListModelBase::data(index, role);
|
||||
}
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_CLIENTLISTMODEL_H
|
||||
#define BLACKGUI_CLIENTLISTMODEL_H
|
||||
#ifndef BLACKGUI_MODELS_CLIENTLISTMODEL_H
|
||||
#define BLACKGUI_MODELS_CLIENTLISTMODEL_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/models/listmodelbase.h"
|
||||
#include "blackmisc/network/client.h"
|
||||
#include "blackmisc/network/clientlist.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "listmodelcallsignobjects.h"
|
||||
#include "allmodelcontainers.h"
|
||||
#include "blackmisc/db/datastoreobjectlist.h"
|
||||
#include "blackmisc/orderable.h"
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
Reference in New Issue
Block a user