From 98330cf2552da4e2ab69db352dc79c10fd92a87e Mon Sep 17 00:00:00 2001 From: Marcus Birkin Date: Wed, 15 Aug 2018 16:27:22 +0100 Subject: [PATCH] Clean up some compiler warnings C vs C++ coding style --- src/preferences.cpp | 4 ++-- src/preferencesdialog.cpp | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/preferences.cpp b/src/preferences.cpp index 4fecf5d5..984c66b5 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -24,13 +24,13 @@ // The base color to generate pastel shades for sources static const QColor mixColor = QColor("coral"); -Preferences *Preferences::m_instance = NULL; +Preferences *Preferences::m_instance = Q_NULLPTR; Preferences::Preferences() { RESTART_APP = false; for(int i=0; icbTheme->clear(); ui->cbTheme->addItems(Preferences::ThemeDescriptions()); - ui->cbTheme->setCurrentIndex((int)Preferences::getInstance()->GetTheme()); + ui->cbTheme->setCurrentIndex(static_cast(Preferences::getInstance()->GetTheme())); } PreferencesDialog::~PreferencesDialog() @@ -109,14 +109,12 @@ void PreferencesDialog::on_buttonBox_accepted() Preferences *p = Preferences::getInstance(); // Display Format - int displayFormat=0; if(ui->DecimalDisplayFormat->isChecked()) - displayFormat = Preferences::DECIMAL; + p->SetDisplayFormat(Preferences::DECIMAL); if(ui->HexDisplayFormat->isChecked()) - displayFormat = Preferences::HEXADECIMAL; + p->SetDisplayFormat(Preferences::HEXADECIMAL); if(ui->PercentDisplayFormat->isChecked()) - displayFormat = Preferences::PERCENT; - p->SetDisplayFormat(displayFormat); + p->SetDisplayFormat(Preferences::PERCENT); // Display Blind p->SetBlindVisualizer(ui->cbDisplayBlind->isChecked()); @@ -161,7 +159,7 @@ void PreferencesDialog::on_buttonBox_accepted() p->SetNetworkListenAll(ui->cbListenAll->isChecked()); // Theme - Preferences::Theme theme = (Preferences::Theme)ui->cbTheme->currentIndex(); + Preferences::Theme theme = static_cast(ui->cbTheme->currentIndex()); if(p->GetTheme()!=theme) { p->SetTheme(theme);