GUI: Add dialog for editing project file.

This commit adds the dialog and code that reads the project file data
to the dialog. The changed data is not yet saved back to the file.
This commit is contained in:
Kimmo Varis 2010-07-07 21:18:42 +03:00
parent f5d3042635
commit 34d0ff73d8
7 changed files with 595 additions and 363 deletions

View File

@ -25,6 +25,7 @@ FORMS = main.ui \
application.ui \
settings.ui \
file.ui \
projectfile.ui \
about.ui
TRANSLATIONS = cppcheck_fi.ts \
@ -52,6 +53,7 @@ HEADERS += mainwindow.h \
common.h \
fileviewdialog.h \
projectfile.h \
projectfiledialog.h \
report.h \
txtreport.h \
xmlreport.h \
@ -70,6 +72,7 @@ SOURCES += main.cpp \
aboutdialog.cpp \
fileviewdialog.cpp \
projectfile.cpp \
projectfiledialog.cpp \
report.cpp \
txtreport.cpp \
xmlreport.cpp \

View File

@ -1,363 +1,369 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="windowTitle">
<string>Cppcheck</string>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<widget class="QWidget" name="mCentral">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="ResultsView" name="mResults" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="mMenuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="mMenuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="mActionSave"/>
<addaction name="mActionQuit"/>
</widget>
<widget class="QMenu" name="mMenuView">
<property name="title">
<string>&amp;View</string>
</property>
<widget class="QMenu" name="mMenuToolbars">
<property name="title">
<string>&amp;Toolbars</string>
</property>
<addaction name="mActionToolBarMain"/>
<addaction name="mActionToolBarView"/>
</widget>
<addaction name="mMenuToolbars"/>
<addaction name="separator"/>
<addaction name="mActionShowStyle"/>
<addaction name="mActionShowErrors"/>
<addaction name="mActionCheckAll"/>
<addaction name="mActionUncheckAll"/>
<addaction name="separator"/>
<addaction name="mActionCollapseAll"/>
<addaction name="mActionExpandAll"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="mMenuLanguage">
<property name="title">
<string>&amp;Language</string>
</property>
</widget>
<widget class="QMenu" name="mMenuHelp">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="mActionHelpContents"/>
<addaction name="mActionLicense"/>
<addaction name="mActionAuthors"/>
<addaction name="separator"/>
<addaction name="mActionAbout"/>
</widget>
<widget class="QMenu" name="mMenuCheck">
<property name="title">
<string>&amp;Check</string>
</property>
<addaction name="mActionCheckFiles"/>
<addaction name="mActionCheckDirectory"/>
<addaction name="mActionRecheck"/>
<addaction name="mActionStop"/>
</widget>
<widget class="QMenu" name="mMenuEdit">
<property name="title">
<string>&amp;Edit</string>
</property>
<addaction name="mActionClearResults"/>
<addaction name="mActionSettings"/>
</widget>
<addaction name="mMenuFile"/>
<addaction name="mMenuEdit"/>
<addaction name="mMenuView"/>
<addaction name="mMenuCheck"/>
<addaction name="mMenuLanguage"/>
<addaction name="mMenuHelp"/>
</widget>
<widget class="QToolBar" name="mToolBarMain">
<property name="windowTitle">
<string>Standard</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="mActionCheckDirectory"/>
<addaction name="mActionSave"/>
<addaction name="mActionRecheck"/>
<addaction name="mActionStop"/>
<addaction name="mActionClearResults"/>
<addaction name="mActionSettings"/>
<addaction name="mActionAbout"/>
</widget>
<widget class="QToolBar" name="mToolBarView">
<property name="windowTitle">
<string>Categories</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="mActionShowErrors"/>
<addaction name="mActionShowStyle"/>
</widget>
<action name="mActionLicense">
<property name="text">
<string>&amp;License...</string>
</property>
</action>
<action name="mActionAuthors">
<property name="text">
<string>A&amp;uthors...</string>
</property>
</action>
<action name="mActionAbout">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/help-browser.png</normaloff>:/images/help-browser.png</iconset>
</property>
<property name="text">
<string>&amp;About...</string>
</property>
</action>
<action name="mActionCheckFiles">
<property name="text">
<string>&amp;Files...</string>
</property>
<property name="shortcut">
<string>Ctrl+F</string>
</property>
</action>
<action name="mActionCheckDirectory">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<property name="text">
<string>&amp;Directory...</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
</property>
</action>
<action name="mActionRecheck">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/view-refresh.png</normaloff>:/images/view-refresh.png</iconset>
</property>
<property name="text">
<string>&amp;Recheck files</string>
</property>
<property name="shortcut">
<string>Ctrl+R</string>
</property>
</action>
<action name="mActionStop">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/process-stop.png</normaloff>:/images/process-stop.png</iconset>
</property>
<property name="text">
<string>&amp;Stop</string>
</property>
<property name="shortcut">
<string>Esc</string>
</property>
</action>
<action name="mActionSave">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/media-floppy.png</normaloff>:/images/media-floppy.png</iconset>
</property>
<property name="text">
<string>&amp;Save results to file...</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="mActionQuit">
<property name="text">
<string>&amp;Quit</string>
</property>
</action>
<action name="mActionClearResults">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/edit-clear.png</normaloff>:/images/edit-clear.png</iconset>
</property>
<property name="text">
<string>&amp;Clear results</string>
</property>
</action>
<action name="mActionSettings">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/preferences-system.png</normaloff>:/images/preferences-system.png</iconset>
</property>
<property name="text">
<string>&amp;Preferences</string>
</property>
</action>
<action name="mActionShowStyle">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/showstylewarnings.png</normaloff>:/images/showstylewarnings.png</iconset>
</property>
<property name="text">
<string>Show style errors</string>
</property>
</action>
<action name="mActionShowErrors">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/showerrors.png</normaloff>:/images/showerrors.png</iconset>
</property>
<property name="text">
<string>Show common errors</string>
</property>
</action>
<action name="mActionCheckAll">
<property name="text">
<string>&amp;Check all</string>
</property>
</action>
<action name="mActionUncheckAll">
<property name="text">
<string>&amp;Uncheck all</string>
</property>
</action>
<action name="mActionCollapseAll">
<property name="text">
<string>Collapse &amp;all</string>
</property>
</action>
<action name="mActionExpandAll">
<property name="text">
<string>&amp;Expand all</string>
</property>
</action>
<action name="mActionToolBarMain">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Standard</string>
</property>
<property name="toolTip">
<string>Standard items</string>
</property>
</action>
<action name="mActionHelpContents">
<property name="text">
<string>&amp;Contents</string>
</property>
<property name="statusTip">
<string>Open the help contents</string>
</property>
<property name="shortcut">
<string>F1</string>
</property>
</action>
<action name="actionToolbar">
<property name="text">
<string>Toolbar</string>
</property>
</action>
<action name="mActionToolBarView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Categories</string>
</property>
<property name="toolTip">
<string>Error categories</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>ResultsView</class>
<extends>QWidget</extends>
<header>resultsview.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="gui.qrc"/>
</resources>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="windowTitle">
<string>Cppcheck</string>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<widget class="QWidget" name="mCentral">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="ResultsView" name="mResults" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="mMenuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="mMenuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="mActionProjectFile"/>
<addaction name="mActionSave"/>
<addaction name="mActionQuit"/>
</widget>
<widget class="QMenu" name="mMenuView">
<property name="title">
<string>&amp;View</string>
</property>
<widget class="QMenu" name="mMenuToolbars">
<property name="title">
<string>&amp;Toolbars</string>
</property>
<addaction name="mActionToolBarMain"/>
<addaction name="mActionToolBarView"/>
</widget>
<addaction name="mMenuToolbars"/>
<addaction name="separator"/>
<addaction name="mActionShowStyle"/>
<addaction name="mActionShowErrors"/>
<addaction name="mActionCheckAll"/>
<addaction name="mActionUncheckAll"/>
<addaction name="separator"/>
<addaction name="mActionCollapseAll"/>
<addaction name="mActionExpandAll"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="mMenuLanguage">
<property name="title">
<string>&amp;Language</string>
</property>
</widget>
<widget class="QMenu" name="mMenuHelp">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="mActionHelpContents"/>
<addaction name="mActionLicense"/>
<addaction name="mActionAuthors"/>
<addaction name="separator"/>
<addaction name="mActionAbout"/>
</widget>
<widget class="QMenu" name="mMenuCheck">
<property name="title">
<string>&amp;Check</string>
</property>
<addaction name="mActionCheckFiles"/>
<addaction name="mActionCheckDirectory"/>
<addaction name="mActionRecheck"/>
<addaction name="mActionStop"/>
</widget>
<widget class="QMenu" name="mMenuEdit">
<property name="title">
<string>&amp;Edit</string>
</property>
<addaction name="mActionClearResults"/>
<addaction name="mActionSettings"/>
</widget>
<addaction name="mMenuFile"/>
<addaction name="mMenuEdit"/>
<addaction name="mMenuView"/>
<addaction name="mMenuCheck"/>
<addaction name="mMenuLanguage"/>
<addaction name="mMenuHelp"/>
</widget>
<widget class="QToolBar" name="mToolBarMain">
<property name="windowTitle">
<string>Standard</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="mActionCheckDirectory"/>
<addaction name="mActionSave"/>
<addaction name="mActionRecheck"/>
<addaction name="mActionStop"/>
<addaction name="mActionClearResults"/>
<addaction name="mActionSettings"/>
<addaction name="mActionAbout"/>
</widget>
<widget class="QToolBar" name="mToolBarView">
<property name="windowTitle">
<string>Categories</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="mActionShowErrors"/>
<addaction name="mActionShowStyle"/>
</widget>
<action name="mActionLicense">
<property name="text">
<string>&amp;License...</string>
</property>
</action>
<action name="mActionAuthors">
<property name="text">
<string>A&amp;uthors...</string>
</property>
</action>
<action name="mActionAbout">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/help-browser.png</normaloff>:/images/help-browser.png</iconset>
</property>
<property name="text">
<string>&amp;About...</string>
</property>
</action>
<action name="mActionCheckFiles">
<property name="text">
<string>&amp;Files...</string>
</property>
<property name="shortcut">
<string>Ctrl+F</string>
</property>
</action>
<action name="mActionCheckDirectory">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<property name="text">
<string>&amp;Directory...</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
</property>
</action>
<action name="mActionRecheck">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/view-refresh.png</normaloff>:/images/view-refresh.png</iconset>
</property>
<property name="text">
<string>&amp;Recheck files</string>
</property>
<property name="shortcut">
<string>Ctrl+R</string>
</property>
</action>
<action name="mActionStop">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/process-stop.png</normaloff>:/images/process-stop.png</iconset>
</property>
<property name="text">
<string>&amp;Stop</string>
</property>
<property name="shortcut">
<string>Esc</string>
</property>
</action>
<action name="mActionSave">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/media-floppy.png</normaloff>:/images/media-floppy.png</iconset>
</property>
<property name="text">
<string>&amp;Save results to file...</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="mActionQuit">
<property name="text">
<string>&amp;Quit</string>
</property>
</action>
<action name="mActionClearResults">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/edit-clear.png</normaloff>:/images/edit-clear.png</iconset>
</property>
<property name="text">
<string>&amp;Clear results</string>
</property>
</action>
<action name="mActionSettings">
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/preferences-system.png</normaloff>:/images/preferences-system.png</iconset>
</property>
<property name="text">
<string>&amp;Preferences</string>
</property>
</action>
<action name="mActionShowStyle">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/showstylewarnings.png</normaloff>:/images/showstylewarnings.png</iconset>
</property>
<property name="text">
<string>Show style errors</string>
</property>
</action>
<action name="mActionShowErrors">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="gui.qrc">
<normaloff>:/images/showerrors.png</normaloff>:/images/showerrors.png</iconset>
</property>
<property name="text">
<string>Show common errors</string>
</property>
</action>
<action name="mActionCheckAll">
<property name="text">
<string>&amp;Check all</string>
</property>
</action>
<action name="mActionUncheckAll">
<property name="text">
<string>&amp;Uncheck all</string>
</property>
</action>
<action name="mActionCollapseAll">
<property name="text">
<string>Collapse &amp;all</string>
</property>
</action>
<action name="mActionExpandAll">
<property name="text">
<string>&amp;Expand all</string>
</property>
</action>
<action name="mActionToolBarMain">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Standard</string>
</property>
<property name="toolTip">
<string>Standard items</string>
</property>
</action>
<action name="mActionHelpContents">
<property name="text">
<string>&amp;Contents</string>
</property>
<property name="statusTip">
<string>Open the help contents</string>
</property>
<property name="shortcut">
<string>F1</string>
</property>
</action>
<action name="actionToolbar">
<property name="text">
<string>Toolbar</string>
</property>
</action>
<action name="mActionToolBarView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Categories</string>
</property>
<property name="toolTip">
<string>Error categories</string>
</property>
</action>
<action name="mActionProjectFile">
<property name="text">
<string>P&amp;roject File...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>ResultsView</class>
<extends>QWidget</extends>
<header>resultsview.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="gui.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -31,6 +31,7 @@
#include "threadhandler.h"
#include "fileviewdialog.h"
#include "projectfile.h"
#include "projectfiledialog.h"
#include "report.h"
#include "../lib/filelister.h"
@ -79,6 +80,8 @@ MainWindow::MainWindow() :
connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded()));
connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu()));
connect(mUI.mActionProjectFile, SIGNAL(triggered()), this, SLOT(ShowProjectFileDialog()));
#ifdef WIN32
connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));
#else
@ -661,3 +664,18 @@ void MainWindow::OpenHtmlHelpContents()
HtmlHelp(NULL, exeFolder.utf16(), HH_DISPLAY_TOPIC, NULL);
#endif // WIN32
}
void MainWindow::ShowProjectFileDialog()
{
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
QString filepath = QFileDialog::getOpenFileName(this,
tr("Select Project File"),
QString(),
filter);
if (!filepath.isEmpty())
{
ProjectFileDialog dlg(filepath, this);
dlg.exec();
}
}

View File

@ -125,6 +125,8 @@ public slots:
*/
void Save();
void ShowProjectFileDialog();
protected slots:
/**

105
gui/projectfile.ui Normal file
View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProjectFile</class>
<widget class="QDialog" name="ProjectFile">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>112</height>
</rect>
</property>
<property name="windowTitle">
<string>Project File</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Include paths:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mEditIncludePaths"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Defines:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mEditDefines"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="mButtons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>mButtons</sender>
<signal>accepted()</signal>
<receiver>ProjectFile</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>mButtons</sender>
<signal>rejected()</signal>
<receiver>ProjectFile</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

53
gui/projectfiledialog.cpp Normal file
View File

@ -0,0 +1,53 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QStringList>
#include "projectfiledialog.h"
#include "projectfile.h"
ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
: QDialog(parent)
, mFileName(path)
{
mUI.setupUi(this);
mPFile = new ProjectFile(path, this);
mPFile->Read();
QStringList includes = mPFile->GetIncludeDirs();
QString includestr;
QString dir;
foreach(dir, includes)
{
includestr += dir;
includestr += ";";
}
mUI.mEditIncludePaths->setText(includestr);
QStringList defines = mPFile->GetDefines();
QString definestr;
QString define;
foreach(define, defines)
{
definestr += define;
definestr += ";";
}
mUI.mEditDefines->setText(definestr);
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
}

45
gui/projectfiledialog.h Normal file
View File

@ -0,0 +1,45 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROJECTFILE_DIALOG_H
#define PROJECTFILE_DIALOG_H
#include <QDialog>
#include <QString>
#include "ui_projectfile.h"
class ProjectFile;
/// @addtogroup GUI
/// @{
class ProjectFileDialog : public QDialog
{
Q_OBJECT
public:
ProjectFileDialog(const QString &path, QWidget *parent = 0);
private:
Ui::ProjectFile mUI;
QString mFileName;
ProjectFile *mPFile;
};
/// @}
#endif // PROJECTFILE_DIALOG_H