#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;
}