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:
|
||||
qt-version: [5.15.2, 6.4.1]
|
||||
library-type: [shared, static]
|
||||
platform: [windows-latest, ubuntu-latest, macos-latest]
|
||||
platform: [windows-latest, macos-latest] # ubuntu-latest
|
||||
include:
|
||||
- platform: windows-latest
|
||||
CC: cl
|
||||
CXX: cl
|
||||
- platform: ubuntu-latest
|
||||
CC: gcc
|
||||
CXX: g++
|
||||
#- platform: ubuntu-latest
|
||||
# CC: gcc
|
||||
# CXX: g++
|
||||
- platform: macos-latest
|
||||
CC: 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));
|
||||
if (!g_logFile->open(QFile::WriteOnly | QFile::Text | QFile::Append)) {
|
||||
std::cerr << "Can't open file to write: " << qUtf8Printable(g_logFile->errorString()) << std::endl;
|
||||
delete g_logFile.release();
|
||||
g_logFile.reset();
|
||||
g_logError = true;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -107,13 +107,13 @@ void FramelessConfig::reload(const bool force)
|
|||
if (g_data()->loaded && !force) {
|
||||
return;
|
||||
}
|
||||
const std::unique_ptr<QSettings> configFile([]() -> QSettings * {
|
||||
if (!QCoreApplication::instance()) {
|
||||
const auto configFile = []() -> std::unique_ptr<QSettings> {
|
||||
if (!qApp) {
|
||||
return nullptr;
|
||||
}
|
||||
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) {
|
||||
const bool envVar = (!g_data()->disableEnvVar
|
||||
&& qEnvironmentVariableIsSet(OptionsTable[i].env.constData())
|
||||
|
|
|
@ -588,7 +588,7 @@ void FramelessHelperWin::removeWindow(const WId windowId)
|
|||
if (g_win32Helper()->data.isEmpty()) {
|
||||
if (g_win32Helper()->nativeEventFilter) {
|
||||
qApp->removeNativeEventFilter(g_win32Helper()->nativeEventFilter.get());
|
||||
delete g_win32Helper()->nativeEventFilter.release();
|
||||
g_win32Helper()->nativeEventFilter.reset();
|
||||
}
|
||||
}
|
||||
HWND hwnd = nullptr;
|
||||
|
|
|
@ -87,17 +87,17 @@ RegistryKey::RegistryKey(const RegistryRootKey root, const QString &key, QObject
|
|||
#if REGISTRYKEY_QWINREGISTRYKEY
|
||||
m_registryKey = std::make_unique<QWinRegistryKey>(g_keyMap[static_cast<int>(m_rootKey)], m_subKey);
|
||||
if (!m_registryKey->isValid()) {
|
||||
delete m_registryKey.release();
|
||||
m_registryKey.reset();
|
||||
}
|
||||
#else
|
||||
const QString rootKey = g_strMap[static_cast<int>(m_rootKey)];
|
||||
const auto lastSlashPos = m_subKey.lastIndexOf(u'\\');
|
||||
m_settings = std::make_unique<QSettings>(rootKey + u'\\' + m_subKey.left(lastSlashPos), QSettings::NativeFormat);
|
||||
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);
|
||||
} else {
|
||||
delete m_settings.release();
|
||||
m_settings.reset();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue