From ef5f5bde0f045ce3ae82c1f9c580cb1ed7d81133 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 23 Sep 2014 00:36:13 +0200 Subject: [PATCH] Formatting, new icons, minor tweaks --- src/blackgui/components/aircraftcomponent.cpp | 3 +- src/blackgui/components/aircraftcomponent.h | 5 ++- .../components/atcstationcomponent.cpp | 11 +++--- src/blackgui/dockwidget.cpp | 2 +- src/blackgui/models/columnformatters.cpp | 6 ++++ src/blackgui/models/columnformatters.h | 3 +- src/blackgui/models/listmodelbase.cpp | 3 +- src/blackgui/models/listmodelbase.h | 4 ++- src/blackgui/updateworker.h | 1 + src/blackgui/views/viewbase.cpp | 2 +- src/blackgui/views/viewbase.h | 6 ++-- src/blackmisc/audioallclasses.h | 4 +-- src/blackmisc/iconlist.cpp | 4 +++ src/blackmisc/icons.cpp | 4 +++ src/blackmisc/icons.h | 34 ++++++++++++++++++- src/blackmisc/namevariantpair.h | 19 ++++++----- src/blackmisc/nwserverlist.cpp | 12 ++++--- src/blackmisc/nwserverlist.h | 19 +++++------ src/blackmisc/sequence.h | 1 + src/blackmisc/valueobject.cpp | 6 ++-- src/blackmisc/valueobject.h | 4 +-- src/blacksim/simulatorinfo.cpp | 11 ++++++ src/blacksim/simulatorinfo.h | 9 +++++ 23 files changed, 120 insertions(+), 53 deletions(-) diff --git a/src/blackgui/components/aircraftcomponent.cpp b/src/blackgui/components/aircraftcomponent.cpp index 63e709c5c..9ea668cd5 100644 --- a/src/blackgui/components/aircraftcomponent.cpp +++ b/src/blackgui/components/aircraftcomponent.cpp @@ -8,8 +8,9 @@ */ #include "aircraftcomponent.h" -#include "dockwidgetinfoareacomponent.h" #include "ui_aircraftcomponent.h" +#include "dockwidgetinfoareacomponent.h" +#include "../guiutility.h" namespace BlackGui { diff --git a/src/blackgui/components/aircraftcomponent.h b/src/blackgui/components/aircraftcomponent.h index 50a4d2c50..95bf0541d 100644 --- a/src/blackgui/components/aircraftcomponent.h +++ b/src/blackgui/components/aircraftcomponent.h @@ -16,7 +16,6 @@ #include "blackgui/components/timerbasedcomponent.h" #include "blackgui/components/dockwidgetinfoareacomponent.h" #include "blackmisc/avaircraft.h" - #include namespace Ui { class CAircraftComponent; } @@ -49,7 +48,7 @@ namespace BlackGui int countAirportsInRange() const; public slots: - //! Update users + //! Update aircrafts void update(); //! \copydoc CTimerBasedComponent::setUpdateIntervalSeconds @@ -71,7 +70,7 @@ namespace BlackGui private: Ui::CAircraftComponent *ui; - CTimerBasedComponent *m_timerComponent; + CTimerBasedComponent *m_timerComponent; }; } } diff --git a/src/blackgui/components/atcstationcomponent.cpp b/src/blackgui/components/atcstationcomponent.cpp index 9cc5f8f42..c95f6922e 100644 --- a/src/blackgui/components/atcstationcomponent.cpp +++ b/src/blackgui/components/atcstationcomponent.cpp @@ -48,12 +48,12 @@ namespace BlackGui Q_ASSERT(connected); connected = this->connect(this->ui->pb_AtcStationsLoadMetar, SIGNAL(clicked()), this, SLOT(getMetar())); Q_ASSERT(connected); - connect(this, &QTabWidget::currentChanged, this, &CAtcStationComponent::ps_atcStationsTabChanged); + connect(this, &QTabWidget::currentChanged, this, &CAtcStationComponent::ps_atcStationsTabChanged); // "local" tab changed (booked, online) connect(this->ui->tvp_AtcStationsOnline, &QTableView::clicked, this, &CAtcStationComponent::ps_onlineAtcStationSelected); connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::testRequestDummyAtcOnlineStations, this, &CAtcStationComponent::ps_testCreateDummyOnlineAtcStations); connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::requestUpdate, this, &CAtcStationComponent::ps_requestOnlineStationsUpdate); - connect(this->ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &CAtcStationComponent::ps_requestAtis); connect(this->ui->tvp_AtcStationsBooked, &CAtcStationView::requestUpdate, this, &CAtcStationComponent::ps_reloadAtcStationsBooked); + connect(this->ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &CAtcStationComponent::ps_requestAtis); } CAtcStationComponent::~CAtcStationComponent() @@ -82,10 +82,7 @@ namespace BlackGui this->connect(this->getIContextNetwork(), &IContextNetwork::changedAtcStationOnlineConnectionStatus, this, &CAtcStationComponent::changedAtcStationOnlineConnectionStatus); this->connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CAtcStationComponent::ps_connectionStatusChanged); } - - bool connected = connect(this->getParentInfoArea(), &CInfoArea::tabBarCurrentChanged, this, &CAtcStationComponent::ps_infoAreaTabBarChanged); - Q_ASSERT(connected); - + connect(this->getParentInfoArea(), &CInfoArea::tabBarCurrentChanged, this, &CAtcStationComponent::ps_infoAreaTabBarChanged); } void CAtcStationComponent::update() @@ -98,7 +95,7 @@ namespace BlackGui bool hasData = this->countBookedStations() > 0 || this->countOnlineStations() > 0; if (hasData && !this->isVisibleWidget()) { - // KWB remove: qDebug() will be removed soo + // KWB remove: qDebug() will be removed soon qDebug() << this->objectName() << "Skipping update, not visible"; return; } diff --git a/src/blackgui/dockwidget.cpp b/src/blackgui/dockwidget.cpp index 2169bb8df..a278dee43 100644 --- a/src/blackgui/dockwidget.cpp +++ b/src/blackgui/dockwidget.cpp @@ -201,6 +201,6 @@ namespace BlackGui void CDockWidget::onStyleSheetsChanged() { - // void + // void, for further extensions } } diff --git a/src/blackgui/models/columnformatters.cpp b/src/blackgui/models/columnformatters.cpp index 169fb7868..bcee7b15b 100644 --- a/src/blackgui/models/columnformatters.cpp +++ b/src/blackgui/models/columnformatters.cpp @@ -133,6 +133,12 @@ namespace BlackGui return QVariant(cvo->toPixmap()); } + CDateTimeFormatter::CDateTimeFormatter(const QString formatString, int alignment, bool i18n) : + CDefaultFormatter(alignment, i18n, { Qt::DisplayRole }), m_formatString(formatString) + { + // void + } + QVariant CDateTimeFormatter::displayRole(const QVariant &dateTime) const { if (dateTime.isNull()) return ""; diff --git a/src/blackgui/models/columnformatters.h b/src/blackgui/models/columnformatters.h index 51c19a599..c4ba1c95a 100644 --- a/src/blackgui/models/columnformatters.h +++ b/src/blackgui/models/columnformatters.h @@ -209,8 +209,7 @@ namespace BlackGui { public: //! Constructor - CDateTimeFormatter(const QString formatString = formatYmd(), int alignment = alignDefault(), bool i18n = true) : - CDefaultFormatter(alignment, i18n, { Qt::DisplayRole }), m_formatString(formatString) {} + CDateTimeFormatter(const QString formatString = formatYmd(), int alignment = alignDefault(), bool i18n = true); //! \copydoc CDefaultFormatter::displayRole virtual QVariant displayRole(const QVariant &dateTime) const override; diff --git a/src/blackgui/models/listmodelbase.cpp b/src/blackgui/models/listmodelbase.cpp index 59b78faa0..efc57c338 100644 --- a/src/blackgui/models/listmodelbase.cpp +++ b/src/blackgui/models/listmodelbase.cpp @@ -129,10 +129,9 @@ namespace BlackGui { // KWB remove: qDebug() will be removed soon qDebug() << "update" << this->objectName() << "size" << container.size() << "thread:" << QThread::currentThreadId(); - - // Keep sorting out of begin/end reset model QTime myTimer; + // Keep sorting out of begin/end reset model ContainerType sortedContainer; bool performSort = sort && container.size() > 1 && this->hasValidSortColumn(); if (performSort) diff --git a/src/blackgui/models/listmodelbase.h b/src/blackgui/models/listmodelbase.h index c31530d44..8f2fd2a19 100644 --- a/src/blackgui/models/listmodelbase.h +++ b/src/blackgui/models/listmodelbase.h @@ -54,7 +54,7 @@ namespace BlackGui /*! * Set column for sorting - * \param propertyIndex index of column to be sorted by + * \param propertyIndex index of column to be sorted */ virtual void setSortColumnByPropertyIndex(const BlackMisc::CPropertyIndex &propertyIndex) { @@ -85,6 +85,8 @@ namespace BlackGui protected slots: //! Helper method with template free signature + //! \param variant container is transferred in variant + //! \param sort int updateContainer(const QVariant &variant, bool sort) { return this->performUpdateContainer(variant, sort); diff --git a/src/blackgui/updateworker.h b/src/blackgui/updateworker.h index 35b50c3e0..47320c270 100644 --- a/src/blackgui/updateworker.h +++ b/src/blackgui/updateworker.h @@ -32,6 +32,7 @@ namespace BlackGui virtual ~IUpdateWorker() { terminateThread();} signals: + //! Update is completed void updateFinished(); public slots: diff --git a/src/blackgui/views/viewbase.cpp b/src/blackgui/views/viewbase.cpp index 1947f1194..3db1d2d07 100644 --- a/src/blackgui/views/viewbase.cpp +++ b/src/blackgui/views/viewbase.cpp @@ -55,7 +55,7 @@ namespace BlackGui QAction *actionInteractiveResize = new QAction(&menu); actionInteractiveResize->setObjectName(this->objectName().append("ActionResizing")); actionInteractiveResize->setIconText("Resize (auto)"); - actionInteractiveResize->setIcon(CIcons::viewMulticolumn()); + actionInteractiveResize->setIcon(CIcons::viewMultiColumn()); actionInteractiveResize->setCheckable(true); actionInteractiveResize->setChecked(this->m_resizeMode == ResizingAuto); actionInteractiveResize->setEnabled(enabled); diff --git a/src/blackgui/views/viewbase.h b/src/blackgui/views/viewbase.h index 98950119d..185f98237 100644 --- a/src/blackgui/views/viewbase.h +++ b/src/blackgui/views/viewbase.h @@ -47,7 +47,7 @@ namespace BlackGui //! Clear data virtual void clear() = 0; - //! Current rows resize mode + //! Resize mode ResizeMode getResizeMode() const { return m_resizeMode; } //! Set resize mode @@ -100,8 +100,8 @@ namespace BlackGui //! \param resize virtual int performUpdateContainer(const QVariant &variant, bool sort, bool resize) = 0; - //! Skip resizing - virtual bool skipResize() const = 0; + //! Skip resizing because of size? + virtual bool reachedResizeThreshold() const = 0; //! Resize or skip resize? virtual bool resize() const; diff --git a/src/blackmisc/audioallclasses.h b/src/blackmisc/audioallclasses.h index 22e8af2cf..b97c8424e 100644 --- a/src/blackmisc/audioallclasses.h +++ b/src/blackmisc/audioallclasses.h @@ -7,8 +7,8 @@ * contained in the LICENSE file. */ -#ifndef BLACKMISC_VOICEALLCLASSES_H -#define BLACKMISC_VOICEALLCLASSES_H +#ifndef BLACKMISC_AUDIOALLCLASSES_H +#define BLACKMISC_AUDIOALLCLASSES_H #include "blackmisc/audiodevice.h" #include "blackmisc/audiodevicelist.h" diff --git a/src/blackmisc/iconlist.cpp b/src/blackmisc/iconlist.cpp index b7396e60b..0b25434dc 100644 --- a/src/blackmisc/iconlist.cpp +++ b/src/blackmisc/iconlist.cpp @@ -102,6 +102,8 @@ namespace BlackMisc CIcon(CIcons::StandardIconRadar16, "radar"), CIcon(CIcons::StandardIconRefresh16, "refresh"), CIcon(CIcons::StandardIconResize16, "resize"), + CIcon(CIcons::StandardIconResizeHorizontal16, "resize (horizontal)"), + CIcon(CIcons::StandardIconResizeVertical16, "resize (vertical)"), CIcon(CIcons::StandardIconStatusBar16, "status bar"), CIcon(CIcons::StandardIconSwift24, "swift"), CIcon(CIcons::StandardIconSwift48, "swift"), @@ -117,6 +119,8 @@ namespace BlackMisc CIcon(CIcons::StandardIconUnknown16, "unknwon"), CIcon(CIcons::StandardIconUser16, "user"), CIcon(CIcons::StandardIconUsers16, "users"), + CIcon(CIcons::StandardIconViewMulticolumn, "view multicolumn"), + CIcon(CIcons::StandardIconViewTile, "view tile"), CIcon(CIcons::StandardIconVolumeHigh16, "volume hight"), CIcon(CIcons::StandardIconVolumeLow16, "volume low"), CIcon(CIcons::StandardIconVolumeMuted16, "muted"), diff --git a/src/blackmisc/icons.cpp b/src/blackmisc/icons.cpp index 271fe5d18..c4bb6432b 100644 --- a/src/blackmisc/icons.cpp +++ b/src/blackmisc/icons.cpp @@ -95,6 +95,8 @@ namespace BlackMisc case StandardIconRadar16: return radar16(); case StandardIconRefresh16: return refresh16(); case StandardIconResize16: return resize16(); + case StandardIconResizeHorizontal16: return resizeHorizontal16(); + case StandardIconResizeVertical16: return resizeVertical16(); case StandardIconStatusBar16: return statusBar16(); case StandardIconSwift24: return swift24(); case StandardIconSwift48: return swift48(); @@ -110,6 +112,8 @@ namespace BlackMisc case StandardIconUnknown16: return unknown16(); case StandardIconUser16: return user16(); case StandardIconUsers16: return users16(); + case StandardIconViewMulticolumn: return viewMultiColumn(); + case StandardIconViewTile: return viewTile(); case StandardIconVolumeHigh16: return volumeHigh16(); case StandardIconVolumeLow16: return volumeLow16(); case StandardIconVolumeMuted16: return volumeMuted16(); diff --git a/src/blackmisc/icons.h b/src/blackmisc/icons.h index 6b1ed7ff1..453efadbf 100644 --- a/src/blackmisc/icons.h +++ b/src/blackmisc/icons.h @@ -95,6 +95,8 @@ namespace BlackMisc StandardIconRadar16, StandardIconRefresh16, StandardIconResize16, + StandardIconResizeHorizontal16, + StandardIconResizeVertical16, StandardIconStatusBar16, StandardIconSwift24, StandardIconSwift48, @@ -110,6 +112,8 @@ namespace BlackMisc StandardIconUnknown16, StandardIconUser16, StandardIconUsers16, + StandardIconViewMulticolumn, + StandardIconViewTile, StandardIconVolumeHigh16, StandardIconVolumeLow16, StandardIconVolumeMuted16, @@ -157,7 +161,21 @@ namespace BlackMisc return pm; } - //! Resize + //! Resize horizontally + static const QPixmap &resizeHorizontal16() + { + static const QPixmap pm(":/diagona/icons/diagona/icons/arrow-resize.png"); + return pm; + } + + //! Resize vertically + static const QPixmap &resizeVertical16() + { + static const QPixmap pm(":/diagona/icons/diagona/icons/arrow-resize-090.png"); + return pm; + } + + //! Refresh static const QPixmap &refresh16() { static const QPixmap pm(":/pastel/icons/pastel/16/arrow-refresh.png"); @@ -199,6 +217,20 @@ namespace BlackMisc return pm; } + //! View multicolumn + static const QPixmap &viewMultiColumn() + { + static const QPixmap pm(":/pastel/icons/pastel/16/application-view-multicolumns.png"); + return pm; + } + + //! View tile + static const QPixmap &viewTile() + { + static const QPixmap pm(":/pastel/icons/pastel/16/application-view-tile.png"); + return pm; + } + //! Tick static const QPixmap &tick16() { diff --git a/src/blackmisc/namevariantpair.h b/src/blackmisc/namevariantpair.h index 86cebc1dc..c72bbc7fd 100644 --- a/src/blackmisc/namevariantpair.h +++ b/src/blackmisc/namevariantpair.h @@ -24,6 +24,16 @@ namespace BlackMisc class CNameVariantPair : public BlackMisc::CValueObject { public: + + //! Properties by index + enum ColumnIndex + { + IndexName = BlackMisc::CPropertyIndex::GlobalIndexCNameVariantPair, + IndexVariant, + IndexIcon, + IndexPixmap + }; + //! Default constructor. CNameVariantPair() {} @@ -69,15 +79,6 @@ namespace BlackMisc //! Members static const QStringList &jsonMembers(); - //! Properties by index - enum ColumnIndex - { - IndexName = BlackMisc::CPropertyIndex::GlobalIndexCNameVariantPair, - IndexVariant, - IndexIcon, - IndexPixmap - }; - //! \copydoc CValueObject::propertyByIndex() virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; diff --git a/src/blackmisc/nwserverlist.cpp b/src/blackmisc/nwserverlist.cpp index a47d77c58..5de8c94e0 100644 --- a/src/blackmisc/nwserverlist.cpp +++ b/src/blackmisc/nwserverlist.cpp @@ -1,7 +1,11 @@ -/* Copyright (C) 2013 VATSIM Community / authors - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* 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 "nwserverlist.h" diff --git a/src/blackmisc/nwserverlist.h b/src/blackmisc/nwserverlist.h index ff652295b..39394aa7f 100644 --- a/src/blackmisc/nwserverlist.h +++ b/src/blackmisc/nwserverlist.h @@ -1,11 +1,13 @@ -/* Copyright (C) 2013 VATSIM Community / authors - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* 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. + */ -/*! - \file -*/ +//! \file #ifndef BLACKMISC_SERVERLIST_H #define BLACKMISC_SERVERLIST_H @@ -13,9 +15,6 @@ #include "nwserver.h" #include "collection.h" #include "sequence.h" -#include -#include -#include namespace BlackMisc { diff --git a/src/blackmisc/sequence.h b/src/blackmisc/sequence.h index c97b30f1d..02ad7e214 100644 --- a/src/blackmisc/sequence.h +++ b/src/blackmisc/sequence.h @@ -355,6 +355,7 @@ namespace BlackMisc * \param key1 A pointer to a member function of T. * \param value1 Will be compared to the return value of key1. * \param newValues Values from this map will be put into each matching element. + * \param skipEqualValues Equal values will not be updated * \return The number of elements modified. */ template diff --git a/src/blackmisc/valueobject.cpp b/src/blackmisc/valueobject.cpp index 292a44584..3ad87e4a3 100644 --- a/src/blackmisc/valueobject.cpp +++ b/src/blackmisc/valueobject.cpp @@ -105,7 +105,7 @@ namespace BlackMisc /* * Variant equal property index? */ - bool CValueObject::equalPropertyByIndex(const QVariant &compareValue, const CPropertyIndex &index) const + bool CValueObject::equalsPropertyByIndex(const QVariant &compareValue, const CPropertyIndex &index) const { const QVariant myValue = this->propertyByIndex(index); return BlackMisc::equalQVariants(myValue, compareValue); @@ -149,7 +149,7 @@ namespace BlackMisc } /* - * Variant map + * apply, return changed indexes */ CPropertyIndexList CValueObject::apply(const BlackMisc::CPropertyIndexVariantMap &indexMap, bool skipEqualValues) { @@ -163,7 +163,7 @@ namespace BlackMisc const CPropertyIndex index = it.key(); if (skipEqualValues) { - bool equal = this->equalPropertyByIndex(value, index); + bool equal = this->equalsPropertyByIndex(value, index); if (equal) { continue; } } this->setPropertyByIndex(value, index); diff --git a/src/blackmisc/valueobject.h b/src/blackmisc/valueobject.h index 7ab11c7b5..d31731f16 100644 --- a/src/blackmisc/valueobject.h +++ b/src/blackmisc/valueobject.h @@ -211,11 +211,9 @@ namespace BlackMisc virtual QPixmap toPixmap() const; //! Set property by index - //! \remarks Intentionally not abstract, avoiding all classes need to implement this method virtual void setPropertyByIndex(const QVariant &variant, const CPropertyIndex &index); //! Property by index - //! \remarks Intentionally not abstract, avoiding all classes need to implement this method virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; //! Property by index as String @@ -223,7 +221,7 @@ namespace BlackMisc virtual QString propertyByIndexAsString(const CPropertyIndex &index, bool i18n = false) const; //! Is given variant equal to value of property index? - virtual bool equalPropertyByIndex(const QVariant &compareValue, const CPropertyIndex &index) const; + virtual bool equalsPropertyByIndex(const QVariant &compareValue, const CPropertyIndex &index) const; //! The stored object as CValueObject static const CValueObject *fromQVariant(const QVariant &variant); diff --git a/src/blacksim/simulatorinfo.cpp b/src/blacksim/simulatorinfo.cpp index 7ae2506e0..9a9341ccf 100644 --- a/src/blacksim/simulatorinfo.cpp +++ b/src/blacksim/simulatorinfo.cpp @@ -1,3 +1,14 @@ +/* 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. + */ + +//! \file + #include "simulatorinfo.h" #include "blackmisc/blackmiscfreefunctions.h" diff --git a/src/blacksim/simulatorinfo.h b/src/blacksim/simulatorinfo.h index 8a5da01b3..b5c9d56df 100644 --- a/src/blacksim/simulatorinfo.h +++ b/src/blacksim/simulatorinfo.h @@ -1,3 +1,12 @@ +/* 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. + */ + #ifndef BLACKSIM_SIMULATORINFO_H #define BLACKSIM_SIMULATORINFO_H