mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 16:10:06 +00:00 
			
		
		
		
	Fix formatting for high_privilege_warning
This commit is contained in:
		
							parent
							
								
									923dad4e2e
								
							
						
					
					
						commit
						6408e1b876
					
				
					 5 changed files with 23 additions and 17 deletions
				
			
		|  | @ -85,7 +85,7 @@ int main(int argc, char* argv[]) | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    // Test to see if scwx was run with high privilege
 |    // Test to see if scwx was run with high privilege
 | ||||||
|    std::string appDataPath { |    const std::string appDataPath { | ||||||
|       QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) |       QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) | ||||||
|          .toStdString()}; |          .toStdString()}; | ||||||
| 
 | 
 | ||||||
|  | @ -99,7 +99,7 @@ int main(int argc, char* argv[]) | ||||||
|       const int result = dialog.exec(); |       const int result = dialog.exec(); | ||||||
| 
 | 
 | ||||||
|       disableHighPrivilegeWarning = dialog.disable_high_privilege_message(); |       disableHighPrivilegeWarning = dialog.disable_high_privilege_message(); | ||||||
|       highPrivilegeChecked = true; |       highPrivilegeChecked        = true; | ||||||
| 
 | 
 | ||||||
|       if (result == QDialog::Rejected) |       if (result == QDialog::Rejected) | ||||||
|       { |       { | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ class HighPrivilegeDialogImpl | ||||||
| public: | public: | ||||||
|    explicit HighPrivilegeDialogImpl(HighPrivilegeDialog* self) : |    explicit HighPrivilegeDialogImpl(HighPrivilegeDialog* self) : | ||||||
|        self_ {self} {}; |        self_ {self} {}; | ||||||
|    ~HighPrivilegeDialogImpl()         = default; |    ~HighPrivilegeDialogImpl() = default; | ||||||
| 
 | 
 | ||||||
|    HighPrivilegeDialog* self_; |    HighPrivilegeDialog* self_; | ||||||
| }; | }; | ||||||
|  | @ -32,7 +32,8 @@ HighPrivilegeDialog::HighPrivilegeDialog(QWidget* parent) : | ||||||
|    ui->setupUi(this); |    ui->setupUi(this); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool HighPrivilegeDialog::disable_high_privilege_message() { | bool HighPrivilegeDialog::disable_high_privilege_message() | ||||||
|  | { | ||||||
|    return ui->highPrivilegeCheckBox->isChecked(); |    return ui->highPrivilegeCheckBox->isChecked(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -44,4 +45,3 @@ HighPrivilegeDialog::~HighPrivilegeDialog() | ||||||
| } // namespace ui
 | } // namespace ui
 | ||||||
| } // namespace qt
 | } // namespace qt
 | ||||||
| } // namespace scwx
 | } // namespace scwx
 | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -25,7 +25,7 @@ private: | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|    explicit HighPrivilegeDialog(QWidget* parent = nullptr); |    explicit HighPrivilegeDialog(QWidget* parent = nullptr); | ||||||
|    ~HighPrivilegeDialog(); |    ~HighPrivilegeDialog() override; | ||||||
| 
 | 
 | ||||||
|    bool disable_high_privilege_message(); |    bool disable_high_privilege_message(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,20 +2,23 @@ | ||||||
| #include <QtGlobal> | #include <QtGlobal> | ||||||
| 
 | 
 | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
| #include <windows.h> | #   include <windows.h> | ||||||
| #else | #else | ||||||
| #include <unistd.h> | #   include <unistd.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| namespace scwx { | namespace scwx | ||||||
| namespace qt { | { | ||||||
| namespace util { | namespace qt | ||||||
|  | { | ||||||
|  | namespace util | ||||||
|  | { | ||||||
| 
 | 
 | ||||||
| bool is_high_privilege() | bool is_high_privilege() | ||||||
| { | { | ||||||
| #if defined(_WIN32) | #if defined(_WIN32) | ||||||
|    bool   isAdmin = false; |    bool            isAdmin = false; | ||||||
|    HANDLE token    = NULL; |    HANDLE          token   = NULL; | ||||||
|    TOKEN_ELEVATION elevation; |    TOKEN_ELEVATION elevation; | ||||||
|    DWORD           elevationSize = sizeof(TOKEN_ELEVATION); |    DWORD           elevationSize = sizeof(TOKEN_ELEVATION); | ||||||
| 
 | 
 | ||||||
|  | @ -33,7 +36,7 @@ bool is_high_privilege() | ||||||
|    CloseHandle(token); |    CloseHandle(token); | ||||||
|    return isAdmin; |    return isAdmin; | ||||||
| #elif defined(Q_OS_UNIX) | #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; |    return geteuid() == 0; | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,8 +1,11 @@ | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| namespace scwx { | namespace scwx | ||||||
| namespace qt { | { | ||||||
| namespace util { | namespace qt | ||||||
|  | { | ||||||
|  | namespace util | ||||||
|  | { | ||||||
| 
 | 
 | ||||||
| bool is_high_privilege(); | bool is_high_privilege(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak