/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "appearancesettingspage.h"
+#include "buffersettings.h"
+#include "chatviewsettings.h"
#include "qtui.h"
-#include "uisettings.h"
+#include "qtuisettings.h"
#include "util.h"
#include <QDir>
initStyleComboBox();
initLanguageComboBox();
- connect(ui.styleComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged()));
- connect(ui.languageComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged()));
+ foreach(QComboBox *comboBox, findChildren<QComboBox *>()) {
+ connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged()));
+ }
+ foreach(QCheckBox *checkBox, findChildren<QCheckBox *>()) {
+ connect(checkBox, SIGNAL(clicked()), this, SLOT(widgetHasChanged()));
+ }
}
void AppearanceSettingsPage::initStyleComboBox() {
QStringList styleList = QStyleFactory::keys();
- ui.styleComboBox->addItem("<default>");
+ ui.styleComboBox->addItem(tr("<System Default>"));
foreach(QString style, styleList) {
ui.styleComboBox->addItem(style);
}
}
void AppearanceSettingsPage::load() {
- UiSettings uiSettings;
+ QtUiSettings uiSettings;
+ // Gui Style
settings["Style"] = uiSettings.value("Style", QString(""));
if(settings["Style"].toString() == "") {
ui.styleComboBox->setCurrentIndex(0);
QApplication::setStyle(settings["Style"].toString());
}
+ // Language
QLocale locale = uiSettings.value("Locale", QLocale::system()).value<QLocale>();
if(locale == QLocale::system())
ui.languageComboBox->setCurrentIndex(0);
ui.languageComboBox->setCurrentIndex(1);
else
ui.languageComboBox->setCurrentIndex(ui.languageComboBox->findText(QLocale::languageToString(locale.language()), Qt::MatchExactly));
- loadTranslation(selectedLocale());
+ Quassel::loadTranslation(selectedLocale());
+
+ ChatViewSettings chatViewSettings;
+ SettingsPage::load(ui.showWebPreview, chatViewSettings.showWebPreview());
+
+ BufferSettings bufferSettings;
+ SettingsPage::load(ui.showUserStateIcons, bufferSettings.showUserStateIcons());
setChangedState(false);
}
void AppearanceSettingsPage::save() {
- UiSettings uiSettings;
+ QtUiSettings uiSettings;
if(ui.styleComboBox->currentIndex() < 1) {
uiSettings.setValue("Style", QString(""));
} else {
uiSettings.setValue("Locale", selectedLocale());
}
-
+
+ ChatViewSettings chatViewSettings;
+ chatViewSettings.enableWebPreview(ui.showWebPreview->isChecked());
+
+ BufferSettings bufferSettings;
+ bufferSettings.enableUserStateIcons(ui.showUserStateIcons->isChecked());
+
load();
setChangedState(false);
}
if(settings["Style"].toString() != ui.styleComboBox->currentText()) return true;
if(selectedLocale() != QLocale()) return true; // QLocale() returns the default locale (manipulated via loadTranslation())
+ if(SettingsPage::hasChanged(ui.showWebPreview)) return true;
+ if(SettingsPage::hasChanged(ui.showUserStateIcons)) return true;
+
return false;
}