Clang-Tidy and Clazy fixes

This commit is contained in:
Jonas Kvinge
2021-06-20 19:04:08 +02:00
parent 755abec636
commit 1295033fae
374 changed files with 1304 additions and 900 deletions

View File

@@ -87,8 +87,8 @@ const char *AppearanceSettingsPage::kIconSizeConfigureButtons = "icon_size_confi
const char *AppearanceSettingsPage::kPlaylistPlayingSongColor = "playlist_playing_song_color";
AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog)
: SettingsPage(dialog),
AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent),
ui_(new Ui_AppearanceSettingsPage),
original_use_a_custom_color_set_(false),
background_image_type_(BackgroundImageType_Default) {

View File

@@ -39,7 +39,7 @@ class AppearanceSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit AppearanceSettingsPage(SettingsDialog *dialog);
explicit AppearanceSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~AppearanceSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -64,8 +64,8 @@ const qint64 BackendSettingsPage::kDefaultBufferDuration = 4000;
const double BackendSettingsPage::kDefaultBufferLowWatermark = 0.33;
const double BackendSettingsPage::kDefaultBufferHighWatermark = 0.99;
BackendSettingsPage::BackendSettingsPage(SettingsDialog *dialog) :
SettingsPage(dialog),
BackendSettingsPage::BackendSettingsPage(SettingsDialog *dialog, QWidget *parent) :
SettingsPage(dialog, parent),
ui_(new Ui_BackendSettingsPage),
configloaded_(false),
engineloaded_(false) {
@@ -216,9 +216,9 @@ void BackendSettingsPage::Load() {
output_name = output.name;
}
QVariant device_value;
if (ui_->combobox_device->currentText().isEmpty()) device_value = QVariant();
else if (ui_->combobox_device->currentText() == kOutputCustom) device_value = ui_->lineedit_device->text();
else device_value = ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()).value<QVariant>();
if (ui_->combobox_device->currentText().isEmpty()) device_value = QVariant(); // clazy:exclude=qt6-deprecated-api-fixes
else if (ui_->combobox_device->currentText() == kOutputCustom) device_value = ui_->lineedit_device->text(); // clazy:exclude=qt6-deprecated-api-fixes
else device_value = ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()).value<QVariant>(); // clazy:exclude=qt6-deprecated-api-fixes
if (enginetype_current_ != enginetype || output_name != output_current_ || device_value != device_current_) {
set_changed();
@@ -295,7 +295,7 @@ void BackendSettingsPage::Load_Output(QString output, QVariant device) {
}
if (!found) { // Output is invalid for this engine, reset to default output.
output = engine()->DefaultOutput();
device = (engine()->CustomDeviceSupport(output) ? QString() : QVariant());
device = (engine()->CustomDeviceSupport(output) ? QString() : QVariant()); // clazy:exclude=qt6-deprecated-api-fixes
for (int i = 0; i < ui_->combobox_output->count(); ++i) {
EngineBase::OutputDetails o = ui_->combobox_output->itemData(i).value<EngineBase::OutputDetails>();
if (o.name == output) {
@@ -444,9 +444,9 @@ void BackendSettingsPage::Save() {
output_name = output.name;
}
if (ui_->combobox_device->currentText().isEmpty()) device_value = QVariant();
else if (ui_->combobox_device->currentText() == kOutputCustom) device_value = ui_->lineedit_device->text();
else device_value = ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()).value<QVariant>();
if (ui_->combobox_device->currentText().isEmpty()) device_value = QVariant(); // clazy:exclude=qt6-deprecated-api-fixes
else if (ui_->combobox_device->currentText() == kOutputCustom) device_value = ui_->lineedit_device->text(); // clazy:exclude=qt6-deprecated-api-fixes
else device_value = ui_->combobox_device->itemData(ui_->combobox_device->currentIndex()).value<QVariant>(); // clazy:exclude=qt6-deprecated-api-fixes
QSettings s;
s.beginGroup(kSettingsGroup);

View File

@@ -41,7 +41,7 @@ class BackendSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit BackendSettingsPage(SettingsDialog *dialog);
explicit BackendSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~BackendSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -58,7 +58,7 @@ bool LocaleAwareCompare(const QString &a, const QString &b) {
} // namespace
#endif
BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_BehaviourSettingsPage), systemtray_available_(false) {
BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog *dialog, QWidget *parent) : SettingsPage(dialog, parent), ui_(new Ui_BehaviourSettingsPage), systemtray_available_(false) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("strawberry"));

View File

@@ -37,7 +37,7 @@ class BehaviourSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit BehaviourSettingsPage(SettingsDialog *dialog);
explicit BehaviourSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~BehaviourSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -61,8 +61,8 @@ const char *CollectionSettingsPage::kSettingsDiskCacheSizeUnit = "disk_cache_siz
const int CollectionSettingsPage::kSettingsCacheSizeDefault = 160;
const int CollectionSettingsPage::kSettingsDiskCacheSizeDefault = 360;
CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog)
: SettingsPage(dialog),
CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent),
ui_(new Ui_CollectionSettingsPage),
initialized_model_(false)
{

View File

@@ -38,7 +38,7 @@ class CollectionSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit CollectionSettingsPage(SettingsDialog *dialog);
explicit CollectionSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~CollectionSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -60,7 +60,7 @@ const char *ContextSettingsPage::kSettingsGroupEnable[ContextSettingsOrder::NELE
const qreal ContextSettingsPage::kDefaultFontSizeHeadline = 11;
ContextSettingsPage::ContextSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_ContextSettingsPage) {
ContextSettingsPage::ContextSettingsPage(SettingsDialog *dialog, QWidget *parent) : SettingsPage(dialog, parent), ui_(new Ui_ContextSettingsPage) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("view-choose"));

View File

@@ -39,7 +39,7 @@ class ContextSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit ContextSettingsPage(SettingsDialog *dialog);
explicit ContextSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~ContextSettingsPage() override;
enum ContextSettingsOrder {

View File

@@ -46,7 +46,7 @@
const char *CoversSettingsPage::kSettingsGroup = "Covers";
CoversSettingsPage::CoversSettingsPage(SettingsDialog *parent) : SettingsPage(parent), ui_(new Ui::CoversSettingsPage), provider_selected_(false) {
CoversSettingsPage::CoversSettingsPage(SettingsDialog *dialog, QWidget *parent) : SettingsPage(dialog, parent), ui_(new Ui::CoversSettingsPage), provider_selected_(false) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("cdcase"));
@@ -65,7 +65,7 @@ CoversSettingsPage::CoversSettingsPage(SettingsDialog *parent) : SettingsPage(pa
NoProviderSelected();
DisableAuthentication();
dialog()->installEventFilter(this);
dialog->installEventFilter(this);
}
@@ -96,7 +96,7 @@ void CoversSettingsPage::Save() {
QStringList providers;
for (int i = 0 ; i < ui_->providers->count() ; ++i) {
const QListWidgetItem *item = ui_->providers->item(i);
if (item->checkState() == Qt::Checked) providers << item->text();
if (item->checkState() == Qt::Checked) providers << item->text(); // clazy:exclude=reserve-candidates
}
QSettings s;

View File

@@ -38,7 +38,7 @@ class CoversSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit CoversSettingsPage(SettingsDialog *parent = nullptr);
explicit CoversSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~CoversSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -54,8 +54,8 @@
const char *GlobalShortcutsSettingsPage::kSettingsGroup = "GlobalShortcuts";
GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog)
: SettingsPage(dialog),
GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent),
ui_(new Ui_GlobalShortcutsSettingsPage),
initialized_(false),
grabber_(new GlobalShortcutGrabber) {

View File

@@ -44,7 +44,7 @@ class GlobalShortcutsSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit GlobalShortcutsSettingsPage(SettingsDialog *dialog);
explicit GlobalShortcutsSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~GlobalShortcutsSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -46,7 +46,7 @@
const char *LyricsSettingsPage::kSettingsGroup = "Lyrics";
LyricsSettingsPage::LyricsSettingsPage(SettingsDialog *parent) : SettingsPage(parent), ui_(new Ui::LyricsSettingsPage), provider_selected_(false) {
LyricsSettingsPage::LyricsSettingsPage(SettingsDialog *dialog, QWidget *parent) : SettingsPage(dialog, parent), ui_(new Ui::LyricsSettingsPage), provider_selected_(false) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("view-media-lyrics"));
@@ -65,7 +65,7 @@ LyricsSettingsPage::LyricsSettingsPage(SettingsDialog *parent) : SettingsPage(pa
NoProviderSelected();
DisableAuthentication();
dialog()->installEventFilter(this);
dialog->installEventFilter(this);
}
@@ -96,7 +96,7 @@ void LyricsSettingsPage::Save() {
QStringList providers;
for (int i = 0 ; i < ui_->providers->count() ; ++i) {
const QListWidgetItem *item = ui_->providers->item(i);
if (item->checkState() == Qt::Checked) providers << item->text();
if (item->checkState() == Qt::Checked) providers << item->text(); // clazy:exclude=reserve-candidates
}
QSettings s;

View File

@@ -38,7 +38,7 @@ class LyricsSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit LyricsSettingsPage(SettingsDialog *parent = nullptr);
explicit LyricsSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~LyricsSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -49,8 +49,8 @@ const char *MoodbarSettingsPage::kSettingsGroup = "Moodbar";
const int MoodbarSettingsPage::kMoodbarPreviewWidth = 150;
const int MoodbarSettingsPage::kMoodbarPreviewHeight = 18;
MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog *dialog)
: SettingsPage(dialog),
MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent),
ui_(new Ui_MoodbarSettingsPage),
initialized_(false)
{

View File

@@ -34,7 +34,7 @@ class MoodbarSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit MoodbarSettingsPage(SettingsDialog *dialog);
explicit MoodbarSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~MoodbarSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -40,11 +40,12 @@ class SettingsDialog;
const char *NetworkProxySettingsPage::kSettingsGroup = "NetworkProxy";
NetworkProxySettingsPage::NetworkProxySettingsPage(SettingsDialog *dialog)
: SettingsPage(dialog), ui_(new Ui_NetworkProxySettingsPage) {
NetworkProxySettingsPage::NetworkProxySettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent), ui_(new Ui_NetworkProxySettingsPage) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("applications-internet"));
}
NetworkProxySettingsPage::~NetworkProxySettingsPage() { delete ui_; }

View File

@@ -36,7 +36,7 @@ class NetworkProxySettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit NetworkProxySettingsPage(SettingsDialog *dialog);
explicit NetworkProxySettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~NetworkProxySettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -57,8 +57,8 @@
class QHideEvent;
class QShowEvent;
NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog *dialog)
: SettingsPage(dialog), ui_(new Ui_NotificationsSettingsPage), pretty_popup_(new OSDPretty(OSDPretty::Mode_Draggable)) {
NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent), ui_(new Ui_NotificationsSettingsPage), pretty_popup_(new OSDPretty(OSDPretty::Mode_Draggable)) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("help-hint"));

View File

@@ -41,7 +41,7 @@ class NotificationsSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit NotificationsSettingsPage(SettingsDialog *dialog);
explicit NotificationsSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~NotificationsSettingsPage() override;
void Load() override;

View File

@@ -36,7 +36,7 @@ class SettingsDialog;
const char *PlaylistSettingsPage::kSettingsGroup = "Playlist";
PlaylistSettingsPage::PlaylistSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_PlaylistSettingsPage) {
PlaylistSettingsPage::PlaylistSettingsPage(SettingsDialog *dialog, QWidget *parent) : SettingsPage(dialog, parent), ui_(new Ui_PlaylistSettingsPage) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("document-new"));

View File

@@ -36,7 +36,7 @@ class PlaylistSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit PlaylistSettingsPage(SettingsDialog *dialog);
explicit PlaylistSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~PlaylistSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -43,10 +43,10 @@
const char *QobuzSettingsPage::kSettingsGroup = "Qobuz";
QobuzSettingsPage::QobuzSettingsPage(SettingsDialog *parent)
: SettingsPage(parent),
QobuzSettingsPage::QobuzSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent),
ui_(new Ui::QobuzSettingsPage),
service_(dialog()->app()->internet_services()->Service<QobuzService>()) {
service_(dialog->app()->internet_services()->Service<QobuzService>()) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("qobuz"));
@@ -59,7 +59,7 @@ QobuzSettingsPage::QobuzSettingsPage(SettingsDialog *parent)
QObject::connect(service_, &InternetService::LoginFailure, this, &QobuzSettingsPage::LoginFailure);
QObject::connect(service_, &InternetService::LoginSuccess, this, &QobuzSettingsPage::LoginSuccess);
dialog()->installEventFilter(this);
dialog->installEventFilter(this);
ui_->format->addItem("MP3 320", 5);
ui_->format->addItem("FLAC Lossless", 6);
@@ -149,7 +149,6 @@ bool QobuzSettingsPage::eventFilter(QObject *object, QEvent *event) {
if (object == dialog() && event->type() == QEvent::Enter) {
ui_->button_login->setEnabled(true);
return false;
}
return SettingsPage::eventFilter(object, event);
@@ -168,7 +167,7 @@ void QobuzSettingsPage::LoginSuccess() {
ui_->button_login->setEnabled(true);
}
void QobuzSettingsPage::LoginFailure(QString failure_reason) {
void QobuzSettingsPage::LoginFailure(const QString &failure_reason) {
if (!this->isVisible()) return;
QMessageBox::warning(this, tr("Authentication failed"), failure_reason);
}

View File

@@ -34,7 +34,7 @@ class QobuzSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit QobuzSettingsPage(SettingsDialog *parent = nullptr);
explicit QobuzSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~QobuzSettingsPage() override;
static const char *kSettingsGroup;
@@ -51,7 +51,7 @@ class QobuzSettingsPage : public SettingsPage {
void LoginClicked();
void LogoutClicked();
void LoginSuccess();
void LoginFailure(QString failure_reason);
void LoginFailure(const QString &failure_reason);
private:
Ui_QobuzSettingsPage *ui_;

View File

@@ -43,12 +43,12 @@
const char *ScrobblerSettingsPage::kSettingsGroup = "Scrobbler";
ScrobblerSettingsPage::ScrobblerSettingsPage(SettingsDialog *parent)
: SettingsPage(parent),
scrobbler_(dialog()->app()->scrobbler()),
lastfmscrobbler_(dialog()->app()->scrobbler()->Service<LastFMScrobbler>()),
librefmscrobbler_(dialog()->app()->scrobbler()->Service<LibreFMScrobbler>()),
listenbrainzscrobbler_(dialog()->app()->scrobbler()->Service<ListenBrainzScrobbler>()),
ScrobblerSettingsPage::ScrobblerSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent),
scrobbler_(dialog->app()->scrobbler()),
lastfmscrobbler_(dialog->app()->scrobbler()->Service<LastFMScrobbler>()),
librefmscrobbler_(dialog->app()->scrobbler()->Service<LibreFMScrobbler>()),
listenbrainzscrobbler_(dialog->app()->scrobbler()->Service<ListenBrainzScrobbler>()),
ui_(new Ui_ScrobblerSettingsPage),
lastfm_waiting_for_auth_(false),
librefm_waiting_for_auth_(false),
@@ -188,7 +188,7 @@ void ScrobblerSettingsPage::LastFM_Logout() {
}
void ScrobblerSettingsPage::LastFM_AuthenticationComplete(const bool success, QString error) {
void ScrobblerSettingsPage::LastFM_AuthenticationComplete(const bool success, const QString &error) {
if (!lastfm_waiting_for_auth_) return;
lastfm_waiting_for_auth_ = false;
@@ -204,7 +204,7 @@ void ScrobblerSettingsPage::LastFM_AuthenticationComplete(const bool success, QS
}
void ScrobblerSettingsPage::LastFM_RefreshControls(bool authenticated) {
void ScrobblerSettingsPage::LastFM_RefreshControls(const bool authenticated) {
ui_->widget_lastfm_login_state->SetLoggedIn(authenticated ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut, lastfmscrobbler_->username());
}
@@ -223,7 +223,7 @@ void ScrobblerSettingsPage::LibreFM_Logout() {
}
void ScrobblerSettingsPage::LibreFM_AuthenticationComplete(const bool success, QString error) {
void ScrobblerSettingsPage::LibreFM_AuthenticationComplete(const bool success, const QString &error) {
if (!librefm_waiting_for_auth_) return;
librefm_waiting_for_auth_ = false;
@@ -239,7 +239,7 @@ void ScrobblerSettingsPage::LibreFM_AuthenticationComplete(const bool success, Q
}
void ScrobblerSettingsPage::LibreFM_RefreshControls(bool authenticated) {
void ScrobblerSettingsPage::LibreFM_RefreshControls(const bool authenticated) {
ui_->widget_librefm_login_state->SetLoggedIn(authenticated ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut, librefmscrobbler_->username());
}
@@ -258,7 +258,7 @@ void ScrobblerSettingsPage::ListenBrainz_Logout() {
}
void ScrobblerSettingsPage::ListenBrainz_AuthenticationComplete(const bool success, QString error) {
void ScrobblerSettingsPage::ListenBrainz_AuthenticationComplete(const bool success, const QString &error) {
if (!listenbrainz_waiting_for_auth_) return;
listenbrainz_waiting_for_auth_ = false;
@@ -274,6 +274,6 @@ void ScrobblerSettingsPage::ListenBrainz_AuthenticationComplete(const bool succe
}
void ScrobblerSettingsPage::ListenBrainz_RefreshControls(bool authenticated) {
void ScrobblerSettingsPage::ListenBrainz_RefreshControls(const bool authenticated) {
ui_->widget_listenbrainz_login_state->SetLoggedIn(authenticated ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
}

View File

@@ -36,7 +36,7 @@ class ScrobblerSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit ScrobblerSettingsPage(SettingsDialog *parent);
explicit ScrobblerSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~ScrobblerSettingsPage() override;
static const char *kSettingsGroup;
@@ -47,13 +47,13 @@ class ScrobblerSettingsPage : public SettingsPage {
private slots:
void LastFM_Login();
void LastFM_Logout();
void LastFM_AuthenticationComplete(const bool success, QString error = QString());
void LastFM_AuthenticationComplete(const bool success, const QString &error = QString());
void LibreFM_Login();
void LibreFM_Logout();
void LibreFM_AuthenticationComplete(const bool success, QString error = QString());
void LibreFM_AuthenticationComplete(const bool success, const QString &error = QString());
void ListenBrainz_Login();
void ListenBrainz_Logout();
void ListenBrainz_AuthenticationComplete(const bool success, QString error = QString());
void ListenBrainz_AuthenticationComplete(const bool success, const QString &error = QString());
private:
AudioScrobbler *scrobbler_;
@@ -66,9 +66,9 @@ class ScrobblerSettingsPage : public SettingsPage {
bool librefm_waiting_for_auth_;
bool listenbrainz_waiting_for_auth_;
void LastFM_RefreshControls(bool authenticated);
void LibreFM_RefreshControls(bool authenticated);
void ListenBrainz_RefreshControls(bool authenticated);
void LastFM_RefreshControls(const bool authenticated);
void LibreFM_RefreshControls(const bool authenticated);
void ListenBrainz_RefreshControls(const bool authenticated);
};

View File

@@ -132,29 +132,29 @@ SettingsDialog::SettingsDialog(Application *app, OSDBase *osd, QMainWindow *main
ui_->list->setItemDelegate(new SettingsItemDelegate(this));
QTreeWidgetItem *general = AddCategory(tr("General"));
AddPage(Page_Behaviour, new BehaviourSettingsPage(this), general);
AddPage(Page_Collection, new CollectionSettingsPage(this), general);
AddPage(Page_Backend, new BackendSettingsPage(this), general);
AddPage(Page_Playlist, new PlaylistSettingsPage(this), general);
AddPage(Page_Scrobbler, new ScrobblerSettingsPage(this), general);
AddPage(Page_Covers, new CoversSettingsPage(this), general);
AddPage(Page_Lyrics, new LyricsSettingsPage(this), general);
AddPage(Page_Behaviour, new BehaviourSettingsPage(this, this), general);
AddPage(Page_Collection, new CollectionSettingsPage(this, this), general);
AddPage(Page_Backend, new BackendSettingsPage(this, this), general);
AddPage(Page_Playlist, new PlaylistSettingsPage(this, this), general);
AddPage(Page_Scrobbler, new ScrobblerSettingsPage(this, this), general);
AddPage(Page_Covers, new CoversSettingsPage(this, this), general);
AddPage(Page_Lyrics, new LyricsSettingsPage(this, this), general);
#ifdef HAVE_GSTREAMER
AddPage(Page_Transcoding, new TranscoderSettingsPage(this), general);
AddPage(Page_Transcoding, new TranscoderSettingsPage(this, this), general);
#endif
AddPage(Page_Proxy, new NetworkProxySettingsPage(this), general);
AddPage(Page_Proxy, new NetworkProxySettingsPage(this, this), general);
QTreeWidgetItem *iface = AddCategory(tr("User interface"));
AddPage(Page_Appearance, new AppearanceSettingsPage(this), iface);
AddPage(Page_Context, new ContextSettingsPage(this), iface);
AddPage(Page_Notifications, new NotificationsSettingsPage(this), iface);
AddPage(Page_Appearance, new AppearanceSettingsPage(this, this), iface);
AddPage(Page_Context, new ContextSettingsPage(this, this), iface);
AddPage(Page_Notifications, new NotificationsSettingsPage(this, this), iface);
#ifdef HAVE_GLOBALSHORTCUTS
AddPage(Page_GlobalShortcuts, new GlobalShortcutsSettingsPage(this), iface);
AddPage(Page_GlobalShortcuts, new GlobalShortcutsSettingsPage(this, this), iface);
#endif
#ifdef HAVE_MOODBAR
AddPage(Page_Moodbar, new MoodbarSettingsPage(this), iface);
AddPage(Page_Moodbar, new MoodbarSettingsPage(this, this), iface);
#endif
#if defined(HAVE_SUBSONIC) || defined(HAVE_TIDAL) || defined(HAVE_QOBUZ)
@@ -162,13 +162,13 @@ SettingsDialog::SettingsDialog(Application *app, OSDBase *osd, QMainWindow *main
#endif
#ifdef HAVE_SUBSONIC
AddPage(Page_Subsonic, new SubsonicSettingsPage(this), streaming);
AddPage(Page_Subsonic, new SubsonicSettingsPage(this, this), streaming);
#endif
#ifdef HAVE_TIDAL
AddPage(Page_Tidal, new TidalSettingsPage(this), streaming);
AddPage(Page_Tidal, new TidalSettingsPage(this, this), streaming);
#endif
#ifdef HAVE_QOBUZ
AddPage(Page_Qobuz, new QobuzSettingsPage(this), streaming);
AddPage(Page_Qobuz, new QobuzSettingsPage(this, this), streaming);
#endif
// List box
@@ -176,7 +176,7 @@ SettingsDialog::SettingsDialog(Application *app, OSDBase *osd, QMainWindow *main
ui_->list->setCurrentItem(pages_[Page_Behaviour].item_);
// Make sure the list is big enough to show all the items
ui_->list->setMinimumWidth(qobject_cast<QAbstractItemView*>(ui_->list)->sizeHintForColumn(0));
ui_->list->setMinimumWidth(qobject_cast<QAbstractItemView*>(ui_->list)->sizeHintForColumn(0)); // clazy:exclude=unneeded-cast
ui_->buttonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence::Close);
@@ -285,7 +285,7 @@ QTreeWidgetItem *SettingsDialog::AddCategory(const QString &name) {
}
void SettingsDialog::AddPage(Page id, SettingsPage *page, QTreeWidgetItem *parent) {
void SettingsDialog::AddPage(const Page id, SettingsPage *page, QTreeWidgetItem *parent) {
if (!parent) parent = ui_->list->invisibleRootItem();

View File

@@ -59,6 +59,8 @@ class Ui_SettingsDialog;
class SettingsItemDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
explicit SettingsItemDelegate(QObject *parent);
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &idx) const override;
@@ -131,7 +133,7 @@ class SettingsDialog : public QDialog {
void SaveGeometry();
QTreeWidgetItem *AddCategory(const QString &name);
void AddPage(Page id, SettingsPage *page, QTreeWidgetItem *parent = nullptr);
void AddPage(const Page id, SettingsPage *page, QTreeWidgetItem *parent = nullptr);
void Apply();
void Save();

View File

@@ -34,7 +34,7 @@
#include "settingsdialog.h"
#include "settingspage.h"
SettingsPage::SettingsPage(SettingsDialog *dialog) : QWidget(dialog), dialog_(dialog), ui_widget_(nullptr), changed_(false) {}
SettingsPage::SettingsPage(SettingsDialog *dialog, QWidget *parent) : QWidget(parent), dialog_(dialog), ui_widget_(nullptr), changed_(false) {}
void SettingsPage::Init(QWidget *ui_widget) {

View File

@@ -49,7 +49,7 @@ class SettingsPage : public QWidget {
Q_OBJECT
public:
explicit SettingsPage(SettingsDialog *dialog);
explicit SettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
void Init(QWidget *ui_widget);

View File

@@ -41,10 +41,10 @@
const char *SubsonicSettingsPage::kSettingsGroup = "Subsonic";
SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog *parent)
: SettingsPage(parent),
SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent),
ui_(new Ui::SubsonicSettingsPage),
service_(dialog()->app()->internet_services()->Service<SubsonicService>()) {
service_(dialog->app()->internet_services()->Service<SubsonicService>()) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("subsonic"));
@@ -56,7 +56,7 @@ SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog *parent)
QObject::connect(service_, &SubsonicService::TestFailure, this, &SubsonicSettingsPage::TestFailure);
QObject::connect(service_, &SubsonicService::TestSuccess, this, &SubsonicSettingsPage::TestSuccess);
dialog()->installEventFilter(this);
dialog->installEventFilter(this);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
ui_->checkbox_http2->hide();
@@ -128,7 +128,6 @@ bool SubsonicSettingsPage::eventFilter(QObject *object, QEvent *event) {
if (object == dialog() && event->type() == QEvent::Enter) {
ui_->button_test->setEnabled(true);
return false;
}
return SettingsPage::eventFilter(object, event);
@@ -144,7 +143,7 @@ void SubsonicSettingsPage::TestSuccess() {
}
void SubsonicSettingsPage::TestFailure(QString failure_reason) {
void SubsonicSettingsPage::TestFailure(const QString &failure_reason) {
if (!this->isVisible()) return;
ui_->button_test->setEnabled(true);

View File

@@ -37,7 +37,7 @@ class SubsonicSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit SubsonicSettingsPage(SettingsDialog *parent = nullptr);
explicit SubsonicSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~SubsonicSettingsPage() override;
static const char *kSettingsGroup;
@@ -53,7 +53,7 @@ class SubsonicSettingsPage : public SettingsPage {
private slots:
void TestClicked();
void TestSuccess();
void TestFailure(QString failure_reason);
void TestFailure(const QString &failure_reason);
private:
Ui_SubsonicSettingsPage *ui_;

View File

@@ -43,10 +43,10 @@
const char *TidalSettingsPage::kSettingsGroup = "Tidal";
TidalSettingsPage::TidalSettingsPage(SettingsDialog *parent)
: SettingsPage(parent),
TidalSettingsPage::TidalSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent),
ui_(new Ui::TidalSettingsPage),
service_(dialog()->app()->internet_services()->Service<TidalService>()) {
service_(dialog->app()->internet_services()->Service<TidalService>()) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("tidal"));
@@ -61,7 +61,7 @@ TidalSettingsPage::TidalSettingsPage(SettingsDialog *parent)
QObject::connect(service_, &InternetService::LoginFailure, this, &TidalSettingsPage::LoginFailure);
QObject::connect(service_, &InternetService::LoginSuccess, this, &TidalSettingsPage::LoginSuccess);
dialog()->installEventFilter(this);
dialog->installEventFilter(this);
ui_->quality->addItem("Low", "LOW");
ui_->quality->addItem("High", "HIGH");
@@ -184,7 +184,6 @@ bool TidalSettingsPage::eventFilter(QObject *object, QEvent *event) {
if (object == dialog() && event->type() == QEvent::Enter) {
ui_->button_login->setEnabled(true);
return false;
}
return SettingsPage::eventFilter(object, event);

View File

@@ -36,7 +36,7 @@ class TidalSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit TidalSettingsPage(SettingsDialog *parent = nullptr);
explicit TidalSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~TidalSettingsPage() override;
static const char *kSettingsGroup;

View File

@@ -38,8 +38,8 @@
class SettingsDialog;
TranscoderSettingsPage::TranscoderSettingsPage(SettingsDialog *dialog)
: SettingsPage(dialog), ui_(new Ui_TranscoderSettingsPage) {
TranscoderSettingsPage::TranscoderSettingsPage(SettingsDialog *dialog, QWidget *parent)
: SettingsPage(dialog, parent), ui_(new Ui_TranscoderSettingsPage) {
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("tools-wizard"));

View File

@@ -38,7 +38,7 @@ class TranscoderSettingsPage : public SettingsPage {
Q_OBJECT
public:
explicit TranscoderSettingsPage(SettingsDialog *dialog);
explicit TranscoderSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
~TranscoderSettingsPage() override;
static const char *kSettingsGroup;