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
3ea285bbbe
commit
0f478c87fe
@ -28,11 +28,14 @@
|
|||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
|
#include "xTools.h"
|
||||||
#include "xToolsSettings.h"
|
#include "xToolsSettings.h"
|
||||||
|
|
||||||
xToolsApplication::xToolsApplication(int argc, char *argv[])
|
xToolsApplication::xToolsApplication(int argc, char *argv[])
|
||||||
: QApplication(argc, argv)
|
: QApplication(argc, argv)
|
||||||
{
|
{
|
||||||
|
xToolsInitAppStyle();
|
||||||
|
|
||||||
m_languageFlagNameMap.insert("zh_CN", "简体中文");
|
m_languageFlagNameMap.insert("zh_CN", "简体中文");
|
||||||
m_languageFlagNameMap.insert("en", "English");
|
m_languageFlagNameMap.insert("en", "English");
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QStyle>
|
||||||
|
|
||||||
static const QString fileName()
|
static const QString fileName()
|
||||||
{
|
{
|
||||||
@ -74,11 +75,16 @@ void xToolsSettings::setHdpiPolicy(int policy)
|
|||||||
|
|
||||||
QString xToolsSettings::appStyle()
|
QString xToolsSettings::appStyle()
|
||||||
{
|
{
|
||||||
#ifdef X_TOOLS_DEFAULT_APP_STYLE
|
auto var = value(mSettingsKey.appStyle);
|
||||||
return value(mSettingsKey.appStyle, X_TOOLS_DEFAULT_APP_STYLE).toString();
|
if (var.isValid()) {
|
||||||
#else
|
return value(mSettingsKey.appStyle).toString();
|
||||||
return QString("Fusion");
|
}
|
||||||
#endif
|
|
||||||
|
if (QApplication::instance()) {
|
||||||
|
return QApplication::style()->objectName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void xToolsSettings::setAppStyle(const QString& style)
|
void xToolsSettings::setAppStyle(const QString& style)
|
||||||
|
|||||||
@ -150,7 +150,10 @@ static void xToolsInitAppStyle()
|
|||||||
const QStringList keys = QStyleFactory::keys();
|
const QStringList keys = QStyleFactory::keys();
|
||||||
qInfo() << "The supported application styles are:" << qPrintable(keys.join(QChar(',')));
|
qInfo() << "The supported application styles are:" << qPrintable(keys.join(QChar(',')));
|
||||||
const QString style = xToolsSettings::instance()->appStyle();
|
const QString style = xToolsSettings::instance()->appStyle();
|
||||||
if (keys.contains(style)) {
|
if (style.isEmpty()) {
|
||||||
|
qWarning() << "The application style is not specified, the default style is:"
|
||||||
|
<< qPrintable(QApplication::style()->objectName());
|
||||||
|
} else if (keys.contains(style)) {
|
||||||
qInfo() << "The current style of application is:" << qPrintable(style);
|
qInfo() << "The current style of application is:" << qPrintable(style);
|
||||||
QApplication::setStyle(QStyleFactory::create(style));
|
QApplication::setStyle(QStyleFactory::create(style));
|
||||||
}
|
}
|
||||||
@ -167,7 +170,6 @@ static void sakDoSomethingBeforeAppCreated(char *argv[], const QString &appName)
|
|||||||
#endif
|
#endif
|
||||||
xToolsTryToClearSettings();
|
xToolsTryToClearSettings();
|
||||||
xToolsInitHdpi();
|
xToolsInitHdpi();
|
||||||
xToolsInitAppStyle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sakDoSomethingAfterAppExited()
|
static void sakDoSomethingAfterAppExited()
|
||||||
|
|||||||
@ -152,10 +152,6 @@ void xToolsMainWindow::initOptionMenuAppStyleMenu()
|
|||||||
m_optionMenu->addMenu(appStyleMenu);
|
m_optionMenu->addMenu(appStyleMenu);
|
||||||
QStringList keys = QStyleFactory::keys();
|
QStringList keys = QStyleFactory::keys();
|
||||||
QString style = xToolsSettings::instance()->appStyle();
|
QString style = xToolsSettings::instance()->appStyle();
|
||||||
if (style.isEmpty() && keys.contains(QString("Funsion"))) {
|
|
||||||
style = "Funsion";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (QString& key : keys) {
|
for (QString& key : keys) {
|
||||||
QAction* action = new QAction(key, this);
|
QAction* action = new QAction(key, this);
|
||||||
action->setObjectName(key);
|
action->setObjectName(key);
|
||||||
|
|||||||
@ -236,7 +236,7 @@
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>8</height>
|
<height>16</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@ -255,7 +255,7 @@
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>8</height>
|
<height>16</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user