~kobe24-lixiang/youker-assistant/trunk

« back to all changes in this revision

Viewing changes to src/youker-application.cpp

  • Committer: Shine Huang
  • Date: 2013-08-26 05:59:11 UTC
  • mfrom: (72.1.35 youker-assistant)
  • Revision ID: hostc@163.com-20130826055911-1losjpsvdiaz5oyf
add monitorball func into systembus

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
3
3
 *
4
 
 * Authors:
5
 
 *  Kobe Lee    kobe24_lixiang@126.com
6
 
 *
7
4
 * This program is free software; you can redistribute it and/or modify
8
5
 * it under the terms of the GNU General Public License as published by
9
6
 * the Free Software Foundation; version 3.
40
37
#include <stdlib.h>
41
38
#include <stdio.h>
42
39
#include <string.h>
43
 
 
44
 
 
45
40
#include <QtDBus>
46
41
 
47
42
extern QString passwd;
63
58
        return QString("/usr/share/youker-assistant/qml/");
64
59
//        return QString("/usr/share/youker-assistant/qml/main.qml");
65
60
    } else {
66
 
//        return QString(QCoreApplication::applicationDirPath() + "/../qml/main.qml");//0720
 
61
//        return QString(QCoreApplication::applicationDirPath() + "/../qml/main.qml");
67
62
        return QString(QCoreApplication::applicationDirPath() + "/../qml/");
68
63
    }
69
64
}
70
65
 
71
 
bool IhuApplication::setup(/*QString str*/)
 
66
bool IhuApplication::setup()
72
67
{
73
 
//    if (str == "SessionDaemon") {
74
 
//        qDebug() << "SessionDaemon000";
75
 
//    }
76
 
//    else {
77
 
//        qDebug() << "SessionDaemon111";
78
 
////        QProcess *process_session = new QProcess;
79
 
////        process_session->start("/usr/bin/youkersession");
80
 
//        int b = system("/usr/bin/youkersession &");
81
 
//        qDebug() << b;
82
 
//        qDebug() << "SessionDaemon222";
83
 
//    }
84
 
 
85
 
 
86
 
 
87
 
 
88
 
//    bool debug_flag = false;
89
 
//    //debug source
90
 
//    if (!debug_flag) {
91
 
//        if (str == "SessionDaemon") {
92
 
//            qDebug() << "SessionDaemon000";
93
 
//        }
94
 
//        else {
95
 
//            qDebug() << "SessionDaemon111";
96
 
////            QProcess *process_session = new QProcess;
97
 
////            process_session->start("/usr/bin/youkersession");
98
 
//            int b = system("/usr/bin/youkersession");
99
 
//            qDebug() << b;
100
 
//            qDebug() << "SessionDaemon222";
101
 
//        }
102
 
//    }
103
 
//    //run deb package
104
 
//    else {
105
 
//        AuthDialog *dialog = new AuthDialog;
106
 
//        dialog->exec();
107
 
 
108
 
//        int value = 0;
109
 
//        QString str = "";
110
 
//        FILE *stream_system;
111
 
//        char buf[64];
112
 
//        memset(buf, '\0', sizeof(buf));
113
 
//        stream_system = popen("ps -ef | grep youkersystem | grep -v grep | wc -l", "r" );
114
 
//        fread(buf, sizeof(char), sizeof(buf), stream_system);
115
 
//        str = QString(buf);
116
 
//        value = str.toInt();
117
 
//        if (value == 0) {
118
 
//            QProcess *process_system = new QProcess;
119
 
//            process_system->start("/usr/bin/youkersystem " + passwd);
120
 
//        }
121
 
//        pclose(stream_system);
122
 
 
123
 
 
124
 
//        FILE *stream_session;
125
 
//        memset(buf, '\0', sizeof(buf));
126
 
//        stream_session = popen("ps -ef | grep youkersession | grep -v grep | wc -l", "r" );
127
 
//        fread(buf, sizeof(char), sizeof(buf), stream_session);
128
 
//        str = QString(buf);
129
 
//        value = str.toInt();
130
 
//        if (value == 0) {
131
 
//            qDebug() << "6789";
132
 
//            QProcess *process_session = new QProcess;
133
 
//            process_session->start("/usr/bin/youkersession");
134
 
//            qDebug() << "56789";
135
 
//        }
136
 
//        else
137
 
//            qDebug() << "67890";
138
 
//        memset(buf, '\0', sizeof(buf));
139
 
//        pclose(stream_session);
140
 
//    }
141
 
 
142
68
    IhuApplication::setApplicationName("Youker Assistant");
143
69
    viewer = new QDeclarativeView;
144
 
    viewer->engine()->setBaseUrl(QUrl::fromLocalFile(getAppDirectory()));//0720
145
 
    viewer->setSource(QUrl::fromLocalFile("main.qml"));//0720
146
 
//    viewer->setSource(QUrl("../qml/main.qml"));//0720
 
70
    viewer->engine()->setBaseUrl(QUrl::fromLocalFile(getAppDirectory()));
 
71
    viewer->setSource(QUrl::fromLocalFile("main.qml"));
 
72
//    viewer->setSource(QUrl("../qml/main.qml"));
147
73
    viewer->rootContext()->setContextProperty("mainwindow", viewer);
148
74
    viewer->setStyleSheet("background:transparent");
149
75
    viewer->setAttribute(Qt::WA_TranslucentBackground);