diff --git a/cli/cppcheck.vcproj b/cli/cppcheck.vcproj index cd313c031ff..7450d15f3b6 100755 --- a/cli/cppcheck.vcproj +++ b/cli/cppcheck.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++" Version="9,00" Name="cppcheck" - ProjectGUID="{230A4467-25A6-3276-A1D0-CB521812CD43}" + ProjectGUID="{56B0F403-02CE-3F89-9A1B-E03F21240A63}" Keyword="Qt4VSv1.0"> + + + + + + setVisible(false); @@ -151,6 +146,13 @@ MainWindow::MainWindow() : mUI.mActionProjectMRU->setVisible(false); UpdateMRUMenuItems(); + QStringList args = QCoreApplication::arguments(); + //Remove the application itself + args.removeFirst(); + if (!args.isEmpty()) { + HandleCLIParams(args); + } + for (int i = 0; i < mPlatforms.getCount(); i++) { Platform plat = mPlatforms.mPlatforms[i]; QAction *act = new QAction(this); @@ -846,14 +848,19 @@ void MainWindow::OpenOnlineHelp() void MainWindow::OpenProjectFile() { + const QString lastPath = mSettings->value(SETTINGS_LAST_PROJECT_PATH, QString()).toString(); const QString filter = tr("Project files (*.cppcheck);;All files(*.*)"); - QString filepath = QFileDialog::getOpenFileName(this, - tr("Select Project File"), - QString(), - filter); + const QString filepath = QFileDialog::getOpenFileName(this, + tr("Select Project File"), + lastPath, + filter); if (!filepath.isEmpty()) { - LoadProjectFile(filepath); + const QFileInfo fi(filepath); + if (fi.exists() && fi.isFile() && fi.isReadable()) { + mSettings->setValue(SETTINGS_LAST_PROJECT_PATH, fi.path()); + LoadProjectFile(filepath); + } } } diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index 36d6a199e35..405e5bdc5aa 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -204,13 +204,23 @@ void ProjectFileDialog::SetExcludedPaths(const QStringList &paths) void ProjectFileDialog::AddIncludeDir() { - QFileInfo inf(mFilePath); + const QFileInfo inf(mFilePath); const QString rootpath = inf.absolutePath(); QString selectedDir = QFileDialog::getExistingDirectory(this, tr("Select include directory"), rootpath); if (!selectedDir.isEmpty()) { + // Check if the path is relative to project file's path and if so + // make it a relative path instead of absolute path. + const QDir dir(selectedDir); + QString absPath = dir.absolutePath(); + if (absPath.startsWith(rootpath)) { + // Remove also the slash from begin of new relative path + selectedDir = absPath.remove(0, rootpath.length() + 1); + } + if (!selectedDir.endsWith("/")) + selectedDir += '/'; AddIncludeDir(selectedDir); } } diff --git a/test/testrunner.vcproj b/test/testrunner.vcproj index 48611545b0b..6f9d24e9e85 100644 --- a/test/testrunner.vcproj +++ b/test/testrunner.vcproj @@ -1,9 +1,9 @@ + PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,HAVE_RULES,_CRT_SECURE_NO_WARNINGS,_DEBUG" /> + PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,HAVE_RULES,_CRT_SECURE_NO_WARNINGS" /> @@ -135,6 +137,8 @@ RelativePath="..\lib\checkclass.cpp" /> + + + + +