mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-06 01:06:31 +08:00
refs #335, Minor tweaks:
* Formatting * renaming * fixed some issues of cppcheck * new icons * smooth scrolling in views, stretching for few columns * fixed start timer in updatetimer * background colors of some LEDs
This commit is contained in:
committed by
Roland Winklmeier
parent
a9768566e6
commit
43ecc238ed
@@ -24,5 +24,4 @@ namespace BlackCore
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace BlackCore
|
||||
virtual ~IContextOwnAircraft() {}
|
||||
|
||||
signals:
|
||||
//! \brief Aircraft changed
|
||||
//! Aircraft changed
|
||||
//! \remarks local only
|
||||
void changedAircraft(const BlackMisc::Aviation::CAircraft &aircraft, const QString &originator);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackCore
|
||||
* Init this context
|
||||
*/
|
||||
CContextOwnAircraft::CContextOwnAircraft(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
|
||||
IContextOwnAircraft(mode, runtime), m_automaticVoiceRoomResolution(true)
|
||||
IContextOwnAircraft(mode, runtime)
|
||||
{
|
||||
Q_ASSERT(this->getRuntime());
|
||||
Q_ASSERT(this->getRuntime()->getIContextSettings());
|
||||
@@ -123,7 +123,7 @@ namespace BlackCore
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << position << altitude << originator;
|
||||
bool changed = (this->m_ownAircraft.getPosition() != position);
|
||||
if (changed) this->m_ownAircraft.setPosition(position);
|
||||
if (changed) { this->m_ownAircraft.setPosition(position); }
|
||||
|
||||
if (this->m_ownAircraft.getAltitude() != altitude)
|
||||
{
|
||||
|
||||
@@ -80,9 +80,9 @@ namespace BlackCore
|
||||
|
||||
private:
|
||||
BlackMisc::Aviation::CAircraft m_ownAircraft; //!< my aircraft
|
||||
bool m_automaticVoiceRoomResolution; //!< voice room override
|
||||
QString m_voiceRoom1UrlOverride; //!< overridden voice room url
|
||||
QString m_voiceRoom2UrlOverride; //!< overridden voice room url
|
||||
bool m_automaticVoiceRoomResolution = true; //!< automatic voice room resolution, or disable for override
|
||||
QString m_voiceRoom1UrlOverride; //!< overridden voice room url
|
||||
QString m_voiceRoom2UrlOverride; //!< overridden voice room url
|
||||
|
||||
//! Init my very own aircraft with some defaults, before overridden by simulator
|
||||
void initOwnAircraft();
|
||||
|
||||
@@ -24,9 +24,7 @@ namespace BlackGui
|
||||
|
||||
CAircraftComponent::CAircraftComponent(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
CEnableForDockWidgetInfoArea(),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CAircraftComponent), m_updateTimer(nullptr)
|
||||
ui(new Ui::CAircraftComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->tabBar()->setExpanding(false);
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftComponent> ui;
|
||||
CUpdateTimer *m_updateTimer;
|
||||
CUpdateTimer *m_updateTimer = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace BlackGui
|
||||
this->connect(this->ui->pb_CockpitToggleCom2, &QPushButton::clicked, this, &CCockpitV1Component::cockpitValuesChanged);
|
||||
this->connect(this->ui->pb_CockpitSelcalTest, &QPushButton::clicked, this, &CCockpitV1Component::testSelcal);
|
||||
|
||||
this->connect(this->ui->cbp_CockpitTransponderMode, &CTransponderModeSelector::valueChanged, this, &CCockpitV1Component::cockpitValuesChanged);
|
||||
this->connect(this->ui->cbp_CockpitTransponderMode, &CTransponderModeSelector::transponderModeChanged, this, &CCockpitV1Component::cockpitValuesChanged);
|
||||
|
||||
this->connect(this->ui->di_CockpitCom1Volume, &QDial::valueChanged, this, &CCockpitV1Component::setCom1Volume);
|
||||
this->connect(this->ui->di_CockpitCom2Volume, &QDial::valueChanged, this, &CCockpitV1Component::setCom2Volume);
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace BlackGui
|
||||
this->ui->led_Simulator->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Simulator connected", "Simulator disconnected", 14);
|
||||
|
||||
shape = CLedWidget::Rounded;
|
||||
this->ui->led_Ptt->setValues(CLedWidget::Yellow, CLedWidget::Red, shape, "Ptt", "Silence", 18);
|
||||
this->ui->led_Audio->setValues(CLedWidget::Yellow, CLedWidget::Red, shape, "On", "Muted", 18);
|
||||
this->ui->led_Ptt->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Ptt", "Silence", 18);
|
||||
this->ui->led_Audio->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "On", "Muted", 18);
|
||||
}
|
||||
|
||||
void CInfoBarStatusComponent::setDBusStatus(bool dbus)
|
||||
|
||||
@@ -20,8 +20,12 @@ namespace BlackGui
|
||||
this->m_timer = new QTimer(this);
|
||||
this->m_timerSingleShot = new QTimer(this);
|
||||
this->m_timerSingleShot->setSingleShot(true);
|
||||
this->connect(this->m_timer, SIGNAL(timeout()), parent, slot);
|
||||
this->connect(this->m_timerSingleShot, SIGNAL(timeout()), parent, slot);
|
||||
|
||||
bool c = this->connect(this->m_timer, SIGNAL(timeout()), parent, slot);
|
||||
Q_ASSERT(c);
|
||||
c = this->connect(this->m_timerSingleShot, SIGNAL(timeout()), parent, slot);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
|
||||
CUpdateTimer::~CUpdateTimer()
|
||||
|
||||
@@ -48,6 +48,9 @@ namespace BlackGui
|
||||
//! Stop timer
|
||||
void stopTimer() { this->setUpdateInterval(-1); this->m_timerSingleShot->stop(); }
|
||||
|
||||
//! Start timer
|
||||
void startTimer(int milliSeconds) { this->setUpdateInterval(milliSeconds);}
|
||||
|
||||
//! Fire the timer straight away
|
||||
void fireTimer();
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackGui
|
||||
//! Return pressed
|
||||
void ps_voiceRoomUrlsReturnPressed();
|
||||
|
||||
//! set the voice room url fields (checkboxes, line edits)
|
||||
//! Set the voice room url fields (checkboxes, line edits)
|
||||
void ps_updateAudioVoiceRoomsFromContext(const BlackMisc::Audio::CVoiceRoomList &selectedVoiceRooms, bool connected);
|
||||
|
||||
private:
|
||||
@@ -58,7 +58,6 @@ namespace BlackGui
|
||||
//! Update voice room views
|
||||
void updateVoiceRoomMembers();
|
||||
|
||||
|
||||
QScopedPointer<Ui::CVoiceRoomsComponent> ui;
|
||||
};
|
||||
|
||||
|
||||
@@ -169,14 +169,7 @@ namespace BlackGui
|
||||
|
||||
void CLedWidget::toggleValue()
|
||||
{
|
||||
if (m_value == Temporary || m_value == On)
|
||||
{
|
||||
m_value = Off;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_value = Off;
|
||||
}
|
||||
m_value = (m_value == Off) ? m_value = On : m_value = Off;
|
||||
setLed();
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ namespace BlackGui
|
||||
{ }
|
||||
|
||||
CBoolIconFormatter::CBoolIconFormatter(CIcons::IconIndex onIcon, CIcons::IconIndex offIcon, const QString &onName, const QString &offName, int alignment) :
|
||||
CBoolIconFormatter(CIconList::iconForIndex(onIcon), CIconList::iconForIndex(offIcon), onName, offName, alignment)
|
||||
CBoolIconFormatter(CIconList::iconByIndex(onIcon), CIconList::iconByIndex(offIcon), onName, offName, alignment)
|
||||
{ }
|
||||
|
||||
CBoolIconFormatter::CBoolIconFormatter(const CIcon &onIcon, const CIcon &offIcon, const QString &onName, const QString &offName, int alignment) :
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Ui { class CShowHideBar; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
//! Show or hide another section
|
||||
//! Show or hide (expand / collapse) another section
|
||||
class CShowHideBar : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
/* 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 "transpondermodeselector.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
CTransponderModeSelector::CTransponderModeSelector(QWidget *parent) : QComboBox(parent),
|
||||
m_currentMode(CTransponder::StateStandby), m_resetMode(CTransponder::StateStandby)
|
||||
CTransponderModeSelector::CTransponderModeSelector(QWidget *parent) : QComboBox(parent)
|
||||
{
|
||||
QComboBox::insertItems(0, CTransponderModeSelector::modes());
|
||||
connect(&this->m_resetTimer, &QTimer::timeout, this, &CTransponderModeSelector::resetTransponderMode);
|
||||
@@ -51,9 +58,9 @@ namespace BlackGui
|
||||
|
||||
void CTransponderModeSelector::setSelectedTransponderMode(CTransponder::TransponderMode mode)
|
||||
{
|
||||
if (mode != CTransponder::StateIdent) this->m_resetMode = mode;
|
||||
if (this->m_currentMode == mode) return;
|
||||
if (this->m_currentMode == CTransponder::StateIdent) emit this->identEnded();
|
||||
if (mode != CTransponder::StateIdent) { this->m_resetMode = mode; }
|
||||
if (this->m_currentMode == mode) { return; }
|
||||
if (this->m_currentMode == CTransponder::StateIdent) { emit this->transponderStateIdentEnded(); }
|
||||
this->m_currentMode = mode;
|
||||
QString m = CTransponder::modeAsString(mode);
|
||||
QComboBox::setCurrentText(m);
|
||||
@@ -65,7 +72,12 @@ namespace BlackGui
|
||||
{
|
||||
this->m_resetTimer.stop();
|
||||
}
|
||||
emit this->valueChanged();
|
||||
emit this->transponderModeChanged(this->m_currentMode);
|
||||
}
|
||||
|
||||
void CTransponderModeSelector::setSelectedTransponderModeStateIdent()
|
||||
{
|
||||
this->setSelectedTransponderMode(BlackMisc::Aviation::CTransponder::StateIdent);
|
||||
}
|
||||
|
||||
void CTransponderModeSelector::setSelectedTransponderModeAsString(const QString &mode)
|
||||
|
||||
@@ -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
|
||||
|
||||
#ifndef BLACKGUI_TRANSPONDERMODESELECTOR_H
|
||||
#define BLACKGUI_TRANSPONDERMODESELECTOR_H
|
||||
|
||||
@@ -11,65 +22,62 @@
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
/*!
|
||||
* \brief Selector for the transponder mode
|
||||
*/
|
||||
//! Selector for the transponder mode
|
||||
//! \remarks features ident reset
|
||||
class CTransponderModeSelector : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
BlackMisc::Aviation::CTransponder::TransponderMode m_currentMode;
|
||||
BlackMisc::Aviation::CTransponder::TransponderMode m_resetMode;
|
||||
QTimer m_resetTimer;
|
||||
|
||||
public:
|
||||
//! \brief Constructor
|
||||
//! Constructor
|
||||
explicit CTransponderModeSelector(QWidget *parent = nullptr);
|
||||
|
||||
//! \brief Standby string
|
||||
//! Standby string
|
||||
static const QString &transponderStateStandby();
|
||||
|
||||
//! \brief Ident string
|
||||
//! Ident string
|
||||
static const QString &transponderStateIdent();
|
||||
|
||||
//! \brief Mode C string
|
||||
//! Mode C string
|
||||
static const QString &transponderModeC();
|
||||
|
||||
//! \brief All relevant modes for GUI
|
||||
//! All relevant modes for GUI
|
||||
static const QStringList &modes();
|
||||
|
||||
//! \brief Selected transponder mode
|
||||
//! Selected transponder mode
|
||||
BlackMisc::Aviation::CTransponder::TransponderMode getSelectedTransponderMode() const;
|
||||
|
||||
//! \brief Selected transponder mode
|
||||
void setSelectedTransponderMode(BlackMisc::Aviation::CTransponder::TransponderMode mode);
|
||||
|
||||
//!\ brief Set to ident
|
||||
void setSelectedTransponderModeStateIdent()
|
||||
{
|
||||
this->setSelectedTransponderMode(BlackMisc::Aviation::CTransponder::StateIdent);
|
||||
}
|
||||
|
||||
//! \brief Ident selected
|
||||
//! Ident selected
|
||||
bool isIdentSelected() const
|
||||
{
|
||||
return this->getSelectedTransponderMode() == BlackMisc::Aviation::CTransponder::StateIdent;
|
||||
}
|
||||
|
||||
public slots:
|
||||
//! \brief reset to last mode (unequal ident)
|
||||
//! reset to last mode (unequal ident)
|
||||
void resetTransponderMode();
|
||||
|
||||
//! \brief Selected transponder mode
|
||||
//! Selected transponder mode
|
||||
void setSelectedTransponderModeAsString(const QString &mode);
|
||||
|
||||
signals:
|
||||
//! Singal, which makes sure the value is already updated internally
|
||||
void valueChanged();
|
||||
//! Selected transponder mode
|
||||
void setSelectedTransponderMode(BlackMisc::Aviation::CTransponder::TransponderMode mode);
|
||||
|
||||
//! \brief Ident ended
|
||||
void identEnded();
|
||||
//! Set to ident (transponder state)
|
||||
void setSelectedTransponderModeStateIdent();
|
||||
|
||||
signals:
|
||||
//! Mode / state has been changed
|
||||
void transponderModeChanged(BlackMisc::Aviation::CTransponder::TransponderMode newMode);
|
||||
|
||||
//! Ident phase ended
|
||||
void transponderStateIdentEnded();
|
||||
|
||||
private:
|
||||
BlackMisc::Aviation::CTransponder::TransponderMode m_currentMode = BlackMisc::Aviation::CTransponder::StateStandby;
|
||||
BlackMisc::Aviation::CTransponder::TransponderMode m_resetMode = BlackMisc::Aviation::CTransponder::StateStandby;
|
||||
QTimer m_resetTimer;
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace BlackGui
|
||||
{
|
||||
CNameVariantPairView::CNameVariantPairView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
m_forceStretchLastColumnWhenResized = true;
|
||||
this->standardInit(new CNameVariantPairModel(true, this));
|
||||
}
|
||||
|
||||
@@ -47,4 +48,4 @@ namespace BlackGui
|
||||
return this->m_model->containsName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace BlackGui
|
||||
void setIconMode(bool withIcon);
|
||||
|
||||
//! Update or add value, QVariant version
|
||||
bool addOrUpdateByName(const QString &name, const QVariant &value, const BlackMisc::CIcon &icon = BlackMisc::CIcon(), bool resize = true, bool skipEqualValues = true);
|
||||
bool addOrUpdateByName(const QString &name, const QVariant &value, const BlackMisc::CIcon &icon = BlackMisc::CIcon(), bool performResizing = true, bool skipEqualValues = true);
|
||||
|
||||
//! Remove by name
|
||||
void removeByName(const QString &name, bool resize = true);
|
||||
void removeByName(const QString &name, bool performResizing = true);
|
||||
|
||||
//! Contains name
|
||||
bool containsName(const QString &name);
|
||||
|
||||
@@ -40,6 +40,11 @@ namespace BlackGui
|
||||
{
|
||||
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, &QWidget::customContextMenuRequested, this, &CViewBaseNonTemplate::ps_customMenuRequested);
|
||||
|
||||
// scroll modes
|
||||
this->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
this->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
|
||||
}
|
||||
|
||||
void CViewBaseNonTemplate::customMenu(QMenu &menu) const
|
||||
@@ -82,8 +87,8 @@ namespace BlackGui
|
||||
|
||||
void CViewBaseNonTemplate::initRowsResizeModeToInteractive()
|
||||
{
|
||||
const int h = this->verticalHeader()->minimumSectionSize();
|
||||
this->setRowsResizeModeToInteractive(h);
|
||||
const int height = this->verticalHeader()->minimumSectionSize();
|
||||
this->setRowsResizeModeToInteractive(height);
|
||||
}
|
||||
|
||||
void CViewBaseNonTemplate::setRowsResizeModeToInteractive(int height)
|
||||
@@ -94,8 +99,9 @@ namespace BlackGui
|
||||
verticalHeader->setDefaultSectionSize(height);
|
||||
}
|
||||
|
||||
bool CViewBaseNonTemplate::resize() const
|
||||
bool CViewBaseNonTemplate::performResizing() const
|
||||
{
|
||||
if (m_resizeMode == ResizingOff) { return false; }
|
||||
if (m_resizeMode == ResizingOnce) { return m_resizeCount < 1; }
|
||||
if (m_resizeMode == ResizingAuto)
|
||||
{
|
||||
@@ -103,7 +109,7 @@ namespace BlackGui
|
||||
if (m_resizeAutoNthTime < 2) return true;
|
||||
return (m_resizeCount % m_resizeAutoNthTime) == 0;
|
||||
}
|
||||
return m_resizeMode == ResizingOff;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CViewBaseNonTemplate::fullResizeToContents()
|
||||
@@ -115,7 +121,11 @@ namespace BlackGui
|
||||
m_resizeCount++;
|
||||
this->resizeColumnsToContents();
|
||||
this->resizeRowsToContents();
|
||||
|
||||
if (m_forceStretchLastColumnWhenResized)
|
||||
{
|
||||
// re-stretch
|
||||
this->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
qDebug() << this->objectName() << "resize ms:" << t.elapsed() << QThread::currentThreadId();
|
||||
}
|
||||
|
||||
@@ -158,7 +168,7 @@ namespace BlackGui
|
||||
{
|
||||
ContainerType sortedContainer = model->sortContainerByColumn(container, sortColumn, sortOrder);
|
||||
QMetaObject::invokeMethod(this, "updateContainer",
|
||||
Q_ARG(QVariant, sortedContainer.toQVariant()), Q_ARG(bool, false), Q_ARG(bool, resize));
|
||||
Q_ARG(QVariant, sortedContainer.toQVariant()), Q_ARG(bool, false), Q_ARG(bool, resize));
|
||||
});
|
||||
worker->then(this, &CViewBase::asyncUpdateFinished);
|
||||
return worker;
|
||||
@@ -166,7 +176,7 @@ namespace BlackGui
|
||||
|
||||
template <class ModelClass, class ContainerType> void CViewBase<ModelClass, ContainerType>::updateContainerMaybeAsync(const ContainerType &container, bool sort, bool resize)
|
||||
{
|
||||
if (container.size() > asyncThreshold && sort)
|
||||
if (container.size() > asyncRowsCountThreshold && sort)
|
||||
{
|
||||
// larger container with sorting
|
||||
updateContainerAsync(container, sort, resize);
|
||||
@@ -231,7 +241,7 @@ namespace BlackGui
|
||||
template <class ModelClass, class ContainerType> void CViewBase<ModelClass, ContainerType>::performResizeToContents()
|
||||
{
|
||||
// small set or large set?
|
||||
if (this->resize())
|
||||
if (this->performResizing())
|
||||
{
|
||||
this->fullResizeToContents();
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ namespace BlackGui
|
||||
{
|
||||
ResizingAuto, //!< always resizing, \sa m_resizeAutoNthTime
|
||||
ResizingOnce, //!< only one time
|
||||
ResizingOff
|
||||
ResizingOff //!< never
|
||||
};
|
||||
|
||||
//! When to use asynchronous updates
|
||||
static const int asyncThreshold = 50;
|
||||
//! When (rows count) to use asynchronous updates
|
||||
static const int asyncRowsCountThreshold = 50;
|
||||
|
||||
//! Clear data
|
||||
virtual void clear() = 0;
|
||||
@@ -101,21 +101,22 @@ namespace BlackGui
|
||||
//! \param variant contains the container
|
||||
//! \param sort
|
||||
//! \param resize
|
||||
virtual int performUpdateContainer(const QVariant &variant, bool sort, bool resize) = 0;
|
||||
virtual int performUpdateContainer(const QVariant &variant, bool sort, bool performResizing) = 0;
|
||||
|
||||
//! Skip resizing because of size?
|
||||
virtual bool reachedResizeThreshold() const = 0;
|
||||
|
||||
//! Resize or skip resize?
|
||||
virtual bool resize() const;
|
||||
virtual bool performResizing() const;
|
||||
|
||||
//! Init default values
|
||||
virtual void standardInit();
|
||||
|
||||
ResizeMode m_resizeMode = ResizingAuto; //!< mode
|
||||
int m_resizeCount = 0; //!< flag / counter,how many resize activities
|
||||
int m_skipResizeThreshold = 40; //!< when to skip resize
|
||||
int m_resizeCount = 0; //!< flag / counter, how many resize activities
|
||||
int m_skipResizeThreshold = 40; //!< when to skip resize (rows count)
|
||||
int m_resizeAutoNthTime = 1; //!< with ResizeAuto, resize every n-th time
|
||||
bool m_forceStretchLastColumnWhenResized = false; //! a small table might (few columns) might to fail stretching, force again
|
||||
|
||||
protected slots:
|
||||
//! Helper method with template free signature serving as callback from threaded worker
|
||||
@@ -153,13 +154,13 @@ namespace BlackGui
|
||||
virtual void clear() override { Q_ASSERT(this->m_model); this->m_model->clear(); }
|
||||
|
||||
//! Update whole container
|
||||
int updateContainer(const ContainerType &container, bool sort = true, bool resize = true);
|
||||
int updateContainer(const ContainerType &container, bool sort = true, bool performResizing = true);
|
||||
|
||||
//! Update whole container in background
|
||||
BlackMisc::CWorker *updateContainerAsync(const ContainerType &container, bool sort = true, bool resize = true);
|
||||
BlackMisc::CWorker *updateContainerAsync(const ContainerType &container, bool sort = true, bool performResizing = true);
|
||||
|
||||
//! Based on size call sync / async update
|
||||
void updateContainerMaybeAsync(const ContainerType &container, bool sort = true, bool resize = true);
|
||||
void updateContainerMaybeAsync(const ContainerType &container, bool sort = true, bool performResizing = true);
|
||||
|
||||
//! Insert
|
||||
template<class ObjectType> void insert(const ObjectType &value, bool resize = true)
|
||||
@@ -211,7 +212,7 @@ namespace BlackGui
|
||||
virtual void performResizeToContents() override;
|
||||
|
||||
//! \copydoc CViewBaseNonTemplate::performUpdateContainer
|
||||
virtual int performUpdateContainer(const QVariant &variant, bool sort, bool resize) override;
|
||||
virtual int performUpdateContainer(const QVariant &variant, bool sort, bool performResizing) override;
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace BlackMisc
|
||||
*/
|
||||
CIcon CAltitude::toIcon() const
|
||||
{
|
||||
return BlackMisc::CIconList::iconForIndex(CIcons::GeoPosition);
|
||||
return BlackMisc::CIconList::iconByIndex(CIcons::GeoPosition);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -38,23 +38,23 @@ namespace BlackMisc
|
||||
const CIcon &CCallsign::convertToIcon(const CCallsign &callsign)
|
||||
{
|
||||
QString t = callsign.asString().toUpper();
|
||||
if (t.length() < 3) return CIconList::iconForIndex(CIcons::NetworkRoleUnknown);
|
||||
if (t.length() < 3) return CIconList::iconByIndex(CIcons::NetworkRoleUnknown);
|
||||
t = t.right(3);
|
||||
|
||||
if (callsign.getStringAsSet().contains("_"))
|
||||
{
|
||||
if ("APP" == t) return CIconList::iconForIndex(CIcons::NetworkRoleApproach);
|
||||
if ("GND" == t) return CIconList::iconForIndex(CIcons::NetworkRoleGround);
|
||||
if ("TWR" == t) return CIconList::iconForIndex(CIcons::NetworkRoleTower);
|
||||
if ("DEL" == t) return CIconList::iconForIndex(CIcons::NetworkRoleDelivery);
|
||||
if ("CTR" == t) return CIconList::iconForIndex(CIcons::NetworkRoleCenter);
|
||||
if ("SUP" == t) return CIconList::iconForIndex(CIcons::NetworkRoleSup);
|
||||
if ("OBS" == t) return CIconList::iconForIndex(CIcons::NetworkRoleApproach);
|
||||
return CIconList::iconForIndex(CIcons::NetworkRoleUnknown);
|
||||
if ("APP" == t) return CIconList::iconByIndex(CIcons::NetworkRoleApproach);
|
||||
if ("GND" == t) return CIconList::iconByIndex(CIcons::NetworkRoleGround);
|
||||
if ("TWR" == t) return CIconList::iconByIndex(CIcons::NetworkRoleTower);
|
||||
if ("DEL" == t) return CIconList::iconByIndex(CIcons::NetworkRoleDelivery);
|
||||
if ("CTR" == t) return CIconList::iconByIndex(CIcons::NetworkRoleCenter);
|
||||
if ("SUP" == t) return CIconList::iconByIndex(CIcons::NetworkRoleSup);
|
||||
if ("OBS" == t) return CIconList::iconByIndex(CIcons::NetworkRoleApproach);
|
||||
return CIconList::iconByIndex(CIcons::NetworkRoleUnknown);
|
||||
}
|
||||
else
|
||||
{
|
||||
return CIconList::iconForIndex(CIcons::NetworkRolePilot);
|
||||
return CIconList::iconByIndex(CIcons::NetworkRolePilot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BlackMisc
|
||||
bool equalsString(const QString &callsignString) const;
|
||||
|
||||
//! \copydoc CValueObject::toIcon()
|
||||
virtual BlackMisc::CIcon toIcon() const override { return CCallsign::convertToIcon(*this); }
|
||||
virtual BlackMisc::CIcon toIcon() const override { return convertToIcon(*this); }
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackMisc
|
||||
|
||||
BlackMisc::CIcon CFlightPlan::toIcon() const
|
||||
{
|
||||
return BlackMisc::CIconList::iconForIndex(CIcons::StandardIconAppFlightPlan16);
|
||||
return BlackMisc::CIconList::iconByIndex(CIcons::StandardIconAppFlightPlan16);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace BlackMisc
|
||||
CSelcal(const char *code) : m_code(code) {}
|
||||
|
||||
//! Is valid?
|
||||
bool isValid() const { return CSelcal::isValidCode(this->m_code); }
|
||||
bool isValid() const { return isValidCode(this->m_code); }
|
||||
|
||||
//! Get SELCAL code
|
||||
const QString &getCode() const { return this->m_code; }
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BlackMisc
|
||||
*/
|
||||
template <class LATorLON> CIcon CEarthAngle<LATorLON>::toIcon() const
|
||||
{
|
||||
return BlackMisc::CIconList::iconForIndex(CIcons::GeoPosition);
|
||||
return BlackMisc::CIconList::iconByIndex(CIcons::GeoPosition);
|
||||
}
|
||||
|
||||
// see here for the reason of thess forward instantiations
|
||||
|
||||
@@ -35,6 +35,17 @@ namespace BlackMisc
|
||||
static const CIconList icons(
|
||||
{
|
||||
// keep indexes alphabetically sorted and in sync with CIcons
|
||||
CIcon(CIcons::ApplicationIconAircrafts, "aircrafts"),
|
||||
CIcon(CIcons::ApplicationIconAtc, "ATC"),
|
||||
CIcon(CIcons::ApplicationIconAudio, "audio"),
|
||||
CIcon(CIcons::ApplicationIconCockpit, "cockpit"),
|
||||
CIcon(CIcons::ApplicationIconFlightPlan, "flightplan"),
|
||||
CIcon(CIcons::ApplicationIconLog, "log"),
|
||||
CIcon(CIcons::ApplicationIconMappings, "mappings"),
|
||||
CIcon(CIcons::ApplicationIconSettings, "settings"),
|
||||
CIcon(CIcons::ApplicationIconSimulator, "simulator"),
|
||||
CIcon(CIcons::ApplicationIconTextMessages, "text messages"),
|
||||
CIcon(CIcons::ApplicationIconWeather, "weather"),
|
||||
CIcon(CIcons::AviationAtis, "ATIS"),
|
||||
CIcon(CIcons::AviationAttitudeIndicator, "attitude indicator"),
|
||||
CIcon(CIcons::AviationMetar, "METAR"),
|
||||
@@ -133,12 +144,12 @@ namespace BlackMisc
|
||||
return icons;
|
||||
}
|
||||
|
||||
const CIcon &CIconList::iconForIndex(CIcons::IconIndex index)
|
||||
const CIcon &CIconList::iconByIndex(CIcons::IconIndex index)
|
||||
{
|
||||
return iconForIndex(static_cast<int>(index));
|
||||
return iconByIndex(static_cast<int>(index));
|
||||
}
|
||||
|
||||
const CIcon &CIconList::iconForIndex(int index)
|
||||
const CIcon &CIconList::iconByIndex(int index)
|
||||
{
|
||||
// changed to index / at based approach during #322 (after Sleepy profiling)
|
||||
// this seems to be faster as the findBy approach previously used, but required synced indexes
|
||||
|
||||
@@ -46,10 +46,10 @@ namespace BlackMisc
|
||||
static const CIconList &allIcons();
|
||||
|
||||
//! Icon for given index
|
||||
static const CIcon &iconForIndex(CIcons::IconIndex index);
|
||||
static const CIcon &iconByIndex(CIcons::IconIndex index);
|
||||
|
||||
//! Icon for given index
|
||||
static const CIcon &iconForIndex(int index);
|
||||
static const CIcon &iconByIndex(int index);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,6 +30,17 @@ namespace BlackMisc
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case ApplicationIconAircrafts: return appAircrafts16();
|
||||
case ApplicationIconAtc: return appAtc16();
|
||||
case ApplicationIconAudio: return appAudio16();
|
||||
case ApplicationIconCockpit: return appCockpit16();
|
||||
case ApplicationIconFlightPlan: return appFlightPlan16();
|
||||
case ApplicationIconLog: return appLog16();
|
||||
case ApplicationIconMappings: return appMappings16();
|
||||
case ApplicationIconSettings: return appSettings16();
|
||||
case ApplicationIconSimulator: return appSimulator16();
|
||||
case ApplicationIconTextMessages: return appTextMessages16();
|
||||
case ApplicationIconWeather: return appWeather16();
|
||||
case AviationAtis: return atis();
|
||||
case AviationAttitudeIndicator: return attitudeIndicator16();
|
||||
case AviationMetar: return metar();
|
||||
@@ -93,6 +104,7 @@ namespace BlackMisc
|
||||
case StandardIconPaperPlane16: return paperPlane16();
|
||||
case StandardIconPlugin16: return plugin16();
|
||||
case StandardIconRadar16: return radar16();
|
||||
case StandardIconRadio16: return radio16();
|
||||
case StandardIconRefresh16: return refresh16();
|
||||
case StandardIconResize16: return resize16();
|
||||
case StandardIconResizeHorizontal16: return resizeHorizontal16();
|
||||
|
||||
@@ -28,6 +28,17 @@ namespace BlackMisc
|
||||
enum IconIndex
|
||||
{
|
||||
// !! keep indexes alphabetically sorted and in sync with CIconList
|
||||
ApplicationIconAircrafts,
|
||||
ApplicationIconAtc,
|
||||
ApplicationIconAudio,
|
||||
ApplicationIconCockpit,
|
||||
ApplicationIconFlightPlan,
|
||||
ApplicationIconLog,
|
||||
ApplicationIconMappings,
|
||||
ApplicationIconSettings,
|
||||
ApplicationIconSimulator,
|
||||
ApplicationIconTextMessages,
|
||||
ApplicationIconWeather,
|
||||
AviationAttitudeIndicator,
|
||||
AviationAtis,
|
||||
AviationMetar,
|
||||
@@ -751,13 +762,13 @@ namespace BlackMisc
|
||||
//! Text only
|
||||
static const QPixmap &capabilityTextOnly()
|
||||
{
|
||||
return CIcons::appTextMessages16();
|
||||
return appTextMessages16();
|
||||
}
|
||||
|
||||
//! Text only
|
||||
static const QPixmap &capabilityUnknown()
|
||||
{
|
||||
return CIcons::unknown16();
|
||||
return unknown16();
|
||||
}
|
||||
|
||||
//! Attitude indicator
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace BlackMisc
|
||||
if (static_cast<QMetaType::Type>(variant.type()) == QMetaType::Int)
|
||||
{
|
||||
CIcons::IconIndex index = static_cast<CIcons::IconIndex>(variant.toInt());
|
||||
this->m_icon = CIconList::iconForIndex(index);
|
||||
this->m_icon = CIconList::iconByIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -100,18 +100,18 @@ namespace BlackMisc
|
||||
switch (this->m_voiceCapabilities)
|
||||
{
|
||||
case Voice:
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityVoiceBackground);
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityVoiceBackground);
|
||||
case TextOnly:
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityTextOnly);
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityTextOnly);
|
||||
case Unknown:
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityUnknown);
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityUnknown);
|
||||
case VoiceReceivingOnly:
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityVoiceReceiveOnlyBackground);
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityVoiceReceiveOnlyBackground);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityUnknown); // never reached
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityUnknown); // never reached
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace BlackMisc
|
||||
{
|
||||
BlackMisc::CIcon CAngle::toIcon() const
|
||||
{
|
||||
BlackMisc::CIcon i = CIconList::iconForIndex(CIcons::StandardIconArrowMediumNorth16);
|
||||
BlackMisc::CIcon i = CIconList::iconByIndex(CIcons::StandardIconArrowMediumNorth16);
|
||||
i.setRotation(*this);
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -132,11 +132,11 @@ namespace BlackMisc
|
||||
{
|
||||
switch (statusMessage.getSeverity())
|
||||
{
|
||||
case SeverityDebug: return CIconList::iconForIndex(CIcons::StandardIconUnknown16); // TODO
|
||||
case SeverityInfo: return CIconList::iconForIndex(CIcons::StandardIconInfo16);
|
||||
case SeverityWarning: return CIconList::iconForIndex(CIcons::StandardIconWarning16);
|
||||
case SeverityError: return CIconList::iconForIndex(CIcons::StandardIconError16);
|
||||
default: return CIconList::iconForIndex(CIcons::StandardIconInfo16);
|
||||
case SeverityDebug: return CIconList::iconByIndex(CIcons::StandardIconUnknown16); // TODO
|
||||
case SeverityInfo: return CIconList::iconByIndex(CIcons::StandardIconInfo16);
|
||||
case SeverityWarning: return CIconList::iconByIndex(CIcons::StandardIconWarning16);
|
||||
case SeverityError: return CIconList::iconByIndex(CIcons::StandardIconError16);
|
||||
default: return CIconList::iconByIndex(CIcons::StandardIconInfo16);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace BlackMisc
|
||||
void setSeverity(StatusSeverity severity) { this->m_severity = severity; }
|
||||
|
||||
//! Representing icon
|
||||
virtual CIcon toIcon() const override { return CStatusMessage::convertToIcon(*this); }
|
||||
virtual CIcon toIcon() const override { return convertToIcon(*this); }
|
||||
|
||||
//! Severity as string
|
||||
const QString &getSeverityAsString() const;
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace BlackMisc
|
||||
*/
|
||||
CIcon CValueObject::toIcon() const
|
||||
{
|
||||
return CIconList::iconForIndex(CIcons::StandardIconUnknown16);
|
||||
return CIconList::iconByIndex(CIcons::StandardIconUnknown16);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user