minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
f00adba67c
commit
d04eaabde7
|
@ -19,14 +19,14 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
qt-version: [5.15.2, 6.4.1]
|
qt-version: [5.15.2, 6.4.1]
|
||||||
library-type: [shared, static]
|
library-type: [shared, static]
|
||||||
platform: [windows-latest, ubuntu-latest, macos-latest]
|
platform: [windows-latest, macos-latest] # ubuntu-latest
|
||||||
include:
|
include:
|
||||||
- platform: windows-latest
|
- platform: windows-latest
|
||||||
CC: cl
|
CC: cl
|
||||||
CXX: cl
|
CXX: cl
|
||||||
- platform: ubuntu-latest
|
#- platform: ubuntu-latest
|
||||||
CC: gcc
|
# CC: gcc
|
||||||
CXX: g++
|
# CXX: g++
|
||||||
- platform: macos-latest
|
- platform: macos-latest
|
||||||
CC: clang
|
CC: clang
|
||||||
CXX: clang++
|
CXX: clang++
|
||||||
|
|
|
@ -62,7 +62,7 @@ static inline void myMessageHandler(const QtMsgType type, const QMessageLogConte
|
||||||
g_logFile->setFileName(FRAMELESSHELPER_STRING_LITERAL("debug-%1.log").arg(g_app));
|
g_logFile->setFileName(FRAMELESSHELPER_STRING_LITERAL("debug-%1.log").arg(g_app));
|
||||||
if (!g_logFile->open(QFile::WriteOnly | QFile::Text | QFile::Append)) {
|
if (!g_logFile->open(QFile::WriteOnly | QFile::Text | QFile::Append)) {
|
||||||
std::cerr << "Can't open file to write: " << qUtf8Printable(g_logFile->errorString()) << std::endl;
|
std::cerr << "Can't open file to write: " << qUtf8Printable(g_logFile->errorString()) << std::endl;
|
||||||
delete g_logFile.release();
|
g_logFile.reset();
|
||||||
g_logError = true;
|
g_logError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,13 +107,13 @@ void FramelessConfig::reload(const bool force)
|
||||||
if (g_data()->loaded && !force) {
|
if (g_data()->loaded && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const std::unique_ptr<QSettings> configFile([]() -> QSettings * {
|
const auto configFile = []() -> std::unique_ptr<QSettings> {
|
||||||
if (!QCoreApplication::instance()) {
|
if (!qApp) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const QDir appDir(QCoreApplication::applicationDirPath());
|
const QDir appDir(QCoreApplication::applicationDirPath());
|
||||||
return new QSettings(appDir.filePath(kConfigFileName), QSettings::IniFormat);
|
return std::make_unique<QSettings>(appDir.filePath(kConfigFileName), QSettings::IniFormat);
|
||||||
}());
|
}();
|
||||||
for (int i = 0; i != OptionCount; ++i) {
|
for (int i = 0; i != OptionCount; ++i) {
|
||||||
const bool envVar = (!g_data()->disableEnvVar
|
const bool envVar = (!g_data()->disableEnvVar
|
||||||
&& qEnvironmentVariableIsSet(OptionsTable[i].env.constData())
|
&& qEnvironmentVariableIsSet(OptionsTable[i].env.constData())
|
||||||
|
|
|
@ -588,7 +588,7 @@ void FramelessHelperWin::removeWindow(const WId windowId)
|
||||||
if (g_win32Helper()->data.isEmpty()) {
|
if (g_win32Helper()->data.isEmpty()) {
|
||||||
if (g_win32Helper()->nativeEventFilter) {
|
if (g_win32Helper()->nativeEventFilter) {
|
||||||
qApp->removeNativeEventFilter(g_win32Helper()->nativeEventFilter.get());
|
qApp->removeNativeEventFilter(g_win32Helper()->nativeEventFilter.get());
|
||||||
delete g_win32Helper()->nativeEventFilter.release();
|
g_win32Helper()->nativeEventFilter.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HWND hwnd = nullptr;
|
HWND hwnd = nullptr;
|
||||||
|
|
|
@ -87,17 +87,17 @@ RegistryKey::RegistryKey(const RegistryRootKey root, const QString &key, QObject
|
||||||
#if REGISTRYKEY_QWINREGISTRYKEY
|
#if REGISTRYKEY_QWINREGISTRYKEY
|
||||||
m_registryKey = std::make_unique<QWinRegistryKey>(g_keyMap[static_cast<int>(m_rootKey)], m_subKey);
|
m_registryKey = std::make_unique<QWinRegistryKey>(g_keyMap[static_cast<int>(m_rootKey)], m_subKey);
|
||||||
if (!m_registryKey->isValid()) {
|
if (!m_registryKey->isValid()) {
|
||||||
delete m_registryKey.release();
|
m_registryKey.reset();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
const QString rootKey = g_strMap[static_cast<int>(m_rootKey)];
|
const QString rootKey = g_strMap[static_cast<int>(m_rootKey)];
|
||||||
const auto lastSlashPos = m_subKey.lastIndexOf(u'\\');
|
const auto lastSlashPos = m_subKey.lastIndexOf(u'\\');
|
||||||
m_settings = std::make_unique<QSettings>(rootKey + u'\\' + m_subKey.left(lastSlashPos), QSettings::NativeFormat);
|
m_settings = std::make_unique<QSettings>(rootKey + u'\\' + m_subKey.left(lastSlashPos), QSettings::NativeFormat);
|
||||||
if (m_settings->childGroups().contains(m_subKey.mid(lastSlashPos + 1))) {
|
if (m_settings->childGroups().contains(m_subKey.mid(lastSlashPos + 1))) {
|
||||||
delete m_settings.release();
|
m_settings.reset();
|
||||||
m_settings = std::make_unique<QSettings>(rootKey + u'\\' + m_subKey, QSettings::NativeFormat);
|
m_settings = std::make_unique<QSettings>(rootKey + u'\\' + m_subKey, QSettings::NativeFormat);
|
||||||
} else {
|
} else {
|
||||||
delete m_settings.release();
|
m_settings.reset();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue