mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-11 00:39:59 +00:00
700d55f1fb
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
109 lines
2.4 KiB
C++
109 lines
2.4 KiB
C++
#include "groupblock.hpp"
|
|
#include "itemblock.hpp"
|
|
|
|
CSVSettings::GroupBlock::GroupBlock (QWidget* parent)
|
|
: AbstractBlock (parent)
|
|
{}
|
|
|
|
CSVSettings::GroupBlock::GroupBlock (bool isVisible, QWidget *parent)
|
|
: AbstractBlock (isVisible, parent)
|
|
{}
|
|
|
|
int CSVSettings::GroupBlock::build (GroupBlockDef *def)
|
|
{
|
|
|
|
if (def->properties.size() == 0)
|
|
return -1;
|
|
|
|
int retVal = 0;
|
|
|
|
setVisible (def->isVisible);
|
|
|
|
mBox->setLayout(createLayout (def->widgetOrientation, true));
|
|
|
|
setObjectName (def->title);
|
|
mBox->setTitle (def->title);
|
|
|
|
foreach (SettingsItemDef *itemDef, def->properties)
|
|
{
|
|
ItemBlock *block = new ItemBlock (mBox);
|
|
|
|
if (block->build (*itemDef) < 0)
|
|
{
|
|
retVal = -2;
|
|
break;
|
|
}
|
|
|
|
mItemBlockList << block;
|
|
mBox->layout()->addWidget (block->getGroupBox());
|
|
|
|
connect (block, SIGNAL (signalUpdateSetting (const QString &, const QString &)),
|
|
this, SLOT (slotUpdateSetting (const QString &, const QString &) ));
|
|
}
|
|
|
|
return retVal;
|
|
}
|
|
|
|
CSMSettings::SettingList *CSVSettings::GroupBlock::getSettings()
|
|
{
|
|
CSMSettings::SettingList *settings = 0;
|
|
|
|
foreach (ItemBlock *block, mItemBlockList)
|
|
{
|
|
if (!settings)
|
|
settings = new CSMSettings::SettingList();
|
|
|
|
settings->append(*(block->getSettings ()));
|
|
}
|
|
|
|
return settings;
|
|
}
|
|
|
|
CSVSettings::ItemBlock *CSVSettings::GroupBlock::getItemBlock (const QString &name, ItemBlockList *blockList)
|
|
{
|
|
ItemBlock *retBlock = 0;
|
|
|
|
if (!blockList)
|
|
blockList = &mItemBlockList;
|
|
|
|
foreach (ItemBlock *block, *blockList)
|
|
{
|
|
if (block->objectName() == name)
|
|
{
|
|
retBlock = block;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return retBlock;
|
|
}
|
|
|
|
CSVSettings::ItemBlock *CSVSettings::GroupBlock::getItemBlock (int index)
|
|
{
|
|
ItemBlock *retBlock = 0;
|
|
|
|
if (mItemBlockList.size() > index)
|
|
retBlock = mItemBlockList.at(index);
|
|
|
|
return retBlock;
|
|
}
|
|
|
|
bool CSVSettings::GroupBlock::updateSettings (const CSMSettings::SettingMap &settings)
|
|
{
|
|
bool success = true;
|
|
|
|
//update all non-proxy settings
|
|
foreach (ItemBlock *block, mItemBlockList)
|
|
{
|
|
CSMSettings::SettingContainer *setting = settings[block->objectName()];
|
|
|
|
if (setting)
|
|
{
|
|
bool success2 = block->update (setting->getValue());
|
|
success = success && success2;
|
|
}
|
|
}
|
|
|
|
return success;
|
|
}
|