summaryrefslogtreecommitdiff
path: root/client/macrowindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/macrowindow.cc')
-rw-r--r--client/macrowindow.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index e3e3bac..db6ad53 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -44,14 +44,13 @@ extern QString user;
extern QString host;
extern quint16 port;
-MacroWindow::MacroWindow(NetCom *netcom, QDomNode &xml_doc, QString course,
+MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString course,
bool collapsed, bool compact)
- : Collapser()
+ : Collapser(), netcom(n)
{
waschanged = false;
this->course = course;
- this->netcom = netcom;
setCollapsedWidget(new ResumeWidget(compact));
@@ -60,6 +59,7 @@ MacroWindow::MacroWindow(NetCom *netcom, QDomNode &xml_doc, QString course,
update(xml_doc);
setCollapsed(collapsed);
+ active = true;
}
MacroWindow::~MacroWindow()
@@ -149,7 +149,7 @@ bool MacroWindow::doCommit()
// If all entries passed validation, continue commit
if(faulty == 0) {
- netcom->send(widgets, course, macro, version);
+ netcom.send(widgets, course, macro, version);
emit updateOnCommit();
setCollapsed(true);
return true;
@@ -305,7 +305,7 @@ void MacroWindow::expandWrapper()
luaprograms.clear();
waschanged = false;
- QDomDocument xml_doc = netcom->send(course, macro);
+ QDomDocument xml_doc = netcom.send(course, macro);
//
// TODO: This is where the dependency checking should occur.
@@ -380,6 +380,7 @@ void MacroWindow::collapseWrapper()
void MacroWindow::toggleMacro()
{
+ if(!active) return;
if(isCollapsed()) {
expandWrapper();
} else {
@@ -393,3 +394,13 @@ void MacroWindow::macroChanged()
emit macroHasChanged();
waschanged = true;
}
+
+void MacroWindow::setActive(bool active)
+{
+ if(this->active == active) return;
+
+ this->active = active;
+ if(active == false) setEnabled(false);
+ else setEnabled(true);
+ emit activationChanged(active);
+}