summaryrefslogtreecommitdiff
path: root/client/macrowindow.cc
diff options
context:
space:
mode:
authordeva <deva>2010-08-13 10:07:22 +0000
committerdeva <deva>2010-08-13 10:07:22 +0000
commit51122d8689f6fbb1061ee0b19f885ad8851dfd50 (patch)
treec0513a8df0eda183226909fccc8b38e3f6e79185 /client/macrowindow.cc
parentc4ecebb7a1f33acb38d51a82788b071186ff3c19 (diff)
Clear lua when reopening a macro window.
Diffstat (limited to 'client/macrowindow.cc')
-rw-r--r--client/macrowindow.cc22
1 files changed, 5 insertions, 17 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index 649f323..5a6760e 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -47,7 +47,7 @@ MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ,
: Collapser(), netcom(n)
{
mainwidget = NULL;
- this->lua = new LUA(&mainwidget);
+ lua = new LUA(&mainwidget);
waschanged = false;
@@ -65,7 +65,6 @@ MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ,
MacroWindow::~MacroWindow()
{
clear();
- delete lua;
}
void MacroWindow::update(QDomNode &node)
@@ -101,7 +100,7 @@ void MacroWindow::initMacro(QDomNode &node)
} else if(xml_elem.tagName() == "script") {
if(xml_elem.attribute("language", "lua") == "lua") {
- this->lua->runScript(xml_elem.text(), NULL, "preload");
+ lua->runScript(xml_elem.text(), NULL, "preload");
}
} else if(xml_elem.tagName() == "widgets") {
@@ -118,15 +117,6 @@ void MacroWindow::initMacro(QDomNode &node)
mainwidget = window;
mainwidget->setValues();
- /*
- QDomNodeList children = node.childNodes();
-
- // Insert their values (this must be done last for scripts to work properly)
- for (int i=0; i<children.count();i++) {
- QDomNode child = children.at(i);
- setValues(child, mainwidget);
- }
- */
if(waschanged == true) macroChanged();
@@ -188,8 +178,6 @@ void MacroWindow::expandWrapper()
{
if(!isCollapsed()) return;
- // clear();
-
waschanged = false;
QDomDocument xml_doc = netcom.send(templ, macro);
@@ -300,11 +288,11 @@ void MacroWindow::setActive(bool active)
void MacroWindow::clear()
{
- if(mainwidget) mainwidget->deleteLater();
+ if(mainwidget) delete mainwidget;
mainwidget = NULL;
- setExpandedWidget(NULL);
+ lua->clear();
- luaprograms.clear();
+ setExpandedWidget(NULL);
}