mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 20:45:33 +00:00
Three primary changes:
1. Declared QStringPair::isEmpty() const 2. Split the CsSettings namespace into two: CSMSettings and CSVSettings. (Required splitting the support.hpp file) 3. Declared several classes as _noqt in CMakeLists.txt for OpenCS
This commit is contained in:
parent
8d0f350446
commit
a8b45e0a13
36 changed files with 335 additions and 325 deletions
|
@ -73,29 +73,33 @@ opencs_units_noqt (view/tools
|
|||
)
|
||||
|
||||
opencs_units (view/settings
|
||||
customblock
|
||||
proxyblock
|
||||
groupbox
|
||||
abstractblock
|
||||
settingwidget
|
||||
itemblock
|
||||
groupblock
|
||||
toggleblock
|
||||
usersettingsdialog
|
||||
abstractpage
|
||||
proxyblock
|
||||
abstractwidget
|
||||
blankpage
|
||||
usersettingsdialog
|
||||
editorpage
|
||||
)
|
||||
|
||||
opencs_units_noqt (view/settings
|
||||
abstractpage
|
||||
blankpage
|
||||
groupblock
|
||||
customblock
|
||||
groupbox
|
||||
itemblock
|
||||
settingwidget
|
||||
toggleblock
|
||||
support
|
||||
)
|
||||
|
||||
opencs_units (model/settings
|
||||
settingcontainer
|
||||
settingsitem
|
||||
)
|
||||
|
||||
opencs_units_noqt (model/settings
|
||||
support
|
||||
usersettings
|
||||
settingsitem
|
||||
)
|
||||
|
||||
set (OPENCS_US
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
#include <QStringList>
|
||||
|
||||
CsSettings::SettingContainer::SettingContainer(QObject *parent) :
|
||||
CSMSettings::SettingContainer::SettingContainer(QObject *parent) :
|
||||
QObject(parent), mValue (0), mValues (0)
|
||||
{
|
||||
}
|
||||
|
||||
CsSettings::SettingContainer::SettingContainer(const QString &value, QObject *parent) :
|
||||
CSMSettings::SettingContainer::SettingContainer(const QString &value, QObject *parent) :
|
||||
QObject(parent), mValue (new QString (value)), mValues (0)
|
||||
{
|
||||
}
|
||||
|
||||
void CsSettings::SettingContainer::insert (const QString &value)
|
||||
void CSMSettings::SettingContainer::insert (const QString &value)
|
||||
{
|
||||
if (mValue)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ void CsSettings::SettingContainer::insert (const QString &value)
|
|||
|
||||
}
|
||||
|
||||
void CsSettings::SettingContainer::update (const QString &value, int index)
|
||||
void CSMSettings::SettingContainer::update (const QString &value, int index)
|
||||
{
|
||||
if (isEmpty())
|
||||
mValue = new QString(value);
|
||||
|
@ -43,7 +43,7 @@ void CsSettings::SettingContainer::update (const QString &value, int index)
|
|||
mValues->replace(index, value);
|
||||
}
|
||||
|
||||
QString CsSettings::SettingContainer::getValue (int index) const
|
||||
QString CSMSettings::SettingContainer::getValue (int index) const
|
||||
{
|
||||
QString retVal("");
|
||||
|
||||
|
@ -66,7 +66,7 @@ QString CsSettings::SettingContainer::getValue (int index) const
|
|||
return retVal;
|
||||
}
|
||||
|
||||
int CsSettings::SettingContainer::count () const
|
||||
int CSMSettings::SettingContainer::count () const
|
||||
{
|
||||
int retVal = 0;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
class QStringList;
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSMSettings
|
||||
{
|
||||
class SettingContainer : public QObject
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "settingsitem.hpp"
|
||||
|
||||
bool CsSettings::SettingsItem::updateItem (const QStringList *values)
|
||||
bool CSMSettings::SettingsItem::updateItem (const QStringList *values)
|
||||
{
|
||||
QStringList::ConstIterator it = values->begin();
|
||||
|
||||
|
@ -30,7 +30,7 @@ bool CsSettings::SettingsItem::updateItem (const QStringList *values)
|
|||
return isValid;
|
||||
}
|
||||
|
||||
bool CsSettings::SettingsItem::updateItem (const QString &value)
|
||||
bool CSMSettings::SettingsItem::updateItem (const QString &value)
|
||||
{
|
||||
//takes a value or a SettingsContainer and updates itself accordingly
|
||||
//after validating the data against it's own definition
|
||||
|
@ -52,7 +52,7 @@ bool CsSettings::SettingsItem::updateItem (const QString &value)
|
|||
return success;
|
||||
}
|
||||
|
||||
bool CsSettings::SettingsItem::updateItem(int valueListIndex)
|
||||
bool CSMSettings::SettingsItem::updateItem(int valueListIndex)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool CsSettings::SettingsItem::updateItem(int valueListIndex)
|
|||
return success;
|
||||
}
|
||||
|
||||
bool CsSettings::SettingsItem::validate (const QString &value)
|
||||
bool CSMSettings::SettingsItem::validate (const QString &value)
|
||||
{
|
||||
bool isValid = true;
|
||||
|
||||
|
@ -90,13 +90,13 @@ bool CsSettings::SettingsItem::validate (const QString &value)
|
|||
return isValid;
|
||||
}
|
||||
|
||||
void CsSettings::SettingsItem::setDefaultValue (const QString &value)
|
||||
void CSMSettings::SettingsItem::setDefaultValue (const QString &value)
|
||||
{
|
||||
mDefaultValue = value;
|
||||
update (value);
|
||||
}
|
||||
|
||||
QString CsSettings::SettingsItem::getDefaultValue() const
|
||||
QString CSMSettings::SettingsItem::getDefaultValue() const
|
||||
{
|
||||
return mDefaultValue;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "support.hpp"
|
||||
#include "settingcontainer.hpp"
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSMSettings
|
||||
{
|
||||
class SettingsItem : public SettingContainer
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SUPPORT_HPP
|
||||
#define SUPPORT_HPP
|
||||
#ifndef MODEL_SUPPORT_HPP
|
||||
#define MODEL_SUPPORT_HPP
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
@ -8,48 +8,13 @@ class QLayout;
|
|||
class QWidget;
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSMSettings
|
||||
{
|
||||
|
||||
class SettingContainer;
|
||||
struct WidgetDef;
|
||||
class ItemBlock;
|
||||
class GroupBlock;
|
||||
struct GroupBlockDef;
|
||||
|
||||
typedef QList<GroupBlockDef *> GroupBlockDefList;
|
||||
typedef QList<GroupBlock *> GroupBlockList;
|
||||
typedef QList<ItemBlock *> ItemBlockList;
|
||||
typedef QList<SettingContainer *> SettingList;
|
||||
typedef QMap<QString, SettingContainer *> SettingMap;
|
||||
typedef QList<SettingContainer *> SettingList;
|
||||
typedef QMap<QString, SettingContainer *> SettingMap;
|
||||
typedef QMap<QString, SettingMap *> SectionMap;
|
||||
typedef QList<QStringList *> ProxyList;
|
||||
typedef QList<WidgetDef *> WidgetList;
|
||||
typedef QMap<QString, ItemBlock *> ItemBlockMap;
|
||||
|
||||
enum OcsWidgetOrientation
|
||||
{
|
||||
OCS_HORIZONTAL,
|
||||
OCS_VERTICAL
|
||||
};
|
||||
|
||||
enum OcsWidgetType
|
||||
{
|
||||
OCS_CHECK_WIDGET,
|
||||
OCS_COMBO_WIDGET,
|
||||
OCS_TEXT_WIDGET,
|
||||
OCS_LIST_WIDGET,
|
||||
OCS_RADIO_WIDGET,
|
||||
OCS_SPIN_WIDGET,
|
||||
OCS_UNDEFINED_WIDGET
|
||||
};
|
||||
|
||||
enum OcsAlignment
|
||||
{
|
||||
OCS_LEFT = Qt::AlignLeft,
|
||||
OCS_CENTER = Qt::AlignHCenter,
|
||||
OCS_RIGHT = Qt::AlignRight
|
||||
};
|
||||
|
||||
struct QStringPair
|
||||
{
|
||||
|
@ -67,104 +32,8 @@ namespace CsSettings
|
|||
QString left;
|
||||
QString right;
|
||||
|
||||
bool isEmpty()
|
||||
bool isEmpty() const
|
||||
{ return (left.isEmpty() && right.isEmpty()); }
|
||||
};
|
||||
|
||||
//template for defining the widget of a property.
|
||||
struct WidgetDef
|
||||
{
|
||||
OcsWidgetType type; //type of widget providing input
|
||||
int labelWidth; //width of caption label
|
||||
int widgetWidth; //width of input widget
|
||||
OcsWidgetOrientation orientation; //label / widget orientation (horizontal / vertical)
|
||||
QString inputMask; //input mask (line edit)
|
||||
QString caption; //label caption. Leave empty for multiple items. See BlockDef::captionList
|
||||
QString value; //widget value. Leave empty for multiple items. See BlockDef::valueList
|
||||
QStringPair *minMax; //Min/Max QString value pair. If empty, assigned to property item value pair.
|
||||
QStringList *valueList; //value list for list widgets. If left empty, is assigned to property item value list during block build().
|
||||
bool isDefault; //isDefault - determined at runtime.
|
||||
OcsAlignment valueAlignment; //left / center / right-justify text in widget
|
||||
OcsAlignment widgetAlignment; //left / center / right-justify widget in group box
|
||||
|
||||
|
||||
WidgetDef() : labelWidth (-1), widgetWidth (-1),
|
||||
orientation (OCS_HORIZONTAL),
|
||||
isDefault (true), valueAlignment (OCS_CENTER),
|
||||
widgetAlignment (OCS_RIGHT),
|
||||
inputMask (""), value (""),
|
||||
caption (""), valueList (0)
|
||||
{}
|
||||
|
||||
WidgetDef (OcsWidgetType widgType)
|
||||
: type (widgType), orientation (OCS_HORIZONTAL),
|
||||
caption (""), value (""), valueAlignment (OCS_CENTER),
|
||||
widgetAlignment (OCS_RIGHT),
|
||||
labelWidth (-1), widgetWidth (-1),
|
||||
valueList (0), isDefault (true)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
//Defines the attributes of the property as it is represented in the config file
|
||||
//as well as the UI elements (group box and widget) that serve it.
|
||||
//Only one widget may serve as the input widget for the property.
|
||||
struct SettingsItemDef
|
||||
{
|
||||
QString name; //property name
|
||||
QStringList *valueList; //list of valid values for the property.
|
||||
//Used to populate option widget captions or list widget item lists (see WidgetDef::caption / value)
|
||||
QString defaultValue;
|
||||
bool hasMultipleValues;
|
||||
QStringPair minMax; //minimum / maximum value pair
|
||||
WidgetDef widget; //definition of the input widget for this setting
|
||||
OcsWidgetOrientation orientation; //general orientation of the widget / label for this property
|
||||
ProxyList *proxyList; //list of property and corresponding default values for proxy widget
|
||||
|
||||
SettingsItemDef() : name (""), defaultValue (""), orientation (OCS_VERTICAL), hasMultipleValues (false)
|
||||
{}
|
||||
|
||||
SettingsItemDef (QString propName, QString propDefault, OcsWidgetOrientation propOrient = OCS_VERTICAL)
|
||||
: name (propName), defaultValue (propDefault), orientation (propOrient),
|
||||
hasMultipleValues(false), valueList (new QStringList), proxyList ( new ProxyList)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
//Hierarchically, this is a "sub-section" of properties within a section, solely for UI organization.
|
||||
//Does not correlate to config file structure.
|
||||
struct GroupBlockDef
|
||||
{
|
||||
QString title; //title of the block containing the property or properties of this sub-section
|
||||
QStringList captions; //list of captions for widgets at the block level (not associated with any particular property)
|
||||
WidgetList widgets; //list of widgets at the block level (not associated with any particular property)
|
||||
QList<SettingsItemDef *> properties; //list of the property(ies) which are subordinate to the property block.
|
||||
OcsWidgetOrientation widgetOrientation; //general orientation of widgets in group block
|
||||
bool isVisible; //determines whether or not box border/title are visible
|
||||
bool isProxy; //indicates whether or not this block defines a proxy block
|
||||
QString defaultValue; //generic default value attribute
|
||||
|
||||
GroupBlockDef (): title(""), widgetOrientation (OCS_VERTICAL), isVisible (true), isProxy (false), defaultValue ("")
|
||||
{}
|
||||
|
||||
GroupBlockDef (QString blockTitle)
|
||||
: title (blockTitle), widgetOrientation (OCS_VERTICAL), isProxy (false), isVisible (true), defaultValue ("")
|
||||
{}
|
||||
};
|
||||
|
||||
struct CustomBlockDef
|
||||
{
|
||||
QString title;
|
||||
QString defaultValue; //default value for widgets unique to the custom block
|
||||
GroupBlockDefList blockDefList; //list of settings groups that comprise the settings within the custom block
|
||||
OcsWidgetOrientation blockOrientation;
|
||||
|
||||
CustomBlockDef (): title (""), defaultValue (""), blockOrientation (OCS_HORIZONTAL)
|
||||
{}
|
||||
|
||||
CustomBlockDef (const QString &blockTitle)
|
||||
: title (blockTitle), defaultValue (""), blockOrientation (OCS_HORIZONTAL)
|
||||
{}
|
||||
};
|
||||
}
|
||||
#endif // SUPPORT_HPP
|
||||
#endif // MODEL_SUPPORT_HPP
|
||||
|
|
|
@ -30,16 +30,16 @@ namespace boost
|
|||
#endif /* (BOOST_VERSION <= 104600) */
|
||||
|
||||
|
||||
CsSettings::UserSettings::UserSettings(Files::ConfigurationManager &cfg)
|
||||
CSMSettings::UserSettings::UserSettings(Files::ConfigurationManager &cfg)
|
||||
: mCfgMgr(cfg)
|
||||
{
|
||||
}
|
||||
|
||||
CsSettings::UserSettings::~UserSettings()
|
||||
CSMSettings::UserSettings::~UserSettings()
|
||||
{
|
||||
}
|
||||
|
||||
QFile *CsSettings::UserSettings::openFile (const QString &filename)
|
||||
QFile *CSMSettings::UserSettings::openFile (const QString &filename)
|
||||
{
|
||||
QFile *file = new QFile(filename);
|
||||
|
||||
|
@ -63,7 +63,7 @@ QFile *CsSettings::UserSettings::openFile (const QString &filename)
|
|||
return file;
|
||||
}
|
||||
|
||||
bool CsSettings::UserSettings::writeFile(QFile *file, QMap<QString, CsSettings::SettingList *> &settings)
|
||||
bool CSMSettings::UserSettings::writeFile(QFile *file, QMap<QString, CSMSettings::SettingList *> &settings)
|
||||
{
|
||||
if (!file)
|
||||
return false;
|
||||
|
@ -88,7 +88,7 @@ bool CsSettings::UserSettings::writeFile(QFile *file, QMap<QString, CsSettings::
|
|||
return true;
|
||||
}
|
||||
|
||||
void CsSettings::UserSettings::getSettings(QTextStream &stream, SectionMap §ions)
|
||||
void CSMSettings::UserSettings::getSettings(QTextStream &stream, SectionMap §ions)
|
||||
{
|
||||
//looks for a square bracket, "'\\["
|
||||
//that has one or more "not nothing" in it, "([^]]+)"
|
||||
|
@ -102,7 +102,7 @@ void CsSettings::UserSettings::getSettings(QTextStream &stream, SectionMap §
|
|||
|
||||
QRegExp keyRe("^([^=]+)\\s*=\\s*(.+)$");
|
||||
|
||||
CsSettings::SettingMap *settings = 0;
|
||||
CSMSettings::SettingMap *settings = 0;
|
||||
QString section = "none";
|
||||
|
||||
while (!stream.atEnd())
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Files { typedef std::vector<boost::filesystem::path> PathContainer;
|
|||
|
||||
class QFile;
|
||||
|
||||
namespace CsSettings {
|
||||
namespace CSMSettings {
|
||||
|
||||
class UserSettings
|
||||
{
|
||||
|
|
|
@ -257,7 +257,7 @@ QDockWidget *CSVDoc::View::getOperations() const
|
|||
|
||||
void CSVDoc::View::showUserSettings()
|
||||
{
|
||||
CsSettings::UserSettingsDialog *settingsDialog = new CsSettings::UserSettingsDialog(this);
|
||||
CSVSettings::UserSettingsDialog *settingsDialog = new CSVSettings::UserSettingsDialog(this);
|
||||
|
||||
connect (settingsDialog, SIGNAL (signalUpdateEditorSetting (const QString &, const QString &)),
|
||||
this, SLOT (slotUpdateEditorSetting (const QString &, const QString &)) );
|
||||
|
@ -271,11 +271,7 @@ void CSVDoc::View::slotUpdateEditorSetting(const QString &settingName, const QSt
|
|||
|
||||
if (lastValue != settingValue)
|
||||
{
|
||||
if (settingName == "Undo Stack Size");
|
||||
|
||||
if (settingName == "Top-Level Window Count");
|
||||
|
||||
if (settingName == "Reuse Subwindows");
|
||||
//evaluate settingName against tokens to determine which function to call to update Editor application.
|
||||
|
||||
lastValue = settingValue;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#include "abstractblock.hpp"
|
||||
|
||||
CsSettings::AbstractBlock::AbstractBlock(QWidget* parent)
|
||||
CSVSettings::AbstractBlock::AbstractBlock(QWidget* parent)
|
||||
: QObject (parent), mBox ( new GroupBox (parent) ), mWidgetParent (parent)
|
||||
{}
|
||||
|
||||
CsSettings::AbstractBlock::AbstractBlock(bool isVisible, QWidget* parent)
|
||||
CSVSettings::AbstractBlock::AbstractBlock(bool isVisible, QWidget* parent)
|
||||
: QObject (parent), mBox ( new GroupBox (isVisible, parent)), mWidgetParent (parent)
|
||||
{}
|
||||
|
||||
QLayout *CsSettings::AbstractBlock::createLayout (OcsWidgetOrientation direction, bool isZeroMargin, QWidget* parent)
|
||||
QLayout *CSVSettings::AbstractBlock::createLayout (OcsWidgetOrientation direction,
|
||||
bool isZeroMargin, QWidget* parent)
|
||||
{
|
||||
QLayout *layout = 0;
|
||||
|
||||
|
@ -23,13 +24,13 @@ QLayout *CsSettings::AbstractBlock::createLayout (OcsWidgetOrientation direction
|
|||
return layout;
|
||||
}
|
||||
|
||||
QGroupBox *CsSettings::AbstractBlock::getGroupBox()
|
||||
QGroupBox *CSVSettings::AbstractBlock::getGroupBox()
|
||||
{
|
||||
return mBox;
|
||||
}
|
||||
|
||||
CsSettings::AbstractWidget *CsSettings::AbstractBlock::buildWidget (const QString& widgetName, WidgetDef &def,
|
||||
QLayout *layout, bool isConnected) const
|
||||
CSVSettings::AbstractWidget *CSVSettings::AbstractBlock::buildWidget (const QString& widgetName, WidgetDef &def,
|
||||
QLayout *layout, bool isConnected) const
|
||||
{
|
||||
AbstractWidget *widg = 0;
|
||||
|
||||
|
@ -76,32 +77,32 @@ CsSettings::AbstractWidget *CsSettings::AbstractBlock::buildWidget (const QStrin
|
|||
return widg;
|
||||
}
|
||||
|
||||
void CsSettings::AbstractBlock::setVisible (bool isVisible)
|
||||
void CSVSettings::AbstractBlock::setVisible (bool isVisible)
|
||||
{
|
||||
mBox->setBorderVisibility (isVisible);
|
||||
}
|
||||
|
||||
bool CsSettings::AbstractBlock::isVisible () const
|
||||
bool CSVSettings::AbstractBlock::isVisible () const
|
||||
{
|
||||
return mBox->borderVisibile();
|
||||
}
|
||||
|
||||
QWidget *CsSettings::AbstractBlock::getParent() const
|
||||
QWidget *CSVSettings::AbstractBlock::getParent() const
|
||||
{
|
||||
return mWidgetParent;
|
||||
}
|
||||
|
||||
void CsSettings::AbstractBlock::slotUpdate (const QString &value)
|
||||
void CSVSettings::AbstractBlock::slotUpdate (const QString &value)
|
||||
{
|
||||
slotUpdateSetting (objectName(), value);
|
||||
}
|
||||
|
||||
void CsSettings::AbstractBlock::slotSetEnabled(bool value)
|
||||
void CSVSettings::AbstractBlock::slotSetEnabled(bool value)
|
||||
{
|
||||
mBox->setEnabled(value);
|
||||
}
|
||||
|
||||
void CsSettings::AbstractBlock::slotUpdateSetting (const QString &settingName, const QString &settingValue)
|
||||
void CSVSettings::AbstractBlock::slotUpdateSetting (const QString &settingName, const QString &settingValue)
|
||||
{
|
||||
bool doEmit = true;
|
||||
updateBySignal (settingName, settingValue, doEmit);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "../../model/settings/settingsitem.hpp"
|
||||
#include "groupbox.hpp"
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
|
||||
class AbstractBlock : public QObject
|
||||
|
@ -17,7 +17,7 @@ namespace CsSettings
|
|||
|
||||
protected:
|
||||
|
||||
typedef QMap<QString, SettingsItem*> SettingsItemMap;
|
||||
typedef QMap<QString, CSMSettings::SettingsItem*> SettingsItemMap;
|
||||
GroupBox *mBox;
|
||||
QWidget *mWidgetParent;
|
||||
|
||||
|
@ -30,8 +30,8 @@ namespace CsSettings
|
|||
void setVisible (bool isVisible);
|
||||
bool isVisible() const;
|
||||
|
||||
virtual SettingList *getSettings() = 0;
|
||||
virtual bool updateSettings (const SettingMap &settings) = 0;
|
||||
virtual CSMSettings::SettingList *getSettings() = 0;
|
||||
virtual bool updateSettings (const CSMSettings::SettingMap &settings) = 0;
|
||||
virtual bool updateBySignal (const QString &name, const QString &value, bool &doEmit)
|
||||
{ return false; }
|
||||
|
||||
|
|
|
@ -10,28 +10,28 @@
|
|||
#include <QLineEdit>
|
||||
#include <QMargins>
|
||||
|
||||
CsSettings::AbstractPage::AbstractPage(QWidget *parent):
|
||||
CSVSettings::AbstractPage::AbstractPage(QWidget *parent):
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
CsSettings::AbstractPage::AbstractPage(const QString &pageName, QWidget *parent):
|
||||
CSVSettings::AbstractPage::AbstractPage(const QString &pageName, QWidget *parent):
|
||||
QWidget(parent)
|
||||
{
|
||||
QWidget::setObjectName (pageName);
|
||||
}
|
||||
|
||||
CsSettings::AbstractPage::~AbstractPage()
|
||||
CSVSettings::AbstractPage::~AbstractPage()
|
||||
{
|
||||
}
|
||||
|
||||
CsSettings::SettingList *CsSettings::AbstractPage::getSettings()
|
||||
CSMSettings::SettingList *CSVSettings::AbstractPage::getSettings()
|
||||
{
|
||||
SettingList *settings = new SettingList();
|
||||
CSMSettings::SettingList *settings = new CSMSettings::SettingList();
|
||||
|
||||
foreach (AbstractBlock *block, mAbstractBlocks)
|
||||
{
|
||||
SettingList *groupSettings = block->getSettings();
|
||||
CSMSettings::SettingList *groupSettings = block->getSettings();
|
||||
settings->append (*groupSettings);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,15 +10,13 @@
|
|||
class SettingMap;
|
||||
class SettingList;
|
||||
|
||||
namespace CsSettings {
|
||||
namespace CSVSettings {
|
||||
|
||||
typedef QList<AbstractBlock *> AbstractBlockList;
|
||||
|
||||
class AbstractPage: public QWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
|
||||
AbstractBlockList mAbstractBlocks;
|
||||
|
@ -32,9 +30,9 @@ namespace CsSettings {
|
|||
|
||||
virtual void setupUi()=0;
|
||||
|
||||
virtual void initializeWidgets (const SettingMap &settings) = 0;
|
||||
virtual void initializeWidgets (const CSMSettings::SettingMap &settings) = 0;
|
||||
|
||||
SettingList *getSettings();
|
||||
CSMSettings::SettingList *getSettings();
|
||||
|
||||
void setObjectName();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <QLayout>
|
||||
#include <QLabel>
|
||||
|
||||
void CsSettings::AbstractWidget::build(QWidget *widget, WidgetDef &def, bool noLabel)
|
||||
void CSVSettings::AbstractWidget::build(QWidget *widget, WidgetDef &def, bool noLabel)
|
||||
{
|
||||
if (!mLayout)
|
||||
createLayout(def.orientation, true);
|
||||
|
@ -12,7 +12,7 @@ void CsSettings::AbstractWidget::build(QWidget *widget, WidgetDef &def, bool noL
|
|||
|
||||
}
|
||||
|
||||
void CsSettings::AbstractWidget::buildLabelAndWidget (QWidget *widget, WidgetDef &def, bool noLabel)
|
||||
void CSVSettings::AbstractWidget::buildLabelAndWidget (QWidget *widget, WidgetDef &def, bool noLabel)
|
||||
{
|
||||
if (def.widgetWidth > -1)
|
||||
widget->setFixedWidth (def.widgetWidth);
|
||||
|
@ -31,7 +31,7 @@ void CsSettings::AbstractWidget::buildLabelAndWidget (QWidget *widget, WidgetDef
|
|||
mLayout->setAlignment (widget, getAlignment (def.widgetAlignment));
|
||||
}
|
||||
|
||||
void CsSettings::AbstractWidget::createLayout
|
||||
void CSVSettings::AbstractWidget::createLayout
|
||||
(OcsWidgetOrientation direction, bool isZeroMargin)
|
||||
{
|
||||
if (direction == OCS_VERTICAL)
|
||||
|
@ -43,36 +43,36 @@ void CsSettings::AbstractWidget::createLayout
|
|||
mLayout->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
QFlags<Qt::AlignmentFlag> CsSettings::AbstractWidget::getAlignment (CsSettings::OcsAlignment flag)
|
||||
QFlags<Qt::AlignmentFlag> CSVSettings::AbstractWidget::getAlignment (CSVSettings::OcsAlignment flag)
|
||||
{
|
||||
return QFlags<Qt::AlignmentFlag>(static_cast<int>(flag));
|
||||
}
|
||||
|
||||
QLayout *CsSettings::AbstractWidget::getLayout()
|
||||
QLayout *CSVSettings::AbstractWidget::getLayout()
|
||||
{
|
||||
return mLayout;
|
||||
}
|
||||
|
||||
void CsSettings::AbstractWidget::slotUpdateWidget (const QString &value)
|
||||
void CSVSettings::AbstractWidget::slotUpdateWidget (const QString &value)
|
||||
{
|
||||
updateWidget (value);
|
||||
}
|
||||
|
||||
void CsSettings::AbstractWidget::slotUpdateItem(const QString &value)
|
||||
void CSVSettings::AbstractWidget::slotUpdateItem(const QString &value)
|
||||
{
|
||||
emit signalUpdateItem (value);
|
||||
}
|
||||
|
||||
void CsSettings::AbstractWidget::slotUpdateItem(bool value)
|
||||
void CSVSettings::AbstractWidget::slotUpdateItem(bool value)
|
||||
{
|
||||
if (value)
|
||||
emit signalUpdateItem (widget()->objectName());
|
||||
}
|
||||
|
||||
void CsSettings::AbstractWidget::slotUpdateItem(int value)
|
||||
void CSVSettings::AbstractWidget::slotUpdateItem(int value)
|
||||
{
|
||||
emit signalUpdateItem (QString::number(value));
|
||||
}
|
||||
|
||||
void CsSettings::AbstractWidget::slotUpdateItem (QListWidgetItem* current, QListWidgetItem* previous)
|
||||
void CSVSettings::AbstractWidget::slotUpdateItem (QListWidgetItem* current, QListWidgetItem* previous)
|
||||
{}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
#define ABSTRACTWIDGET_HPP
|
||||
|
||||
#include <QWidget>
|
||||
#include "../../model/settings/support.hpp"
|
||||
#include "support.hpp"
|
||||
|
||||
class QLayout;
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
class AbstractWidget : public QObject
|
||||
{
|
||||
|
@ -35,12 +35,12 @@ namespace CsSettings
|
|||
virtual void updateWidget (const QString &value) = 0;
|
||||
|
||||
//converts user-defined enum to Qt equivalents
|
||||
QFlags<Qt::AlignmentFlag> getAlignment (CsSettings::OcsAlignment flag);
|
||||
QFlags<Qt::AlignmentFlag> getAlignment (OcsAlignment flag);
|
||||
|
||||
private:
|
||||
|
||||
//widget initialization utilities
|
||||
void createLayout (CsSettings::OcsWidgetOrientation direction, bool isZeroMargin);
|
||||
void createLayout (OcsWidgetOrientation direction, bool isZeroMargin);
|
||||
void buildLabelAndWidget (QWidget *widget, WidgetDef &def, bool noLabel);
|
||||
|
||||
|
||||
|
|
|
@ -17,19 +17,19 @@
|
|||
#include "groupblock.hpp"
|
||||
#include "toggleblock.hpp"
|
||||
|
||||
CsSettings::BlankPage::BlankPage(QWidget *parent):
|
||||
CSVSettings::BlankPage::BlankPage(QWidget *parent):
|
||||
AbstractPage("Blank", parent)
|
||||
{
|
||||
initPage();
|
||||
}
|
||||
|
||||
CsSettings::BlankPage::BlankPage(const QString &title, QWidget *parent):
|
||||
CSVSettings::BlankPage::BlankPage(const QString &title, QWidget *parent):
|
||||
AbstractPage(title, parent)
|
||||
{
|
||||
initPage();
|
||||
}
|
||||
|
||||
void CsSettings::BlankPage::initPage()
|
||||
void CSVSettings::BlankPage::initPage()
|
||||
{
|
||||
// Hacks to get the stylesheet look properly
|
||||
#ifdef Q_OS_MAC
|
||||
|
@ -40,7 +40,7 @@ void CsSettings::BlankPage::initPage()
|
|||
setupUi();
|
||||
}
|
||||
|
||||
void CsSettings::BlankPage::setupUi()
|
||||
void CSVSettings::BlankPage::setupUi()
|
||||
{
|
||||
QGroupBox *pageBox = new QGroupBox(this);
|
||||
QLayout* pageLayout = new QVBoxLayout();
|
||||
|
@ -49,7 +49,7 @@ void CsSettings::BlankPage::setupUi()
|
|||
pageLayout->addWidget(pageBox);
|
||||
}
|
||||
|
||||
void CsSettings::BlankPage::initializeWidgets (const SettingMap &settings)
|
||||
void CSVSettings::BlankPage::initializeWidgets (const CSMSettings::SettingMap &settings)
|
||||
{
|
||||
//iterate each item in each blocks in this section
|
||||
//validate the corresponding setting against the defined valuelist if any.
|
||||
|
|
|
@ -5,14 +5,13 @@
|
|||
|
||||
class QGroupBox;
|
||||
|
||||
namespace CsSettings {
|
||||
namespace CSVSettings {
|
||||
|
||||
class UserSettings;
|
||||
class AbstractBlock;
|
||||
|
||||
class BlankPage : public AbstractPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
|
@ -20,7 +19,7 @@ namespace CsSettings {
|
|||
BlankPage (const QString &title, QWidget *parent);
|
||||
|
||||
void setupUi();
|
||||
void initializeWidgets (const SettingMap &settings);
|
||||
void initializeWidgets (const CSMSettings::SettingMap &settings);
|
||||
|
||||
private:
|
||||
void initPage();
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
#include "itemblock.hpp"
|
||||
#include "proxyblock.hpp"
|
||||
|
||||
CsSettings::CustomBlock::CustomBlock (QWidget *parent) : AbstractBlock (parent)
|
||||
CSVSettings::CustomBlock::CustomBlock (QWidget *parent) : AbstractBlock (parent)
|
||||
{
|
||||
}
|
||||
|
||||
int CsSettings::CustomBlock::build(GroupBlockDefList &defList, GroupBlockDefList::iterator *it)
|
||||
int CSVSettings::CustomBlock::build(GroupBlockDefList &defList, GroupBlockDefList::iterator *it)
|
||||
{
|
||||
int retVal = 0;
|
||||
|
||||
|
@ -37,7 +37,7 @@ int CsSettings::CustomBlock::build(GroupBlockDefList &defList, GroupBlockDefList
|
|||
return retVal;
|
||||
}
|
||||
|
||||
CsSettings::GroupBox *CsSettings::CustomBlock::buildGroupBox (CsSettings::OcsWidgetOrientation orientation)
|
||||
CSVSettings::GroupBox *CSVSettings::CustomBlock::buildGroupBox (OcsWidgetOrientation orientation)
|
||||
{
|
||||
GroupBox *box = new GroupBox (false, mBox);
|
||||
QLayout *layout = createLayout (orientation, true, box);
|
||||
|
@ -45,7 +45,7 @@ CsSettings::GroupBox *CsSettings::CustomBlock::buildGroupBox (CsSettings::OcsWid
|
|||
return box;
|
||||
}
|
||||
|
||||
int CsSettings::CustomBlock::buildGroupBlock(GroupBlockDef &def)
|
||||
int CSVSettings::CustomBlock::buildGroupBlock(GroupBlockDef &def)
|
||||
{
|
||||
GroupBlock *block = new GroupBlock (getParent());
|
||||
|
||||
|
@ -57,7 +57,7 @@ int CsSettings::CustomBlock::buildGroupBlock(GroupBlockDef &def)
|
|||
return block->build(def);
|
||||
}
|
||||
|
||||
int CsSettings::CustomBlock::buildProxyBlock(GroupBlockDef& def, ProxyBlock *block)
|
||||
int CSVSettings::CustomBlock::buildProxyBlock(GroupBlockDef& def, ProxyBlock *block)
|
||||
{
|
||||
if (def.properties.size() != 1)
|
||||
return -1;
|
||||
|
@ -91,13 +91,13 @@ int CsSettings::CustomBlock::buildProxyBlock(GroupBlockDef& def, ProxyBlock *blo
|
|||
return 0;
|
||||
}
|
||||
|
||||
CsSettings::SettingList *CsSettings::CustomBlock::getSettings()
|
||||
CSMSettings::SettingList *CSVSettings::CustomBlock::getSettings()
|
||||
{
|
||||
SettingList *settings = new SettingList();
|
||||
CSMSettings::SettingList *settings = new CSMSettings::SettingList();
|
||||
|
||||
foreach (GroupBlock *block, mGroupList)
|
||||
{
|
||||
SettingList *groupSettings = block->getSettings();
|
||||
CSMSettings::SettingList *groupSettings = block->getSettings();
|
||||
|
||||
if (groupSettings)
|
||||
settings->append(*groupSettings);
|
||||
|
@ -106,7 +106,7 @@ CsSettings::SettingList *CsSettings::CustomBlock::getSettings()
|
|||
return settings;
|
||||
}
|
||||
|
||||
bool CsSettings::CustomBlock::updateSettings (const SettingMap &settings)
|
||||
bool CSVSettings::CustomBlock::updateSettings (const CSMSettings::SettingMap &settings)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "abstractblock.hpp"
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
|
||||
class ProxyBlock;
|
||||
|
@ -19,8 +19,8 @@ namespace CsSettings
|
|||
|
||||
explicit CustomBlock (QWidget *parent = 0);
|
||||
|
||||
bool updateSettings (const SettingMap &settings);
|
||||
SettingList *getSettings();
|
||||
bool updateSettings (const CSMSettings::SettingMap &settings);
|
||||
CSMSettings::SettingList *getSettings();
|
||||
int build (GroupBlockDefList &defList, GroupBlockDefList::Iterator *it = 0);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "groupblock.hpp"
|
||||
#include "toggleblock.hpp"
|
||||
|
||||
CsSettings::EditorPage::EditorPage(QWidget *parent):
|
||||
CSVSettings::EditorPage::EditorPage(QWidget *parent):
|
||||
AbstractPage("Editor", parent)
|
||||
{
|
||||
// Hacks to get the stylesheet look properly
|
||||
|
@ -29,7 +29,7 @@ CsSettings::EditorPage::EditorPage(QWidget *parent):
|
|||
setupUi();
|
||||
}
|
||||
|
||||
void CsSettings::EditorPage::setupUi()
|
||||
void CSVSettings::EditorPage::setupUi()
|
||||
{
|
||||
GroupBlockDef undoStack (QString("Undo Stack Size"));
|
||||
GroupBlockDef topLevelWindowCount (QString("Maximum Top-Level Window Count"));
|
||||
|
@ -153,7 +153,7 @@ void CsSettings::EditorPage::setupUi()
|
|||
}
|
||||
}
|
||||
|
||||
void CsSettings::EditorPage::initializeWidgets (const SettingMap &settings)
|
||||
void CSVSettings::EditorPage::initializeWidgets (const CSMSettings::SettingMap &settings)
|
||||
{
|
||||
//iterate each item in each blocks in this section
|
||||
//validate the corresponding setting against the defined valuelist if any.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
class QGroupBox;
|
||||
|
||||
namespace CsSettings {
|
||||
namespace CSVSettings {
|
||||
|
||||
class UserSettings;
|
||||
class AbstractBlock;
|
||||
|
@ -19,7 +19,7 @@ namespace CsSettings {
|
|||
EditorPage(QWidget *parent = 0);
|
||||
|
||||
void setupUi();
|
||||
void initializeWidgets (const SettingMap &settings);
|
||||
void initializeWidgets (const CSMSettings::SettingMap &settings);
|
||||
|
||||
signals:
|
||||
void signalUpdateEditorSetting (const QString &settingName, const QString &settingValue);
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#include "groupblock.hpp"
|
||||
#include "itemblock.hpp"
|
||||
|
||||
CsSettings::GroupBlock::GroupBlock (QWidget* parent)
|
||||
CSVSettings::GroupBlock::GroupBlock (QWidget* parent)
|
||||
: AbstractBlock (parent)
|
||||
{}
|
||||
|
||||
CsSettings::GroupBlock::GroupBlock (bool isVisible, QWidget *parent)
|
||||
CSVSettings::GroupBlock::GroupBlock (bool isVisible, QWidget *parent)
|
||||
: AbstractBlock (isVisible, parent)
|
||||
{}
|
||||
|
||||
int CsSettings::GroupBlock::build (GroupBlockDef &def)
|
||||
int CSVSettings::GroupBlock::build (GroupBlockDef &def)
|
||||
{
|
||||
|
||||
if (def.properties.size() == 0)
|
||||
|
@ -44,14 +44,14 @@ int CsSettings::GroupBlock::build (GroupBlockDef &def)
|
|||
return retVal;
|
||||
}
|
||||
|
||||
CsSettings::SettingList *CsSettings::GroupBlock::getSettings()
|
||||
CSMSettings::SettingList *CSVSettings::GroupBlock::getSettings()
|
||||
{
|
||||
SettingList *settings = 0;
|
||||
CSMSettings::SettingList *settings = 0;
|
||||
|
||||
foreach (ItemBlock *block, mItemBlockList)
|
||||
{
|
||||
if (!settings)
|
||||
settings = new SettingList();
|
||||
settings = new CSMSettings::SettingList();
|
||||
|
||||
settings->append(*(block->getSettings ()));
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ CsSettings::SettingList *CsSettings::GroupBlock::getSettings()
|
|||
return settings;
|
||||
}
|
||||
|
||||
CsSettings::ItemBlock *CsSettings::GroupBlock::getItemBlock (const QString &name, ItemBlockList *blockList)
|
||||
CSVSettings::ItemBlock *CSVSettings::GroupBlock::getItemBlock (const QString &name, ItemBlockList *blockList)
|
||||
{
|
||||
ItemBlock *retBlock = 0;
|
||||
|
||||
|
@ -78,7 +78,7 @@ CsSettings::ItemBlock *CsSettings::GroupBlock::getItemBlock (const QString &name
|
|||
return retBlock;
|
||||
}
|
||||
|
||||
CsSettings::ItemBlock *CsSettings::GroupBlock::getItemBlock (int index)
|
||||
CSVSettings::ItemBlock *CSVSettings::GroupBlock::getItemBlock (int index)
|
||||
{
|
||||
ItemBlock *retBlock = 0;
|
||||
|
||||
|
@ -88,14 +88,14 @@ CsSettings::ItemBlock *CsSettings::GroupBlock::getItemBlock (int index)
|
|||
return retBlock;
|
||||
}
|
||||
|
||||
bool CsSettings::GroupBlock::updateSettings (const SettingMap &settings)
|
||||
bool CSVSettings::GroupBlock::updateSettings (const CSMSettings::SettingMap &settings)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
//update all non-proxy settings
|
||||
foreach (ItemBlock *block, mItemBlockList)
|
||||
{
|
||||
SettingContainer *setting = settings[block->objectName()];
|
||||
CSMSettings::SettingContainer *setting = settings[block->objectName()];
|
||||
|
||||
if (setting)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <QList>
|
||||
#include "abstractblock.hpp"
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
class ItemBlock;
|
||||
|
||||
|
@ -18,9 +18,9 @@ namespace CsSettings
|
|||
|
||||
int build (GroupBlockDef &def);
|
||||
|
||||
bool updateSettings (const SettingMap &settings);
|
||||
bool updateSettings (const CSMSettings::SettingMap &settings);
|
||||
|
||||
SettingList *getSettings();
|
||||
CSMSettings::SettingList *getSettings();
|
||||
ItemBlock *getItemBlock (const QString &name, ItemBlockList *blockList = 0);
|
||||
ItemBlock *getItemBlock (int index);
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
#include "groupbox.hpp"
|
||||
|
||||
const QString CsSettings::GroupBox::INVISIBLE_BOX_STYLE =
|
||||
const QString CSVSettings::GroupBox::INVISIBLE_BOX_STYLE =
|
||||
QString::fromUtf8("QGroupBox { border: 0px; padding 0px; margin: 0px;}");
|
||||
|
||||
CsSettings::GroupBox::GroupBox(QWidget *parent) :
|
||||
CSVSettings::GroupBox::GroupBox(QWidget *parent) :
|
||||
QGroupBox (parent)
|
||||
{
|
||||
initBox();
|
||||
}
|
||||
|
||||
CsSettings::GroupBox::GroupBox (bool isVisible, QWidget *parent) :
|
||||
CSVSettings::GroupBox::GroupBox (bool isVisible, QWidget *parent) :
|
||||
QGroupBox (parent)
|
||||
{
|
||||
initBox(isVisible);
|
||||
}
|
||||
|
||||
void CsSettings::GroupBox::initBox(bool isVisible)
|
||||
void CSVSettings::GroupBox::initBox(bool isVisible)
|
||||
{
|
||||
setFlat (true);
|
||||
VISIBLE_BOX_STYLE = styleSheet();
|
||||
|
@ -24,12 +24,12 @@ void CsSettings::GroupBox::initBox(bool isVisible)
|
|||
setStyleSheet (INVISIBLE_BOX_STYLE);
|
||||
}
|
||||
|
||||
bool CsSettings::GroupBox::borderVisibile() const
|
||||
bool CSVSettings::GroupBox::borderVisibile() const
|
||||
{
|
||||
return (styleSheet() != INVISIBLE_BOX_STYLE);
|
||||
}
|
||||
|
||||
void CsSettings::GroupBox::setTitle (const QString &title)
|
||||
void CSVSettings::GroupBox::setTitle (const QString &title)
|
||||
{
|
||||
if (borderVisibile() )
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ void CsSettings::GroupBox::setTitle (const QString &title)
|
|||
}
|
||||
}
|
||||
|
||||
void CsSettings::GroupBox::setBorderVisibility (bool value)
|
||||
void CSVSettings::GroupBox::setBorderVisibility (bool value)
|
||||
{
|
||||
if (value)
|
||||
setStyleSheet(VISIBLE_BOX_STYLE);
|
||||
|
@ -46,7 +46,7 @@ void CsSettings::GroupBox::setBorderVisibility (bool value)
|
|||
setStyleSheet(INVISIBLE_BOX_STYLE);
|
||||
}
|
||||
|
||||
void CsSettings::GroupBox::setMinimumWidth()
|
||||
void CSVSettings::GroupBox::setMinimumWidth()
|
||||
{
|
||||
//set minimum width to accommodate title, if needed
|
||||
//1.5 multiplier to account for bold title.
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
|
||||
#include <QGroupBox>
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
class GroupBox : public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
static const QString INVISIBLE_BOX_STYLE;
|
||||
QString VISIBLE_BOX_STYLE; //not a const...
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
#include <QFontMetrics>
|
||||
|
||||
CsSettings::ItemBlock::ItemBlock (QWidget* parent)
|
||||
CSVSettings::ItemBlock::ItemBlock (QWidget* parent)
|
||||
: mSetting (0), AbstractBlock (false, parent)
|
||||
{
|
||||
}
|
||||
|
||||
int CsSettings::ItemBlock::build(SettingsItemDef &iDef)
|
||||
int CSVSettings::ItemBlock::build(SettingsItemDef &iDef)
|
||||
{
|
||||
buildItemBlock (iDef);
|
||||
buildItemBlockWidgets (iDef);
|
||||
|
@ -15,7 +15,7 @@ int CsSettings::ItemBlock::build(SettingsItemDef &iDef)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CsSettings::ItemBlock::buildItemBlockWidgets (SettingsItemDef &iDef)
|
||||
void CSVSettings::ItemBlock::buildItemBlockWidgets (SettingsItemDef &iDef)
|
||||
{
|
||||
WidgetDef wDef = iDef.widget;
|
||||
QLayout *blockLayout = 0;
|
||||
|
@ -56,13 +56,13 @@ void CsSettings::ItemBlock::buildItemBlockWidgets (SettingsItemDef &iDef)
|
|||
}
|
||||
}
|
||||
|
||||
void CsSettings::ItemBlock::buildItemBlock (SettingsItemDef &iDef)
|
||||
void CSVSettings::ItemBlock::buildItemBlock (SettingsItemDef &iDef)
|
||||
{
|
||||
QString defaultValue = iDef.defaultValue;
|
||||
|
||||
setObjectName(iDef.name);
|
||||
|
||||
mSetting = new SettingsItem (objectName(),
|
||||
mSetting = new CSMSettings::SettingsItem (objectName(),
|
||||
iDef.hasMultipleValues, iDef.defaultValue,
|
||||
parent());
|
||||
|
||||
|
@ -74,7 +74,7 @@ void CsSettings::ItemBlock::buildItemBlock (SettingsItemDef &iDef)
|
|||
}
|
||||
|
||||
|
||||
bool CsSettings::ItemBlock::update (const QString &value)
|
||||
bool CSVSettings::ItemBlock::update (const QString &value)
|
||||
{
|
||||
bool success = updateItem (value);
|
||||
|
||||
|
@ -85,13 +85,13 @@ bool CsSettings::ItemBlock::update (const QString &value)
|
|||
}
|
||||
|
||||
|
||||
bool CsSettings::ItemBlock::updateItem (const QString &value)
|
||||
bool CSVSettings::ItemBlock::updateItem (const QString &value)
|
||||
{
|
||||
return mSetting->updateItem(value);
|
||||
}
|
||||
|
||||
|
||||
bool CsSettings::ItemBlock::updateBySignal(const QString &name, const QString &value, bool &doEmit)
|
||||
bool CSVSettings::ItemBlock::updateBySignal(const QString &name, const QString &value, bool &doEmit)
|
||||
{
|
||||
bool success = (mSetting->getValue() != value);
|
||||
|
||||
|
@ -101,15 +101,15 @@ bool CsSettings::ItemBlock::updateBySignal(const QString &name, const QString &v
|
|||
return success;
|
||||
}
|
||||
|
||||
CsSettings::SettingList *CsSettings::ItemBlock::getSettings ()
|
||||
CSMSettings::SettingList *CSVSettings::ItemBlock::getSettings ()
|
||||
{
|
||||
SettingList *list = new SettingList();
|
||||
CSMSettings::SettingList *list = new CSMSettings::SettingList();
|
||||
list->push_back(mSetting);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
QString CsSettings::ItemBlock::getValue() const
|
||||
QString CSVSettings::ItemBlock::getValue() const
|
||||
{
|
||||
return mSetting->getValue();
|
||||
}
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
|
||||
#include "abstractblock.hpp"
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
|
||||
class ItemBlock : public AbstractBlock
|
||||
{
|
||||
SettingsItem *mSetting;
|
||||
CSMSettings::SettingsItem *mSetting;
|
||||
WidgetList mWidgetList;
|
||||
|
||||
public:
|
||||
|
||||
ItemBlock (QWidget* parent = 0);
|
||||
|
||||
bool updateSettings (const SettingMap &settings) { return false; }
|
||||
bool updateSettings (const CSMSettings::SettingMap &settings) { return false; }
|
||||
|
||||
SettingList *getSettings ();
|
||||
CSMSettings::SettingList *getSettings ();
|
||||
QString getValue () const;
|
||||
|
||||
int getSettingCount();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "proxyblock.hpp"
|
||||
#include "itemblock.hpp"
|
||||
|
||||
CsSettings::ProxyBlock::ProxyBlock (QWidget *parent)
|
||||
CSVSettings::ProxyBlock::ProxyBlock (QWidget *parent)
|
||||
: GroupBlock (parent)
|
||||
{
|
||||
}
|
||||
int CsSettings::ProxyBlock::build (GroupBlockDef &proxyDef)
|
||||
int CSVSettings::ProxyBlock::build (GroupBlockDef &proxyDef)
|
||||
{
|
||||
//get the list of pre-defined values for the proxy
|
||||
mValueList = proxyDef.properties.at(0)->valueList;
|
||||
|
@ -19,7 +19,7 @@ int CsSettings::ProxyBlock::build (GroupBlockDef &proxyDef)
|
|||
return success;
|
||||
}
|
||||
|
||||
void CsSettings::ProxyBlock::addSetting (ItemBlock *settingBlock, QStringList *proxyList)
|
||||
void CSVSettings::ProxyBlock::addSetting (ItemBlock *settingBlock, QStringList *proxyList)
|
||||
{
|
||||
//connect the item block of the proxied seting to the generic update slot
|
||||
connect (settingBlock, SIGNAL (signalUpdateSetting(const QString &, const QString &)),
|
||||
|
@ -29,23 +29,23 @@ void CsSettings::ProxyBlock::addSetting (ItemBlock *settingBlock, QStringList *p
|
|||
mProxyList << proxyList;
|
||||
}
|
||||
|
||||
bool CsSettings::ProxyBlock::updateSettings (const SettingMap &settings)
|
||||
bool CSVSettings::ProxyBlock::updateSettings (const CSMSettings::SettingMap &settings)
|
||||
{
|
||||
return updateByProxiedSettings(&settings);
|
||||
}
|
||||
|
||||
bool CsSettings::ProxyBlock::updateBySignal(const QString &name, const QString &value, bool &doEmit)
|
||||
bool CSVSettings::ProxyBlock::updateBySignal(const QString &name, const QString &value, bool &doEmit)
|
||||
{
|
||||
doEmit = false;
|
||||
return updateProxiedSettings();
|
||||
}
|
||||
|
||||
void CsSettings::ProxyBlock::slotUpdateProxySetting (const QString &name, const QString &value)
|
||||
void CSVSettings::ProxyBlock::slotUpdateProxySetting (const QString &name, const QString &value)
|
||||
{
|
||||
updateByProxiedSettings();
|
||||
}
|
||||
|
||||
bool CsSettings::ProxyBlock::updateProxiedSettings()
|
||||
bool CSVSettings::ProxyBlock::updateProxiedSettings()
|
||||
{
|
||||
foreach (ItemBlock *block, mProxiedItemBlockList)
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ bool CsSettings::ProxyBlock::updateProxiedSettings()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CsSettings::ProxyBlock::updateByProxiedSettings(const SettingMap *settings)
|
||||
bool CSVSettings::ProxyBlock::updateByProxiedSettings(const CSMSettings::SettingMap *settings)
|
||||
{
|
||||
bool success = false;
|
||||
int commonIndex = -1;
|
||||
|
@ -143,7 +143,7 @@ bool CsSettings::ProxyBlock::updateByProxiedSettings(const SettingMap *settings)
|
|||
return success;
|
||||
}
|
||||
|
||||
CsSettings::ItemBlock *CsSettings::ProxyBlock::getProxiedItemBlock (const QString &name)
|
||||
CSVSettings::ItemBlock *CSVSettings::ProxyBlock::getProxiedItemBlock (const QString &name)
|
||||
{
|
||||
return getItemBlock (name, &mProxiedItemBlockList);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "groupblock.hpp"
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
class ProxyBlock : public GroupBlock
|
||||
{
|
||||
|
@ -23,14 +23,14 @@ namespace CsSettings
|
|||
void addSetting (ItemBlock* settingBlock, QStringList *proxyList);
|
||||
int build (GroupBlockDef &def);
|
||||
|
||||
SettingList *getSettings() { return 0; }
|
||||
bool updateSettings (const SettingMap &settings);
|
||||
CSMSettings::SettingList *getSettings() { return 0; }
|
||||
bool updateSettings (const CSMSettings::SettingMap &settings);
|
||||
bool updateBySignal (const QString &name, const QString &value, bool &doEmit);
|
||||
|
||||
private:
|
||||
|
||||
ItemBlock *getProxiedItemBlock (const QString &name);
|
||||
bool updateByProxiedSettings(const SettingMap *settings = 0);
|
||||
bool updateByProxiedSettings(const CSMSettings::SettingMap *settings = 0);
|
||||
bool updateProxiedSettings();
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "abstractwidget.hpp"
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
//VALID FOR RADIOBUTTON / CHECKBOX (or other toggle widget with it's own label)
|
||||
template <typename T1>
|
||||
|
@ -25,7 +25,7 @@ namespace CsSettings
|
|||
|
||||
public:
|
||||
|
||||
explicit SettingWidget(WidgetDef &def, QLayout *layout, QWidget* parent = 0)
|
||||
explicit SettingWidget (WidgetDef &def, QLayout *layout, QWidget* parent = 0)
|
||||
: AbstractWidget (layout, parent), mWidget (new T1 (parent))
|
||||
{
|
||||
mWidget->setText(def.caption);
|
||||
|
@ -55,7 +55,7 @@ namespace CsSettings
|
|||
|
||||
public:
|
||||
|
||||
SettingWidget(WidgetDef &def, QLayout *layout, QWidget *parent = 0)
|
||||
SettingWidget (WidgetDef &def, QLayout *layout, QWidget *parent = 0)
|
||||
: AbstractWidget (layout, parent), mWidget (new QSpinBox (parent))
|
||||
{
|
||||
def.caption += tr(" (%1 to %2)").arg(def.minMax->left).arg(def.minMax->right);
|
||||
|
@ -91,7 +91,7 @@ namespace CsSettings
|
|||
};
|
||||
|
||||
template <>
|
||||
class SettingWidget <QComboBox>: public CsSettings::AbstractWidget
|
||||
class SettingWidget <QComboBox>: public CSVSettings::AbstractWidget
|
||||
{
|
||||
|
||||
QComboBox *mWidget;
|
||||
|
@ -143,7 +143,7 @@ namespace CsSettings
|
|||
};
|
||||
|
||||
template <>
|
||||
class SettingWidget <QLineEdit>: public CsSettings::AbstractWidget
|
||||
class SettingWidget <QLineEdit>: public CSVSettings::AbstractWidget
|
||||
{
|
||||
|
||||
QLineEdit *mWidget;
|
||||
|
@ -176,7 +176,7 @@ namespace CsSettings
|
|||
};
|
||||
|
||||
template <>
|
||||
class SettingWidget <QListWidget>: public CsSettings::AbstractWidget
|
||||
class SettingWidget <QListWidget>: public CSVSettings::AbstractWidget
|
||||
{
|
||||
|
||||
QListWidget *mWidget;
|
||||
|
|
1
apps/opencs/view/settings/support.cpp
Normal file
1
apps/opencs/view/settings/support.cpp
Normal file
|
@ -0,0 +1 @@
|
|||
#include "support.hpp"
|
144
apps/opencs/view/settings/support.hpp
Normal file
144
apps/opencs/view/settings/support.hpp
Normal file
|
@ -0,0 +1,144 @@
|
|||
#ifndef VIEW_SUPPORT_HPP
|
||||
#define VIEW_SUPPORT_HPP
|
||||
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
|
||||
#include "../../model/settings/support.hpp"
|
||||
|
||||
namespace CSVSettings
|
||||
{
|
||||
struct WidgetDef;
|
||||
class ItemBlock;
|
||||
class GroupBlock;
|
||||
struct GroupBlockDef;
|
||||
|
||||
typedef QList<GroupBlockDef *> GroupBlockDefList;
|
||||
typedef QList<GroupBlock *> GroupBlockList;
|
||||
typedef QList<ItemBlock *> ItemBlockList;
|
||||
typedef QList<QStringList *> ProxyList;
|
||||
typedef QList<WidgetDef *> WidgetList;
|
||||
typedef QMap<QString, ItemBlock *> ItemBlockMap;
|
||||
|
||||
enum OcsWidgetOrientation
|
||||
{
|
||||
OCS_HORIZONTAL,
|
||||
OCS_VERTICAL
|
||||
};
|
||||
|
||||
enum OcsWidgetType
|
||||
{
|
||||
OCS_CHECK_WIDGET,
|
||||
OCS_COMBO_WIDGET,
|
||||
OCS_TEXT_WIDGET,
|
||||
OCS_LIST_WIDGET,
|
||||
OCS_RADIO_WIDGET,
|
||||
OCS_SPIN_WIDGET,
|
||||
OCS_UNDEFINED_WIDGET
|
||||
};
|
||||
|
||||
enum OcsAlignment
|
||||
{
|
||||
OCS_LEFT = Qt::AlignLeft,
|
||||
OCS_CENTER = Qt::AlignHCenter,
|
||||
OCS_RIGHT = Qt::AlignRight
|
||||
};
|
||||
|
||||
//template for defining the widget of a property.
|
||||
struct WidgetDef
|
||||
{
|
||||
OcsWidgetType type; //type of widget providing input
|
||||
int labelWidth; //width of caption label
|
||||
int widgetWidth; //width of input widget
|
||||
OcsWidgetOrientation orientation; //label / widget orientation (horizontal / vertical)
|
||||
QString inputMask; //input mask (line edit)
|
||||
QString caption; //label caption. Leave empty for multiple items. See BlockDef::captionList
|
||||
QString value; //widget value. Leave empty for multiple items. See BlockDef::valueList
|
||||
CSMSettings::QStringPair *minMax; //Min/Max QString value pair. If empty, assigned to property item value pair.
|
||||
QStringList *valueList; //value list for list widgets. If left empty, is assigned to property item value list during block build().
|
||||
bool isDefault; //isDefault - determined at runtime.
|
||||
OcsAlignment valueAlignment; //left / center / right-justify text in widget
|
||||
OcsAlignment widgetAlignment; //left / center / right-justify widget in group box
|
||||
|
||||
|
||||
WidgetDef() : labelWidth (-1), widgetWidth (-1),
|
||||
orientation (OCS_HORIZONTAL),
|
||||
isDefault (true), valueAlignment (OCS_CENTER),
|
||||
widgetAlignment (OCS_RIGHT),
|
||||
inputMask (""), value (""),
|
||||
caption (""), valueList (0)
|
||||
{}
|
||||
|
||||
WidgetDef (OcsWidgetType widgType)
|
||||
: type (widgType), orientation (OCS_HORIZONTAL),
|
||||
caption (""), value (""), valueAlignment (OCS_CENTER),
|
||||
widgetAlignment (OCS_RIGHT),
|
||||
labelWidth (-1), widgetWidth (-1),
|
||||
valueList (0), isDefault (true)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
//Defines the attributes of the property as it is represented in the config file
|
||||
//as well as the UI elements (group box and widget) that serve it.
|
||||
//Only one widget may serve as the input widget for the property.
|
||||
struct SettingsItemDef
|
||||
{
|
||||
QString name; //property name
|
||||
QStringList *valueList; //list of valid values for the property.
|
||||
//Used to populate option widget captions or list widget item lists (see WidgetDef::caption / value)
|
||||
QString defaultValue;
|
||||
bool hasMultipleValues;
|
||||
CSMSettings::QStringPair minMax; //minimum / maximum value pair
|
||||
WidgetDef widget; //definition of the input widget for this setting
|
||||
OcsWidgetOrientation orientation; //general orientation of the widget / label for this property
|
||||
ProxyList *proxyList; //list of property and corresponding default values for proxy widget
|
||||
|
||||
SettingsItemDef() : name (""), defaultValue (""), orientation (OCS_VERTICAL), hasMultipleValues (false)
|
||||
{}
|
||||
|
||||
SettingsItemDef (QString propName, QString propDefault, OcsWidgetOrientation propOrient = OCS_VERTICAL)
|
||||
: name (propName), defaultValue (propDefault), orientation (propOrient),
|
||||
hasMultipleValues(false), valueList (new QStringList), proxyList ( new ProxyList)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
//Hierarchically, this is a "sub-section" of properties within a section, solely for UI organization.
|
||||
//Does not correlate to config file structure.
|
||||
struct GroupBlockDef
|
||||
{
|
||||
QString title; //title of the block containing the property or properties of this sub-section
|
||||
QStringList captions; //list of captions for widgets at the block level (not associated with any particular property)
|
||||
WidgetList widgets; //list of widgets at the block level (not associated with any particular property)
|
||||
QList<SettingsItemDef *> properties; //list of the property(ies) which are subordinate to the property block.
|
||||
OcsWidgetOrientation widgetOrientation; //general orientation of widgets in group block
|
||||
bool isVisible; //determines whether or not box border/title are visible
|
||||
bool isProxy; //indicates whether or not this block defines a proxy block
|
||||
QString defaultValue; //generic default value attribute
|
||||
|
||||
GroupBlockDef (): title(""), widgetOrientation (OCS_VERTICAL), isVisible (true), isProxy (false), defaultValue ("")
|
||||
{}
|
||||
|
||||
GroupBlockDef (QString blockTitle)
|
||||
: title (blockTitle), widgetOrientation (OCS_VERTICAL), isProxy (false), isVisible (true), defaultValue ("")
|
||||
{}
|
||||
};
|
||||
|
||||
struct CustomBlockDef
|
||||
{
|
||||
QString title;
|
||||
QString defaultValue; //default value for widgets unique to the custom block
|
||||
GroupBlockDefList blockDefList; //list of settings groups that comprise the settings within the custom block
|
||||
OcsWidgetOrientation blockOrientation;
|
||||
|
||||
CustomBlockDef (): title (""), defaultValue (""), blockOrientation (OCS_HORIZONTAL)
|
||||
{}
|
||||
|
||||
CustomBlockDef (const QString &blockTitle)
|
||||
: title (blockTitle), defaultValue (""), blockOrientation (OCS_HORIZONTAL)
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // VIEW_SUPPORT_HPP
|
|
@ -3,11 +3,11 @@
|
|||
#include "groupbox.hpp"
|
||||
#include "itemblock.hpp"
|
||||
|
||||
CsSettings::ToggleBlock::ToggleBlock(QWidget *parent) :
|
||||
CSVSettings::ToggleBlock::ToggleBlock(QWidget *parent) :
|
||||
CustomBlock(parent)
|
||||
{}
|
||||
|
||||
int CsSettings::ToggleBlock::build(CustomBlockDef &def)
|
||||
int CSVSettings::ToggleBlock::build(CustomBlockDef &def)
|
||||
{
|
||||
if (def.blockDefList.size()==0)
|
||||
return -1;
|
||||
|
@ -49,7 +49,7 @@ int CsSettings::ToggleBlock::build(CustomBlockDef &def)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CsSettings::GroupBox *CsSettings::ToggleBlock::buildToggleWidgets (GroupBlockDef &def, QString &defaultToggle)
|
||||
CSVSettings::GroupBox *CSVSettings::ToggleBlock::buildToggleWidgets (GroupBlockDef &def, QString &defaultToggle)
|
||||
{
|
||||
GroupBox *box = new GroupBox (false, getParent());
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "customblock.hpp"
|
||||
|
||||
namespace CsSettings
|
||||
namespace CSVSettings
|
||||
{
|
||||
class GroupBlock;
|
||||
class GroupBox;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "settingwidget.hpp"
|
||||
#include <QDebug>
|
||||
|
||||
CsSettings::UserSettingsDialog::UserSettingsDialog(QMainWindow *parent) :
|
||||
CSVSettings::UserSettingsDialog::UserSettingsDialog(QMainWindow *parent) :
|
||||
QMainWindow (parent), mUserSettings (mCfgMgr), mStackedWidget (0)
|
||||
{
|
||||
setWindowTitle(QString::fromUtf8 ("User Settings"));
|
||||
|
@ -31,22 +31,22 @@ CsSettings::UserSettingsDialog::UserSettingsDialog(QMainWindow *parent) :
|
|||
SLOT (slotChangePage (QListWidgetItem*, QListWidgetItem*)));
|
||||
}
|
||||
|
||||
CsSettings::UserSettingsDialog::~UserSettingsDialog()
|
||||
CSVSettings::UserSettingsDialog::~UserSettingsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void CsSettings::UserSettingsDialog::closeEvent (QCloseEvent *event)
|
||||
void CSVSettings::UserSettingsDialog::closeEvent (QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void CsSettings::UserSettingsDialog::setWidgetStates (SectionMap settingsMap)
|
||||
void CSVSettings::UserSettingsDialog::setWidgetStates (CSMSettings::SectionMap settingsMap)
|
||||
{
|
||||
//iterate the tabWidget's pages (sections)
|
||||
for (int i = 0; i < mStackedWidget->count(); i++)
|
||||
{
|
||||
//get the settings defined for the entire section
|
||||
CsSettings::SettingMap *settings = settingsMap [mStackedWidget->widget(i)->objectName()];
|
||||
CSMSettings::SettingMap *settings = settingsMap [mStackedWidget->widget(i)->objectName()];
|
||||
|
||||
//if found, initialize the page's widgets
|
||||
if (settings)
|
||||
|
@ -57,7 +57,7 @@ void CsSettings::UserSettingsDialog::setWidgetStates (SectionMap settingsMap)
|
|||
}
|
||||
}
|
||||
|
||||
void CsSettings::UserSettingsDialog::buildPages()
|
||||
void CSVSettings::UserSettingsDialog::buildPages()
|
||||
{
|
||||
//craete central widget with it's layout and immediate children
|
||||
QWidget *centralWidget = new QWidget (this);
|
||||
|
@ -75,17 +75,17 @@ void CsSettings::UserSettingsDialog::buildPages()
|
|||
setCentralWidget (centralWidget);
|
||||
setDockOptions (QMainWindow::AllowNestedDocks);
|
||||
//uncomment to test with sample editor page.
|
||||
//createSamplePage();
|
||||
createSamplePage();
|
||||
createPage<BlankPage>("Page1");
|
||||
createPage<BlankPage>("Page2");
|
||||
createPage<BlankPage>("Page3");
|
||||
}
|
||||
|
||||
void CsSettings::UserSettingsDialog::createSamplePage()
|
||||
void CSVSettings::UserSettingsDialog::createSamplePage()
|
||||
{
|
||||
//add pages to stackedwidget and items to listwidget
|
||||
CsSettings::AbstractPage *page
|
||||
= new CsSettings::EditorPage(this);
|
||||
CSVSettings::AbstractPage *page
|
||||
= new CSVSettings::EditorPage(this);
|
||||
|
||||
mStackedWidget->addWidget (page);
|
||||
|
||||
|
@ -95,7 +95,7 @@ void CsSettings::UserSettingsDialog::createSamplePage()
|
|||
this, SIGNAL ( signalUpdateEditorSetting (const QString &, const QString &)));
|
||||
}
|
||||
|
||||
void CsSettings::UserSettingsDialog::positionWindow ()
|
||||
void CSVSettings::UserSettingsDialog::positionWindow ()
|
||||
{
|
||||
QRect scr = QApplication::desktop()->screenGeometry();
|
||||
|
||||
|
@ -103,14 +103,14 @@ void CsSettings::UserSettingsDialog::positionWindow ()
|
|||
|
||||
}
|
||||
|
||||
CsSettings::SectionMap CsSettings::UserSettingsDialog::loadSettings ()
|
||||
CSMSettings::SectionMap CSVSettings::UserSettingsDialog::loadSettings ()
|
||||
{
|
||||
QString userPath = QString::fromStdString(mCfgMgr.getUserPath().string());
|
||||
|
||||
mPaths.append(QString("opencs.cfg"));
|
||||
mPaths.append(userPath + QString("opencs.cfg"));
|
||||
|
||||
SectionMap settingsMap;
|
||||
CSMSettings::SectionMap settingsMap;
|
||||
|
||||
foreach (const QString &path, mPaths)
|
||||
{
|
||||
|
@ -144,9 +144,9 @@ CsSettings::SectionMap CsSettings::UserSettingsDialog::loadSettings ()
|
|||
return settingsMap;
|
||||
}
|
||||
|
||||
void CsSettings::UserSettingsDialog::writeSettings()
|
||||
void CSVSettings::UserSettingsDialog::writeSettings()
|
||||
{
|
||||
QMap<QString, SettingList *> settings;
|
||||
QMap<QString, CSMSettings::SettingList *> settings;
|
||||
|
||||
for (int i = 0; i < mStackedWidget->count(); ++i)
|
||||
{
|
||||
|
@ -158,12 +158,12 @@ void CsSettings::UserSettingsDialog::writeSettings()
|
|||
|
||||
}
|
||||
|
||||
CsSettings::AbstractPage *CsSettings::UserSettingsDialog::getAbstractPage (int index)
|
||||
CSVSettings::AbstractPage *CSVSettings::UserSettingsDialog::getAbstractPage (int index)
|
||||
{
|
||||
return dynamic_cast<AbstractPage *>(mStackedWidget->widget(index));
|
||||
}
|
||||
|
||||
void CsSettings::UserSettingsDialog::slotChangePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
void CSVSettings::UserSettingsDialog::slotChangePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
{
|
||||
if (!current)
|
||||
current = previous;
|
||||
|
|
|
@ -13,7 +13,7 @@ class AbstractWidget;
|
|||
class QStackedWidget;
|
||||
class QListWidget;
|
||||
|
||||
namespace CsSettings {
|
||||
namespace CSVSettings {
|
||||
|
||||
class AbstractPage;
|
||||
class UserSettingsDialog : public QMainWindow
|
||||
|
@ -23,7 +23,7 @@ namespace CsSettings {
|
|||
QStringList mPaths;
|
||||
QListWidget *mListWidget;
|
||||
QStackedWidget *mStackedWidget;
|
||||
UserSettings mUserSettings;
|
||||
CSMSettings::UserSettings mUserSettings;
|
||||
Files::ConfigurationManager mCfgMgr;
|
||||
|
||||
public:
|
||||
|
@ -34,10 +34,10 @@ namespace CsSettings {
|
|||
|
||||
void closeEvent (QCloseEvent *event);
|
||||
AbstractPage *getAbstractPage (int index);
|
||||
void setWidgetStates (SectionMap settingsMap);
|
||||
void setWidgetStates (CSMSettings::SectionMap settingsMap);
|
||||
void buildPages();
|
||||
void positionWindow ();
|
||||
SectionMap loadSettings();
|
||||
CSMSettings::SectionMap loadSettings();
|
||||
void writeSettings();
|
||||
void createSamplePage();
|
||||
|
||||
|
|
Loading…
Reference in a new issue