Adjust structure of the plugin

This commit is contained in:
李 翔 2018-01-22 08:39:19 +08:00
parent 5f2b46a90d
commit ad1896858b
35 changed files with 270023 additions and 94 deletions

View File

@ -1,5 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
shredmanager \
systemmonitor \
startupmanager
systemmonitor
# startupmanager

View File

@ -18,7 +18,7 @@
*/
#include "diskitem.h"
#include "myimagebutton.h"
#include "../widgets/myimagebutton.h"
#include <QHBoxLayout>
#include <QMouseEvent>

View File

@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "titlewidget.h"
#include "myimagebutton.h"
#include "mytipimagebutton.h"
#include "monitortitlewidget.h"
#include "../widgets/myimagebutton.h"
#include "../widgets/mytipimagebutton.h"
#include "util.h"
#include <QApplication>
@ -29,7 +29,7 @@
#include <QResizeEvent>
#include <QStyleFactory>
TitleWidget::TitleWidget(QWidget *parent)
MonitorTitleWidget::MonitorTitleWidget(QWidget *parent)
:QFrame(parent)
{
installEventFilter(this);
@ -45,7 +45,7 @@ TitleWidget::TitleWidget(QWidget *parent)
initWidgets();
}
TitleWidget::~TitleWidget()
MonitorTitleWidget::~MonitorTitleWidget()
{
//Segmentation fault
QLayoutItem *child;
@ -63,7 +63,7 @@ TitleWidget::~TitleWidget()
delete m_layout;
}
void TitleWidget::mouseDoubleClickEvent(QMouseEvent *e)
void MonitorTitleWidget::mouseDoubleClickEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
if (window()->isMaximized())
@ -75,7 +75,7 @@ void TitleWidget::mouseDoubleClickEvent(QMouseEvent *e)
QFrame::mouseDoubleClickEvent(e);
}
void TitleWidget::paintEvent(QPaintEvent *e)
void MonitorTitleWidget::paintEvent(QPaintEvent *e)
{
QFrame::paintEvent(e);
@ -92,7 +92,7 @@ void TitleWidget::paintEvent(QPaintEvent *e)
p.drawPath(tPath);
}
void TitleWidget::initLeftContent()
void MonitorTitleWidget::initLeftContent()
{
QWidget *w = new QWidget;
m_lLayout = new QHBoxLayout(w);
@ -100,7 +100,7 @@ void TitleWidget::initLeftContent()
m_lLayout->setSpacing(0);
QLabel *label = new QLabel;
label->setStyleSheet("QLabel{border-image: url(:/../../src/res/kylin-assistant.png);}");
label->setStyleSheet("QLabel{border-image: url(://res/kylin-assistant.png);}");
label->setFixedSize(24, 24);
m_lLayout->addWidget(label);
@ -113,7 +113,7 @@ void TitleWidget::initLeftContent()
m_layout->addWidget(w, 1, Qt::AlignLeft);
}
void TitleWidget::initRightContent()
void MonitorTitleWidget::initRightContent()
{
QWidget *w = new QWidget;
m_rLayout = new QHBoxLayout(w);
@ -141,7 +141,7 @@ void TitleWidget::initRightContent()
maxBtn->setObjectName("UnMaxButton");
}
});
connect(this, &TitleWidget::updateMaxBtn, this, [=]{
connect(this, &MonitorTitleWidget::updateMaxBtn, this, [=]{
if (window()->isMaximized()) {
maxBtn->setObjectName("UnMaxButton");
} else {
@ -159,7 +159,7 @@ void TitleWidget::initRightContent()
m_rLayout->addWidget(closeBtn);
}
void TitleWidget::initWidgets()
void MonitorTitleWidget::initWidgets()
{
m_layout = new QHBoxLayout(this);
m_layout->setContentsMargins(0, 0, 0, 0);

View File

@ -25,12 +25,12 @@
class QHBoxLayout;
class TitleWidget : public QFrame
class MonitorTitleWidget : public QFrame
{
Q_OBJECT
public:
TitleWidget(QWidget *parent);
~TitleWidget();
MonitorTitleWidget(QWidget *parent);
~MonitorTitleWidget();
void initLeftContent();
void initRightContent();
void initWidgets();

View File

@ -18,7 +18,7 @@
*/
#include "processcategory.h"
#include "myimagebutton.h"
#include "../widgets/myimagebutton.h"
ProcessCategory::ProcessCategory(int tabIndex, QWidget *parent)
: QWidget(parent)

View File

@ -20,11 +20,11 @@
#include "processworker.h"
#include "../../component/utils.h"
#include "mydialog.h"
#include "../widgets/mydialog.h"
#include "processlistitem.h"
#include "myactiongroup.h"
#include "myactiongroupitem.h"
#include "myaction.h"
#include "../widgets/myactiongroup.h"
#include "../widgets/myactiongroupitem.h"
#include "../widgets/myaction.h"
#include "processlistwidget.h"
#include <QLabel>

View File

@ -19,7 +19,7 @@
#include "propertiesdialog.h"
#include "processworker.h"
#include "myimagebutton.h"
#include "../widgets/myimagebutton.h"
#include "util.h"
#include <QApplication>
@ -91,11 +91,11 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, pid_t processId) : QDialog(p
nameTitleLabel->setFixedWidth(100);
nameTitleLabel->setAlignment(Qt::AlignRight);
nameLabel = new QLabel();
nameLabel->setStyleSheet("QLabel { background-color : transparent; color : #000000; }");
m_appNameLabel = new QLabel();
m_appNameLabel->setStyleSheet("QLabel { background-color : transparent; color : #000000; }");
nameLayout->addWidget(nameTitleLabel);
nameLayout->addWidget(nameLabel);
nameLayout->addWidget(m_appNameLabel);
nameLayout->addSpacing(20);
cmdlineTitleLabel = new QLabel(QString("%1:").arg(tr("Command line")));
@ -178,7 +178,7 @@ PropertiesDialog::~PropertiesDialog()
delete userTitleLabel;
delete userLabel;
delete nameTitleLabel;
delete nameLabel;
delete m_appNameLabel;
delete titleLabel;
delete cmdlineTitleLabel;
delete cpuDurationLabel;
@ -227,7 +227,7 @@ void PropertiesDialog::initProcproperties()
iconLabel->setPixmap(icon_pixmap);
titleLabel->setText(displayName);
userLabel->setText(username);
nameLabel->setText(QString(info->name));
m_appNameLabel->setText(QString(info->name));
cmdlineLabel->setText(QString(info->arguments));
startTimeLabel->setText(QFileInfo(QString("/proc/%1").arg(pid)).created().toString("yyyy-MM-dd hh:mm:ss"));
cpuDurationLabel->setText(formatDurationForDisplay(100 * info->cpu_time / info->frequency));

View File

@ -69,7 +69,7 @@ private:
QLabel *userLabel;
QLabel *userTitleLabel;
QLabel *iconLabel;
QLabel *nameLabel;
QLabel *m_appNameLabel;
QLabel *nameTitleLabel;
QLabel *cpuDurationLabel;
QLabel *cpuDurationTitleLabel;

File diff suppressed because it is too large Load Diff

View File

@ -205,7 +205,7 @@ void SystemMonitor::initPanelStack()
void SystemMonitor::initTitleWidget()
{
m_titleWidget = new TitleWidget(this);
m_titleWidget = new MonitorTitleWidget(this);
m_titleWidget->resize(width(), TOP_TITLE_WIDGET_HEIGHT);
m_titleWidget->move(0, 0);
}

View File

@ -20,7 +20,7 @@
#ifndef SYSTEMMONITOR_H
#define SYSTEMMONITOR_H
#include "titlewidget.h"
#include "monitortitlewidget.h"
#include "toolbar.h"
#include "processdialog.h"
#include "resourcesdialog.h"
@ -31,8 +31,6 @@
#include <QLabel>
#include <QSettings>
enum PDragState {NOT_PDRAGGING, START_PDRAGGING, PDRAGGING};
class SystemMonitor : public QFrame
{
Q_OBJECT
@ -50,7 +48,6 @@ public:
bool getSortOrder();
int getSortIndex();
void moveCenter();
// void moveDialog(QPoint diff);
public slots:
void recordVisibleColumn(int, bool, QList<bool> columnVisible);
@ -59,7 +56,6 @@ public slots:
protected:
void resizeEvent(QResizeEvent *e) override;
// bool eventFilter(QObject *, QEvent *);
void paintEvent(QPaintEvent *);
void closeEvent(QCloseEvent *event);
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
@ -68,13 +64,11 @@ protected:
private:
QStackedWidget *m_sysMonitorStack = nullptr;
TitleWidget *m_titleWidget = nullptr;
MonitorTitleWidget *m_titleWidget = nullptr;
ToolBar *m_toolBar = nullptr;
ProcessDialog *process_dialog = nullptr;
ResouresDialog *resources_dialog = nullptr;
FileSystemDialog *filesystem_dialog = nullptr;
// PDragState drag_state;
// QPoint start_drag;
QSettings *proSettings;
QPoint dragPosition;

View File

@ -35,17 +35,17 @@ HEADERS += \
processworker.h \
util.h \
../../component/utils.h \
mydialog.h \
myimagebutton.h \
../widgets/mydialog.h \
../widgets/myimagebutton.h \
propertiesdialog.h \
processcategory.h \
processdata.h \
myactiongroup.h \
myactiongroupitem.h \
myaction.h \
titlewidget.h \
../widgets/myactiongroup.h \
../widgets/myactiongroupitem.h \
../widgets/myaction.h \
monitortitlewidget.h \
toolbar.h \
mytipimagebutton.h \
../widgets/mytipimagebutton.h \
resourcesdialog.h \
filesystemdialog.h \
diskitemlist.h \
@ -53,7 +53,7 @@ HEADERS += \
filesystemworker.h \
diskmodel.h \
diskinfo.h \
mysearchedit.h \
../widgets/mysearchedit.h \
networkflow.h \
cpuoccupancyrate.h \
cpuballwidget.h \
@ -67,16 +67,16 @@ SOURCES += \
processlistitem.cpp \
processworker.cpp \
util.cpp \
mydialog.cpp \
myimagebutton.cpp \
../widgets/mydialog.cpp \
../widgets/myimagebutton.cpp \
propertiesdialog.cpp \
processcategory.cpp \
myactiongroup.cpp \
myactiongroupitem.cpp \
myaction.cpp \
titlewidget.cpp \
../widgets/myactiongroup.cpp \
../widgets/myactiongroupitem.cpp \
../widgets/myaction.cpp \
monitortitlewidget.cpp \
toolbar.cpp \
mytipimagebutton.cpp \
../widgets/mytipimagebutton.cpp \
resourcesdialog.cpp \
filesystemdialog.cpp \
diskitemlist.cpp \
@ -84,7 +84,7 @@ SOURCES += \
filesystemworker.cpp \
diskmodel.cpp \
diskinfo.cpp \
mysearchedit.cpp \
../widgets/mysearchedit.cpp \
networkflow.cpp \
cpuoccupancyrate.cpp \
cpuballwidget.cpp \

View File

@ -18,10 +18,10 @@
*/
#include "toolbar.h"
#include "myimagebutton.h"
#include "mytipimagebutton.h"
#include "../widgets/myimagebutton.h"
#include "../widgets/mytipimagebutton.h"
#include "processcategory.h"
#include "mysearchedit.h"
#include "../widgets/mysearchedit.h"
#include "util.h"
#include <QApplication>

View File

@ -59,8 +59,8 @@ AboutDialog::AboutDialog(QWidget *parent, /*const QString &version, */QString sk
iconLabel = new QLabel(baseWidget);
//iconLabel->setGeometry(QRect(380, 20, 44, 44));
iconLabel->setGeometry(QRect(360, 36, 44, 44));//20161228
nameLabel = new QLabel(baseWidget);
nameLabel->setGeometry(QRect(71, 0, 300, 30));
m_appNameLabel = new QLabel(baseWidget);
m_appNameLabel->setGeometry(QRect(71, 0, 300, 30));
// linkLabel = new QLabel();
// iconLabel->setStyleSheet("QLabel{background-image:url(':/res/kylin-assistant.png')}");
@ -68,19 +68,19 @@ AboutDialog::AboutDialog(QWidget *parent, /*const QString &version, */QString sk
image = image.scaled(QSize(44, 44), Qt::KeepAspectRatio, Qt::SmoothTransformation);
iconLabel->setPixmap(QPixmap::fromImage(image));
nameLabel->setStyleSheet("QLabel{color:#ffffff;font-family: 方正黑体_GBK;font-size: 12px;text-align: center;font-weight:bold;}");
nameLabel->setAlignment(Qt::AlignCenter);
m_appNameLabel->setStyleSheet("QLabel{color:#ffffff;font-family: 方正黑体_GBK;font-size: 12px;text-align: center;font-weight:bold;}");
m_appNameLabel->setAlignment(Qt::AlignCenter);
// if (arch == "aarch64" || os == "Kylin" || os == "YHKylin") {//20161228
// close_btn->move(442-36, 0);
// nameLabel->setText(tr("Kylin Assisant") + " " + VERSION);
// m_appNameLabel->setText(tr("Kylin Assisant") + " " + VERSION);
// }
// else {
// close_btn->move(0, 0);
// nameLabel->setText(tr("Youker Assisant") + " " + VERSION);
// m_appNameLabel->setText(tr("Youker Assisant") + " " + VERSION);
// }
close_btn->move(442-36, 0);
nameLabel->setText(tr("Kylin Assistant") + " " + qApp->applicationVersion());
m_appNameLabel->setText(tr("Kylin Assistant") + " " + qApp->applicationVersion());
// linkLabel->setAlignment(Qt::AlignRight);
// linkLabel->setText(QString::fromLocal8Bit("<a style='color: green;' href = https://launchpad.net/youker-assistant> home page</a>"));

View File

@ -65,7 +65,7 @@ private:
QTextBrowser *aboutEdit;
QTextEdit *contributorEdit;
QLabel *iconLabel;
QLabel *nameLabel;
QLabel *m_appNameLabel;
QPushButton *okBtn;
// QLabel *versionLabel;
// QLabel *linkLabel;

View File

@ -129,13 +129,13 @@ HomePage::~HomePage()
delete box_tip;
box_tip = NULL;
}
for(int i=0; i<item_list.count(); i++)
{
ToolButton *btn = item_list.at(i);
delete btn;
btn = NULL;
}
item_list.clear();
// for(int i=0; i<item_list.count(); i++)
// {
// ToolButton *btn = item_list.at(i);
// delete btn;
// btn = NULL;
// }
// item_list.clear();
}
void HomePage::initUI()
@ -176,7 +176,7 @@ void HomePage::initUI()
QStringList icon_list;
/*QStringList icon_list;
// icon_list<<"://res/ubuntukylin-software-center"<<"://res/boot"<<"://res/camera";
icon_list<<"://res/boot" << "://res/more.png";
QStringList text_list;
@ -194,10 +194,9 @@ void HomePage::initUI()
signal_mapper->setMapping(tool_button, QString::number(i, 10));
button_layout->addWidget(tool_button);
item_list.append(tool_button);
}
connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(switchPageIndex(QString)));
*/
// more_btn->setFocusPolicy(Qt::NoFocus);
// QPixmap pixmap("://res/more.png");
@ -224,7 +223,7 @@ void HomePage::initUI()
layout5->addWidget(box_logo);
layout5->addLayout(layout4);
layout5->addStretch();
layout5->addLayout(button_layout);
// layout5->addLayout(button_layout);
layout5->setMargin(0);
layout5->setSpacing(5);
layout5->setContentsMargins(0,0,0,0);

View File

@ -82,7 +82,7 @@ private:
QString current_version;
QString osname;
QString osarch;
QList<ToolButton *> item_list;
// QList<ToolButton *> item_list;
};
#endif // HOMEPAGE_H

View File

@ -139,7 +139,7 @@ MainWindow::MainWindow(QString cur_arch, int d_count, QWidget* parent, Qt::Windo
box_widget = NULL;
aboutDlg = NULL;
auto_start = NULL;
// auto_start = NULL;
upgrade_dialog = NULL;
// camera_manager = NULL;
@ -300,11 +300,11 @@ MainWindow::~MainWindow()
mSettings = NULL;
}
if(auto_start != NULL)
{
delete auto_start;
auto_start = NULL;
}
// if(auto_start != NULL)
// {
// delete auto_start;
// auto_start = NULL;
// }
// if(camera_manager != NULL)
// {
// delete camera_manager;
@ -1180,9 +1180,9 @@ void MainWindow::changeSkin(QString pciture)
mSettings->endGroup();
mSettings->sync();
if(auto_start != NULL) {
auto_start->resetTitleSkin(last_skin_path);
}
// if(auto_start != NULL) {
// auto_start->resetTitleSkin(last_skin_path);
// }
// if(camera_manager != NULL) {
// camera_manager->resetTitleSkin(last_skin_path);
// }

View File

@ -163,7 +163,7 @@ private:
QParallelAnimationGroup *gatherGroup;
PAGESTATUS status;
bool statusFlag;
AutoStartWidget *auto_start;
// AutoStartWidget *auto_start;
// CameraManager *camera_manager;
UpgradeDialog *upgrade_dialog;
// QStringList skinlist;

View File

@ -54,11 +54,11 @@ UpgradeDialog::UpgradeDialog(QWidget *parent, /*const QString &version, */QStrin
close_btn->move(0, 0);
}
nameLabel = new QLabel(baseWidget);
nameLabel->setGeometry(QRect(37, 0, 260, 30));
nameLabel->setStyleSheet("QLabel{color:#ffffff;font-family: 方正黑体_GBK;font-size: 12px;text-align: center;font-weight:bold;}");
nameLabel->setAlignment(Qt::AlignCenter);
nameLabel->setText(tr("check and update"));
m_appNameLabel = new QLabel(baseWidget);
m_appNameLabel->setGeometry(QRect(37, 0, 260, 30));
m_appNameLabel->setStyleSheet("QLabel{color:#ffffff;font-family: 方正黑体_GBK;font-size: 12px;text-align: center;font-weight:bold;}");
m_appNameLabel->setAlignment(Qt::AlignCenter);
m_appNameLabel->setText(tr("check and update"));
// msg_label = new QLabel(baseWidget);
// msg_label->setGeometry(QRect(10, 40, 324, 20));

View File

@ -80,7 +80,7 @@ private:
QLabel *ok_icon_label;
LoadingLabel *work_loading_label;
LoadingLabel *upgrade_loading_label;
QLabel *nameLabel;
QLabel *m_appNameLabel;
QLabel *doing_label;
QLabel *error_label;
QLabel *tip_label;