!38 add grub and plymouth UI
Merge pull request !38 from likehomedream/my-devel
This commit is contained in:
commit
8d0f3f7bac
|
@ -30,6 +30,8 @@ SOURCES += \
|
|||
src/module/cursorthemewidget.cpp \
|
||||
src/module/globalthemefeature.cpp \
|
||||
src/module/globalthemewidget.cpp \
|
||||
src/module/grubthemefeature.cpp \
|
||||
src/module/grubthemewidget.cpp \
|
||||
src/module/historywidget.cpp \
|
||||
src/module/iconthemewidget.cpp \
|
||||
src/module/iconwidgetfeature.cpp \
|
||||
|
@ -38,6 +40,8 @@ SOURCES += \
|
|||
src/main.cpp \
|
||||
src/maininterface.cpp \
|
||||
src/mainwindow.cpp \
|
||||
src/module/plymouththemefeature.cpp \
|
||||
src/module/plymouththemewidget.cpp \
|
||||
src/titlebar.cpp
|
||||
|
||||
HEADERS += \
|
||||
|
@ -55,6 +59,8 @@ HEADERS += \
|
|||
src/module/cursorthemewidget.h \
|
||||
src/module/globalthemefeature.h \
|
||||
src/module/globalthemewidget.h \
|
||||
src/module/grubthemefeature.h \
|
||||
src/module/grubthemewidget.h \
|
||||
src/module/historywidget.h \
|
||||
src/module/iconthemewidget.h \
|
||||
src/module/iconwidgetfeature.h \
|
||||
|
@ -62,6 +68,8 @@ HEADERS += \
|
|||
src/module/infocreatewidget.h \
|
||||
src/maininterface.h \
|
||||
src/mainwindow.h \
|
||||
src/module/plymouththemefeature.h \
|
||||
src/module/plymouththemewidget.h \
|
||||
src/titlebar.h
|
||||
|
||||
# Default rules for deployment.
|
||||
|
|
|
@ -130,5 +130,8 @@
|
|||
<file>resource/debian/rules</file>
|
||||
<file>resource/debian/copyright</file>
|
||||
<file>resource/debian/source/format</file>
|
||||
<file>resource/background/homepage-boot.png</file>
|
||||
<file>resource/background/openKylin.svg</file>
|
||||
<file>resource/background/grub-listview.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
|
@ -0,0 +1,94 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 5000 1300" style="enable-background:new 0 0 5000 1300;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:url(#SVGID_1_);}
|
||||
.st1{fill:url(#SVGID_2_);}
|
||||
.st2{fill:url(#SVGID_3_);}
|
||||
.st3{fill:url(#SVGID_4_);}
|
||||
.st4{fill:url(#SVGID_5_);}
|
||||
.st5{fill:url(#SVGID_6_);}
|
||||
.st6{fill:url(#SVGID_7_);}
|
||||
.st7{fill:url(#SVGID_8_);}
|
||||
.st8{fill:url(#SVGID_9_);}
|
||||
.st9{fill:url(#SVGID_10_);}
|
||||
</style>
|
||||
<g id="渐变_1_">
|
||||
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="998.5" y1="8278.7363" x2="998.5" y2="8890.126" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<path class="st0" d="M991,489H779.3v0.1c-2-0.1-4-0.1-6.1-0.1l0,0v560.9h147.2v-95.3H991c128.6,0,232.8-104.2,232.8-232.8
|
||||
S1119.6,489,991,489z M991,807.5h-70.7V636.2H991c47.3,0,85.7,38.3,85.7,85.7C1076.7,769.1,1038.3,807.5,991,807.5L991,807.5z"/>
|
||||
|
||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="410" y1="8278.7363" x2="410" y2="8890.1357" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<path class="st1" d="M410,493.9c-128,0-235.9,86.6-268.1,204.4c-6.6,24-9.9,48.7-9.9,73.6c0,153.5,124.5,278,278,278
|
||||
s278-124.5,278-278c0-24.9-3.3-49.6-9.9-73.6C645.9,580.5,538.1,493.9,410,493.9z M410,902.8c-72.1,0-130.9-58.7-130.9-130.8
|
||||
S337.8,641.2,410,641.2S540.9,699.9,540.9,772S482.2,902.8,410,902.8L410,902.8z"/>
|
||||
|
||||
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="1587.1151" y1="8278.7363" x2="1587.1151" y2="8890.1357" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<path class="st2" d="M1855.1,698.5v-0.1c-33-119.2-143.8-206.4-272.7-204.4c-126,2-231.7,87.9-263.5,204.3
|
||||
c-6.8,24.8-10.1,50.5-9.8,76.2c1.4,149.8,123,272.7,272.8,275.4c118.1,2.2,219.8-69.4,262.2-171.8h-180.5c-0.4,0.3-0.8,0.6-1.2,0.9
|
||||
c-20.9,14.8-45.7,23-71.3,23.7c-1.3,0-2.6,0-3.9,0.1h-2.3c-0.3,0-0.6,0-1,0c-42.1-1.2-81-22.5-104.7-57.2h376.1
|
||||
c7-25.7,10.3-52.2,9.8-78.8C1864.5,743.7,1861.2,720.7,1855.1,698.5z M1478.9,698.4c40.6-59.7,121.8-75.3,181.6-34.7
|
||||
c13.7,9.3,25.4,21,34.7,34.7H1478.9z"/>
|
||||
|
||||
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="2175.4001" y1="8278.7363" x2="2175.4001" y2="8890.126" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<path class="st3" d="M2175.4,518.2c-48.7,0-96.1,15.8-135,45.1c-25.8-20.1-57.5-30.9-90.2-30.9l0,0v517.6h147.1V743.6
|
||||
c-0.5-43.1,34.1-78.5,77.2-79c43.1-0.5,78.5,34.1,79,77.2c0,0.6,0,1.2,0,1.8v306.5h147.1V743.6
|
||||
C2400.7,619.2,2299.6,518.2,2175.4,518.2z"/>
|
||||
|
||||
<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="2826.95" y1="8868.4893" x2="2826.95" y2="8068.4893" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#ED5F00"/>
|
||||
<stop offset="1" style="stop-color:#FFC52B"/>
|
||||
</linearGradient>
|
||||
<polygon class="st4" points="3168.1,249.9 2897.1,249.9 2695.7,496.5 2695.7,496 2695.7,249.9 2485.8,249.9 2485.8,496 2485.8,496
|
||||
2485.8,753.3 2485.8,1049.9 2514.4,1049.9 2695.7,1049.9 2695.7,828.1 2695.7,828.1 2743,770.2 2897.1,1049.9 3168.1,1049.9
|
||||
2889.5,590.9 "/>
|
||||
|
||||
<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="3915.55" y1="8278.7363" x2="3915.55" y2="8890.1357" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<polygon class="st5" points="3878.2,489 3731.1,489 3731.1,902.8 3731.1,1049.9 3878.2,1049.9 4025.4,1049.9 4100,1049.9
|
||||
4100,902.8 3878.2,902.8 "/>
|
||||
|
||||
<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="4642.75" y1="8278.7363" x2="4642.75" y2="8890.126" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<path class="st6" d="M4642.7,518.2c-48.7-0.1-96.1,15.8-135,45.1c-25.8-20.1-57.5-30.9-90.2-30.9v517.6h147.1V743.6
|
||||
c-0.5-43.1,34.1-78.5,77.2-79s78.5,34.1,79,77.2c0,0.6,0,1.2,0,1.8v306.5H4868V743.6C4868,619.2,4766.9,518.2,4642.7,518.2z"/>
|
||||
|
||||
<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="3418.2502" y1="8278.7363" x2="3418.2502" y2="8890.1357" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<path class="st7" d="M3498.8,673.5c-0.1,44.5-36.2,80.5-80.7,80.5c-36.9-0.1-69.1-25.2-78-60.9c-1.6-11.3-2.4-22.6-2.4-34v-170
|
||||
h-147.2v184.5c0,99.8,64.6,184.9,154.2,215.5V1050h147.1V889.1l0,0c89.6-30.7,154.2-115.7,154.2-215.5V489.1h-147.1v184.4H3498.8z"
|
||||
/>
|
||||
|
||||
<linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="4258.6504" y1="8278.7363" x2="4258.6504" y2="8890.1357" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<rect x="4185.1" y="489" class="st8" width="147.1" height="99.1"/>
|
||||
|
||||
<linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="4258.6504" y1="8278.7363" x2="4258.6504" y2="8890.126" gradientTransform="matrix(1 0 0 1 0 -7818.5396)">
|
||||
<stop offset="0" style="stop-color:#3DA4FF"/>
|
||||
<stop offset="1" style="stop-color:#134BD6"/>
|
||||
</linearGradient>
|
||||
<rect x="4185.1" y="627.1" class="st9" width="147.1" height="422.9"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.8 KiB |
|
@ -60,6 +60,8 @@ void MainInterface::init()
|
|||
m_globalthemewidget = new GlobalThemeWidget(m_themestackedwidget);
|
||||
m_iconthemewidget = new IconThemeWidget(m_ishistory,m_themestackedwidget);
|
||||
m_cursorthemewidget = new CursorThemeWidget(m_themestackedwidget);
|
||||
m_plymouththemewidget = new PlymouthThemeWidget(m_themestackedwidget);
|
||||
m_grubthemewidget = new GrubThemeWidget(m_themestackedwidget);
|
||||
|
||||
connect(m_globalthemewidget,&GlobalThemeWidget::wallpaperupdate,this, &MainInterface::wallpaperupdate);
|
||||
connect(this, &MainInterface::wallpaperupdate, m_cursorthemewidget, &CursorThemeWidget::wallpaperupdate);
|
||||
|
@ -68,6 +70,9 @@ void MainInterface::init()
|
|||
m_themestackedwidget->addWidget(m_globalthemewidget);
|
||||
m_themestackedwidget->addWidget(m_iconthemewidget);
|
||||
m_themestackedwidget->addWidget(m_cursorthemewidget);
|
||||
m_themestackedwidget->addWidget(m_plymouththemewidget);
|
||||
m_themestackedwidget->addWidget(m_grubthemewidget);
|
||||
|
||||
m_themestackedwidget->setCurrentIndex(0);
|
||||
|
||||
m_layout = new QHBoxLayout();
|
||||
|
@ -85,6 +90,13 @@ void MainInterface::init()
|
|||
connect(m_cursorbtn,&TypeButton::clicked,m_themestackedwidget,[=](){
|
||||
m_themestackedwidget->setCurrentIndex(2);
|
||||
});
|
||||
connect(m_plymouthbtn,&TypeButton::clicked,m_themestackedwidget,[=](){
|
||||
m_themestackedwidget->setCurrentIndex(3);
|
||||
});
|
||||
connect(m_grubbtn,&TypeButton::clicked,m_themestackedwidget,[=](){
|
||||
m_themestackedwidget->setCurrentIndex(4);
|
||||
m_grubbtn->setChecked(true);
|
||||
});
|
||||
InfoCreateWidget *info = new InfoCreateWidget(nullptr,nullptr,"create");
|
||||
connect(m_buildbtn,&QPushButton::clicked,info,[=](){
|
||||
FileProcess getInfo;
|
||||
|
@ -107,23 +119,33 @@ void MainInterface::initLeftBar()
|
|||
|
||||
QButtonGroup *buttonGroup = new QButtonGroup(m_navigationwidget);
|
||||
buttonGroup->setExclusive(true);
|
||||
QButtonGroup *bootbuttonGroup = new QButtonGroup(m_navigationwidget);
|
||||
|
||||
m_globalbtn = new TypeButton(m_navigationwidget);
|
||||
m_iconbtn = new TypeButton(m_navigationwidget);
|
||||
m_cursorbtn = new TypeButton(m_navigationwidget);
|
||||
m_plymouthbtn = new TypeButton(m_navigationwidget);
|
||||
m_grubbtn = new TypeButton(m_navigationwidget);
|
||||
|
||||
m_buildbtn = new QPushButton(m_navigationwidget);
|
||||
|
||||
buttonGroup->addButton(m_globalbtn);
|
||||
buttonGroup->addButton(m_iconbtn);
|
||||
buttonGroup->addButton(m_cursorbtn);
|
||||
bootbuttonGroup->addButton(m_plymouthbtn);
|
||||
bootbuttonGroup->addButton(m_grubbtn);
|
||||
|
||||
m_globalbtn->setCheckable(true);
|
||||
m_iconbtn->setCheckable(true);
|
||||
m_cursorbtn->setCheckable(true);
|
||||
m_plymouthbtn->setCheckable(true);
|
||||
m_grubbtn->setCheckable(true);
|
||||
|
||||
leftLayout->addWidget(m_globalbtn);
|
||||
leftLayout->addWidget(m_iconbtn);
|
||||
leftLayout->addWidget(m_cursorbtn);
|
||||
leftLayout->addWidget(m_plymouthbtn);
|
||||
leftLayout->addWidget(m_grubbtn);
|
||||
leftLayout->addStretch();
|
||||
leftLayout->addWidget(m_buildbtn);
|
||||
}
|
||||
|
@ -146,6 +168,18 @@ void MainInterface::setCursorTheme()
|
|||
m_cursorbtn->setChecked(true);
|
||||
}
|
||||
|
||||
void MainInterface::setPlymouthTheme()
|
||||
{
|
||||
m_themestackedwidget->setCurrentIndex(3);
|
||||
m_plymouthbtn->setChecked(true);
|
||||
}
|
||||
|
||||
void MainInterface::setGrubTheme()
|
||||
{
|
||||
m_themestackedwidget->setCurrentIndex(4);
|
||||
m_grubbtn->setChecked(true);
|
||||
}
|
||||
|
||||
void MainInterface::getThemeInfo(const HistoryInfo &InfoData)
|
||||
{
|
||||
if (InfoData.themetype == "globalTheme"){
|
||||
|
@ -166,3 +200,21 @@ QMap<QString, QString>* MainInterface::getAppIconsMap()
|
|||
return m_iconthemewidget->getAppIconsMap();
|
||||
}
|
||||
|
||||
void MainInterface::updateButtonGroup(bool isGlobalTheme)
|
||||
{
|
||||
if(isGlobalTheme){
|
||||
m_plymouthbtn->setVisible(false);
|
||||
m_grubbtn->setVisible(false);
|
||||
m_globalbtn->setVisible(true);
|
||||
m_iconbtn->setVisible(true);
|
||||
m_cursorbtn->setVisible(true);
|
||||
}else{
|
||||
m_globalbtn->setVisible(false);
|
||||
m_iconbtn->setVisible(false);
|
||||
m_cursorbtn->setVisible(false);
|
||||
m_plymouthbtn->setVisible(true);
|
||||
m_grubbtn->setVisible(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#include "./module/globalthemewidget.h"
|
||||
#include "./module/cursorthemewidget.h"
|
||||
#include "./module/infocreatewidget.h"
|
||||
#include "./module/plymouththemewidget.h"
|
||||
#include "./module/grubthemewidget.h"
|
||||
|
||||
#include "titlebar.h"
|
||||
#include "./module/cacheconfirmedwidget.h"
|
||||
#include "./module/historywidget.h"
|
||||
|
@ -32,9 +35,13 @@ public:
|
|||
void setIconTheme();
|
||||
void setGlobalTheme();
|
||||
void setCursorTheme();
|
||||
void setPlymouthTheme();
|
||||
void setGrubTheme();
|
||||
|
||||
void getThemeInfo(const HistoryInfo &InfoData);
|
||||
void updateButtonGroup(bool isGlobalTheme);
|
||||
QMap<QString, QString>* getAppIconsMap();
|
||||
|
||||
signals:
|
||||
void wallpaperupdate(const QString& filePath);
|
||||
void wallpaperPathChanged(QString path);
|
||||
|
@ -58,7 +65,8 @@ private:
|
|||
IconThemeWidget *m_iconthemewidget;
|
||||
GlobalThemeWidget *m_globalthemewidget;
|
||||
CursorThemeWidget *m_cursorthemewidget;
|
||||
|
||||
PlymouthThemeWidget *m_plymouththemewidget;
|
||||
GrubThemeWidget *m_grubthemewidget;
|
||||
QStackedWidget *m_themestackedwidget;
|
||||
|
||||
QHBoxLayout *m_layout;
|
||||
|
@ -67,6 +75,8 @@ private:
|
|||
TypeButton *m_globalbtn;
|
||||
TypeButton *m_iconbtn;
|
||||
TypeButton *m_cursorbtn;
|
||||
TypeButton *m_plymouthbtn;
|
||||
TypeButton *m_grubbtn;
|
||||
QPushButton *m_buildbtn;
|
||||
QWidget *m_belowwidget;
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ void MainWindow::initUI()
|
|||
m_globalbtn = new EntryButton();
|
||||
m_iconbtn = new EntryButton();
|
||||
m_cursorbtn = new EntryButton();
|
||||
m_bootbtn = new EntryButton();
|
||||
|
||||
QVBoxLayout* alllayout = new QVBoxLayout;
|
||||
|
||||
|
@ -61,7 +62,7 @@ void MainWindow::initUI()
|
|||
layout->addWidget(m_globalbtn);
|
||||
layout->addWidget(m_iconbtn);
|
||||
layout->addWidget(m_cursorbtn);
|
||||
|
||||
layout->addWidget(m_bootbtn);
|
||||
|
||||
m_guideWidget = new QWidget();
|
||||
|
||||
|
@ -106,7 +107,8 @@ void MainWindow::initUI()
|
|||
m_iconbtn->setEntry(icon1,"图标主题");
|
||||
QIcon icon2 = QIcon(QPixmap(":/resource/background/homepage-cursor.png"));
|
||||
m_cursorbtn->setEntry(icon2,"光标主题");
|
||||
|
||||
QIcon icon3 = QIcon(QPixmap(":/resource/background/homepage-boot.png"));
|
||||
m_bootbtn->setEntry(icon3,"启动个性化");
|
||||
m_entrywidget->setLayout(alllayout);
|
||||
|
||||
QScrollArea* scrollArea = new QScrollArea;
|
||||
|
@ -126,6 +128,7 @@ void MainWindow::initUI()
|
|||
buttonGroup->addButton(m_globalbtn);
|
||||
buttonGroup->addButton(m_iconbtn);
|
||||
buttonGroup->addButton(m_cursorbtn);
|
||||
buttonGroup->addButton(m_bootbtn);
|
||||
|
||||
connect(m_historywidget,&HistoryWidget::startSecondEdit,[=](HistoryInfo InfoData){
|
||||
m_maininterface->isHistory(true);
|
||||
|
@ -143,6 +146,7 @@ void MainWindow::initUI()
|
|||
m_maininterface->setGlobalTheme();
|
||||
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("globalTheme"), "recognise");
|
||||
m_infoCreateWidget->show();
|
||||
m_maininterface->updateButtonGroup(true);
|
||||
m_bridge->createFileManager(false,FileProcess::g_date);
|
||||
} else if (button == m_iconbtn) {
|
||||
m_maininterface->setIconTheme();
|
||||
|
@ -150,11 +154,19 @@ void MainWindow::initUI()
|
|||
m_infoCreateWidget->show();
|
||||
m_bridge->createFileManager(false,FileProcess::g_date);
|
||||
m_bridge->updateIconCache(m_maininterface->getAppIconsMap(),"appicon");
|
||||
m_maininterface->updateButtonGroup(true);
|
||||
} else if (button == m_cursorbtn) {
|
||||
m_maininterface->setCursorTheme();
|
||||
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("cursorTheme"), "recognise");
|
||||
m_infoCreateWidget->show();
|
||||
m_bridge->createFileManager(false,FileProcess::g_date);
|
||||
m_maininterface->updateButtonGroup(true);
|
||||
}else if (button == m_bootbtn) {
|
||||
m_maininterface->setPlymouthTheme();
|
||||
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("bootTheme"), "recognise");
|
||||
m_infoCreateWidget->show();
|
||||
m_bridge->createFileManager(false,FileProcess::g_date);
|
||||
m_maininterface->updateButtonGroup(false);
|
||||
}
|
||||
if (m_historywidget == nullptr) {
|
||||
m_historywidget = new HistoryWidget();
|
||||
|
|
|
@ -72,6 +72,7 @@ private:
|
|||
EntryButton *m_globalbtn;
|
||||
EntryButton *m_iconbtn;
|
||||
EntryButton *m_cursorbtn;
|
||||
EntryButton *m_bootbtn;
|
||||
MainInterface *m_maininterface;
|
||||
InfoCreateWidget *m_mainPageState;
|
||||
Bridge *m_bridge;
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
#include "grubthemefeature.h"
|
||||
#include <QGraphicsBlurEffect>
|
||||
GrubThemeFeature::GrubThemeFeature(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GrubGraphicsView::GrubGraphicsView(QGraphicsScene *scene)
|
||||
{
|
||||
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
setRenderHint(QPainter::Antialiasing, true);
|
||||
setOptimizationFlags(QGraphicsView::DontAdjustForAntialiasing |
|
||||
QGraphicsView::DontSavePainterState);
|
||||
this->setStyleSheet("background-color: transparent;");
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
}
|
||||
|
||||
void GrubGraphicsView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier) {
|
||||
qreal scaleFactor = std::pow(qreal(2), event->delta() / 240.0);
|
||||
qreal currentScale = transform().m11(); // 获取当前的缩放倍数
|
||||
// // 限制最大为1.1倍
|
||||
// qreal targetScale = currentScale * scaleFactor;
|
||||
// if (targetScale > 1.1) {
|
||||
// scaleFactor = 1.1 / currentScale;
|
||||
// }else if (targetScale < 0.3) {
|
||||
// scaleFactor = 0.3 / currentScale;
|
||||
// }
|
||||
|
||||
scale(scaleFactor, scaleFactor);
|
||||
} else {
|
||||
QGraphicsView::wheelEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
GrubImageWidget::GrubImageWidget(QWidget *parent)
|
||||
{
|
||||
QGraphicsScene* scene = new QGraphicsScene(this);
|
||||
GrubGraphicsView* graphicsView = new GrubGraphicsView(scene);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->addWidget(graphicsView);
|
||||
setLayout(layout);
|
||||
|
||||
graphicsView->setScene(scene);
|
||||
// 加载并显示背景图片
|
||||
QPixmap pixmap(":/resource/background/1-warty-final-ubuntukylin.jpg");
|
||||
QGraphicsPixmapItem* backgroundItem = new QGraphicsPixmapItem(pixmap);
|
||||
scene->addItem(backgroundItem);
|
||||
|
||||
// 创建毛玻璃特效并应用于背景图元
|
||||
QGraphicsBlurEffect* blurEffect = new QGraphicsBlurEffect;
|
||||
blurEffect->setBlurRadius(10);
|
||||
backgroundItem->setGraphicsEffect(blurEffect);
|
||||
|
||||
// 设置图元居中显示
|
||||
QRectF viewRect = graphicsView->viewport()->rect();
|
||||
QPointF center(viewRect.center());
|
||||
backgroundItem->setPos(center.x() - pixmap.width() / 2, center.y() - pixmap.height() / 2);
|
||||
|
||||
// 添加新的图元
|
||||
QPixmap overlayPixmap(":/resource/background/grub-listview.png");
|
||||
QGraphicsPixmapItem* overlayItem = new QGraphicsPixmapItem(overlayPixmap);
|
||||
scene->addItem(overlayItem);
|
||||
// 放大图元
|
||||
qreal scaleRatio = 2.0; // 放大倍数
|
||||
overlayItem->setScale(scaleRatio);
|
||||
// 计算新的图元位置
|
||||
qreal scaledWidth = overlayPixmap.width() * scaleRatio; // 放大后的宽度
|
||||
qreal scaledHeight = overlayPixmap.height() * scaleRatio; // 放大后的高度
|
||||
overlayItem->setPos(center.x() - scaledWidth / 2, center.y() - scaledHeight / 2);
|
||||
|
||||
graphicsView->fitInView(scene->sceneRect(), Qt::KeepAspectRatio);
|
||||
graphicsView->show();
|
||||
|
||||
// 设置初始缩放倍数为0.9倍
|
||||
qreal initialScale = 0.4;
|
||||
graphicsView->scale(initialScale, initialScale);
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef GRUBTHEMEFEATURE_H
|
||||
#define GRUBTHEMEFEATURE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QGraphicsView>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWheelEvent>
|
||||
#include <QPainter>
|
||||
#include <QtMath>
|
||||
|
||||
class GrubGraphicsView : public QGraphicsView {
|
||||
public:
|
||||
explicit GrubGraphicsView(QGraphicsScene* scene);
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
// void drawBackground(QPainter *painter, const QRectF &rect) override;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class GrubImageWidget : public QWidget {
|
||||
public:
|
||||
GrubImageWidget(QWidget *parent = nullptr);
|
||||
private:
|
||||
GrubGraphicsView* graphicsView;
|
||||
|
||||
QGraphicsScene* m_scene;
|
||||
QPixmap m_mergedImage;
|
||||
QPixmap m_image;
|
||||
|
||||
QGraphicsProxyWidget* m_proxy;
|
||||
};
|
||||
|
||||
class GrubThemeFeature : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GrubThemeFeature(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // GRUBTHEMEFEATURE_H
|
|
@ -0,0 +1,75 @@
|
|||
#include "grubthemewidget.h"
|
||||
|
||||
GrubThemeWidget::GrubThemeWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
initPreviewWidget();
|
||||
initRightWidget();
|
||||
QHBoxLayout *globalthemelayout = new QHBoxLayout();
|
||||
globalthemelayout->addWidget(m_previewwidget);
|
||||
globalthemelayout->addWidget(m_rightwidget);
|
||||
this->setLayout(globalthemelayout);
|
||||
}
|
||||
|
||||
void GrubThemeWidget::initPreviewWidget()
|
||||
{
|
||||
m_previewwidget = new QWidget(this);
|
||||
m_previewwidget->setMinimumSize(495,620);
|
||||
|
||||
m_previewwidget->setBackgroundRole(QPalette::Window);
|
||||
|
||||
m_preview = new GrubImageWidget(m_previewwidget);
|
||||
|
||||
m_previewlayout = new QVBoxLayout(m_previewwidget);
|
||||
addspaceritem();
|
||||
m_previewwidget->setLayout(m_previewlayout);
|
||||
}
|
||||
|
||||
void GrubThemeWidget::initRightWidget()
|
||||
{
|
||||
m_rightwidget = new QWidget(this);
|
||||
m_rightwidget->setMinimumSize(400,620);
|
||||
m_rightwidget->setMaximumWidth(400);
|
||||
m_rightwidget->setBackgroundRole(QPalette::Base);
|
||||
initEditWidget();
|
||||
}
|
||||
|
||||
void GrubThemeWidget::initEditWidget()
|
||||
{
|
||||
m_grubwidget = new QWidget(m_rightwidget);
|
||||
m_grubwidget->setFixedHeight(150);
|
||||
m_grubwidget->setFixedHeight(183);
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
|
||||
QLabel *tipLabel = new QLabel("Grub背景");
|
||||
QWidget *grubWidget = new QWidget();
|
||||
QHBoxLayout *widgetLayout = new QHBoxLayout();
|
||||
|
||||
QPushButton *showBtn = new QPushButton();
|
||||
showBtn->setFixedSize(160,100);
|
||||
|
||||
QLabel *tipLabel1 = new QLabel();
|
||||
tipLabel1->setText("<html>尺寸:3840*2160<br>大小:不超过 10 MB<br>格式:PNG</html>");
|
||||
|
||||
widgetLayout->addWidget(showBtn);
|
||||
widgetLayout->addWidget(tipLabel1);
|
||||
grubWidget->setLayout(widgetLayout);
|
||||
|
||||
layout->addWidget(tipLabel);
|
||||
layout->addWidget(grubWidget);
|
||||
m_grubwidget->setLayout(layout);
|
||||
}
|
||||
|
||||
void GrubThemeWidget::addspaceritem()
|
||||
{
|
||||
QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
QSpacerItem *spacer2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
spacer->changeSize(m_previewwidget->width(), 155, QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
spacer2->changeSize(m_previewwidget->width(), 159, QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
m_previewlayout->addItem(spacer);
|
||||
m_previewlayout->addWidget(m_preview);
|
||||
m_previewlayout->addItem(spacer2);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef GRUBTHEMEWIDGET_H
|
||||
#define GRUBTHEMEWIDGET_H
|
||||
|
||||
#include "grubthemefeature.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QScrollArea>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
|
||||
class GrubThemeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GrubThemeWidget(QWidget *parent = nullptr);
|
||||
void initPreviewWidget();
|
||||
void initRightWidget();
|
||||
void addspaceritem();
|
||||
void initEditWidget();
|
||||
signals:
|
||||
private:
|
||||
QWidget *m_previewwidget;
|
||||
GrubImageWidget *m_preview;
|
||||
QWidget *m_rightwidget;
|
||||
QWidget *m_grubwidget;
|
||||
QVBoxLayout *m_previewlayout;
|
||||
};
|
||||
|
||||
#endif // GRUBTHEMEWIDGET_H
|
|
@ -0,0 +1,66 @@
|
|||
#include "plymouththemefeature.h"
|
||||
|
||||
PlymouthThemeFeature::PlymouthThemeFeature(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PlymouthImageWidget::PlymouthImageWidget(QWidget *parent)
|
||||
{
|
||||
QGraphicsScene* scene = new QGraphicsScene(this);
|
||||
PlymouthGraphicsView* graphicsView = new PlymouthGraphicsView(scene);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->addWidget(graphicsView);
|
||||
setLayout(layout);
|
||||
|
||||
graphicsView->setScene(scene);
|
||||
// 加载并显示图片
|
||||
QPixmap pixmap(":/resource/background/openKylin.svg");
|
||||
QGraphicsPixmapItem* pixmapItem = new QGraphicsPixmapItem(pixmap);
|
||||
scene->addItem(pixmapItem);
|
||||
|
||||
graphicsView->fitInView(scene->sceneRect(), Qt::KeepAspectRatio);
|
||||
graphicsView->show();
|
||||
|
||||
// 设置初始缩放倍数为0.9倍
|
||||
qreal initialScale = 0.4;
|
||||
graphicsView->scale(initialScale, initialScale);
|
||||
}
|
||||
|
||||
PlymouthGraphicsView::PlymouthGraphicsView(QGraphicsScene *scene)
|
||||
{
|
||||
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
setRenderHint(QPainter::Antialiasing, true);
|
||||
setOptimizationFlags(QGraphicsView::DontAdjustForAntialiasing |
|
||||
QGraphicsView::DontSavePainterState);
|
||||
this->setStyleSheet("background-color: transparent;");
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
}
|
||||
|
||||
void PlymouthGraphicsView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier) {
|
||||
qreal scaleFactor = std::pow(qreal(2), event->delta() / 240.0);
|
||||
qreal currentScale = transform().m11(); // 获取当前的缩放倍数
|
||||
// // 限制最大为1.1倍
|
||||
// qreal targetScale = currentScale * scaleFactor;
|
||||
// if (targetScale > 1.1) {
|
||||
// scaleFactor = 1.1 / currentScale;
|
||||
// }else if (targetScale < 0.3) {
|
||||
// scaleFactor = 0.3 / currentScale;
|
||||
// }
|
||||
|
||||
scale(scaleFactor, scaleFactor);
|
||||
} else {
|
||||
QGraphicsView::wheelEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void PlymouthGraphicsView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
{
|
||||
// 绘制全黑背景
|
||||
painter->fillRect(rect, Qt::black);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef PLYMOUTHTHEMEFEATURE_H
|
||||
#define PLYMOUTHTHEMEFEATURE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QGraphicsView>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWheelEvent>
|
||||
#include <QPainter>
|
||||
#include <QtMath>
|
||||
class PlymouthGraphicsView : public QGraphicsView {
|
||||
public:
|
||||
explicit PlymouthGraphicsView(QGraphicsScene* scene);
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
void drawBackground(QPainter *painter, const QRectF &rect) override;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class PlymouthImageWidget : public QWidget {
|
||||
public:
|
||||
PlymouthImageWidget(QWidget *parent = nullptr);
|
||||
private:
|
||||
PlymouthGraphicsView* graphicsView;
|
||||
QString m_coverFilePath;
|
||||
|
||||
QGraphicsScene* m_scene;
|
||||
QPixmap m_mergedImage;
|
||||
QPixmap m_image;
|
||||
QGraphicsProxyWidget* m_proxy;
|
||||
};
|
||||
|
||||
class PlymouthThemeFeature : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PlymouthThemeFeature(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // PLYMOUTHTHEMEFEATURE_H
|
|
@ -0,0 +1,94 @@
|
|||
#include "plymouththemewidget.h"
|
||||
#include "iconwidgetfeature.h"
|
||||
|
||||
PlymouthThemeWidget::PlymouthThemeWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
initPreviewWidget();
|
||||
initRightWidget();
|
||||
QHBoxLayout *globalthemelayout = new QHBoxLayout();
|
||||
globalthemelayout->addWidget(m_previewwidget);
|
||||
globalthemelayout->addWidget(m_rightwidget);
|
||||
this->setLayout(globalthemelayout);
|
||||
}
|
||||
|
||||
void PlymouthThemeWidget::initPreviewWidget()
|
||||
{
|
||||
m_previewwidget = new QWidget(this);
|
||||
m_previewwidget->setMinimumSize(495,620);
|
||||
|
||||
m_previewwidget->setBackgroundRole(QPalette::Window);
|
||||
|
||||
m_preview = new PlymouthImageWidget(m_previewwidget);
|
||||
|
||||
m_previewlayout = new QVBoxLayout(m_previewwidget);
|
||||
addspaceritem();
|
||||
m_previewwidget->setLayout(m_previewlayout);
|
||||
}
|
||||
|
||||
void PlymouthThemeWidget::initRightWidget()
|
||||
{
|
||||
m_rightwidget = new QWidget(this);
|
||||
m_rightwidget->setMinimumSize(400,620);
|
||||
m_rightwidget->setMaximumWidth(400);
|
||||
m_rightwidget->setBackgroundRole(QPalette::Base);
|
||||
initEditWidget();
|
||||
}
|
||||
|
||||
void PlymouthThemeWidget::initEditWidget()
|
||||
{
|
||||
m_plymouthwidget = new QWidget(m_rightwidget);
|
||||
m_plymouthwidget->setFixedHeight(150);
|
||||
QVBoxLayout *widgetLayout = new QVBoxLayout(m_plymouthwidget);
|
||||
QWidget *checkBoxWidget = new QWidget();
|
||||
QHBoxLayout *checkBoxLayout = new QHBoxLayout(checkBoxWidget);
|
||||
QCheckBox *pic = new QCheckBox();
|
||||
QLabel *pixLabel = new QLabel("图片");
|
||||
QCheckBox *video = new QCheckBox();
|
||||
QLabel *videoLabel = new QLabel("视频");
|
||||
checkBoxLayout->addWidget(pic);
|
||||
checkBoxLayout->addWidget(pixLabel);
|
||||
checkBoxLayout->addWidget(video);
|
||||
checkBoxLayout->addWidget(videoLabel);
|
||||
checkBoxLayout->addStretch(1);
|
||||
QWidget *showWidget = new QWidget();
|
||||
QHBoxLayout *showLayout = new QHBoxLayout(showWidget);
|
||||
|
||||
QLabel *defaultLabel = new QLabel();
|
||||
defaultLabel->setFixedSize(64,64);
|
||||
QPixmap pixmap(":/resource/background/openKylin.svg");
|
||||
pixmap = pixmap.scaled(64,64, Qt::KeepAspectRatio);
|
||||
defaultLabel->setPixmap(pixmap);
|
||||
CustomLabel *customLabel= new CustomLabel();
|
||||
customLabel->setFixedSize(64,64);
|
||||
QPushButton *addButton = new QPushButton();
|
||||
addButton->setIcon(QIcon::fromTheme("list-add-symbolic"));
|
||||
addButton->setFixedSize(36,36);
|
||||
|
||||
QLabel *tipLabel = new QLabel();
|
||||
tipLabel->setText("<html>大小不超过10MB<br>格式:MP4</html>");
|
||||
|
||||
showLayout->addWidget(defaultLabel);
|
||||
showLayout->addWidget(customLabel);
|
||||
showLayout->addWidget(addButton);
|
||||
showLayout->addStretch(1);
|
||||
showLayout->addWidget(tipLabel);
|
||||
|
||||
showWidget->setLayout(showLayout);
|
||||
|
||||
widgetLayout->addWidget(checkBoxWidget);
|
||||
widgetLayout->addWidget(showWidget);
|
||||
m_plymouthwidget->setLayout(widgetLayout);
|
||||
}
|
||||
|
||||
void PlymouthThemeWidget::addspaceritem()
|
||||
{
|
||||
QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
QSpacerItem *spacer2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
spacer->changeSize(m_previewwidget->width(), 155, QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
spacer2->changeSize(m_previewwidget->width(), 159, QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
m_previewlayout->addItem(spacer);
|
||||
m_previewlayout->addWidget(m_preview);
|
||||
m_previewlayout->addItem(spacer2);
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef PLYMOUTHMOUTHTHEMEWIDGET_H
|
||||
#define PLYMOUTHMOUTHTHEMEWIDGET_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QScrollArea>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include "plymouththemefeature.h"
|
||||
|
||||
class PlymouthThemeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PlymouthThemeWidget(QWidget *parent = nullptr);
|
||||
void initPreviewWidget();
|
||||
void initRightWidget();
|
||||
void addspaceritem();
|
||||
void initEditWidget();
|
||||
signals:
|
||||
private:
|
||||
QWidget *m_previewwidget;
|
||||
PlymouthImageWidget *m_preview;
|
||||
QWidget *m_rightwidget;
|
||||
QWidget *m_plymouthwidget;
|
||||
QVBoxLayout *m_previewlayout;
|
||||
};
|
||||
|
||||
#endif // PLYMOUTHMOUTHTHEMEWIDGET_H
|
Loading…
Reference in New Issue