Files
pilotclient/src/blackgui/models/statusmessagelistmodel.cpp
Klaus Basan 269c65b578 As of workshop RW/KB, improved / fixed text messages
Also refs #351
* messages can be formatted with style sheet
* fixed: removed command from message
* added originator to command line
* msg parsing now in core
* using ITimestampBased for text messages and status messages
* allow to resize rows to content (view base)
* model / views for text messages
* removed old qt stylesheets
2015-03-20 17:10:58 +01:00

50 lines
2.2 KiB
C++

/* 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.
*/
#include "statusmessagelistmodel.h"
#include "blackmisc/icon.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include <QMetaProperty>
#include <QBrush>
#include <QIcon>
using namespace BlackMisc;
namespace BlackGui
{
namespace Models
{
/*
* Constructor
*/
CStatusMessageListModel::CStatusMessageListModel(QObject *parent) :
CListModelBase<BlackMisc::CStatusMessage, BlackMisc::CStatusMessageList>("ViewStatusMessageList", parent)
{
this->m_columns.addColumn(CColumn("time", CStatusMessage::IndexUtcTimestamp, new CDateTimeFormatter(CDateTimeFormatter::formatHms())));
this->m_columns.addColumn(CColumn::standardString("category", CStatusMessage::IndexCategoryHumanReadable));
CColumn col = CColumn("severity", CStatusMessage::IndexIcon);
col.setSortPropertyIndex(CStatusMessage::IndexSeverityAsString);
this->m_columns.addColumn(col);
this->m_columns.addColumn(CColumn::standardString("message", CStatusMessage::IndexMessage));
this->m_columns.addColumn(CColumn::standardString("all categories", CStatusMessage::IndexCategories));
this->m_sortedColumn = CStatusMessage::IndexUtcTimestamp;
this->m_sortOrder = Qt::DescendingOrder;
// force strings for translation in resource files
(void)QT_TRANSLATE_NOOP("ViewStatusMessageList", "time");
(void)QT_TRANSLATE_NOOP("ViewStatusMessageList", "severity");
(void)QT_TRANSLATE_NOOP("ViewStatusMessageList", "type");
(void)QT_TRANSLATE_NOOP("ViewStatusMessageList", "message");
(void)QT_TRANSLATE_NOOP("ViewStatusMessageList", "all categories");
}
} // namespace
} // namespace