Skip to content

Commit fe3d6bf

Browse files
author
Daniel Marjamäki
committed
Merge pull request #75 from kimmov/guifixes
GUI fixes + VS 2008 project files update
2 parents fb248ed + cc92f1c commit fe3d6bf

5 files changed

Lines changed: 72 additions & 30 deletions

File tree

‎cli/cppcheck.vcproj‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ProjectType="Visual C++"
44
Version="9,00"
55
Name="cppcheck"
6-
ProjectGUID="{230A4467-25A6-3276-A1D0-CB521812CD43}"
6+
ProjectGUID="{56B0F403-02CE-3F89-9A1B-E03F21240A63}"
77
Keyword="Qt4VSv1.0">
88
<Platforms>
99
<Platform
@@ -19,8 +19,8 @@
1919
UseOfMfc="0">
2020
<Tool
2121
Name="VCCLCompilerTool"
22-
AdditionalIncludeDirectories="&quot;.&quot;,&quot;..\lib&quot;,&quot;..\externals&quot;,&quot;..\externals\tinyxml&quot;,..\..\Qt\VS4.7.0\mkspecs\win32-msvc2008"
23-
AdditionalOptions="-Zm200 -w34100 -w34189"
22+
AdditionalIncludeDirectories="&quot;.&quot;,&quot;..\lib&quot;,&quot;..\externals&quot;,&quot;..\externals\tinyxml&quot;,..\..\..\..\Qt\qt-everywhere-opensource-src-4.7.3-vs2008-x86\mkspecs\win32-msvc2008"
23+
AdditionalOptions="-Zm200 -w34100 -w34189 -MP"
2424
AssemblerListingLocation="temp\"
2525
BufferSecurityCheck="false"
2626
DebugInformationFormat="3"
@@ -72,8 +72,8 @@
7272
UseOfMfc="0">
7373
<Tool
7474
Name="VCCLCompilerTool"
75-
AdditionalIncludeDirectories="&quot;.&quot;,&quot;..\lib&quot;,&quot;..\externals&quot;,&quot;..\externals\tinyxml&quot;,..\..\Qt\VS4.7.0\mkspecs\win32-msvc2008"
76-
AdditionalOptions="-Zm200 -w34100 -w34189"
75+
AdditionalIncludeDirectories="&quot;.&quot;,&quot;..\lib&quot;,&quot;..\externals&quot;,&quot;..\externals\tinyxml&quot;,..\..\..\..\Qt\qt-everywhere-opensource-src-4.7.3-vs2008-x86\mkspecs\win32-msvc2008"
76+
AdditionalOptions="-Zm200 -w34100 -w34189 -MP"
7777
AssemblerListingLocation="temp\"
7878
BufferSecurityCheck="false"
7979
DebugInformationFormat="0"
@@ -129,12 +129,16 @@
129129
RelativePath="..\lib\checkassignif.cpp" />
130130
<File
131131
RelativePath="..\lib\checkautovariables.cpp" />
132+
<File
133+
RelativePath="..\lib\checkboost.cpp" />
132134
<File
133135
RelativePath="..\lib\checkbufferoverrun.cpp" />
134136
<File
135137
RelativePath="..\lib\checkclass.cpp" />
136138
<File
137139
RelativePath="..\lib\checkexceptionsafety.cpp" />
140+
<File
141+
RelativePath="..\lib\checkinternal.cpp" />
138142
<File
139143
RelativePath="..\lib\checkmemoryleak.cpp" />
140144
<File
@@ -183,6 +187,8 @@
183187
RelativePath="..\lib\suppressions.cpp" />
184188
<File
185189
RelativePath="..\lib\symboldatabase.cpp" />
190+
<File
191+
RelativePath="..\lib\templatesimplifier.cpp" />
186192
<File
187193
RelativePath="threadexecutor.cpp" />
188194
<File
@@ -212,12 +218,16 @@
212218
RelativePath="..\lib\checkassignif.h" />
213219
<File
214220
RelativePath="..\lib\checkautovariables.h" />
221+
<File
222+
RelativePath="..\lib\checkboost.h" />
215223
<File
216224
RelativePath="..\lib\checkbufferoverrun.h" />
217225
<File
218226
RelativePath="..\lib\checkclass.h" />
219227
<File
220228
RelativePath="..\lib\checkexceptionsafety.h" />
229+
<File
230+
RelativePath="..\lib\checkinternal.h" />
221231
<File
222232
RelativePath="..\lib\checkmemoryleak.h" />
223233
<File
@@ -266,6 +276,8 @@
266276
RelativePath="..\lib\suppressions.h" />
267277
<File
268278
RelativePath="..\lib\symboldatabase.h" />
279+
<File
280+
RelativePath="..\lib\templatesimplifier.h" />
269281
<File
270282
RelativePath="threadexecutor.h" />
271283
<File

‎gui/common.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#define PROGRESS_MAX 1024.0
8282

8383
#define SETTINGS_CHECKED_PLATFORM "Checked platform"
84+
#define SETTINGS_LAST_PROJECT_PATH "Last project path"
8485

8586
/// @}
8687
#endif

‎gui/mainwindow.cpp‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,8 @@ MainWindow::MainWindow() :
135135
EnableProjectOpenActions(true);
136136
EnableProjectActions(false);
137137

138-
QStringList args = QCoreApplication::arguments();
139-
//Remove the application itself
140-
args.removeFirst();
141-
if (!args.isEmpty()) {
142-
HandleCLIParams(args);
143-
}
144-
138+
// Must setup MRU menu before CLI param handling as it can load a
139+
// project file and update MRU menu.
145140
for (int i = 0; i < MaxRecentProjects; ++i) {
146141
mRecentProjectActs[i] = new QAction(this);
147142
mRecentProjectActs[i]->setVisible(false);
@@ -152,6 +147,13 @@ MainWindow::MainWindow() :
152147
mUI.mActionProjectMRU->setVisible(false);
153148
UpdateMRUMenuItems();
154149

150+
QStringList args = QCoreApplication::arguments();
151+
//Remove the application itself
152+
args.removeFirst();
153+
if (!args.isEmpty()) {
154+
HandleCLIParams(args);
155+
}
156+
155157
for (int i = 0; i < mPlatforms.getCount(); i++) {
156158
Platform plat = mPlatforms.mPlatforms[i];
157159
QAction *act = new QAction(this);
@@ -851,14 +853,19 @@ void MainWindow::OpenOnlineHelp()
851853

852854
void MainWindow::OpenProjectFile()
853855
{
856+
const QString lastPath = mSettings->value(SETTINGS_LAST_PROJECT_PATH, QString()).toString();
854857
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
855-
QString filepath = QFileDialog::getOpenFileName(this,
856-
tr("Select Project File"),
857-
QString(),
858-
filter);
858+
const QString filepath = QFileDialog::getOpenFileName(this,
859+
tr("Select Project File"),
860+
lastPath,
861+
filter);
859862

860863
if (!filepath.isEmpty()) {
861-
LoadProjectFile(filepath);
864+
const QFileInfo fi(filepath);
865+
if (fi.exists() && fi.isFile() && fi.isReadable()) {
866+
mSettings->setValue(SETTINGS_LAST_PROJECT_PATH, fi.path());
867+
LoadProjectFile(filepath);
868+
}
862869
}
863870
}
864871

‎gui/projectfiledialog.cpp‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,23 @@ void ProjectFileDialog::SetExcludedPaths(const QStringList &paths)
204204

205205
void ProjectFileDialog::AddIncludeDir()
206206
{
207-
QFileInfo inf(mFilePath);
207+
const QFileInfo inf(mFilePath);
208208
const QString rootpath = inf.absolutePath();
209209
QString selectedDir = QFileDialog::getExistingDirectory(this,
210210
tr("Select include directory"),
211211
rootpath);
212212

213213
if (!selectedDir.isEmpty()) {
214+
// Check if the path is relative to project file's path and if so
215+
// make it a relative path instead of absolute path.
216+
const QDir dir(selectedDir);
217+
QString absPath = dir.absolutePath();
218+
if (absPath.startsWith(rootpath)) {
219+
// Remove also the slash from begin of new relative path
220+
selectedDir = absPath.remove(0, rootpath.length() + 1);
221+
}
222+
if (!selectedDir.endsWith("/"))
223+
selectedDir += '/';
214224
AddIncludeDir(selectedDir);
215225
}
216226
}

‎test/testrunner.vcproj‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="Windows-1252"?>
22
<VisualStudioProject
33
ProjectType="Visual C++"
4-
Version="7.00"
4+
Version="9,00"
55
Name="testrunner"
6-
ProjectGUID="{499B17DA-AB07-38BE-B1CD-F7370CA0E0EE}"
6+
ProjectGUID="{A1772A4C-E3F0-33FC-9A59-2189857FB799}"
77
Keyword="Qt4VSv1.0">
88
<Platforms>
99
<Platform
@@ -19,16 +19,16 @@
1919
UseOfMfc="0">
2020
<Tool
2121
Name="VCCLCompilerTool"
22-
AdditionalIncludeDirectories="&quot;.&quot;,&quot;..\cli&quot;,&quot;..\lib&quot;,&quot;..\externals\tinyxml&quot;,..\..\Qt\VS4.7.3\mkspecs\win32-msvc2008"
23-
AdditionalOptions="-Zm200 -w34100 -w34189"
22+
AdditionalIncludeDirectories="&quot;.&quot;,&quot;..\cli&quot;,&quot;..\lib&quot;,&quot;..\externals&quot;,&quot;..\externals\tinyxml&quot;,..\..\..\..\Qt\qt-everywhere-opensource-src-4.7.3-vs2008-x86\mkspecs\win32-msvc2008"
23+
AdditionalOptions="-Zm200 -w34100 -w34189 -MP"
2424
AssemblerListingLocation="temp\"
2525
BufferSecurityCheck="false"
2626
DebugInformationFormat="3"
2727
ExceptionHandling="1"
2828
GeneratePreprocessedFile="0"
2929
ObjectFile="temp\"
3030
Optimization ="4"
31-
PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,_CRT_SECURE_NO_WARNINGS"
31+
PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,HAVE_RULES,_CRT_SECURE_NO_WARNINGS"
3232
ProgramDataBaseFileName=".\"
3333
RuntimeLibrary="3"
3434
RuntimeTypeInfo="true"
@@ -39,7 +39,8 @@
3939
Name="VCCustomBuildTool" />
4040
<Tool
4141
Name="VCLinkerTool"
42-
AdditionalDependencies="shlwapi.lib"
42+
AdditionalDependencies="shlwapi.lib ../externals\pcre.lib"
43+
AdditionalLibraryDirectories="../externals"
4344
GenerateDebugInformation="true"
4445
IgnoreImportLibrary="true"
4546
LinkTimeCodeGeneration="0"
@@ -60,7 +61,7 @@
6061
Name="VCPreLinkEventTool" />
6162
<Tool
6263
Name="VCResourceCompilerTool"
63-
PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,_CRT_SECURE_NO_WARNINGS,_DEBUG" />
64+
PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,HAVE_RULES,_CRT_SECURE_NO_WARNINGS,_DEBUG" />
6465
</Configuration>
6566
<Configuration
6667
Name="Release|Win32"
@@ -71,16 +72,16 @@
7172
UseOfMfc="0">
7273
<Tool
7374
Name="VCCLCompilerTool"
74-
AdditionalIncludeDirectories="&quot;.&quot;,&quot;..\cli&quot;,&quot;..\lib&quot;,&quot;..\externals\tinyxml&quot;,..\..\Qt\VS4.7.3\mkspecs\win32-msvc2008"
75-
AdditionalOptions="-Zm200 -w34100 -w34189"
75+
AdditionalIncludeDirectories="&quot;.&quot;,&quot;..\cli&quot;,&quot;..\lib&quot;,&quot;..\externals&quot;,&quot;..\externals\tinyxml&quot;,..\..\..\..\Qt\qt-everywhere-opensource-src-4.7.3-vs2008-x86\mkspecs\win32-msvc2008"
76+
AdditionalOptions="-Zm200 -w34100 -w34189 -MP"
7677
AssemblerListingLocation="temp\"
7778
BufferSecurityCheck="false"
7879
DebugInformationFormat="0"
7980
ExceptionHandling="1"
8081
GeneratePreprocessedFile="0"
8182
ObjectFile="temp\"
8283
Optimization ="2"
83-
PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,_CRT_SECURE_NO_WARNINGS,NDEBUG"
84+
PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,HAVE_RULES,_CRT_SECURE_NO_WARNINGS,NDEBUG"
8485
ProgramDataBaseFileName=".\"
8586
RuntimeLibrary="2"
8687
RuntimeTypeInfo="true"
@@ -91,7 +92,8 @@
9192
Name="VCCustomBuildTool" />
9293
<Tool
9394
Name="VCLinkerTool"
94-
AdditionalDependencies="shlwapi.lib"
95+
AdditionalDependencies="shlwapi.lib ../externals\pcre.lib"
96+
AdditionalLibraryDirectories="../externals"
9597
GenerateDebugInformation="false"
9698
IgnoreImportLibrary="true"
9799
LinkIncremental="1"
@@ -113,7 +115,7 @@
113115
Name="VCPreLinkEventTool" />
114116
<Tool
115117
Name="VCResourceCompilerTool"
116-
PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,_CRT_SECURE_NO_WARNINGS" />
118+
PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,HAVE_RULES,_CRT_SECURE_NO_WARNINGS" />
117119
</Configuration>
118120
</Configurations>
119121
<Files>
@@ -135,6 +137,8 @@
135137
RelativePath="..\lib\checkclass.cpp" />
136138
<File
137139
RelativePath="..\lib\checkexceptionsafety.cpp" />
140+
<File
141+
RelativePath="..\lib\checkinternal.cpp" />
138142
<File
139143
RelativePath="..\lib\checkmemoryleak.cpp" />
140144
<File
@@ -183,12 +187,16 @@
183187
RelativePath="..\lib\suppressions.cpp" />
184188
<File
185189
RelativePath="..\lib\symboldatabase.cpp" />
190+
<File
191+
RelativePath="..\lib\templatesimplifier.cpp" />
186192
<File
187193
RelativePath="test64bit.cpp" />
188194
<File
189195
RelativePath="testassignif.cpp" />
190196
<File
191197
RelativePath="testautovariables.cpp" />
198+
<File
199+
RelativePath="testboost.cpp" />
192200
<File
193201
RelativePath="testbufferoverrun.cpp" />
194202
<File
@@ -296,6 +304,8 @@
296304
RelativePath="..\lib\checkclass.h" />
297305
<File
298306
RelativePath="..\lib\checkexceptionsafety.h" />
307+
<File
308+
RelativePath="..\lib\checkinternal.h" />
299309
<File
300310
RelativePath="..\lib\checkmemoryleak.h" />
301311
<File
@@ -346,6 +356,8 @@
346356
RelativePath="..\lib\suppressions.h" />
347357
<File
348358
RelativePath="..\lib\symboldatabase.h" />
359+
<File
360+
RelativePath="..\lib\templatesimplifier.h" />
349361
<File
350362
RelativePath="testsuite.h" />
351363
<File

0 commit comments

Comments
 (0)