chore: update files of project

This commit is contained in:
x-tools-author 2024-04-10 23:21:59 +08:00
parent c8ffc9e024
commit 8ef703c072
5 changed files with 23 additions and 12 deletions

View File

@ -1,6 +1,6 @@
add_compile_definitions(X_TOOLS_AUTHOR="x-tools-author") add_compile_definitions(X_TOOLS_AUTHOR="x-tools-author")
add_compile_definitions(X_TOOLS_EDITION="beta1") add_compile_definitions(X_TOOLS_EDITION="beta1")
add_compile_definitions(X_TOOLS_VERSION="5.0.0") add_compile_definitions(X_TOOLS_VERSION="6.0.0")
add_compile_definitions(X_TOOLS_DEFAULT_APP_STYLE="Fusion") add_compile_definitions(X_TOOLS_DEFAULT_APP_STYLE="Fusion")
add_compile_definitions(X_TOOLS_CLEAR_MESSAGE_INTERVAL=8000) add_compile_definitions(X_TOOLS_CLEAR_MESSAGE_INTERVAL=8000)
add_compile_definitions(X_TOOLS_AUTHOR_EMAIL="x-tools@outlook.com") add_compile_definitions(X_TOOLS_AUTHOR_EMAIL="x-tools@outlook.com")

View File

@ -25,6 +25,9 @@
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
#include "xToolsDataStructure.h" #include "xToolsDataStructure.h"
#endif #endif
#ifdef X_TOOLS_ENABLE_ADVANCED_STYLESHEET
#include "xToolsStyleSheetManager.h"
#endif
#ifdef X_TOOLS_IMPORT_MODULE_GLOG #ifdef X_TOOLS_IMPORT_MODULE_GLOG
static void xToolsInitGoogleLogging(char *argv0) static void xToolsInitGoogleLogging(char *argv0)
@ -194,7 +197,16 @@ int xToolsExec(int argc, char *argv[], const QString &appName)
AppT app(argc, argv); AppT app(argc, argv);
const QString dtStr = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"); const QString dtStr = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss");
xToolsSettings::instance()->setValue("startUpTime", dtStr); xToolsSettings::instance()->setValue("startUpTime", dtStr);
#ifdef X_TOOLS_ENABLE_ADVANCED_STYLESHEET
auto &styleSheetManager = xToolsStyleSheetManager::instance();
const QString styleSheet = styleSheetManager.styleSheet();
if (!styleSheet.isEmpty() && !styleSheetManager.currentTheme().isEmpty()) {
app.setStyleSheet(styleSheet);
}
#else
xToolsInitAppStyle(); xToolsInitAppStyle();
#endif
QWidget *ui; QWidget *ui;
if (xToolsIsSameType<MainWindowT, CentralWidgetT>()) { if (xToolsIsSameType<MainWindowT, CentralWidgetT>()) {

View File

@ -43,11 +43,6 @@ xToolsMainWindow::xToolsMainWindow(QWidget* parent)
m_xToolsApp = dynamic_cast<xToolsApplication*>(qApp); m_xToolsApp = dynamic_cast<xToolsApplication*>(qApp);
Q_ASSERT_X(m_xToolsApp, Q_FUNC_INFO, "The application is not xToolsApplication."); Q_ASSERT_X(m_xToolsApp, Q_FUNC_INFO, "The application is not xToolsApplication.");
#ifdef X_TOOLS_ENABLE_ADVANCED_STYLESHEET
auto& styleSheetManager = xToolsStyleSheetManager::instance();
styleSheetManager.setThemeName(styleSheetManager.themeName());
#endif
m_appStyleActionGroup = new QActionGroup(this); m_appStyleActionGroup = new QActionGroup(this);
m_languageActionGroup = new QActionGroup(this); m_languageActionGroup = new QActionGroup(this);
m_appPaletteActionGroup = new QActionGroup(this); m_appPaletteActionGroup = new QActionGroup(this);
@ -56,6 +51,12 @@ xToolsMainWindow::xToolsMainWindow(QWidget* parent)
initMenuOption(); initMenuOption();
initMenuLanguage(); initMenuLanguage();
initMenuHelp(); initMenuHelp();
#ifdef X_TOOLS_ENABLE_ADVANCED_STYLESHEET
connect(&xToolsStyleSheetManager::instance(),
&xToolsStyleSheetManager::stylesheetChanged,
this,
[=]() { tryToReboot(); });
#endif
} }
QString xToolsMainWindow::qtConfFileName() QString xToolsMainWindow::qtConfFileName()

View File

@ -56,13 +56,11 @@ QString xToolsStyleSheetManager::themeName()
void xToolsStyleSheetManager::setThemeName(const QString& themeName) void xToolsStyleSheetManager::setThemeName(const QString& themeName)
{ {
qInfo() << "The stylesheet is setting to: " << themeName;
setCurrentTheme(themeName); setCurrentTheme(themeName);
qInfo() << "The stylesheet is updating...";
updateStylesheet(); updateStylesheet();
qInfo() << "The stylesheet is setting to the application..."; #if 0
qApp->setStyleSheet(styleSheet()); qApp->setStyleSheet(styleSheet());
xToolsSettings::instance()->setValue("themeName", themeName); #endif
qInfo() << "The stylesheet has been changed: " << this->currentTheme(); qInfo() << "The stylesheet has been changed: " << this->currentTheme();
} }
@ -105,4 +103,4 @@ void xToolsStyleSheetManager::loadThemes()
setupActions(m_darkThemes, m_darkThemeMenu, m_darkThemeActionGroup); setupActions(m_darkThemes, m_darkThemeMenu, m_darkThemeActionGroup);
setupActions(m_lightThemes, m_lightThemeMenu, m_lightThemeActionGroup); setupActions(m_lightThemes, m_lightThemeMenu, m_lightThemeActionGroup);
} }

View File

@ -21,7 +21,7 @@ X_TOOLS_ORG_NAME = "xTools"
X_TOOLS_ORG_DOMAIN = "IT" X_TOOLS_ORG_DOMAIN = "IT"
X_TOOLS_APP_DESCRIPTION = "xTools Studio" X_TOOLS_APP_DESCRIPTION = "xTools Studio"
X_TOOLS_APP_COPYRIGHT = "Copyright 2018-2024 x-tools-author(x-tools@outlook.com). All rights reserved." X_TOOLS_APP_COPYRIGHT = "Copyright 2018-2024 x-tools-author(x-tools@outlook.com). All rights reserved."
X_TOOLS_VERSION = "5.0.0" X_TOOLS_VERSION = "6.0.0"
win32 { win32 {
QMAKE_TARGET_COMPANY = "$${X_TOOLS_ORG_NAME}" QMAKE_TARGET_COMPANY = "$${X_TOOLS_ORG_NAME}"