~feng-kylin/youker-assistant/youker-assistant

« back to all changes in this revision

Viewing changes to src/mainwindow.h

  • Committer: lixiang
  • Date: 2018-03-06 03:13:06 UTC
  • Revision ID: lixiang@kylinos.cn-20180306031306-fd7qnru3vm4a1xjd
Rewrite with Qt5, and add system monitor

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & Kylin Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Kobe Lee    xiangli@ubuntukylin.com/kobe24_lixiang@126.com
 
6
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
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/>.
 
18
 */
 
19
 
 
20
#ifndef MAINWINDOW_H
 
21
#define MAINWINDOW_H
 
22
 
 
23
#include <QMainWindow>
 
24
#include <QWidget>
 
25
#include <QPixmap>
 
26
#include <QSettings>
 
27
#include <QDesktopWidget>
 
28
 
 
29
#include "bottomcontentwidget.h"
 
30
#include "infowidget.h"
 
31
#include "settingwidget.h"
 
32
#include "cleanerwidget.h"
 
33
#include "boxwidget.h"
 
34
#include "../component/kylinmenu.h"
 
35
#include "../component/utils.h"
 
36
#include "../component/toolkits.h"
 
37
#include "aboutdialog.h"
 
38
 
 
39
class DataWorker;
 
40
class SystemDbusProxy;
 
41
class SessionDbusProxy;
 
42
 
 
43
class MainTopWidget;
 
44
class MiddleWidget;
 
45
class MainBottomWidget;
 
46
class TopBaseWidget;
 
47
 
 
48
class MainWindow : public QMainWindow
 
49
{
 
50
    Q_OBJECT
 
51
 
 
52
public:
 
53
    explicit MainWindow(QString cur_arch = "", int d_count = 0, QWidget* parent = 0/*, Qt::WindowFlags flags = 0*/);
 
54
    ~MainWindow();
 
55
    void setTranslator(QTranslator* translator);
 
56
    void initConnect();
 
57
    void reViewThePointSkin(QString pciture);
 
58
    void reViewTheOrgSkin();
 
59
    void changeSkin(QString pciture);
 
60
    void restoreSkin();
 
61
    int getCurrentBackgroundIndex();
 
62
    QString getCurrentBackgroundName();
 
63
    QString getCurrentBackgroundAbsName();
 
64
    QStringList filterSkin();
 
65
    bool deleteFile(QString filename);
 
66
    bool CopyFile(QString filename);
 
67
    QString accessOSName();
 
68
    void createAboutDialog();
 
69
 
 
70
    void initWidgets();
 
71
    void moveCenter();
 
72
 
 
73
protected:
 
74
    void mousePressEvent(QMouseEvent *event);
 
75
    void mouseReleaseEvent(QMouseEvent *event);
 
76
    void mouseMoveEvent(QMouseEvent *event);
 
77
    void closeEvent(QCloseEvent *);
 
78
//    virtual void paintEvent(QPaintEvent *event);
 
79
 
 
80
public slots:
 
81
    void openSkinCenter();
 
82
    void openUpgradePage(/*QStringList version_list*/);
 
83
//    void openUpgradePageAgain();
 
84
    void showMainMenu();
 
85
    void closeYoukerAssistant();
 
86
    void setCurrentPageIndex(int index);
 
87
    void changeLanguage(LANGUAGE language);
 
88
    void newFeatures();
 
89
    void setupConfigure();
 
90
    void aboutUs();
 
91
    void startDbusDaemon();
 
92
    void onInitDataFinished();
 
93
    void onPluginModuleError(const QString &info);
 
94
 
 
95
private:
 
96
    QStackedWidget *m_topStack = nullptr;
 
97
    QStackedWidget *m_bottomStack = nullptr;
 
98
 
 
99
    MainTopWidget *m_mainTopWidget = nullptr;
 
100
    MiddleWidget *m_middleWidget = nullptr;
 
101
    MainBottomWidget *m_mainBottomWidget = nullptr;
 
102
    MainTopWidget *cleaner_action_widget;
 
103
    TopBaseWidget *info_action_widget = nullptr;
 
104
    TopBaseWidget *setting_action_widget = nullptr;
 
105
    TopBaseWidget *box_action_widget = nullptr;
 
106
 
 
107
    InfoWidget *info_widget = nullptr;
 
108
    CleanerWidget *cleaner_widget = nullptr;
 
109
    SettingWidget *setting_widget = nullptr;
 
110
    BoxWidget *box_widget = nullptr;
 
111
    KylinMenu *main_menu = nullptr;
 
112
    QPoint m_dragPosition; //移动的距离
 
113
    bool m_mousePressed; //按下鼠标左键
 
114
    QTranslator* translator = nullptr; //翻译器
 
115
    LANGUAGE current_language; //当前语言
 
116
    QPixmap main_skin_pixmap;
 
117
    QString last_skin_path;
 
118
    QPixmap review_skin_pixmap;
 
119
    Toolkits *toolKits = nullptr;
 
120
    AboutDialog *aboutDlg;
 
121
    QSettings *mSettings;
 
122
    QString desktop;
 
123
    QString osName;
 
124
    QString arch;
 
125
    bool battery;
 
126
    bool sensor;
 
127
    int display_count;
 
128
    QStringList m_cpulist;
 
129
    QString m_currentCpuMode;
 
130
    PAGESTATUS status;
 
131
    DataWorker *m_dataWorker = nullptr;
 
132
    QWidget *centralWidget = nullptr;
 
133
};
 
134
 
 
135
class GlobalData // define by hebing,just for transmit var
 
136
{
 
137
 
 
138
public:
 
139
    static QString globalarch;
 
140
};
 
141
 
 
142
#endif // MAINWINDOW_H