2
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & Kylin Ltd.
5
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 3.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#include "mainwindow.h"
22
#include <QPropertyAnimation>
23
#include <QParallelAnimationGroup>
24
#include "shadowwidget.h"
25
//#include "cameramanager.h"
26
#include "../component/threadpool.h"
28
QString GlobalData::globalarch = ""; // add by hebing, just for transmit var
30
MainWindow::MainWindow(QString cur_arch, int d_count, QWidget *parent) :
31
QDialog(parent), arch(cur_arch), display_count(d_count)/*skin_center(parent),*/
34
GlobalData::globalarch = this->arch;
36
this->osName = accessOSName();
38
// dsk = getenv("XDG_CURRENT_DESKTOP");
41
this->desktop = qgetenv("XDG_CURRENT_DESKTOP");
42
if(this->desktop.isEmpty())
43
this->desktop = qgetenv("XDG_SESSION_DESKTOP");
44
// qDebug() << this->desktop;
45
// qDebug() << QString::compare(this->desktop, "mate", Qt::CaseInsensitive/*Qt::CaseInsensitive*/);
47
// this->osName = "Kylin";
48
// if (this->arch == "aarch64" || this->osName == "Kylin" || this->osName == "YHKylin") {
49
if (this->desktop == "MATE" || this->desktop == "mate" || this->desktop == "UKUI" || this->desktop == "ukui") {
51
this->resize(900, 600);
52
this->setAutoFillBackground(true);
53
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Widget);
54
this->setWindowTitle(tr("Kylin Assistant"));
57
this->setFixedSize(900, 600);
58
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowSystemMenuHint);
59
this->setWindowTitle(tr("Youker Assistant"));
62
// this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowSystemMenuHint);
63
//// this->setAttribute(Qt::WA_TranslucentBackground, true);
65
this->setWindowIcon(QIcon(":/res/youker-assistant.png"));
66
this->setWindowOpacity(1);
67
// this->setWindowFlags(Qt::FramelessWindowHint | Qt::Widget);
68
// this->setAttribute(Qt::WA_TranslucentBackground);
69
// this->setStyleSheet("QMainWindow{border: 1px solid gray;border-radius:2px}");
70
this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}");
71
// version = "V2.2.0";
75
sessioninterface = NULL;
76
systeminterface = NULL;
78
mSettings = new QSettings(YOUKER_COMPANY_SETTING, YOUKER_SETTING_FILE_NAME_SETTING);
79
mSettings->setIniCodec("UTF-8");
82
//judge has skin or not in /var/lib/youker-assistant-daemon/default/
83
mSettings->beginGroup("Background");
84
last_skin_path = mSettings->value("Path").toString();
85
if(last_skin_path.isEmpty()) {
86
last_skin_path = ":/background/res/skin/1.png";
87
mSettings->setValue("Path", last_skin_path);
90
QStringList skinlist = this->filterSkin();
91
QList<QString>::Iterator it = skinlist.begin(), itend = skinlist.end();
93
for(;it != itend; it++)
95
if(*it == last_skin_path) {
101
last_skin_path = skinlist.at(0);
102
mSettings->setValue("Path", last_skin_path);
106
mSettings->endGroup();
108
main_skin_pixmap.load(last_skin_path);
114
cleaner_widget = NULL;
115
setting_widget = NULL;
120
upgrade_dialog = NULL;
121
// camera_manager = NULL;
126
home_action_widget = NULL;
127
info_action_widget = NULL;
128
cleaner_action_widget = NULL;
129
setting_action_widget = NULL;
130
box_action_widget = NULL;
132
toolKits = new Toolkits(0, this->width(), this->height());
135
shadow_widget = new ShadowWidget(this);
136
shadow_widget->setGeometry(rect());
137
// shadow_widget->setColor(QColor(Qt::gray));
138
shadow_widget->setColor(QColor("#e9eef0"));
140
default_action_widget = new ActionWidget(this);
141
default_action_widget->setGeometry(QRect(0, 0, 900, 227));
142
default_action_widget->setFixedHeight(227);
143
other_action_widget = new ActionWidget(this);
144
other_action_widget->setGeometry(QRect(0, -150, 900, 150));
145
other_action_widget->setFixedHeight(150);
146
topStack = new QStackedWidget(other_action_widget);
147
topStack->setGeometry(other_action_widget->rect());
149
//设置在最底层,方便title_widget的显示
150
// default_action_widget->lower();
151
QPalette palette_back;
152
palette_back.setBrush(QPalette::Background, QBrush(QPixmap(last_skin_path)));
153
default_action_widget->setPalette(palette_back);
154
other_action_widget->setPalette(palette_back);
156
tool_widget = new ToolWidget(this, this->arch, this->osName);
157
tool_widget->setGeometry(QRect(0, 227, 900, 47));
158
tool_widget->setParentWindow(this);
159
connect(this, SIGNAL(chanegBoxToolStatus()), tool_widget, SLOT(showBoxTool()));
160
tool_widget->initConnect();
162
title_widget = new TitleWidget(this, this->arch, this->osName);
163
if (this->arch == "aarch64" || this->osName == "Kylin" || this->osName == "YHKylin")
164
title_widget->move(756, 0);
166
title_widget->move(0, 0);
168
connect(title_widget, SIGNAL(closeApp()), this, SLOT(closeYoukerAssistant()));
169
title_widget->setParentWindow(this);
170
title_widget->initConnect();
173
login_widget = new LoginWidget(this);
174
if (this->arch == "aarch64" || this->osName == "Kylin" || this->osName == "YHKylin")
175
login_widget->hide();
177
login_widget->move(585, 0);//900 - login_widget(220) - right_align(15) = 665
180
default_content_widget = new ContentWidget(this);
181
default_content_widget->setGeometry(QRect(0, 274, 900, 326));
182
default_content_widget->setFixedHeight(326);
183
other_content_widget = new ContentWidget(this);
184
other_content_widget->setGeometry(QRect(0, 600, 900, 403));
185
other_content_widget->setFixedHeight(403);
186
bottomStack = new QStackedWidget(other_content_widget);
187
bottomStack->setGeometry(other_content_widget->rect());
188
// top_grid_layout = NULL;
189
// bottom_grid_layout = NULL;
191
main_menu = new KylinMenu(this);
192
main_menu->setParentWindow(this);
193
main_menu->initConnect();
195
this->initHomePage();
196
this->initAnimation();
199
this->startDbusDaemon();
202
MainWindow::~MainWindow()
204
if (home_page != NULL)
209
if (info_widget != NULL)
214
if (cleaner_widget != NULL)
216
delete cleaner_widget;
217
cleaner_widget = NULL;
219
if (setting_widget != NULL)
221
delete setting_widget;
222
setting_widget = NULL;
224
if (box_widget != NULL)
229
if (setting_action_widget != NULL)
231
delete setting_action_widget;
232
setting_action_widget = NULL;
234
// if (sessioninterface != NULL)
236
// delete sessioninterface;
237
// sessioninterface = NULL;
239
// if (systeminterface != NULL)
241
// delete systeminterface;
242
// systeminterface = NULL;
244
if (sessioninterface) {
245
sessioninterface->deleteLater();
247
if (systeminterface) {
248
systeminterface->deleteLater();
250
ThreadPool::Instance()->deleteLater();
251
if (aboutDlg != NULL)
256
if (toolKits != NULL)
261
if (mSettings != NULL)
268
if(auto_start != NULL)
273
// if(camera_manager != NULL)
275
// delete camera_manager;
276
// camera_manager = NULL;
278
if(skin_center != NULL)
283
if(upgrade_dialog != NULL)
285
delete upgrade_dialog;
286
upgrade_dialog = NULL;
290
QString MainWindow::accessOSName()
296
QFile osfile("/etc/os-release");
297
if(osfile.exists()) {
298
if(!osfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
299
qDebug() << "Can't open os-release!" << endl;
302
while(!osfile.atEnd()) {
303
QByteArray line = osfile.readLine();
305
if (str.startsWith("NAME")) {
313
if(tmp.length() > 0 && tmp.contains("=")) {
314
osname = QString(tmp.split("=").at(1)).replace("\"", "").replace("\n","").trimmed();
316
if(osname.length() > 0) {
322
QFile ukfile("/etc/ubuntukylin-release");
323
if(ukfile.exists()) {
324
if(!ukfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
325
qDebug() << "Can't open ubuntukylin-release!" << endl;
328
while(!ukfile.atEnd()) {
329
QByteArray line = ukfile.readLine();
331
if (str.startsWith("DISTRIB_DESCRIPTION")) {
339
if(tmp.length() > 0 && tmp.contains("=")) {
340
osname = QString(tmp.split("=").at(1)).replace("\"", "").replace("\n","").trimmed();
342
if(osname.length() > 0) {
348
QFile lsbfile("/etc/lsb-release");
349
if(lsbfile.exists()) {
350
if(!lsbfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
351
qDebug() << "Can't open lsb-release!" << endl;
354
while(!lsbfile.atEnd()) {
355
QByteArray line = lsbfile.readLine();
357
if (str.startsWith("DISTRIB_DESCRIPTION")) {
365
if(tmp.length() > 0 && tmp.contains("=")) {
366
osname = QString(tmp.split("=").at(1)).replace("\"", "").replace("\n","").trimmed();
368
if(osname.length() > 0) {
372
return "Ubuntu Kylin";
375
bool MainWindow::deleteFile(QString filename)
377
bool result = systeminterface->delete_file_qt(filename);
381
bool MainWindow::CopyFile(QString filename)
383
bool result = systeminterface->copy_file_qt(filename);
387
QStringList MainWindow::filterSkin()
389
QStringList skinlist;
390
QString path = "/var/lib/youker-assistant-daemon/default/";
391
QString path2 = "/var/lib/youker-assistant-daemon/custom/";
393
picdir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
394
picdir.setSorting(QDir::Size | QDir::Reversed);
396
picdir2.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
397
picdir2.setSorting(QDir::Size | QDir::Reversed);
399
filters << "*.jpg" << "*.png";
400
picdir.setNameFilters(filters);
401
picdir2.setNameFilters(filters);
402
QFileInfoList list = picdir.entryInfoList();
403
QFileInfoList list2 = picdir2.entryInfoList();
404
if(list.size() < 1 && list2.size() < 1) {
405
skinlist << ":/background/res/skin/1.png" << ":/background/res/skin/2.png" << ":/background/res/skin/3.png" << ":/background/res/skin/4.png";
406
// return ":/background/res/skin/1.png";
408
else if(list.size() > 0 && list2.size() > 0) {
409
for (int j = 0; j < list.size(); ++j) {
410
QFileInfo fileInfo = list.at(j);
411
skinlist << path + fileInfo.fileName();
413
for (int k = 0; k < list2.size(); ++k) {
414
QFileInfo fileInfo = list2.at(k);
415
skinlist << path2 + fileInfo.fileName();
417
skinlist << ":/background/res/skin/1.png" << ":/background/res/skin/2.png" << ":/background/res/skin/3.png" << ":/background/res/skin/4.png";
420
if(list.size() > 0) {
421
for (int j = 0; j < list.size(); ++j) {
422
QFileInfo fileInfo = list.at(j);
423
skinlist << path + fileInfo.fileName();
425
skinlist << ":/background/res/skin/1.png" << ":/background/res/skin/2.png" << ":/background/res/skin/3.png" << ":/background/res/skin/4.png";
427
else if(list2.size() > 0) {
428
for (int m = 0; m < list2.size(); ++m) {
429
QFileInfo fileInfo = list2.at(m);
430
skinlist << path2 + fileInfo.fileName();
432
skinlist << ":/background/res/skin/1.png" << ":/background/res/skin/2.png" << ":/background/res/skin/3.png" << ":/background/res/skin/4.png";
434
// QFileInfo fileInfo = list.at(0);
435
// return path + fileInfo.fileName();
440
void MainWindow::initAnimation()
442
QPoint origPoint(0, 227);
443
QPoint needPoint(0, 150);
444
QPoint origPoint1(0, 0);
445
QPoint needPoint1(0, -227);
446
QPoint origPoint2(0, -150);
447
QPoint needPoint2(0, 0);
449
QPoint origPoint3(0, 274);
450
QPoint needPoint3(0, 600);
451
QPoint origPoint4(0, 600);
452
QPoint needPoint4(0, 197);
454
QPropertyAnimation *mainActionAnimation = new QPropertyAnimation(default_action_widget, "pos");
455
mainActionAnimation->setDuration(500);
456
mainActionAnimation->setStartValue(origPoint1);
457
mainActionAnimation->setEndValue(needPoint1);
459
QPropertyAnimation *mainActionAnimation2 = new QPropertyAnimation(other_action_widget, "pos");
460
mainActionAnimation2->setDuration(500);
461
mainActionAnimation2->setStartValue(origPoint2);
462
mainActionAnimation2->setEndValue(needPoint2);
464
QPropertyAnimation *mainToolAnimation = new QPropertyAnimation(tool_widget, "pos");
465
mainToolAnimation->setDuration(500);
466
mainToolAnimation->setStartValue(origPoint);
467
mainToolAnimation->setEndValue(needPoint);
469
QPropertyAnimation *mainContentAnimation = new QPropertyAnimation(default_content_widget, "pos");
470
mainContentAnimation->setDuration(500);
471
mainContentAnimation->setStartValue(origPoint3);
472
mainContentAnimation->setEndValue(needPoint3);
474
QPropertyAnimation *mainContentAnimation2 = new QPropertyAnimation(other_content_widget, "pos");
475
mainContentAnimation2->setDuration(500);
476
mainContentAnimation2->setStartValue(origPoint4);
477
mainContentAnimation2->setEndValue(needPoint4);
479
QPropertyAnimation *m_toTrans = new QPropertyAnimation(shadow_widget, "opacity");
480
m_toTrans->setDuration(200);
481
m_toTrans->setStartValue(1);
482
m_toTrans->setEndValue(0);
484
spreadGroup = new QParallelAnimationGroup(this);
485
spreadGroup->addAnimation(mainActionAnimation);
486
spreadGroup->addAnimation(mainActionAnimation2);
487
spreadGroup->addAnimation(mainToolAnimation);
488
spreadGroup->addAnimation(mainContentAnimation);
489
spreadGroup->addAnimation(mainContentAnimation2);
490
spreadGroup->addAnimation(m_toTrans);
492
QPropertyAnimation *mainActionBackAnimation2 = new QPropertyAnimation(other_action_widget, "pos");
493
mainActionBackAnimation2->setDuration(500);
494
mainActionBackAnimation2->setStartValue(needPoint2);
495
mainActionBackAnimation2->setEndValue(origPoint2);
497
QPropertyAnimation *mainActionBackAnimation = new QPropertyAnimation(default_action_widget, "pos");
498
mainActionBackAnimation->setDuration(500);
499
mainActionBackAnimation->setStartValue(needPoint1);
500
mainActionBackAnimation->setEndValue(origPoint1);
502
QPropertyAnimation *mainToolBackAnimation = new QPropertyAnimation(tool_widget, "pos");
503
mainToolBackAnimation->setDuration(500);
504
mainToolBackAnimation->setStartValue(needPoint);
505
mainToolBackAnimation->setEndValue(origPoint);
508
QPropertyAnimation *mainContentBackAnimation = new QPropertyAnimation(default_content_widget, "pos");
509
mainContentBackAnimation->setDuration(500);
510
mainContentBackAnimation->setStartValue(needPoint3);
511
mainContentBackAnimation->setEndValue(origPoint3);
513
QPropertyAnimation *mainContentBackAnimation2 = new QPropertyAnimation(other_content_widget, "pos");
514
mainContentBackAnimation2->setDuration(500);
515
mainContentBackAnimation2->setStartValue(needPoint4);
516
mainContentBackAnimation2->setEndValue(origPoint4);
518
QPropertyAnimation *m_toGray = new QPropertyAnimation(shadow_widget, "opacity");
519
m_toGray->setDuration(200);
520
m_toGray->setStartValue(0);
521
m_toGray->setEndValue(1);
523
gatherGroup = new QParallelAnimationGroup(this);
524
gatherGroup->addAnimation(mainActionBackAnimation);
525
gatherGroup->addAnimation(mainActionBackAnimation2);
526
gatherGroup->addAnimation(mainToolBackAnimation);
527
gatherGroup->addAnimation(mainContentBackAnimation);
528
gatherGroup->addAnimation(mainContentBackAnimation2);
529
gatherGroup->addAnimation(m_toGray);
531
connect(spreadGroup, SIGNAL(finished()), this, SLOT(upAnimFinished()));
532
connect(gatherGroup, SIGNAL(finished()), this, SLOT(closeAnimFinished()));
535
void MainWindow::upAnimFinished()
538
shadow_widget->hide();
539
if(title_widget->isHidden())
540
title_widget->show();
541
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin")
543
if(status == BOXPAGE && login_widget->isHidden()) {
544
login_widget->show();
547
login_widget->hide();
552
void MainWindow::closeAnimFinished()
555
if(title_widget->isHidden())
556
title_widget->show();
557
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin" && login_widget->isHidden())
559
login_widget->show();
561
shadow_widget->hide();
564
void MainWindow::setTranslator(QTranslator* translator)
566
this->translator = translator;
569
void MainWindow::changeLanguage(LANGUAGE language)
571
if(current_language == language)
575
current_language = language;
580
translator->load(QString(":/qmfile/res/qm/youker-assistant_es.qm"));
584
translator->load(QString(":/qmfile/res/qm/youker-assistant_zh_CN.qm"));
588
translator->load(QString(":/qmfile/res/qm/youker-assistant_es.qm"));
592
translator->load(QString(":/qmfile/res/qm/youker-assistant_zh_CN.qm"));
595
// title_widget->translateLanguage();
596
// kill_mummy_widget->translateLanguage();
597
// main_menu->translateActions();
598
// character_widget->translateLanguage();
599
// login_dialog->translateLanguage();
600
// register_widget->translateLanguage();
601
// character_widget->translateLanguage();
602
// about_us_dialog->translateLanguage();
603
// setting_dialog->translateLanguage();
604
// skin_widget->translateLanguage();
605
// system_tray->translateLanguage();
608
void MainWindow::displayMainWindow(/*int count*/)
610
this->battery = sessioninterface->judge_power_is_exists_qt();
611
this->sensor = systeminterface->judge_sensors_exists_qt();
612
login_widget->setSessionDbusProxy(sessioninterface);
613
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin")
614
sessioninterface->check_user_qt();
615
connect(sessioninterface, SIGNAL(ssoSuccessSignal(QString, QString)), login_widget, SLOT(showLoginInfo(QString,QString)));
616
connect(sessioninterface, SIGNAL(ssoLoginLogoutSignal(bool)), login_widget, SLOT(showLoginAndLogoutStatus(bool)));
617
home_action_widget->setSessionDbusProxy(sessioninterface);
618
home_action_widget->setSystemDbusProxy(systeminterface);
619
home_action_widget->enableSanButton();
620
connect(sessioninterface, SIGNAL(isScanning(QString)), home_action_widget, SLOT(getScanResult(QString)));
621
connect(sessioninterface, SIGNAL(finishScanWork(QString)), home_action_widget, SLOT(finishScanResult(QString)));
622
connect(sessioninterface, SIGNAL(tellScanResult(QString,QString)) ,home_action_widget, SLOT(getScanAllResult(QString,QString)));
623
connect(systeminterface, SIGNAL(finishCleanWorkMain(QString/*, QString*/)), home_action_widget, SLOT(getCleanResult(QString/*, QString*/)));
624
connect(systeminterface, SIGNAL(finishCleanWorkMainError(QString)), home_action_widget, SLOT(finishCleanError(QString)));
625
connect(systeminterface, SIGNAL(quickCleanProcess(QString,QString)), home_action_widget, SLOT(getCleaningMessage(QString,QString)));
626
home_page->setSessionDbusProxy(sessioninterface);
627
home_page->setSystemDbusProxy(systeminterface);
628
this->initOtherPages();
630
// if (this->isHidden()) {
631
int windowWidth, windowHeight = 0;
632
if (this->display_count < 2) {
633
windowWidth = QApplication::desktop()->width();
634
windowHeight = QApplication::desktop()->height();
635
this->move((windowWidth - this->width()) / 2,(windowHeight - this->height()) / 2);
638
/*this->setGeometry(QApplication::desktop()->screenGeometry(1));
640
for (int i=0;i<count;i++) {
642
a_width += QApplication::desktop()->screenGeometry(i).width();//QRect QApplication::desktop->screenGeometry(1);根据当前的屏幕序号获取屏幕宽高等属性
644
windowWidth = QApplication::desktop()->width() - a_width;//QApplication::desktop()->width();获取虚拟屏幕全宽,注意这个比较猛,是获取的总宽度,对于横向扩展屏来说,也就是 屏幕1+ 屏幕2 + ... 的宽度
645
windowHeight = QApplication::desktop()->screenGeometry(1).height();
646
qDebug() << windowWidth;//3286 1024 1920 1366
647
qDebug() << windowHeight;//1080 768 1080 768
648
qDebug() << this->width();//900
649
qDebug() << this->height();//600
650
this->move((windowWidth - this->width()) / 2,(windowHeight - this->height()) / 2);*/
651
windowWidth = QApplication::desktop()->screenGeometry(0).width();
652
windowHeight = QApplication::desktop()->screenGeometry(0).height();
653
this->move((windowWidth - this->width()) / 2,(windowHeight - this->height()) / 2);
658
// QTimer::singleShot(100, this, SLOT(startDbusDaemon()));
665
inline bool isRunningInstalled() {
666
static bool installed = (QCoreApplication::applicationDirPath() ==
667
QDir(("/usr/bin")).canonicalPath());
671
inline QString getAppDirectory() {
672
if (isRunningInstalled()) {
673
return QString("/var/lib/youker-assistant-daemon/");
675
return QString(QCoreApplication::applicationDirPath());
679
void MainWindow::startDbusDaemon()
681
sessioninterface = new SessionDispatcher;
682
systeminterface = new SystemDispatcher;
683
QThread *sessionThread = ThreadPool::Instance()->createNewThread();
684
sessioninterface->moveToThread(sessionThread);
685
sessionThread->start();
686
QThread *systemThread = ThreadPool::Instance()->createNewThread();
687
systeminterface->moveToThread(systemThread);
688
connect(systemThread, SIGNAL(started()), systeminterface, SLOT(initData()));
690
// connect(systeminterface, &SystemDispatcher::dbusInitFinished, this, [=] {dlg.close();this->displayMainWindow();
692
connect(systeminterface, SIGNAL(dbusInitFinished()), this, SLOT(displayMainWindow()));//数据获取完毕后,告诉界面去更新数据后显示界面
693
systemThread->start();
696
/*sessioninterface = new SessionDispatcher(this);
697
systeminterface = new SystemDispatcher(this);
698
// this->desktop = sessioninterface->access_current_desktop_qt();
699
// this->osName = systeminterface->get_os_name_qt();
700
// this->machine = sessioninterface->access_current_machine_qt();//x86_64
701
this->battery = sessioninterface->judge_power_is_exists_qt();
702
this->sensor = systeminterface->judge_sensors_exists_qt();
703
login_widget->setSessionDbusProxy(sessioninterface);
704
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin")
705
sessioninterface->check_user_qt();
706
connect(sessioninterface, SIGNAL(ssoSuccessSignal(QString, QString)), login_widget, SLOT(showLoginInfo(QString,QString)));
707
connect(sessioninterface, SIGNAL(ssoLoginLogoutSignal(bool)), login_widget, SLOT(showLoginAndLogoutStatus(bool)));
708
home_action_widget->setSessionDbusProxy(sessioninterface);
709
home_action_widget->setSystemDbusProxy(systeminterface);
710
home_action_widget->enableSanButton();
711
connect(sessioninterface, SIGNAL(isScanning(QString)), home_action_widget, SLOT(getScanResult(QString)));
712
connect(sessioninterface, SIGNAL(finishScanWork(QString)), home_action_widget, SLOT(finishScanResult(QString)));
713
connect(sessioninterface, SIGNAL(tellScanResult(QString,QString)) ,home_action_widget, SLOT(getScanAllResult(QString,QString)));
714
connect(systeminterface, SIGNAL(finishCleanWorkMain(QString)), home_action_widget, SLOT(getCleanResult(QString)));
715
connect(systeminterface, SIGNAL(finishCleanWorkMainError(QString)), home_action_widget, SLOT(finishCleanError(QString)));
716
connect(systeminterface, SIGNAL(quickCleanProcess(QString,QString)), home_action_widget, SLOT(getCleaningMessage(QString,QString)));
717
home_page->setSessionDbusProxy(sessioninterface);
718
home_page->setSystemDbusProxy(systeminterface);
719
this->initOtherPages();*/
722
void MainWindow::initOtherPages()
724
if(cleaner_action_widget == NULL)
725
cleaner_action_widget = new CleanerActionWidget(this);
726
topStack->addWidget(cleaner_action_widget);
727
if(info_action_widget == NULL)
728
info_action_widget = new InfoActionWidget(this);
729
topStack->addWidget(info_action_widget);
730
if(setting_action_widget == NULL)
731
setting_action_widget = new SettingActionWidget();
732
topStack->addWidget(setting_action_widget);
733
if(box_action_widget == NULL)
734
box_action_widget = new BoxActionWidget(this);
735
topStack->addWidget(box_action_widget);
737
if(cleaner_widget == NULL)
738
cleaner_widget = new CleanerWidget();
739
cleaner_widget->setSessionDbusProxy(sessioninterface);
740
cleaner_widget->setSystemDbusProxy(systeminterface);
741
cleaner_widget->setToolKits(toolKits);
742
cleaner_widget->setParentWindow(this);
743
cleaner_widget->initUI(last_skin_path);
744
connect(cleaner_action_widget, SIGNAL(showDetailData()),cleaner_widget, SLOT(displayDetailPage()));
745
connect(cleaner_action_widget, SIGNAL(showMainData()),cleaner_widget, SLOT(displayMainPage()));
746
connect(cleaner_action_widget, SIGNAL(sendCleanSignal()),cleaner_widget, SIGNAL(transCleanSignal()));
747
connect(systeminterface, SIGNAL(sendCleanOverSignal()), cleaner_widget, SLOT(displayMainPage()));
748
connect(systeminterface, SIGNAL(sendCleanOverSignal()), cleaner_action_widget, SLOT(displayOrgPage()));
750
connect(systeminterface, SIGNAL(policykitCleanSignal(bool)), cleaner_action_widget, SLOT(receivePolicyKitSignal(bool)));
751
connect(systeminterface, SIGNAL(sendCleanOverSignal()), cleaner_action_widget, SLOT(showCleanOverStatus()));
752
connect(systeminterface, SIGNAL(tellCleanerMainData(QStringList)), cleaner_action_widget, SLOT(showCleanerData(QStringList)));
753
connect(systeminterface, SIGNAL(tellCleanerMainStatus(QString, QString)), cleaner_action_widget, SLOT(showCleanerStatus(QString, QString)));
754
connect(systeminterface, SIGNAL(sendCleanErrorSignal(QString)), cleaner_action_widget, SLOT(showCleanerError(QString)));
755
connect(sessioninterface, SIGNAL(tellCleanerDetailStatus(QString)), cleaner_action_widget, SLOT(showCleanReciveStatus(QString)));
756
connect(sessioninterface, SIGNAL(tellCleanerDetailError(QString)), cleaner_action_widget, SLOT(showCleanReciveError(QString)));
759
connect(cleaner_action_widget, SIGNAL(sendScanSignal()),cleaner_widget, SIGNAL(transScanSignal()));
760
connect(cleaner_widget, SIGNAL(tranActionAnimaitonSignal()),cleaner_action_widget, SLOT(displayAnimation()));
761
connect(cleaner_widget, SIGNAL(tranScanOverSignal(bool)),cleaner_action_widget, SLOT(accordScanOverStatusToChange(bool)));
762
bottomStack->addWidget(cleaner_widget);
764
if(info_widget == NULL)
765
info_widget = new InfoWidget(this->arch);
766
info_widget->setSessionDbusProxy(sessioninterface);
767
info_widget->setSystemDbusProxy(systeminterface);
768
info_widget->initUI(this->battery, this->sensor);
769
bottomStack->addWidget(info_widget);
771
if(setting_widget == NULL)
772
setting_widget = new SettingWidget(this->desktop, this->battery);
773
setting_widget->setParentWindow(this);
774
setting_widget->setSessionDbusProxy(sessioninterface);
775
setting_widget->setSystemDbusProxy(systeminterface);
776
setting_widget->initUI(last_skin_path);
777
connect(setting_widget, SIGNAL(changeActionPage(int)), setting_action_widget, SLOT(displayActionSubPage(int)));
778
connect(setting_action_widget, SIGNAL(notifyContentPageToMain()), setting_widget, SLOT(displaySettingHomePage()));
779
bottomStack->addWidget(setting_widget);
781
if(box_widget == NULL)
782
box_widget = new BoxWidget(this, this->arch, this->osName, getAppDirectory());
783
box_widget->setSessionDbusProxy(sessioninterface);
784
connect(box_widget, SIGNAL(sendSubIndex(int)), this, SLOT(displaySubPage(int)));
785
bottomStack->addWidget(box_widget);
788
int MainWindow::getCurrentBackgroundIndex()
791
mSettings->beginGroup("Background");
792
QString cur_skin_path = mSettings->value("Path").toString();
793
if(!cur_skin_path.isEmpty()) {
794
int start_pos = cur_skin_path.lastIndexOf("/") + 1;
795
int end_pos = cur_skin_path.length();
796
index = cur_skin_path.mid(start_pos, end_pos-start_pos).replace(".png", "").toInt();
798
mSettings->endGroup();
803
QString MainWindow::getCurrentBackgroundName()
805
QString cur_skin_path;
806
mSettings->beginGroup("Background");
807
cur_skin_path = mSettings->value("Path").toString();
808
if(!cur_skin_path.isEmpty()) {
809
int start_pos = cur_skin_path.lastIndexOf("/") + 1;
810
int end_pos = cur_skin_path.length();
811
cur_skin_path = cur_skin_path.mid(start_pos, end_pos-start_pos);
813
mSettings->endGroup();
815
return cur_skin_path;
818
QString MainWindow::getCurrentBackgroundAbsName()
820
QString cur_skin_path;
821
mSettings->beginGroup("Background");
822
cur_skin_path = mSettings->value("Path").toString();
823
mSettings->endGroup();
825
return cur_skin_path;
828
void MainWindow::restoreSkin()
830
if (main_skin_pixmap.isDetached())
832
main_skin_pixmap.detach();
834
main_skin_pixmap.load(last_skin_path);
835
QPalette palette_back;
836
palette_back.setBrush(QPalette::Background, main_skin_pixmap);
837
default_action_widget->setPalette(palette_back);
838
other_action_widget->setPalette(palette_back);
842
void MainWindow::changeSkin(QString pciture)
844
if (main_skin_pixmap.isDetached())
846
main_skin_pixmap.detach();
848
last_skin_path = pciture;
849
main_skin_pixmap.load(pciture);
851
palette.setBrush(QPalette::Background, main_skin_pixmap);
852
default_action_widget->setPalette(palette);
853
other_action_widget->setPalette(palette);
855
mSettings->beginGroup("Background");
856
mSettings->setValue("Path", pciture);
857
mSettings->endGroup();
860
if(auto_start != NULL) {
861
auto_start->resetTitleSkin(last_skin_path);
863
// if(camera_manager != NULL) {
864
// camera_manager->resetTitleSkin(last_skin_path);
866
if(setting_widget != NULL) {
867
setting_widget->resetSkin(last_skin_path);
869
if(cleaner_widget != NULL) {
870
cleaner_widget->resetSkin(last_skin_path);
872
if(aboutDlg != NULL) {
873
aboutDlg->resetTitleSkin(last_skin_path);
875
if(upgrade_dialog != NULL) {
876
upgrade_dialog->resetTitleSkin(last_skin_path);
880
void MainWindow::reViewThePointSkin(QString pciture)
882
if (review_skin_pixmap.isDetached())
884
review_skin_pixmap.detach();
886
review_skin_pixmap.load(pciture);
887
QPalette palette_back;
888
palette_back.setBrush(QPalette::Background, review_skin_pixmap);
889
default_action_widget->setPalette(palette_back);
890
other_action_widget->setPalette(palette_back);
893
void MainWindow::reViewTheOrgSkin()
895
if (review_skin_pixmap.isDetached())
897
review_skin_pixmap.detach();
899
review_skin_pixmap.load(last_skin_path);
900
QPalette palette_back;
901
palette_back.setBrush(QPalette::Background, review_skin_pixmap);
902
default_action_widget->setPalette(palette_back);
903
other_action_widget->setPalette(palette_back);
906
void MainWindow::showMainMenu() {
907
if (this->arch == "aarch64" || this->osName == "Kylin" || this->osName == "YHKylin")
909
QPoint p = rect().topRight();
912
main_menu->exec(this->mapToGlobal(p));
916
QPoint p = rect().topLeft();
917
p.setX(p.x() + 107);//104
919
main_menu->exec(this->mapToGlobal(p));
925
// pos.setY(-main_menu->sizeHint().height());
926
// main_menu->exec(title_widget->mapToGlobal(pos));
929
void MainWindow::closeYoukerAssistant() {
931
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");
932
animation->setDuration(500);
933
animation->setStartValue(1);
934
animation->setEndValue(0);
936
connect(animation, SIGNAL(finished()), this, SLOT(close()));
939
void MainWindow::closeEvent(QCloseEvent *)
941
// QApplication::quit();
945
void MainWindow::setCurrentPageIndex(int index)
949
if (this->arch == "aarch64" || this->osName == "Kylin" || this->osName == "YHKylin")
950
login_widget->hide();
951
if (status != HOMEPAGE) {
953
shadow_widget->show();
955
if(title_widget->isVisible())
956
title_widget->hide();
957
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin" && login_widget->isVisible())
959
login_widget->hide();
961
gatherGroup->start();
969
if (this->arch == "aarch64" || this->osName == "Kylin" || this->osName == "YHKylin")
970
login_widget->hide();
971
if (status == HOMEPAGE) {
977
if (status != CLEANPAGE && statusFlag) {
978
shadow_widget->show();
980
if(title_widget->isVisible())
981
title_widget->hide();
982
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin" && login_widget->isVisible()) {
983
login_widget->hide();
985
// topStack->setCurrentIndex(0);
986
// bottomStack->setCurrentIndex(0);
987
topStack->setCurrentWidget(cleaner_action_widget);
988
bottomStack->setCurrentWidget(cleaner_widget);
989
spreadGroup->start();
993
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin" && login_widget->isVisible()) {
994
login_widget->hide();
996
// topStack->setCurrentIndex(0);
997
// bottomStack->setCurrentIndex(0);
998
topStack->setCurrentWidget(cleaner_action_widget);
999
bottomStack->setCurrentWidget(cleaner_widget);
1004
if (this->arch == "aarch64" || this->osName == "Kylin" || this->osName == "YHKylin" )
1005
login_widget->hide();
1006
if (status == HOMEPAGE) {
1012
if (status != INFOPAGE && statusFlag) {
1013
shadow_widget->show();
1014
tool_widget->hide();
1015
if(title_widget->isVisible())
1016
title_widget->hide();
1017
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin" && login_widget->isVisible()) {
1018
login_widget->hide();
1020
// topStack->setCurrentIndex(1);
1021
// bottomStack->setCurrentIndex(1);
1022
topStack->setCurrentWidget(info_action_widget);
1023
bottomStack->setCurrentWidget(info_widget);
1024
spreadGroup->start();
1028
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin" && login_widget->isVisible()) {
1029
login_widget->hide();
1031
// topStack->setCurrentIndex(1);
1032
// bottomStack->setCurrentIndex(1);
1033
topStack->setCurrentWidget(info_action_widget);
1034
bottomStack->setCurrentWidget(info_widget);
1039
if (status == HOMEPAGE)
1043
if (this->arch == "aarch64" || this->osName == "Kylin" || this->osName == "YHKylin" )
1045
login_widget->hide();
1046
if (status != BOXPAGE && statusFlag) {
1047
shadow_widget->show();
1048
tool_widget->hide();
1049
if(title_widget->isVisible())
1050
title_widget->hide();
1051
// topStack->setCurrentIndex(3);
1052
// bottomStack->setCurrentIndex(3);
1053
topStack->setCurrentWidget(box_action_widget);
1054
bottomStack->setCurrentWidget(box_widget);
1055
spreadGroup->start();
1059
// topStack->setCurrentIndex(3);
1060
// bottomStack->setCurrentIndex(3);
1061
topStack->setCurrentWidget(box_action_widget);
1062
bottomStack->setCurrentWidget(box_widget);
1067
if (status != SETTINGPAGE && statusFlag) {
1068
shadow_widget->show();
1069
tool_widget->hide();
1070
if(title_widget->isVisible())
1071
title_widget->hide();
1072
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin" && login_widget->isVisible()) {
1073
login_widget->hide();
1075
// topStack->setCurrentIndex(2);
1076
// bottomStack->setCurrentIndex(2);
1077
topStack->setCurrentWidget(setting_action_widget);
1078
bottomStack->setCurrentWidget(setting_widget);
1079
spreadGroup->start();
1080
status = SETTINGPAGE;
1083
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin" && login_widget->isVisible()) {
1084
login_widget->hide();
1086
// topStack->setCurrentIndex(2);
1087
// bottomStack->setCurrentIndex(2);
1088
topStack->setCurrentWidget(setting_action_widget);
1089
bottomStack->setCurrentWidget(setting_widget);
1095
if (this->arch != "aarch64" && this->osName != "Kylin" && this->osName != "YHKylin")
1097
if (status == HOMEPAGE)
1101
if (status != BOXPAGE && statusFlag) {
1102
shadow_widget->show();
1103
tool_widget->hide();
1104
if(title_widget->isVisible())
1105
title_widget->hide();
1106
if (login_widget->isVisible()) {
1107
login_widget->hide();
1109
// topStack->setCurrentIndex(3);
1110
// bottomStack->setCurrentIndex(3);
1111
topStack->setCurrentWidget(box_action_widget);
1112
bottomStack->setCurrentWidget(box_widget);
1113
spreadGroup->start();
1117
if (login_widget->isHidden()) {
1118
login_widget->show();
1120
// topStack->setCurrentIndex(3);
1121
// bottomStack->setCurrentIndex(3);
1122
topStack->setCurrentWidget(box_action_widget);
1123
bottomStack->setCurrentWidget(box_widget);
1129
void MainWindow::initHomePage()
1131
if(home_action_widget == NULL)
1133
// if(top_grid_layout == NULL )
1134
QGridLayout *home_top_grid_layout = new QGridLayout();
1135
// home_action_widget = new HomeActionWidget(this, mSettings);
1136
home_action_widget = new HomeActionWidget(0, mSettings);
1137
home_top_grid_layout->addWidget(home_action_widget,0,0);
1138
default_action_widget->setLayout(home_top_grid_layout);
1139
home_top_grid_layout->setSpacing(0);
1140
home_top_grid_layout->setContentsMargins(0, 0, 0, 0);
1143
if(home_page == NULL)
1145
// if( bottom_grid_layout == NULL )
1146
QGridLayout *home_bottom_grid_layout = new QGridLayout();
1147
// home_page = new HomePage(0/*, version*/);
1148
home_page = new HomePage(this, this->arch, this->osName/*, version*/);
1149
connect(home_page, SIGNAL(sendSubIndex(int)), this, SLOT(displaySubPage(int)));
1150
home_page->setParentWindow(this);
1151
home_page->initUI();
1152
home_page->initConnect();
1154
home_bottom_grid_layout->addWidget(home_page,0,0);
1155
default_content_widget->setLayout(home_bottom_grid_layout);
1156
home_bottom_grid_layout->setSpacing(0);
1157
home_bottom_grid_layout->setContentsMargins(0, 0, 0, 0);
1161
void MainWindow::openSkinCenter() {
1162
if(skin_center == NULL) {
1163
skin_center = new SkinCenter(0, last_skin_path, this->arch, this->osName);//20161228
1164
skin_center->setParentWindow(this);
1165
skin_center->initSysBackgroundList();
1166
int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (442 / 2);
1167
int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (340 / 2);
1168
skin_center->move(w_x, w_y);
1169
skin_center->show();
1170
skin_center->raise();
1173
int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (442 / 2);
1174
int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (326 / 2);
1175
skin_center->move(w_x, w_y);
1176
skin_center->show();
1177
skin_center->raise();
1181
void MainWindow::openUpgradePage(/*QStringList version_list*/)
1183
int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (334 / 2);
1184
int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (470 / 2);
1185
if(upgrade_dialog == NULL)
1187
// upgrade_dialog = new UpgradeDialog(0, version_list.at(2), last_skin_path);
1188
upgrade_dialog = new UpgradeDialog(0, /*this->version, */last_skin_path, this->arch, this->osName);//20161228
1189
upgrade_dialog->setSystemDbusProxy(systeminterface);
1190
upgrade_dialog->setSessionDbusProxy(sessioninterface);
1191
connect(home_page, SIGNAL(sendOpenUpgrade()), this, SLOT(openUpgradePageAgain()));
1192
connect(upgrade_dialog, SIGNAL(showBackendBtnSignal(bool)), home_page, SLOT(displayBackedBtn(bool)));
1193
connect(upgrade_dialog,SIGNAL(close_signal()), this, SLOT(closeYoukerAssistant()));
1194
connect(systeminterface,SIGNAL(get_fetch_signal(QString, QStringList)),upgrade_dialog,SLOT(receiveFetchSignal(QString, QStringList)));
1195
connect(systeminterface,SIGNAL(get_apt_signal(QString, QStringList)),upgrade_dialog,SLOT(receiveAptSignal(QString, QStringList)));
1196
connect(sessioninterface,SIGNAL(receive_source_list_signal(bool)),upgrade_dialog,SLOT(receiveCheckResultSignal(bool)));
1197
upgrade_dialog->move(w_x, w_y);
1198
upgrade_dialog->show();
1199
upgrade_dialog->raise();
1200
upgrade_dialog->startAccessData();
1203
// upgrade_dialog->resetVersionNumber(version_list);
1204
upgrade_dialog->move(w_x, w_y);
1205
upgrade_dialog->show();
1206
upgrade_dialog->raise();
1207
home_page->hideBackedBtn();
1208
// upgrade_dialog->startAccessData();
1212
void MainWindow::openUpgradePageAgain()
1214
int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (334 / 2);
1215
int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (470 / 2);
1216
upgrade_dialog->move(w_x, w_y);
1217
upgrade_dialog->show();
1218
upgrade_dialog->raise();
1221
void MainWindow::displaySubPage(int index)
1225
if(auto_start == NULL) {
1226
auto_start = new AutoStartWidget(0, sessioninterface, last_skin_path);
1227
connect(sessioninterface, SIGNAL(tellAutoModel(QStringList)), auto_start, SLOT(readyReciveData(QStringList)));
1228
connect(sessioninterface, SIGNAL(showAutoModel()), auto_start, SLOT(readyShowUI()));
1229
auto_start->initData();
1230
int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (560 / 2);
1231
int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (398 / 2);
1232
auto_start->move(w_x, w_y);
1234
auto_start->raise();
1237
int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (560 / 2);
1238
int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (398 / 2);
1239
auto_start->move(w_x, w_y);
1241
auto_start->raise();
1247
//CameraManager *camera_manager = new CameraManager(0, sessioninterface, last_skin_path);
1248
//int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (622 / 2);
1249
//int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (480 / 2);
1250
//camera_manager->move(w_x, w_y);
1251
//camera_manager->exec();
1252
// if(camera_manager == NULL) {
1253
// camera_manager = new CameraManager(0, sessioninterface, last_skin_path);
1254
// int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (622 / 2);
1255
// int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (480 / 2);
1256
// camera_manager->move(w_x, w_y);
1257
// camera_manager->exec();
1260
// int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (622 / 2);
1261
// int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (480 / 2);
1262
// camera_manager->move(w_x, w_y);
1263
// camera_manager->exec();
1268
void MainWindow::newFeatures()
1273
void MainWindow::setupConfigure()
1278
void MainWindow::aboutUs()
1280
int w_x = this->frameGeometry().topLeft().x() + (900 / 2) - (442 / 2);
1281
int w_y = this->frameGeometry().topLeft().y() + (600 /2) - (326 / 2);
1282
if(aboutDlg == NULL)
1284
aboutDlg = new AboutDialog(0, /*version, */last_skin_path, this->arch, this->osName);
1285
aboutDlg->move(w_x, w_y);
1290
aboutDlg->move(w_x, w_y);
1297
void MainWindow::mousePressEvent(QMouseEvent *event)
1299
// if(event->button() == Qt::LeftButton)
1301
// mouse_press = true;
1302
// drag_pos = event->globalPos() - this->frameGeometry().topLeft();
1305
if(event->button() == Qt::LeftButton)
1308
drag_pos = event->globalPos() - pos();
1312
void MainWindow::mouseReleaseEvent(QMouseEvent *)
1314
mouse_press = false;
1315
setWindowOpacity(1);
1318
void MainWindow::mouseMoveEvent(QMouseEvent *event)
1322
QPoint move_pos = event->globalPos();
1323
move(move_pos - drag_pos);
1324
setWindowOpacity(0.9);
1329
//void MainWindow::paintEvent(QPaintEvent *event)
1331
// QPainterPath path;
1332
// path.setFillRule(Qt::WindingFill);
1333
// path.addRect(10, 10, this->width()-20, this->height()-20);
1335
// QPainter painter(this);
1336
// painter.setRenderHint(QPainter::Antialiasing, true);
1337
// painter.fillPath(path, QBrush(Qt::white));
1339
// QColor color(0, 0, 0, 50);
1340
// for(int i=0; i<10; i++)
1342
// QPainterPath path;
1343
// path.setFillRule(Qt::WindingFill);
1344
// path.addRect(10-i, 10-i, this->width()-(10-i)*2, this->height()-(10-i)*2);
1345
// color.setAlpha(150 - qSqrt(i)*50);
1346
// painter.setPen(color);
1347
// painter.drawPath(path);