GUI: Add menuitem to close open project file.

This commit is contained in:
Kimmo Varis 2010-08-15 12:12:28 +03:00
parent c98d398398
commit ab1aaf9a45
3 changed files with 25 additions and 0 deletions

View File

@ -76,6 +76,7 @@
<addaction name="mActionOpenXML"/> <addaction name="mActionOpenXML"/>
<addaction name="mActionNewProjectFile"/> <addaction name="mActionNewProjectFile"/>
<addaction name="mActionOpenProjectFile"/> <addaction name="mActionOpenProjectFile"/>
<addaction name="mActionCloseProjectFile"/>
<addaction name="mActionSave"/> <addaction name="mActionSave"/>
<addaction name="mActionQuit"/> <addaction name="mActionQuit"/>
</widget> </widget>
@ -374,6 +375,14 @@
<string>Log View</string> <string>Log View</string>
</property> </property>
</action> </action>
<action name="mActionCloseProjectFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>C&amp;lose Project File</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -89,6 +89,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()));
#ifdef WIN32 #ifdef WIN32
connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents())); connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));
@ -690,6 +691,7 @@ void MainWindow::OpenProjectFile()
if (!filepath.isEmpty()) if (!filepath.isEmpty())
{ {
mUI.mActionCloseProjectFile->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();
@ -708,12 +710,20 @@ void MainWindow::NewProjectFile()
if (!filepath.isEmpty()) if (!filepath.isEmpty())
{ {
mUI.mActionCloseProjectFile->setEnabled(true);
Project prj(filepath, this); Project prj(filepath, this);
prj.Create(); prj.Create();
prj.Edit(); prj.Edit();
} }
} }
void MainWindow::CloseProjectFile()
{
delete mProject;
mProject = NULL;
mUI.mActionCloseProjectFile->setEnabled(false);
}
void MainWindow::ShowLogView() void MainWindow::ShowLogView()
{ {
if (mLogView == NULL) if (mLogView == NULL)

View File

@ -146,6 +146,12 @@ public slots:
*/ */
void OpenProjectFile(); void OpenProjectFile();
/**
* @brief Slot to close open project file.
*
*/
void CloseProjectFile();
/** /**
* @brief Slot for showing the log view. * @brief Slot for showing the log view.
* *