summaryrefslogtreecommitdiff
path: root/client/test/util.cc
blob: 1fd09d4227a6fd1279364927141fc4487d8b700f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "util.h"
#include <QDomDocument>
#include <QSettings>
#include <QDomNode>

#include "netcom.h"

#define CONFIG_DEFAULT "pracro.ini"

MacroWindow *createMacroWindow()
{
  MacroWindow *m;

  QSettings settings("pracro.ini", QSettings::IniFormat);
  settings.beginGroup("server");
  QString host = settings.value("host").toString();
  int port = settings.value("port").toInt();
  settings.endGroup();

	NetCom netcom(host, port);
	QDomNode node;
  m = new MacroWindow(netcom, node, "test");
  return m;
}

QDomElement getWidgetElement(QString type, QString name, QString value)
{
  QDomDocument doc;

  QDomElement e = doc.createElement(type);
  e.setAttribute("name", name);
  if(value != "") e.setAttribute("value", value);

  return e;
}