~ubuntu-branches/ubuntu/vivid/youker-assistant/vivid

« back to all changes in this revision

Viewing changes to src/main.cpp

  • Committer: Package Import Robot
  • Author(s): Kobe Lee (kylinkobe)
  • Date: 2013-09-18 16:22:14 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130918162214-6nqyjyf3cd3ynqky
Tags: 0.2.1-0ubuntu1
* Modify the mouse events of MonitorBall.
* Add reset button for clear pages.
* Add policykit for apt clear in sudodbus.
* Fixed the bug about software status and add masklayer.
* Rewrite the code of system information.
* Add some signals and slots.
* Fixed the bug about Software signals(LP: #1226389).
* Modify KThread and add base.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
 */
16
16
#include <QApplication>
17
 
#include "fcitxcfgwizard.h" //kobe08
 
17
#include "fcitxcfgwizard.h"
 
18
#include "toolkits.h"
18
19
#include "systemdispatcher.h"
19
20
#include "sessiondispatcher.h"
 
21
#include "sudodispatcher.h"
20
22
#include "youker-application.h"
21
23
#include <QDeclarativeEngine>
22
24
#include <QDeclarativeView>
23
25
#include <QtDeclarative>
24
 
#include "quibo.h"
25
26
#include "qmlaudio.h"
26
27
#include <QTextCodec>
27
28
#include <QProcess>
28
29
#include <QDebug>
29
 
 
30
30
#include <sys/types.h>
31
 
#include <unistd.h>
32
 
#include <stdlib.h>
33
 
#include <stdio.h>
34
 
#include <string.h>
35
 
#include <QDialog>
36
 
 
37
31
#include "qrangemodel.h"
38
32
#include "qstyleitem.h"
39
33
#include "qwheelarea.h"
56
50
#include <qdeclarativeitem.h>
57
51
#include <qdeclarativeimageprovider.h>
58
52
#include <qdeclarativeview.h>
59
 
#include <QImage>
60
 
 
61
 
 
62
53
#include "KThread.h"
63
54
 
64
 
/*
65
 
a       ARRAY 数组
66
 
b       BOOLEAN 布尔值
67
 
d       DOUBLE IEEE 754双精度浮点数
68
 
g       SIGNATURE 类型签名
69
 
i       INT32 32位有符号整数
70
 
n       INT16 16位有符号整数
71
 
o       OBJECT_PATH 对象路径
72
 
q       UINT16 16位无符号整数
73
 
s       STRING 零结尾的UTF-8字符串
74
 
t       UINT64 64位无符号整数
75
 
u       UINT32 32位无符号整数
76
 
v       VARIANT 可以放任意数据类型的容器,数据中包含类型信息。例如glib中的GValue。
77
 
x       INT64 64位有符号整数
78
 
y       BYTE 8位无符号整数
79
 
()      定义结构时使用。例如"(i(ii))"
80
 
{}      定义键-值对时使用。例如"a{us}"
81
 
 
82
 
a表示数组,数组元素的类型由a后面的标记决定。例如:
83
 
    "as"是字符串数组。
84
 
    数组"a(i(ii))"的元素是一个结构。用括号将成员的类型括起来就表示结构了,结构可以嵌套。
85
 
    数组"a{sv}"的元素是一个键-值对。"{sv}"表示键类型是字符串,值类型是VARIANT。
86
 
*/
87
 
 
88
 
 
89
 
void registerTypes()
90
 
{
 
55
 
 
56
void registerTypes() {
 
57
    qmlRegisterType<Toolkits>("ToolkitsType", 0, 1, "Toolkits");
91
58
    qmlRegisterType<SessionDispatcher>("SessionType", 0, 1, "SessionDispatcher");
92
59
    qmlRegisterType<SystemDispatcher>("SystemType", 0, 1, "SystemDispatcher");
93
 
    qmlRegisterType<FcitxCfgWizard>("FcitxCfgWizard", 0, 1, "FcitxCfgWizard");//kobe08
 
60
    qmlRegisterType<SudoDispatcher>("SudoType", 0, 1, "SudoDispatcher");
 
61
    qmlRegisterType<FcitxCfgWizard>("FcitxCfgWizard", 0, 1, "FcitxCfgWizard");
94
62
    qmlRegisterType<QmlAudio>("AudioType", 0, 1, "QmlAudio");
95
63
    qmlRegisterType<QRangeModel>("RangeModelType", 0, 1, "RangeModel");
96
64
    qmlRegisterType<QStyleItem>("StyleItemType", 0, 1, "StyleItem");
97
65
    qmlRegisterType<QWheelArea>("WheelAreaType", 0, 1, "WheelArea");
98
66
    qmlRegisterType<QtMenu>("MenuType", 0, 1, "Menu");
99
67
    qmlRegisterUncreatableType<QtMenuBase>("MenuBaseType", 0, 1, "NativeMenuBase", QLatin1String("Do not create objects of type NativeMenuBase"));
100
 
 
101
68
    qmlRegisterType<QCursorArea>("CursorAreaType", 0, 1, "CursorArea");
102
69
    qmlRegisterType<QTooltipArea>("TooltipAreaType", 0, 1, "TooltipArea");
103
70
    qmlRegisterType<QtMenuBar>("MenuBarType", 0, 1, "MenuBar");
112
79
    qmlRegisterUncreatableType<QDeclarativeLayout>("LayoutType", 0, 1, "Layout",
113
80
                                                   QLatin1String("Do not create objects of type Layout"));
114
81
    qmlRegisterUncreatableType<QDesktopItem>("DesktopType",0,1,"Desktop", QLatin1String("Do not create objects of type Desktop"));
115
 
 
116
82
}
117
83
 
118
 
 
119
84
int main(int argc, char** argv)
120
85
{
 
86
    int num = 0;
 
87
    QProcess *process = new QProcess();
 
88
    QStringList *args = new QStringList();
 
89
    args->append("aux");
 
90
    process->start("ps", *args);
 
91
    process->waitForFinished();
 
92
    while(process->canReadLine()) {
 
93
        QString tmp = process->readLine();
 
94
        if(tmp.endsWith("youker-assistant\n")) {
 
95
            num += 1;
 
96
        }
 
97
        if(num > 1) {
 
98
            exit(0);
 
99
        }
 
100
    }
121
101
    QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
122
102
    QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
123
103
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
137
117
    }
138
118
    return application.exec();
139
119
}
 
120
 
 
121
 
 
122
/*
 
123
a       ARRAY 数组
 
124
b       BOOLEAN 布尔值
 
125
d       DOUBLE IEEE 754双精度浮点数
 
126
g       SIGNATURE 类型签名
 
127
i       INT32 32位有符号整数
 
128
n       INT16 16位有符号整数
 
129
o       OBJECT_PATH 对象路径
 
130
q       UINT16 16位无符号整数
 
131
s       STRING 零结尾的UTF-8字符串
 
132
t       UINT64 64位无符号整数
 
133
u       UINT32 32位无符号整数
 
134
v       VARIANT 可以放任意数据类型的容器,数据中包含类型信息。例如glib中的GValue。
 
135
x       INT64 64位有符号整数
 
136
y       BYTE 8位无符号整数
 
137
()      定义结构时使用。例如"(i(ii))"
 
138
{}      定义键-值对时使用。例如"a{us}"
 
139
 
 
140
a表示数组,数组元素的类型由a后面的标记决定。例如:
 
141
    "as"是字符串数组。
 
142
    数组"a(i(ii))"的元素是一个结构。用括号将成员的类型括起来就表示结构了,结构可以嵌套。
 
143
    数组"a{sv}"的元素是一个键-值对。"{sv}"表示键类型是字符串,值类型是VARIANT。
 
144
*/