Use C++11 enum class
This commit is contained in:
@@ -84,7 +84,7 @@ const char *AppearanceSettingsPage::kPlaylistPlayingSongColor = "playlist_playin
|
||||
AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
||||
: SettingsPage(dialog, parent),
|
||||
ui_(new Ui_AppearanceSettingsPage),
|
||||
background_image_type_(BackgroundImageType_Default) {
|
||||
background_image_type_(BackgroundImageType::Default) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("view-media-visualization", true, 0, 32));
|
||||
@@ -94,11 +94,11 @@ AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog, QWidget *
|
||||
ui_->combobox_style->addItem(style, style);
|
||||
}
|
||||
|
||||
ui_->combobox_backgroundimageposition->setItemData(0, BackgroundImagePosition_UpperLeft);
|
||||
ui_->combobox_backgroundimageposition->setItemData(1, BackgroundImagePosition_UpperRight);
|
||||
ui_->combobox_backgroundimageposition->setItemData(2, BackgroundImagePosition_Middle);
|
||||
ui_->combobox_backgroundimageposition->setItemData(3, BackgroundImagePosition_BottomLeft);
|
||||
ui_->combobox_backgroundimageposition->setItemData(4, BackgroundImagePosition_BottomRight);
|
||||
ui_->combobox_backgroundimageposition->setItemData(0, static_cast<int>(BackgroundImagePosition::UpperLeft));
|
||||
ui_->combobox_backgroundimageposition->setItemData(1, static_cast<int>(BackgroundImagePosition::UpperRight));
|
||||
ui_->combobox_backgroundimageposition->setItemData(2, static_cast<int>(BackgroundImagePosition::Middle));
|
||||
ui_->combobox_backgroundimageposition->setItemData(3, static_cast<int>(BackgroundImagePosition::BottomLeft));
|
||||
ui_->combobox_backgroundimageposition->setItemData(4, static_cast<int>(BackgroundImagePosition::BottomRight));
|
||||
|
||||
QObject::connect(ui_->blur_slider, &QSlider::valueChanged, this, &AppearanceSettingsPage::BlurLevelChanged);
|
||||
QObject::connect(ui_->opacity_slider, &QSlider::valueChanged, this, &AppearanceSettingsPage::OpacityLevelChanged);
|
||||
@@ -160,29 +160,29 @@ void AppearanceSettingsPage::Load() {
|
||||
TabBarSystemColor(ui_->tabbar_system_color->isChecked());
|
||||
|
||||
// Playlist settings
|
||||
background_image_type_ = static_cast<BackgroundImageType>(s.value(kBackgroundImageType).toInt());
|
||||
background_image_type_ = static_cast<BackgroundImageType>(s.value(kBackgroundImageType, static_cast<int>(BackgroundImageType::Default)).toInt());
|
||||
background_image_filename_ = s.value(kBackgroundImageFilename).toString();
|
||||
|
||||
switch (background_image_type_) {
|
||||
case BackgroundImageType_Default:
|
||||
case BackgroundImageType::Default:
|
||||
ui_->use_default_background->setChecked(true);
|
||||
break;
|
||||
case BackgroundImageType_None:
|
||||
case BackgroundImageType::None:
|
||||
ui_->use_no_background->setChecked(true);
|
||||
break;
|
||||
case BackgroundImageType_Album:
|
||||
case BackgroundImageType::Album:
|
||||
ui_->use_album_cover_background->setChecked(true);
|
||||
break;
|
||||
case BackgroundImageType_Strawbs:
|
||||
case BackgroundImageType::Strawbs:
|
||||
ui_->use_strawbs_background->setChecked(true);
|
||||
break;
|
||||
case BackgroundImageType_Custom:
|
||||
case BackgroundImageType::Custom:
|
||||
ui_->use_custom_background_image->setChecked(true);
|
||||
break;
|
||||
}
|
||||
ui_->background_image_filename->setText(background_image_filename_);
|
||||
|
||||
ui_->combobox_backgroundimageposition->setCurrentIndex(ui_->combobox_backgroundimageposition->findData(s.value(kBackgroundImagePosition, BackgroundImagePosition_BottomRight).toInt()));
|
||||
ui_->combobox_backgroundimageposition->setCurrentIndex(ui_->combobox_backgroundimageposition->findData(s.value(kBackgroundImagePosition, static_cast<int>(BackgroundImagePosition::BottomRight)).toInt()));
|
||||
ui_->spinbox_background_image_maxsize->setValue(s.value(kBackgroundImageMaxSize, 0).toInt());
|
||||
ui_->checkbox_background_image_stretch->setChecked(s.value(kBackgroundImageStretch, false).toBool());
|
||||
ui_->checkbox_background_image_do_not_cut->setChecked(s.value(kBackgroundImageDoNotCut, true).toBool());
|
||||
@@ -234,32 +234,31 @@ void AppearanceSettingsPage::Save() {
|
||||
|
||||
background_image_filename_ = ui_->background_image_filename->text();
|
||||
if (ui_->use_default_background->isChecked()) {
|
||||
background_image_type_ = BackgroundImageType_Default;
|
||||
background_image_type_ = BackgroundImageType::Default;
|
||||
}
|
||||
else if (ui_->use_no_background->isChecked()) {
|
||||
background_image_type_ = BackgroundImageType_None;
|
||||
background_image_type_ = BackgroundImageType::None;
|
||||
}
|
||||
else if (ui_->use_album_cover_background->isChecked()) {
|
||||
background_image_type_ = BackgroundImageType_Album;
|
||||
background_image_type_ = BackgroundImageType::Album;
|
||||
}
|
||||
else if (ui_->use_strawbs_background->isChecked()) {
|
||||
background_image_type_ = BackgroundImageType_Strawbs;
|
||||
background_image_type_ = BackgroundImageType::Strawbs;
|
||||
}
|
||||
else if (ui_->use_custom_background_image->isChecked()) {
|
||||
background_image_type_ = BackgroundImageType_Custom;
|
||||
background_image_type_ = BackgroundImageType::Custom;
|
||||
}
|
||||
s.setValue(kBackgroundImageType, background_image_type_);
|
||||
s.setValue(kBackgroundImageType, static_cast<int>(background_image_type_));
|
||||
|
||||
if (background_image_type_ == BackgroundImageType_Custom) {
|
||||
if (background_image_type_ == BackgroundImageType::Custom) {
|
||||
s.setValue(kBackgroundImageFilename, background_image_filename_);
|
||||
}
|
||||
else {
|
||||
s.remove(kBackgroundImageFilename);
|
||||
}
|
||||
|
||||
BackgroundImagePosition backgroundimageposition = static_cast<BackgroundImagePosition>(ui_->combobox_backgroundimageposition->itemData(ui_->combobox_backgroundimageposition->currentIndex()).toInt());
|
||||
s.setValue(kBackgroundImageMaxSize, ui_->spinbox_background_image_maxsize->value());
|
||||
s.setValue(kBackgroundImagePosition, backgroundimageposition);
|
||||
s.setValue(kBackgroundImagePosition, ui_->combobox_backgroundimageposition->currentData().toInt());
|
||||
s.setValue(kBackgroundImageStretch, ui_->checkbox_background_image_stretch->isChecked());
|
||||
s.setValue(kBackgroundImageDoNotCut, ui_->checkbox_background_image_do_not_cut->isChecked());
|
||||
s.setValue(kBackgroundImageKeepAspectRatio, ui_->checkbox_background_image_keep_aspect_ratio->isChecked());
|
||||
|
||||
@@ -75,20 +75,20 @@ class AppearanceSettingsPage : public SettingsPage {
|
||||
|
||||
static const char *kPlaylistPlayingSongColor;
|
||||
|
||||
enum BackgroundImageType {
|
||||
BackgroundImageType_Default,
|
||||
BackgroundImageType_None,
|
||||
BackgroundImageType_Custom,
|
||||
BackgroundImageType_Album,
|
||||
BackgroundImageType_Strawbs
|
||||
enum class BackgroundImageType {
|
||||
Default,
|
||||
None,
|
||||
Custom,
|
||||
Album,
|
||||
Strawbs
|
||||
};
|
||||
|
||||
enum BackgroundImagePosition {
|
||||
BackgroundImagePosition_UpperLeft = 1,
|
||||
BackgroundImagePosition_UpperRight = 2,
|
||||
BackgroundImagePosition_Middle = 3,
|
||||
BackgroundImagePosition_BottomLeft = 4,
|
||||
BackgroundImagePosition_BottomRight = 5
|
||||
enum class BackgroundImagePosition {
|
||||
UpperLeft = 1,
|
||||
UpperRight = 2,
|
||||
Middle = 3,
|
||||
BottomLeft = 4,
|
||||
BottomRight = 5
|
||||
};
|
||||
|
||||
void Load() override;
|
||||
|
||||
@@ -67,7 +67,7 @@ BackendSettingsPage::BackendSettingsPage(SettingsDialog *dialog, QWidget *parent
|
||||
ui_(new Ui_BackendSettingsPage),
|
||||
configloaded_(false),
|
||||
engineloaded_(false),
|
||||
enginetype_current_(Engine::None) {
|
||||
enginetype_current_(Engine::EngineType::None) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("soundcard", true, 0, 32));
|
||||
@@ -113,15 +113,15 @@ void BackendSettingsPage::Load() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
Engine::EngineType enginetype = Engine::EngineTypeFromName(s.value("engine", EngineName(Engine::None)).toString());
|
||||
if (enginetype == Engine::None && engine()) enginetype = engine()->type();
|
||||
Engine::EngineType enginetype = Engine::EngineTypeFromName(s.value("engine", EngineName(Engine::EngineType::None)).toString());
|
||||
if (enginetype == Engine::EngineType::None && engine()) enginetype = engine()->type();
|
||||
|
||||
ui_->combobox_engine->clear();
|
||||
#ifdef HAVE_GSTREAMER
|
||||
ui_->combobox_engine->addItem(IconLoader::Load("gstreamer"), EngineDescription(Engine::GStreamer), QVariant::fromValue(static_cast<int>(Engine::GStreamer)));
|
||||
ui_->combobox_engine->addItem(IconLoader::Load("gstreamer"), EngineDescription(Engine::EngineType::GStreamer), static_cast<int>(Engine::EngineType::GStreamer));
|
||||
#endif
|
||||
#ifdef HAVE_VLC
|
||||
ui_->combobox_engine->addItem(IconLoader::Load("vlc"), EngineDescription(Engine::VLC), QVariant::fromValue(static_cast<int>(Engine::VLC)));
|
||||
ui_->combobox_engine->addItem(IconLoader::Load("vlc"), EngineDescription(Engine::EngineType::VLC), static_cast<int>(Engine::EngineType::VLC));
|
||||
#endif
|
||||
|
||||
enginetype_current_ = enginetype;
|
||||
@@ -133,20 +133,17 @@ void BackendSettingsPage::Load() {
|
||||
#ifdef HAVE_ALSA
|
||||
ui_->lineedit_device->show();
|
||||
ui_->widget_alsa_plugin->show();
|
||||
int alsaplug_int = alsa_plugin(s.value("alsaplugin", 0).toInt());
|
||||
if (static_cast<alsa_plugin>(alsaplug_int)) {
|
||||
alsa_plugin alsaplugin = static_cast<alsa_plugin>(alsaplug_int);
|
||||
switch (alsaplugin) {
|
||||
case alsa_plugin::alsa_hw:
|
||||
ui_->radiobutton_alsa_hw->setChecked(true);
|
||||
break;
|
||||
case alsa_plugin::alsa_plughw:
|
||||
ui_->radiobutton_alsa_plughw->setChecked(true);
|
||||
break;
|
||||
case alsa_plugin::alsa_pcm:
|
||||
ui_->radiobutton_alsa_pcm->setChecked(true);
|
||||
break;
|
||||
}
|
||||
const ALSAPluginType alsa_plugin_type = static_cast<ALSAPluginType>(s.value("alsaplugin", static_cast<int>(ALSAPluginType::PCM)).toInt());
|
||||
switch (alsa_plugin_type) {
|
||||
case ALSAPluginType::HW:
|
||||
ui_->radiobutton_alsa_hw->setChecked(true);
|
||||
break;
|
||||
case ALSAPluginType::PlugHW:
|
||||
ui_->radiobutton_alsa_plughw->setChecked(true);
|
||||
break;
|
||||
case ALSAPluginType::PCM:
|
||||
ui_->radiobutton_alsa_pcm->setChecked(true);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
ui_->lineedit_device->hide();
|
||||
@@ -191,7 +188,7 @@ void BackendSettingsPage::Load() {
|
||||
|
||||
if (!EngineInitialized()) return;
|
||||
|
||||
if (engine()->state() == Engine::Empty) {
|
||||
if (engine()->state() == Engine::State::Empty) {
|
||||
if (ui_->combobox_engine->count() > 1) ui_->combobox_engine->setEnabled(true);
|
||||
else ui_->combobox_engine->setEnabled(false);
|
||||
}
|
||||
@@ -234,7 +231,7 @@ void BackendSettingsPage::Load() {
|
||||
|
||||
bool BackendSettingsPage::EngineInitialized() {
|
||||
|
||||
if (!engine() || engine()->type() == Engine::None) {
|
||||
if (!engine() || engine()->type() == Engine::EngineType::None) {
|
||||
errordialog_.ShowMessage("Engine is not initialized! Please restart.");
|
||||
return false;
|
||||
}
|
||||
@@ -309,7 +306,7 @@ void BackendSettingsPage::Load_Output(QString output, QVariant device) {
|
||||
}
|
||||
}
|
||||
|
||||
if (engine()->type() == Engine::GStreamer) {
|
||||
if (engine()->type() == Engine::EngineType::GStreamer) {
|
||||
ui_->groupbox_buffer->setEnabled(true);
|
||||
ui_->groupbox_replaygain->setEnabled(true);
|
||||
}
|
||||
@@ -335,7 +332,7 @@ void BackendSettingsPage::Load_Device(const QString &output, const QVariant &dev
|
||||
ui_->lineedit_device->clear();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (engine()->type() != Engine::GStreamer)
|
||||
if (engine()->type() != Engine::EngineType::GStreamer)
|
||||
#endif
|
||||
ui_->combobox_device->addItem(IconLoader::Load("soundcard"), kOutputAutomaticallySelect, QVariant());
|
||||
|
||||
@@ -364,29 +361,29 @@ void BackendSettingsPage::Load_Device(const QString &output, const QVariant &dev
|
||||
ui_->radiobutton_alsa_pcm->setEnabled(true);
|
||||
if (device.toString().contains(QRegularExpression("^hw:.*"))) {
|
||||
ui_->radiobutton_alsa_hw->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_hw);
|
||||
SwitchALSADevices(ALSAPluginType::HW);
|
||||
}
|
||||
else if (device.toString().contains(QRegularExpression("^plughw:.*"))) {
|
||||
ui_->radiobutton_alsa_plughw->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_plughw);
|
||||
SwitchALSADevices(ALSAPluginType::PlugHW);
|
||||
}
|
||||
else if (device.toString().contains(QRegularExpression("^.*:.*CARD=.*")) || device.toString().contains(QRegularExpression("^.*:.*DEV=.*"))) {
|
||||
ui_->radiobutton_alsa_pcm->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_pcm);
|
||||
SwitchALSADevices(ALSAPluginType::PCM);
|
||||
}
|
||||
else {
|
||||
if (ui_->radiobutton_alsa_hw->isChecked()) {
|
||||
SwitchALSADevices(alsa_plugin::alsa_hw);
|
||||
SwitchALSADevices(ALSAPluginType::HW);
|
||||
}
|
||||
else if (ui_->radiobutton_alsa_plughw->isChecked()) {
|
||||
SwitchALSADevices(alsa_plugin::alsa_plughw);
|
||||
SwitchALSADevices(ALSAPluginType::PlugHW);
|
||||
}
|
||||
else if (ui_->radiobutton_alsa_pcm->isChecked()) {
|
||||
SwitchALSADevices(alsa_plugin::alsa_pcm);
|
||||
SwitchALSADevices(ALSAPluginType::PCM);
|
||||
}
|
||||
else {
|
||||
ui_->radiobutton_alsa_hw->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_hw);
|
||||
SwitchALSADevices(ALSAPluginType::HW);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -462,9 +459,9 @@ void BackendSettingsPage::Save() {
|
||||
s.setValue("device", device_value);
|
||||
|
||||
#ifdef HAVE_ALSA
|
||||
if (ui_->radiobutton_alsa_hw->isChecked()) s.setValue("alsaplugin", static_cast<int>(alsa_plugin::alsa_hw));
|
||||
else if (ui_->radiobutton_alsa_plughw->isChecked()) s.setValue("alsaplugin", static_cast<int>(alsa_plugin::alsa_plughw));
|
||||
else if (ui_->radiobutton_alsa_pcm->isChecked()) s.setValue("alsaplugin", static_cast<int>(alsa_plugin::alsa_pcm));
|
||||
if (ui_->radiobutton_alsa_hw->isChecked()) s.setValue("alsaplugin", static_cast<int>(ALSAPluginType::HW));
|
||||
else if (ui_->radiobutton_alsa_plughw->isChecked()) s.setValue("alsaplugin", static_cast<int>(ALSAPluginType::PlugHW));
|
||||
else if (ui_->radiobutton_alsa_pcm->isChecked()) s.setValue("alsaplugin", static_cast<int>(ALSAPluginType::PCM));
|
||||
else s.remove("alsaplugin");
|
||||
#endif
|
||||
|
||||
@@ -517,7 +514,7 @@ void BackendSettingsPage::EngineChanged(const int index) {
|
||||
|
||||
if (engine()->type() == enginetype) return;
|
||||
|
||||
if (engine()->state() != Engine::Empty) {
|
||||
if (engine()->state() != Engine::State::Empty) {
|
||||
errordialog_.ShowMessage("Can't switch engine while playing!");
|
||||
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(static_cast<int>(engine()->type())));
|
||||
return;
|
||||
@@ -576,15 +573,15 @@ void BackendSettingsPage::DeviceStringChanged() {
|
||||
if (engine()->ALSADeviceSupport(output.name)) {
|
||||
if (ui_->lineedit_device->text().contains(QRegularExpression("^hw:.*")) && !ui_->radiobutton_alsa_hw->isChecked()) {
|
||||
ui_->radiobutton_alsa_hw->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_hw);
|
||||
SwitchALSADevices(ALSAPluginType::HW);
|
||||
}
|
||||
else if (ui_->lineedit_device->text().contains(QRegularExpression("^plughw:.*")) && !ui_->radiobutton_alsa_plughw->isChecked()) {
|
||||
ui_->radiobutton_alsa_plughw->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_plughw);
|
||||
SwitchALSADevices(ALSAPluginType::PlugHW);
|
||||
}
|
||||
else if ((ui_->lineedit_device->text().contains(QRegularExpression("^.*:.*CARD=.*")) || ui_->lineedit_device->text().contains(QRegularExpression("^.*:.*DEV=.*"))) && !ui_->radiobutton_alsa_pcm->isChecked()) {
|
||||
ui_->radiobutton_alsa_pcm->setChecked(true);
|
||||
SwitchALSADevices(alsa_plugin::alsa_pcm);
|
||||
SwitchALSADevices(ALSAPluginType::PCM);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -646,18 +643,18 @@ void BackendSettingsPage::RgFallbackGainChanged(const int value) {
|
||||
}
|
||||
|
||||
#ifdef HAVE_ALSA
|
||||
void BackendSettingsPage::SwitchALSADevices(const alsa_plugin alsaplugin) {
|
||||
void BackendSettingsPage::SwitchALSADevices(const ALSAPluginType alsa_plugin_type) {
|
||||
|
||||
// All ALSA devices are listed twice, one for "hw" and one for "plughw"
|
||||
// Only show one of them by making the other ones invisible based on the alsa plugin radiobuttons
|
||||
for (int i = 0; i < ui_->combobox_device->count(); ++i) {
|
||||
QListView *view = qobject_cast<QListView*>(ui_->combobox_device->view());
|
||||
if (!view) continue;
|
||||
if ((ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^hw:.*")) && alsaplugin != alsa_plugin::alsa_hw)
|
||||
if ((ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^hw:.*")) && alsa_plugin_type != ALSAPluginType::HW)
|
||||
||
|
||||
(ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^plughw:.*")) && alsaplugin != alsa_plugin::alsa_plughw)
|
||||
(ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^plughw:.*")) && alsa_plugin_type != ALSAPluginType::PlugHW)
|
||||
||
|
||||
((ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^.*:.*CARD=.*")) || ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^.*:.*DEV=.*"))) && alsaplugin != alsa_plugin::alsa_pcm)
|
||||
((ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^.*:.*CARD=.*")) || ui_->combobox_device->itemData(i).toString().contains(QRegularExpression("^.*:.*DEV=.*"))) && alsa_plugin_type != ALSAPluginType::PCM)
|
||||
) {
|
||||
view->setRowHidden(i, true);
|
||||
}
|
||||
@@ -680,7 +677,7 @@ void BackendSettingsPage::radiobutton_alsa_hw_clicked(const bool checked) {
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||
if (!engine()->ALSADeviceSupport(output.name)) return;
|
||||
|
||||
SwitchALSADevices(alsa_plugin::alsa_hw);
|
||||
SwitchALSADevices(ALSAPluginType::HW);
|
||||
|
||||
QString device_new = ui_->lineedit_device->text();
|
||||
|
||||
@@ -709,7 +706,7 @@ void BackendSettingsPage::radiobutton_alsa_plughw_clicked(const bool checked) {
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||
if (!engine()->ALSADeviceSupport(output.name)) return;
|
||||
|
||||
SwitchALSADevices(alsa_plugin::alsa_plughw);
|
||||
SwitchALSADevices(ALSAPluginType::PlugHW);
|
||||
|
||||
QString device_new = ui_->lineedit_device->text();
|
||||
|
||||
@@ -738,7 +735,7 @@ void BackendSettingsPage::radiobutton_alsa_pcm_clicked(const bool checked) {
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||
if (!engine()->ALSADeviceSupport(output.name)) return;
|
||||
|
||||
SwitchALSADevices(alsa_plugin::alsa_pcm);
|
||||
SwitchALSADevices(ALSAPluginType::PCM);
|
||||
|
||||
QString device_new = ui_->lineedit_device->text();
|
||||
|
||||
@@ -798,7 +795,7 @@ void BackendSettingsPage::FadingOptionsChanged() {
|
||||
if (!configloaded_ || !EngineInitialized()) return;
|
||||
|
||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||
if (engine()->type() == Engine::GStreamer &&
|
||||
if (engine()->type() == Engine::EngineType::GStreamer &&
|
||||
!(engine()->ALSADeviceSupport(output.name) && !ui_->lineedit_device->text().isEmpty() && (ui_->lineedit_device->text().contains(QRegularExpression("^hw:.*")) || ui_->lineedit_device->text().contains(QRegularExpression("^plughw:.*"))))) {
|
||||
ui_->groupbox_fading->setEnabled(true);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,14 @@ class BackendSettingsPage : public SettingsPage {
|
||||
|
||||
EngineBase *engine() const { return dialog()->app()->player()->engine(); }
|
||||
|
||||
#ifdef HAVE_ALSA
|
||||
enum class ALSAPluginType {
|
||||
HW = 1,
|
||||
PlugHW = 2,
|
||||
PCM = 3
|
||||
};
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void EngineChanged(const int index);
|
||||
void OutputChanged(const int index);
|
||||
@@ -69,13 +77,6 @@ class BackendSettingsPage : public SettingsPage {
|
||||
void BufferDefaults();
|
||||
|
||||
private:
|
||||
#ifdef HAVE_ALSA
|
||||
enum alsa_plugin {
|
||||
alsa_hw = 1,
|
||||
alsa_plughw = 2,
|
||||
alsa_pcm = 3
|
||||
};
|
||||
#endif
|
||||
|
||||
bool EngineInitialized();
|
||||
|
||||
@@ -83,7 +84,7 @@ class BackendSettingsPage : public SettingsPage {
|
||||
void Load_Output(QString output, QVariant device);
|
||||
void Load_Device(const QString &output, const QVariant &device);
|
||||
#ifdef HAVE_ALSA
|
||||
void SwitchALSADevices(const alsa_plugin alsaplugin);
|
||||
void SwitchALSADevices(const ALSAPluginType alsa_plugin_type);
|
||||
#endif
|
||||
void SelectDevice(const QString &device_new);
|
||||
|
||||
|
||||
@@ -116,24 +116,24 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog *dialog, QWidget *pa
|
||||
ui_->groupbox_language->setVisible(false);
|
||||
#endif
|
||||
|
||||
ui_->combobox_menuplaymode->setItemData(0, PlayBehaviour_Never);
|
||||
ui_->combobox_menuplaymode->setItemData(1, PlayBehaviour_IfStopped);
|
||||
ui_->combobox_menuplaymode->setItemData(2, PlayBehaviour_Always);
|
||||
ui_->combobox_menuplaymode->setItemData(0, static_cast<int>(PlayBehaviour::Never));
|
||||
ui_->combobox_menuplaymode->setItemData(1, static_cast<int>(PlayBehaviour::IfStopped));
|
||||
ui_->combobox_menuplaymode->setItemData(2, static_cast<int>(PlayBehaviour::Always));
|
||||
|
||||
ui_->combobox_previousmode->setItemData(0, PreviousBehaviour_DontRestart);
|
||||
ui_->combobox_previousmode->setItemData(1, PreviousBehaviour_Restart);
|
||||
ui_->combobox_previousmode->setItemData(0, static_cast<int>(PreviousBehaviour::DontRestart));
|
||||
ui_->combobox_previousmode->setItemData(1, static_cast<int>(PreviousBehaviour::Restart));
|
||||
|
||||
ui_->combobox_doubleclickaddmode->setItemData(0, AddBehaviour_Append);
|
||||
ui_->combobox_doubleclickaddmode->setItemData(1, AddBehaviour_Load);
|
||||
ui_->combobox_doubleclickaddmode->setItemData(2, AddBehaviour_OpenInNew);
|
||||
ui_->combobox_doubleclickaddmode->setItemData(3, AddBehaviour_Enqueue);
|
||||
ui_->combobox_doubleclickaddmode->setItemData(0, static_cast<int>(AddBehaviour::Append));
|
||||
ui_->combobox_doubleclickaddmode->setItemData(1, static_cast<int>(AddBehaviour::Load));
|
||||
ui_->combobox_doubleclickaddmode->setItemData(2, static_cast<int>(AddBehaviour::OpenInNew));
|
||||
ui_->combobox_doubleclickaddmode->setItemData(3, static_cast<int>(AddBehaviour::Enqueue));
|
||||
|
||||
ui_->combobox_doubleclickplaymode->setItemData(0, PlayBehaviour_Never);
|
||||
ui_->combobox_doubleclickplaymode->setItemData(1, PlayBehaviour_IfStopped);
|
||||
ui_->combobox_doubleclickplaymode->setItemData(2, PlayBehaviour_Always);
|
||||
ui_->combobox_doubleclickplaymode->setItemData(0, static_cast<int>(PlayBehaviour::Never));
|
||||
ui_->combobox_doubleclickplaymode->setItemData(1, static_cast<int>(PlayBehaviour::IfStopped));
|
||||
ui_->combobox_doubleclickplaymode->setItemData(2, static_cast<int>(PlayBehaviour::Always));
|
||||
|
||||
ui_->combobox_doubleclickplaylistaddmode->setItemData(0, PlaylistAddBehaviour_Play);
|
||||
ui_->combobox_doubleclickplaylistaddmode->setItemData(1, PlaylistAddBehaviour_Enqueue);
|
||||
ui_->combobox_doubleclickplaylistaddmode->setItemData(0, static_cast<int>(PlaylistAddBehaviour::Play));
|
||||
ui_->combobox_doubleclickplaylistaddmode->setItemData(1, static_cast<int>(PlaylistAddBehaviour::Enqueue));
|
||||
|
||||
}
|
||||
|
||||
@@ -177,26 +177,25 @@ void BehaviourSettingsPage::Load() {
|
||||
ui_->checkbox_playingwidget->setChecked(s.value("playing_widget", true).toBool());
|
||||
|
||||
#ifndef Q_OS_MACOS
|
||||
StartupBehaviour behaviour = StartupBehaviour(s.value("startupbehaviour", Startup_Remember).toInt());
|
||||
switch (behaviour) {
|
||||
case Startup_Show:
|
||||
const StartupBehaviour startup_behaviour = static_cast<StartupBehaviour>(s.value("startupbehaviour", static_cast<int>(StartupBehaviour::Remember)).toInt());
|
||||
switch (startup_behaviour) {
|
||||
case StartupBehaviour::Show:
|
||||
ui_->radiobutton_show->setChecked(true);
|
||||
break;
|
||||
case Startup_ShowMaximized:
|
||||
case StartupBehaviour::ShowMaximized:
|
||||
ui_->radiobutton_show_maximized->setChecked(true);
|
||||
break;
|
||||
case Startup_ShowMinimized:
|
||||
case StartupBehaviour::ShowMinimized:
|
||||
ui_->radiobutton_show_minimized->setChecked(true);
|
||||
break;
|
||||
case Startup_Hide:
|
||||
case StartupBehaviour::Hide:
|
||||
if (systemtray_available_) {
|
||||
ui_->radiobutton_hide->setChecked(true);
|
||||
break;
|
||||
}
|
||||
;
|
||||
[[fallthrough]];
|
||||
case BehaviourSettingsPage::Startup_Remember:
|
||||
default:
|
||||
case BehaviourSettingsPage::StartupBehaviour::Remember:
|
||||
ui_->radiobutton_remember->setChecked(true);
|
||||
break;
|
||||
}
|
||||
@@ -210,15 +209,15 @@ void BehaviourSettingsPage::Load() {
|
||||
ui_->combobox_language->setCurrentIndex(ui_->combobox_language->findText(name));
|
||||
}
|
||||
|
||||
ui_->combobox_menuplaymode->setCurrentIndex(ui_->combobox_menuplaymode->findData(s.value("menu_playmode", PlayBehaviour_Never).toInt()));
|
||||
ui_->combobox_menuplaymode->setCurrentIndex(ui_->combobox_menuplaymode->findData(s.value("menu_playmode", static_cast<int>(PlayBehaviour::Never)).toInt()));
|
||||
|
||||
ui_->combobox_previousmode->setCurrentIndex(ui_->combobox_previousmode->findData(s.value("menu_previousmode", PreviousBehaviour_DontRestart).toInt()));
|
||||
ui_->combobox_previousmode->setCurrentIndex(ui_->combobox_previousmode->findData(s.value("menu_previousmode", static_cast<int>(PreviousBehaviour::DontRestart)).toInt()));
|
||||
|
||||
ui_->combobox_doubleclickaddmode->setCurrentIndex(ui_->combobox_doubleclickaddmode->findData(s.value("doubleclick_addmode", AddBehaviour_Append).toInt()));
|
||||
ui_->combobox_doubleclickaddmode->setCurrentIndex(ui_->combobox_doubleclickaddmode->findData(s.value("doubleclick_addmode", static_cast<int>(AddBehaviour::Append)).toInt()));
|
||||
|
||||
ui_->combobox_doubleclickplaymode->setCurrentIndex(ui_->combobox_doubleclickplaymode->findData(s.value("doubleclick_playmode", PlayBehaviour_Never).toInt()));
|
||||
ui_->combobox_doubleclickplaymode->setCurrentIndex(ui_->combobox_doubleclickplaymode->findData(s.value("doubleclick_playmode", static_cast<int>(PlayBehaviour::Never)).toInt()));
|
||||
|
||||
ui_->combobox_doubleclickplaylistaddmode->setCurrentIndex(ui_->combobox_doubleclickplaylistaddmode->findData(s.value("doubleclick_playlist_addmode", PlaylistAddBehaviour_Play).toInt()));
|
||||
ui_->combobox_doubleclickplaylistaddmode->setCurrentIndex(ui_->combobox_doubleclickplaylistaddmode->findData(s.value("doubleclick_playlist_addmode", static_cast<int>(PlaylistAddBehaviour::Play)).toInt()));
|
||||
|
||||
ui_->spinbox_seekstepsec->setValue(s.value("seek_step_sec", 10).toInt());
|
||||
|
||||
@@ -241,30 +240,30 @@ void BehaviourSettingsPage::Save() {
|
||||
s.setValue("resumeplayback", ui_->checkbox_resumeplayback->isChecked());
|
||||
s.setValue("playing_widget", ui_->checkbox_playingwidget->isChecked());
|
||||
|
||||
StartupBehaviour behaviour = Startup_Remember;
|
||||
if (ui_->radiobutton_remember->isChecked()) behaviour = Startup_Remember;
|
||||
if (ui_->radiobutton_show->isChecked()) behaviour = Startup_Show;
|
||||
if (ui_->radiobutton_hide->isChecked()) behaviour = Startup_Hide;
|
||||
if (ui_->radiobutton_show_maximized->isChecked()) behaviour = Startup_ShowMaximized;
|
||||
if (ui_->radiobutton_show_minimized->isChecked()) behaviour = Startup_ShowMinimized;
|
||||
s.setValue("startupbehaviour", static_cast<int>(behaviour));
|
||||
StartupBehaviour startup_behaviour = StartupBehaviour::Remember;
|
||||
if (ui_->radiobutton_remember->isChecked()) startup_behaviour = StartupBehaviour::Remember;
|
||||
if (ui_->radiobutton_show->isChecked()) startup_behaviour = StartupBehaviour::Show;
|
||||
if (ui_->radiobutton_hide->isChecked()) startup_behaviour = StartupBehaviour::Hide;
|
||||
if (ui_->radiobutton_show_maximized->isChecked()) startup_behaviour = StartupBehaviour::ShowMaximized;
|
||||
if (ui_->radiobutton_show_minimized->isChecked()) startup_behaviour = StartupBehaviour::ShowMinimized;
|
||||
s.setValue("startupbehaviour", static_cast<int>(startup_behaviour));
|
||||
|
||||
s.setValue("language", language_map_.contains(ui_->combobox_language->currentText()) ? language_map_[ui_->combobox_language->currentText()] : QString());
|
||||
|
||||
PlayBehaviour menu_playmode = static_cast<PlayBehaviour>(ui_->combobox_menuplaymode->itemData(ui_->combobox_menuplaymode->currentIndex()).toInt());
|
||||
const PlayBehaviour menu_playmode = static_cast<PlayBehaviour>(ui_->combobox_menuplaymode->currentData().toInt());
|
||||
|
||||
PreviousBehaviour menu_previousmode = static_cast<PreviousBehaviour>(ui_->combobox_previousmode->itemData(ui_->combobox_previousmode->currentIndex()).toInt());
|
||||
AddBehaviour doubleclick_addmode = static_cast<AddBehaviour>(ui_->combobox_doubleclickaddmode->itemData(ui_->combobox_doubleclickaddmode->currentIndex()).toInt());
|
||||
const PreviousBehaviour menu_previousmode = static_cast<PreviousBehaviour>(ui_->combobox_previousmode->currentData().toInt());
|
||||
const AddBehaviour doubleclick_addmode = static_cast<AddBehaviour>(ui_->combobox_doubleclickaddmode->currentData().toInt());
|
||||
|
||||
PlayBehaviour doubleclick_playmode = static_cast<PlayBehaviour>(ui_->combobox_doubleclickplaymode->itemData(ui_->combobox_doubleclickplaymode->currentIndex()).toInt());
|
||||
const PlayBehaviour doubleclick_playmode = static_cast<PlayBehaviour>(ui_->combobox_doubleclickplaymode->currentData().toInt());
|
||||
|
||||
PlaylistAddBehaviour doubleclick_playlist_addmode = static_cast<PlaylistAddBehaviour>(ui_->combobox_doubleclickplaylistaddmode->itemData(ui_->combobox_doubleclickplaylistaddmode->currentIndex()).toInt());
|
||||
const PlaylistAddBehaviour doubleclick_playlist_addmode = static_cast<PlaylistAddBehaviour>(ui_->combobox_doubleclickplaylistaddmode->currentData().toInt());
|
||||
|
||||
s.setValue("menu_playmode", menu_playmode);
|
||||
s.setValue("menu_previousmode", menu_previousmode);
|
||||
s.setValue("doubleclick_addmode", doubleclick_addmode);
|
||||
s.setValue("doubleclick_playmode", doubleclick_playmode);
|
||||
s.setValue("doubleclick_playlist_addmode", doubleclick_playlist_addmode);
|
||||
s.setValue("menu_playmode", static_cast<int>(menu_playmode));
|
||||
s.setValue("menu_previousmode", static_cast<int>(menu_previousmode));
|
||||
s.setValue("doubleclick_addmode", static_cast<int>(doubleclick_addmode));
|
||||
s.setValue("doubleclick_playmode", static_cast<int>(doubleclick_playmode));
|
||||
s.setValue("doubleclick_playlist_addmode", static_cast<int>(doubleclick_playlist_addmode));
|
||||
|
||||
s.setValue("seek_step_sec", ui_->spinbox_seekstepsec->value());
|
||||
|
||||
|
||||
@@ -43,35 +43,35 @@ class BehaviourSettingsPage : public SettingsPage {
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
// Don't change the values
|
||||
enum StartupBehaviour {
|
||||
Startup_Remember = 1,
|
||||
Startup_Show = 2,
|
||||
Startup_Hide = 3,
|
||||
Startup_ShowMaximized = 4,
|
||||
Startup_ShowMinimized = 5,
|
||||
enum class StartupBehaviour {
|
||||
Remember = 1,
|
||||
Show = 2,
|
||||
Hide = 3,
|
||||
ShowMaximized = 4,
|
||||
ShowMinimized = 5
|
||||
};
|
||||
|
||||
enum PlayBehaviour {
|
||||
PlayBehaviour_Never = 1,
|
||||
PlayBehaviour_IfStopped = 2,
|
||||
PlayBehaviour_Always = 3,
|
||||
enum class PlayBehaviour {
|
||||
Never = 1,
|
||||
IfStopped = 2,
|
||||
Always = 3
|
||||
};
|
||||
|
||||
enum PreviousBehaviour {
|
||||
PreviousBehaviour_DontRestart = 1,
|
||||
PreviousBehaviour_Restart = 2
|
||||
enum class PreviousBehaviour {
|
||||
DontRestart = 1,
|
||||
Restart = 2
|
||||
};
|
||||
|
||||
enum AddBehaviour {
|
||||
AddBehaviour_Append = 1,
|
||||
AddBehaviour_Enqueue = 2,
|
||||
AddBehaviour_Load = 3,
|
||||
AddBehaviour_OpenInNew = 4
|
||||
enum class AddBehaviour {
|
||||
Append = 1,
|
||||
Enqueue = 2,
|
||||
Load = 3,
|
||||
OpenInNew = 4
|
||||
};
|
||||
|
||||
enum PlaylistAddBehaviour {
|
||||
PlaylistAddBehaviour_Play = 1,
|
||||
PlaylistAddBehaviour_Enqueue = 2,
|
||||
enum class PlaylistAddBehaviour {
|
||||
Play = 1,
|
||||
Enqueue = 2
|
||||
};
|
||||
|
||||
void Load() override;
|
||||
|
||||
@@ -76,11 +76,22 @@ CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog, QWidget *
|
||||
setWindowIcon(IconLoader::Load("library-music", true, 0, 32));
|
||||
ui_->add->setIcon(IconLoader::Load("document-open-folder"));
|
||||
|
||||
ui_->combobox_cache_size->addItems({ "KB", "MB" });
|
||||
ui_->combobox_disk_cache_size->addItems({ "KB", "MB", "GB" });
|
||||
ui_->combobox_cache_size->addItem("KB", static_cast<int>(CacheSizeUnit::KB));
|
||||
ui_->combobox_cache_size->addItem("MB", static_cast<int>(CacheSizeUnit::MB));
|
||||
|
||||
ui_->combobox_iopriority->addItems({ "Auto", "Realtime", "Best effort", "Idle" });
|
||||
ui_->combobox_threadpriority->addItems({ "Idle", "Lowest", "Low", "Normal" });
|
||||
ui_->combobox_disk_cache_size->addItem("KB", static_cast<int>(CacheSizeUnit::KB));
|
||||
ui_->combobox_disk_cache_size->addItem("MB", static_cast<int>(CacheSizeUnit::MB));
|
||||
ui_->combobox_disk_cache_size->addItem("GB", static_cast<int>(CacheSizeUnit::GB));
|
||||
|
||||
ui_->combobox_iopriority->addItem("Auto", static_cast<int>(Utilities::IoPriority::IOPRIO_CLASS_NONE));
|
||||
ui_->combobox_iopriority->addItem("Realtime", static_cast<int>(Utilities::IoPriority::IOPRIO_CLASS_RT));
|
||||
ui_->combobox_iopriority->addItem("Best effort", static_cast<int>(Utilities::IoPriority::IOPRIO_CLASS_BE));
|
||||
ui_->combobox_iopriority->addItem("Idle", static_cast<int>(Utilities::IoPriority::IOPRIO_CLASS_IDLE));
|
||||
|
||||
ui_->combobox_threadpriority->addItem("Idle", QThread::Priority::IdlePriority);
|
||||
ui_->combobox_threadpriority->addItem("Lowest", QThread::Priority::LowestPriority);
|
||||
ui_->combobox_threadpriority->addItem("Low", QThread::Priority::LowPriority);
|
||||
ui_->combobox_threadpriority->addItem("Normal", QThread::Priority::NormalPriority);
|
||||
|
||||
QObject::connect(ui_->add, &QPushButton::clicked, this, &CollectionSettingsPage::Add);
|
||||
QObject::connect(ui_->remove, &QPushButton::clicked, this, &CollectionSettingsPage::Remove);
|
||||
@@ -193,17 +204,27 @@ void CollectionSettingsPage::Load() {
|
||||
QStringList filters = s.value("cover_art_patterns", QStringList() << "front" << "cover").toStringList();
|
||||
ui_->cover_art_patterns->setText(filters.join(","));
|
||||
|
||||
SaveCoverType save_cover_type = SaveCoverType(s.value("save_cover_type", SaveCoverType_Cache).toInt());
|
||||
const SaveCoverType save_cover_type = static_cast<SaveCoverType>(s.value("save_cover_type", static_cast<int>(SaveCoverType::Cache)).toInt());
|
||||
switch (save_cover_type) {
|
||||
case SaveCoverType_Cache: ui_->radiobutton_save_albumcover_cache->setChecked(true); break;
|
||||
case SaveCoverType_Album: ui_->radiobutton_save_albumcover_albumdir->setChecked(true); break;
|
||||
case SaveCoverType_Embedded: ui_->radiobutton_save_albumcover_embedded->setChecked(true); break;
|
||||
case SaveCoverType::Cache:
|
||||
ui_->radiobutton_save_albumcover_cache->setChecked(true);
|
||||
break;
|
||||
case SaveCoverType::Album:
|
||||
ui_->radiobutton_save_albumcover_albumdir->setChecked(true);
|
||||
break;
|
||||
case SaveCoverType::Embedded:
|
||||
ui_->radiobutton_save_albumcover_embedded->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
SaveCoverFilename save_cover_filename = SaveCoverFilename(s.value("save_cover_filename", SaveCoverFilename_Pattern).toInt());
|
||||
const SaveCoverFilename save_cover_filename = static_cast<SaveCoverFilename>(s.value("save_cover_filename", static_cast<int>(SaveCoverFilename::Pattern)).toInt());
|
||||
switch (save_cover_filename) {
|
||||
case SaveCoverFilename_Hash: ui_->radiobutton_cover_hash->setChecked(true); break;
|
||||
case SaveCoverFilename_Pattern: ui_->radiobutton_cover_pattern->setChecked(true); break;
|
||||
case SaveCoverFilename::Hash:
|
||||
ui_->radiobutton_cover_hash->setChecked(true);
|
||||
break;
|
||||
case SaveCoverFilename::Pattern:
|
||||
ui_->radiobutton_cover_pattern->setChecked(true);
|
||||
break;
|
||||
}
|
||||
QString cover_pattern = s.value("cover_pattern").toString();
|
||||
if (!cover_pattern.isEmpty()) ui_->lineedit_cover_pattern->setText(cover_pattern);
|
||||
@@ -212,12 +233,10 @@ void CollectionSettingsPage::Load() {
|
||||
ui_->checkbox_cover_replace_spaces->setChecked(s.value("cover_replace_spaces", true).toBool());
|
||||
|
||||
ui_->spinbox_cache_size->setValue(s.value(kSettingsCacheSize, kSettingsCacheSizeDefault).toInt());
|
||||
ui_->combobox_cache_size->setCurrentIndex(s.value(kSettingsCacheSizeUnit, static_cast<int>(CacheSizeUnit_MB)).toInt());
|
||||
if (ui_->combobox_cache_size->currentIndex() == -1) ui_->combobox_cache_size->setCurrentIndex(static_cast<int>(CacheSizeUnit_MB));
|
||||
ui_->combobox_cache_size->setCurrentIndex(ui_->combobox_cache_size->findData(s.value(kSettingsCacheSizeUnit, static_cast<int>(CacheSizeUnit::MB)).toInt()));
|
||||
ui_->checkbox_disk_cache->setChecked(s.value(kSettingsDiskCacheEnable, false).toBool());
|
||||
ui_->spinbox_disk_cache_size->setValue(s.value(kSettingsDiskCacheSize, kSettingsDiskCacheSizeDefault).toInt());
|
||||
ui_->combobox_disk_cache_size->setCurrentIndex(s.value(kSettingsDiskCacheSizeUnit, static_cast<int>(CacheSizeUnit_MB)).toInt());
|
||||
if (ui_->combobox_disk_cache_size->currentIndex() == -1) ui_->combobox_cache_size->setCurrentIndex(static_cast<int>(CacheSizeUnit_MB));
|
||||
ui_->combobox_disk_cache_size->setCurrentIndex(ui_->combobox_disk_cache_size->findData(s.value(kSettingsDiskCacheSizeUnit, static_cast<int>(CacheSizeUnit::MB)).toInt()));
|
||||
|
||||
ui_->checkbox_save_playcounts->setChecked(s.value("save_playcounts", false).toBool());
|
||||
ui_->checkbox_save_ratings->setChecked(s.value("save_ratings", false).toBool());
|
||||
@@ -232,10 +251,10 @@ void CollectionSettingsPage::Load() {
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WIN32
|
||||
ComboBoxLoadFromSettingsByIndex(s, ui_->combobox_iopriority, "io_priority", Utilities::IOPRIO_CLASS_IDLE);
|
||||
ui_->combobox_iopriority->setCurrentIndex(ui_->combobox_iopriority->findData(s.value("io_priority", static_cast<int>(Utilities::IoPriority::IOPRIO_CLASS_IDLE)).toInt()));
|
||||
#endif
|
||||
|
||||
ComboBoxLoadFromSettingsByIndex(s, ui_->combobox_threadpriority, "thread_priority", QThread::Priority::IdlePriority);
|
||||
ui_->combobox_threadpriority->setCurrentIndex(ui_->combobox_threadpriority->findData(s.value("thread_priority", QThread::Priority::IdlePriority).toInt()));
|
||||
|
||||
int workers = s.value("tagreader_workers", qBound(1, QThread::idealThreadCount() / 2, 4)).toInt();
|
||||
if (workers <= 0 || workers > 4) {
|
||||
@@ -278,15 +297,15 @@ void CollectionSettingsPage::Save() {
|
||||
|
||||
s.setValue("cover_art_patterns", filters);
|
||||
|
||||
SaveCoverType save_cover_type = SaveCoverType_Cache;
|
||||
if (ui_->radiobutton_save_albumcover_cache->isChecked()) save_cover_type = SaveCoverType_Cache;
|
||||
else if (ui_->radiobutton_save_albumcover_albumdir->isChecked()) save_cover_type = SaveCoverType_Album;
|
||||
else if (ui_->radiobutton_save_albumcover_embedded->isChecked()) save_cover_type = SaveCoverType_Embedded;
|
||||
SaveCoverType save_cover_type = SaveCoverType::Cache;
|
||||
if (ui_->radiobutton_save_albumcover_cache->isChecked()) save_cover_type = SaveCoverType::Cache;
|
||||
else if (ui_->radiobutton_save_albumcover_albumdir->isChecked()) save_cover_type = SaveCoverType::Album;
|
||||
else if (ui_->radiobutton_save_albumcover_embedded->isChecked()) save_cover_type = SaveCoverType::Embedded;
|
||||
s.setValue("save_cover_type", static_cast<int>(save_cover_type));
|
||||
|
||||
SaveCoverFilename save_cover_filename = SaveCoverFilename_Hash;
|
||||
if (ui_->radiobutton_cover_hash->isChecked()) save_cover_filename = SaveCoverFilename_Hash;
|
||||
else if (ui_->radiobutton_cover_pattern->isChecked()) save_cover_filename = SaveCoverFilename_Pattern;
|
||||
SaveCoverFilename save_cover_filename = SaveCoverFilename::Hash;
|
||||
if (ui_->radiobutton_cover_hash->isChecked()) save_cover_filename = SaveCoverFilename::Hash;
|
||||
else if (ui_->radiobutton_cover_pattern->isChecked()) save_cover_filename = SaveCoverFilename::Pattern;
|
||||
s.setValue("save_cover_filename", static_cast<int>(save_cover_filename));
|
||||
|
||||
s.setValue("cover_pattern", ui_->lineedit_cover_pattern->text());
|
||||
@@ -295,10 +314,10 @@ void CollectionSettingsPage::Save() {
|
||||
s.setValue("cover_replace_spaces", ui_->checkbox_cover_replace_spaces->isChecked());
|
||||
|
||||
s.setValue(kSettingsCacheSize, ui_->spinbox_cache_size->value());
|
||||
s.setValue(kSettingsCacheSizeUnit, ui_->combobox_cache_size->currentIndex());
|
||||
s.setValue(kSettingsCacheSizeUnit, ui_->combobox_cache_size->currentData().toInt());
|
||||
s.setValue(kSettingsDiskCacheEnable, ui_->checkbox_disk_cache->isChecked());
|
||||
s.setValue(kSettingsDiskCacheSize, ui_->spinbox_disk_cache_size->value());
|
||||
s.setValue(kSettingsDiskCacheSizeUnit, ui_->combobox_disk_cache_size->currentIndex());
|
||||
s.setValue(kSettingsDiskCacheSizeUnit, ui_->combobox_disk_cache_size->currentData().toInt());
|
||||
|
||||
s.setValue("save_playcounts", ui_->checkbox_save_playcounts->isChecked());
|
||||
s.setValue("save_ratings", ui_->checkbox_save_ratings->isChecked());
|
||||
@@ -308,10 +327,10 @@ void CollectionSettingsPage::Save() {
|
||||
s.setValue("delete_files", ui_->checkbox_delete_files->isChecked());
|
||||
|
||||
#ifndef Q_OS_WIN32
|
||||
s.setValue("io_priority", ui_->combobox_iopriority->currentIndex());
|
||||
s.setValue("io_priority", ui_->combobox_iopriority->currentData().toInt());
|
||||
#endif
|
||||
|
||||
s.setValue("thread_priority", ui_->combobox_threadpriority->currentIndex());
|
||||
s.setValue("thread_priority", ui_->combobox_threadpriority->currentData().toInt());
|
||||
s.setValue("tagreader_workers", ui_->spinbox_tagreaderworkers->value());
|
||||
|
||||
s.endGroup();
|
||||
@@ -353,8 +372,10 @@ void CollectionSettingsPage::ClearPixmapDiskCache() {
|
||||
|
||||
void CollectionSettingsPage::CacheSizeUnitChanged(int index) {
|
||||
|
||||
switch (static_cast<CacheSizeUnit>(index)) {
|
||||
case CacheSizeUnit_MB:
|
||||
const CacheSizeUnit cache_size_unit = static_cast<CacheSizeUnit>(ui_->combobox_cache_size->currentData(index).toInt());
|
||||
|
||||
switch (cache_size_unit) {
|
||||
case CacheSizeUnit::MB:
|
||||
ui_->spinbox_cache_size->setMaximum(std::numeric_limits<int>::max() / 1024);
|
||||
break;
|
||||
default:
|
||||
@@ -366,8 +387,10 @@ void CollectionSettingsPage::CacheSizeUnitChanged(int index) {
|
||||
|
||||
void CollectionSettingsPage::DiskCacheSizeUnitChanged(int index) {
|
||||
|
||||
switch (static_cast<CacheSizeUnit>(index)) {
|
||||
case CacheSizeUnit_GB:
|
||||
const CacheSizeUnit cache_size_unit = static_cast<CacheSizeUnit>(ui_->combobox_disk_cache_size->currentData(index).toInt());
|
||||
|
||||
switch (cache_size_unit) {
|
||||
case CacheSizeUnit::GB:
|
||||
ui_->spinbox_disk_cache_size->setMaximum(4);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -50,22 +50,22 @@ class CollectionSettingsPage : public SettingsPage {
|
||||
static const int kSettingsCacheSizeDefault;
|
||||
static const int kSettingsDiskCacheSizeDefault;
|
||||
|
||||
enum SaveCoverType {
|
||||
SaveCoverType_Cache = 1,
|
||||
SaveCoverType_Album = 2,
|
||||
SaveCoverType_Embedded = 3
|
||||
enum class SaveCoverType {
|
||||
Cache = 1,
|
||||
Album = 2,
|
||||
Embedded = 3
|
||||
};
|
||||
|
||||
enum SaveCoverFilename {
|
||||
SaveCoverFilename_Hash = 1,
|
||||
SaveCoverFilename_Pattern = 2
|
||||
enum class SaveCoverFilename {
|
||||
Hash = 1,
|
||||
Pattern = 2
|
||||
};
|
||||
|
||||
enum CacheSizeUnit {
|
||||
CacheSizeUnit_KB,
|
||||
CacheSizeUnit_MB,
|
||||
CacheSizeUnit_GB,
|
||||
CacheSizeUnit_TB,
|
||||
enum class CacheSizeUnit {
|
||||
KB,
|
||||
MB,
|
||||
GB,
|
||||
TB
|
||||
};
|
||||
|
||||
void Load() override;
|
||||
|
||||
@@ -47,7 +47,7 @@ const char *ContextSettingsPage::kSettingsGroup = "Context";
|
||||
const char *ContextSettingsPage::kSettingsTitleFmt = "TitleFmt";
|
||||
const char *ContextSettingsPage::kSettingsSummaryFmt = "SummaryFmt";
|
||||
|
||||
const char *ContextSettingsPage::kSettingsGroupEnable[ContextSettingsOrder::NELEMS] = {
|
||||
const char *ContextSettingsPage::kSettingsGroupEnable[static_cast<int>(ContextSettingsOrder::NELEMS)] = {
|
||||
"AlbumEnable",
|
||||
"EngineAndDeviceEnable",
|
||||
"TechnicalDataEnable",
|
||||
@@ -65,12 +65,12 @@ ContextSettingsPage::ContextSettingsPage(SettingsDialog *dialog, QWidget *parent
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("view-choose", true, 0, 32));
|
||||
|
||||
checkboxes_[ContextSettingsOrder::ALBUM] = ui_->checkbox_album;
|
||||
checkboxes_[ContextSettingsOrder::ENGINE_AND_DEVICE] = ui_->checkbox_engine_device;
|
||||
checkboxes_[ContextSettingsOrder::TECHNICAL_DATA] = ui_->checkbox_technical_data;
|
||||
checkboxes_[ContextSettingsOrder::SONG_LYRICS] = ui_->checkbox_song_lyrics;
|
||||
checkboxes_[ContextSettingsOrder::SEARCH_COVER] = ui_->checkbox_search_cover;
|
||||
checkboxes_[ContextSettingsOrder::SEARCH_LYRICS] = ui_->checkbox_search_lyrics;
|
||||
checkboxes_[static_cast<int>(ContextSettingsOrder::ALBUM)] = ui_->checkbox_album;
|
||||
checkboxes_[static_cast<int>(ContextSettingsOrder::ENGINE_AND_DEVICE)] = ui_->checkbox_engine_device;
|
||||
checkboxes_[static_cast<int>(ContextSettingsOrder::TECHNICAL_DATA)] = ui_->checkbox_technical_data;
|
||||
checkboxes_[static_cast<int>(ContextSettingsOrder::SONG_LYRICS)] = ui_->checkbox_song_lyrics;
|
||||
checkboxes_[static_cast<int>(ContextSettingsOrder::SEARCH_COVER)] = ui_->checkbox_search_cover;
|
||||
checkboxes_[static_cast<int>(ContextSettingsOrder::SEARCH_LYRICS)] = ui_->checkbox_search_lyrics;
|
||||
|
||||
// Create and populate the helper menus
|
||||
QMenu *menu = new QMenu(this);
|
||||
@@ -135,7 +135,7 @@ void ContextSettingsPage::Load() {
|
||||
ui_->context_custom_text1->setText(s.value(kSettingsTitleFmt, "%title% - %artist%").toString());
|
||||
ui_->context_custom_text2->setText(s.value(kSettingsSummaryFmt, "%album%").toString());
|
||||
|
||||
for (int i = 0; i < ContextSettingsOrder::NELEMS; ++i) {
|
||||
for (int i = 0; i < static_cast<int>(ContextSettingsOrder::NELEMS); ++i) {
|
||||
checkboxes_[i]->setChecked(s.value(kSettingsGroupEnable[i], checkboxes_[i]->isChecked()).toBool());
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void ContextSettingsPage::Save() {
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue(kSettingsTitleFmt, ui_->context_custom_text1->text());
|
||||
s.setValue(kSettingsSummaryFmt, ui_->context_custom_text2->text());
|
||||
for (int i = 0; i < ContextSettingsOrder::NELEMS; ++i) {
|
||||
for (int i = 0; i < static_cast<int>(ContextSettingsOrder::NELEMS); ++i) {
|
||||
s.setValue(kSettingsGroupEnable[i], checkboxes_[i]->isChecked());
|
||||
}
|
||||
s.setValue("font_headline", ui_->font_headline->currentFont().family());
|
||||
|
||||
@@ -42,7 +42,7 @@ class ContextSettingsPage : public SettingsPage {
|
||||
explicit ContextSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
|
||||
~ContextSettingsPage() override;
|
||||
|
||||
enum ContextSettingsOrder {
|
||||
enum class ContextSettingsOrder {
|
||||
ALBUM,
|
||||
ENGINE_AND_DEVICE,
|
||||
TECHNICAL_DATA,
|
||||
@@ -55,7 +55,7 @@ class ContextSettingsPage : public SettingsPage {
|
||||
static const char *kSettingsGroup;
|
||||
static const char *kSettingsTitleFmt;
|
||||
static const char *kSettingsSummaryFmt;
|
||||
static const char *kSettingsGroupEnable[ContextSettingsOrder::NELEMS];
|
||||
static const char *kSettingsGroupEnable[static_cast<int>(ContextSettingsOrder::NELEMS)];
|
||||
static const qreal kDefaultFontSizeHeadline;
|
||||
|
||||
void Load() override;
|
||||
@@ -70,7 +70,7 @@ class ContextSettingsPage : public SettingsPage {
|
||||
|
||||
private:
|
||||
Ui_ContextSettingsPage *ui_;
|
||||
QCheckBox *checkboxes_[ContextSettingsOrder::NELEMS] {};
|
||||
QCheckBox *checkboxes_[static_cast<int>(ContextSettingsOrder::NELEMS)] {};
|
||||
};
|
||||
|
||||
#endif // CONTEXTSETTINGSPAGE_H
|
||||
|
||||
@@ -131,7 +131,7 @@ void CoversSettingsPage::CurrentItemChanged(QListWidgetItem *item_current, QList
|
||||
ui_->label_auth_info->setText(tr("Use Qobuz settings to authenticate."));
|
||||
}
|
||||
else {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
@@ -201,7 +201,7 @@ void CoversSettingsPage::NoProviderSelected() {
|
||||
|
||||
void CoversSettingsPage::DisableAuthentication() {
|
||||
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(false);
|
||||
ui_->login_state->hide();
|
||||
ui_->button_authenticate->hide();
|
||||
@@ -221,7 +221,7 @@ void CoversSettingsPage::AuthenticateClicked() {
|
||||
CoverProvider *provider = dialog()->app()->cover_providers()->ProviderByName(ui_->providers->currentItem()->text());
|
||||
if (!provider) return;
|
||||
ui_->button_authenticate->setEnabled(false);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoginInProgress);
|
||||
QObject::connect(provider, &CoverProvider::AuthenticationFailure, this, &CoversSettingsPage::AuthenticationFailure);
|
||||
QObject::connect(provider, &CoverProvider::AuthenticationSuccess, this, &CoversSettingsPage::AuthenticationSuccess);
|
||||
provider->Authenticate();
|
||||
@@ -245,7 +245,7 @@ void CoversSettingsPage::LogoutClicked() {
|
||||
}
|
||||
else {
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -258,7 +258,7 @@ void CoversSettingsPage::AuthenticationSuccess() {
|
||||
|
||||
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
|
||||
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedIn);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
|
||||
}
|
||||
@@ -273,7 +273,7 @@ void CoversSettingsPage::AuthenticationFailure(const QStringList &errors) {
|
||||
|
||||
QMessageBox::warning(this, tr("Authentication failed"), errors.join("\n"));
|
||||
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ void LyricsSettingsPage::CurrentItemChanged(QListWidgetItem *item_current, QList
|
||||
LyricsProvider *provider = dialog()->app()->lyrics_providers()->ProviderByName(item_current->text());
|
||||
if (provider) {
|
||||
if (provider->AuthenticationRequired()) {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
@@ -191,7 +191,7 @@ void LyricsSettingsPage::NoProviderSelected() {
|
||||
|
||||
void LyricsSettingsPage::DisableAuthentication() {
|
||||
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(false);
|
||||
ui_->login_state->hide();
|
||||
ui_->button_authenticate->hide();
|
||||
@@ -211,7 +211,7 @@ void LyricsSettingsPage::AuthenticateClicked() {
|
||||
LyricsProvider *provider = dialog()->app()->lyrics_providers()->ProviderByName(ui_->providers->currentItem()->text());
|
||||
if (!provider) return;
|
||||
ui_->button_authenticate->setEnabled(false);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoginInProgress);
|
||||
QObject::connect(provider, &LyricsProvider::AuthenticationFailure, this, &LyricsSettingsPage::AuthenticationFailure);
|
||||
QObject::connect(provider, &LyricsProvider::AuthenticationSuccess, this, &LyricsSettingsPage::AuthenticationSuccess);
|
||||
provider->Authenticate();
|
||||
@@ -226,7 +226,7 @@ void LyricsSettingsPage::LogoutClicked() {
|
||||
provider->Deauthenticate();
|
||||
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ void LyricsSettingsPage::AuthenticationSuccess() {
|
||||
|
||||
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
|
||||
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedIn);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
|
||||
}
|
||||
@@ -253,7 +253,7 @@ void LyricsSettingsPage::AuthenticationFailure(const QStringList &errors) {
|
||||
|
||||
QMessageBox::warning(this, tr("Authentication failed"), errors.join("\n"));
|
||||
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ void MoodbarSettingsPage::InitMoodbarPreviews() {
|
||||
file.close();
|
||||
|
||||
// Render and set each preview
|
||||
for (int i = 0; i < MoodbarRenderer::StyleCount; ++i) {
|
||||
for (int i = 0; i < static_cast<int>(MoodbarRenderer::MoodbarStyle::StyleCount); ++i) {
|
||||
|
||||
const MoodbarRenderer::MoodbarStyle style = static_cast<MoodbarRenderer::MoodbarStyle>(i);
|
||||
const ColorVector colors = MoodbarRenderer::Colors(file_data, style, palette());
|
||||
|
||||
@@ -56,18 +56,17 @@ void NetworkProxySettingsPage::Load() {
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(NetworkProxyFactory::kSettingsGroup);
|
||||
NetworkProxyFactory::Mode mode = NetworkProxyFactory::Mode(s.value("mode", NetworkProxyFactory::Mode_System).toInt());
|
||||
const NetworkProxyFactory::Mode mode = static_cast<NetworkProxyFactory::Mode>(s.value("mode", static_cast<int>(NetworkProxyFactory::Mode::System)).toInt());
|
||||
switch (mode) {
|
||||
case NetworkProxyFactory::Mode_Manual:
|
||||
case NetworkProxyFactory::Mode::Manual:
|
||||
ui_->proxy_manual->setChecked(true);
|
||||
break;
|
||||
|
||||
case NetworkProxyFactory::Mode_Direct:
|
||||
case NetworkProxyFactory::Mode::Direct:
|
||||
ui_->proxy_direct->setChecked(true);
|
||||
break;
|
||||
|
||||
case NetworkProxyFactory::Mode_System:
|
||||
default:
|
||||
case NetworkProxyFactory::Mode::System:
|
||||
ui_->proxy_system->setChecked(true);
|
||||
break;
|
||||
}
|
||||
@@ -91,13 +90,13 @@ void NetworkProxySettingsPage::Save() {
|
||||
|
||||
QSettings s;
|
||||
|
||||
NetworkProxyFactory::Mode mode = NetworkProxyFactory::Mode_System;
|
||||
if (ui_->proxy_direct->isChecked()) mode = NetworkProxyFactory::Mode_Direct;
|
||||
else if (ui_->proxy_system->isChecked()) mode = NetworkProxyFactory::Mode_System;
|
||||
else if (ui_->proxy_manual->isChecked()) mode = NetworkProxyFactory::Mode_Manual;
|
||||
NetworkProxyFactory::Mode mode = NetworkProxyFactory::Mode::System;
|
||||
if (ui_->proxy_direct->isChecked()) mode = NetworkProxyFactory::Mode::Direct;
|
||||
else if (ui_->proxy_system->isChecked()) mode = NetworkProxyFactory::Mode::System;
|
||||
else if (ui_->proxy_manual->isChecked()) mode = NetworkProxyFactory::Mode::Manual;
|
||||
|
||||
s.beginGroup(NetworkProxyFactory::kSettingsGroup);
|
||||
s.setValue("mode", mode);
|
||||
s.setValue("mode", static_cast<int>(mode));
|
||||
s.setValue("type", ui_->proxy_type->currentIndex() == 0 ? QNetworkProxy::HttpProxy : QNetworkProxy::Socks5Proxy);
|
||||
s.setValue("hostname", ui_->proxy_hostname->text());
|
||||
s.setValue("port", ui_->proxy_port->value());
|
||||
|
||||
@@ -59,7 +59,7 @@ class QShowEvent;
|
||||
NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
||||
: SettingsPage(dialog, parent),
|
||||
ui_(new Ui_NotificationsSettingsPage),
|
||||
pretty_popup_(new OSDPretty(OSDPretty::Mode_Draggable)) {
|
||||
pretty_popup_(new OSDPretty(OSDPretty::Mode::Draggable)) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("help-hint", true, 0, 32));
|
||||
@@ -154,9 +154,9 @@ void NotificationsSettingsPage::Load() {
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(OSDBase::kSettingsGroup);
|
||||
OSDBase::Behaviour osd_behaviour = OSDBase::Behaviour(s.value("Behaviour", OSDBase::Native).toInt());
|
||||
const OSDBase::Behaviour osd_behaviour = static_cast<OSDBase::Behaviour>(s.value("Behaviour", static_cast<int>(OSDBase::Behaviour::Native)).toInt());
|
||||
switch (osd_behaviour) {
|
||||
case OSDBase::Native:
|
||||
case OSDBase::Behaviour::Native:
|
||||
#ifdef Q_OS_WIN32
|
||||
if (dialog()->osd()->SupportsNativeNotifications() || dialog()->osd()->SupportsTrayPopups()) {
|
||||
#else
|
||||
@@ -167,18 +167,18 @@ void NotificationsSettingsPage::Load() {
|
||||
}
|
||||
// Fallthrough
|
||||
|
||||
case OSDBase::Pretty:
|
||||
case OSDBase::Behaviour::Pretty:
|
||||
ui_->notifications_pretty->setChecked(true);
|
||||
break;
|
||||
|
||||
case OSDBase::TrayPopup:
|
||||
case OSDBase::Behaviour::TrayPopup:
|
||||
if (dialog()->osd()->SupportsTrayPopups()) {
|
||||
ui_->notifications_tray->setChecked(true);
|
||||
break;
|
||||
}
|
||||
// Fallthrough
|
||||
|
||||
case OSDBase::Disabled:
|
||||
case OSDBase::Behaviour::Disabled:
|
||||
default:
|
||||
ui_->notifications_none->setChecked(true);
|
||||
break;
|
||||
@@ -229,11 +229,11 @@ void NotificationsSettingsPage::Save() {
|
||||
|
||||
QSettings s;
|
||||
|
||||
OSDBase::Behaviour osd_behaviour = OSDBase::Disabled;
|
||||
if (ui_->notifications_none->isChecked()) osd_behaviour = OSDBase::Disabled;
|
||||
else if (ui_->notifications_native->isChecked()) osd_behaviour = OSDBase::Native;
|
||||
else if (ui_->notifications_tray->isChecked()) osd_behaviour = OSDBase::TrayPopup;
|
||||
else if (ui_->notifications_pretty->isChecked()) osd_behaviour = OSDBase::Pretty;
|
||||
OSDBase::Behaviour osd_behaviour = OSDBase::Behaviour::Disabled;
|
||||
if (ui_->notifications_none->isChecked()) osd_behaviour = OSDBase::Behaviour::Disabled;
|
||||
else if (ui_->notifications_native->isChecked()) osd_behaviour = OSDBase::Behaviour::Native;
|
||||
else if (ui_->notifications_tray->isChecked()) osd_behaviour = OSDBase::Behaviour::TrayPopup;
|
||||
else if (ui_->notifications_pretty->isChecked()) osd_behaviour = OSDBase::Behaviour::Pretty;
|
||||
|
||||
s.beginGroup(OSDBase::kSettingsGroup);
|
||||
s.setValue("Behaviour", static_cast<int>(osd_behaviour));
|
||||
@@ -345,15 +345,15 @@ void NotificationsSettingsPage::NotificationCustomTextChanged(bool enabled) {
|
||||
|
||||
void NotificationsSettingsPage::PrepareNotificationPreview() {
|
||||
|
||||
OSDBase::Behaviour notificationType = OSDBase::Disabled;
|
||||
OSDBase::Behaviour notificationType = OSDBase::Behaviour::Disabled;
|
||||
if (ui_->notifications_native->isChecked()) {
|
||||
notificationType = OSDBase::Native;
|
||||
notificationType = OSDBase::Behaviour::Native;
|
||||
}
|
||||
else if (ui_->notifications_pretty->isChecked()) {
|
||||
notificationType = OSDBase::Pretty;
|
||||
notificationType = OSDBase::Behaviour::Pretty;
|
||||
}
|
||||
else if (ui_->notifications_tray->isChecked()) {
|
||||
notificationType = OSDBase::TrayPopup;
|
||||
notificationType = OSDBase::Behaviour::TrayPopup;
|
||||
}
|
||||
|
||||
// If user changes timeout or other options, that won't be reflected in the preview
|
||||
|
||||
@@ -76,18 +76,18 @@ void PlaylistSettingsPage::Load() {
|
||||
ui_->checkbox_playlist_clear->setChecked(s.value("playlist_clear", true).toBool());
|
||||
ui_->checkbox_auto_sort->setChecked(s.value("auto_sort", false).toBool());
|
||||
|
||||
PathType path_type = PathType(s.value("path_type", PathType_Automatic).toInt());
|
||||
const PathType path_type = static_cast<PathType>(s.value("path_type", static_cast<int>(PathType::Automatic)).toInt());
|
||||
switch (path_type) {
|
||||
case PathType_Automatic:
|
||||
case PathType::Automatic:
|
||||
ui_->radiobutton_automaticpath->setChecked(true);
|
||||
break;
|
||||
case PathType_Absolute:
|
||||
case PathType::Absolute:
|
||||
ui_->radiobutton_absolutepath->setChecked(true);
|
||||
break;
|
||||
case PathType_Relative:
|
||||
case PathType::Relative:
|
||||
ui_->radiobutton_relativepath->setChecked(true);
|
||||
break;
|
||||
case PathType_Ask_User:
|
||||
case PathType::Ask_User:
|
||||
ui_->radiobutton_askpath->setChecked(true);
|
||||
}
|
||||
|
||||
@@ -111,18 +111,18 @@ void PlaylistSettingsPage::Load() {
|
||||
|
||||
void PlaylistSettingsPage::Save() {
|
||||
|
||||
PathType path_type = PathType_Automatic;
|
||||
PathType path_type = PathType::Automatic;
|
||||
if (ui_->radiobutton_automaticpath->isChecked()) {
|
||||
path_type = PathType_Automatic;
|
||||
path_type = PathType::Automatic;
|
||||
}
|
||||
else if (ui_->radiobutton_absolutepath->isChecked()) {
|
||||
path_type = PathType_Absolute;
|
||||
path_type = PathType::Absolute;
|
||||
}
|
||||
else if (ui_->radiobutton_relativepath->isChecked()) {
|
||||
path_type = PathType_Relative;
|
||||
path_type = PathType::Relative;
|
||||
}
|
||||
else if (ui_->radiobutton_askpath->isChecked()) {
|
||||
path_type = PathType_Ask_User;
|
||||
path_type = PathType::Ask_User;
|
||||
}
|
||||
|
||||
QSettings s;
|
||||
|
||||
@@ -41,11 +41,11 @@ class PlaylistSettingsPage : public SettingsPage {
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
enum PathType {
|
||||
PathType_Automatic = 0, // Automatically select path type
|
||||
PathType_Absolute, // Always use absolute paths
|
||||
PathType_Relative, // Always use relative paths
|
||||
PathType_Ask_User, // Only used in preferences: to ask user which of the previous values he wants to use.
|
||||
enum class PathType {
|
||||
Automatic = 0, // Automatically select path type
|
||||
Absolute, // Always use absolute paths
|
||||
Relative, // Always use relative paths
|
||||
Ask_User // Only used in preferences: to ask user which of the previous values he wants to use.
|
||||
};
|
||||
|
||||
void Load() override;
|
||||
|
||||
@@ -94,7 +94,7 @@ void QobuzSettingsPage::Load() {
|
||||
|
||||
s.endGroup();
|
||||
|
||||
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedIn);
|
||||
|
||||
Init(ui_->layout_qobuzsettingspage->parentWidget());
|
||||
|
||||
@@ -157,7 +157,7 @@ bool QobuzSettingsPage::eventFilter(QObject *object, QEvent *event) {
|
||||
void QobuzSettingsPage::LogoutClicked() {
|
||||
|
||||
service_->Logout();
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
ui_->button_login->setEnabled(true);
|
||||
|
||||
}
|
||||
@@ -165,7 +165,7 @@ void QobuzSettingsPage::LogoutClicked() {
|
||||
void QobuzSettingsPage::LoginSuccess() {
|
||||
|
||||
if (!isVisible()) return;
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedIn);
|
||||
ui_->button_login->setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -99,17 +99,17 @@ void ScrobblerSettingsPage::Load() {
|
||||
ui_->checkbox_albumartist->setChecked(scrobbler_->PreferAlbumArtist());
|
||||
ui_->checkbox_show_error_dialog->setChecked(scrobbler_->ShowErrorDialog());
|
||||
|
||||
ui_->checkbox_source_collection->setChecked(scrobbler_->sources().contains(Song::Source_Collection));
|
||||
ui_->checkbox_source_local->setChecked(scrobbler_->sources().contains(Song::Source_LocalFile));
|
||||
ui_->checkbox_source_cdda->setChecked(scrobbler_->sources().contains(Song::Source_CDDA));
|
||||
ui_->checkbox_source_device->setChecked(scrobbler_->sources().contains(Song::Source_Device));
|
||||
ui_->checkbox_source_subsonic->setChecked(scrobbler_->sources().contains(Song::Source_Subsonic));
|
||||
ui_->checkbox_source_tidal->setChecked(scrobbler_->sources().contains(Song::Source_Tidal));
|
||||
ui_->checkbox_source_qobuz->setChecked(scrobbler_->sources().contains(Song::Source_Qobuz));
|
||||
ui_->checkbox_source_stream->setChecked(scrobbler_->sources().contains(Song::Source_Stream));
|
||||
ui_->checkbox_source_somafm->setChecked(scrobbler_->sources().contains(Song::Source_SomaFM));
|
||||
ui_->checkbox_source_radioparadise->setChecked(scrobbler_->sources().contains(Song::Source_RadioParadise));
|
||||
ui_->checkbox_source_unknown->setChecked(scrobbler_->sources().contains(Song::Source_Unknown));
|
||||
ui_->checkbox_source_collection->setChecked(scrobbler_->sources().contains(Song::Source::Collection));
|
||||
ui_->checkbox_source_local->setChecked(scrobbler_->sources().contains(Song::Source::LocalFile));
|
||||
ui_->checkbox_source_cdda->setChecked(scrobbler_->sources().contains(Song::Source::CDDA));
|
||||
ui_->checkbox_source_device->setChecked(scrobbler_->sources().contains(Song::Source::Device));
|
||||
ui_->checkbox_source_subsonic->setChecked(scrobbler_->sources().contains(Song::Source::Subsonic));
|
||||
ui_->checkbox_source_tidal->setChecked(scrobbler_->sources().contains(Song::Source::Tidal));
|
||||
ui_->checkbox_source_qobuz->setChecked(scrobbler_->sources().contains(Song::Source::Qobuz));
|
||||
ui_->checkbox_source_stream->setChecked(scrobbler_->sources().contains(Song::Source::Stream));
|
||||
ui_->checkbox_source_somafm->setChecked(scrobbler_->sources().contains(Song::Source::SomaFM));
|
||||
ui_->checkbox_source_radioparadise->setChecked(scrobbler_->sources().contains(Song::Source::RadioParadise));
|
||||
ui_->checkbox_source_unknown->setChecked(scrobbler_->sources().contains(Song::Source::Unknown));
|
||||
|
||||
ui_->checkbox_lastfm_enable->setChecked(lastfmscrobbler_->IsEnabled());
|
||||
ui_->checkbox_lastfm_https->setChecked(lastfmscrobbler_->IsUseHTTPS());
|
||||
@@ -142,17 +142,17 @@ void ScrobblerSettingsPage::Save() {
|
||||
s.setValue("show_error_dialog", ui_->checkbox_show_error_dialog->isChecked());
|
||||
|
||||
QStringList sources;
|
||||
if (ui_->checkbox_source_collection->isChecked()) sources << Song::TextForSource(Song::Source_Collection);
|
||||
if (ui_->checkbox_source_local->isChecked()) sources << Song::TextForSource(Song::Source_LocalFile);
|
||||
if (ui_->checkbox_source_cdda->isChecked()) sources << Song::TextForSource(Song::Source_CDDA);
|
||||
if (ui_->checkbox_source_device->isChecked()) sources << Song::TextForSource(Song::Source_Device);
|
||||
if (ui_->checkbox_source_subsonic->isChecked()) sources << Song::TextForSource(Song::Source_Subsonic);
|
||||
if (ui_->checkbox_source_tidal->isChecked()) sources << Song::TextForSource(Song::Source_Tidal);
|
||||
if (ui_->checkbox_source_qobuz->isChecked()) sources << Song::TextForSource(Song::Source_Qobuz);
|
||||
if (ui_->checkbox_source_stream->isChecked()) sources << Song::TextForSource(Song::Source_Stream);
|
||||
if (ui_->checkbox_source_somafm->isChecked()) sources << Song::TextForSource(Song::Source_SomaFM);
|
||||
if (ui_->checkbox_source_radioparadise->isChecked()) sources << Song::TextForSource(Song::Source_RadioParadise);
|
||||
if (ui_->checkbox_source_unknown->isChecked()) sources << Song::TextForSource(Song::Source_Unknown);
|
||||
if (ui_->checkbox_source_collection->isChecked()) sources << Song::TextForSource(Song::Source::Collection);
|
||||
if (ui_->checkbox_source_local->isChecked()) sources << Song::TextForSource(Song::Source::LocalFile);
|
||||
if (ui_->checkbox_source_cdda->isChecked()) sources << Song::TextForSource(Song::Source::CDDA);
|
||||
if (ui_->checkbox_source_device->isChecked()) sources << Song::TextForSource(Song::Source::Device);
|
||||
if (ui_->checkbox_source_subsonic->isChecked()) sources << Song::TextForSource(Song::Source::Subsonic);
|
||||
if (ui_->checkbox_source_tidal->isChecked()) sources << Song::TextForSource(Song::Source::Tidal);
|
||||
if (ui_->checkbox_source_qobuz->isChecked()) sources << Song::TextForSource(Song::Source::Qobuz);
|
||||
if (ui_->checkbox_source_stream->isChecked()) sources << Song::TextForSource(Song::Source::Stream);
|
||||
if (ui_->checkbox_source_somafm->isChecked()) sources << Song::TextForSource(Song::Source::SomaFM);
|
||||
if (ui_->checkbox_source_radioparadise->isChecked()) sources << Song::TextForSource(Song::Source::RadioParadise);
|
||||
if (ui_->checkbox_source_unknown->isChecked()) sources << Song::TextForSource(Song::Source::Unknown);
|
||||
|
||||
s.setValue("sources", sources);
|
||||
|
||||
@@ -179,7 +179,7 @@ void ScrobblerSettingsPage::Save() {
|
||||
void ScrobblerSettingsPage::LastFM_Login() {
|
||||
|
||||
lastfm_waiting_for_auth_ = true;
|
||||
ui_->widget_lastfm_login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
ui_->widget_lastfm_login_state->SetLoggedIn(LoginStateWidget::State::LoginInProgress);
|
||||
lastfmscrobbler_->Authenticate(ui_->checkbox_lastfm_https->isChecked());
|
||||
|
||||
}
|
||||
@@ -208,13 +208,13 @@ void ScrobblerSettingsPage::LastFM_AuthenticationComplete(const bool success, co
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::LastFM_RefreshControls(const bool authenticated) {
|
||||
ui_->widget_lastfm_login_state->SetLoggedIn(authenticated ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut, lastfmscrobbler_->username());
|
||||
ui_->widget_lastfm_login_state->SetLoggedIn(authenticated ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut, lastfmscrobbler_->username());
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::LibreFM_Login() {
|
||||
|
||||
librefm_waiting_for_auth_ = true;
|
||||
ui_->widget_librefm_login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
ui_->widget_librefm_login_state->SetLoggedIn(LoginStateWidget::State::LoginInProgress);
|
||||
librefmscrobbler_->Authenticate();
|
||||
|
||||
}
|
||||
@@ -243,13 +243,13 @@ void ScrobblerSettingsPage::LibreFM_AuthenticationComplete(const bool success, c
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::LibreFM_RefreshControls(const bool authenticated) {
|
||||
ui_->widget_librefm_login_state->SetLoggedIn(authenticated ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut, librefmscrobbler_->username());
|
||||
ui_->widget_librefm_login_state->SetLoggedIn(authenticated ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut, librefmscrobbler_->username());
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::ListenBrainz_Login() {
|
||||
|
||||
listenbrainz_waiting_for_auth_ = true;
|
||||
ui_->widget_listenbrainz_login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
ui_->widget_listenbrainz_login_state->SetLoggedIn(LoginStateWidget::State::LoginInProgress);
|
||||
listenbrainzscrobbler_->Authenticate();
|
||||
|
||||
}
|
||||
@@ -278,5 +278,5 @@ void ScrobblerSettingsPage::ListenBrainz_AuthenticationComplete(const bool succe
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::ListenBrainz_RefreshControls(const bool authenticated) {
|
||||
ui_->widget_listenbrainz_login_state->SetLoggedIn(authenticated ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->widget_listenbrainz_login_state->SetLoggedIn(authenticated ? LoginStateWidget::State::LoggedIn : LoginStateWidget::State::LoggedOut);
|
||||
}
|
||||
|
||||
@@ -129,29 +129,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, 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);
|
||||
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, this), general);
|
||||
AddPage(Page::Transcoding, new TranscoderSettingsPage(this, this), general);
|
||||
#endif
|
||||
AddPage(Page_Proxy, new NetworkProxySettingsPage(this, this), general);
|
||||
AddPage(Page::Proxy, new NetworkProxySettingsPage(this, this), general);
|
||||
|
||||
QTreeWidgetItem *iface = AddCategory(tr("User interface"));
|
||||
AddPage(Page_Appearance, new AppearanceSettingsPage(this, this), iface);
|
||||
AddPage(Page_Context, new ContextSettingsPage(this, this), iface);
|
||||
AddPage(Page_Notifications, new NotificationsSettingsPage(this, 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, this), iface);
|
||||
AddPage(Page::GlobalShortcuts, new GlobalShortcutsSettingsPage(this, this), iface);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MOODBAR
|
||||
AddPage(Page_Moodbar, new MoodbarSettingsPage(this, this), iface);
|
||||
AddPage(Page::Moodbar, new MoodbarSettingsPage(this, this), iface);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SUBSONIC) || defined(HAVE_TIDAL) || defined(HAVE_QOBUZ)
|
||||
@@ -159,18 +159,18 @@ SettingsDialog::SettingsDialog(Application *app, OSDBase *osd, QMainWindow *main
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SUBSONIC
|
||||
AddPage(Page_Subsonic, new SubsonicSettingsPage(this, this), streaming);
|
||||
AddPage(Page::Subsonic, new SubsonicSettingsPage(this, this), streaming);
|
||||
#endif
|
||||
#ifdef HAVE_TIDAL
|
||||
AddPage(Page_Tidal, new TidalSettingsPage(this, this), streaming);
|
||||
AddPage(Page::Tidal, new TidalSettingsPage(this, this), streaming);
|
||||
#endif
|
||||
#ifdef HAVE_QOBUZ
|
||||
AddPage(Page_Qobuz, new QobuzSettingsPage(this, this), streaming);
|
||||
AddPage(Page::Qobuz, new QobuzSettingsPage(this, this), streaming);
|
||||
#endif
|
||||
|
||||
// List box
|
||||
QObject::connect(ui_->list, &QTreeWidget::currentItemChanged, this, &SettingsDialog::CurrentItemChanged);
|
||||
ui_->list->setCurrentItem(pages_[Page_Behaviour].item_);
|
||||
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)); // clazy:exclude=unneeded-cast
|
||||
|
||||
@@ -74,25 +74,25 @@ class SettingsDialog : public QDialog {
|
||||
explicit SettingsDialog(Application *app, OSDBase *osd, QMainWindow *mainwindow, QWidget *parent = nullptr);
|
||||
~SettingsDialog() override;
|
||||
|
||||
enum Page {
|
||||
Page_Behaviour,
|
||||
Page_Collection,
|
||||
Page_Backend,
|
||||
Page_Playback,
|
||||
Page_Playlist,
|
||||
Page_Scrobbler,
|
||||
Page_Covers,
|
||||
Page_Lyrics,
|
||||
Page_Transcoding,
|
||||
Page_Proxy,
|
||||
Page_Appearance,
|
||||
Page_Context,
|
||||
Page_Notifications,
|
||||
Page_GlobalShortcuts,
|
||||
Page_Moodbar,
|
||||
Page_Subsonic,
|
||||
Page_Tidal,
|
||||
Page_Qobuz,
|
||||
enum class Page {
|
||||
Behaviour,
|
||||
Collection,
|
||||
Backend,
|
||||
Playback,
|
||||
Playlist,
|
||||
Scrobbler,
|
||||
Covers,
|
||||
Lyrics,
|
||||
Transcoding,
|
||||
Proxy,
|
||||
Appearance,
|
||||
Context,
|
||||
Notifications,
|
||||
GlobalShortcuts,
|
||||
Moodbar,
|
||||
Subsonic,
|
||||
Tidal,
|
||||
Qobuz,
|
||||
};
|
||||
|
||||
enum Role {
|
||||
|
||||
@@ -84,12 +84,12 @@ void SubsonicSettingsPage::Load() {
|
||||
ui_->checkbox_download_album_covers->setChecked(s.value("downloadalbumcovers", true).toBool());
|
||||
ui_->checkbox_server_scrobbling->setChecked(s.value("serversidescrobbling", false).toBool());
|
||||
|
||||
AuthMethod auth_method = static_cast<AuthMethod>(s.value("authmethod", AuthMethod_MD5).toInt());
|
||||
const AuthMethod auth_method = static_cast<AuthMethod>(s.value("authmethod", static_cast<int>(AuthMethod::MD5)).toInt());
|
||||
switch (auth_method) {
|
||||
case AuthMethod_Hex:
|
||||
case AuthMethod::Hex:
|
||||
ui_->auth_method_hex->setChecked(true);
|
||||
break;
|
||||
case AuthMethod_MD5:
|
||||
case AuthMethod::MD5:
|
||||
ui_->auth_method_md5->setChecked(true);
|
||||
break;
|
||||
}
|
||||
@@ -115,10 +115,10 @@ void SubsonicSettingsPage::Save() {
|
||||
s.setValue("downloadalbumcovers", ui_->checkbox_download_album_covers->isChecked());
|
||||
s.setValue("serversidescrobbling", ui_->checkbox_server_scrobbling->isChecked());
|
||||
if (ui_->auth_method_hex->isChecked()) {
|
||||
s.setValue("authmethod", AuthMethod_Hex);
|
||||
s.setValue("authmethod", static_cast<int>(AuthMethod::Hex));
|
||||
}
|
||||
else {
|
||||
s.setValue("authmethod", AuthMethod_MD5);
|
||||
s.setValue("authmethod", static_cast<int>(AuthMethod::MD5));
|
||||
}
|
||||
s.endGroup();
|
||||
|
||||
@@ -137,7 +137,7 @@ void SubsonicSettingsPage::TestClicked() {
|
||||
return;
|
||||
}
|
||||
|
||||
emit Test(server_url, ui_->username->text(), ui_->password->text(), ui_->auth_method_hex->isChecked() ? AuthMethod_Hex : AuthMethod_MD5);
|
||||
emit Test(server_url, ui_->username->text(), ui_->password->text(), ui_->auth_method_hex->isChecked() ? AuthMethod::Hex : AuthMethod::MD5);
|
||||
ui_->button_test->setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ class SubsonicSettingsPage : public SettingsPage {
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
enum AuthMethod {
|
||||
AuthMethod_Hex,
|
||||
AuthMethod_MD5
|
||||
enum class AuthMethod {
|
||||
Hex,
|
||||
MD5
|
||||
};
|
||||
|
||||
void Load() override;
|
||||
|
||||
@@ -73,9 +73,9 @@ TidalSettingsPage::TidalSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
||||
ui_->coversize->addItem("750x750", "750x750");
|
||||
ui_->coversize->addItem("1280x1280", "1280x1280");
|
||||
|
||||
ui_->streamurl->addItem("streamurl", StreamUrlMethod_StreamUrl);
|
||||
ui_->streamurl->addItem("urlpostpaywall", StreamUrlMethod_UrlPostPaywall);
|
||||
ui_->streamurl->addItem("playbackinfopostpaywall", StreamUrlMethod_PlaybackInfoPostPaywall);
|
||||
ui_->streamurl->addItem("streamurl", static_cast<int>(StreamUrlMethod::StreamUrl));
|
||||
ui_->streamurl->addItem("urlpostpaywall", static_cast<int>(StreamUrlMethod::UrlPostPaywall));
|
||||
ui_->streamurl->addItem("playbackinfopostpaywall", static_cast<int>(StreamUrlMethod::PlaybackInfoPostPaywall));
|
||||
|
||||
}
|
||||
|
||||
@@ -104,18 +104,13 @@ void TidalSettingsPage::Load() {
|
||||
ui_->checkbox_fetchalbums->setChecked(s.value("fetchalbums", false).toBool());
|
||||
ui_->checkbox_download_album_covers->setChecked(s.value("downloadalbumcovers", true).toBool());
|
||||
ComboBoxLoadFromSettings(s, ui_->coversize, "coversize", "640x640");
|
||||
|
||||
StreamUrlMethod stream_url = static_cast<StreamUrlMethod>(s.value("streamurl").toInt());
|
||||
int i = ui_->streamurl->findData(stream_url);
|
||||
if (i == -1) i = ui_->streamurl->findData(StreamUrlMethod_StreamUrl);
|
||||
ui_->streamurl->setCurrentIndex(i);
|
||||
|
||||
ui_->streamurl->setCurrentIndex(ui_->streamurl->findData(s.value("streamurl", static_cast<int>(StreamUrlMethod::StreamUrl)).toInt()));
|
||||
ui_->checkbox_album_explicit->setChecked(s.value("album_explicit", false).toBool());
|
||||
|
||||
s.endGroup();
|
||||
|
||||
OAuthClicked(ui_->oauth->isChecked());
|
||||
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedIn);
|
||||
|
||||
Init(ui_->layout_tidalsettingspage->parentWidget());
|
||||
|
||||
@@ -135,15 +130,15 @@ void TidalSettingsPage::Save() {
|
||||
s.setValue("username", ui_->username->text());
|
||||
s.setValue("password", QString::fromUtf8(ui_->password->text().toUtf8().toBase64()));
|
||||
|
||||
s.setValue("quality", ui_->quality->itemData(ui_->quality->currentIndex()));
|
||||
s.setValue("quality", ui_->quality->currentData().toString());
|
||||
s.setValue("searchdelay", ui_->searchdelay->value());
|
||||
s.setValue("artistssearchlimit", ui_->artistssearchlimit->value());
|
||||
s.setValue("albumssearchlimit", ui_->albumssearchlimit->value());
|
||||
s.setValue("songssearchlimit", ui_->songssearchlimit->value());
|
||||
s.setValue("fetchalbums", ui_->checkbox_fetchalbums->isChecked());
|
||||
s.setValue("downloadalbumcovers", ui_->checkbox_download_album_covers->isChecked());
|
||||
s.setValue("coversize", ui_->coversize->itemData(ui_->coversize->currentIndex()));
|
||||
s.setValue("streamurl", ui_->streamurl->itemData(ui_->streamurl->currentIndex()));
|
||||
s.setValue("coversize", ui_->coversize->currentData().toString());
|
||||
s.setValue("streamurl", ui_->streamurl->currentData().toInt());
|
||||
s.setValue("album_explicit", ui_->checkbox_album_explicit->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
@@ -200,14 +195,14 @@ void TidalSettingsPage::LogoutClicked() {
|
||||
|
||||
service_->Logout();
|
||||
ui_->button_login->setEnabled(true);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
|
||||
|
||||
}
|
||||
|
||||
void TidalSettingsPage::LoginSuccess() {
|
||||
|
||||
if (!isVisible()) return;
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedIn);
|
||||
ui_->button_login->setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ class TidalSettingsPage : public SettingsPage {
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
enum StreamUrlMethod {
|
||||
StreamUrlMethod_StreamUrl,
|
||||
StreamUrlMethod_UrlPostPaywall,
|
||||
StreamUrlMethod_PlaybackInfoPostPaywall,
|
||||
enum class StreamUrlMethod {
|
||||
StreamUrl,
|
||||
UrlPostPaywall,
|
||||
PlaybackInfoPostPaywall
|
||||
};
|
||||
|
||||
void Load() override;
|
||||
|
||||
Reference in New Issue
Block a user