@@ -86,53 +86,40 @@ bool Project::Open()
8686bool Project::Edit ()
8787{
8888 ProjectFileDialog dlg (mFilename , mParentWidget );
89- QString root = mPFile ->GetRootPath ();
90- dlg.SetRootPath (root);
91- QStringList includes = mPFile ->GetIncludeDirs ();
92- dlg.SetIncludepaths (includes);
93- QStringList defines = mPFile ->GetDefines ();
94- dlg.SetDefines (defines);
95- QStringList paths = mPFile ->GetCheckPaths ();
96- dlg.SetPaths (paths);
97- QString importProject = mPFile ->GetImportProject ();
98- dlg.SetImportProject (importProject);
99- QStringList ignorepaths = mPFile ->GetExcludedPaths ();
100- dlg.SetExcludedPaths (ignorepaths);
101- QStringList libraries = mPFile ->GetLibraries ();
102- dlg.SetLibraries (libraries);
103- QStringList suppressions = mPFile ->GetSuppressions ();
104- dlg.SetSuppressions (suppressions);
105-
106- int rv = dlg.exec ();
107- if (rv == QDialog::Accepted) {
108- QString root = dlg.GetRootPath ();
109- mPFile ->SetRootPath (root);
110- mPFile ->SetImportProject (dlg.GetImportProject ());
111- QStringList includes = dlg.GetIncludePaths ();
112- mPFile ->SetIncludes (includes);
113- QStringList defines = dlg.GetDefines ();
114- mPFile ->SetDefines (defines);
115- QStringList paths = dlg.GetPaths ();
116- mPFile ->SetCheckPaths (paths);
117- QStringList excludedpaths = dlg.GetExcludedPaths ();
118- mPFile ->SetExcludedPaths (excludedpaths);
119- QStringList libraries = dlg.GetLibraries ();
120- mPFile ->SetLibraries (libraries);
121- QStringList suppressions = dlg.GetSuppressions ();
122- mPFile ->SetSuppressions (suppressions);
123-
124- bool writeSuccess = mPFile ->Write ();
125- if (!writeSuccess) {
126- QMessageBox msg (QMessageBox::Critical,
127- tr (" Cppcheck" ),
128- tr (" Could not write the project file." ),
129- QMessageBox::Ok,
130- mParentWidget );
131- msg.exec ();
132- }
133- return writeSuccess;
89+ dlg.SetRootPath (mPFile ->GetRootPath ());
90+ dlg.SetBuildDir (mPFile ->GetBuildDir ());
91+ dlg.SetIncludepaths (mPFile ->GetIncludeDirs ());
92+ dlg.SetDefines (mPFile ->GetDefines ());
93+ dlg.SetPaths (mPFile ->GetCheckPaths ());
94+ dlg.SetImportProject (mPFile ->GetImportProject ());
95+ dlg.SetExcludedPaths (mPFile ->GetExcludedPaths ());
96+ dlg.SetLibraries (mPFile ->GetLibraries ());
97+ dlg.SetSuppressions (mPFile ->GetSuppressions ());
98+
99+ if (dlg.exec () != QDialog::Accepted)
100+ return false ;
101+
102+ mPFile ->SetRootPath (dlg.GetRootPath ());
103+ mPFile ->SetBuildDir (dlg.GetBuildDir ());
104+ mPFile ->SetImportProject (dlg.GetImportProject ());
105+ mPFile ->SetIncludes (dlg.GetIncludePaths ());
106+ mPFile ->SetDefines (dlg.GetDefines ());
107+ mPFile ->SetCheckPaths (dlg.GetPaths ());
108+ mPFile ->SetExcludedPaths (dlg.GetExcludedPaths ());
109+ mPFile ->SetLibraries (dlg.GetLibraries ());
110+ mPFile ->SetSuppressions (dlg.GetSuppressions ());
111+
112+ if (!mPFile ->Write ()) {
113+ QMessageBox msg (QMessageBox::Critical,
114+ tr (" Cppcheck" ),
115+ tr (" Could not write the project file." ),
116+ QMessageBox::Ok,
117+ mParentWidget );
118+ msg.exec ();
119+ return false ;
134120 }
135- return false ;
121+
122+ return true ;
136123}
137124
138125void Project::Create ()
0 commit comments