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)
This commit is contained in:
Kimmo Varis 2011-09-29 22:46:19 +03:00
parent 24ce170554
commit 2d483b698f
4 changed files with 137 additions and 0 deletions

View File

@ -91,5 +91,7 @@ ShowTypes;
// The maximum value for the progress bar
#define PROGRESS_MAX 1024.0
#define SETTINGS_CHECKED_PLATFORM "Checked platform"
/// @}
#endif

View File

@ -133,6 +133,13 @@
<addaction name="mActionCheckDirectory"/>
<addaction name="mActionRecheck"/>
<addaction name="mActionStop"/>
<addaction name="separator"/>
<addaction name="mActionPlatformDefault"/>
<addaction name="mActionPlatformUnix32Bit"/>
<addaction name="mActionPlatformUnix64Bit"/>
<addaction name="mActionPlatformWin32ANSI"/>
<addaction name="mActionPlatformWin32Unicode"/>
<addaction name="mActionPlatformWin64"/>
</widget>
<widget class="QMenu" name="mMenuEdit">
<property name="title">
@ -549,6 +556,54 @@
<bool>true</bool>
</property>
</action>
<action name="mActionPlatformWin32ANSI">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Windows 32-bit ANSI</string>
</property>
</action>
<action name="mActionPlatformWin32Unicode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Windows 32-bit Unicode</string>
</property>
</action>
<action name="mActionPlatformUnix32Bit">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Unix 32-bit</string>
</property>
</action>
<action name="mActionPlatformUnix64Bit">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Unix 64-bit</string>
</property>
</action>
<action name="mActionPlatformWin64">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Windows 64-bit</string>
</property>
</action>
<action name="mActionPlatformDefault">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Default</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -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);
}

View File

@ -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:
/**