From 2d483b698fd4cdfcd961cb50e1c2dbf8f4f2fb9a Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Thu, 29 Sep 2011 22:46:19 +0300 Subject: [PATCH] GUI: Add menu-selection for the checked platform. This is quick and dirty patch to add the platform selection for the GUI. It is simple menu selection in Check-menu. It always defaults to "Default" at startup. And it forget the selection when the application is closed. Ticket: #3119 (GUI: add ability to specify platform type) --- gui/common.h | 2 ++ gui/main.ui | 55 ++++++++++++++++++++++++++++++++++++++++++++++ gui/mainwindow.cpp | 48 ++++++++++++++++++++++++++++++++++++++++ gui/mainwindow.h | 32 +++++++++++++++++++++++++++ 4 files changed, 137 insertions(+) diff --git a/gui/common.h b/gui/common.h index 292bc4174..3c9bace3e 100644 --- a/gui/common.h +++ b/gui/common.h @@ -91,5 +91,7 @@ ShowTypes; // The maximum value for the progress bar #define PROGRESS_MAX 1024.0 +#define SETTINGS_CHECKED_PLATFORM "Checked platform" + /// @} #endif diff --git a/gui/main.ui b/gui/main.ui index e7fd8aa00..0c6c3dbec 100644 --- a/gui/main.ui +++ b/gui/main.ui @@ -133,6 +133,13 @@ + + + + + + + @@ -549,6 +556,54 @@ true + + + true + + + Windows 32-bit ANSI + + + + + true + + + Windows 32-bit Unicode + + + + + true + + + Unix 32-bit + + + + + true + + + Unix 64-bit + + + + + true + + + Windows 64-bit + + + + + true + + + Default + + diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index f16090e37..dea8acea8 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -117,6 +117,22 @@ MainWindow::MainWindow() : connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents())); + QActionGroup* platformGroup = new QActionGroup(this); + mUI.mActionPlatformDefault->setActionGroup(platformGroup); + mUI.mActionPlatformUnix32Bit->setActionGroup(platformGroup); + mUI.mActionPlatformUnix64Bit->setActionGroup(platformGroup); + mUI.mActionPlatformWin32ANSI->setActionGroup(platformGroup); + mUI.mActionPlatformWin32Unicode->setActionGroup(platformGroup); + mUI.mActionPlatformWin64->setActionGroup(platformGroup); + mUI.mActionPlatformDefault->setChecked(true); + + connect(mUI.mActionPlatformDefault, SIGNAL(triggered()), this, SLOT(PlatformDefault())); + connect(mUI.mActionPlatformUnix32Bit, SIGNAL(triggered()), this, SLOT(PlatformUnix32Bit())); + connect(mUI.mActionPlatformUnix64Bit, SIGNAL(triggered()), this, SLOT(PlatformUnix64Bit())); + connect(mUI.mActionPlatformWin32ANSI, SIGNAL(triggered()), this, SLOT(PlatformWin32ANSI())); + connect(mUI.mActionPlatformWin32Unicode, SIGNAL(triggered()), this, SLOT(PlatformWin32Unicode())); + connect(mUI.mActionPlatformWin64, SIGNAL(triggered()), this, SLOT(PlatformWin64())); + LoadSettings(); mThread->Initialize(mUI.mResults); @@ -488,6 +504,7 @@ Settings MainWindow::GetCppcheckSettings() result._jobs = mSettings->value(SETTINGS_CHECK_THREADS, 1).toInt(); result._inlineSuppressions = mSettings->value(SETTINGS_INLINE_SUPPRESSIONS, false).toBool(); result.inconclusive = mSettings->value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool(); + result.platformType = (Settings::PlatformType) mSettings->value(SETTINGS_CHECKED_PLATFORM, 0).toInt(); if (result._jobs <= 0) { @@ -1090,3 +1107,34 @@ void MainWindow::RemoveProjectMRU(const QString &project) mSettings->setValue(SETTINGS_MRU_PROJECTS, files); UpdateMRUMenuItems(); } + + +void MainWindow::PlatformDefault() +{ + mSettings->setValue(SETTINGS_CHECKED_PLATFORM, Settings::Unspecified); +} + +void MainWindow::PlatformUnix32Bit() +{ + mSettings->setValue(SETTINGS_CHECKED_PLATFORM, Settings::Unix32); +} + +void MainWindow::PlatformUnix64Bit() +{ + mSettings->setValue(SETTINGS_CHECKED_PLATFORM, Settings::Unix64); +} + +void MainWindow::PlatformWin32ANSI() +{ + mSettings->setValue(SETTINGS_CHECKED_PLATFORM, Settings::Win32A); +} + +void MainWindow::PlatformWin32Unicode() +{ + mSettings->setValue(SETTINGS_CHECKED_PLATFORM, Settings::Win32W); +} + +void MainWindow::PlatformWin64() +{ + mSettings->setValue(SETTINGS_CHECKED_PLATFORM, Settings::Win64); +} diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 1c9ca2ad3..0ec00e19f 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -285,6 +285,38 @@ protected slots: */ void OpenRecentProject(); + /** + * @brief Selects "default" as the checked platform. + * Selects the platform as the "default", meaning whichever platform the + * GUI was compiled with. + */ + void PlatformDefault(); + + /** + * @brief Selects 32-bit Unix as the checked platform. + */ + void PlatformUnix32Bit(); + + /** + * @brief Selects 64-bit Unix as the checked platform. + */ + void PlatformUnix64Bit(); + + /** + * @brief Selects 32-bit ANSI Windows as the checked platform. + */ + void PlatformWin32ANSI(); + + /** + * @brief Selects 32-bit Unicode Windows as the checked platform. + */ + void PlatformWin32Unicode(); + + /** + * @brief Selects 64-bit Windows as the checked platform. + */ + void PlatformWin64(); + protected: /**