make showMinimized() normal

This commit is contained in:
balloonflower 2018-02-08 22:34:18 +08:00
parent 2602e0bdf9
commit d230c24648
15 changed files with 51 additions and 169 deletions

2
debian/control vendored
View File

@ -15,6 +15,7 @@ Build-Depends: debhelper (>= 9),
qtbase5-dev (>= 5.1),
libqt5svg5-dev,
qt5-qmake,
qt5-default,
qtscript5-dev,
qttools5-dev-tools,
pkg-config,
@ -34,6 +35,7 @@ Depends: python3-dbus,
python3-apt (>= 0.7.100.3~),
python3-pil,
python3-piston-mini-client,
inotify-hookable,
hdparm,
lm-sensors,
ethtool,

View File

@ -41,7 +41,8 @@
ShredDialog::ShredDialog(QWidget *parent) :
QWidget(parent)
{
setWindowFlags(Qt::FramelessWindowHint);
// setWindowFlags(Qt::FramelessWindowHint);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}");
this->setWindowIcon(QIcon(":/res/kylin-assistant.png"));
this->setFixedSize(500, 471);

View File

@ -62,7 +62,7 @@ StartupWidget::StartupWidget(QWidget *parent)
qRegisterMetaType<StartupDataPtrList>();
qRegisterMetaType<QList<StartupData>>();
this->setWindowFlags(Qt::FramelessWindowHint);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
this->setAutoFillBackground(true);
this->setMouseTracking(true);
// this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);//去掉边框

View File

@ -37,6 +37,7 @@ MonitorTitleWidget::MonitorTitleWidget(QSettings *settings, QWidget *parent)
,proSettings(settings)
{
this->setWindowFlags(Qt::FramelessWindowHint);//this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);
// this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
installEventFilter(this);
setMouseTracking(true);

View File

@ -39,7 +39,9 @@ const int spacing = 8;
PropertiesDialog::PropertiesDialog(QWidget *parent, pid_t processId) : QDialog(parent)
, mousePressed(false)
{
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint| Qt::WindowStaysOnTopHint);
// this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint/* | Qt::WindowCloseButtonHint*/| Qt::WindowStaysOnTopHint);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
this->setAttribute(Qt::WA_TranslucentBackground);
this->setAttribute(Qt::WA_Resized, false);
// this->setMaximumSize(480, 600);

View File

@ -39,7 +39,9 @@ SystemMonitor::SystemMonitor(QWidget *parent)
// this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);//去掉边框
// this->setAttribute(Qt::WA_TranslucentBackground);//背景透明
this->setWindowFlags(Qt::FramelessWindowHint);
// this->setWindowFlags(Qt::FramelessWindowHint);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
this->setAutoFillBackground(true);
this->setMouseTracking(true);
// installEventFilter(this);

View File

@ -16,7 +16,9 @@ MyDialog::MyDialog(const QString &title, const QString &message, QWidget *parent
QDialog(parent)
, mousePressed(false)
{
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);
// this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint/* | Qt::WindowCloseButtonHint*/);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
this->setAttribute(Qt::WA_TranslucentBackground);
// this->setAttribute(Qt::WA_DeleteOnClose, false);
this->setAttribute(Qt::WA_Resized, false);

View File

@ -18,12 +18,13 @@
*/
#include "mainbottomwidget.h"
#include <QSignalMapper>
#include <QDebug>
#include "mainwindow.h"
#include "../component/toolbutton.h"
#include "../component/utils.h"
#include <QApplication>
#include <QSignalMapper>
#include <QDebug>
MainBottomWidget::MainBottomWidget(QWidget *parent, QString arch, QString os/*, const QString &version*/) :
QWidget(parent), osarch(arch), osname(os)
{
@ -95,7 +96,7 @@ MainBottomWidget::MainBottomWidget(QWidget *parent, QString arch, QString os/*,
box_logo->setPixmap(QPixmap("://res/box.png"));
this->initUI();
this->initConnect();
this->setLanguage();
}
@ -174,52 +175,6 @@ void MainBottomWidget::initUI()
layout4->setSpacing(5);
layout4->setContentsMargins(0,0,0,0);
/*QStringList icon_list;
// icon_list<<"://res/ubuntukylin-software-center"<<"://res/boot"<<"://res/camera";
icon_list<<"://res/boot" << "://res/more.png";
QStringList text_list;
// text_list<< tr("Youker Softeware Center") << tr("Boot Manager") << tr("Camera");
text_list << tr("Boot Manager") << tr("More");
QHBoxLayout *button_layout = new QHBoxLayout();
QSignalMapper *signal_mapper = new QSignalMapper(this);
for(int i=0; i<icon_list.size(); i++)
{
ToolButton *tool_button = new ToolButton;
tool_button->setFocusPolicy(Qt::NoFocus);
tool_button->setIcon(icon_list.at(i));
tool_button->setText(text_list.at(i));
connect(tool_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
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");
// more_btn->setIcon(pixmap);
// more_btn->setIconSize(pixmap.size());
// QVBoxLayout *more_layout = new QVBoxLayout();
//// more_layout->addStretch();
// more_layout->addWidget(more_btn);
// more_layout->addWidget(more_text_btn);
//// more_layout->addStretch();
// more_layout->setSpacing(0);
// more_layout->setMargin(0);
// more_layout->setContentsMargins(0, 8, 0, 0);
// button_layout->addStretch();
// button_layout->addLayout(more_layout);
//// button_layout->addWidget(more_btn, 0, Qt::AlignTop);
// button_layout->setSpacing(20);
// button_layout->setMargin(0);
// button_layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *layout5 = new QHBoxLayout();
layout5->addWidget(box_logo);
layout5->addLayout(layout4);
@ -229,8 +184,6 @@ void MainBottomWidget::initUI()
layout5->setSpacing(5);
layout5->setContentsMargins(0,0,0,0);
QVBoxLayout *main_layout = new QVBoxLayout();
main_layout->addLayout(layout3);
main_layout->addLayout(layout5);
@ -243,14 +196,7 @@ void MainBottomWidget::initUI()
void MainBottomWidget::initConnect()
{
connect(this, SIGNAL(moreSignal()), p_mainwindow, SIGNAL(chanegBoxToolStatus()));
// connect(more_btn, SIGNAL(clicked()), p_mainwindow, SLOT(showBoxWidget()));
// connect(more_btn, SIGNAL(clicked()), p_mainwindow, SIGNAL(chanegBoxToolStatus()));
// connect(more_text_btn, SIGNAL(clicked()), p_mainwindow, SLOT(showBoxWidget()));
// connect(more_text_btn, SIGNAL(clicked()), p_mainwindow, SIGNAL(chanegBoxToolStatus()));
// connect(check_btn, SIGNAL(clicked()), this, SLOT(checkLastestVersion()));
connect(check_btn, SIGNAL(clicked()), this, SLOT(onCheckBtnClicked()));
connect(this, SIGNAL(sendSignal()), p_mainwindow, SIGNAL(chanegBoxToolStatus()));
connect(box_title, SIGNAL(clicked()), this, SIGNAL(sendSignal()));
}
@ -290,59 +236,7 @@ void MainBottomWidget::hideBackedBtn()
check_btn->hide();
}
//void HomePage::checkLastestVersion()
//{
// QStringList version_list = sessionProxy->checkNewVersion();
// if(version_list.length() == 1) {
// version_label->setText(version_list.at(0));
// }
// if(version_list.length() == 4) {
// version_label->setText(version_list.at(2));
// if(version_list.at(3) == "1") {
// qDebug() << "Neet to UPdate......";
// p_mainwindow->openUpgradePage(version_list);
//// systemProxy->update_myself();
// }
// else {
// qDebug() << "Unneccesary to UPdate......";
// p_mainwindow->openUpgradePage(version_list);
// }
// }
// else {
// version_label->setText("");
// }
//}
void MainBottomWidget::switchPageIndex(QString index)
{
}
//bool HomePage::eventFilter(QObject *obj, QEvent *event)
//{
// if(obj == box_title){
// if(event->type() == QEvent::MouseButtonRelease){
// emit this->sendSignal();
//// p_mainwindow->showBoxWidget();
// }
//// if(event->type() == QEvent::Enter){
//// ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn_hover.png"));
//// }else if(event->type() == QEvent::Leave){
//// ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
//// }else if(event->type() == QEvent::MouseButtonPress){
//// ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn_hover.png"));
//// }else if(event->type() == QEvent::MouseButtonRelease){
//// QMouseEvent *me = (QMouseEvent *)event;
//// QLabel *lb = (QLabel *)obj;
//// if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
//// this->close();
//// this->destroy();
//// }else{
//// ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
//// }
//// } else {
//// return QObject::eventFilter(obj, event);
//// }
// }
// return QObject::eventFilter(obj, event);
//}

View File

@ -26,7 +26,6 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
class MainWindow;
class ToolButton;
class MainBottomWidget : public QWidget
@ -38,15 +37,10 @@ public:
void setLanguage();
void initBoxTool();
void initConnect();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void initUI();
//protected:
// bool eventFilter(QObject *obj, QEvent *event);
public slots:
void switchPageIndex(QString index);
// void checkLastestVersion();
void displayBackedBtn(bool flag);
void onCheckBtnClicked();
void hideBackedBtn();
@ -54,7 +48,6 @@ public slots:
signals:
void sendSubIndex(int index);
void sendSignal();
void moreSignal();
void sendOpenUpgrade();
private:
@ -66,7 +59,6 @@ private:
QLabel *box_logo;
QPushButton *box_title;
QLabel *box_tip;
MainWindow *p_mainwindow;
QString current_version;
QString osname;
QString osarch;

View File

@ -40,7 +40,10 @@ MainTopWidget::MainTopWidget(bool isMain, QSettings *mSettings, QWidget *parent)
: QWidget(parent)
, pSettings(mSettings)
, m_isMain(isMain)
// , p_mainwindow(parent)
{
// p_mainwindow = static_cast<MainWindow *>(parent);
if (m_isMain)
this->setFixedSize(900, 227);
else
@ -195,8 +198,10 @@ void MainTopWidget::initTitlebarRightContent()
// //openSkinCenter()
// }
// });
connect(min_button, &SystemButton::clicked, this, [=] {
connect(min_button, &SystemButton::clicked, [=] (const bool b) {
emit this->showMin();
// if (p_mainwindow)
// p_mainwindow->showMinimized();
// if (parentWidget()) {
// parentWidget()->showMinimized();
// }
@ -205,12 +210,6 @@ void MainTopWidget::initTitlebarRightContent()
emit this->closeApp();
// window()->close();
});
// connect(min_button, SIGNAL(clicked()), p_mainwindow, SLOT(showMinimized()));
// connect(close_button, SIGNAL(clicked()), this, SIGNAL(closeApp()));
// connect(skin_button, SIGNAL(clicked()), p_mainwindow, SLOT(openSkinCenter()));
// connect(main_menu_button, SIGNAL(clicked()), p_mainwindow, SLOT(showMainMenu()));
}
void MainTopWidget::initContentLeftContent()
@ -252,15 +251,19 @@ void MainTopWidget::initContentLeftContent()
QVBoxLayout *layout1 = new QVBoxLayout();
layout1->addStretch();
layout1->addWidget(suggest_label);
if (scan_result_label)
layout1->addWidget(scan_result_label);
layout1->addWidget(doing_label);
if (result_label)
layout1->addWidget(result_label);
if (m_isMain) {
layout1->addWidget(suggest_label, 0, Qt::AlignVCenter);
layout1->addWidget(scan_result_label, 0, Qt::AlignVCenter);
layout1->addWidget(doing_label, 0, Qt::AlignVCenter);
layout1->addWidget(result_label, 0, Qt::AlignVCenter);
}
else {
layout1->addWidget(suggest_label, 0, Qt::AlignVCenter);
layout1->addWidget(doing_label, 0, Qt::AlignVCenter);
}
layout1->addStretch();
layout1->setSpacing(15);
layout1->setContentsMargins(0, 20, 0, 0);
layout1->setContentsMargins(0, 0, 0, 0);
m_toolLeftLayout->addStretch();
m_toolLeftLayout->addWidget(loading_label, 0, Qt::AlignHCenter);
@ -275,7 +278,7 @@ void MainTopWidget::initActionRightContent()
{
QWidget *w = new QWidget;
m_toolRightLayout = new QHBoxLayout(w);
m_toolRightLayout->setContentsMargins(0, 3, 6, 10);
m_toolRightLayout->setContentsMargins(0, 3, 30, 10);
m_toolRightLayout->setSpacing(5);
scan_button = new QPushButton(this);

View File

@ -33,8 +33,6 @@
#include "../component/loadinglabel.h"
class MainWindow;
//class SessionDispatcher;
//class SystemDispatcher;
class MainTopWidget : public QWidget
{
@ -43,8 +41,6 @@ public:
explicit MainTopWidget(bool isMain = false, QSettings *mSettings = 0, QWidget *parent = 0);
~MainTopWidget();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
// void setSessionDbusProxy(SessionDispatcher* dispatcher) { sessionProxy = dispatcher;}
// void setSystemDbusProxy(SystemDispatcher* dispatcher) { systemProxy = dispatcher;}
void initConnect();
void setLanguage();
void writeFixCleanDate();
@ -54,9 +50,6 @@ public:
QString getSafeScanDate();
QString getOneKeyFlag();
// void enableSanButton();
void initTitlebarLeftContent();
void initTitlebarRightContent();
void initContentLeftContent();
@ -112,9 +105,6 @@ private:
QPushButton *clean_button = nullptr;
QPushButton *back_button = nullptr;
MainWindow *p_mainwindow;
// SystemDispatcher *systemProxy;
// SessionDispatcher *sessionProxy;
QString trace;
QString cookies;
QString garbage;
@ -123,7 +113,6 @@ private:
QString workFlag;
QString scanFinishTime;
QVBoxLayout *m_layout = nullptr;
QHBoxLayout *m_topLayout = nullptr;
QHBoxLayout *m_titleRightLayout = nullptr;
@ -132,6 +121,8 @@ private:
QHBoxLayout *m_toolLeftLayout = nullptr;
QHBoxLayout *m_toolRightLayout = nullptr;
MainWindow *p_mainwindow = nullptr;
bool m_isMain;
};

View File

@ -69,7 +69,8 @@ MainWindow::MainWindow(QString cur_arch, int d_count, QWidget* parent/*, Qt::Win
if(this->desktop.isEmpty())
this->desktop = qgetenv("XDG_SESSION_DESKTOP");
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid
// this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);
this->setAttribute(Qt::WA_TranslucentBackground);
this->setAutoFillBackground(true);
this->setMouseTracking(true);
@ -178,8 +179,12 @@ void MainWindow::initWidgets()
//top
m_mainTopWidget = new MainTopWidget(true, mSettings, this);
// m_mainTopWidget->setParentWindow(this);
connect(m_mainTopWidget, SIGNAL(showMenu()), this, SLOT(showMainMenu()));
connect(m_mainTopWidget, SIGNAL(showMin()), this, SLOT(showMinimized()));
// connect(m_mainTopWidget, SIGNAL(showMin()), this, SLOT(showMinimized()));
connect(m_mainTopWidget, &MainTopWidget::showMin, this, [=] {
this->showMinimized();
});
connect(m_mainTopWidget, SIGNAL(closeApp()), this, SLOT(closeYoukerAssistant()));
m_mainTopWidget->setPalette(palette_back);
m_topStack->addWidget(m_mainTopWidget);
@ -221,12 +226,11 @@ void MainWindow::initWidgets()
//middle
m_middleWidget = new MiddleWidget(this, this->arch, this->osName);
m_middleWidget->setFixedSize(MAIN_WINDOW_WIDTH, 47);
m_middleWidget->setParentWindow(this);
connect(m_middleWidget, SIGNAL(turnCurrentPage(int)), this, SLOT(setCurrentPageIndex(int)));
m_middleWidget->initConnect();
//bottom
m_mainBottomWidget = new MainBottomWidget(this, this->arch, this->osName);
connect(m_mainBottomWidget, SIGNAL(sendSignal()), m_middleWidget, SLOT(showBoxTool()));
m_bottomStack->addWidget(m_mainBottomWidget);
cleaner_widget = new CleanerWidget();

View File

@ -91,9 +91,6 @@ public slots:
void startDbusDaemon();
void onInitDataFinished();
signals:
void chanegBoxToolStatus();
private:
QStackedWidget *m_topStack = nullptr;
QStackedWidget *m_bottomStack = nullptr;

View File

@ -55,7 +55,7 @@ MiddleWidget::MiddleWidget(QWidget *parent, QString arch, QString os)
signal_mapper->setMapping(tool_button, QString::number(i, 10));
button_layout->addWidget(tool_button, 0, Qt::AlignBottom);
}
this->switchSelectedPageIndex(0);
this->switchSelectedPageIndex("0");
connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(switchSelectedPageIndex(QString)));
button_layout->addStretch();
@ -78,11 +78,6 @@ MiddleWidget::~MiddleWidget()
button_list.clear();
}
void MiddleWidget::initConnect()
{
// connect(this, SIGNAL(turnCurrentPage(int)), p_mainwindow, SLOT(setCurrentPageIndex(int)));
}
void MiddleWidget::switchSelectedPageIndex(QString index)
{
bool ok;
@ -105,10 +100,11 @@ void MiddleWidget::switchSelectedPageIndex(QString index)
void MiddleWidget::showBoxTool()
{
qDebug() << "showBoxTool.................";
// if(this->cur_arch == "aarch64" || this->osname == "Kylin" || this->osname == "YHKylin") {
// this->switchSelectedPageIndex("3");
// }
// else {
// this->switchSelectedPageIndex("4");
this->switchSelectedPageIndex("4");
// }
}

View File

@ -30,16 +30,12 @@
#include "../component/kylinbutton.h"
#include "../component/kylintoolbutton.h"
class MainWindow;
class MiddleWidget : public QWidget
{
Q_OBJECT
public:
explicit MiddleWidget(QWidget *parent = 0, QString arch = "", QString os = "");
~MiddleWidget();
void setParentWindow(MainWindow* window) { p_mainwindow = window;}
void initConnect();
signals:
void turnCurrentPage(int index);
@ -52,7 +48,6 @@ private:
QPoint press_point;//鼠标按下去的点
bool is_move;
QList<KylinToolButton *> button_list;
MainWindow *p_mainwindow;
QString cur_arch;
QString osname;
};