Code cleanup

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-09-25 16:25:05 -03:00 committed by Dirk Hohndel
parent 1d2d046c0f
commit c53615315e
2 changed files with 4 additions and 312 deletions

View file

@ -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();
}

View file

@ -83,16 +83,6 @@
<property name="currentRow">
<number>-1</number>
</property>
<item>
<property name="text">
<string>Defaults</string>
</property>
<property name="icon">
<iconset>
<normalon>:/subsurface-icon</normalon>
</iconset>
</property>
</item>
<item>
<property name="text">
<string>Units</string>
@ -113,16 +103,6 @@
</iconset>
</property>
</item>
<item>
<property name="text">
<string>Language</string>
</property>
<property name="icon">
<iconset>
<normalon>:/advanced</normalon>
</iconset>
</property>
</item>
<item>
<property name="text">
<string>Network</string>
@ -143,16 +123,6 @@
</iconset>
</property>
</item>
<item>
<property name="text">
<string>Georeference</string>
</property>
<property name="icon">
<iconset>
<normalon>:/georeference</normalon>
</iconset>
</property>
</item>
</widget>
</item>
<item>
@ -164,37 +134,8 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="defaults_page">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>5</number>
</property>
<property name="margin">
<number>5</number>
</property>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="units_page">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
@ -787,93 +728,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="language_page">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6" stretch="0,1,0">
<property name="spacing">
<number>5</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<property name="margin">
<number>5</number>
</property>
<item>
<widget class="QGroupBox" name="language_group">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>UI language</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="languageSystemDefault">
<property name="text">
<string>System default</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>Filter</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="languageFilter"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QListView" name="languageView">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="network_page">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
@ -1200,94 +1054,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="geolookup_page">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_155">
<property name="spacing">
<number>5</number>
</property>
<property name="margin">
<number>5</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_12">
<property name="title">
<string>Dive Site Layout</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QComboBox" name="first_item">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_29">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>/</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="second_item">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_30">
<property name="text">
<string>/</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="third_item">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -1370,38 +1136,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>languageSystemDefault</sender>
<signal>toggled(bool)</signal>
<receiver>languageView</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>231</x>
<y>26</y>
</hint>
<hint type="destinationlabel">
<x>186</x>
<y>30</y>
</hint>
</hints>
</connection>
<connection>
<sender>languageSystemDefault</sender>
<signal>toggled(bool)</signal>
<receiver>languageFilter</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>231</x>
<y>26</y>
</hint>
<hint type="destinationlabel">
<x>185</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>imperial</sender>
<signal>toggled(bool)</signal>