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
This commit is contained in:
Klaus Basan
2015-03-13 01:53:37 +01:00
parent aee2b2495f
commit 269c65b578
73 changed files with 1301 additions and 1311 deletions

View 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.
*/
#include "textmessageview.h"
#include <QHeaderView>
using namespace BlackMisc;
using namespace BlackGui::Models;
namespace BlackGui
{
namespace Views
{
CTextMessageView::CTextMessageView(QWidget *parent) : CViewBase(parent)
{
this->standardInit(new CTextMessageListModel(CTextMessageListModel::FromTo, this));
this->m_withMenuItemClear = true;
}
void CTextMessageView::setTextMessageMode(CTextMessageListModel::TextMessageMode mode)
{
Q_ASSERT(this->m_model);
this->m_model->setTextMessageMode(mode);
this->setSortIndicator();
}
}
} // namespace

View File

@@ -0,0 +1,35 @@
/* 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_TEXTMESSAGEVIEW_H
#define BLACKGUI_TEXTMESSAGEVIEW_H
#include "viewbase.h"
#include "../models/textmessagelistmodel.h"
namespace BlackGui
{
namespace Views
{
//! Airports view
class CTextMessageView : public CViewBase<Models::CTextMessageListModel, BlackMisc::Network::CTextMessageList, BlackMisc::Network::CTextMessage>
{
public:
//! Constructor
explicit CTextMessageView(QWidget *parent = nullptr);
//! Set display mode
void setTextMessageMode(BlackGui::Models::CTextMessageListModel::TextMessageMode mode);
};
}
}
#endif // guard

View File

@@ -13,6 +13,7 @@
#include "../models/atcstationlistmodel.h"
#include "../models/aircraftlistmodel.h"
#include "../models/aircraftmodellistmodel.h"
#include "../models/textmessagelistmodel.h"
#include "../models/airportlistmodel.h"
#include "../models/airportlistmodel.h"
#include "../models/serverlistmodel.h"
@@ -51,6 +52,7 @@ namespace BlackGui
// scroll modes
this->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
this->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
this->setWordWrap(true);
}
void CViewBaseNonTemplate::setFilterDialog(QDialog *filterDialog)
@@ -142,17 +144,19 @@ namespace BlackGui
void CViewBaseNonTemplate::initRowsResizeModeToInteractive()
{
const int height = this->verticalHeader()->minimumSectionSize();
this->setRowsResizeModeToInteractive(height);
}
void CViewBaseNonTemplate::setRowsResizeModeToInteractive(int height)
{
QHeaderView *verticalHeader = this->verticalHeader();
Q_ASSERT(verticalHeader);
verticalHeader->setSectionResizeMode(QHeaderView::Interactive);
verticalHeader->setDefaultSectionSize(height);
}
void CViewBaseNonTemplate::rowsResizeModeToContent()
{
QHeaderView *verticalHeader = this->verticalHeader();
Q_ASSERT(verticalHeader);
verticalHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
}
bool CViewBaseNonTemplate::performResizing() const
{
if (m_resizeMode == ResizingOff) { return false; }
@@ -376,6 +380,7 @@ namespace BlackGui
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::CKeyboardKeyListModel, BlackMisc::Settings::CSettingKeyboardHotkeyList, BlackMisc::Settings::CSettingKeyboardHotkey>;

View File

@@ -74,6 +74,9 @@ namespace BlackGui
//! Filter dialog
void setFilterDialog(QDialog *filterDialog);
//! Resize mode to content
void rowsResizeModeToContent();
//! Main application window widget if any
QWidget *mainApplicationWindowWidget() const;
@@ -111,10 +114,6 @@ namespace BlackGui
//! Init as interactive, as this allows manually resizing
void initRowsResizeModeToInteractive();
//! Set fixed row height (vertical header with height)
//! \sa initRowsResizeModeToFixed
virtual void setRowsResizeModeToInteractive(int height);
//! Helper method with template free signature
//! \param variant contains the container
//! \param sort