add Grub and Plymouth history
This commit is contained in:
parent
f3f6316151
commit
e9194d2a8a
|
@ -479,6 +479,13 @@ bool ConfigFileManager::copyIcontoCacheDir(QMap<QString, QString> *map, QDir cac
|
||||||
*/
|
*/
|
||||||
void ConfigFileManager::copyPictoCacheDir(const QString &destinationFilePath, QDir cachedir, QString type)
|
void ConfigFileManager::copyPictoCacheDir(const QString &destinationFilePath, QDir cachedir, QString type)
|
||||||
{
|
{
|
||||||
|
//清空文件夹
|
||||||
|
QStringList fileList = cachedir.entryList(QDir::Files);
|
||||||
|
foreach (const QString &fileName, fileList) {
|
||||||
|
QString filePath = cachedir.absoluteFilePath(fileName);
|
||||||
|
QFile::remove(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
QString sourceFilePath = destinationFilePath;
|
QString sourceFilePath = destinationFilePath;
|
||||||
QString sourceFileExt = QFileInfo(sourceFilePath).suffix();
|
QString sourceFileExt = QFileInfo(sourceFilePath).suffix();
|
||||||
|
|
||||||
|
@ -513,11 +520,18 @@ void ConfigFileManager::copyPictoCacheDir(const QString &destinationFilePath, QD
|
||||||
*/
|
*/
|
||||||
void ConfigFileManager::copyMp4toCacheDir(const QString &destinationFilePath, QDir cachedir)
|
void ConfigFileManager::copyMp4toCacheDir(const QString &destinationFilePath, QDir cachedir)
|
||||||
{
|
{
|
||||||
|
//清空文件夹
|
||||||
|
QStringList fileList = cachedir.entryList(QDir::Files);
|
||||||
|
foreach (const QString &fileName, fileList) {
|
||||||
|
QString filePath = cachedir.absoluteFilePath(fileName);
|
||||||
|
QFile::remove(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
QStringList list;
|
QStringList list;
|
||||||
//ffmpeg -i "111.mp4" -vframes 104 "/home/.cache/theme-build/m_time/src/plymouthTheme/%d.png"
|
//ffmpeg -i "111.mp4" -vframes 104 "/home/.cache/theme-build/m_time/src/plymouthTheme/%d.png"
|
||||||
//FIX ME :限制条件
|
//FIX ME :限制条件
|
||||||
QString cache = cachedir.absolutePath()+"/%d.png";
|
QString cache = cachedir.absolutePath()+"/%d.png";
|
||||||
list<<"-i"<<destinationFilePath<<"-vframes"<<"70"<<cache;
|
list<<"-i"<<destinationFilePath<<"-vframes"<<"104"<<cache;
|
||||||
|
|
||||||
QProcess p;
|
QProcess p;
|
||||||
p.start("ffmpeg",list);
|
p.start("ffmpeg",list);
|
||||||
|
|
|
@ -121,6 +121,7 @@ void MainInterface::init()
|
||||||
});
|
});
|
||||||
connect(m_plymouthbtn,&TypeButton::clicked,m_themestackedwidget,[=](){
|
connect(m_plymouthbtn,&TypeButton::clicked,m_themestackedwidget,[=](){
|
||||||
m_themestackedwidget->setCurrentIndex(3);
|
m_themestackedwidget->setCurrentIndex(3);
|
||||||
|
this->startShowPlymouth();
|
||||||
});
|
});
|
||||||
connect(m_grubbtn,&TypeButton::clicked,m_themestackedwidget,[=](){
|
connect(m_grubbtn,&TypeButton::clicked,m_themestackedwidget,[=](){
|
||||||
m_themestackedwidget->setCurrentIndex(4);
|
m_themestackedwidget->setCurrentIndex(4);
|
||||||
|
@ -267,6 +268,12 @@ void MainInterface::getThemeInfo(const HistoryInfo &InfoData)
|
||||||
}else if(InfoData.themetype == "iconTheme"){
|
}else if(InfoData.themetype == "iconTheme"){
|
||||||
setIconTheme();
|
setIconTheme();
|
||||||
m_iconthemewidget->eidtInitWidget(InfoData);
|
m_iconthemewidget->eidtInitWidget(InfoData);
|
||||||
|
}else if(InfoData.themetype == "plymouthTheme"){
|
||||||
|
setPlymouthTheme();
|
||||||
|
m_plymouththemewidget->eidtInitWidget(InfoData);
|
||||||
|
}else if(InfoData.themetype == "grubTheme"){
|
||||||
|
setGrubTheme();
|
||||||
|
m_grubthemewidget->eidtInitWidget(InfoData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,13 @@ void GrubThemeWidget::initEditWidget()
|
||||||
QWidget *grubWidget = new QWidget();
|
QWidget *grubWidget = new QWidget();
|
||||||
QHBoxLayout *widgetLayout = new QHBoxLayout();
|
QHBoxLayout *widgetLayout = new QHBoxLayout();
|
||||||
|
|
||||||
QPushButton *showBtn = new QPushButton();
|
m_showBtn = new QPushButton();
|
||||||
showBtn->setFixedSize(160,100);
|
m_showBtn->setFixedSize(160,100);
|
||||||
|
|
||||||
QLabel *tipLabel1 = new QLabel();
|
QLabel *tipLabel1 = new QLabel();
|
||||||
tipLabel1->setText("<html>尺寸:3840*2160<br>大小:不超过 10 MB<br>格式:PNG</html>");
|
tipLabel1->setText("<html>尺寸:3840*2160<br>大小:不超过 10 MB<br>格式:PNG</html>");
|
||||||
|
|
||||||
connect(showBtn, &QPushButton::clicked, this, [=]() {
|
connect(m_showBtn, &QPushButton::clicked, this, [=]() {
|
||||||
// 弹出文件选择对话框,选择图片文件
|
// 弹出文件选择对话框,选择图片文件
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)"));
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ void GrubThemeWidget::initEditWidget()
|
||||||
// 加载图片文件并创建一个QPixmap对象
|
// 加载图片文件并创建一个QPixmap对象
|
||||||
QPixmap pixmap(newFilePath);
|
QPixmap pixmap(newFilePath);
|
||||||
// 设置按钮的图标为加载的图片文件对应的图标,并设置图标大小为按钮的大小
|
// 设置按钮的图标为加载的图片文件对应的图标,并设置图标大小为按钮的大小
|
||||||
showBtn->setIcon(QIcon(pixmap));
|
m_showBtn->setIcon(QIcon(pixmap));
|
||||||
showBtn->setIconSize(showBtn->size());
|
m_showBtn->setIconSize(m_showBtn->size());
|
||||||
// 发出新的Grub文件路径信号
|
// 发出新的Grub文件路径信号
|
||||||
emit newGrubFilePath(newFilePath);
|
emit newGrubFilePath(newFilePath);
|
||||||
g_themeChange = true;
|
g_themeChange = true;
|
||||||
|
@ -120,7 +120,7 @@ void GrubThemeWidget::initEditWidget()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
widgetLayout->addWidget(showBtn);
|
widgetLayout->addWidget(m_showBtn);
|
||||||
widgetLayout->addWidget(tipLabel1);
|
widgetLayout->addWidget(tipLabel1);
|
||||||
grubWidget->setLayout(widgetLayout);
|
grubWidget->setLayout(widgetLayout);
|
||||||
|
|
||||||
|
@ -129,6 +129,15 @@ void GrubThemeWidget::initEditWidget()
|
||||||
m_grubwidget->setLayout(layout);
|
m_grubwidget->setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GrubThemeWidget::eidtInitWidget(const HistoryInfo &InfoData)
|
||||||
|
{
|
||||||
|
QString imagedirpath = InfoData.filepath+"/src/grubTheme/background.jpg";
|
||||||
|
m_preview->updateBackground(imagedirpath);
|
||||||
|
QPixmap pixmap(imagedirpath);
|
||||||
|
m_showBtn->setIcon(QIcon(pixmap));
|
||||||
|
m_showBtn->setIconSize(m_showBtn->size());
|
||||||
|
}
|
||||||
|
|
||||||
void GrubThemeWidget::addspaceritem()
|
void GrubThemeWidget::addspaceritem()
|
||||||
{
|
{
|
||||||
QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define GRUBTHEMEWIDGET_H
|
#define GRUBTHEMEWIDGET_H
|
||||||
|
|
||||||
#include "grubthemefeature.h"
|
#include "grubthemefeature.h"
|
||||||
|
#include "historywidget.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -21,6 +21,7 @@ public:
|
||||||
void addspaceritem();
|
void addspaceritem();
|
||||||
void initEditWidget();
|
void initEditWidget();
|
||||||
static bool g_themeChange;
|
static bool g_themeChange;
|
||||||
|
void eidtInitWidget(const HistoryInfo &InfoData);
|
||||||
signals:
|
signals:
|
||||||
void newGrubFilePath(const QString& path);
|
void newGrubFilePath(const QString& path);
|
||||||
private:
|
private:
|
||||||
|
@ -29,6 +30,7 @@ private:
|
||||||
QWidget *m_rightwidget;
|
QWidget *m_rightwidget;
|
||||||
QWidget *m_grubwidget;
|
QWidget *m_grubwidget;
|
||||||
QVBoxLayout *m_previewlayout;
|
QVBoxLayout *m_previewlayout;
|
||||||
|
QPushButton *m_showBtn;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GRUBTHEMEWIDGET_H
|
#endif // GRUBTHEMEWIDGET_H
|
||||||
|
|
|
@ -140,6 +140,18 @@ void PlymouthThemeWidget::startShowPlymouth()
|
||||||
m_preview->showPlymouth();
|
m_preview->showPlymouth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlymouthThemeWidget::eidtInitWidget(const HistoryInfo &InfoData)
|
||||||
|
{
|
||||||
|
QString imagedirpath = InfoData.filepath+"/src/plymouthTheme/";
|
||||||
|
|
||||||
|
m_preview->updatePlymouth(imagedirpath);
|
||||||
|
m_preview->showPlymouth();
|
||||||
|
|
||||||
|
QPixmap pixmap(InfoData.filepath+"/src/plymouthTheme/40.png");
|
||||||
|
pixmap = pixmap.scaled(64,64, Qt::KeepAspectRatio);
|
||||||
|
m_customLabel->setPixmap(pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
void PlymouthThemeWidget::addspaceritem()
|
void PlymouthThemeWidget::addspaceritem()
|
||||||
{
|
{
|
||||||
QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define PLYMOUTHMOUTHTHEMEWIDGET_H
|
#define PLYMOUTHMOUTHTHEMEWIDGET_H
|
||||||
#include "plymouththemefeature.h"
|
#include "plymouththemefeature.h"
|
||||||
#include "iconwidgetfeature.h"
|
#include "iconwidgetfeature.h"
|
||||||
|
#include "historywidget.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
@ -24,6 +25,7 @@ public:
|
||||||
void setThumbnailIcon(QString path);
|
void setThumbnailIcon(QString path);
|
||||||
static bool g_themeChange;
|
static bool g_themeChange;
|
||||||
void startShowPlymouth();
|
void startShowPlymouth();
|
||||||
|
void eidtInitWidget(const HistoryInfo &InfoData);
|
||||||
signals:
|
signals:
|
||||||
void newPlymouthFilePath(const QString& path);
|
void newPlymouthFilePath(const QString& path);
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue