aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-07-30 17:33:21 +0000
committersaturneric <[email protected]>2024-07-30 17:33:21 +0000
commit02edad4c989f60e248657bb7854253f8297db583 (patch)
tree0fa307c34d270f42ba1ad90da819c259d744f283
parentfeat: should check build capability at dev branch (diff)
downloadGpgFrontend-02edad4c989f60e248657bb7854253f8297db583.tar.gz
GpgFrontend-02edad4c989f60e248657bb7854253f8297db583.zip
fix: use standard os detection macro
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/core/GpgCoreInit.cpp62
-rw-r--r--src/core/function/ArchiveFileOperator.cpp8
-rw-r--r--src/core/function/GlobalSettingStation.cpp7
-rw-r--r--src/core/function/SecureMemoryAllocator.cpp20
-rw-r--r--src/core/module/ModuleInit.cpp19
-rw-r--r--src/init.cpp2
-rw-r--r--src/ui/GpgFrontendApplication.cpp2
-rw-r--r--src/ui/GpgFrontendUIInit.cpp2
-rw-r--r--src/ui/dialog/controller/GnuPGControllerDialog.cpp15
-rw-r--r--src/ui/dialog/keypair_details/KeyDetailsDialog.cpp3
-rw-r--r--src/ui/dialog/keypair_details/KeyPairOperaTab.cpp38
-rw-r--r--src/ui/dialog/settings/SettingsDialog.cpp10
13 files changed, 91 insertions, 100 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8a4212c..795dd522 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -292,7 +292,6 @@ IF(MINGW)
message(STATUS "Build Environment MINGW")
set(OS_PLATFORM 0)
- add_definitions(-DWINDOWS)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
@@ -313,7 +312,6 @@ if(APPLE)
message(STATUS "GpgFrontend Configuration For OS Platform MacOS")
set(OS_PLATFORM 1)
- ADD_DEFINITIONS(-DMACOS)
if(XCODE_BUILD)
set(XCODE_CODE_SIGN_IDENTITY "\"${XCODE_CODE_SIGN_IDENTITY}\"")
@@ -347,7 +345,6 @@ if(LINUX)
message(STATUS "GpgFrontend Configuration For OS Platform Linux")
set(OS_PLATFORM 2)
- add_compile_definitions(LINUX)
# Get Env Info
find_program(UNAME_PROGRAM uname)
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp
index f24ce200..3e03536a 100644
--- a/src/core/GpgCoreInit.cpp
+++ b/src/core/GpgCoreInit.cpp
@@ -70,7 +70,8 @@ auto VerifyKeyDatabasePath(const QFileInfo& key_database_fs_path) -> bool {
auto SearchGpgconfPath(const QList<QString>& candidate_paths) -> QString {
for (const auto& path : candidate_paths) {
if (VerifyGpgconfPath(QFileInfo(path))) {
- return path;
+ // return a unify path
+ return QFileInfo(path).absoluteFilePath();
}
}
return {};
@@ -79,7 +80,8 @@ auto SearchGpgconfPath(const QList<QString>& candidate_paths) -> QString {
auto SearchKeyDatabasePath(const QList<QString>& candidate_paths) -> QString {
for (const auto& path : candidate_paths) {
if (VerifyKeyDatabasePath(QFileInfo(path))) {
- return path;
+ // return a unify path
+ return QFileInfo(path).absoluteFilePath();
}
}
return {};
@@ -204,7 +206,7 @@ auto GetGnuPGPathByGpgConf(const QString& gnupg_install_fs_path) -> QString {
auto component_path = info_split_list[2].trimmed();
if (component_name.toLower() == "gpg") {
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
// replace some special substrings on windows platform
component_path.replace("%3a", ":");
#endif
@@ -229,7 +231,7 @@ auto DetectGpgConfPath() -> QString {
if (use_custom_gnupg_install_path && !custom_gnupg_install_path.isEmpty()) {
// check gpgconf path
gnupg_install_fs_path = custom_gnupg_install_path;
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
gnupg_install_fs_path += "/gpgconf.exe";
#else
gnupg_install_fs_path += "/gpgconf";
@@ -242,16 +244,19 @@ auto DetectGpgConfPath() -> QString {
}
}
- // fallback to default path
+ // custom not found or not defined then fallback to default candidate path
if (gnupg_install_fs_path.isEmpty()) {
-#ifdef MACOS
+ // platform detection
+#if defined(__APPLE__) && defined(__MACH__)
gnupg_install_fs_path = SearchGpgconfPath(
{"/usr/local/bin/gpgconf", "/opt/homebrew/bin/gpgconf"});
-#endif
-
-#ifdef WINDOWS
+#elif defined(_WIN32) || defined(WIN32)
+ gnupg_install_fs_path =
+ SearchGpgconfPath({"C:/Program Files (x86)/gnupg/bin/gpgconf.exe"});
+#else
+ // unix or linux or another platforms
gnupg_install_fs_path =
- SearchGpgconfPath({"C:/Program Files (x86)/gnupg/bin"});
+ SearchGpgconfPath({"/usr/local/bin/gpgconf", "/usr/bin/gpgconf"});
#endif
}
@@ -314,46 +319,37 @@ void InitGpgFrontendCore(CoreInitArgs args) {
QString::fromLocal8Bit(qgetenv("container")) != "flatpak")
.toBool();
- // check key database path
+ // key database path
QString key_database_fs_path;
- // user defined
+
+ // try to use user defined key database
if (use_custom_key_database_path &&
!custom_key_database_path.isEmpty()) {
- key_database_fs_path = custom_key_database_path;
- if (VerifyKeyDatabasePath(QFileInfo(key_database_fs_path))) {
- qCWarning(core)
- << "core loaded custom gpg key database is illegal: "
- << key_database_fs_path;
+ if (VerifyKeyDatabasePath(QFileInfo(custom_key_database_path))) {
+ key_database_fs_path =
+ QFileInfo(custom_gnupg_install_path).absoluteFilePath();
} else {
- use_custom_key_database_path = true;
+ qCWarning(core) << "custom gpg key database path is not suitable: "
+ << key_database_fs_path;
}
} else {
-#if defined(LINUX) || defined(MACOS)
- use_custom_key_database_path = true;
+
+#if defined(__linux__) || (defined(__APPLE__) && defined(__MACH__))
+ // use user's home path by default
key_database_fs_path =
SearchKeyDatabasePath({QDir::home().path() + "/.gnupg"});
#endif
}
if (args.load_default_gpg_context) {
- // init ctx, also checking the basical env
+ // init ctx, also checking the basic env
auto& ctx = GpgFrontend::GpgContext::CreateInstance(
kGpgFrontendDefaultChannel, [=]() -> ChannelObjectPtr {
GpgFrontend::GpgContextInitArgs args;
// set key database path
- if (use_custom_key_database_path &&
- !key_database_fs_path.isEmpty()) {
- QFileInfo dir_info(key_database_fs_path);
- if (dir_info.exists() && dir_info.isDir() &&
- dir_info.isReadable() && dir_info.isWritable()) {
- args.db_path = dir_info.absoluteFilePath();
- } else {
- qCWarning(core)
- << "custom key database path: " << key_database_fs_path
- << ", is not point to "
- "an accessible directory";
- }
+ if (!key_database_fs_path.isEmpty()) {
+ args.db_path = key_database_fs_path;
}
// set custom gnupg path
diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp
index c478ed15..2fc801ab 100644
--- a/src/core/function/ArchiveFileOperator.cpp
+++ b/src/core/function/ArchiveFileOperator.cpp
@@ -103,7 +103,7 @@ void ArchiveFileOperator::NewArchive2DataExchanger(
auto *disk = archive_read_disk_new();
archive_read_disk_set_standard_lookup(disk);
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
auto target_directory_utf16_wstr = std::wstring(
reinterpret_cast<const wchar_t *>((target_directory).utf16()));
auto r =
@@ -135,7 +135,7 @@ void ArchiveFileOperator::NewArchive2DataExchanger(
archive_read_disk_descend(disk);
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
auto source_path =
QString::fromUtf16(reinterpret_cast<const char16_t *>(
archive_entry_pathname_w(entry)));
@@ -150,7 +150,7 @@ void ArchiveFileOperator::NewArchive2DataExchanger(
auto relativ_path_name = base_path.relativeFilePath(source_path);
archive_entry_set_pathname(entry, relativ_path_name.toUtf8());
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
auto source_path_utf16_wstr = std::wstring(
reinterpret_cast<const wchar_t *>(source_path.utf16()));
archive_entry_copy_sourcepath_w(entry,
@@ -253,7 +253,7 @@ void ArchiveFileOperator::ExtractArchiveFromDataExchanger(
auto path_name = QString::fromUtf8(archive_entry_pathname(entry));
auto target_path_name = target_path + "/" + path_name;
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
auto target_path_utf16_wstr = std::wstring(
reinterpret_cast<const wchar_t *>((target_path_name).utf16()));
archive_entry_copy_pathname_w(entry, target_path_utf16_wstr.c_str());
diff --git a/src/core/function/GlobalSettingStation.cpp b/src/core/function/GlobalSettingStation.cpp
index bb4900e1..68fc79d7 100644
--- a/src/core/function/GlobalSettingStation.cpp
+++ b/src/core/function/GlobalSettingStation.cpp
@@ -57,11 +57,8 @@ class GlobalSettingStation::Impl {
qCInfo(core) << "app data path: " << app_data_path_;
qCInfo(core) << "app log path: " << app_log_path_;
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
qCInfo(core) << "app config path: " << app_config_path_;
-#endif
-
-#ifdef WINDOWS
if (!QDir(app_config_path_).exists()) QDir(app_config_path_).mkpath(".");
#endif
@@ -72,7 +69,7 @@ class GlobalSettingStation::Impl {
[[nodiscard]] auto GetSettings() -> QSettings {
if (!portable_mode_) {
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
return QSettings(app_config_target_path_, QSettings::IniFormat);
#else
return QSettings();
diff --git a/src/core/function/SecureMemoryAllocator.cpp b/src/core/function/SecureMemoryAllocator.cpp
index 778d6f44..cb2249c9 100644
--- a/src/core/function/SecureMemoryAllocator.cpp
+++ b/src/core/function/SecureMemoryAllocator.cpp
@@ -28,39 +28,37 @@
#include "SecureMemoryAllocator.h"
-#ifndef MACOS
-
-#include <mimalloc.h>
-
namespace GpgFrontend {
+#if defined(__APPLE__) && defined(__MACH__)
+
auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* {
- auto* addr = mi_malloc(size);
+ auto* addr = malloc(size);
return addr;
}
auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* {
- auto* addr = mi_realloc(ptr, size);
+ auto* addr = realloc(ptr, size);
return addr;
}
-void SecureMemoryAllocator::Deallocate(void* p) { mi_free(p); }
+void SecureMemoryAllocator::Deallocate(void* p) { free(p); }
#else
-namespace GpgFrontend {
+#include <mimalloc.h>
auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* {
- auto* addr = malloc(size);
+ auto* addr = mi_malloc(size);
return addr;
}
auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* {
- auto* addr = realloc(ptr, size);
+ auto* addr = mi_realloc(ptr, size);
return addr;
}
-void SecureMemoryAllocator::Deallocate(void* p) { free(p); }
+void SecureMemoryAllocator::Deallocate(void* p) { mi_free(p); }
#endif
diff --git a/src/core/module/ModuleInit.cpp b/src/core/module/ModuleInit.cpp
index ae784279..4fedc6c7 100644
--- a/src/core/module/ModuleInit.cpp
+++ b/src/core/module/ModuleInit.cpp
@@ -47,25 +47,26 @@ void LoadModuleFromPath(const QString& mods_path, bool integrated) {
}
auto LoadIntegratedMods() -> bool {
- auto exec_binary_path = QCoreApplication::applicationDirPath();
+ const auto exec_binary_path = QCoreApplication::applicationDirPath();
+ QString mods_path = exec_binary_path + "/modules";
-#if defined(MACOS) && defined(RELEASE)
- // App Bundle
- auto mods_path = exec_binary_path + "/../Modules";
-#else
- // Debug Or Windows Platform
- auto mods_path = exec_binary_path + "/modules";
-#endif
+#ifdef NDEBUG
+#if defined(__APPLE__) && defined(__MACH__)
+ // App Bundle
+ mods_path = exec_binary_path + "/../Modules";
+#elif defined(__linux__)
// AppImage
if (!qEnvironmentVariable("APPIMAGE").isEmpty()) {
mods_path = qEnvironmentVariable("APPDIR") + "/usr/modules";
}
-
// Flatpak
if (!qEnvironmentVariable("container").isEmpty()) {
mods_path = "/app/modules";
}
+#endif
+
+#endif
if (!QDir(mods_path).exists()) {
qCWarning(core) << "integrated module directory at path: " << mods_path
diff --git a/src/init.cpp b/src/init.cpp
index 6e67551d..6d8fe8e4 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -40,7 +40,7 @@
namespace GpgFrontend {
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
int setenv(const char *name, const char *value, int overwrite) {
if (!overwrite) {
int errcode = 0;
diff --git a/src/ui/GpgFrontendApplication.cpp b/src/ui/GpgFrontendApplication.cpp
index fec29360..5227e55a 100644
--- a/src/ui/GpgFrontendApplication.cpp
+++ b/src/ui/GpgFrontendApplication.cpp
@@ -34,7 +34,7 @@ namespace GpgFrontend::UI {
GpgFrontendApplication::GpgFrontendApplication(int &argc, char *argv[])
: QApplication(argc, argv) {
-#if defined(DEBUG) || !defined(MACOS)
+#if !(defined(__APPLE__) && defined(__MACH__))
GpgFrontend::UI::GpgFrontendApplication::setWindowIcon(
QIcon(":/icons/gpgfrontend.png"));
#endif
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp
index c720d3df..f7ebfd29 100644
--- a/src/ui/GpgFrontendUIInit.cpp
+++ b/src/ui/GpgFrontendUIInit.cpp
@@ -120,7 +120,7 @@ void InitGpgFrontendUI(QApplication* /*app*/) {
auto settings = GlobalSettingStation::GetInstance().GetSettings();
auto theme = settings.value("appearance/theme").toString();
-#ifdef WINDOWS
+#if defined(_WIN32) || defined(WIN32)
if (theme.isEmpty()) {
// support dark mode on windows
QApplication::setStyle(QStyleFactory::create("Fusion"));
diff --git a/src/ui/dialog/controller/GnuPGControllerDialog.cpp b/src/ui/dialog/controller/GnuPGControllerDialog.cpp
index c62bb33c..4cdc4864 100644
--- a/src/ui/dialog/controller/GnuPGControllerDialog.cpp
+++ b/src/ui/dialog/controller/GnuPGControllerDialog.cpp
@@ -149,19 +149,18 @@ GnuPGControllerDialog::GnuPGControllerDialog(QWidget* parent)
this->slot_set_restart_needed(kDeepRestartCode);
});
-#ifndef MACOS
- connect(ui_->buttonBox, &QDialogButtonBox::accepted, this,
- &GnuPGControllerDialog::SlotAccept);
- connect(ui_->buttonBox, &QDialogButtonBox::rejected, this,
- &GnuPGControllerDialog::reject);
-#else
-
+#if defined(__APPLE__) && defined(__MACH__)
// macOS style settings
ui_->buttonBox->setDisabled(true);
ui_->buttonBox->setHidden(true);
connect(this, &QDialog::finished, this, &GnuPGControllerDialog::SlotAccept);
connect(this, &QDialog::finished, this, &GnuPGControllerDialog::deleteLater);
+#else
+ connect(ui_->buttonBox, &QDialogButtonBox::accepted, this,
+ &GnuPGControllerDialog::SlotAccept);
+ connect(ui_->buttonBox, &QDialogButtonBox::rejected, this,
+ &GnuPGControllerDialog::reject);
#endif
setWindowTitle(tr("GnuPG Controller"));
@@ -356,7 +355,7 @@ auto GnuPGControllerDialog::check_custom_gnupg_path(QString path) -> bool {
QMessageBox::critical(this, tr("Illegal GnuPG Path"),
tr("Target GnuPG Path is not an absolute path."));
}
-#ifdef WINDOWS
+#ifdef __MINGW32__
QFileInfo const gpgconf_info(path + "/gpgconf.exe");
#else
QFileInfo const gpgconf_info(path + "/gpgconf");
diff --git a/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp b/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
index 6fa3b2d3..927a4553 100644
--- a/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
+++ b/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
@@ -61,9 +61,10 @@ KeyDetailsDialog::KeyDetailsDialog(const GpgKey& key, QWidget* parent)
auto* main_layout = new QVBoxLayout;
main_layout->addWidget(tab_widget_);
-#ifdef MACOS
+#if defined(__APPLE__) && defined(__MACH__)
setAttribute(Qt::WA_LayoutUsesWidgetRect);
#endif
+
this->setAttribute(Qt::WA_DeleteOnClose, true);
this->setLayout(main_layout);
this->setWindowTitle(tr("Key Details"));
diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
index 7ca31ed2..d641ff3b 100644
--- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
@@ -218,11 +218,12 @@ void KeyPairOperaTab::slot_export_public_key() {
}
// generate a file name
-#ifndef WINDOWS
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
+#if defined(_WIN32) || defined(WIN32)
+
+ auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
m_key_.GetId() + ")_pub.asc";
#else
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
+ auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
m_key_.GetId() + ")_pub.asc";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -264,11 +265,12 @@ void KeyPairOperaTab::slot_export_short_private_key() {
}
// generate a file name
-#ifndef WINDOWS
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
+#if defined(_WIN32) || defined(WIN32)
+
+ auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
m_key_.GetId() + ")_short_secret.asc";
#else
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
+ auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
m_key_.GetId() + ")_short_secret.asc";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -307,11 +309,11 @@ void KeyPairOperaTab::slot_export_private_key() {
}
// generate a file name
-#ifndef WINDOWS
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
+#if defined(_WIN32) || defined(WIN32)
+ auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
m_key_.GetId() + ")_full_secret.asc";
#else
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
+ auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
m_key_.GetId() + ")_full_secret.asc";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -351,11 +353,11 @@ void KeyPairOperaTab::slot_gen_revoke_cert() {
auto literal = QString("%1 (*.rev)").arg(tr("Revocation Certificates"));
QString m_output_file_name;
-#ifndef WINDOWS
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
+#if defined(_WIN32) || defined(WIN32)
+ auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
m_key_.GetId() + ").rev";
#else
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
+ auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
m_key_.GetId() + ").rev";
#endif
@@ -492,11 +494,11 @@ void KeyPairOperaTab::slot_export_paper_key() {
}
// generate a file name
-#ifndef WINDOWS
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
+#if defined(_WIN32) || defined(WIN32)
+ auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
m_key_.GetId() + ")_paper_key.txt";
#else
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
+ auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
m_key_.GetId() + ")_paper_key.txt";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -545,11 +547,11 @@ void KeyPairOperaTab::slot_import_paper_key() {
}
// generate a file name
-#ifndef WINDOWS
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
+#if defined(_WIN32) || defined(WIN32)
+ auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
m_key_.GetId() + ")_paper_key.txt";
#else
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
+ auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
m_key_.GetId() + ")_paper_key.txt";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
diff --git a/src/ui/dialog/settings/SettingsDialog.cpp b/src/ui/dialog/settings/SettingsDialog.cpp
index ca3071c2..0c38d372 100644
--- a/src/ui/dialog/settings/SettingsDialog.cpp
+++ b/src/ui/dialog/settings/SettingsDialog.cpp
@@ -55,7 +55,11 @@ SettingsDialog::SettingsDialog(QWidget* parent)
tab_widget_->addTab(key_server_tab_, tr("Key Server"));
tab_widget_->addTab(network_tab_, tr("Network"));
-#ifndef MACOS
+#if defined(__APPLE__) && defined(__MACH__)
+ connect(this, &QDialog::finished, this, &SettingsDialog::SlotAccept);
+ connect(this, &QDialog::finished, this, &SettingsDialog::deleteLater);
+ setWindowTitle(tr("Preference"));
+#else
button_box_ =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(button_box_, &QDialogButtonBox::accepted, this,
@@ -65,10 +69,6 @@ SettingsDialog::SettingsDialog(QWidget* parent)
main_layout->addWidget(button_box_);
main_layout->stretch(0);
setWindowTitle(tr("Settings"));
-#else
- connect(this, &QDialog::finished, this, &SettingsDialog::SlotAccept);
- connect(this, &QDialog::finished, this, &SettingsDialog::deleteLater);
- setWindowTitle(tr("Preference"));
#endif
setLayout(main_layout);