!43 fix grub and plymouth layout

Merge pull request !43 from likehomedream/my-devel
This commit is contained in:
KevinDuan 2023-11-08 09:47:34 +00:00 committed by Gitee
commit af820bf288
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 78 additions and 31 deletions

View File

@ -133,5 +133,7 @@
<file>resource/background/homepage-boot.png</file>
<file>resource/background/openKylin.svg</file>
<file>resource/background/grub-listview.png</file>
<file>resource/background/homepage-plymouth.png</file>
<file>resource/background/homepage-grub.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -56,13 +56,15 @@ void Bridge::windowRadiusChanged(int windowradius)
void Bridge::appIconsMapChanged(QMap<QString, QString> *appiconsmaps)
{
m_appsiconpathmap = appiconsmaps;
m_configfilemanager->copyIcontoCacheDir(m_appsiconpathmap,m_builderappicon);
m_configfilemanager->copyIcontoCacheDir(m_appsiconpathmap,QDir::homePath()+"/.cache/theme-build/"
+FileProcess::g_date+"/src/iconTheme/appicon");
}
void Bridge::systemIconsMapChanged(QMap<QString, QString> *systemiconsmaps)
{
m_systemiconpathmap = systemiconsmaps;
m_configfilemanager->copyIcontoCacheDir(m_systemiconpathmap,m_buildersystemicon);
m_configfilemanager->copyIcontoCacheDir(m_systemiconpathmap,QDir::homePath()+"/.cache/theme-build/"
+FileProcess::g_date+"/src/iconTheme/systemicon");
}
void Bridge::cursorMapChanged(QMap<QString, QString> *cursormap)

View File

@ -125,7 +125,7 @@ void MainInterface::initLeftBar()
QButtonGroup *buttonGroup = new QButtonGroup(m_navigationwidget);
buttonGroup->setExclusive(true);
QButtonGroup *bootbuttonGroup = new QButtonGroup(m_navigationwidget);
// QButtonGroup *bootbuttonGroup = new QButtonGroup(m_navigationwidget);
m_globalbtn = new TypeButton(m_navigationwidget);
m_globalbtn->setText(tr("GlobalTheme"));
@ -144,8 +144,8 @@ void MainInterface::initLeftBar()
buttonGroup->addButton(m_globalbtn);
buttonGroup->addButton(m_iconbtn);
buttonGroup->addButton(m_cursorbtn);
bootbuttonGroup->addButton(m_plymouthbtn);
bootbuttonGroup->addButton(m_grubbtn);
buttonGroup->addButton(m_plymouthbtn);
buttonGroup->addButton(m_grubbtn);
m_globalbtn->setCheckable(true);
m_iconbtn->setCheckable(true);

View File

@ -54,18 +54,18 @@ void MainWindow::initUI()
m_maininterface = new MainInterface();
m_entrywidget = new QWidget();
m_globalbtn = new EntryButton();
m_iconbtn = new EntryButton();
m_cursorbtn = new EntryButton();
m_bootbtn = new EntryButton();
initEntry();
QVBoxLayout* alllayout = new QVBoxLayout;
QHBoxLayout* layout = new QHBoxLayout;
layout->addWidget(m_globalbtn);
layout->addWidget(m_iconbtn);
layout->addWidget(m_cursorbtn);
layout->addWidget(m_bootbtn);
QGridLayout* layout = new QGridLayout;
layout->addWidget(m_globalbtn,0,0);
layout->addWidget(m_iconbtn,0,1);
layout->addWidget(m_cursorbtn,0,2);
layout->addWidget(m_plymouthbtn,1,0);
layout->addWidget(m_grubbtn,1,1);
m_guideWidget = new QWidget();
@ -104,14 +104,7 @@ void MainWindow::initUI()
alllayout->addWidget(m_historywidget);
}
QIcon icon = QIcon(QPixmap(":/resource/background/homepage-global.png"));
m_globalbtn->setEntry(icon,tr("Global Theme"));
QIcon icon1 = QIcon(QPixmap(":/resource/background/homepage-icons.png"));
m_iconbtn->setEntry(icon1,tr("Icon Theme"));
QIcon icon2 = QIcon(QPixmap(":/resource/background/homepage-cursor.png"));
m_cursorbtn->setEntry(icon2,tr("Cursor Theme"));
QIcon icon3 = QIcon(QPixmap(":/resource/background/homepage-boot.png"));
m_bootbtn->setEntry(icon3,tr("Boot Theme"));
m_entrywidget->setLayout(alllayout);
QScrollArea* scrollArea = new QScrollArea;
@ -131,7 +124,8 @@ void MainWindow::initUI()
buttonGroup->addButton(m_globalbtn);
buttonGroup->addButton(m_iconbtn);
buttonGroup->addButton(m_cursorbtn);
buttonGroup->addButton(m_bootbtn);
buttonGroup->addButton(m_plymouthbtn);
buttonGroup->addButton(m_grubbtn);
connect(m_historywidget,&HistoryWidget::startSecondEdit,[=](HistoryInfo InfoData){
m_maininterface->isHistory(true);
@ -149,7 +143,6 @@ 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();
@ -158,20 +151,23 @@ void MainWindow::initUI()
m_bridge->createFileManager(false,FileProcess::g_date);
m_bridge->updateIconCache(m_maininterface->getAppIconsMap(),"appicon");
m_bridge->updateIconCache(m_maininterface->getSystemIconsMap(),"systemicon");
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) {
}else if (button == m_plymouthbtn) {
m_maininterface->setPlymouthTheme();
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("bootTheme"), "recognise");
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("plymouthTheme"), "recognise");
m_infoCreateWidget->show();
m_bridge->createFileManager(false,FileProcess::g_date);
}else if (button == m_grubbtn) {
m_maininterface->setGrubTheme();
InfoCreateWidget* m_infoCreateWidget = new InfoCreateWidget(nullptr, m_fileProcess.FileCreate("grubTheme"), "recognise");
m_infoCreateWidget->show();
m_bridge->createFileManager(false,FileProcess::g_date);
m_maininterface->updateButtonGroup(false);
}
if (m_historywidget == nullptr) {
m_historywidget = new HistoryWidget();
m_historywidget->setMinimumHeight(2000);
@ -196,6 +192,31 @@ void MainWindow::initUI()
});
}
void MainWindow::initEntry()
{
m_globalbtn = new EntryButton();
m_iconbtn = new EntryButton();
m_cursorbtn = new EntryButton();
m_plymouthbtn = new EntryButton();
m_grubbtn = new EntryButton();
QIcon icon = QIcon(QPixmap(":/resource/background/homepage-global.png"));
m_globalbtn->setEntry(icon,tr("Global Theme"));
m_globalbtn->setTip(tr("Topics include basic styles for windows and controls, icons, cursors, and more!"));
QIcon icon1 = QIcon(QPixmap(":/resource/background/homepage-icons.png"));
m_iconbtn->setEntry(icon1,tr("Icon Theme"));
m_iconbtn->setTip(tr("The icon theme includes multiple application icons and system settings homepage icons."));
QIcon icon2 = QIcon(QPixmap(":/resource/background/homepage-cursor.png"));
m_cursorbtn->setEntry(icon2,tr("Cursor Theme"));
m_cursorbtn->setTip(tr("Cursor theme for pointer cursor icon"));
QIcon icon3 = QIcon(QPixmap(":/resource/background/homepage-plymouth.png"));
m_plymouthbtn->setEntry(icon3,tr("Plymouth Theme"));
m_plymouthbtn->setTip(tr("Boot animation can be customized to boot screen effect"));
QIcon icon4 = QIcon(QPixmap(":/resource/background/homepage-grub.png"));
m_grubbtn->setEntry(icon4,tr("GRUB Theme"));
m_grubbtn->setTip(tr("Modify GURB background wallpaper"));
}
void MainWindow::onGoHomeClicked()
{
@ -218,24 +239,40 @@ void MainWindow::onGoHomeClicked()
void EntryButton::setEntry(const QIcon &icon, const QString &text)
{
QFont font("Arial", 18);
font.setBold(true);
textLabel->setFont(font);
iconLabel->setPixmap(icon.pixmap(320, 320));
textLabel->setText(text);
textLabel->setAlignment(Qt::AlignCenter);
textLabel->setFont(QFont("Arial" , 16));
textLabel->setFont(QFont("Arial" , 18));
}
void EntryButton::setTip(const QString &text)
{
tipLabel->setText(text);
QFont font;
font.setPointSize(10);
tipLabel->setFont(font);
tipLabel->setText(text);
tipLabel->setWordWrap(true);
}
EntryButton::EntryButton(QWidget *parent): QPushButton(parent)
{
this->setFixedSize(240,240);
this->setFixedSize(240,280);
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
iconLabel = new QLabel;
textLabel = new QLabel;
tipLabel = new QLabel;
layout->addWidget(iconLabel);
layout->addWidget(textLabel);
layout->addWidget(tipLabel);
}
void MainWindow::mousePressEvent(QMouseEvent *event)

View File

@ -17,10 +17,12 @@ class EntryButton : public QPushButton
public:
EntryButton(QWidget *parent = nullptr);
void setEntry(const QIcon &icon, const QString &text);
void setTip(const QString &text);
private:
QLabel *iconLabel;
QLabel *textLabel;
QLabel *tipLabel;
};
enum ResizeRegion
{
@ -47,6 +49,7 @@ public:
void mouseReleaseEvent(QMouseEvent *event);
void initUI();
void initEntry();
public slots:
@ -72,6 +75,8 @@ private:
EntryButton *m_globalbtn;
EntryButton *m_iconbtn;
EntryButton *m_cursorbtn;
EntryButton *m_plymouthbtn;
EntryButton *m_grubbtn;
EntryButton *m_bootbtn;
MainInterface *m_maininterface;
InfoCreateWidget *m_mainPageState;

View File

@ -395,4 +395,5 @@ void IconThemeWidget::refresh()
updateCustomIconPathMap(m_iconpathmap);
m_systempreview->updateIconMap(getResourcesAppIconMap("systemicon"));
updateCustomSyetemIconPathMap(m_systemiconpathmap);
}