swift
identifierlistmodel.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #include <QtGlobal>
7 
9 #include "gui/models/columns.h"
10 #include "misc/timestampbased.h"
11 
12 using namespace swift::misc;
13 
14 namespace swift::gui::models
15 {
16  CIdentifierListModel::CIdentifierListModel(QObject *parent) : CListModelBase("ModelIdentifierList", parent)
17  {
18  this->m_columns.addColumn(CColumn::standardString("name", CIdentifier::IndexName));
19  this->m_columns.addColumn(CColumn::standardString("machine", CIdentifier::IndexMachineName));
20  this->m_columns.addColumn(CColumn::standardString("process", CIdentifier::IndexProcessName));
21  this->m_columns.addColumn(CColumn::standardString("p.id", "process id", CIdentifier::IndexProcessId));
22  this->m_columns.addColumn(CColumn("lcl m.", "local machine", CIdentifier::IndexIsFromLocalMachine,
23  new CBoolIconFormatter("local", "remote")));
24  this->m_columns.addColumn(CColumn("same p.", "same process", CIdentifier::IndexIsFromSameProcess,
25  new CBoolIconFormatter("same process", "other process")));
26  this->m_columns.addColumn(CColumn::standardString("m.id", "machine id", CIdentifier::IndexMachineIdBase64));
27 
28  // force strings for translation in resource files
29  (void)QT_TRANSLATE_NOOP("ModelIdentifierList", "name");
30  (void)QT_TRANSLATE_NOOP("ModelIdentifierList", "machine");
31  (void)QT_TRANSLATE_NOOP("ModelIdentifierList", "process");
32  (void)QT_TRANSLATE_NOOP("ModelIdentifierList", "p.id");
33  (void)QT_TRANSLATE_NOOP("ModelIdentifierList", "m.id");
34  (void)QT_TRANSLATE_NOOP("ModelIdentifierList", "lcl m.");
35  (void)QT_TRANSLATE_NOOP("ModelIdentifierList", "same p.");
36  }
37 } // namespace swift::gui::models
Single column.
Definition: columns.h:26
static CColumn standardString(const QString &headerName, const swift::misc::CPropertyIndex &propertyIndex, int alignment=CDefaultFormatter::alignDefault())
Get a standard string object formatted column.
Definition: columns.cpp:57
void addColumn(const CColumn &column)
Add a column.
Definition: columns.cpp:100
Models to be used with views, mainly QTableView.
Free functions in swift::misc.