!16 增加文件处理

Merge pull request !16 from KevinDuan/2.0
This commit is contained in:
likehomedream 2023-09-05 02:21:17 +00:00 committed by Gitee
commit f6939945e0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 680 additions and 1 deletions

View File

@ -18,10 +18,13 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \ SOURCES += \
src/cursorthemefeature.cpp \ src/cursorthemefeature.cpp \
src/cursorthemewidget.cpp \ src/cursorthemewidget.cpp \
src/fileprocess.cpp \
src/globalthemefeature.cpp \ src/globalthemefeature.cpp \
src/globalthemewidget.cpp \ src/globalthemewidget.cpp \
src/iconthemewidget.cpp \ src/iconthemewidget.cpp \
src/iconwidgetfeature.cpp \ src/iconwidgetfeature.cpp \
src/infocreatefeature.cpp \
src/infocreatewidget.cpp \
src/main.cpp \ src/main.cpp \
src/maininterface.cpp \ src/maininterface.cpp \
src/mainwindow.cpp \ src/mainwindow.cpp \
@ -30,10 +33,13 @@ SOURCES += \
HEADERS += \ HEADERS += \
src/cursorthemefeature.h \ src/cursorthemefeature.h \
src/cursorthemewidget.h \ src/cursorthemewidget.h \
src/fileprocess.h \
src/globalthemefeature.h \ src/globalthemefeature.h \
src/globalthemewidget.h \ src/globalthemewidget.h \
src/iconthemewidget.h \ src/iconthemewidget.h \
src/iconwidgetfeature.h \ src/iconwidgetfeature.h \
src/infocreatefeature.h \
src/infocreatewidget.h \
src/maininterface.h \ src/maininterface.h \
src/mainwindow.h \ src/mainwindow.h \
src/titlebar.h src/titlebar.h

View File

@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 6.0.2, 2023-09-04T17:30:58. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{d45cb136-b7fa-4602-8e06-0fe9f55982ae}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">4</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{79fb097c-bd96-4583-b07f-5f8807181fba}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/kevin/test/gitee/test/test/test/build-kylin-theme-builder-unknown-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/kevin/test/gitee/test/test/test/build-kylin-theme-builder-unknown-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/kevin/test/gitee/test/test/test/build-kylin-theme-builder-unknown-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/kevin/test/gitee/test/test/test/build-kylin-theme-builder-unknown-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/kevin/test/gitee/test/test/test/build-kylin-theme-builder-unknown-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/kevin/test/gitee/test/test/test/build-kylin-theme-builder-unknown-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

37
src/fileprocess.cpp Normal file
View File

@ -0,0 +1,37 @@
#include "fileprocess.h"
FileProcess::FileProcess()
{
//创建缓存目录
m_builder = QDir::homePath()+"/.cache/theme-build/";
if (m_builder.exists()){
qDebug()<<"thmem-build cache Dir exists";
} else {
m_builder.mkdir(m_builder.absolutePath());
qDebug()<<"thmem-build cache Dir create";
}
return;
}
void FileProcess::FileSearch(){
}
QString FileProcess::FileCreate(const QString &m_themeType){
QDateTime currentDateTime = QDateTime::currentDateTime();
m_date = currentDateTime.toString("yyyyMMddhhmmss");
qDebug()<< m_date;
//创建新的记录文件目录
QString m_themePath = QDir::homePath() + "/.cache/theme-build/" + m_date;
QDir m_builderTime = m_themePath;
QDir m_builderDeb = m_themePath + "/debian";
QDir m_themeTypePath = m_themePath + "/" + m_themeType;
m_builderTime.mkdir(m_builderTime.absolutePath());
m_builderTime.mkdir(m_builderDeb.absolutePath());
m_themeTypePath.mkdir(m_themeTypePath.absolutePath());
return m_date;
}

23
src/fileprocess.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef FILEPROCESS_H
#define FILEPROCESS_H
#include <QObject>
#include <QDir>
#include <QDateTime>
#include <QDebug>
#include <QStandardPaths>
class FileProcess
{
public:
FileProcess();
void FileSearch();
QString FileCreate(const QString &themes);
private:
QDir m_builder;
QString m_date;
};
#endif // FILEPROCESS_H

View File

@ -0,0 +1,7 @@
#include "infocreatefeature.h"
//theme info proecessing
InfoCreateFeature::InfoCreateFeature()
{
}

18
src/infocreatefeature.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef INFOCREATEFEATURE_H
#define INFOCREATEFEATURE_H
#include <QObject>
#include <QDir>
#include <QDateTime>
#include <QDebug>
class InfoCreateFeature
{
public:
InfoCreateFeature();
private:
};
#endif // INFOCREATEFEATURE_H

245
src/infocreatewidget.cpp Normal file
View File

@ -0,0 +1,245 @@
#include "infocreatewidget.h"
//create theme info graphical interface
InfoCreateWidget::InfoCreateWidget(QWidget *parent, const QString &m_date,
const QString &m_state) : QWidget(parent)
{
this->setFixedSize(424,404);
this->setWindowModality(Qt::ApplicationModal);
InitThemeName();
InitBuilderInfo();
InitInfoBtn(m_state);
InfoProcess(m_date);
m_warningMessage = new QLabel();
m_warningMessage->setText("");
m_warningMessage2 = new QLabel();
m_warningMessage2->setText("");
m_warningMessage3 = new QLabel();
m_warningMessage3->setText("");
m_warningMessage4 = new QLabel();
m_warningMessage4->setText("");
QVBoxLayout *m_infoCreateLayout = new QVBoxLayout(this);
m_infoCreateLayout->addLayout(m_themeNameCNLayout);
m_infoCreateLayout->addWidget(m_warningMessage);
m_infoCreateLayout->addLayout(m_themeNameENLayout);
m_infoCreateLayout->addWidget(m_warningMessage2);
m_infoCreateLayout->addLayout(m_builderNameLayout);
m_infoCreateLayout->addWidget(m_warningMessage3);
m_infoCreateLayout->addLayout(m_builderMailLayout);
m_infoCreateLayout->addWidget(m_warningMessage4);
m_infoCreateLayout->addLayout(m_infoBtnLayout);
this->setLayout(m_infoCreateLayout);
}
void InfoCreateWidget::InitThemeName(){
m_themeNameCNLayout = new QHBoxLayout();
m_themeNameCNLabel = new QLabel();
m_themeNameCNLineEdit = new QLineEdit();
m_themeNameCNLabel->setText("ThemeName-CN");
m_themeNameCNLineEdit->setEchoMode(QLineEdit::Normal);
m_themeNameCNLayout->addWidget(m_themeNameCNLabel);
m_themeNameCNLayout->addWidget(m_themeNameCNLineEdit);
m_themeNameENLayout = new QHBoxLayout();
m_themeNameENLabel = new QLabel();
m_themeNameENLineEdit = new QLineEdit();
m_themeNameENLabel->setText("ThemeName-EN");
m_themeNameENLineEdit->setEchoMode(QLineEdit::Normal);
m_themeNameENLayout->addWidget(m_themeNameENLabel);
m_themeNameENLayout->addWidget(m_themeNameENLineEdit);
}
void InfoCreateWidget::InitBuilderInfo(){
m_builderNameLayout = new QHBoxLayout();
m_builderNameLabel = new QLabel();
m_builderNameLineEdit = new QLineEdit();
m_builderNameLabel->setText("Builder Name");
m_builderNameLineEdit->setEchoMode(QLineEdit::Normal);
m_builderNameLayout->addWidget(m_builderNameLabel);
m_builderNameLayout->addWidget(m_builderNameLineEdit);
m_builderMailLayout = new QHBoxLayout();
m_builderMailLabel = new QLabel();
m_builderMailLineEdit = new QLineEdit();
m_builderMailLabel->setText("Builder Mail");
m_builderMailLineEdit->setEchoMode(QLineEdit::Normal);
m_builderMailLayout->addWidget(m_builderMailLabel);
m_builderMailLayout->addWidget(m_builderMailLineEdit);
}
void InfoCreateWidget::InitInfoBtn(const QString &m_state){
m_infoBtnLayout = new QHBoxLayout();
m_exitBtn = new QPushButton();
m_recogniseBtn = new QPushButton();
m_createDebBtn = new QPushButton();
m_exitBtn->setText("Back");
m_recogniseBtn->setText("OK");
m_createDebBtn->setText("Create");
m_infoBtnLayout->addWidget(m_exitBtn);
m_infoBtnLayout->addWidget(m_recogniseBtn);
m_infoBtnLayout->addWidget(m_createDebBtn);
if(m_state == "recognise"){
m_recogniseBtn->setHidden(false);
m_recogniseBtn->setEnabled(false);
m_createDebBtn->setHidden(true);
} else if(m_state == "create"){
m_recogniseBtn->setHidden(true);
m_createDebBtn->setHidden(false);
} else {
qDebug() << m_state;
}
}
void InfoCreateWidget::InfoProcess(const QString &m_date){
// 监听文本变化
QObject::connect(m_themeNameCNLineEdit, &QLineEdit::textChanged, [this]() {
m_warningMessage->setText("11111111111");
});
QObject::connect(m_themeNameENLineEdit, &QLineEdit::textChanged, [this]() {
m_themeENName = m_themeNameENLineEdit->text();
QRegExp englishRegexp("[A-Za-z0-9]+$");
if(m_themeNameENLineEdit != nullptr){
if (englishRegexp.exactMatch(m_themeENName)){
m_warningMessage2->setText("");
m_themeENNameState = true;
if (m_themeENNameState && m_builderMailState && m_builderNameState){
m_recogniseBtn->setEnabled(true);
}
} else {
QPalette m_fontqpe;
m_fontqpe.setColor(QPalette::WindowText,Qt::red);
m_warningMessage2->setPalette(m_fontqpe);
m_warningMessage2->setText("输入格式错误!");
m_themeENNameState = false;
}
} else {
QPalette m_fontqpe;
m_fontqpe.setColor(QPalette::WindowText,Qt::red);
m_warningMessage2->setPalette(m_fontqpe);
m_warningMessage2->setText("输入为空!");
m_themeENNameState = false;
}
});
QObject::connect(m_builderNameLineEdit, &QLineEdit::textChanged, [this]() {
m_builderName = m_builderNameLineEdit->text();
QRegExp englishRegexp("[A-Za-z0-9]+$");
if(m_themeNameENLineEdit != nullptr){
if (englishRegexp.exactMatch(m_builderName)){
m_warningMessage3->setText("");
m_builderNameState = true;
if (m_themeENNameState && m_builderMailState && m_builderNameState){
m_recogniseBtn->setEnabled(true);
}
} else {
QPalette m_fontqpe;
m_fontqpe.setColor(QPalette::WindowText,Qt::red);
m_warningMessage3->setPalette(m_fontqpe);
m_warningMessage3->setText("输入格式错误!");
m_builderNameState = false;
}
} else {
QPalette m_fontqpe;
m_fontqpe.setColor(QPalette::WindowText,Qt::red);
m_warningMessage3->setPalette(m_fontqpe);
m_warningMessage3->setText("输入为空!");
m_builderNameState = false;
}
});
QObject::connect(m_builderMailLineEdit, &QLineEdit::textChanged, [this]() {
m_builderMail = m_builderMailLineEdit->text();
QRegExp mailRegexp("\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b");
if(m_themeNameENLineEdit != nullptr){
if (mailRegexp.exactMatch(m_builderMail)){
m_warningMessage4->setText("");
m_builderMailState = true;
if (m_themeENNameState && m_builderNameState && m_builderMailState){
m_recogniseBtn->setEnabled(true);
}
} else {
QPalette m_fontqpe;
m_fontqpe.setColor(QPalette::WindowText,Qt::red);
m_warningMessage4->setPalette(m_fontqpe);
m_warningMessage4->setText("输入格式错误!");
m_builderMailState = false;
}
} else {
QPalette m_fontqpe;
m_fontqpe.setColor(QPalette::WindowText,Qt::red);
m_warningMessage4->setPalette(m_fontqpe);
m_warningMessage4->setText("输入为空!");
m_builderMailState = false;
}
});
//退出信息收集页面
connect(m_exitBtn, &QPushButton::clicked,this,[=](){
this->close();
});
//创建control/changelog文件
connect(m_recogniseBtn, &QPushButton::clicked,this,[=](){
QFile m_control(QDir::homePath() + "/.cache/theme-build/" + m_date + "/debian/control");
if (m_control.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
qDebug()<< m_control;
QTextStream m_controlStream(&m_control);
m_controlStream << QStringLiteral("Source: ") + m_themeENName;
m_controlStream << endl << QStringLiteral("Section: misc");
m_controlStream << endl << QStringLiteral("Priority: optional");
m_controlStream << endl << QStringLiteral("Maintainer: ") + m_builderName + QStringLiteral(" <") + m_builderMail + QStringLiteral(">");
m_controlStream << endl << QStringLiteral("Build-Depends: debhelper-compat (= 13), dh-python, python3-setuptools, python3-all");
m_controlStream << endl << QStringLiteral("Standards-Version: 4.6.0");
m_controlStream << endl << QStringLiteral("Rules-Requires-Root: no");
m_controlStream << endl;
m_controlStream << endl << QStringLiteral("Package: ") + m_themeENName;
m_controlStream << endl << QStringLiteral("Architecture: all");
m_controlStream << endl << QStringLiteral("Depends: ${python3:Depends}, ${misc:Depends}");
m_controlStream << endl << QStringLiteral("Description: Theme Package ") + m_themeENName;
}
QFile m_changelog(QDir::homePath() + "/.cache/theme-build/" + m_date + "/debian/changelog");
if (m_changelog.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)){
QTextStream m_changelogStream(&m_changelog);
m_changelogStream << m_themeENName + QStringLiteral(" (1.0-1) UNRELEASED; urgency=medium");
m_changelogStream << endl;
m_changelogStream << endl << QStringLiteral(" * Initial release");
m_changelogStream << endl;
m_changelogStream << endl << QStringLiteral(" -- ") + m_builderName + QStringLiteral(" <") + m_builderMail
+ QStringLiteral("> Wed, 30 Aug 2023 14:42:06 +0800");
}
this->close();
});
//获取已输入信息,再次确认后开始编译
connect(m_createDebBtn,&QPushButton::clicked,this,[=](){
});
}

74
src/infocreatewidget.h Normal file
View File

@ -0,0 +1,74 @@
#ifndef INFOCREATEWIDGET_H
#define INFOCREATEWIDGET_H
#include "fileprocess.h"
#include "infocreatefeature.h"
#include <QWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QButtonGroup>
#include <QPainter>
#include <QScrollArea>
#include <QLabel>
#include <QMap>
#include <QDebug>
#include <QFileDialog>
#include <QStackedWidget>
#include <QObject>
#include <QWidget>
#include <QLineEdit>
#include <QRegExp>
#include <QRegularExpressionValidator>
class InfoCreateWidget : public QWidget
{
Q_OBJECT
public:
// explicit InfoCreateWidget(QWidget *parent = nullptr);
explicit InfoCreateWidget(QWidget *parent, const QString &m_date, const QString &m_state);
void InitThemeName();
void InitBuilderInfo();
void InitInfoBtn(const QString &m_state);
void InfoProcess(const QString &m_date);
void InfoCreateBtn();
QString m_themeENName;
QString m_builderMail;
QString m_builderName;
signals:
private:
QLabel *m_warningMessage;
QLabel *m_warningMessage2;
QLabel *m_warningMessage3;
QLabel *m_warningMessage4;
QHBoxLayout *m_themeNameCNLayout;
QLabel *m_themeNameCNLabel;
QLineEdit *m_themeNameCNLineEdit;
QHBoxLayout *m_themeNameENLayout;
QLabel *m_themeNameENLabel;
QLineEdit *m_themeNameENLineEdit;
QHBoxLayout *m_builderNameLayout;
QLabel *m_builderNameLabel;
QLineEdit *m_builderNameLineEdit;
QHBoxLayout *m_builderMailLayout;
QLabel *m_builderMailLabel;
QLineEdit *m_builderMailLineEdit;
QHBoxLayout *m_infoBtnLayout;
QPushButton *m_exitBtn;
QPushButton *m_recogniseBtn;
QPushButton *m_createDebBtn;
bool m_themeENNameState;
bool m_builderNameState;
bool m_builderMailState;
};
#endif // INFOCREATEWIDGET_H

View File

@ -5,6 +5,7 @@
#include "iconthemewidget.h" #include "iconthemewidget.h"
#include "globalthemewidget.h" #include "globalthemewidget.h"
#include "cursorthemewidget.h" #include "cursorthemewidget.h"
#include "infocreatewidget.h"
#include "titlebar.h" #include "titlebar.h"
#include <QWidget> #include <QWidget>

View File

@ -4,7 +4,7 @@
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
{ {
setWindowFlags(Qt::FramelessWindowHint); // setWindowFlags(Qt::FramelessWindowHint);
initUI(); initUI();
m_titlebar = new TitleBar(this); m_titlebar = new TitleBar(this);
@ -16,6 +16,7 @@ MainWindow::MainWindow(QWidget *parent)
setCentralWidget(centralWidget); setCentralWidget(centralWidget);
setMouseTracking(true); setMouseTracking(true);
connect(m_titlebar, &TitleBar::gohomesignal, this, &MainWindow::onGoHomeClicked); connect(m_titlebar, &TitleBar::gohomesignal, this, &MainWindow::onGoHomeClicked);
FileProcess();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -65,14 +66,20 @@ void MainWindow::initUI()
connect(m_globalbtn, &QPushButton::clicked, [=]() { connect(m_globalbtn, &QPushButton::clicked, [=]() {
m_stackedWidget->setCurrentWidget(m_maininterface); m_stackedWidget->setCurrentWidget(m_maininterface);
m_maininterface->setGlobalTheme(); m_maininterface->setGlobalTheme();
InfoCreateWidget *m_infoCreateWidget = new InfoCreateWidget(nullptr,m_fileProcess.FileCreate("globalTheme"),"recognise");
m_infoCreateWidget->show();
}); });
connect(m_iconbtn, &QPushButton::clicked, [=]() { connect(m_iconbtn, &QPushButton::clicked, [=]() {
m_stackedWidget->setCurrentWidget(m_maininterface); m_stackedWidget->setCurrentWidget(m_maininterface);
m_maininterface->setIconTheme(); m_maininterface->setIconTheme();
InfoCreateWidget *m_infoCreateWidget = new InfoCreateWidget(nullptr,m_fileProcess.FileCreate("iconTheme"),"recognise");
m_infoCreateWidget->show();
}); });
connect(m_cursorbtn, &QPushButton::clicked, [=]() { connect(m_cursorbtn, &QPushButton::clicked, [=]() {
m_stackedWidget->setCurrentWidget(m_maininterface); m_stackedWidget->setCurrentWidget(m_maininterface);
m_maininterface->setCursorTheme(); m_maininterface->setCursorTheme();
InfoCreateWidget *m_infoCreateWidget = new InfoCreateWidget(nullptr,m_fileProcess.FileCreate("cursorTheme"),"recognise");
m_infoCreateWidget->show();
}); });
} }

View File

@ -67,6 +67,7 @@ private:
EntryButton *m_iconbtn; EntryButton *m_iconbtn;
EntryButton *m_cursorbtn; EntryButton *m_cursorbtn;
MainInterface *m_maininterface; MainInterface *m_maininterface;
FileProcess m_fileProcess;
TitleBar*m_titlebar; TitleBar*m_titlebar;
QPoint m_dragStartPosition; QPoint m_dragStartPosition;
QPoint m_dragPosition; QPoint m_dragPosition;