!50 add plymouth file operate
Merge pull request !50 from likehomedream/my-devel
This commit is contained in:
commit
ba2c2f42c6
|
@ -89,8 +89,14 @@ void Bridge::timeCursorMapChanged(QMap<QString, QString> *timecursormap)
|
|||
void Bridge::plymouthPathChanged(QString path)
|
||||
{
|
||||
m_plymouthpath = path;
|
||||
m_configfilemanager->copyPictoCacheDir(m_plymouthpath,QDir::homePath()+"/.cache/theme-build/"
|
||||
+m_time+"/src/plymouthTheme","plymouth");
|
||||
QFileInfo fileInfo(m_plymouthpath);
|
||||
if (fileInfo.suffix().toLower() == "mp4"){
|
||||
m_configfilemanager->copyMp4toCacheDir(m_plymouthpath,QDir::homePath()+"/.cache/theme-build/"
|
||||
+m_time+"/src/plymouthTheme");
|
||||
}else{
|
||||
m_configfilemanager->copyPictoCacheDir(m_plymouthpath,QDir::homePath()+"/.cache/theme-build/"
|
||||
+m_time+"/src/plymouthTheme","plymouth");
|
||||
}
|
||||
}
|
||||
|
||||
void Bridge::grubPathChanged(QString path)
|
||||
|
@ -167,6 +173,9 @@ void Bridge::createFileManager(QString time)
|
|||
m_configfilemanager = new ConfigFileManager();
|
||||
// createDir();
|
||||
connect(m_configfilemanager,&ConfigFileManager::updateInfo,this,&Bridge::updateInfo);
|
||||
connect(m_configfilemanager, &ConfigFileManager::updateThumbnail, this, [&](const QString& path) {
|
||||
emit updateThumbnail(path);
|
||||
});
|
||||
}
|
||||
|
||||
//void Bridge::createDir()
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
void updateIconCache(QMap<QString, QString> *iconsmaps,QString icontype);
|
||||
signals:
|
||||
void updateInfo();
|
||||
void updateThumbnail(QString thumbnailPath);
|
||||
private:
|
||||
Bridge(QObject *parent = nullptr);
|
||||
QString m_time;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "configfilemanager.h"
|
||||
#include "historyinfoload.h"
|
||||
#include <QProcess>
|
||||
|
||||
ConfigFileManager::ConfigFileManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
@ -304,3 +305,28 @@ void ConfigFileManager::copyPictoCacheDir(const QString &destinationFilePath, QD
|
|||
qDebug() << "File copied successfully";
|
||||
}
|
||||
|
||||
void ConfigFileManager::copyMp4toCacheDir(const QString &destinationFilePath, QDir cachedir)
|
||||
{
|
||||
QStringList list;
|
||||
//ffmpeg -i "111.mp4" "/home/.cache/theme-build/m_time/src/plymouthTheme/%d.png"
|
||||
//FIX ME :限制条件
|
||||
QString cache = cachedir.absolutePath()+"/%d.png";
|
||||
list<<"-i"<<destinationFilePath<<cache;
|
||||
QProcess p;
|
||||
p.start("ffmpeg",list);
|
||||
if (!p.waitForStarted()) {
|
||||
qWarning()<<"start get video image failed.";
|
||||
}
|
||||
|
||||
if (!p.waitForFinished(40000)) {
|
||||
qWarning()<<"wait video image too long time.";
|
||||
}
|
||||
QString err=p.readAllStandardError();
|
||||
QString read=p.readAll();
|
||||
if (err.contains("not contain any stream")) {
|
||||
qWarning()<<"get video image failed.";
|
||||
}
|
||||
QString thunbnail = cachedir.absolutePath()+"/40.png";;
|
||||
emit updateThumbnail(thunbnail);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,10 @@ public:
|
|||
bool copyIcontoCacheDir(QMap<QString, QString> *map,QDir cachedir);
|
||||
|
||||
void copyPictoCacheDir(const QString& destinationFilePath,QDir cachedir,QString type);
|
||||
void copyMp4toCacheDir(const QString& destinationFilePath,QDir cachedir);
|
||||
signals:
|
||||
void updateInfo();
|
||||
void updateThumbnail(QString thumbnailPath);
|
||||
private:
|
||||
|
||||
};
|
||||
|
|
|
@ -296,3 +296,8 @@ void MainInterface::updateButtonGroup(bool isGlobalTheme)
|
|||
|
||||
}
|
||||
|
||||
void MainInterface::updateThumbnail(QString thumbnailPath)
|
||||
{
|
||||
m_plymouththemewidget->setThumbnailIcon(thumbnailPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
|
||||
void getThemeInfo(const HistoryInfo &InfoData);
|
||||
void updateButtonGroup(bool isGlobalTheme);
|
||||
void updateThumbnail(QString thumbnailPath);
|
||||
//初始化和刷新时使用
|
||||
QMap<QString, QString>* getAppIconsMap();
|
||||
QMap<QString, QString>* getSystemIconsMap();
|
||||
|
|
|
@ -37,6 +37,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(m_maininterface, &MainInterface::grubPathChanged, m_bridge, &Bridge::grubPathChanged);
|
||||
// connect(m_maininterface, &MainInterface::startCopy, m_bridge, &Bridge::startCopy);
|
||||
connect(m_bridge,&Bridge::updateInfo,m_historywidget,&HistoryWidget::updateInfo);
|
||||
connect(m_bridge,&Bridge::updateThumbnail,m_maininterface,&MainInterface::updateThumbnail);
|
||||
|
||||
connect(m_maininterface, &MainInterface::gohomesignals, this, &MainWindow::onGoHomeClicked);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,13 @@ void PlymouthThemeWidget::initEditWidget()
|
|||
m_plymouthwidget->setLayout(widgetLayout);
|
||||
}
|
||||
|
||||
void PlymouthThemeWidget::setThumbnailIcon(QString path)
|
||||
{
|
||||
QPixmap pixmap(path);
|
||||
pixmap = pixmap.scaled(64,64, Qt::KeepAspectRatio);
|
||||
m_customLabel->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void PlymouthThemeWidget::addspaceritem()
|
||||
{
|
||||
QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
void initRightWidget();
|
||||
void addspaceritem();
|
||||
void initEditWidget();
|
||||
void setThumbnailIcon(QString path);
|
||||
signals:
|
||||
void newPlymouthFilePath(const QString& path);
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue