mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-07 10:21:35 +00:00
Re-link user settings to editor main application
This commit is contained in:
parent
e3384e3999
commit
4b607d658f
18 changed files with 290 additions and 371 deletions
|
@ -28,6 +28,7 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
|
||||||
setupDataFiles (config.first);
|
setupDataFiles (config.first);
|
||||||
|
|
||||||
CSMSettings::UserSettings::instance().loadSettings ("opencs.cfg");
|
CSMSettings::UserSettings::instance().loadSettings ("opencs.cfg");
|
||||||
|
mSettings.setModel (CSMSettings::UserSettings::instance());
|
||||||
|
|
||||||
ogreInit.init ((mCfgMgr.getUserConfigPath() / "opencsOgre.log").string());
|
ogreInit.init ((mCfgMgr.getUserConfigPath() / "opencsOgre.log").string());
|
||||||
|
|
||||||
|
@ -117,6 +118,18 @@ std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfi
|
||||||
|
|
||||||
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
||||||
|
|
||||||
|
//iterate the data directories and add them to the file dialog for loading
|
||||||
|
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
||||||
|
{
|
||||||
|
QString path = QString::fromStdString(iter->string());
|
||||||
|
mFileDialog.addFiles(path);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
//load the settings into the userSettings instance.
|
||||||
|
const QString settingFileName = "opencs.cfg";
|
||||||
|
CSMSettings::UserSettings::instance().loadSettings(settingFileName);
|
||||||
|
*/
|
||||||
|
|
||||||
return std::make_pair (dataDirs, variables["fallback-archive"].as<std::vector<std::string> >());
|
return std::make_pair (dataDirs, variables["fallback-archive"].as<std::vector<std::string> >());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "view/doc/filedialog.hpp"
|
#include "view/doc/filedialog.hpp"
|
||||||
#include "view/doc/newgame.hpp"
|
#include "view/doc/newgame.hpp"
|
||||||
|
|
||||||
#include "view/settings/usersettingsdialog.hpp"
|
#include "view/settings/dialog.hpp"
|
||||||
|
|
||||||
namespace OgreInit
|
namespace OgreInit
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ namespace CS
|
||||||
CSVDoc::ViewManager mViewManager;
|
CSVDoc::ViewManager mViewManager;
|
||||||
CSVDoc::StartupDialogue mStartup;
|
CSVDoc::StartupDialogue mStartup;
|
||||||
CSVDoc::NewGameDialogue mNewGame;
|
CSVDoc::NewGameDialogue mNewGame;
|
||||||
CSVSettings::UserSettingsDialog mSettings;
|
CSVSettings::Dialog mSettings;
|
||||||
CSVDoc::FileDialog mFileDialog;
|
CSVDoc::FileDialog mFileDialog;
|
||||||
boost::filesystem::path mLocal;
|
boost::filesystem::path mLocal;
|
||||||
boost::filesystem::path mResources;
|
boost::filesystem::path mResources;
|
||||||
|
|
|
@ -9,11 +9,16 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
#include "settingcontainer.hpp"
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
|
||||||
|
#include "setting.hpp"
|
||||||
|
#include "support.hpp"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workaround for problems with whitespaces in paths in older versions of Boost library
|
* Workaround for problems with whitespaces in paths in older versions of Boost library
|
||||||
*/
|
*/
|
||||||
|
@ -37,38 +42,151 @@ CSMSettings::UserSettings::UserSettings()
|
||||||
assert(!mUserSettingsInstance);
|
assert(!mUserSettingsInstance);
|
||||||
mUserSettingsInstance = this;
|
mUserSettingsInstance = this;
|
||||||
|
|
||||||
mReadWriteMessage = QObject::tr("<br><b>Could not open or create file for writing</b><br><br> \
|
buildSettingModelDefaults();
|
||||||
Please make sure you have the right permissions and try again.<br>");
|
|
||||||
|
|
||||||
mReadOnlyMessage = QObject::tr("<br><b>Could not open file for reading</b><br><br> \
|
|
||||||
Please make sure you have the right permissions and try again.<br>");
|
|
||||||
|
|
||||||
buildEditorSettingDefaults();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMSettings::UserSettings::buildEditorSettingDefaults()
|
void CSMSettings::UserSettings::buildSettingModelDefaults()
|
||||||
{
|
{
|
||||||
SettingContainer *windowHeight = new SettingContainer("768", this);
|
QString section = "Window Size";
|
||||||
SettingContainer *windowWidth = new SettingContainer("1024", this);
|
{
|
||||||
SettingContainer *rsDelegate = new SettingContainer("Icon and Text", this);
|
Setting *width = createSetting (Type_SingleText, section, "Width");
|
||||||
SettingContainer *refIdTypeDelegate = new SettingContainer("Icon and Text", this);
|
Setting *height = createSetting (Type_SingleText, section, "Height");
|
||||||
|
|
||||||
windowHeight->setObjectName ("Height");
|
width->setWidgetWidth (5);
|
||||||
windowWidth->setObjectName ("Width");
|
height->setWidgetWidth (5);
|
||||||
rsDelegate->setObjectName ("Record Status Display");
|
|
||||||
refIdTypeDelegate->setObjectName ("Referenceable ID Type Display");
|
|
||||||
|
|
||||||
SettingMap *displayFormatMap = new SettingMap;
|
width->setDefaultValues (QStringList() << "1024");
|
||||||
SettingMap *windowSizeMap = new SettingMap;
|
height->setDefaultValues (QStringList() << "768");
|
||||||
|
|
||||||
displayFormatMap->insert (rsDelegate->objectName(), rsDelegate );
|
width->setEditorSetting (true);
|
||||||
displayFormatMap->insert (refIdTypeDelegate->objectName(), refIdTypeDelegate);
|
height->setEditorSetting (true);
|
||||||
|
|
||||||
windowSizeMap->insert (windowWidth->objectName(), windowWidth );
|
height->setViewLocation (2,2);
|
||||||
windowSizeMap->insert (windowHeight->objectName(), windowHeight );
|
width->setViewLocation (2,1);
|
||||||
|
|
||||||
mEditorSettingDefaults.insert ("Display Format", displayFormatMap);
|
/*
|
||||||
mEditorSettingDefaults.insert ("Window Size", windowSizeMap);
|
*Create the proxy setting for predefined values
|
||||||
|
*/
|
||||||
|
Setting *preDefined = createSetting (Type_SingleList, section,
|
||||||
|
"Pre-Defined",
|
||||||
|
QStringList()
|
||||||
|
<< "640 x 480"
|
||||||
|
<< "800 x 600"
|
||||||
|
<< "1024 x 768"
|
||||||
|
<< "1440 x 900"
|
||||||
|
);
|
||||||
|
|
||||||
|
preDefined->setViewLocation (1, 1);
|
||||||
|
preDefined->setWidgetWidth (10);
|
||||||
|
preDefined->setColumnSpan (2);
|
||||||
|
|
||||||
|
preDefined->addProxy (width,
|
||||||
|
QStringList() << "640" << "800" << "1024" << "1440"
|
||||||
|
);
|
||||||
|
|
||||||
|
preDefined->addProxy (height,
|
||||||
|
QStringList() << "480" << "600" << "768" << "900"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
section = "Display Format";
|
||||||
|
{
|
||||||
|
QString defaultValue = "Icon and Text";
|
||||||
|
|
||||||
|
QStringList values = QStringList()
|
||||||
|
<< defaultValue << "Icon Only" << "Text Only";
|
||||||
|
|
||||||
|
Setting *rsd = createSetting (Type_SingleBool,
|
||||||
|
section, "Record Status Display",
|
||||||
|
values);
|
||||||
|
|
||||||
|
Setting *ritd = createSetting (Type_SingleBool,
|
||||||
|
section, "Referenceable ID Type Display",
|
||||||
|
values);
|
||||||
|
|
||||||
|
rsd->setEditorSetting (true);
|
||||||
|
ritd->setEditorSetting (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
section = "Proxy Selection Test";
|
||||||
|
{
|
||||||
|
//create three setting objects, specifying the basic widget type,
|
||||||
|
//the setting view name, the page name, and the default value
|
||||||
|
Setting *masterBoolean = createSetting (Type_SingleBool, section,
|
||||||
|
"Master Proxy",
|
||||||
|
QStringList()
|
||||||
|
<< "Profile One" << "Profile Two"
|
||||||
|
<< "Profile Three" << "Profile Four"
|
||||||
|
);
|
||||||
|
|
||||||
|
Setting *slaveBoolean = createSetting (Type_MultiBool, section,
|
||||||
|
"Proxy Checkboxes",
|
||||||
|
QStringList() << "One" << "Two"
|
||||||
|
<< "Three" << "Four" << "Five"
|
||||||
|
);
|
||||||
|
|
||||||
|
Setting *slaveSingleText = createSetting (Type_SingleText, section,
|
||||||
|
"Proxy TextBox 1"
|
||||||
|
);
|
||||||
|
|
||||||
|
Setting *slaveMultiText = createSetting (Type_SingleText, section,
|
||||||
|
"ProxyTextBox 2"
|
||||||
|
);
|
||||||
|
|
||||||
|
// There are three types of values:
|
||||||
|
//
|
||||||
|
// Declared values - Pre-determined values, typically for
|
||||||
|
// combobox drop downs and boolean (radiobutton / checkbox) labels.
|
||||||
|
// These values represent the total possible list of values that may
|
||||||
|
// define a setting. No other values are allowed.
|
||||||
|
//
|
||||||
|
// Defined values - Values which represent the atual, current value of
|
||||||
|
// a setting. For settings with declared values, this must be one or
|
||||||
|
// several declared values, as appropriate.
|
||||||
|
//
|
||||||
|
// Proxy values - values the proxy master updates the proxy slave when
|
||||||
|
// it's own definition is set / changed. These are definitions for
|
||||||
|
// proxy slave settings, but must match any declared values the proxy
|
||||||
|
// slave has, if any.
|
||||||
|
|
||||||
|
masterBoolean->addProxy (slaveBoolean, QList <QStringList>()
|
||||||
|
<< (QStringList() << "One" << "Three")
|
||||||
|
<< (QStringList() << "One" << "Three")
|
||||||
|
<< (QStringList() << "One" << "Three" << "Five")
|
||||||
|
<< (QStringList() << "Two" << "Four")
|
||||||
|
);
|
||||||
|
|
||||||
|
masterBoolean->addProxy (slaveSingleText, QList <QStringList>()
|
||||||
|
<< (QStringList() << "Text A")
|
||||||
|
<< (QStringList() << "Text B")
|
||||||
|
<< (QStringList() << "Text A")
|
||||||
|
<< (QStringList() << "Text C")
|
||||||
|
);
|
||||||
|
|
||||||
|
masterBoolean->addProxy (slaveMultiText, QList <QStringList>()
|
||||||
|
<< (QStringList() << "One" << "Three")
|
||||||
|
<< (QStringList() << "One" << "Three")
|
||||||
|
<< (QStringList() << "One" << "Three" << "Five")
|
||||||
|
<< (QStringList() << "Two" << "Four")
|
||||||
|
);
|
||||||
|
|
||||||
|
//settings with proxies are not serialized by default
|
||||||
|
//other settings non-serialized for demo purposes
|
||||||
|
slaveBoolean->setSerializable (false);
|
||||||
|
slaveSingleText->setSerializable (false);
|
||||||
|
slaveMultiText->setSerializable (false);
|
||||||
|
|
||||||
|
slaveBoolean->setDefaultValues (QStringList()
|
||||||
|
<< "One" << "Three" << "Five");
|
||||||
|
|
||||||
|
slaveSingleText->setDefaultValue ("Text A");
|
||||||
|
|
||||||
|
slaveMultiText->setDefaultValues (QStringList()
|
||||||
|
<< "One" << "Three" << "Five");
|
||||||
|
|
||||||
|
slaveSingleText->setWidgetWidth (24);
|
||||||
|
slaveMultiText->setWidgetWidth (24);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMSettings::UserSettings::~UserSettings()
|
CSMSettings::UserSettings::~UserSettings()
|
||||||
|
@ -76,230 +194,83 @@ CSMSettings::UserSettings::~UserSettings()
|
||||||
mUserSettingsInstance = 0;
|
mUserSettingsInstance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream *CSMSettings::UserSettings::openFileStream (const QString &filePath, bool isReadOnly) const
|
|
||||||
{
|
|
||||||
QIODevice::OpenMode openFlags = QIODevice::Text;
|
|
||||||
|
|
||||||
if (isReadOnly)
|
|
||||||
openFlags = QIODevice::ReadOnly | openFlags;
|
|
||||||
else
|
|
||||||
openFlags = QIODevice::ReadWrite | QIODevice::Truncate | openFlags;
|
|
||||||
|
|
||||||
QFile *file = new QFile(filePath);
|
|
||||||
QTextStream *stream = 0;
|
|
||||||
|
|
||||||
if (file->open(openFlags))
|
|
||||||
{
|
|
||||||
stream = new QTextStream(file);
|
|
||||||
stream->setCodec(QTextCodec::codecForName("UTF-8"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return stream;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSMSettings::UserSettings::writeSettings(QMap<QString, CSMSettings::SettingList *> &settings)
|
|
||||||
{
|
|
||||||
QTextStream *stream = openFileStream(mUserFilePath);
|
|
||||||
|
|
||||||
bool success = (stream);
|
|
||||||
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
QList<QString> keyList = settings.keys();
|
|
||||||
|
|
||||||
foreach (QString key, keyList)
|
|
||||||
{
|
|
||||||
SettingList *sectionSettings = settings[key];
|
|
||||||
|
|
||||||
*stream << "[" << key << "]" << '\n';
|
|
||||||
|
|
||||||
foreach (SettingContainer *item, *sectionSettings)
|
|
||||||
*stream << item->objectName() << " = " << item->getValue() << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
stream->device()->close();
|
|
||||||
delete stream;
|
|
||||||
stream = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
displayFileErrorMessage(mReadWriteMessage, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (success);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const CSMSettings::SectionMap &CSMSettings::UserSettings::getSectionMap() const
|
|
||||||
{
|
|
||||||
return mSectionSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CSMSettings::SettingMap *CSMSettings::UserSettings::getSettings(const QString §ionName) const
|
|
||||||
{
|
|
||||||
return getValidSettings(sectionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSMSettings::UserSettings::loadFromFile(const QString &filePath)
|
|
||||||
{
|
|
||||||
if (filePath.isEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
SectionMap loadedSettings;
|
|
||||||
|
|
||||||
QTextStream *stream = openFileStream (filePath, true);
|
|
||||||
|
|
||||||
bool success = (stream);
|
|
||||||
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
//looks for a square bracket, "'\\["
|
|
||||||
//that has one or more "not nothing" in it, "([^]]+)"
|
|
||||||
//and is closed with a square bracket, "\\]"
|
|
||||||
|
|
||||||
QRegExp sectionRe("^\\[([^]]+)\\]");
|
|
||||||
|
|
||||||
//Find any character(s) that is/are not equal sign(s), "[^=]+"
|
|
||||||
//followed by an optional whitespace, an equal sign, and another optional whitespace, "\\s*=\\s*"
|
|
||||||
//and one or more periods, "(.+)"
|
|
||||||
|
|
||||||
QRegExp keyRe("^([^=]+)\\s*=\\s*(.+)$");
|
|
||||||
|
|
||||||
CSMSettings::SettingMap *settings = 0;
|
|
||||||
QString section = "none";
|
|
||||||
|
|
||||||
while (!stream->atEnd())
|
|
||||||
{
|
|
||||||
QString line = stream->readLine().simplified();
|
|
||||||
|
|
||||||
if (line.isEmpty() || line.startsWith("#"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//if a section is found, push it onto a new QStringList
|
|
||||||
//and push the QStringList onto
|
|
||||||
if (sectionRe.exactMatch(line))
|
|
||||||
{
|
|
||||||
//add the previous section's settings to the member map
|
|
||||||
if (settings)
|
|
||||||
loadedSettings.insert(section, settings);
|
|
||||||
|
|
||||||
//save new section and create a new list
|
|
||||||
section = sectionRe.cap(1);
|
|
||||||
settings = new SettingMap;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyRe.indexIn(line) != -1)
|
|
||||||
{
|
|
||||||
SettingContainer *sc = new SettingContainer (keyRe.cap(2).simplified());
|
|
||||||
sc->setObjectName(keyRe.cap(1).simplified());
|
|
||||||
(*settings)[keyRe.cap(1).simplified()] = sc;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
loadedSettings.insert(section, settings);
|
|
||||||
|
|
||||||
stream->device()->close();
|
|
||||||
delete stream;
|
|
||||||
stream = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
mergeMap (loadedSettings);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSMSettings::UserSettings::mergeMap (const CSMSettings::SectionMap §ionSettings)
|
|
||||||
{
|
|
||||||
foreach (QString key, sectionSettings.uniqueKeys())
|
|
||||||
{
|
|
||||||
// insert entire section if it does not already exist in the loaded files
|
|
||||||
if (mSectionSettings.find(key) == mSectionSettings.end())
|
|
||||||
mSectionSettings.insert(key, sectionSettings.value(key));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SettingMap *passedSettings = sectionSettings.value(key);
|
|
||||||
SettingMap *settings = mSectionSettings.value(key);
|
|
||||||
|
|
||||||
foreach (QString key2, passedSettings->uniqueKeys())
|
|
||||||
{
|
|
||||||
//insert section settings individially if they do not already exist
|
|
||||||
if (settings->find(key2) == settings->end())
|
|
||||||
settings->insert(key2, passedSettings->value(key2));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
settings->value(key2)->update(passedSettings->value(key2)->getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSMSettings::UserSettings::loadSettings (const QString &fileName)
|
void CSMSettings::UserSettings::loadSettings (const QString &fileName)
|
||||||
{
|
{
|
||||||
mSectionSettings.clear();
|
mUserFilePath = QString::fromUtf8
|
||||||
|
(mCfgMgr.getUserConfigPath().c_str()) + fileName.toUtf8();
|
||||||
|
|
||||||
//global
|
QString global = QString::fromUtf8
|
||||||
QString globalFilePath = QString::fromStdString(mCfgMgr.getGlobalPath().string()) + fileName;
|
(mCfgMgr.getGlobalPath().c_str()) + fileName.toUtf8();
|
||||||
bool globalOk = loadFromFile(globalFilePath);
|
|
||||||
|
|
||||||
|
QString local = QString::fromUtf8
|
||||||
|
(mCfgMgr.getLocalPath().c_str()) + fileName.toUtf8();
|
||||||
|
|
||||||
//local
|
//open user and global streams
|
||||||
QString localFilePath = QString::fromStdString(mCfgMgr.getLocalPath().string()) + fileName;
|
QTextStream *userStream = openFilestream (mUserFilePath, true);
|
||||||
bool localOk = loadFromFile(localFilePath);
|
QTextStream *otherStream = openFilestream (global, true);
|
||||||
|
|
||||||
//user
|
//failed stream, try for local
|
||||||
mUserFilePath = QString::fromStdString(mCfgMgr.getUserConfigPath().string()) + fileName;
|
if (!otherStream)
|
||||||
loadFromFile(mUserFilePath);
|
otherStream = openFilestream (local, true);
|
||||||
|
|
||||||
if (!(localOk || globalOk))
|
//error condition - notify and return
|
||||||
|
if (!otherStream || !userStream)
|
||||||
{
|
{
|
||||||
QString message = QObject::tr("<br><b>Could not open user settings files for reading</b><br><br> \
|
QString message = QObject::tr("<br><b>An error was encountered loading \
|
||||||
Global and local settings files could not be read.\
|
user settings files.</b><br><br> One or several files could not \
|
||||||
You may have incorrect file permissions or the OpenCS installation may be corrupted.<br>");
|
be read. This may be caused by a missing configuration file, \
|
||||||
|
incorrect file permissions or a corrupted installation of \
|
||||||
|
OpenCS.<br>");
|
||||||
|
|
||||||
message += QObject::tr("<br>Global filepath: ") + globalFilePath;
|
message += QObject::tr("<br>Global filepath: ") + global;
|
||||||
message += QObject::tr("<br>Local filepath: ") + localFilePath;
|
message += QObject::tr("<br>Local filepath: ") + local;
|
||||||
|
message += QObject::tr("<br>User filepath: ") + mUserFilePath;
|
||||||
|
|
||||||
displayFileErrorMessage ( message, true);
|
displayFileErrorMessage ( message, true);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSMSettings::UserSettings::updateSettings (const QString §ionName, const QString &settingName)
|
|
||||||
{
|
|
||||||
|
|
||||||
SettingMap *settings = getValidSettings(sectionName);
|
|
||||||
|
|
||||||
if (!settings)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (settingName.isEmpty())
|
//success condition - merge the two streams into a single map and save
|
||||||
{
|
DefinitionPageMap totalMap = readFilestream (userStream);
|
||||||
foreach (const SettingContainer *setting, *settings)
|
DefinitionPageMap otherMap = readFilestream(otherStream);
|
||||||
emit signalUpdateEditorSetting (setting->objectName(), setting->getValue());
|
|
||||||
}
|
//merging other settings file in and ignore duplicate settings to
|
||||||
else
|
//avoid overwriting user-level settings
|
||||||
{
|
mergeSettings (totalMap, otherMap);
|
||||||
if (settings->find(settingName) != settings->end())
|
|
||||||
{
|
if (!totalMap.isEmpty())
|
||||||
const SettingContainer *setting = settings->value(settingName);
|
addDefinitions (totalMap);
|
||||||
emit signalUpdateEditorSetting (setting->objectName(), setting->getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CSMSettings::UserSettings::getSetting (const QString §ion, const QString &setting) const
|
void CSMSettings::UserSettings::saveSettings
|
||||||
|
(const QMap <QString, QStringList> &settingMap)
|
||||||
{
|
{
|
||||||
SettingMap *settings = getValidSettings(section);
|
for (int i = 0; i < settings().size(); i++)
|
||||||
|
{
|
||||||
|
Setting* setting = settings().at(i);
|
||||||
|
|
||||||
QString retVal = "";
|
QString key = setting->page() + '.' + setting->name();
|
||||||
|
|
||||||
if (settings->find(setting) != settings->end())
|
if (!settingMap.keys().contains(key))
|
||||||
retVal = settings->value(setting)->getValue();
|
continue;
|
||||||
|
|
||||||
return retVal;
|
setting->setDefinedValues (settingMap.value(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
writeFilestream (openFilestream (mUserFilePath, false), settingMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CSMSettings::UserSettings::settingValue (const QString §ion,
|
||||||
|
const QString &name)
|
||||||
|
{
|
||||||
|
Setting *setting = findSetting(section, name);
|
||||||
|
|
||||||
|
if (setting)
|
||||||
|
{
|
||||||
|
if (!setting->definedValues().isEmpty())
|
||||||
|
return setting->definedValues().at(0);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMSettings::UserSettings& CSMSettings::UserSettings::instance()
|
CSMSettings::UserSettings& CSMSettings::UserSettings::instance()
|
||||||
|
@ -307,49 +278,3 @@ CSMSettings::UserSettings& CSMSettings::UserSettings::instance()
|
||||||
assert(mUserSettingsInstance);
|
assert(mUserSettingsInstance);
|
||||||
return *mUserSettingsInstance;
|
return *mUserSettingsInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMSettings::UserSettings::displayFileErrorMessage(const QString &message, bool isReadOnly)
|
|
||||||
{
|
|
||||||
// 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();
|
|
||||||
}
|
|
||||||
|
|
||||||
CSMSettings::SettingMap *
|
|
||||||
CSMSettings::UserSettings::getValidSettings (const QString §ionName) const
|
|
||||||
{
|
|
||||||
SettingMap *settings = 0;
|
|
||||||
|
|
||||||
//copy the default values for the entire section if it's not found
|
|
||||||
if (mSectionSettings.find(sectionName) == mSectionSettings.end())
|
|
||||||
{
|
|
||||||
if (mEditorSettingDefaults.find(sectionName) != mEditorSettingDefaults.end())
|
|
||||||
settings = mEditorSettingDefaults.value (sectionName);
|
|
||||||
}
|
|
||||||
//otherwise, iterate the section's settings, looking for missing values and replacing them with defaults.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SettingMap *loadedSettings = mSectionSettings[sectionName];
|
|
||||||
SettingMap *defaultSettings = mEditorSettingDefaults[sectionName];
|
|
||||||
|
|
||||||
foreach (QString key, defaultSettings->uniqueKeys())
|
|
||||||
{
|
|
||||||
//write the default value to the loaded settings
|
|
||||||
if (loadedSettings->find((key))==loadedSettings->end())
|
|
||||||
loadedSettings->insert(key, defaultSettings->value(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
settings = mSectionSettings.value (sectionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
|
|
||||||
#include "support.hpp"
|
#include "settingmanager.hpp"
|
||||||
|
|
||||||
#ifndef Q_MOC_RUN
|
#ifndef Q_MOC_RUN
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
|
@ -21,17 +21,15 @@ class QFile;
|
||||||
|
|
||||||
namespace CSMSettings {
|
namespace CSMSettings {
|
||||||
|
|
||||||
struct UserSettings: public QObject
|
class UserSettings: public SettingManager
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
SectionMap mSectionSettings;
|
|
||||||
SectionMap mEditorSettingDefaults;
|
|
||||||
|
|
||||||
static UserSettings *mUserSettingsInstance;
|
static UserSettings *mUserSettingsInstance;
|
||||||
QString mUserFilePath;
|
QString mUserFilePath;
|
||||||
Files::ConfigurationManager mCfgMgr;
|
Files::ConfigurationManager mCfgMgr;
|
||||||
|
|
||||||
QString mReadOnlyMessage;
|
QString mReadOnlyMessage;
|
||||||
QString mReadWriteMessage;
|
QString mReadWriteMessage;
|
||||||
|
|
||||||
|
@ -47,48 +45,23 @@ namespace CSMSettings {
|
||||||
void operator= (UserSettings const &); //not implemented
|
void operator= (UserSettings const &); //not implemented
|
||||||
|
|
||||||
/// Writes settings to the last loaded settings file
|
/// Writes settings to the last loaded settings file
|
||||||
bool writeSettings(QMap<QString, SettingList *> §ions);
|
bool writeSettings();
|
||||||
|
|
||||||
/// Called from editor to trigger signal to update the specified setting.
|
|
||||||
/// If no setting name is specified, all settings found in the specified section are updated.
|
|
||||||
void updateSettings (const QString §ionName, const QString &settingName = "");
|
|
||||||
|
|
||||||
/// Retrieves the settings file at all three levels (global, local and user).
|
/// Retrieves the settings file at all three levels (global, local and user).
|
||||||
|
|
||||||
/// \todo Multi-valued settings are not fully implemented. Setting values
|
|
||||||
/// \todo loaded in later files will always overwrite previously loaded values.
|
|
||||||
void loadSettings (const QString &fileName);
|
void loadSettings (const QString &fileName);
|
||||||
|
|
||||||
/// Returns the entire map of settings across all sections
|
/// Writes settings to the user's config file path
|
||||||
const SectionMap &getSectionMap () const;
|
void saveSettings (const QMap <QString, QStringList > &settingMap);
|
||||||
|
|
||||||
const SettingMap *getSettings (const QString §ionName) const;
|
QString settingValue (const QString §ion, const QString &name);
|
||||||
|
|
||||||
/// Retrieves the value as a QString of the specified setting in the specified section
|
|
||||||
QString getSetting(const QString §ion, const QString &setting) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void buildSettingModelDefaults();
|
||||||
/// Opens a QTextStream from the provided path as read-only or read-write.
|
|
||||||
QTextStream *openFileStream (const QString &filePath, bool isReadOnly = false) const;
|
|
||||||
|
|
||||||
/// Parses a setting file specified in filePath from the provided text stream.
|
|
||||||
bool loadFromFile (const QString &filePath = "");
|
|
||||||
|
|
||||||
/// merge the passed map into mSectionSettings
|
|
||||||
void mergeMap (const SectionMap &);
|
|
||||||
|
|
||||||
void displayFileErrorMessage(const QString &message, bool isReadOnly);
|
|
||||||
|
|
||||||
void buildEditorSettingDefaults();
|
|
||||||
|
|
||||||
SettingMap *getValidSettings (const QString §ionName) const;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void signalUpdateEditorSetting (const QString &settingName, const QString &settingValue);
|
void userSettingUpdated(const QString &, const QStringList &);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // USERSETTINGS_HPP
|
#endif // USERSETTINGS_HPP
|
||||||
|
|
|
@ -12,16 +12,15 @@ CSMWorld::UniversalId CSVDoc::SubView::getUniversalId() const
|
||||||
return mUniversalId;
|
return mUniversalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::SubView::updateEditorSetting (const QString &settingName, const QString &settingValue)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSVDoc::SubView::setStatusBar (bool show) {}
|
void CSVDoc::SubView::setStatusBar (bool show) {}
|
||||||
|
|
||||||
void CSVDoc::SubView::useHint (const std::string& hint) {}
|
void CSVDoc::SubView::useHint (const std::string& hint) {}
|
||||||
|
|
||||||
|
void CSVDoc::SubView::updateUserSetting (const QString &, const QStringList &)
|
||||||
|
{}
|
||||||
|
|
||||||
void CSVDoc::SubView::setUniversalId (const CSMWorld::UniversalId& id)
|
void CSVDoc::SubView::setUniversalId (const CSMWorld::UniversalId& id)
|
||||||
{
|
{
|
||||||
mUniversalId = id;
|
mUniversalId = id;
|
||||||
setWindowTitle (mUniversalId.toString().c_str());
|
setWindowTitle (mUniversalId.toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,9 @@ namespace CSVDoc
|
||||||
CSMWorld::UniversalId getUniversalId() const;
|
CSMWorld::UniversalId getUniversalId() const;
|
||||||
|
|
||||||
virtual void setEditLock (bool locked) = 0;
|
virtual void setEditLock (bool locked) = 0;
|
||||||
virtual void updateEditorSetting (const QString &, const QString &);
|
|
||||||
|
virtual void updateUserSetting
|
||||||
|
(const QString &, const QStringList &);
|
||||||
|
|
||||||
virtual void setStatusBar (bool show);
|
virtual void setStatusBar (bool show);
|
||||||
///< Default implementation: ignored
|
///< Default implementation: ignored
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "../../model/doc/document.hpp"
|
#include "../../model/doc/document.hpp"
|
||||||
#include "../world/subviews.hpp"
|
#include "../world/subviews.hpp"
|
||||||
#include "../tools/subviews.hpp"
|
#include "../tools/subviews.hpp"
|
||||||
#include "../settings/usersettingsdialog.hpp"
|
#include "../../model/settings/usersettings.hpp"
|
||||||
#include "viewmanager.hpp"
|
#include "viewmanager.hpp"
|
||||||
#include "operations.hpp"
|
#include "operations.hpp"
|
||||||
#include "subview.hpp"
|
#include "subview.hpp"
|
||||||
|
@ -235,8 +235,11 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to
|
||||||
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1),
|
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1),
|
||||||
mViewTotal (totalViews)
|
mViewTotal (totalViews)
|
||||||
{
|
{
|
||||||
QString width = CSMSettings::UserSettings::instance().getSetting(QString("Window Size"), QString("Width"));
|
QString width = CSMSettings::UserSettings::instance().settingValue
|
||||||
QString height = CSMSettings::UserSettings::instance().getSetting(QString("Window Size"), QString("Height"));
|
(QString("Window Size"), QString("Width"));
|
||||||
|
|
||||||
|
QString height = CSMSettings::UserSettings::instance().settingValue
|
||||||
|
(QString("Window Size"), QString("Height"));
|
||||||
|
|
||||||
resize (width.toInt(), height.toInt());
|
resize (width.toInt(), height.toInt());
|
||||||
|
|
||||||
|
@ -336,7 +339,10 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
||||||
connect (view, SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&)), this,
|
connect (view, SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&)), this,
|
||||||
SLOT (addSubView (const CSMWorld::UniversalId&, const std::string&)));
|
SLOT (addSubView (const CSMWorld::UniversalId&, const std::string&)));
|
||||||
|
|
||||||
CSMSettings::UserSettings::instance().updateSettings("Display Format");
|
connect (&CSMSettings::UserSettings::instance(),
|
||||||
|
SIGNAL (userSettingUpdated (const QString &, const QStringList &)),
|
||||||
|
view,
|
||||||
|
SLOT (updateUserSetting (const QString &, const QStringList &)));
|
||||||
|
|
||||||
view->show();
|
view->show();
|
||||||
}
|
}
|
||||||
|
@ -484,24 +490,19 @@ void CSVDoc::View::resizeViewHeight (int height)
|
||||||
resize (geometry().width(), height);
|
resize (geometry().width(), height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::View::updateEditorSetting (const QString &settingName, const QString &settingValue)
|
void CSVDoc::View::updateUserSetting
|
||||||
|
(const QString &name, const QStringList &list)
|
||||||
{
|
{
|
||||||
if ( (settingName == "Record Status Display") || (settingName == "Referenceable ID Type Display") )
|
if (list.isEmpty())
|
||||||
{
|
return;
|
||||||
foreach (QObject *view, mSubViewWindow.children())
|
|
||||||
{
|
|
||||||
// not all mSubviewWindow children are CSVDoc::Subview objects
|
|
||||||
CSVDoc::SubView *subview = dynamic_cast<CSVDoc::SubView *>(view);
|
|
||||||
|
|
||||||
if (subview)
|
int value = list.at(0).toInt();
|
||||||
subview->updateEditorSetting (settingName, settingValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (settingName == "Width")
|
|
||||||
resizeViewWidth (settingValue.toInt());
|
|
||||||
|
|
||||||
else if (settingName == "Height")
|
if (name == "Width")
|
||||||
resizeViewHeight (settingValue.toInt());
|
resizeViewWidth (value);
|
||||||
|
|
||||||
|
else if (name == "Height")
|
||||||
|
resizeViewHeight (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::View::toggleShowStatusBar (bool show)
|
void CSVDoc::View::toggleShowStatusBar (bool show)
|
||||||
|
|
|
@ -126,6 +126,8 @@ namespace CSVDoc
|
||||||
|
|
||||||
void abortOperation (int type);
|
void abortOperation (int type);
|
||||||
|
|
||||||
|
void updateUserSetting (const QString &, const QStringList &);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void newView();
|
void newView();
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
#include "../world/vartypedelegate.hpp"
|
#include "../world/vartypedelegate.hpp"
|
||||||
#include "../world/recordstatusdelegate.hpp"
|
#include "../world/recordstatusdelegate.hpp"
|
||||||
#include "../world/idtypedelegate.hpp"
|
#include "../world/idtypedelegate.hpp"
|
||||||
#include "../settings/usersettingsdialog.hpp"
|
|
||||||
|
#include "../../model/settings/usersettings.hpp"
|
||||||
|
|
||||||
#include "view.hpp"
|
#include "view.hpp"
|
||||||
|
|
||||||
|
@ -83,9 +84,6 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
||||||
for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i)
|
for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i)
|
||||||
mDelegateFactories->add (sMapping[i].mDisplay, new CSVWorld::EnumDelegateFactory (
|
mDelegateFactories->add (sMapping[i].mDisplay, new CSVWorld::EnumDelegateFactory (
|
||||||
CSMWorld::Columns::getEnums (sMapping[i].mColumnId), sMapping[i].mAllowNone));
|
CSMWorld::Columns::getEnums (sMapping[i].mColumnId), sMapping[i].mAllowNone));
|
||||||
|
|
||||||
connect (&CSMSettings::UserSettings::instance(), SIGNAL (signalUpdateEditorSetting (const QString &, const QString &)),
|
|
||||||
this, SLOT (slotUpdateEditorSetting (const QString &, const QString &)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVDoc::ViewManager::~ViewManager()
|
CSVDoc::ViewManager::~ViewManager()
|
||||||
|
@ -119,6 +117,11 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document)
|
||||||
connect (view, SIGNAL (loadDocumentRequest ()), this, SIGNAL (loadDocumentRequest()));
|
connect (view, SIGNAL (loadDocumentRequest ()), this, SIGNAL (loadDocumentRequest()));
|
||||||
connect (view, SIGNAL (editSettingsRequest()), this, SIGNAL (editSettingsRequest()));
|
connect (view, SIGNAL (editSettingsRequest()), this, SIGNAL (editSettingsRequest()));
|
||||||
|
|
||||||
|
connect (&CSMSettings::UserSettings::instance(),
|
||||||
|
SIGNAL (userSettingUpdated(const QString &, const QStringList &)),
|
||||||
|
view,
|
||||||
|
SLOT (updateUserSetting (const QString &, const QStringList &)));
|
||||||
|
|
||||||
updateIndices();
|
updateIndices();
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
@ -313,9 +316,3 @@ void CSVDoc::ViewManager::exitApplication (CSVDoc::View *view)
|
||||||
if (notifySaveOnClose (view))
|
if (notifySaveOnClose (view))
|
||||||
QApplication::instance()->exit();
|
QApplication::instance()->exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::ViewManager::slotUpdateEditorSetting (const QString &settingName, const QString &settingValue)
|
|
||||||
{
|
|
||||||
foreach (CSVDoc::View *view, mViews)
|
|
||||||
view->updateEditorSetting (settingName, settingValue);
|
|
||||||
}
|
|
||||||
|
|
|
@ -76,9 +76,6 @@ namespace CSVDoc
|
||||||
void progress (int current, int max, int type, int threads, CSMDoc::Document *document);
|
void progress (int current, int max, int type, int threads, CSMDoc::Document *document);
|
||||||
|
|
||||||
void onExitWarningHandler(int state, CSMDoc::Document* document);
|
void onExitWarningHandler(int state, CSMDoc::Document* document);
|
||||||
|
|
||||||
/// connected to update signal in UserSettings
|
|
||||||
void slotUpdateEditorSetting (const QString &, const QString &);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,13 @@ void CSVTools::ReportSubView::setEditLock (bool locked)
|
||||||
// ignored. We don't change document state anyway.
|
// ignored. We don't change document state anyway.
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVTools::ReportSubView::updateEditorSetting (const QString& key, const QString& value)
|
void CSVTools::ReportSubView::updateUserSetting
|
||||||
|
(const QString &name, const QStringList &list)
|
||||||
{
|
{
|
||||||
mIdTypeDelegate->updateEditorSetting (key, value);
|
mIdTypeDelegate->updateUserSetting (name, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVTools::ReportSubView::show (const QModelIndex& index)
|
void CSVTools::ReportSubView::show (const QModelIndex& index)
|
||||||
{
|
{
|
||||||
focusId (mModel->getUniversalId (index.row()), "");
|
focusId (mModel->getUniversalId (index.row()), "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,8 @@ namespace CSVTools
|
||||||
|
|
||||||
virtual void setEditLock (bool locked);
|
virtual void setEditLock (bool locked);
|
||||||
|
|
||||||
virtual void updateEditorSetting (const QString&, const QString&);
|
virtual void updateUserSetting
|
||||||
|
(const QString &, const QStringList &);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
@ -47,4 +48,4 @@ namespace CSVTools
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -449,15 +449,19 @@ void CSVWorld::Table::previewRecord()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::Table::updateEditorSetting (const QString &settingName, const QString &settingValue)
|
void CSVWorld::Table::updateUserSetting
|
||||||
|
(const QString &name, const QStringList &list)
|
||||||
{
|
{
|
||||||
int columns = mModel->columnCount();
|
int columns = mModel->columnCount();
|
||||||
|
|
||||||
for (int i=0; i<columns; ++i)
|
for (int i=0; i<columns; ++i)
|
||||||
if (QAbstractItemDelegate *delegate = itemDelegateForColumn (i))
|
if (QAbstractItemDelegate *delegate = itemDelegateForColumn (i))
|
||||||
if (dynamic_cast<CommandDelegate&> (*delegate).
|
if (dynamic_cast<CommandDelegate&>
|
||||||
updateEditorSetting (settingName, settingValue))
|
(*delegate).updateUserSetting (name, list))
|
||||||
emit dataChanged (mModel->index (0, i), mModel->index (mModel->rowCount()-1, i));
|
{
|
||||||
|
emit dataChanged (mModel->index (0, i),
|
||||||
|
mModel->index (mModel->rowCount()-1, i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::Table::tableSizeUpdate()
|
void CSVWorld::Table::tableSizeUpdate()
|
||||||
|
@ -598,4 +602,4 @@ std::vector<std::string> CSVWorld::Table::getColumnsWithDisplay(CSMWorld::Column
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return titles;
|
return titles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace CSVWorld
|
||||||
|
|
||||||
CSMWorld::UniversalId getUniversalId (int row) const;
|
CSMWorld::UniversalId getUniversalId (int row) const;
|
||||||
|
|
||||||
void updateEditorSetting (const QString &settingName, const QString &settingValue);
|
void updateUserSetting (const QString &name, const QStringList &list);
|
||||||
|
|
||||||
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
|
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,10 @@ void CSVWorld::TableSubView::editRequest (const CSMWorld::UniversalId& id, const
|
||||||
focusId (id, hint);
|
focusId (id, hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::TableSubView::updateEditorSetting(const QString &settingName, const QString &settingValue)
|
void CSVWorld::TableSubView::updateUserSetting
|
||||||
|
(const QString &name, const QStringList &list)
|
||||||
{
|
{
|
||||||
mTable->updateEditorSetting(settingName, settingValue);
|
mTable->updateUserSetting(name, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::TableSubView::setStatusBar (bool show)
|
void CSVWorld::TableSubView::setStatusBar (bool show)
|
||||||
|
@ -134,4 +135,4 @@ bool CSVWorld::TableSubView::eventFilter (QObject* object, QEvent* event)
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,8 @@ namespace CSVWorld
|
||||||
|
|
||||||
virtual void setEditLock (bool locked);
|
virtual void setEditLock (bool locked);
|
||||||
|
|
||||||
virtual void updateEditorSetting (const QString& key, const QString& value);
|
virtual void updateUserSetting
|
||||||
|
(const QString& name, const QStringList &list);
|
||||||
|
|
||||||
virtual void setStatusBar (bool show);
|
virtual void setStatusBar (bool show);
|
||||||
|
|
||||||
|
|
|
@ -196,8 +196,8 @@ bool CSVWorld::CommandDelegate::isEditLocked() const
|
||||||
return mEditLock;
|
return mEditLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSVWorld::CommandDelegate::updateEditorSetting (const QString &settingName,
|
bool CSVWorld::CommandDelegate::updateUserSetting (const QString &name,
|
||||||
const QString &settingValue)
|
const QStringList &list)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -263,4 +263,4 @@ void CSVWorld::DropLineEdit::dropEvent(QDropEvent *event)
|
||||||
const CSMWorld::TableMimeData* data(dynamic_cast<const CSMWorld::TableMimeData*>(event->mimeData()));
|
const CSMWorld::TableMimeData* data(dynamic_cast<const CSMWorld::TableMimeData*>(event->mimeData()));
|
||||||
emit tableMimeDataDropped(data->getData(), data->getDocumentPtr());
|
emit tableMimeDataDropped(data->getData(), data->getDocumentPtr());
|
||||||
//WIP
|
//WIP
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,9 @@ namespace CSVWorld
|
||||||
|
|
||||||
bool isEditLocked() const;
|
bool isEditLocked() const;
|
||||||
|
|
||||||
virtual bool updateEditorSetting (const QString &settingName, const QString &settingValue);
|
virtual bool updateUserSetting
|
||||||
|
(const QString &name, const QStringList &list);
|
||||||
|
|
||||||
///< \return Does column require update?
|
///< \return Does column require update?
|
||||||
|
|
||||||
virtual void setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay = false) const;
|
virtual void setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay = false) const;
|
||||||
|
|
Loading…
Reference in a new issue