summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/builder.cc18
-rw-r--r--client/builder.h1
-rw-r--r--client/macro.cc34
-rw-r--r--client/macro.h9
-rw-r--r--client/main.cc13
5 files changed, 68 insertions, 7 deletions
diff --git a/client/builder.cc b/client/builder.cc
index 29c42c6..af44fd8 100644
--- a/client/builder.cc
+++ b/client/builder.cc
@@ -69,9 +69,11 @@ void Builder::recurser(QDomNode xml_node, QWidget *parent)
} else if(xml_elem.tagName() == "button") {
PushButton *pushbutton = new PushButton(xml_elem);
+ //connect(pushbutton, SIGNAL(act_continue()), main, SLOT(get_macro()));
connect(pushbutton, SIGNAL(act_commit()), this, SLOT(commit()));
connect(pushbutton, SIGNAL(act_reset()), this, SLOT(reset()));
connect(pushbutton, SIGNAL(act_cancel()), this, SLOT(cancel()));
+ connect(pushbutton, SIGNAL(act_continue()), this, SLOT(cont("fisk")));
widget = pushbutton;
} else if(xml_elem.tagName() == "textedit") {
@@ -190,3 +192,19 @@ void Builder::cancel()
{
printf("Builder -> cancelling...\n");
}
+
+void Builder::cont(QString name)
+{
+ /*
+ QVector< Widget* >::iterator i=widgets.begin();
+ while (i != widgets.end()) {
+ Widget* w = *i;
+
+ if(w->getName()
+ xml_string.append(" <field name=\"" + w->getName()
+ + "\" value=\"" + w->getValue() + "\"/>\n");
+ i++;
+ }
+ */
+ printf("%s : Builder -> continuing...\n", name.toStdString().c_str());
+}
diff --git a/client/builder.h b/client/builder.h
index 586370d..534480f 100644
--- a/client/builder.h
+++ b/client/builder.h
@@ -47,6 +47,7 @@ public slots:
void commit();
void reset();
void cancel();
+ void cont(QString name);
private:
void recurser(QDomNode xml_node, QWidget *parent);
diff --git a/client/macro.cc b/client/macro.cc
index ec520f0..654557d 100644
--- a/client/macro.cc
+++ b/client/macro.cc
@@ -28,10 +28,22 @@
#include "builder.h"
#include "sendrecieve.h"
#include <QDomDocument>
+#include <QApplication>
+
+#define MY_EVENT_ID 65432
+
+class MyEvent : public QEvent {
+public:
+ MyEvent(QString macro) : QEvent((QEvent::Type)MY_EVENT_ID)
+ {
+ this->macro = macro;
+ }
+ QString macro;
+};
static QDomDocument xml_request(QString name);
-void macro(QString name)
+void create_macro(QString name)
{
// Build the XML request
QDomDocument xml_req = xml_request(name);
@@ -55,6 +67,26 @@ void macro(QString name)
Builder *builder = new Builder(&xml_doc);
}
+bool MyEventHandler::eventFilter( QObject *o, QEvent *e )
+{
+
+ if ( e->type() == MY_EVENT_ID ) {
+ MyEvent *event = (MyEvent*)e;
+ create_macro(event->macro);
+ // ... DO SOMETHING WITH EVENT
+ return TRUE; // eat event
+ } else {
+ // standard event processing
+ return FALSE;
+ }
+}
+
+void new_macro(QString macro)
+{
+ MyEvent *event = new MyEvent(macro);
+ qApp->postEvent(qApp, event);
+}
+
static QDomDocument xml_request(QString name)
{
// Create the xml request array
diff --git a/client/macro.h b/client/macro.h
index 36f4f4f..9863d3a 100644
--- a/client/macro.h
+++ b/client/macro.h
@@ -28,7 +28,14 @@
#define __PRACRO_MACRO_H__
#include <QString>
+#include <QObject>
+#include <QEvent>
-void macro(QString name);
+class MyEventHandler : public QObject {
+protected:
+ bool eventFilter( QObject *o, QEvent *e );
+};
+
+void new_macro(QString name);
#endif/*__PRACRO_MACRO_H__*/
diff --git a/client/main.cc b/client/main.cc
index a37ed1e..025b713 100644
--- a/client/main.cc
+++ b/client/main.cc
@@ -25,16 +25,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include "macro.h"
-#include "sendrecieve.h"
#include <QApplication>
+#include <QObject>
+#include <QEvent>
+#include "macro.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
-
- macro("example");
+
+ MyEventHandler *eventhandler = new MyEventHandler();
+ app.installEventFilter( eventhandler );
+
+ new_macro("example");
return app.exec();
}
-