33
by Shine Huang
change branch to 0.8.0 |
1 |
/*
|
2 |
* This file is part of the chinese-calendar project
|
|
3 |
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
|
|
4 |
*
|
|
5 |
* This program is free software: you can redistribute it and/or modify
|
|
6 |
* it under the terms of the GNU General Public License version 3 as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
* GNU General Public License for more details.
|
|
13 |
*
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16 |
*
|
|
40.1.2
by Anthony Wong
Replace UbuntuKylin with Ubuntu Kylin |
17 |
* This project is developed by "Ubuntu Kylin Members" team,
|
33
by Shine Huang
change branch to 0.8.0 |
18 |
* see <https://launchpad.net/~ubuntukylin~members>
|
19 |
* Authors: Abel Liu <guiltyritter@gmail.com>
|
|
20 |
* Shine Huang <hostc@163.com>
|
|
21 |
*/
|
|
22 |
||
23 |
#include <QtGui> |
|
24 |
#include <QCoreApplication> |
|
25 |
#include <QTranslator> |
|
26 |
#include <QTextCodec> |
|
27 |
#include <QDesktopWidget> |
|
37
by Shine Huang
0.8.1 new upstream release |
28 |
#include <QtSingleApplication> |
33
by Shine Huang
change branch to 0.8.0 |
29 |
#include "chinesecalendar.h" |
30 |
||
31 |
int main(int argc, char *argv[]) |
|
32 |
{
|
|
37
by Shine Huang
0.8.1 new upstream release |
33 |
//单程序运行处理
|
34 |
QtSingleApplication app(argc, argv); |
|
35 |
if (app.isRunning()) |
|
36 |
return 0; |
|
37 |
||
33
by Shine Huang
change branch to 0.8.0 |
38 |
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); |
39 |
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); |
|
37
by Shine Huang
0.8.1 new upstream release |
40 |
// QApplication app(argc, argv);
|
33
by Shine Huang
change branch to 0.8.0 |
41 |
QTranslator translator; |
42 |
||
43 |
translator.load(":/translate/i18_zh_CN.qm"); |
|
44 |
app.installTranslator(&translator); |
|
45 |
||
45
by Shine Huang
1.0.0-2 fix |
46 |
// load default skin
|
47 |
//#ifdef DEBUG
|
|
48 |
// QFile file(QCoreApplication::applicationDirPath() + "/skin/blue-skin.qss");
|
|
49 |
//#else
|
|
50 |
// QFile file("/usr/share/chinese-calendar/skin/blue-skin.qss");
|
|
51 |
//#endif
|
|
52 |
// file.open(QFile::ReadOnly);
|
|
53 |
// QString stylesheet = QObject::tr(file.readAll());
|
|
54 |
// app.setStyleSheet(stylesheet);
|
|
33
by Shine Huang
change branch to 0.8.0 |
55 |
|
56 |
app.setQuitOnLastWindowClosed(false); |
|
57 |
||
58 |
ChineseCalendar *window = new ChineseCalendar; |
|
59 |
app.setWindowIcon(window->icon64); |
|
60 |
window->setWindowFlags(Qt::FramelessWindowHint); |
|
61 |
window->resetDateItemColor(); |
|
62 |
||
63 |
QDesktopWidget desktop; |
|
64 |
int width = desktop.screenGeometry().width(); |
|
65 |
int height = desktop.screenGeometry().height(); |
|
66 |
||
42
by Shine Huang
1.0.0 |
67 |
window->move(width - window->width() - 5, 30); |
33
by Shine Huang
change branch to 0.8.0 |
68 |
window->hide(); |
69 |
return app.exec(); |
|
70 |
}
|