From c53615315e151a2790218c13898f128d561df1b9 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 25 Sep 2015 16:25:05 -0300 Subject: Code cleanup Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- desktop-widgets/preferences.cpp | 48 +------ desktop-widgets/preferences.ui | 268 +--------------------------------------- 2 files changed, 4 insertions(+), 312 deletions(-) diff --git a/desktop-widgets/preferences.cpp b/desktop-widgets/preferences.cpp index cb19ce759..2ce96bd77 100644 --- a/desktop-widgets/preferences.cpp +++ b/desktop-widgets/preferences.cpp @@ -48,10 +48,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial ui.proxyType->addItem(tr("SOCKS proxy"), QNetworkProxy::Socks5Proxy); ui.proxyType->setCurrentIndex(-1); - ui.first_item->setModel(GeoReferencingOptionsModel::instance()); - ui.second_item->setModel(GeoReferencingOptionsModel::instance()); - ui.third_item->setModel(GeoReferencingOptionsModel::instance()); - // Facebook stuff: #if !defined(Q_OS_ANDROID) && defined(FBSUPPORT) FacebookManager *fb = FacebookManager::instance(); facebookWebView = new QWebView(this); @@ -187,28 +183,11 @@ void PreferencesDialog::setUiFromPrefs() ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES); ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS); - - QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(); - filterModel->setSourceModel(LanguageModel::instance()); - filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); - ui.languageView->setModel(filterModel); - filterModel->sort(0); - connect(ui.languageFilter, SIGNAL(textChanged(QString)), filterModel, SLOT(setFilterFixedString(QString))); - QSettings s; ui.save_uid_local->setChecked(s.value("save_uid_local").toBool()); ui.default_uid->setText(s.value("subsurface_webservice_uid").toString().toUpper()); - s.beginGroup("Language"); - ui.languageSystemDefault->setChecked(s.value("UseSystemLanguage", true).toBool()); - QAbstractItemModel *m = ui.languageView->model(); - QModelIndexList languages = m->match(m->index(0, 0), Qt::UserRole, s.value("UiLanguage").toString()); - if (languages.count()) - ui.languageView->setCurrentIndex(languages.first()); - - s.endGroup(); - ui.proxyHost->setText(prefs.proxy_host); ui.proxyPort->setValue(prefs.proxy_port); ui.proxyAuthRequired->setChecked(prefs.proxy_auth); @@ -222,17 +201,6 @@ void PreferencesDialog::setUiFromPrefs() ui.save_password_local->setChecked(prefs.save_password_local); cloudPinNeeded(); ui.cloud_background_sync->setChecked(prefs.cloud_background_sync); - ui.default_uid->setText(prefs.userid); - - // GeoManagement -#ifdef DISABLED - ui.enable_geocoding->setChecked( prefs.geocoding.enable_geocoding ); - ui.parse_without_gps->setChecked(prefs.geocoding.parse_dive_without_gps); - ui.tag_existing_dives->setChecked(prefs.geocoding.tag_existing_dives); -#endif - ui.first_item->setCurrentIndex(prefs.geocoding.category[0]); - ui.second_item->setCurrentIndex(prefs.geocoding.category[1]); - ui.third_item->setCurrentIndex(prefs.geocoding.category[2]); } void PreferencesDialog::restorePrefs() @@ -290,19 +258,6 @@ void PreferencesDialog::syncSettings() s.setValue("pscr_ratio", rint(1000.0 / ui.pscrfactor->value())); s.endGroup(); - // Locale - QLocale loc; - s.beginGroup("Language"); - bool useSystemLang = s.value("UseSystemLanguage", true).toBool(); - if (useSystemLang != ui.languageSystemDefault->isChecked() || - (!useSystemLang && s.value("UiLanguage").toString() != ui.languageView->currentIndex().data(Qt::UserRole))) { - QMessageBox::warning(MainWindow::instance(), tr("Restart required"), - tr("To correctly load a new language you must restart Subsurface.")); - } - s.setValue("UseSystemLanguage", ui.languageSystemDefault->isChecked()); - s.setValue("UiLanguage", ui.languageView->currentIndex().data(Qt::UserRole)); - s.endGroup(); - s.beginGroup("Network"); s.setValue("proxy_type", ui.proxyType->itemData(ui.proxyType->currentIndex()).toInt()); s.setValue("proxy_host", ui.proxyHost->text()); @@ -381,6 +336,7 @@ void PreferencesDialog::syncSettings() SAVE_OR_REMOVE("cloud_base_url", default_prefs.cloud_base_url, prefs.cloud_base_url); s.endGroup(); +<<<<<<< HEAD s.beginGroup("geocoding"); #ifdef DISABLED s.setValue("enable_geocoding", ui.enable_geocoding->isChecked()); @@ -392,6 +348,8 @@ void PreferencesDialog::syncSettings() s.setValue("cat2", ui.third_item->currentIndex()); s.endGroup(); +======= +>>>>>>> Code Cleanup loadSettings(); emit settingsChanged(); } diff --git a/desktop-widgets/preferences.ui b/desktop-widgets/preferences.ui index aa5dc4cb5..a799d966c 100644 --- a/desktop-widgets/preferences.ui +++ b/desktop-widgets/preferences.ui @@ -83,16 +83,6 @@ -1 - - - Defaults - - - - :/subsurface-icon - - - Units @@ -113,16 +103,6 @@ - - - Language - - - - :/advanced - - - Network @@ -143,16 +123,6 @@ - - - Georeference - - - - :/georeference - - - @@ -164,37 +134,8 @@ - 0 + 3 - - - - 0 - 0 - - - - - 5 - - - 5 - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - @@ -787,93 +728,6 @@ - - - - 0 - 0 - - - - - 5 - - - QLayout::SetNoConstraint - - - 5 - - - - - - 0 - 0 - - - - UI language - - - - - - System default - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Filter - - - - - - - - - - - - - - 0 - 0 - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - @@ -1200,94 +1054,6 @@ - - - - 0 - 0 - - - - - 5 - - - 5 - - - - - Dive Site Layout - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - / - - - - - - - - 0 - 0 - - - - - - - - / - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - @@ -1370,38 +1136,6 @@ - - languageSystemDefault - toggled(bool) - languageView - setDisabled(bool) - - - 231 - 26 - - - 186 - 30 - - - - - languageSystemDefault - toggled(bool) - languageFilter - setDisabled(bool) - - - 231 - 26 - - - 185 - 20 - - - imperial toggled(bool) -- cgit v1.2.3-70-g09d2