openmw-tes3coop/apps/opencs/view/settings/editorpage.cpp
graffy76 700d55f1fb Fixed / implemented missing features for RecordStatusDelegate
Implemented updating editor application from preferences menu, loading
settings when editor loads, adding Record Status Display prefernce.

Fixed multiple bugs, made changes to CSM(V)Settings classes to make
implementing new prefrences easier.

Rewrote CSMSettings::UserSettings to retain last-loaded settings.

Adjusted icon position in Record Status column

Capitalized status text

Added delegate to referenceables table
2013-06-15 06:40:18 -05:00

59 lines
1.9 KiB
C++

#include "editorpage.hpp"
#include "groupblock.hpp"
#include "../../model/settings/usersettings.hpp"
CSVSettings::EditorPage::EditorPage(QWidget* parent) :
AbstractPage(parent)
{
setupUi();
}
CSVSettings::EditorPage::EditorPage (const QString &pageName, QWidget* parent)
: AbstractPage (pageName, parent)
{
setupUi();
}
CSVSettings::GroupBlockDef *CSVSettings::EditorPage::setupRecordStatusDisplay()
{
GroupBlockDef *statusBlock = new GroupBlockDef(QString("Record Status Display"));
SettingsItemDef *statusItem = new SettingsItemDef (statusBlock->title, "Icon and Text");
*(statusItem->valueList) << QString("Icon and Text") << QString("Icon Only") << QString("Text Only");
WidgetDef statusWidget (Widget_RadioButton);
statusWidget.valueList = statusItem->valueList;
statusItem->widget = statusWidget;
statusBlock->properties << statusItem;
return statusBlock;
}
void CSVSettings::EditorPage::setupUi()
{
mAbstractBlocks << buildBlock<GroupBlock>(setupRecordStatusDisplay());
foreach (AbstractBlock *block, mAbstractBlocks)
{
connect (block, SIGNAL (signalUpdateSetting (const QString &, const QString &)),
this, SIGNAL (signalUpdateEditorSetting (const QString &, const QString &)) );
}
connect ( this,
SIGNAL ( signalUpdateEditorSetting (const QString &, const QString &)),
&(CSMSettings::UserSettings::instance()),
SIGNAL ( signalUpdateEditorSetting (const QString &, const QString &)));
}
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.
for (AbstractBlockList::Iterator it_block = mAbstractBlocks.begin();
it_block != mAbstractBlocks.end(); ++it_block)
(*it_block)->updateSettings (settings);
}