Made changes for clean up and fix the problem that a new ramdon port is set every time a setting is saved.

This commit is contained in:
tungnian lee 2012-08-28 15:55:08 -07:00 committed by sledgehammer999
commit 75e28bb3e6
5 changed files with 84 additions and 30 deletions

View file

@ -138,6 +138,8 @@ options_imp::options_imp(QWidget *parent):
// General tab
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
//add checkbox for random port
connect(checkRandomPort, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -367,6 +369,8 @@ void options_imp::saveOptions() {
// General preferences
pref.setLocale(locale);
pref.setAlternatingRowColors(checkAltRowColors->isChecked());
//set random port
pref.setRandomPort(checkRandomPort->isChecked());
pref.setSystrayIntegration(systrayIntegration());
pref.setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex()));
pref.setCloseToTray(closeToTray());
@ -540,6 +544,8 @@ void options_imp::loadOptions() {
const Preferences pref;
setLocale(pref.getLocale());
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
//get random port
checkRandomPort->setChecked(pref.useRandomPort());
checkShowSystray->setChecked(pref.systrayIntegration());
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
if (checkShowSystray->isChecked()) {
@ -792,6 +798,7 @@ void options_imp::on_randomButton_clicked() {
spinPort->setValue(rand() % 64512 + 1024);
}
int options_imp::getEncryptionSetting() const {
return comboEncryption->currentIndex();
}