added support for 3. Liga; fix resize bug
[buliscores] / src / src / settingsdialog.cpp
index 13b9277..5f73996 100644 (file)
@@ -9,20 +9,16 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
     settings(qApp->organizationName(), qApp->applicationName())
 {
     QString league;
+    int     index;
 
     ui->setupUi(this);
 
     league = settings.value("League", "1. Bundesliga").toString();
-    if (league == ui->rbBL1->text()) {
-        ui->rbBL1->setChecked(true);
-    } else if (league == ui->rbBL2->text()) {
-        ui->rbBL2->setChecked(true);
-    } else if (league == ui->rbT3BL->text()) {
-        ui->rbT3BL->setChecked(true);
+    if ((index = ui->cbLeague->findText(league)) != -1) {
+        ui->cbLeague->setCurrentIndex(index);
     } else {
-        ui->rbBL1->setChecked(true);
+        ui->cbLeague->setCurrentIndex(0);
     }
-
     ui->cbPlaySound->setChecked(settings.value("Sounds", false).toBool());
 
     connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onDlgAccepted()));
@@ -35,7 +31,7 @@ SettingsDialog::~SettingsDialog()
 
 void SettingsDialog::onDlgAccepted()
 {
-    settings.setValue("League", ui->buttonGroup->checkedButton()->text());
+    settings.setValue("League", ui->cbLeague->currentText());
     settings.setValue("Sounds", ui->cbPlaySound->isChecked());
     this->accept();
 }