mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
chore: update files of project
This commit is contained in:
parent
9ed7c20312
commit
0e29492e59
@ -1,9 +1,8 @@
|
||||
add_compile_definitions(X_TOOLS_AUTHOR="x-tools-author")
|
||||
add_compile_definitions(SAK_EDITION="beta1")
|
||||
add_compile_definitions(SAK_VERSION="5.1.0")
|
||||
add_compile_definitions(SAK_STYLE_DEFAULT="Fusion")
|
||||
add_compile_definitions(SAK_HOST_ADDRESS_ANY="Any")
|
||||
add_compile_definitions(SAK_CLEAR_MESSAGE_INTERVAL=8000)
|
||||
add_compile_definitions(X_TOOL_EDITION="beta1")
|
||||
add_compile_definitions(X_TOOLS_VERSION="5.1.0")
|
||||
add_compile_definitions(X_TOOLS_DEFAULT_APP_STYLE="Fusion")
|
||||
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_GITEE_REPOSITORY_URL="https://gitee.com/x-tools-author/x-tools")
|
||||
add_compile_definitions(X_TOOLS_GITHUB_REPOSITORY_URL="https://github.com/x-tools-author/x-tools")
|
||||
|
||||
@ -57,7 +57,7 @@ xToolsFileCheckAssistant::xToolsFileCheckAssistant(QWidget* parent)
|
||||
|
||||
// It will clean the message which was showed on the info label when the timer
|
||||
// is timeout
|
||||
m_clearMessageTimer.setInterval(SAK_CLEAR_MESSAGE_INTERVAL);
|
||||
m_clearMessageTimer.setInterval(X_TOOLS_CLEAR_MESSAGE_INTERVAL);
|
||||
connect(&m_clearMessageTimer, &QTimer::timeout, this, &xToolsFileCheckAssistant::clearMessage);
|
||||
|
||||
m_upperCheckBox->setChecked(true);
|
||||
|
||||
@ -21,11 +21,10 @@
|
||||
#include "xToolsInterface.h"
|
||||
#endif
|
||||
#include "xToolsSettings.h"
|
||||
#include "xToolsTranslator.h"
|
||||
|
||||
#ifdef X_TOOLS_USING_GLOG
|
||||
|
||||
static void sakInitGoogleLogging(char *argv0)
|
||||
static void xToolsInitGoogleLogging(char *argv0)
|
||||
{
|
||||
QString logPath = SAKSettings::instance()->settingsPath();
|
||||
logPath += "/log";
|
||||
@ -52,7 +51,7 @@ static void sakInitGoogleLogging(char *argv0)
|
||||
qInfo() << "The logging path is:" << qPrintable(logPath);
|
||||
}
|
||||
|
||||
static void sakShutdownGoogleLogging()
|
||||
static void xToolsShutdownGoogleLogging()
|
||||
{
|
||||
#ifndef QT_DEBUG
|
||||
google::ShutdownGoogleLogging();
|
||||
@ -85,7 +84,7 @@ static void qtLogToGoogleLog(QtMsgType type, const QMessageLogContext &context,
|
||||
}
|
||||
#endif
|
||||
|
||||
static void sakInitApp(const QString &appName)
|
||||
static void xToolsInitApp(const QString &appName)
|
||||
{
|
||||
// Initialize some information about application.
|
||||
QString cookedAppName = appName;
|
||||
@ -94,21 +93,21 @@ static void sakInitApp(const QString &appName)
|
||||
QCoreApplication::setOrganizationDomain(QString("IT"));
|
||||
QCoreApplication::setApplicationName(cookedAppName);
|
||||
|
||||
#ifdef SAK_VERSION
|
||||
QCoreApplication::setApplicationVersion(SAK_VERSION);
|
||||
#ifdef X_TOOLS_VERSION
|
||||
QCoreApplication::setApplicationVersion(X_TOOLS_VERSION);
|
||||
#else
|
||||
QCoreApplication::setApplicationVersion("0.0.0");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sakInstallMessageHandler()
|
||||
static void xToolsInstallMessageHandler()
|
||||
{
|
||||
#ifndef QT_DEBUG
|
||||
qInstallMessageHandler(qtLogToGoogleLog);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sakTryToClearSettings()
|
||||
static void xToolsTryToClearSettings()
|
||||
{
|
||||
// Remove settings file and database
|
||||
if (xToolsSettings::instance()->clearSettings()) {
|
||||
@ -121,13 +120,7 @@ static void sakTryToClearSettings()
|
||||
}
|
||||
}
|
||||
|
||||
static void sakInitLanguage()
|
||||
{
|
||||
QString language = xToolsSettings::instance()->language();
|
||||
xToolsTranslator::instance()->setupLanguage(language);
|
||||
}
|
||||
|
||||
static void sakInitHdpi()
|
||||
static void xToolsInitHdpi()
|
||||
{
|
||||
#if 0
|
||||
qputenv("QT_SCALE_FACTOR", "1.5");
|
||||
@ -141,7 +134,7 @@ static void sakInitHdpi()
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sakInitAppStyle()
|
||||
static void xToolsInitAppStyle()
|
||||
{
|
||||
qInfo() << "The supported application styles are:"
|
||||
<< qPrintable(QStyleFactory::keys().join(QChar(',')));
|
||||
@ -154,24 +147,21 @@ static void sakInitAppStyle()
|
||||
|
||||
static void sakDoSomethingBeforeAppCreated(char *argv[], const QString &appName)
|
||||
{
|
||||
sakInitApp(appName);
|
||||
xToolsInitApp(appName);
|
||||
#ifdef X_TOOLS_USING_GLOG
|
||||
sakInitGoogleLogging(argv[0]);
|
||||
sakInstallMessageHandler();
|
||||
xToolsInitGoogleLogging(argv[0]);
|
||||
xToolsInstallMessageHandler();
|
||||
#else
|
||||
Q_UNUSED(argv)
|
||||
#endif
|
||||
sakTryToClearSettings();
|
||||
#if 0
|
||||
sakInitLanguage();
|
||||
#endif
|
||||
sakInitHdpi();
|
||||
sakInitAppStyle();
|
||||
xToolsTryToClearSettings();
|
||||
xToolsInitHdpi();
|
||||
xToolsInitAppStyle();
|
||||
}
|
||||
|
||||
static void sakDoSomethingAfterAppExited()
|
||||
{
|
||||
#ifdef X_TOOLS_USING_GLOG
|
||||
sakShutdownGoogleLogging();
|
||||
xToolsShutdownGoogleLogging();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ void xToolsSettings::setHdpiPolicy(int policy)
|
||||
|
||||
QString xToolsSettings::appStyle()
|
||||
{
|
||||
return value(mSettingsKey.appStyle, SAK_STYLE_DEFAULT).toString();
|
||||
return value(mSettingsKey.appStyle, X_TOOLS_DEFAULT_APP_STYLE).toString();
|
||||
}
|
||||
|
||||
void xToolsSettings::setAppStyle(const QString& style)
|
||||
|
||||
@ -103,6 +103,11 @@ QSplashScreen &xToolsApplication::splashScreen()
|
||||
return m_splashScreen;
|
||||
}
|
||||
|
||||
QStringList xToolsApplication::supportedLanguages()
|
||||
{
|
||||
return m_languageFlagNameMap.values();
|
||||
}
|
||||
|
||||
void xToolsApplication::setupLanguage(const QString &language)
|
||||
{
|
||||
setupLanguage(language, m_translatorPrefix);
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
class xToolsApplication : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QStringList supportedLanguages READ supportedLanguages CONSTANT FINAL)
|
||||
public:
|
||||
enum xToolsAppPalette { DefaultPalette, DarkPalette, LightPalette, CustomPalette = -1 };
|
||||
|
||||
@ -25,6 +26,7 @@ public:
|
||||
void setupPalette(int palette);
|
||||
void setupPalette(const QString &fileName);
|
||||
QSplashScreen &splashScreen();
|
||||
QStringList supportedLanguages();
|
||||
|
||||
virtual void setupLanguage(const QString &language);
|
||||
|
||||
|
||||
@ -29,17 +29,15 @@
|
||||
#include "xToolsDataStructure.h"
|
||||
#endif
|
||||
|
||||
#include "xToolsApplication.h"
|
||||
#include "xToolsInterface.h"
|
||||
#include "xToolsSettings.h"
|
||||
#include "xToolsTranslator.h"
|
||||
|
||||
xToolsMainWindow::xToolsMainWindow(QWidget* parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
m_appStyleActionGroup = new QActionGroup(this);
|
||||
m_languageActionGroup = new QActionGroup(this);
|
||||
QString language = xToolsSettings::instance()->language();
|
||||
xToolsTranslator::instance()->setupLanguage(language);
|
||||
init();
|
||||
}
|
||||
|
||||
@ -98,7 +96,7 @@ void xToolsMainWindow::initMenuLanguage()
|
||||
m_languageMenu = new QMenu(tr("&Languages"), this);
|
||||
menuBar()->addMenu(m_languageMenu);
|
||||
|
||||
QStringList languages = xToolsTranslator::instance()->languanges();
|
||||
QStringList languages = qobject_cast<xToolsApplication*>(qApp)->supportedLanguages();
|
||||
for (auto& language : languages) {
|
||||
QAction* action = new QAction(language, this);
|
||||
action->setCheckable(true);
|
||||
|
||||
@ -451,7 +451,7 @@ void MainWindow::aboutSoftware()
|
||||
QList<Info> infoList;
|
||||
infoList << Info{tr("Version"), QString(qApp->applicationVersion()), false}
|
||||
#ifndef SAK_RELEASE_FOR_APP_STORE
|
||||
<< Info{tr("Edition"), SAK_EDITION, false}
|
||||
<< Info{tr("Edition"), X_TOOL_EDITION, false}
|
||||
#endif
|
||||
<< Info{tr("Author"), QString(X_TOOLS_AUTHOR), false}
|
||||
<< Info{tr("Email"), QString(X_TOOLS_AUTHOR_EMAIL), false}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user