1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-01-16 02:40:50 +01:00

Remove obsolete xine warning and engine reinitialization

This commit is contained in:
Jonas Kvinge 2018-11-04 21:23:34 +01:00
parent f38ffb505d
commit 4197a508a3
4 changed files with 1 additions and 36 deletions

View File

@ -78,7 +78,6 @@ void BackendSettingsPage::Load() {
configloaded_ = false;
engineloaded_ = false;
xinewarning_ = false;
Engine::EngineType enginetype = Engine::EngineTypeFromName(s_.value("engine", EngineName(Engine::None)).toString());
if (enginetype == Engine::None && engine()) enginetype = engine()->type();
@ -193,7 +192,6 @@ void BackendSettingsPage::Load_Engine(Engine::EngineType enginetype) {
qLog(Debug) << "Switching engine.";
Engine::EngineType new_enginetype = dialog()->app()->player()->CreateEngine(enginetype);
dialog()->app()->player()->Init();
dialog()->set_output_changed(false);
if (new_enginetype != enginetype) {
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(engine()->type()));
}
@ -373,10 +371,6 @@ void BackendSettingsPage::Save() {
else if (ui_->radiobutton_alsa_plughw->isChecked()) s_.setValue("alsaplugin", static_cast<int>(alsa_plugin::alsa_plughw));
else s_.remove("alsaplugin");
// If engine has not been changed, but output or device has been changed,
// then set_output_changed(true) to reinitialize engine when dialog closes.
if (enginetype == enginetype_current_ && (output_name != output_current_ || device_value != device_current_)) dialog()->set_output_changed(true);
}
void BackendSettingsPage::Cancel() {
@ -402,7 +396,6 @@ void BackendSettingsPage::EngineChanged(int index) {
}
engineloaded_ = false;
xinewarning_ = false;
ResetWarning();
Load_Engine(enginetype);
@ -415,8 +408,6 @@ void BackendSettingsPage::OutputChanged(int index) {
EngineBase::OutputDetails output = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
Load_Device(output.name, QVariant());
if (engine()->type() == Engine::Xine && engine()->state() != Engine::Empty) XineWarning();
}
void BackendSettingsPage::DeviceSelectionChanged(int index) {
@ -438,8 +429,6 @@ void BackendSettingsPage::DeviceSelectionChanged(int index) {
if (!ui_->lineedit_device->text().isEmpty()) ui_->lineedit_device->setText("");
}
if (engine()->type() == Engine::Xine && engine()->state() != Engine::Empty) XineWarning();
}
void BackendSettingsPage::DeviceStringChanged() {
@ -541,19 +530,6 @@ void BackendSettingsPage::ResetWarning() {
}
void BackendSettingsPage::XineWarning() {
if (!engineloaded_) return;
if (!configloaded_) return;
if (engine()->type() != Engine::Xine) return;
if (engine()->state() == Engine::Empty) return;
if (xinewarning_) return;
ShowWarning("You need to restart Strawberry for output/device changes to take affect for Xine.");
xinewarning_ = true;
}
void BackendSettingsPage::SwitchALSADevices(alsa_plugin alsaplugin) {
// All ALSA devices are listed twice, one for "hw" and one for "plughw"

View File

@ -91,7 +91,6 @@ private:
QSettings s_;
bool configloaded_;
bool engineloaded_;
bool xinewarning_;
ErrorDialog errordialog_;
Engine::EngineType enginetype_current_;

View File

@ -112,8 +112,7 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent)
model_(app_->collection_model()->directory_model()),
appearance_(app_->appearance()),
ui_(new Ui_SettingsDialog),
loading_settings_(false),
output_changed_(false) {
loading_settings_(false) {
ui_->setupUi(this);
ui_->list->setItemDelegate(new SettingsItemDelegate(this));
@ -221,11 +220,6 @@ void SettingsDialog::Save() {
void SettingsDialog::accept() {
Save();
// Only Xine needs to reinitialize to switch output and device.
if (output_changed_ && engine() && engine()->type() == Engine::Xine && engine()->state() == Engine::Empty) {
engine()->ReloadSettings();
engine()->Init();
}
QDialog::accept();
}

View File

@ -109,8 +109,6 @@ public:
// QWidget
void showEvent(QShowEvent *e);
void set_output_changed(bool output_changed) { output_changed_ = output_changed; }
void ComboBoxLoadFromSettings(QSettings &s, QComboBox *combobox, QString setting, QString default_value);
signals:
@ -144,8 +142,6 @@ private:
bool loading_settings_;
QMap<Page, PageData> pages_;
bool output_changed_;
};
#endif // SETTINGSDIALOG_H