-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
104 lines (91 loc) · 2.1 KB
/
main.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include <ZApplication.h>
#include <ZMessageDlg.h>
#include <ZNoticeDlg.h>
#include <qdatetime.h>
#include <qtranslator.h>
#include <qtextcodec.h>
#include "megabox.h"
#include "myapplication.h"
#include "cfg.h"
#include "source.h"
#include "daemon.h"
#include "lng.h"
#include "myDef.h"
#include "codeComp.h"
#include "UtilsDBOperation.h"
Settings *cfg;
megabox *gui;
MyApplication *app;
Daemon *mDaemon;
Lng *lng;
//ResTool *res;
CDCP *codeComp;
UtilsDBOperation *mgxDB;
UtilsDBOperation *favDB;
#ifdef VE66_FIX_SWITCH
void note()
{
ZNoticeDlg *dlg = new ZNoticeDlg((ZNoticeDlg::Type)1 ,2000, "", ctr("App daemon start OK!!"));
dlg->exec();
delete dlg;
dlg = NULL;
}
#endif
int main(int argc, char** argv)
{
int ret = -1;
app = new MyApplication(argc,argv);
gui = NULL;
if(QCopChannel::isRegistered("/EZX/ROKRTOOLS"))
{
qDebug("app is registered , raise app \n");
QCopChannel::send("/EZX/ROKRTOOLS","RaiseUI()");
ret = 0;
}
if (ret == -1)
{
#ifdef VE66_FIX_SWITCH
note();
#endif
mgxDB = new UtilsDBOperation( MGX_OBJ_PATH );
favDB = new UtilsDBOperation( FAV_OBJ_PATH );
cfg = new Settings();
codeComp = new CDCP();
lng = new Lng(getAppDir()+"lng/"+cfg->lngStr);
gui = new megabox(NULL, NULL);
#ifdef DEBUG
std::cout<<"lng file is "<<getAppDir()+"lng/"+cfg->lngStr<<std::endl;
#endif
printf("start daemon\n");
mDaemon = new Daemon(NULL);
#ifdef START_NO_HIDE
printf("start no hide\n");
app->setMainWidget(gui);
gui->show();
#endif
//lng->start();
mDaemon->start();
ret = app->exec();
mDaemon->wait();
//lng->wait();
//delete res;
//res = NULL;
delete cfg;
cfg = NULL;
delete codeComp;
codeComp = NULL;
delete gui;
gui = NULL;
delete mDaemon;
mDaemon = NULL;
delete lng;
lng = NULL;
delete mgxDB;
mgxDB = NULL;
delete favDB;
favDB = NULL;
}
delete app;
app = NULL;
return ret;
}