forked from mirror/openmw-tes3mp
Revert everything
This commit is contained in:
parent
a9760ec805
commit
f30d1a3075
8 changed files with 28 additions and 120 deletions
|
@ -587,28 +587,6 @@ CSMPrefs::State& CSMPrefs::State::get()
|
|||
return *sThis;
|
||||
}
|
||||
|
||||
void CSMPrefs::State::resetCategory(const std::string& category)
|
||||
{
|
||||
for (Settings::CategorySettingValueMap::iterator i = mSettings.mUserSettings.begin();
|
||||
i != mSettings.mUserSettings.end(); ++i)
|
||||
{
|
||||
// if the category matches
|
||||
if (i->first.first == category)
|
||||
{
|
||||
// mark the setting as changed
|
||||
mSettings.mChangedSettings.insert(std::make_pair(i->first.first, i->first.second));
|
||||
// reset the value to the default
|
||||
i->second = mSettings.mDefaultSettings[i->first];
|
||||
}
|
||||
}
|
||||
|
||||
Collection::iterator iter = mCategories.find(category);
|
||||
if (iter != mCategories.end())
|
||||
{
|
||||
(*iter).second.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CSMPrefs::State& CSMPrefs::get()
|
||||
{
|
||||
|
|
|
@ -106,8 +106,6 @@ namespace CSMPrefs
|
|||
|
||||
static State& get();
|
||||
|
||||
void resetCategory(const std::string& category);
|
||||
|
||||
signals:
|
||||
|
||||
void settingChanged (const CSMPrefs::Setting *setting);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <QGridLayout>
|
||||
#include <QStackedLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "../../model/prefs/setting.hpp"
|
||||
#include "../../model/prefs/category.hpp"
|
||||
|
@ -15,12 +14,31 @@ namespace CSVPrefs
|
|||
{
|
||||
KeyBindingPage::KeyBindingPage(CSMPrefs::Category& category, QWidget* parent)
|
||||
: PageBase(category, parent)
|
||||
, mTopWidget(0)
|
||||
, mStackedLayout(0)
|
||||
, mPageLayout(0)
|
||||
, mPageSelector(0)
|
||||
{
|
||||
init();
|
||||
// Need one widget for scroll area
|
||||
QWidget* topWidget = new QWidget();
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(topWidget);
|
||||
|
||||
// Allows switching between "pages"
|
||||
QWidget* stackedWidget = new QWidget();
|
||||
mStackedLayout = new QStackedLayout(stackedWidget);
|
||||
|
||||
mPageSelector = new QComboBox();
|
||||
connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int)));
|
||||
|
||||
topLayout->addWidget(mPageSelector);
|
||||
topLayout->addWidget(stackedWidget);
|
||||
topLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
||||
|
||||
// Add each option
|
||||
for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter)
|
||||
addSetting (*iter);
|
||||
|
||||
setWidgetResizable(true);
|
||||
setWidget(topWidget);
|
||||
}
|
||||
|
||||
void KeyBindingPage::addSetting(CSMPrefs::Setting *setting)
|
||||
|
@ -67,41 +85,4 @@ namespace CSVPrefs
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KeyBindingPage::refresh()
|
||||
{
|
||||
delete mTopWidget;
|
||||
|
||||
// reinitialize
|
||||
init();
|
||||
}
|
||||
|
||||
void KeyBindingPage::init()
|
||||
{
|
||||
// Need one widget for scroll area
|
||||
mTopWidget = new QWidget();
|
||||
QVBoxLayout* topLayout = new QVBoxLayout(mTopWidget);
|
||||
|
||||
QWidget* resetAll = new QPushButton("Reset all to default", this);
|
||||
connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory()));
|
||||
topLayout->addWidget(resetAll);
|
||||
|
||||
// Allows switching between "pages"
|
||||
QWidget* stackedWidget = new QWidget();
|
||||
mStackedLayout = new QStackedLayout(stackedWidget);
|
||||
|
||||
mPageSelector = new QComboBox();
|
||||
connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int)));
|
||||
|
||||
topLayout->addWidget(mPageSelector);
|
||||
topLayout->addWidget(stackedWidget);
|
||||
topLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
||||
|
||||
// Add each option
|
||||
for (CSMPrefs::Category::Iterator iter = getCategory().begin(); iter!=getCategory().end(); ++iter)
|
||||
addSetting (*iter);
|
||||
|
||||
setWidgetResizable(true);
|
||||
setWidget(mTopWidget);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "pagebase.hpp"
|
||||
|
||||
class QWidget;
|
||||
class QComboBox;
|
||||
class QGridLayout;
|
||||
class QStackedLayout;
|
||||
|
@ -27,11 +26,6 @@ namespace CSVPrefs
|
|||
|
||||
private:
|
||||
|
||||
void refresh();
|
||||
|
||||
void init();
|
||||
|
||||
QWidget* mTopWidget;
|
||||
QStackedLayout* mStackedLayout;
|
||||
QGridLayout* mPageLayout;
|
||||
QComboBox* mPageSelector;
|
||||
|
|
|
@ -2,16 +2,20 @@
|
|||
#include "page.hpp"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "../../model/prefs/setting.hpp"
|
||||
#include "../../model/prefs/category.hpp"
|
||||
|
||||
CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent)
|
||||
: PageBase (category, parent)
|
||||
, mParent (parent)
|
||||
{
|
||||
init();
|
||||
QWidget *widget = new QWidget (parent);
|
||||
mGrid = new QGridLayout (widget);
|
||||
|
||||
for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter)
|
||||
addSetting (*iter);
|
||||
|
||||
setWidget (widget);
|
||||
}
|
||||
|
||||
void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting)
|
||||
|
@ -34,26 +38,3 @@ void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting)
|
|||
mGrid->addWidget (new QWidget (this), next, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CSVPrefs::Page::refresh()
|
||||
{
|
||||
delete mWidget;
|
||||
|
||||
// reinitialize
|
||||
init();
|
||||
}
|
||||
|
||||
void CSVPrefs::Page::init()
|
||||
{
|
||||
mWidget = new QWidget(mParent);
|
||||
mGrid = new QGridLayout(mWidget);
|
||||
|
||||
QWidget* resetAll = new QPushButton("Reset all to default", this);
|
||||
connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory()));
|
||||
mGrid->addWidget(resetAll, 0, 0, 1, 2);
|
||||
|
||||
for (CSMPrefs::Category::Iterator iter = getCategory().begin(); iter!=getCategory().end(); ++iter)
|
||||
addSetting (*iter);
|
||||
|
||||
setWidget(mWidget);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "pagebase.hpp"
|
||||
|
||||
class QGridLayout;
|
||||
class QWidget;
|
||||
|
||||
namespace CSMPrefs
|
||||
{
|
||||
|
@ -18,20 +17,12 @@ namespace CSVPrefs
|
|||
Q_OBJECT
|
||||
|
||||
QGridLayout *mGrid;
|
||||
QWidget* mParent;
|
||||
QWidget* mWidget;
|
||||
|
||||
public:
|
||||
|
||||
Page (CSMPrefs::Category& category, QWidget *parent);
|
||||
|
||||
void addSetting (CSMPrefs::Setting *setting);
|
||||
|
||||
private:
|
||||
|
||||
void refresh();
|
||||
|
||||
void init();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "pagebase.hpp"
|
||||
|
||||
#include "../../model/prefs/category.hpp"
|
||||
#include "../../model/prefs/state.hpp"
|
||||
|
||||
CSVPrefs::PageBase::PageBase (CSMPrefs::Category& category, QWidget *parent)
|
||||
: QScrollArea (parent), mCategory (category)
|
||||
|
@ -12,9 +11,3 @@ CSMPrefs::Category& CSVPrefs::PageBase::getCategory()
|
|||
{
|
||||
return mCategory;
|
||||
}
|
||||
|
||||
void CSVPrefs::PageBase::resetCategory()
|
||||
{
|
||||
CSMPrefs::get().resetCategory(getCategory().getKey());
|
||||
refresh();
|
||||
}
|
||||
|
|
|
@ -21,14 +21,6 @@ namespace CSVPrefs
|
|||
PageBase (CSMPrefs::Category& category, QWidget *parent);
|
||||
|
||||
CSMPrefs::Category& getCategory();
|
||||
|
||||
public slots:
|
||||
|
||||
void resetCategory();
|
||||
|
||||
private:
|
||||
|
||||
virtual void refresh() {};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue