From c60fd58ec9e3fb3977604443a7b0bedd41d43d94 Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 10 May 2008 20:41:00 +0000 Subject: [PATCH] small settingsdialog fixes --- src/gui/qt/settingsdialog.ui | 509 +++++------------- .../qt/settingsdialog/settingsdialogimpl.cpp | 49 +- 2 files changed, 187 insertions(+), 371 deletions(-) diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index aafdb352..b9fec5f1 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -78,11 +78,19 @@ 0 + + + 0 + 0 + 455 + 621 + + - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Interface @@ -116,7 +124,7 @@ Qt::Horizontal - + 40 20 @@ -223,10 +231,7 @@ 9 - - 6 - - + 6 @@ -234,16 +239,7 @@ 0 - - 0 - - - 0 - - - 0 - - + 0 @@ -251,16 +247,7 @@ 2 - - 0 - - - 0 - - - 0 - - + 0 @@ -331,7 +318,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 400 111 @@ -342,11 +329,19 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 455 + 621 + + - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Sound @@ -377,16 +372,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -471,7 +457,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 400 321 @@ -482,11 +468,19 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 100 + 30 + + - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Local Game Settings @@ -663,7 +657,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 20 5 @@ -767,7 +761,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 437 285 @@ -778,11 +772,19 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 100 + 30 + + - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Network Game Settings @@ -953,7 +955,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 20 10 @@ -1076,7 +1078,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 20 14 @@ -1102,10 +1104,7 @@ p, li { white-space: pre-wrap; } 9 - - 6 - - + 6 @@ -1193,7 +1192,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 400 216 @@ -1204,11 +1203,19 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 100 + 30 + + - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Internet Game Settings @@ -1401,16 +1408,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -1549,7 +1547,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 437 16 @@ -1560,23 +1558,19 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 100 + 30 + + - + 9 - - 9 - - - 9 - - - 9 - - - 6 - - + 6 @@ -1584,7 +1578,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 20 40 @@ -1595,7 +1589,7 @@ p, li { white-space: pre-wrap; } - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Player Nicks @@ -1608,42 +1602,18 @@ p, li { white-space: pre-wrap; } Computer Engine - + 7 - - 7 - - - 7 - - - 7 - - - 10 - - + 10 - + 0 - - 0 - - - 0 - - - 0 - - - 4 - - + 4 @@ -1679,16 +1649,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -1699,7 +1660,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1743,7 +1704,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1782,22 +1743,10 @@ p, li { white-space: pre-wrap; } - + 0 - - 0 - - - 0 - - - 0 - - - 4 - - + 4 @@ -1833,16 +1782,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -1853,7 +1793,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1897,7 +1837,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1936,22 +1876,10 @@ p, li { white-space: pre-wrap; } - + 0 - - 0 - - - 0 - - - 0 - - - 4 - - + 4 @@ -2012,16 +1940,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -2032,7 +1951,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2076,7 +1995,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2090,22 +2009,10 @@ p, li { white-space: pre-wrap; } - + 0 - - 0 - - - 0 - - - 0 - - - 4 - - + 4 @@ -2166,16 +2073,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -2186,7 +2084,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2230,7 +2128,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2244,22 +2142,10 @@ p, li { white-space: pre-wrap; } - + 0 - - 0 - - - 0 - - - 0 - - - 4 - - + 4 @@ -2320,16 +2206,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -2340,7 +2217,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2384,7 +2261,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2398,22 +2275,10 @@ p, li { white-space: pre-wrap; } - + 0 - - 0 - - - 0 - - - 0 - - - 4 - - + 4 @@ -2474,16 +2339,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -2494,7 +2350,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2538,7 +2394,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2575,22 +2431,10 @@ p, li { white-space: pre-wrap; } - + 0 - - 0 - - - 0 - - - 0 - - - 0 - - + 0 @@ -2598,16 +2442,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -2615,7 +2450,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -2656,7 +2491,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -2671,16 +2506,7 @@ p, li { white-space: pre-wrap; } 6 - - 6 - - - 6 - - - 6 - - + 6 @@ -2688,7 +2514,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -2726,7 +2552,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -2741,16 +2567,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -2758,7 +2575,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 20 40 @@ -2771,16 +2588,7 @@ p, li { white-space: pre-wrap; } 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -2791,7 +2599,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2835,7 +2643,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2850,7 +2658,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 20 40 @@ -2865,23 +2673,19 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 100 + 30 + + - + 9 - - 9 - - - 9 - - - 9 - - - 6 - - + 6 @@ -2926,7 +2730,8 @@ p, li { white-space: pre-wrap; } - ../../../../../../.designer/backup + + ../../../../../../.designer/backup../../../../../../.designer/backup @@ -3002,7 +2807,7 @@ p, li { white-space: pre-wrap; } - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Log Messages @@ -3021,7 +2826,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 20 40 @@ -3048,7 +2853,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -3201,22 +3006,6 @@ p, li { white-space: pre-wrap; } - - buttonBox - accepted() - settingsDialog - accept() - - - 498 - 678 - - - 354 - 472 - - - buttonBox rejected() @@ -3240,12 +3029,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 413 - 425 + 305 + 39 - 650 - 426 + 305 + 39 @@ -3256,12 +3045,12 @@ p, li { white-space: pre-wrap; } setNum(int) - 639 - 96 + 305 + 39 - 335 - 97 + 305 + 39 @@ -3272,12 +3061,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 639 - 200 + 305 + 39 - 639 - 235 + 305 + 39 @@ -3288,12 +3077,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 639 - 200 + 305 + 39 - 639 - 235 + 305 + 39 diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index 90a1285e..355a4c19 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -166,7 +166,7 @@ void settingsDialogImpl::exec() { checkBox_useIpv6->setChecked(myConfig->readConfigInt("ServerUseIpv6")); checkBox_useSctp->setChecked(myConfig->readConfigInt("ServerUseSctp")); - //Internet Game Settings + //Internet Game Settings if(myConfig->readConfigInt("InternetServerConfigMode")) { groupBox_manualServerConfig->setChecked(TRUE); } else { groupBox_automaticServerConfig->setChecked(TRUE); } lineEdit_InternetServerListAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerListAddress").c_str())); @@ -187,7 +187,6 @@ void settingsDialogImpl::exec() { checkBox_IRCServerUseIpv6->setChecked(myConfig->readConfigInt("IRCServerUseIpv6")); //Interface - comboBox_switchLanguage->setCurrentIndex(comboBox_switchLanguage->findData(QString::fromUtf8(myConfig->readConfigString("Language").c_str()).section('_', 0, 0))); checkBox_showLeftToolbox->setChecked(myConfig->readConfigInt("ShowLeftToolBox")); checkBox_showRightToolbox->setChecked(myConfig->readConfigInt("ShowRightToolBox")); @@ -310,12 +309,34 @@ void settingsDialogImpl::isAccepted() { myConfig->writeConfigInt("ServerUseSctp", checkBox_useSctp->isChecked()); //Internet Game Settings - if(groupBox_automaticServerConfig->isChecked()) { myConfig->writeConfigInt("InternetServerConfigMode", 0); } - if(groupBox_manualServerConfig->isChecked()) { myConfig->writeConfigInt("InternetServerConfigMode", 1); } - myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData()); - myConfig->writeConfigString("InternetServerAddress", lineEdit_InternetServerAddress->text().toUtf8().constData()); - myConfig->writeConfigInt("InternetServerPort", spinBox_InternetServerPort->value()); - myConfig->writeConfigString("InternetServerPassword", lineEdit_InternetServerPassword->text().toUtf8().constData()); + if(groupBox_automaticServerConfig->isChecked()) { + + myConfig->writeConfigInt("InternetServerConfigMode", 0); + +// QUrl serverList; +// serverList.setUrl(lineEdit_InternetServerListAddress->text(),QUrl::StrictMode); +// QRegExp rx("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"); +// if(lineEdit_InternetServerListAddress->text().contains(rx)) { + if(lineEdit_InternetServerListAddress->text().contains("/") && lineEdit_InternetServerListAddress->text().contains(".") ) { + + myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData()); + } + else { + QMessageBox::warning(this, tr("Settings Error"), + tr("The entered server list address isn't a valid URL.\n" + "Please enter a valid server list address!"), + QMessageBox::Ok); + settingsCorrect = FALSE; + } + } + if(groupBox_manualServerConfig->isChecked()) { + + myConfig->writeConfigInt("InternetServerConfigMode", 1); + myConfig->writeConfigString("InternetServerAddress", lineEdit_InternetServerAddress->text().toUtf8().constData()); + myConfig->writeConfigInt("InternetServerPort", spinBox_InternetServerPort->value()); + myConfig->writeConfigString("InternetServerPassword", lineEdit_InternetServerPassword->text().toUtf8().constData()); + } + myConfig->writeConfigInt("InternetServerUseIpv6", checkBox_InternetServerUseIpv6->isChecked()); myConfig->writeConfigInt("InternetServerUseSctp", checkBox_InternetServerUseSctp->isChecked()); myConfig->writeConfigInt("UseInternetGamePassword", checkBox_UseInternetGamePassword->isChecked()); @@ -401,7 +422,7 @@ void settingsDialogImpl::isAccepted() { } //Wenn alles richtig eingegeben wurde --> Dialog schließen - if(settingsCorrect) { this->hide(); } + if(settingsCorrect) { this->accept(); } } void settingsDialogImpl::setFlipsidePicFileName() @@ -614,7 +635,13 @@ void settingsDialogImpl::setLanguageChanged(int index) { } -void settingsDialogImpl::toggleGroupBoxAutomaticServerConfig(bool /*toggleState*/) { if(groupBox_automaticServerConfig->isChecked()) groupBox_manualServerConfig->setChecked(FALSE); } +void settingsDialogImpl::toggleGroupBoxAutomaticServerConfig(bool toggleState) { + if(toggleState) groupBox_manualServerConfig->setChecked(FALSE); + else groupBox_manualServerConfig->setChecked(TRUE); +} -void settingsDialogImpl::toggleGroupBoxManualServerConfig(bool /*toggleState*/) { if(groupBox_manualServerConfig->isChecked()) groupBox_automaticServerConfig->setChecked(FALSE); } +void settingsDialogImpl::toggleGroupBoxManualServerConfig(bool toggleState) { + if(toggleState) groupBox_automaticServerConfig->setChecked(FALSE); + else groupBox_automaticServerConfig->setChecked(TRUE); +}