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