[qnut] fixed main window show/hide on tray icon click event
[nut.git] / libnutcommon / common.cpp
blobb71a6efde3984874c31a06a8828024e279efb617
1 #include "common.h"
3 QDBusArgument &operator<< (QDBusArgument &argument, const QHostAddress &data) {
4 argument.beginStructure();
5 argument << data.toString();
6 argument.endStructure();
7 return argument;
9 const QDBusArgument &operator>> (const QDBusArgument &argument, QHostAddress &data) {
10 argument.beginStructure();
11 QString addr;
12 argument >> addr;
13 data = QHostAddress(addr);
14 argument.endStructure();
15 return argument;
18 namespace libnutcommon {
19 void config_init();
20 void device_init();
22 void init() {
23 static int done = 0;
24 if (done) return;
25 done = 1;
27 config_init();
28 device_init();
30 qRegisterMetaType< QHostAddress >("QHostAddress");
31 qRegisterMetaType< QList<QHostAddress> >("QList<QHostAddress>");
32 qDBusRegisterMetaType< QHostAddress >();
33 qDBusRegisterMetaType< QList<QHostAddress> >();
35 qRegisterMetaType< QVector< quint32 > >("QVector< quint32 >");
36 qRegisterMetaType< QVector< QVector< quint32 > > >("QVector< QVector< quint32 > >");
37 qDBusRegisterMetaType< QVector< quint32 > >();
38 qDBusRegisterMetaType< QVector< QVector< quint32 > > >();