From 464c17085cd95a5c8236442f1f9f20ce19aa3676 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 30 Apr 2014 01:02:36 +0200 Subject: [PATCH] refs #212, MS review, https://dev.vatsim-germany.org/issues/212#note-6 --- samples/blackgui/mainwindow_menus.cpp | 4 ++-- src/blackgui/userlistmodel.h | 2 +- src/blackgui/viewbase.h | 2 +- src/blackmisc/avaltitude.cpp | 16 +++++++--------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/samples/blackgui/mainwindow_menus.cpp b/samples/blackgui/mainwindow_menus.cpp index 9314b2ea7..f9dd38dad 100644 --- a/samples/blackgui/mainwindow_menus.cpp +++ b/samples/blackgui/mainwindow_menus.cpp @@ -85,8 +85,8 @@ void MainWindow::audioIconContextMenu(const QPoint &position) this->m_contextMenuAudio->addAction("Toogle mute"); #if defined(Q_OS_WIN) - // #if defined required? seems to be redundant - if (QSysInfo::WindowsVersion && QSysInfo::WV_NT_based) + // QSysInfo::WindowsVersion only available on Win platforms + if (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) { this->m_contextMenuAudio->addAction("Mixer"); } diff --git a/src/blackgui/userlistmodel.h b/src/blackgui/userlistmodel.h index 7df38adbe..e349c1c9e 100644 --- a/src/blackgui/userlistmodel.h +++ b/src/blackgui/userlistmodel.h @@ -25,7 +25,7 @@ namespace BlackGui }; //! \brief Constructor - CUserListModel(UserMode userMode, QObject *parent = nullptr); + explicit CUserListModel(UserMode userMode, QObject *parent = nullptr); //! \brief Destructor virtual ~CUserListModel() {} diff --git a/src/blackgui/viewbase.h b/src/blackgui/viewbase.h index a969a8267..69e656ded 100644 --- a/src/blackgui/viewbase.h +++ b/src/blackgui/viewbase.h @@ -19,7 +19,7 @@ namespace BlackGui protected: //! Constructor - CViewBase(QWidget *parent) : QTableView(parent) + CViewBase(QWidget *parent, ModelClass *model = nullptr) : QTableView(parent), m_model(model) { this->setSortingEnabled(true); this->horizontalHeader()->setStretchLastSection(true); diff --git a/src/blackmisc/avaltitude.cpp b/src/blackmisc/avaltitude.cpp index 0c3151180..78673b189 100644 --- a/src/blackmisc/avaltitude.cpp +++ b/src/blackmisc/avaltitude.cpp @@ -163,31 +163,29 @@ namespace BlackMisc if (v.contains("FL", Qt::CaseInsensitive)) { v = v.replace("FL", "", Qt::CaseInsensitive).trimmed(); - this->m_datum = FlightLevel; bool ok = false; double dv = v.toDouble(&ok) * 100.0; - CLength l(ok ? dv : 0.0, - ok ? CLengthUnit::ft() : CLengthUnit::nullUnit()); - this->set(l); + CAltitude a(ok ? dv : 0.0, FlightLevel, + ok ? CLengthUnit::ft() : CLengthUnit::nullUnit()); + *this = a; return; } // normal altitude, AGL/MSL + ReferenceDatum rd = MeanSeaLevel; if (v.contains("MSL", Qt::CaseInsensitive)) { v = v.replace("MSL", "", Qt::CaseInsensitive).trimmed(); - this->m_datum = MeanSeaLevel; + rd = MeanSeaLevel; } else if (v.contains("AGL")) { v = v.replace("AGL", "", Qt::CaseInsensitive).trimmed(); - this->m_datum = AboveGround; + rd = AboveGround; } - else - this->m_datum = MeanSeaLevel; CLength l = BlackMisc::PhysicalQuantities::CPqString::parse(v); - this->set(l); + *this = CAltitude(l, rd); } /*