2
* Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd.
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; version 3.
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.
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/>.
19
#include "contentfield.h"
20
#include "messengerproxy.h"
22
ContentField::ContentField(QWidget *parent)
23
:QStackedWidget(parent)
25
this->setStyleSheet("background:transparent;");
26
this->setAutoFillBackground(false);
27
this->view = new QDeclarativeView(this);
29
// this->view->rootContext()->setContextProperty("mainwindow", this->view);
30
this->setFixedSize(this->view->size());
31
this->view->move(0, 0);
34
connect(this, SIGNAL(activePushStack(int)), MessengerProxy::get_instance_object(), SLOT(accessCurrentHomeIndex(int)));
37
ContentField::~ContentField()
42
void ContentField::DoNavigate(int index)
44
if(index >= 0 && index <= 4) {
45
emit activePushStack(index);//返回首页信号
46
// this->setCurrentIndex(index);
50
inline bool isRunningInstalled() {
51
static bool installed = (QCoreApplication::applicationDirPath() ==
52
QDir(("/usr/bin")).canonicalPath());
56
inline QString getAppDirectory() {
57
if (isRunningInstalled()) {
58
// qDebug() << QCoreApplication::applicationDirPath();
59
return QString("/usr/share/youker-assistant/qml/");
61
return QString(QCoreApplication::applicationDirPath() + "/../qml/");
65
void ContentField::setup() {
66
this->view->engine()->setBaseUrl(QUrl::fromLocalFile(getAppDirectory()));
67
this->view->setSource(QUrl::fromLocalFile("ContentField.qml"));