ENH: add ability to suppress dev warnings to gui code

This commit is contained in:
Bill Hoffman 2008-03-11 22:51:56 -04:00
parent fc26c1459c
commit 420725077c
8 changed files with 66 additions and 27 deletions

View File

@ -83,34 +83,28 @@ BEGIN
END
IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 447, 255
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "CMakeSetupDialog"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
RTEXT "Where is the source code:",IDC_STATIC,6,7,86,9
COMBOBOX IDC_WhereSource,96,6,169,12,CBS_SIMPLE | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_WhereSource,96,6,169,12,CBS_SIMPLE | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Browse...",IDC_BROWSE_SOURCE,267,6,34,13
RTEXT "Where to build the binaries:",IDC_STATIC,5,27,90,9
COMBOBOX IDC_WhereBuild,96,26,169,68,CBS_DROPDOWN |
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_WhereBuild,96,26,169,68,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Browse...",IDC_BROWSE_BUILD,267,25,34,13
CONTROL "Show Advanced Values",IDC_AdvancedValues,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,321,18,98,9
CONTROL "Show Advanced Values",IDC_AdvancedValues,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,321,9,98,9
DEFPUSHBUTTON "Configure",IDC_BuildProjects,84,221,51,15
PUSHBUTTON "OK",IDC_OK,141,221,51,15
PUSHBUTTON "Cancel",IDCANCEL,198,221,51,15
PUSHBUTTON "Help",IDC_HELP_BUTTON,312,221,51,15
LISTBOX IDC_LIST2,15,53,419,126,LBS_SORT | LBS_OWNERDRAWVARIABLE |
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_HSCROLL
LISTBOX IDC_LIST2,15,53,419,126,LBS_SORT | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL
GROUPBOX "Cache Values",IDC_FRAME,10,44,432,140
CTEXT "Right click on a cache value for additional options (delete, ignore, and help).\nPress Configure to update and display new values in red.\nPress OK to generate selected build files and exit.",
IDC_MouseHelpCaption,0,191,442,27
LTEXT "Static",IDC_PROGRESS,2,240,442,12,SS_CENTERIMAGE |
SS_SUNKEN
CTEXT "Right click on a cache value for additional options (delete, ignore, and help).\nPress Configure to update and display new values in red.\nPress OK to generate selected build files and exit.",IDC_MouseHelpCaption,0,191,442,27
LTEXT "Static",IDC_PROGRESS,2,240,442,12,SS_CENTERIMAGE | SS_SUNKEN
PUSHBUTTON "Delete Cache",IDC_DELETE_BUTTON,255,221,51,15
CONTROL "Suppress dev Warnings",IDC_SUPPRESS_DEV_WARNINGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,321,28,108,10
END
IDD_CMAKE_HELP_DIALOG DIALOG 0, 0, 365, 183
@ -118,22 +112,18 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "CMake Help"
BEGIN
DEFPUSHBUTTON "OK",IDOK,155,159,50,14
EDITTEXT IDC_EDIT1,7,7,351,152,ES_MULTILINE | ES_READONLY | NOT
WS_BORDER
EDITTEXT IDC_EDIT1,7,7,351,152,ES_MULTILINE | ES_READONLY | NOT WS_BORDER
END
IDD_GEN_DIALOG DIALOGEX 0, 0, 263, 86
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select Generator"
BEGIN
DEFPUSHBUTTON "OK",IDOK,70,65,50,14
PUSHBUTTON "Cancel",IDCANCEL,143,65,50,14
RTEXT "Build For:",IDC_BuildForLabel,7,45,34,11,SS_CENTERIMAGE
COMBOBOX IDC_Generator,52,45,204,117,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
CTEXT "Please select what build system you want CMake to generate files for.\nYou should select the tool that you will use to build the project.\nPress OK once you have made your selection.",
IDC_MouseHelpCaption,7,7,245,36
COMBOBOX IDC_Generator,52,45,204,117,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CTEXT "Please select what build system you want CMake to generate files for.\nYou should select the tool that you will use to build the project.\nPress OK once you have made your selection.",IDC_MouseHelpCaption,7,7,245,36
END

View File

@ -224,6 +224,8 @@ void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMakeSetupDialog)
DDX_Control(pDX, IDC_AdvancedValues, m_AdvancedValuesControl);
DDX_Control(pDX, IDC_SUPPRESS_DEV_WARNINGS, m_SuppressDevWarningsControl);
DDX_Check(pDX, IDC_SUPPRESS_DEV_WARNINGS, m_SuppressDevValue);
DDX_Control(pDX, IDC_BROWSE_SOURCE, m_BrowseSource);
DDX_Control(pDX, IDC_BROWSE_BUILD, m_BrowseBuild);
DDX_Control(pDX, IDC_DELETE_BUTTON, m_DeleteButton);
@ -261,6 +263,8 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
ON_BN_CLICKED(IDC_DELETE_BUTTON, OnDeleteButton)
ON_BN_CLICKED(IDC_HELP_BUTTON, OnHelpButton)
ON_BN_CLICKED(IDC_AdvancedValues, OnAdvancedValues)
ON_BN_CLICKED(IDC_SUPPRESS_DEV_WARNINGS, OnSuppressDevValue)
ON_BN_DOUBLECLICKED(IDC_SUPPRESS_DEV_WARNINGS, OnDoubleclickedSuppressDevValue)
ON_BN_DOUBLECLICKED(IDC_AdvancedValues, OnDoubleclickedAdvancedValues)
ON_WM_DROPFILES()
ON_BN_CLICKED(IDCANCEL, OnCancel)
@ -671,6 +675,7 @@ void CMakeSetupDialog::RunCMake(bool generateProjectFiles)
m_CMakeInstance->CreateGlobalGenerator(m_GeneratorDialog.m_GeneratorChoiceString));
m_CMakeInstance->SetCMakeCommand(m_PathToExecutable);
m_CMakeInstance->LoadCache();
m_CMakeInstance->SetSuppressDevWarnings(m_SuppressDevValue);
if(m_CMakeInstance->Configure() != 0)
{
cmSystemTools::Error(
@ -1073,6 +1078,13 @@ void CMakeSetupDialog::OnSize(UINT nType, int cx, int cy)
0, 0,
SWP_NOCOPYBITS |
SWP_NOSIZE | SWP_NOZORDER);
m_SuppressDevWarningsControl.GetWindowRect(&cRect);
this->ScreenToClient(&cRect);
m_SuppressDevWarningsControl.SetWindowPos(&wndTop, cRect.left + deltax,
cRect.top,
0, 0,
SWP_NOCOPYBITS |
SWP_NOSIZE | SWP_NOZORDER);
m_BrowseSource.GetWindowRect(&cRect);
this->ScreenToClient(&cRect);
m_BrowseSource.SetWindowPos(&wndTop, cRect.left + deltax,
@ -1383,6 +1395,15 @@ void CMakeSetupDialog::RemoveAdvancedValues()
}
void CMakeSetupDialog::OnSuppressDevValue()
{
}
void CMakeSetupDialog::OnDoubleclickedSuppressDevValue()
{
this->OnSuppressDevValue();
}
void CMakeSetupDialog::OnAdvancedValues()
{
this->UpdateData();

View File

@ -63,6 +63,7 @@ protected:
//{{AFX_DATA(CMakeSetupDialog)
enum { IDD = IDD_CMakeSetupDialog_DIALOG };
CButton m_AdvancedValuesControl;
CButton m_SuppressDevWarningsControl;
CButton m_BrowseSource;
CButton m_BrowseBuild;
CButton m_HelpButton;
@ -80,6 +81,7 @@ protected:
CStatic m_StatusDisplay;
CButton m_Configure;
BOOL m_AdvancedValues;
BOOL m_SuppressDevValue;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
@ -125,6 +127,8 @@ protected:
afx_msg void OnDeleteButton();
afx_msg void OnAdvancedValues();
afx_msg void OnDoubleclickedAdvancedValues();
afx_msg void OnSuppressDevValue();
afx_msg void OnDoubleclickedSuppressDevValue();
afx_msg void OnDropFiles(HDROP);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
//}}AFX_MSG

View File

@ -33,6 +33,8 @@
#define IDC_AdvancedValues 1027
#define IDC_PROGRESS 1028
#define IDC_BuildForLabel 1029
#define IDC_CHECK1 1030
#define IDC_SUPPRESS_DEV_WARNINGS 1030
// Next default values for new objects
//
@ -40,7 +42,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 135
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1030
#define _APS_NEXT_CONTROL_VALUE 1031
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif

View File

@ -59,6 +59,7 @@ void QCMakeThread::run()
CMakeSetupDialog::CMakeSetupDialog()
: ExitAfterGenerate(true), CacheModified(false), CurrentState(Interrupting)
{
this->SuppressDevWarnings = false;
// create the GUI
QSettings settings;
settings.beginGroup("Settings/StartPath");
@ -95,8 +96,11 @@ CMakeSetupDialog::CMakeSetupDialog()
this->GenerateAction = ToolsMenu->addAction(tr("&Generate"));
QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)),
this, SLOT(doGenerate()));
this->SuppressDevWarningsAction = ToolsMenu->addAction(tr("&Suppress dev Warnings"));
QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)),
this, SLOT(doSuppressDev()));
this->SuppressDevWarningsAction->setCheckable(true);
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
QAction* a = HelpMenu->addAction(tr("About"));
QObject::connect(a, SIGNAL(triggered(bool)),
@ -304,6 +308,14 @@ void CMakeSetupDialog::finishGenerate(int err)
}
}
#include <iostream>
void CMakeSetupDialog::doSuppressDev()
{
this->SuppressDevWarnings = !this->SuppressDevWarnings;
this->CMakeThread->cmakeInstance()->
SetSuppressDevWarnings(this->SuppressDevWarnings);
}
void CMakeSetupDialog::doGenerate()
{
if(this->CurrentState == Generating)

View File

@ -44,6 +44,7 @@ protected slots:
void initialize();
void doConfigure();
void doGenerate();
void doSuppressDev();
void doHelp();
void doAbout();
void doInterrupt();
@ -85,11 +86,13 @@ protected:
QCMakeThread* CMakeThread;
bool ExitAfterGenerate;
bool CacheModified;
bool SuppressDevWarnings;
QAction* ReloadCacheAction;
QAction* DeleteCacheAction;
QAction* ExitAction;
QAction* ConfigureAction;
QAction* GenerateAction;
QAction* SuppressDevWarningsAction;
State CurrentState;
};

View File

@ -28,6 +28,7 @@
QCMake::QCMake(QObject* p)
: QObject(p)
{
this->SuppressDevWarnings = false;
qRegisterMetaType<QCMakeCacheProperty>();
qRegisterMetaType<QCMakeCachePropertyList>();
@ -107,6 +108,7 @@ void QCMake::setBinaryDirectory(const QString& dir)
"Please check the permissions of the directory you are trying to run CMake on.");
}
}
QCMakeCachePropertyList props = this->properties();
emit this->propertiesChanged(props);
cmCacheManager::CacheIterator itm = cachem->NewIterator();
@ -143,6 +145,7 @@ void QCMake::configure()
this->CMakeInstance->SetGlobalGenerator(
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toAscii().data()));
this->CMakeInstance->LoadCache();
this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
this->CMakeInstance->PreLoadCMakeFiles();
cmSystemTools::ResetErrorOccuredFlag();
@ -360,3 +363,7 @@ void QCMake::reloadCache()
emit this->propertiesChanged(props);
}
void QCMake::SetSuppressDevWarnings(bool value)
{
this->SuppressDevWarnings = value;
}

View File

@ -65,7 +65,7 @@ class QCMake : public QObject
public:
QCMake(QObject* p=0);
~QCMake();
void SetSuppressDevWarnings(bool value);
public slots:
/// load the cache file in a directory
void loadCache(const QString& dir);
@ -125,7 +125,7 @@ protected:
static void progressCallback(const char* msg, float percent, void* cd);
static void errorCallback(const char* msg, const char* title,
bool&, void* cd);
bool SuppressDevWarnings;
QString SourceDirectory;
QString BinaryDirectory;
QString Generator;