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 "titlewidget.h"
21
#include "mainwindow.h"
23
TitleWidget::TitleWidget(QWidget *parent, QString arch, QString os)
26
this->setFixedSize(900, 36);
27
min_button = new SystemButton();
28
close_button = new SystemButton();
29
skin_button = new SystemButton();
30
main_menu_button = new SystemButton();
31
min_button->loadPixmap(":/sys/res/sysBtn/min_button.png");
32
close_button->loadPixmap(":/sys/res/sysBtn/close_button.png");
33
skin_button->loadPixmap(":/sys/res/sysBtn/skin_button.png");
34
main_menu_button->loadPixmap(":/sys/res/sysBtn/main_menu.png");
35
min_button->setFocusPolicy(Qt::NoFocus);
36
close_button->setFocusPolicy(Qt::NoFocus);
37
skin_button->setFocusPolicy(Qt::NoFocus);
38
main_menu_button->setFocusPolicy(Qt::NoFocus);
40
QHBoxLayout *title_layout = new QHBoxLayout();
41
// if(arch == "aarch64" || os == "Kylin" || os == "YHKylin")
43
title_layout->addWidget(main_menu_button, 0, Qt::AlignTop);
44
title_layout->addWidget(skin_button, 0, Qt::AlignTop);
45
title_layout->addWidget(min_button, 0, Qt::AlignTop);
46
title_layout->addWidget(close_button, 0, Qt::AlignTop);
50
// title_layout->addWidget(close_button, 0, Qt::AlignTop);
51
// title_layout->addWidget(min_button, 0, Qt::AlignTop);
52
// title_layout->addWidget(skin_button, 0, Qt::AlignTop);
53
// title_layout->addWidget(main_menu_button, 0, Qt::AlignTop);
56
title_layout->addStretch();
57
title_layout->setSpacing(0);
58
title_layout->setContentsMargins(0, 0, 5, 0);
60
QVBoxLayout *main_layout = new QVBoxLayout();
61
main_layout->addLayout(title_layout);
62
main_layout->setSpacing(0);
63
main_layout->setContentsMargins(0, 0, 0, 0);
65
setLayout(main_layout);
70
TitleWidget::~TitleWidget()
72
if(min_button != NULL)
77
if(close_button != NULL)
82
if(skin_button != NULL)
87
if(main_menu_button != NULL)
89
delete main_menu_button;
90
main_menu_button = NULL;
94
void TitleWidget::initConnect() {
95
connect(min_button, SIGNAL(clicked()), p_mainwindow, SLOT(showMinimized()));
96
connect(close_button, SIGNAL(clicked()), this, SIGNAL(closeApp()));
97
connect(skin_button, SIGNAL(clicked()), p_mainwindow, SLOT(openSkinCenter()));
98
connect(main_menu_button, SIGNAL(clicked()), p_mainwindow, SLOT(showMainMenu()));
101
/*void TitleWidget::paintEvent(QPaintEvent *event)
103
QPainter painter(this);
105
painter.setRenderHint(QPainter::Antialiasing, true);
106
painter.setOpacity(0.05);
109
QPainterPath framePath;
110
framePath.addRoundedRect(QRect(rect().x() + penWidth, rect().y() + penWidth, rect().width() - penWidth * 2, rect().height() - penWidth * 2), 4, 4);//背景弧度
111
painter.setClipPath(framePath);
114
framePen.setColor(QColor("#F5F5F5"));
115
painter.setOpacity(0.2);
116
painter.drawPath(framePath);