diff --git a/scwx-qt/source/scwx/qt/main/main.cpp b/scwx-qt/source/scwx/qt/main/main.cpp index 4a6445d0..468aa1e6 100644 --- a/scwx-qt/source/scwx/qt/main/main.cpp +++ b/scwx-qt/source/scwx/qt/main/main.cpp @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) } // Test to see if scwx was run with high privilege - std::string appDataPath { + const std::string appDataPath { QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) .toStdString()}; @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) const int result = dialog.exec(); disableHighPrivilegeWarning = dialog.disable_high_privilege_message(); - highPrivilegeChecked = true; + highPrivilegeChecked = true; if (result == QDialog::Rejected) { diff --git a/scwx-qt/source/scwx/qt/ui/high_privilege_dialog.cpp b/scwx-qt/source/scwx/qt/ui/high_privilege_dialog.cpp index 0c60052a..c057e6a4 100644 --- a/scwx-qt/source/scwx/qt/ui/high_privilege_dialog.cpp +++ b/scwx-qt/source/scwx/qt/ui/high_privilege_dialog.cpp @@ -19,7 +19,7 @@ class HighPrivilegeDialogImpl public: explicit HighPrivilegeDialogImpl(HighPrivilegeDialog* self) : self_ {self} {}; - ~HighPrivilegeDialogImpl() = default; + ~HighPrivilegeDialogImpl() = default; HighPrivilegeDialog* self_; }; @@ -32,7 +32,8 @@ HighPrivilegeDialog::HighPrivilegeDialog(QWidget* parent) : ui->setupUi(this); } -bool HighPrivilegeDialog::disable_high_privilege_message() { +bool HighPrivilegeDialog::disable_high_privilege_message() +{ return ui->highPrivilegeCheckBox->isChecked(); } @@ -44,4 +45,3 @@ HighPrivilegeDialog::~HighPrivilegeDialog() } // namespace ui } // namespace qt } // namespace scwx - diff --git a/scwx-qt/source/scwx/qt/ui/high_privilege_dialog.hpp b/scwx-qt/source/scwx/qt/ui/high_privilege_dialog.hpp index 5271d245..b5d79ada 100644 --- a/scwx-qt/source/scwx/qt/ui/high_privilege_dialog.hpp +++ b/scwx-qt/source/scwx/qt/ui/high_privilege_dialog.hpp @@ -25,7 +25,7 @@ private: public: explicit HighPrivilegeDialog(QWidget* parent = nullptr); - ~HighPrivilegeDialog(); + ~HighPrivilegeDialog() override; bool disable_high_privilege_message(); diff --git a/scwx-qt/source/scwx/qt/util/check_privilege.cpp b/scwx-qt/source/scwx/qt/util/check_privilege.cpp index c33f87b4..2d7d1227 100644 --- a/scwx-qt/source/scwx/qt/util/check_privilege.cpp +++ b/scwx-qt/source/scwx/qt/util/check_privilege.cpp @@ -2,20 +2,23 @@ #include #ifdef _WIN32 -#include +# include #else -#include +# include #endif -namespace scwx { -namespace qt { -namespace util { +namespace scwx +{ +namespace qt +{ +namespace util +{ bool is_high_privilege() { #if defined(_WIN32) - bool isAdmin = false; - HANDLE token = NULL; + bool isAdmin = false; + HANDLE token = NULL; TOKEN_ELEVATION elevation; DWORD elevationSize = sizeof(TOKEN_ELEVATION); @@ -33,7 +36,7 @@ bool is_high_privilege() CloseHandle(token); return isAdmin; #elif defined(Q_OS_UNIX) - // On UNIX root is always uid 0. On Linux this is enforced by the kernal. + // On UNIX root is always uid 0. On Linux this is enforced by the kernel. return geteuid() == 0; #endif } diff --git a/scwx-qt/source/scwx/qt/util/check_privilege.hpp b/scwx-qt/source/scwx/qt/util/check_privilege.hpp index 1234f0ef..7a44a070 100644 --- a/scwx-qt/source/scwx/qt/util/check_privilege.hpp +++ b/scwx-qt/source/scwx/qt/util/check_privilege.hpp @@ -1,8 +1,11 @@ #pragma once -namespace scwx { -namespace qt { -namespace util { +namespace scwx +{ +namespace qt +{ +namespace util +{ bool is_high_privilege();