summaryrefslogtreecommitdiff
path: root/src/gui/widgets/setuptabscroll.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-05 17:47:46 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-19 18:46:08 +0300
commit40764f894c6ef0def1d0eb0677d064da13701bcd (patch)
tree4400b0b56d20ebb3e66187990a01615a0c2adb3a /src/gui/widgets/setuptabscroll.cpp
parent0b31fa647c786513c9addc5f8c55708f05226e03 (diff)
downloadManaVerse-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.gz
ManaVerse-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.bz2
ManaVerse-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.xz
ManaVerse-40764f894c6ef0def1d0eb0677d064da13701bcd.zip
Redesign Misc setup page.
Diffstat (limited to 'src/gui/widgets/setuptabscroll.cpp')
-rw-r--r--src/gui/widgets/setuptabscroll.cpp64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
index c46ebaf97..ece4fef8f 100644
--- a/src/gui/widgets/setuptabscroll.cpp
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -20,6 +20,8 @@
#include "gui/widgets/setuptabscroll.h"
+#include "gui/setupitem.h"
+
#include "gui/widgets/layouthelper.h"
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/vertcontainer.h"
@@ -42,8 +44,68 @@ SetupTabScroll::SetupTabScroll() :
SetupTabScroll::~SetupTabScroll()
{
-// delete mScroll;
mScroll = 0;
+
delete mContainer;
mContainer = 0;
+
+ std::set<SetupItem*>::iterator it = mAllItems.begin();
+ std::set<SetupItem*>::iterator it_end = mAllItems.end();
+ while (it != it_end)
+ {
+ delete *it;
+ ++ it;
+ }
+ mAllItems.clear();
+}
+
+void SetupTabScroll::addControl(SetupItem *widget)
+{
+ std::map<std::string,SetupItem*>::iterator iter
+ = mItems.find(widget->getActionEventId());
+ if (iter != mItems.end())
+ {
+ delete (*iter).second;
+ mItems.erase(iter);
+ }
+ mItems[widget->getActionEventId()] = widget;
+ mAllItems.insert(widget);
+}
+
+void SetupTabScroll::addControl(SetupItem *widget, std::string event)
+{
+ std::map<std::string,SetupItem*>::iterator iter
+ = mItems.find(event);
+ if (iter != mItems.end())
+ {
+ delete (*iter).second;
+ mItems.erase(iter);
+ }
+ mItems[event] = widget;
+ mAllItems.insert(widget);
+}
+
+void SetupTabScroll::apply()
+{
+ std::map<std::string,SetupItem*>::iterator iter;
+ for (iter = mItems.begin(); iter != mItems.end(); ++ iter)
+ (*iter).second->apply((*iter).first);
+}
+
+void SetupTabScroll::cancel()
+{
+ std::map<std::string,SetupItem*>::iterator iter;
+ for (iter = mItems.begin(); iter != mItems.end(); ++ iter)
+ (*iter).second->cancel((*iter).first);
+}
+
+void SetupTabScroll::externalUpdated()
+{
+ std::map<std::string,SetupItem*>::iterator iter;
+ for (iter = mItems.begin(); iter != mItems.end(); ++ iter)
+ {
+ SetupItem *widget = (*iter).second;
+ if (!widget->isMainConfig())
+ (*iter).second->externalUpdated((*iter).first);
+ }
}