add modify icon function
This commit is contained in:
parent
1861e6993e
commit
c8b4e386d4
|
@ -47,6 +47,7 @@ void Bridge::appIconsMapChanged(QMap<QString, QString> *appiconsmaps)
|
||||||
for (it = appiconsmaps->begin(); it != appiconsmaps->end(); ++it) {
|
for (it = appiconsmaps->begin(); it != appiconsmaps->end(); ++it) {
|
||||||
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
||||||
}
|
}
|
||||||
|
m_appsiconpathmap = appiconsmaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bridge::systemIconsMapChanged(QMap<QString, QString> *systemiconsmaps)
|
void Bridge::systemIconsMapChanged(QMap<QString, QString> *systemiconsmaps)
|
||||||
|
@ -55,6 +56,7 @@ void Bridge::systemIconsMapChanged(QMap<QString, QString> *systemiconsmaps)
|
||||||
for (it = systemiconsmaps->begin(); it != systemiconsmaps->end(); ++it) {
|
for (it = systemiconsmaps->begin(); it != systemiconsmaps->end(); ++it) {
|
||||||
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
||||||
}
|
}
|
||||||
|
m_systemiconpathmap = systemiconsmaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bridge::cursorMapChanged(QMap<QString, QString> *cursormap)
|
void Bridge::cursorMapChanged(QMap<QString, QString> *cursormap)
|
||||||
|
@ -63,6 +65,7 @@ void Bridge::cursorMapChanged(QMap<QString, QString> *cursormap)
|
||||||
for (it = cursormap->begin(); it != cursormap->end(); ++it) {
|
for (it = cursormap->begin(); it != cursormap->end(); ++it) {
|
||||||
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
||||||
}
|
}
|
||||||
|
m_cursorpathmap = cursormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bridge::timeCursorMapChanged(QMap<QString, QString> *timecursormap)
|
void Bridge::timeCursorMapChanged(QMap<QString, QString> *timecursormap)
|
||||||
|
@ -71,15 +74,36 @@ void Bridge::timeCursorMapChanged(QMap<QString, QString> *timecursormap)
|
||||||
for (it = timecursormap->begin(); it != timecursormap->end(); ++it) {
|
for (it = timecursormap->begin(); it != timecursormap->end(); ++it) {
|
||||||
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
qDebug() << "Key:" << it.key() << "Value:" << it.value();
|
||||||
}
|
}
|
||||||
|
m_timecursorpathmap = timecursormap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bridge::startCopy()
|
||||||
|
{
|
||||||
|
m_configfilemanager->copytoCacheDir(m_appsiconpathmap,m_builderappicon);
|
||||||
|
// m_configfilemanager->copytoCacheDir(m_systemiconpathmap,m_buildersystemicon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bridge::createFileManager(QString time)
|
void Bridge::createFileManager(QString time)
|
||||||
{
|
{
|
||||||
m_time = time;
|
m_time = time;
|
||||||
m_configfilemanager = new ConfigFileManager(time);
|
m_configfilemanager = new ConfigFileManager(time);
|
||||||
|
createDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Bridge::getTime()
|
void Bridge::createDir()
|
||||||
{
|
{
|
||||||
return m_time;
|
QString m_themePath = QDir::homePath() + "/.cache/theme-build/" +m_time;
|
||||||
|
m_builderConfig = m_themePath + "/config";
|
||||||
|
m_builderappicon = m_themePath + "/iconTheme" + "/appicon";
|
||||||
|
m_buildersystemicon = m_themePath + "/iconTheme" + "/systemicon";
|
||||||
|
m_buildercursor = m_themePath + "/cursorTheme" + "/cursor";
|
||||||
|
m_buildertimecursor = m_themePath + "/cursorTheme" + "/timecursor";
|
||||||
|
|
||||||
|
m_builderConfig.mkdir(m_builderConfig.absolutePath());
|
||||||
|
m_buildericons.mkdir(m_buildericons.absolutePath());
|
||||||
|
m_builderappicon.mkdir(m_builderappicon.absolutePath());
|
||||||
|
m_buildersystemicon.mkdir(m_buildersystemicon.absolutePath());
|
||||||
|
m_buildercursors.mkdir(m_buildercursors.absolutePath());
|
||||||
|
m_buildercursor.mkdir(m_buildercursor.absolutePath());
|
||||||
|
m_buildertimecursor.mkdir(m_buildertimecursor.absolutePath());
|
||||||
}
|
}
|
||||||
|
|
18
src/bridge.h
18
src/bridge.h
|
@ -14,7 +14,7 @@ class Bridge : public QObject
|
||||||
public:
|
public:
|
||||||
static Bridge* getInstance(QObject *parent = nullptr);
|
static Bridge* getInstance(QObject *parent = nullptr);
|
||||||
void createFileManager(QString time);
|
void createFileManager(QString time);
|
||||||
|
void createDir();
|
||||||
void wallpaperPathChanged(QString path);
|
void wallpaperPathChanged(QString path);
|
||||||
void coverPathChanged(QString path);
|
void coverPathChanged(QString path);
|
||||||
void radiusChanged(int radius);
|
void radiusChanged(int radius);
|
||||||
|
@ -24,8 +24,8 @@ public:
|
||||||
void systemIconsMapChanged(QMap<QString, QString> *systemiconsmaps);
|
void systemIconsMapChanged(QMap<QString, QString> *systemiconsmaps);
|
||||||
void cursorMapChanged(QMap<QString, QString> *cursormap);
|
void cursorMapChanged(QMap<QString, QString> *cursormap);
|
||||||
void timeCursorMapChanged(QMap<QString, QString> *timecursormap);
|
void timeCursorMapChanged(QMap<QString, QString> *timecursormap);
|
||||||
|
void startCopy();
|
||||||
|
|
||||||
QString getTime();
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -34,6 +34,20 @@ private:
|
||||||
static Bridge* m_instance;
|
static Bridge* m_instance;
|
||||||
static QMutex m_mutex;
|
static QMutex m_mutex;
|
||||||
ConfigFileManager *m_configfilemanager;
|
ConfigFileManager *m_configfilemanager;
|
||||||
|
|
||||||
|
QMap<QString, QString> *m_appsiconpathmap;
|
||||||
|
QMap<QString, QString> *m_systemiconpathmap;
|
||||||
|
QMap<QString, QString> *m_cursorpathmap;
|
||||||
|
QMap<QString, QString> *m_timecursorpathmap;
|
||||||
|
|
||||||
|
QDir m_builderConfig;
|
||||||
|
QDir m_buildericons;
|
||||||
|
QDir m_builderappicon;
|
||||||
|
QDir m_buildersystemicon;
|
||||||
|
QDir m_buildercursors;
|
||||||
|
QDir m_buildercursor;
|
||||||
|
QDir m_buildertimecursor;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BRIDGE_H
|
#endif // BRIDGE_H
|
||||||
|
|
|
@ -10,9 +10,10 @@ ConfigFileManager::ConfigFileManager(const QString& time,QObject *parent) : QObj
|
||||||
m_time = time;
|
m_time = time;
|
||||||
createConf();
|
createConf();
|
||||||
createJson();
|
createJson();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfigFileManager::createJson()
|
bool ConfigFileManager::createJson()
|
||||||
{
|
{
|
||||||
QString m_themePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/config/";
|
QString m_themePath = QDir::homePath() + "/.cache/theme-build/" + m_time + "/config/";
|
||||||
|
@ -199,3 +200,33 @@ bool ConfigFileManager::copyFileContent(const QString &sourceFilePath, const QSt
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ConfigFileManager::copytoCacheDir(QMap<QString, QString> *map, QDir cachedir)
|
||||||
|
{
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
|
for (auto it = map->begin(); it != map->end(); ++it)
|
||||||
|
{
|
||||||
|
QString key = it.key();
|
||||||
|
QString value = it.value();
|
||||||
|
|
||||||
|
if (value.startsWith(":/resource")){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile inputFile(value);
|
||||||
|
QFileInfo fileInfo(inputFile.fileName());
|
||||||
|
QString destinationPath = cachedir.filePath(key + "." + fileInfo.completeSuffix());
|
||||||
|
|
||||||
|
if (!inputFile.exists()){
|
||||||
|
success = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inputFile.copy(destinationPath)){
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
class ConfigFileManager : public QObject
|
class ConfigFileManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ConfigFileManager(const QString& time,QObject *parent = nullptr);
|
explicit ConfigFileManager(const QString& time,QObject *parent = nullptr);
|
||||||
|
|
||||||
bool createJson();
|
bool createJson();
|
||||||
bool createConf();
|
bool createConf();
|
||||||
bool modifyRadiusJson(int radius);
|
bool modifyRadiusJson(int radius);
|
||||||
|
@ -20,11 +22,13 @@ public:
|
||||||
|
|
||||||
|
|
||||||
bool copyFileContent(const QString& sourceFilePath, const QString& destinationFilePath);
|
bool copyFileContent(const QString& sourceFilePath, const QString& destinationFilePath);
|
||||||
|
bool copytoCacheDir(QMap<QString, QString> *map,QDir cachedir);
|
||||||
signals:
|
signals:
|
||||||
private:
|
private:
|
||||||
QString m_time;
|
QString m_time;
|
||||||
QString jsonFilePath;
|
QString jsonFilePath;
|
||||||
QString confFilePath;
|
QString confFilePath;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONFIGFILEMANAGER_H
|
#endif // CONFIGFILEMANAGER_H
|
||||||
|
|
|
@ -61,11 +61,17 @@ QString FileProcess::FileCreate(const QString &m_themeType){
|
||||||
QString m_themePath = QDir::homePath() + "/.cache/theme-build/" + g_date;
|
QString m_themePath = QDir::homePath() + "/.cache/theme-build/" + g_date;
|
||||||
QDir m_builderTime = m_themePath;
|
QDir m_builderTime = m_themePath;
|
||||||
QDir m_builderDeb = m_themePath + "/debian";
|
QDir m_builderDeb = m_themePath + "/debian";
|
||||||
QDir m_builderConfig = m_themePath + "/config";
|
|
||||||
QDir m_themeTypePath = m_themePath + "/" + m_themeType;
|
QDir m_themeTypePath = m_themePath + "/" + m_themeType;
|
||||||
|
|
||||||
|
|
||||||
m_builderTime.mkdir(m_builderTime.absolutePath());
|
m_builderTime.mkdir(m_builderTime.absolutePath());
|
||||||
m_builderTime.mkdir(m_builderDeb.absolutePath());
|
m_builderDeb.mkdir(m_builderDeb.absolutePath());
|
||||||
m_builderTime.mkdir(m_builderConfig.absolutePath());
|
if(m_themeType == "globalTheme"){
|
||||||
|
QDir iconPath = m_themePath+ "/iconTheme";
|
||||||
|
QDir cursorPath = m_themePath+ "/cursorTheme";
|
||||||
|
iconPath.mkdir(iconPath.absolutePath());
|
||||||
|
cursorPath.mkdir(cursorPath.absolutePath());
|
||||||
|
}
|
||||||
m_themeTypePath.mkdir(m_themeTypePath.absolutePath());
|
m_themeTypePath.mkdir(m_themeTypePath.absolutePath());
|
||||||
|
|
||||||
return g_date;
|
return g_date;
|
||||||
|
|
|
@ -242,6 +242,8 @@ void InfoCreateWidget::InfoProcess(const QString &m_date){
|
||||||
createControlChangelog(FileProcess::g_date);
|
createControlChangelog(FileProcess::g_date);
|
||||||
//清空日期缓存
|
//清空日期缓存
|
||||||
FileProcess::g_date = nullptr;
|
FileProcess::g_date = nullptr;
|
||||||
|
//发送文件复制信号
|
||||||
|
emit readytoBuild();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
void createControlChangelog(const QString &m_date);
|
void createControlChangelog(const QString &m_date);
|
||||||
void getFileInfo(const QMap<QString, QVariant> &m_packageInfo);
|
void getFileInfo(const QMap<QString, QVariant> &m_packageInfo);
|
||||||
signals:
|
signals:
|
||||||
|
void readytoBuild();
|
||||||
private:
|
private:
|
||||||
QLabel *m_warningMessage;
|
QLabel *m_warningMessage;
|
||||||
QLabel *m_warningMessage2;
|
QLabel *m_warningMessage2;
|
||||||
|
|
|
@ -83,6 +83,7 @@ void MainInterface::init()
|
||||||
FileProcess getInfo;
|
FileProcess getInfo;
|
||||||
info->getFileInfo(getInfo.FileSearch(FileProcess::g_date));
|
info->getFileInfo(getInfo.FileSearch(FileProcess::g_date));
|
||||||
info->show();
|
info->show();
|
||||||
|
connect(info,&InfoCreateWidget::readytoBuild,this,&MainInterface::startCopy);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ signals:
|
||||||
void systemIconsMapChanged(QMap<QString, QString> *systemiconsmap);
|
void systemIconsMapChanged(QMap<QString, QString> *systemiconsmap);
|
||||||
void cursorMapChanged(QMap<QString, QString> *appiconsmap);
|
void cursorMapChanged(QMap<QString, QString> *appiconsmap);
|
||||||
void timeCursorMapChanged(QMap<QString, QString> *systemiconsmap);
|
void timeCursorMapChanged(QMap<QString, QString> *systemiconsmap);
|
||||||
|
void startCopy();
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void initLeftBar();
|
void initLeftBar();
|
||||||
|
|
|
@ -27,6 +27,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
connect(m_maininterface, &MainInterface::appIconsMapChanged, m_bridge, &Bridge::appIconsMapChanged);
|
connect(m_maininterface, &MainInterface::appIconsMapChanged, m_bridge, &Bridge::appIconsMapChanged);
|
||||||
connect(m_maininterface, &MainInterface::systemIconsMapChanged, m_bridge, &Bridge::systemIconsMapChanged);
|
connect(m_maininterface, &MainInterface::systemIconsMapChanged, m_bridge, &Bridge::systemIconsMapChanged);
|
||||||
connect(m_maininterface, &MainInterface::cursorMapChanged, m_bridge, &Bridge::systemIconsMapChanged);
|
connect(m_maininterface, &MainInterface::cursorMapChanged, m_bridge, &Bridge::systemIconsMapChanged);
|
||||||
|
connect(m_maininterface, &MainInterface::startCopy, m_bridge, &Bridge::startCopy);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
|
Loading…
Reference in New Issue