-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
28 lines (22 loc) · 750 Bytes
/
main.cpp
File metadata and controls
28 lines (22 loc) · 750 Bytes
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
#include <QApplication>
#include <QCoreApplication>
#include <QMessageBox>
#include "traycontroller.h"
#include "singleapplication.h"
int main(int argc, char *argv[])
{
SingleApplication * a = new SingleApplication(argc, argv,"note by xingchen");
if(a->isRunning ())
{
a->sendMessage ("note by xingchen is running");
QMessageBox::warning (0,"note by xingchen","note已经打开");
return 0;
}
TrayController * t = new TrayController();
t->show();
// 捕获 commitDataRequest(QSessionManager&) 消息
// 使得程序得知系统将要关机或者注销
QObject::connect (a,SIGNAL(commitDataRequest(QSessionManager&)),
t,SLOT(quitSlot()));
return a->exec();
}