GUI: Add menuitem to edit open project file.
Earlier we opened project file only for editing. But now that we really use project files we need separate feature for editing them.
This commit is contained in:
parent
ab1aaf9a45
commit
0f4d067926
11
gui/main.ui
11
gui/main.ui
|
@ -74,9 +74,12 @@
|
||||||
<string>&File</string>
|
<string>&File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="mActionOpenXML"/>
|
<addaction name="mActionOpenXML"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="mActionNewProjectFile"/>
|
<addaction name="mActionNewProjectFile"/>
|
||||||
<addaction name="mActionOpenProjectFile"/>
|
<addaction name="mActionOpenProjectFile"/>
|
||||||
|
<addaction name="mActionEditProjectFile"/>
|
||||||
<addaction name="mActionCloseProjectFile"/>
|
<addaction name="mActionCloseProjectFile"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="mActionSave"/>
|
<addaction name="mActionSave"/>
|
||||||
<addaction name="mActionQuit"/>
|
<addaction name="mActionQuit"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -383,6 +386,14 @@
|
||||||
<string>C&lose Project File</string>
|
<string>C&lose Project File</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="mActionEditProjectFile">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Edit Project File...</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -90,6 +90,7 @@ MainWindow::MainWindow() :
|
||||||
connect(mUI.mActionNewProjectFile, SIGNAL(triggered()), this, SLOT(NewProjectFile()));
|
connect(mUI.mActionNewProjectFile, SIGNAL(triggered()), this, SLOT(NewProjectFile()));
|
||||||
connect(mUI.mActionOpenProjectFile, SIGNAL(triggered()), this, SLOT(OpenProjectFile()));
|
connect(mUI.mActionOpenProjectFile, SIGNAL(triggered()), this, SLOT(OpenProjectFile()));
|
||||||
connect(mUI.mActionCloseProjectFile, SIGNAL(triggered()), this, SLOT(CloseProjectFile()));
|
connect(mUI.mActionCloseProjectFile, SIGNAL(triggered()), this, SLOT(CloseProjectFile()));
|
||||||
|
connect(mUI.mActionEditProjectFile, SIGNAL(triggered()), this, SLOT(EditProjectFile()));
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));
|
connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));
|
||||||
|
@ -692,6 +693,7 @@ void MainWindow::OpenProjectFile()
|
||||||
if (!filepath.isEmpty())
|
if (!filepath.isEmpty())
|
||||||
{
|
{
|
||||||
mUI.mActionCloseProjectFile->setEnabled(true);
|
mUI.mActionCloseProjectFile->setEnabled(true);
|
||||||
|
mUI.mActionEditProjectFile->setEnabled(true);
|
||||||
mProject = new Project(filepath, this);
|
mProject = new Project(filepath, this);
|
||||||
mProject->Open();
|
mProject->Open();
|
||||||
QStringList paths = mProject->GetProjectFile()->GetCheckPaths();
|
QStringList paths = mProject->GetProjectFile()->GetCheckPaths();
|
||||||
|
@ -714,6 +716,7 @@ void MainWindow::NewProjectFile()
|
||||||
Project prj(filepath, this);
|
Project prj(filepath, this);
|
||||||
prj.Create();
|
prj.Create();
|
||||||
prj.Edit();
|
prj.Edit();
|
||||||
|
mUI.mActionEditProjectFile->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,6 +725,22 @@ void MainWindow::CloseProjectFile()
|
||||||
delete mProject;
|
delete mProject;
|
||||||
mProject = NULL;
|
mProject = NULL;
|
||||||
mUI.mActionCloseProjectFile->setEnabled(false);
|
mUI.mActionCloseProjectFile->setEnabled(false);
|
||||||
|
mUI.mActionEditProjectFile->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::EditProjectFile()
|
||||||
|
{
|
||||||
|
if (!mProject)
|
||||||
|
{
|
||||||
|
QMessageBox msg(QMessageBox::Critical,
|
||||||
|
tr("Cppcheck"),
|
||||||
|
QString(tr("No project file loaded")),
|
||||||
|
QMessageBox::Ok,
|
||||||
|
this);
|
||||||
|
msg.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mProject->Edit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ShowLogView()
|
void MainWindow::ShowLogView()
|
||||||
|
|
|
@ -152,6 +152,12 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void CloseProjectFile();
|
void CloseProjectFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to edit project file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void EditProjectFile();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Slot for showing the log view.
|
* @brief Slot for showing the log view.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue