commit
39d563dfef
|
@ -34,3 +34,8 @@ HEADERS += \
|
|||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
RESOURCES += \
|
||||
debiansources.qrc
|
||||
|
||||
DISTFILES +=
|
||||
|
|
|
@ -7,14 +7,21 @@ CursorThemeWidget::CursorThemeWidget(QWidget *parent) : WidgetBase(parent)
|
|||
init();
|
||||
|
||||
connect(m_importButton , &QPushButton::clicked, this, [=](){
|
||||
this->importCursor();
|
||||
});
|
||||
this->importCursor();
|
||||
});
|
||||
|
||||
connect(m_confirmButton,&QPushButton::clicked,this,[=](){
|
||||
if("" != m_nameLineEdit->text()){
|
||||
m_cursorthemename = m_nameLineEdit->text();
|
||||
emit lineEditEdited(m_cursorthemename);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void CursorThemeWidget::init()
|
||||
{
|
||||
QString name = qgetenv("USER");
|
||||
m_cursorpath = HOMEPATH +name + "/.cache/theme-build/cursor/";
|
||||
QString name = "/.cache/theme-build/"+WidgetBase::getSharedTimeString()+"/cursor/";
|
||||
m_cursorpath = QDir::homePath() +name ;
|
||||
QWidget* newWidget = new QWidget(this);
|
||||
|
||||
newWidget->setFixedHeight(291);
|
||||
|
@ -55,7 +62,7 @@ void CursorThemeWidget::importCursor()
|
|||
{
|
||||
m_fd= new QFileDialog(this);
|
||||
m_fd->setFileMode(QFileDialog::Directory);
|
||||
m_fd->setDirectory(HOMEPATH+qgetenv("USER"));
|
||||
m_fd->setDirectory(QDir::homePath());
|
||||
m_fd->setAcceptMode(QFileDialog::AcceptOpen);
|
||||
m_fd->setViewMode(QFileDialog::List);
|
||||
m_fd->setWindowTitle(tr("Select Import Dir"));
|
||||
|
|
|
@ -26,10 +26,12 @@ public:
|
|||
Q_SIGNALS:
|
||||
void readyToBuild();
|
||||
|
||||
void lineEditEdited(const QString& text);
|
||||
|
||||
private:
|
||||
QFileDialog *m_fd;
|
||||
QString m_cursorpath;
|
||||
QString m_cursorthemename;
|
||||
QListWidget *m_listwidget;
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<RCC>
|
||||
<qresource prefix="/"/>
|
||||
</RCC>
|
|
@ -0,0 +1,23 @@
|
|||
Package: icon_package_name
|
||||
Version: package_version
|
||||
Architecture: all
|
||||
Maintainer: Ubuntu Kylin Team <ubuntukylin-members@lists.launchpad.net>
|
||||
Description: package_description
|
||||
|
||||
Package: cursor_package_name
|
||||
Version: package_version
|
||||
Architecture: architecture
|
||||
Maintainer: maintainer_name <maintainer_email>
|
||||
Description: package_description
|
||||
|
||||
Package: wallpaper_package_name
|
||||
Version: package_version
|
||||
Architecture: architecture
|
||||
Maintainer: maintainer_name <maintainer_email>
|
||||
Description: package_description
|
||||
|
||||
Package: global_package_name
|
||||
Version: package_version
|
||||
Architecture: architecture
|
||||
Maintainer: maintainer_name <maintainer_email>
|
||||
Description: package_description
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
export NO_PNG_PKG_MANGLE=1
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_install:
|
||||
dh_install -X.sass-cache
|
|
@ -0,0 +1 @@
|
|||
3.0 (native)
|
|
@ -0,0 +1,13 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>debiansource/cursortheme.install</file>
|
||||
<file>debiansource/control</file>
|
||||
<file>debiansource/copyright</file>
|
||||
<file>debiansource/wallpaper.install</file>
|
||||
<file>debiansource/changelog</file>
|
||||
<file>debiansource/globaltheme.install</file>
|
||||
<file>debiansource/icontheme.install</file>
|
||||
<file>debiansource/source/format</file>
|
||||
<file>debiansource/rules</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,15 +1,110 @@
|
|||
#include "debmaker.h"
|
||||
#include "mainwindow.h"
|
||||
#include <QDebug>
|
||||
|
||||
DebMaker::DebMaker(QObject *parent) : QObject(parent)
|
||||
{
|
||||
qDebug()<<"-------------11111-------------------------------------";
|
||||
|
||||
//初始化,文件、XXX,打包操作在这里进行
|
||||
|
||||
|
||||
// initControl();
|
||||
// initRules();
|
||||
initDebian();
|
||||
}
|
||||
|
||||
void DebMaker::buildStart()
|
||||
{
|
||||
qDebug()<<"--------------------------------------------------";
|
||||
}
|
||||
|
||||
|
||||
void DebMaker::receiveIconthemename(const QString &iconthemename)
|
||||
{
|
||||
m_iconthemename = iconthemename;
|
||||
|
||||
QFile resourceFile(m_contorlpath);
|
||||
if (!resourceFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
qDebug() << "无法打开资源文件";
|
||||
}
|
||||
|
||||
QTextStream in(&resourceFile);
|
||||
QString fileContent = in.readAll();
|
||||
resourceFile.close();
|
||||
|
||||
QString variable = m_iconthemename;
|
||||
fileContent.replace("icon_package_name", variable);
|
||||
QFile outputFile(m_contorlpath);
|
||||
if (!outputFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
qDebug() << "无法写入文件";
|
||||
}
|
||||
QTextStream out(&outputFile);
|
||||
out << fileContent;
|
||||
outputFile.close();
|
||||
}
|
||||
|
||||
void DebMaker::receiveWallpaperthemename(const QString &wallpaperthemename)
|
||||
{
|
||||
m_wallpaperthemename = wallpaperthemename;
|
||||
}
|
||||
|
||||
void DebMaker::receiveCursorthemename(const QString &cursorthemename)
|
||||
{
|
||||
m_cursorthemename = cursorthemename;
|
||||
}
|
||||
|
||||
void DebMaker::receiveGlobalthemename(const QString &globalthemename)
|
||||
{
|
||||
m_globalthemename = globalthemename;
|
||||
}
|
||||
|
||||
void DebMaker::initDebianFiles(const QString &sourceFilePath)
|
||||
{
|
||||
|
||||
QFileInfo fileInfo(sourceFilePath);
|
||||
QString destinationFilePath = m_filePath+fileInfo.fileName();
|
||||
if(sourceFilePath == ":/debiansource/source/format"){
|
||||
destinationFilePath= m_filePath+"source/format";
|
||||
QDir dir(m_filePath+"source/");
|
||||
if (!dir.exists()) {
|
||||
dir.mkpath(m_filePath+"source/");
|
||||
}
|
||||
}
|
||||
QFile::copy(sourceFilePath,destinationFilePath);
|
||||
changePermissions(destinationFilePath);
|
||||
if(sourceFilePath == ":/debiansource/control"){
|
||||
m_contorlpath = destinationFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
void DebMaker::initDebian()
|
||||
{
|
||||
m_filePath = QDir::homePath() + "/.cache/theme-build/"+WidgetBase::getSharedTimeString()+"/debian/";
|
||||
QDir dir(m_filePath);
|
||||
if (!dir.exists()) {
|
||||
dir.mkpath(m_filePath);
|
||||
}
|
||||
initDebianFiles(":/debiansource/control");
|
||||
initDebianFiles(":/debiansource/copyright");
|
||||
initDebianFiles(":/debiansource/cursortheme.install");
|
||||
initDebianFiles(":/debiansource/globaltheme.install");
|
||||
initDebianFiles(":/debiansource/icontheme.install");
|
||||
initDebianFiles(":/debiansource/wallpaper.install");
|
||||
initDebianFiles(":/debiansource/rules");
|
||||
initDebianFiles(":/debiansource/source/format");
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DebMaker::changePermissions(const QString &destinationFilePath)
|
||||
{
|
||||
QFile file(destinationFilePath);
|
||||
if(!file.exists()){
|
||||
qDebug()<<"文件不存在?";
|
||||
} else {
|
||||
file.setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner |
|
||||
QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup |
|
||||
QFile::ReadOther | QFile::WriteOther | QFile::ExeOther);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,25 @@ class DebMaker : public QObject
|
|||
public:
|
||||
explicit DebMaker(QObject *parent = nullptr);
|
||||
void buildStart();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void receiveIconthemename(const QString& iconthemename);
|
||||
void receiveWallpaperthemename(const QString& wallpaperthemename);
|
||||
void receiveCursorthemename(const QString& cursorthemename);
|
||||
void receiveGlobalthemename(const QString& globalthemename);
|
||||
|
||||
void initDebianFiles(const QString& sourceFilePath);
|
||||
void initDebian();
|
||||
|
||||
private:
|
||||
void changePermissions(const QString& destinationFilePath);
|
||||
QString m_iconthemename = "";
|
||||
QString m_wallpaperthemename = "";
|
||||
QString m_cursorthemename = "";
|
||||
QString m_globalthemename = "";
|
||||
QString m_contorlpath = "";
|
||||
QString m_filePath = "";
|
||||
};
|
||||
|
||||
#endif // DEBMAKER_H
|
||||
|
|
|
@ -12,12 +12,19 @@ GlobalThemeWidget::GlobalThemeWidget(QWidget *parent) : WidgetBase(parent)
|
|||
m_importButton->deleteLater();
|
||||
// m_headWidget->setFixedHeight(62);
|
||||
init();
|
||||
|
||||
connect(m_confirmButton,&QPushButton::clicked,this,[=](){
|
||||
if("" != m_nameLineEdit->text()){
|
||||
m_globalthemename = m_nameLineEdit->text();
|
||||
emit lineEditEdited(m_globalthemename);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void GlobalThemeWidget::init()
|
||||
{
|
||||
QString name = qgetenv("USER");
|
||||
m_globalpath = HOMEPATH +name + "/.cache/theme-build/global/";
|
||||
QString name = "/.cache/theme-build/"+WidgetBase::getSharedTimeString()+"/global/";
|
||||
m_globalpath = QDir::homePath() +name;
|
||||
m_allLayout->takeAt(1);
|
||||
|
||||
initGlobalWidget();
|
||||
|
@ -186,7 +193,7 @@ void GlobalThemeWidget::importCover()
|
|||
m_fd->setViewMode(QFileDialog::List);
|
||||
m_fd->setNameFilter(filters);
|
||||
m_fd->setFileMode(QFileDialog::ExistingFile);
|
||||
m_fd->setDirectory(HOMEPATH+qgetenv("USER"));
|
||||
m_fd->setDirectory(QDir::homePath());
|
||||
m_fd->setWindowTitle(tr("Select Import Wallpapers"));
|
||||
m_fd->setLabelText(QFileDialog::Accept, tr("Select"));
|
||||
m_fd->setLabelText(QFileDialog::Reject, tr("Cancel"));
|
||||
|
@ -224,7 +231,7 @@ void GlobalThemeWidget::importWallpaper()
|
|||
m_fd->setViewMode(QFileDialog::List);
|
||||
m_fd->setNameFilter(filters);
|
||||
m_fd->setFileMode(QFileDialog::ExistingFile);
|
||||
m_fd->setDirectory(HOMEPATH+qgetenv("USER"));
|
||||
m_fd->setDirectory(QDir::homePath());
|
||||
m_fd->setWindowTitle(tr("Select Import Wallpapers"));
|
||||
m_fd->setLabelText(QFileDialog::Accept, tr("Select"));
|
||||
m_fd->setLabelText(QFileDialog::Reject, tr("Cancel"));
|
||||
|
@ -283,8 +290,8 @@ void GlobalThemeWidget::openFileDialog()
|
|||
coverfile.rename(m_globalpath+"cover.png");
|
||||
}else{
|
||||
QFile::copy(sourceFilePath, destinationFilePath);
|
||||
QFile coverfile(m_globalpath+fileInfo.fileName());
|
||||
coverfile.rename(m_globalpath+"wallpaper.png");
|
||||
QFile wallpaperfile(m_globalpath+fileInfo.fileName());
|
||||
wallpaperfile.rename(m_globalpath+"wallpaper.png");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,8 +25,13 @@ protected:
|
|||
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void readyToBuild();
|
||||
|
||||
void lineEditEdited(const QString& text);
|
||||
private:
|
||||
QString m_globalpath = "";
|
||||
QString m_globalthemename = "";
|
||||
|
||||
QWidget *m_globalwidget;
|
||||
QVBoxLayout *m_globallayout;
|
||||
|
|
|
@ -16,19 +16,34 @@
|
|||
IconThemeWidget::IconThemeWidget(QWidget *parent) : WidgetBase(parent)
|
||||
{
|
||||
|
||||
init();
|
||||
this->initThemeLabel("创建主题图标");
|
||||
this->initImportButton("导入图标");
|
||||
|
||||
m_importButton->setDisabled(true);
|
||||
|
||||
|
||||
connect(m_importButton , &QPushButton::clicked, this, [=](){
|
||||
this->importIcons();
|
||||
});
|
||||
this->importIcons();
|
||||
});
|
||||
connect(m_confirmButton,&QPushButton::clicked,this,[=](){
|
||||
if("" != m_nameLineEdit->text()){
|
||||
m_iconthemename = m_nameLineEdit->text();
|
||||
emit lineEditEdited(m_iconthemename);
|
||||
// m_importButton->setDisabled(false);
|
||||
}
|
||||
});
|
||||
connect(m_nameLineEdit,&QLineEdit::editingFinished,this,[=](){
|
||||
m_importButton->setDisabled(false);
|
||||
});
|
||||
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
void IconThemeWidget::init()
|
||||
{
|
||||
QString name = qgetenv("USER");
|
||||
m_iconpath = HOMEPATH +name + "/.cache/theme-build/icon/";
|
||||
QString name = "/.cache/theme-build/"+ WidgetBase::getSharedTimeString()+"/icon/";
|
||||
m_iconpath = QDir::homePath() +name;
|
||||
QWidget* newWidget = new QWidget(this);
|
||||
|
||||
newWidget->setFixedHeight(291);
|
||||
|
@ -76,7 +91,7 @@ void IconThemeWidget::importIcons()
|
|||
// QString filters = tr("Icon files(*.png)");
|
||||
m_fd= new QFileDialog(this);
|
||||
m_fd->setFileMode(QFileDialog::Directory);
|
||||
m_fd->setDirectory(HOMEPATH+qgetenv("USER"));
|
||||
m_fd->setDirectory(QDir::homePath());
|
||||
m_fd->setAcceptMode(QFileDialog::AcceptOpen);
|
||||
m_fd->setViewMode(QFileDialog::List);
|
||||
// m_fd->setNameFilter(filters);
|
||||
|
@ -112,7 +127,7 @@ void IconThemeWidget::openFileDialog()
|
|||
QString selectedDirectory;
|
||||
selectedDirectory = m_fd->selectedFiles().first();
|
||||
|
||||
// bool isLegal = ThemesCheck::checkIconsDir(selectedDirectory);
|
||||
bool isLegal = ThemesCheck::checkIconsDir(selectedDirectory);
|
||||
// if(isLegal){
|
||||
QStringList str_list = selectedDirectory.split("/");
|
||||
|
||||
|
|
|
@ -79,9 +79,11 @@ public:
|
|||
Q_SIGNALS:
|
||||
void readyToBuild();
|
||||
|
||||
void lineEditEdited(const QString& text);
|
||||
|
||||
private:
|
||||
QFileDialog *m_fd;
|
||||
QString m_iconthemename;
|
||||
QString m_iconpath;
|
||||
QListView *m_listview;
|
||||
QStandardItemModel *m_model;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QObject>
|
||||
#include <QStackedWidget>
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
|
@ -46,15 +47,32 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(m_cursorThemeWidget,&CursorThemeWidget::onBackButtonClicked,this,&MainWindow::backToCreateInterface);
|
||||
connect(m_globalThemeWidget,&GlobalThemeWidget::onBackButtonClicked,this,&MainWindow::backToCreateInterface);
|
||||
|
||||
connect(m_buildPackage,&QPushButton::clicked,this,[=](){
|
||||
qDebug()<<"-=============================";
|
||||
m_debMaker = new DebMaker(this);
|
||||
});
|
||||
connect(m_iconThemeWidget,&IconThemeWidget::onConfirmButtonClicked,this,&MainWindow::backToCreateInterface);
|
||||
connect(m_wallpaperThemeWidget,&WallpaperthemeWidget::onConfirmButtonClicked,this,&MainWindow::backToCreateInterface);
|
||||
connect(m_cursorThemeWidget,&CursorThemeWidget::onConfirmButtonClicked,this,&MainWindow::backToCreateInterface);
|
||||
connect(m_globalThemeWidget,&GlobalThemeWidget::onConfirmButtonClicked,this,&MainWindow::backToCreateInterface);
|
||||
|
||||
connect(m_iconThemeWidget, &IconThemeWidget::lineEditEdited, this, &MainWindow::updateIconThemeName);
|
||||
connect(m_wallpaperThemeWidget, &WallpaperthemeWidget::lineEditEdited, this, &MainWindow::updateWallPaperThemeName);
|
||||
connect(m_cursorThemeWidget, &CursorThemeWidget::lineEditEdited, this, &MainWindow::updateCursorThemeName);
|
||||
connect(m_globalThemeWidget, &GlobalThemeWidget::lineEditEdited, this, &MainWindow::updateGlobalThemeName);
|
||||
|
||||
connect(m_buildPackage,&QPushButton::clicked,this,&MainWindow::sendThemeName);
|
||||
|
||||
m_debMaker = new DebMaker(this);
|
||||
|
||||
connect(this, &MainWindow::sendIconthemename, m_debMaker, &DebMaker::receiveIconthemename);
|
||||
connect(this, &MainWindow::sendWallpaperthemename, m_debMaker, &DebMaker::receiveWallpaperthemename);
|
||||
connect(this, &MainWindow::sendCursorthemename, m_debMaker, &DebMaker::receiveCursorthemename);
|
||||
connect(this, &MainWindow::sendGlobalthemename, m_debMaker, &DebMaker::receiveGlobalthemename);
|
||||
// connect(m_buildPackage,&QPushButton::clicked,m_debMaker,&DebMaker::initControl);
|
||||
// connect(m_buildPackage,&QPushButton::clicked,m_debMaker,&DebMaker::initRules);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
FileOperate::deleteDirectoryFiles("/home/"+qgetenv("USER") +"/.cache/theme-build/");
|
||||
|
||||
delete m_interface;
|
||||
|
||||
delete m_createIconTheme;
|
||||
|
@ -71,10 +89,7 @@ void MainWindow::initUI()
|
|||
// 创建 QStackedWidget 对象
|
||||
m_stackWidget = new QStackedWidget(this);
|
||||
m_stackWidget->resize(480,580);
|
||||
|
||||
// 创建网格布局
|
||||
m_stackWidgetLayout = new QGridLayout(this);
|
||||
// 将 QStackedWidget 对象添加到网格布局中
|
||||
m_stackWidgetLayout->addWidget(m_stackWidget, 0, 0, 1, 1);
|
||||
|
||||
m_interface = new QWidget(this);
|
||||
|
@ -92,7 +107,15 @@ void MainWindow::initUI()
|
|||
QHBoxLayout *m_createIconThemeLayout = new QHBoxLayout();
|
||||
QLabel *m_createIconThemeLabel = new QLabel();
|
||||
m_createIconThemeLabel->setText("Create Icon theme");
|
||||
m_iconnamelabel = new QLabel();
|
||||
QLabel *iconlabel = new QLabel();
|
||||
QIcon icon = QIcon::fromTheme("kylin-boot-guide");
|
||||
iconlabel->setPixmap(icon.pixmap(QSize(24, 24)));
|
||||
|
||||
m_createIconThemeLayout->addWidget(m_createIconThemeLabel);
|
||||
m_createIconThemeLayout->addStretch(1);
|
||||
m_createIconThemeLayout->addWidget(m_iconnamelabel);
|
||||
m_createIconThemeLayout->addWidget(iconlabel);
|
||||
m_createIconTheme->setLayout(m_createIconThemeLayout);
|
||||
|
||||
//create cursor theme button
|
||||
|
@ -101,7 +124,15 @@ void MainWindow::initUI()
|
|||
QHBoxLayout *m_createCursorThemeLayout = new QHBoxLayout();
|
||||
QLabel *m_createCursorThemeLabel = new QLabel();
|
||||
m_createCursorThemeLabel->setText("Create Cursor theme");
|
||||
m_cursornamelabel = new QLabel();
|
||||
QLabel *iconlabel1 = new QLabel();
|
||||
QIcon icon1 = QIcon::fromTheme("kylin-boot-guide");
|
||||
iconlabel1->setPixmap(icon1.pixmap(QSize(24, 24)));
|
||||
|
||||
m_createCursorThemeLayout->addWidget(m_createCursorThemeLabel);
|
||||
m_createCursorThemeLayout->addStretch(1);
|
||||
m_createCursorThemeLayout->addWidget(m_cursornamelabel);
|
||||
m_createCursorThemeLayout->addWidget(iconlabel1);
|
||||
m_createCursorTheme->setLayout(m_createCursorThemeLayout);
|
||||
|
||||
//create wallpaper theme button
|
||||
|
@ -110,7 +141,14 @@ void MainWindow::initUI()
|
|||
QHBoxLayout *m_createWallpaperThemeLayout = new QHBoxLayout();
|
||||
QLabel *m_createWallpaperThemeLabel = new QLabel();
|
||||
m_createWallpaperThemeLabel->setText("Create Wallpaper theme");
|
||||
m_wallpapernamelabel = new QLabel();
|
||||
QLabel *iconlabel2 = new QLabel();
|
||||
QIcon icon2 = QIcon::fromTheme("kylin-boot-guide");
|
||||
iconlabel2->setPixmap(icon2.pixmap(QSize(24, 24)));
|
||||
m_createWallpaperThemeLayout->addWidget(m_createWallpaperThemeLabel);
|
||||
m_createWallpaperThemeLayout->addStretch(1);
|
||||
m_createWallpaperThemeLayout->addWidget(m_wallpapernamelabel);
|
||||
m_createWallpaperThemeLayout->addWidget(iconlabel2);
|
||||
m_createWallpaperTheme->setLayout(m_createWallpaperThemeLayout);
|
||||
|
||||
//create global theme button
|
||||
|
@ -119,7 +157,15 @@ void MainWindow::initUI()
|
|||
QHBoxLayout *m_createGlobalThemeLayout = new QHBoxLayout();
|
||||
QLabel *m_createGlobalThemeLabel = new QLabel();
|
||||
m_createGlobalThemeLabel->setText("Create Global theme");
|
||||
m_globalnamelabel = new QLabel();
|
||||
QLabel *iconlabel3 = new QLabel();
|
||||
QIcon icon3 = QIcon::fromTheme("kylin-boot-guide");
|
||||
iconlabel3->setPixmap(icon3.pixmap(QSize(24, 24)));
|
||||
|
||||
m_createGlobalThemeLayout->addWidget(m_createGlobalThemeLabel);
|
||||
m_createGlobalThemeLayout->addStretch(1);
|
||||
m_createGlobalThemeLayout->addWidget(m_globalnamelabel);
|
||||
m_createGlobalThemeLayout->addWidget(iconlabel3);
|
||||
m_createGlobalTheme->setLayout(m_createGlobalThemeLayout);
|
||||
|
||||
m_createThemeLayout->setSpacing(0);
|
||||
|
@ -180,16 +226,47 @@ void MainWindow::createGlobalClicked()
|
|||
m_stackWidget->setCurrentIndex(4);
|
||||
}
|
||||
|
||||
void MainWindow::createInterfaceHidden()
|
||||
{
|
||||
// m_createThemeInterface->setHidden(true);
|
||||
// m_buildPackage->setHidden(true);
|
||||
// m_backToCreateInterface->setHidden(false);
|
||||
// m_buildThemeCheck->setHidden(false);
|
||||
}
|
||||
|
||||
void MainWindow::backToCreateInterface()
|
||||
{
|
||||
m_stackWidget->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void MainWindow::updateIconThemeName(const QString& text)
|
||||
{
|
||||
m_iconthemename = text;
|
||||
m_iconnamelabel->setText(m_iconthemename);
|
||||
}
|
||||
|
||||
void MainWindow::updateWallPaperThemeName(const QString &text)
|
||||
{
|
||||
m_wallpaperthemename = text;
|
||||
m_wallpapernamelabel->setText(m_iconthemename);
|
||||
}
|
||||
|
||||
void MainWindow::updateCursorThemeName(const QString &text)
|
||||
{
|
||||
m_cursorthemename = text;
|
||||
m_cursornamelabel->setText(m_cursorthemename);
|
||||
}
|
||||
|
||||
void MainWindow::updateGlobalThemeName(const QString &text)
|
||||
{
|
||||
m_globalthemename = text;
|
||||
m_globalnamelabel->setText(m_globalthemename);
|
||||
}
|
||||
|
||||
void MainWindow::sendThemeName()
|
||||
{
|
||||
if("" != m_iconthemename){
|
||||
emit sendIconthemename(m_iconthemename);
|
||||
}
|
||||
if("" != m_wallpaperthemename){
|
||||
emit sendWallpaperthemename(m_wallpaperthemename);
|
||||
}
|
||||
if("" != m_cursorthemename){
|
||||
emit sendCursorthemename(m_cursorthemename);
|
||||
}
|
||||
if("" != m_globalthemename){
|
||||
emit sendGlobalthemename(m_globalthemename);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,11 @@ public:
|
|||
QPushButton *m_createWallpaperTheme;
|
||||
QPushButton *m_createGlobalTheme;
|
||||
|
||||
QLabel *m_iconnamelabel;
|
||||
QLabel *m_cursornamelabel;
|
||||
QLabel *m_wallpapernamelabel;
|
||||
QLabel *m_globalnamelabel;
|
||||
|
||||
QWidget *m_buildThemeInterface;
|
||||
//打包按钮
|
||||
QPushButton *m_buildPackage;
|
||||
|
@ -59,9 +64,22 @@ public:
|
|||
CursorThemeWidget *m_cursorThemeWidget;
|
||||
GlobalThemeWidget *m_globalThemeWidget;
|
||||
DebMaker* m_debMaker;
|
||||
|
||||
Q_SIGNALS:
|
||||
void readToBuild();
|
||||
|
||||
void sendIconthemename(const QString& iconthemename);
|
||||
void sendWallpaperthemename(const QString& wallpaperthemename);
|
||||
void sendCursorthemename(const QString& cursorthemename);
|
||||
void sendGlobalthemename(const QString& globalthemename);
|
||||
|
||||
public slots:
|
||||
void sendThemeName();
|
||||
void updateIconThemeName(const QString& text);
|
||||
void updateWallPaperThemeName(const QString& text);
|
||||
void updateCursorThemeName(const QString& text);
|
||||
void updateGlobalThemeName(const QString& text);
|
||||
|
||||
private:
|
||||
|
||||
void createIconClicked();
|
||||
|
@ -69,11 +87,13 @@ private:
|
|||
void createCursorClicked();
|
||||
void createGlobalClicked();
|
||||
|
||||
void createInterfaceHidden();
|
||||
void createInterfaceShow();
|
||||
|
||||
void backToCreateInterface();
|
||||
void buildThemesCheck();
|
||||
|
||||
QString m_iconthemename = "";
|
||||
QString m_wallpaperthemename = "";
|
||||
QString m_cursorthemename = "";
|
||||
QString m_globalthemename = "";
|
||||
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -7,14 +7,21 @@ WallpaperthemeWidget::WallpaperthemeWidget(QWidget *parent) : WidgetBase(parent)
|
|||
this->initImportButton("导入图片");
|
||||
init();
|
||||
connect(m_importButton , &QPushButton::clicked, this, [=](){
|
||||
this->importWallpaper();
|
||||
});
|
||||
this->importWallpaper();
|
||||
});
|
||||
|
||||
connect(m_confirmButton,&QPushButton::clicked,this,[=](){
|
||||
if("" != m_nameLineEdit->text()){
|
||||
m_wallpaperthemename = m_nameLineEdit->text();
|
||||
emit lineEditEdited(m_wallpaperthemename);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void WallpaperthemeWidget::init()
|
||||
{
|
||||
QString name = qgetenv("USER");
|
||||
m_wallpaperpath = HOMEPATH +name + "/.cache/theme-build/wallpapers/";
|
||||
QString name = "/.cache/theme-build/"+WidgetBase::getSharedTimeString()+"/wallpapers/";
|
||||
m_wallpaperpath = QDir::homePath() +name;
|
||||
|
||||
QWidget* newWidget = new QWidget(this);
|
||||
|
||||
|
@ -37,7 +44,7 @@ void WallpaperthemeWidget::init()
|
|||
QStringList fileNames = QDir(fixedPath).entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||
foreach (QString fileName, fileNames) {
|
||||
QString imgpath = m_wallpaperpath+fileName;
|
||||
QListWidgetItem *item = new QListWidgetItem(/*fileName*/);
|
||||
QListWidgetItem *item = new QListWidgetItem(fileName);
|
||||
|
||||
item->setIcon(QIcon(imgpath));
|
||||
m_listwidget->addItem(item);
|
||||
|
@ -47,8 +54,7 @@ void WallpaperthemeWidget::init()
|
|||
|
||||
int row = m_listwidget->row(item);
|
||||
|
||||
QString clicked_path = m_wallpaperpath+m_listwidget->currentItem()->data(Qt::DisplayRole).toString();
|
||||
|
||||
QString clicked_path = m_wallpaperpath+m_listwidget->currentItem()->data(Qt::UserRole).toString();
|
||||
QFile::remove(clicked_path);
|
||||
m_listwidget->takeItem(row);
|
||||
delete item;
|
||||
|
@ -68,7 +74,7 @@ void WallpaperthemeWidget::importWallpaper()
|
|||
m_fd->setViewMode(QFileDialog::List);
|
||||
m_fd->setNameFilter(filters);
|
||||
m_fd->setFileMode(QFileDialog::ExistingFile);
|
||||
m_fd->setDirectory(HOMEPATH+qgetenv("USER"));
|
||||
m_fd->setDirectory(QDir::homePath());
|
||||
m_fd->setWindowTitle(tr("Select Import Wallpapers"));
|
||||
m_fd->setLabelText(QFileDialog::Accept, tr("Select"));
|
||||
m_fd->setLabelText(QFileDialog::Reject, tr("Cancel"));
|
||||
|
|
|
@ -16,12 +16,13 @@ public:
|
|||
|
||||
void importWallpaper();
|
||||
void openFileDialog();
|
||||
signals:
|
||||
|
||||
Q_SIGNALS:
|
||||
void lineEditEdited(const QString& text);
|
||||
private:
|
||||
QFileDialog *m_fd;
|
||||
QString m_wallpaperpath;
|
||||
|
||||
QString m_wallpaperthemename;
|
||||
QListWidget *m_listwidget;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
#include "widgetbase.h"
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
|
||||
QString WidgetBase::m_date;
|
||||
|
||||
WidgetBase::WidgetBase(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
if (m_date.isEmpty()) {
|
||||
QDateTime currentDateTime = QDateTime::currentDateTime();
|
||||
m_date = currentDateTime.toString("yyyyMMddhhmmss");
|
||||
}
|
||||
|
||||
this->setAutoFillBackground(true);
|
||||
this->setBackgroundRole(QPalette::Base);
|
||||
m_allLayout = new QVBoxLayout;
|
||||
|
@ -14,7 +23,7 @@ WidgetBase::WidgetBase(QWidget *parent) : QWidget(parent)
|
|||
// m_themeLabel->setText(QString("创建主题图标"));
|
||||
|
||||
m_nameLineEdit = new QLineEdit(m_headWidget);
|
||||
|
||||
m_nameLineEdit->setPlaceholderText("输入主题名称");
|
||||
m_importButton = new QPushButton(m_headWidget);
|
||||
m_importButton->setFixedSize(QSize(96,36));
|
||||
// m_importButton->setText(QString("导入图标"));
|
||||
|
@ -61,6 +70,11 @@ WidgetBase::~WidgetBase()
|
|||
delete m_buttonLayout;
|
||||
}
|
||||
|
||||
QString WidgetBase::getSharedTimeString()
|
||||
{
|
||||
return m_date;
|
||||
}
|
||||
|
||||
void WidgetBase::initThemeLabel(QString text)
|
||||
{
|
||||
if(NULL != text){
|
||||
|
|
|
@ -11,20 +11,22 @@
|
|||
|
||||
#include "fileoperate.h"
|
||||
|
||||
#define HOMEPATH "/home/"
|
||||
|
||||
class WidgetBase : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WidgetBase(QWidget *parent = nullptr);
|
||||
virtual ~WidgetBase();
|
||||
|
||||
static QString getSharedTimeString();
|
||||
void initThemeLabel(QString text);
|
||||
void initImportButton(QString text);
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
private:
|
||||
static QString m_date;
|
||||
|
||||
protected:
|
||||
// virtual void init();
|
||||
QVBoxLayout *m_allLayout;
|
||||
|
|
Loading…
Reference in New Issue