diff --git a/apps/opencs/model/settings/settingmanager.cpp b/apps/opencs/model/settings/settingmanager.cpp
index afb80c206..b0e5cba98 100644
--- a/apps/opencs/model/settings/settingmanager.cpp
+++ b/apps/opencs/model/settings/settingmanager.cpp
@@ -10,17 +10,7 @@
CSMSettings::SettingManager::SettingManager(QObject *parent) :
QObject(parent)
-{
- mReadWriteMessage = QObject::tr("
Could not open or create file for \
- writing
Please make sure you have the right\
- permissions and try again.
");
-
- mReadOnlyMessage = QObject::tr("
Could not open file for \
- reading
Please make sure you have the \
- right permissions and try again.
");
-
-}
-
+{}
CSMSettings::Setting *CSMSettings::SettingManager::createSetting
(CSMSettings::SettingType typ, const QString &page, const QString &name)
@@ -42,23 +32,6 @@ CSMSettings::Setting *CSMSettings::SettingManager::createSetting
return setting;
}
-void CSMSettings::SettingManager::displayFileErrorMessage(const QString &message,
- bool isReadOnly) const
-{
- // File cannot be opened or created
- QMessageBox msgBox;
- msgBox.setWindowTitle(QObject::tr("OpenCS configuration file I/O error"));
- msgBox.setIcon(QMessageBox::Critical);
- msgBox.setStandardButtons(QMessageBox::Ok);
-
- if (!isReadOnly)
- msgBox.setText (mReadWriteMessage + message);
- else
- msgBox.setText (message);
-
- msgBox.exec();
-}
-
void CSMSettings::SettingManager::addDefinitions (const QSettings *settings)
{
foreach (const QString &key, settings->allKeys())
@@ -80,35 +53,9 @@ void CSMSettings::SettingManager::addDefinitions (const QSettings *settings)
values.append (setting->defaultValues());
setting->setDefinedValues (values);
-
- qDebug() << "added definitons " << values;
- }
-}
-
-QList CSMSettings::SettingManager::findSettings
- (const QStringList &list)
-{
- QList settings;
-
- foreach (const QString &value, list)
- {
- QStringList names = value.split(".", QString::SkipEmptyParts);
-
- if (names.size() != 2)
- continue;
-
- Setting *setting = findSetting (names.at(0), names.at(1));
-
- if (!setting)
- continue;
-
- settings.append (setting);
}
-
- return settings;
}
-
CSMSettings::Setting *CSMSettings::SettingManager::findSetting
(const QString &pageName, const QString &settingName)
{
@@ -123,19 +70,6 @@ CSMSettings::Setting *CSMSettings::SettingManager::findSetting
return 0;
}
-QList CSMSettings::SettingManager::findSettings
- (const QString &pageName)
-{
- QList settings;
-
- foreach (Setting *setting, mSettings)
- {
- if (setting->page() == pageName)
- settings.append (setting);
- }
- return settings;
-}
-
CSMSettings::SettingPageMap CSMSettings::SettingManager::settingPageMap() const
{
SettingPageMap pageMap;
diff --git a/apps/opencs/model/settings/settingmanager.hpp b/apps/opencs/model/settings/settingmanager.hpp
index 9342c66e4..95f55106e 100644
--- a/apps/opencs/model/settings/settingmanager.hpp
+++ b/apps/opencs/model/settings/settingmanager.hpp
@@ -22,8 +22,6 @@ namespace CSMSettings
{
Q_OBJECT
- QString mReadOnlyMessage;
- QString mReadWriteMessage;
QList mSettings;
public:
@@ -33,13 +31,6 @@ namespace CSMSettings
Setting *findSetting
(const QString &pageName, const QString &settingName = QString());
- ///retrieve all settings for a specified page
- QList findSettings (const QString &pageName);
-
- ///retrieve all settings named in the attached list.
- ///Setting names are specified in "PageName.SettingName" format.
- QList findSettings (const QStringList &list);
-
///Retreive a map of the settings, keyed by page name
SettingPageMap settingPageMap() const;
@@ -52,11 +43,6 @@ namespace CSMSettings
///add definitions to the settings specified in the page map
void addDefinitions (const QSettings *settings);
- void displayFileErrorMessage(const QString &message,
- bool isReadOnly) const;
-
- QList settings() const { return mSettings; }
-
signals:
void userSettingUpdated (const QString &, const QStringList &);
diff --git a/apps/opencs/model/settings/usersettings.cpp b/apps/opencs/model/settings/usersettings.cpp
index 7764cc2c2..178104982 100644
--- a/apps/opencs/model/settings/usersettings.cpp
+++ b/apps/opencs/model/settings/usersettings.cpp
@@ -44,6 +44,14 @@ CSMSettings::UserSettings::UserSettings()
mSettings = 0;
+ mReadWriteMessage = QObject::tr("
Could not open or create file for \
+ writing
Please make sure you have the right\
+ permissions and try again.
");
+
+ mReadOnlyMessage = QObject::tr("
Could not open file for \
+ reading
Please make sure you have the \
+ right permissions and try again.
");
+
buildSettingModelDefaults();
}
@@ -131,10 +139,10 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
* proxy slave settings, but must match any declared values the proxy
* slave has, if any.
*******************************************************************/
-
+/*
//create setting objects, specifying the basic widget type,
//the page name, and the view name
-/*
+
Setting *masterBoolean = createSetting (Type_RadioButton, section,
"Master Proxy");
@@ -234,6 +242,7 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
slaveIntegerSpinbox->setSerializable (false);
slaveDoubleSpinbox->setSerializable (false);
slaveSlider->setSerializable (false);
+ slaveDial->setSerializable (false);
slaveBoolean->setDefaultValues (QStringList()
<< "One" << "Three" << "Five");
@@ -285,9 +294,34 @@ CSMSettings::UserSettings::~UserSettings()
mUserSettingsInstance = 0;
}
+void CSMSettings::UserSettings::displayFileErrorMessage
+ (const QString &userpath,
+ const QString &globalpath,
+ const QString &localpath) const
+{
+ QString message = QObject::tr("
An error was encountered loading \
+ user settings files.
One or several files could not \
+ be read. This may be caused by a missing configuration file, \
+ incorrect file permissions or a corrupted installation of \
+ OpenCS.
");
+
+ message += QObject::tr("
Global filepath: ") + globalpath;
+ message += QObject::tr("
Local filepath: ") + localpath;
+ message += QObject::tr("
User filepath: ") + userpath;
+
+ QMessageBox msgBox;
+
+ msgBox.setWindowTitle(QObject::tr("OpenCS configuration file I/O error"));
+ msgBox.setIcon(QMessageBox::Critical);
+ msgBox.setStandardButtons(QMessageBox::Ok);
+
+ msgBox.setText (mReadWriteMessage + message);
+ msgBox.exec();
+}
+
void CSMSettings::UserSettings::loadSettings (const QString &fileName)
{
- mUserFilePath = QString::fromUtf8
+ QString userFilePath = QString::fromUtf8
(mCfgMgr.getUserConfigPath().string().c_str());
QString globalFilePath = QString::fromUtf8
@@ -296,7 +330,7 @@ void CSMSettings::UserSettings::loadSettings (const QString &fileName)
QString localFilePath = QString::fromUtf8
(mCfgMgr.getLocalPath().string().c_str());
- bool isUser = QFile (mUserFilePath + fileName).exists();
+ bool isUser = QFile (userFilePath + fileName).exists();
bool isSystem = QFile (globalFilePath + fileName).exists();
QString otherFilePath = globalFilePath;
@@ -311,22 +345,12 @@ void CSMSettings::UserSettings::loadSettings (const QString &fileName)
//error condition - notify and return
if (!isUser || !isSystem)
{
- QString message = QObject::tr("
An error was encountered loading \
- user settings files.
One or several files could not \
- be read. This may be caused by a missing configuration file, \
- incorrect file permissions or a corrupted installation of \
- OpenCS.
");
-
- message += QObject::tr("
Global filepath: ") + globalFilePath;
- message += QObject::tr("
Local filepath: ") + localFilePath;
- message += QObject::tr("
User filepath: ") + mUserFilePath;
-
- displayFileErrorMessage ( message, true);
+ displayFileErrorMessage (userFilePath, globalFilePath, localFilePath);
return;
}
QSettings::setPath
- (QSettings::IniFormat, QSettings::UserScope, mUserFilePath);
+ (QSettings::IniFormat, QSettings::UserScope, userFilePath);
QSettings::setPath
(QSettings::IniFormat, QSettings::SystemScope, otherFilePath);
diff --git a/apps/opencs/model/settings/usersettings.hpp b/apps/opencs/model/settings/usersettings.hpp
index ade14c50c..826bb6d6b 100644
--- a/apps/opencs/model/settings/usersettings.hpp
+++ b/apps/opencs/model/settings/usersettings.hpp
@@ -28,14 +28,12 @@ namespace CSMSettings {
Q_OBJECT
static UserSettings *mUserSettingsInstance;
- QString mUserFilePath;
Files::ConfigurationManager mCfgMgr;
QString mReadOnlyMessage;
QString mReadWriteMessage;
QSettings *mSettings;
-
public:
/// Singleton implementation
@@ -47,9 +45,6 @@ namespace CSMSettings {
UserSettings (UserSettings const &); //not implemented
void operator= (UserSettings const &); //not implemented
- /// Writes settings to the last loaded settings file
- bool writeSettings();
-
/// Retrieves the settings file at all three levels (global, local and user).
void loadSettings (const QString &fileName);
@@ -61,6 +56,10 @@ namespace CSMSettings {
private:
void buildSettingModelDefaults();
+ void displayFileErrorMessage(const QString &userpath,
+ const QString &globalpath,
+ const QString &localpath) const;
+
};
}
#endif // USERSETTINGS_HPP