Skip to content
Permalink
Browse files

Rename Welcome Page action to Close Project

  • Loading branch information
NathanW2 committed Mar 5, 2018
1 parent 8d2b3be commit 993b9fd4abcd759bedb28e97009414e2761c3c28
Showing with 32 additions and 16 deletions.
  1. +15 −9 src/app/qgisapp.cpp
  2. +9 −3 src/app/qgisapp.h
  3. +1 −0 src/app/qgisappinterface.h
  4. +7 −4 src/ui/qgisapp.ui
@@ -1863,7 +1863,7 @@ void QgisApp::createActions()
connect( mActionNewBlankProject, &QAction::triggered, this, &QgisApp::fileNewBlank );
connect( mActionOpenProject, &QAction::triggered, this, &QgisApp::fileOpen );
connect( mActionSaveProject, &QAction::triggered, this, &QgisApp::fileSave );
connect( mActionWelcomePage, &QAction::triggered, this, [ = ] { mCentralContainer->setCurrentIndex( 1 ); } );
connect( mActionCloseProject, &QAction::triggered, this, &QgisApp::fileClose );
connect( mActionSaveProjectAs, &QAction::triggered, this, &QgisApp::fileSaveAs );
connect( mActionSaveMapAsImage, &QAction::triggered, this, [ = ] { saveMapAsImage(); } );
connect( mActionSaveMapAsPdf, &QAction::triggered, this, [ = ] { saveMapAsPdf(); } );
@@ -5015,29 +5015,35 @@ void QgisApp::fileExit()
}


void QgisApp::fileNew()
bool QgisApp::fileNew()
{
fileNew( true ); // prompts whether to save project
return fileNew( true ); // prompts whether to save project
} // fileNew()


void QgisApp::fileNewBlank()
bool QgisApp::fileNewBlank()
{
fileNew( true, true );
return fileNew( true, true );
}

void QgisApp::fileClose()
{
if ( fileNewBlank() )
mCentralContainer->setCurrentIndex( 1 );
}


//as file new but accepts flags to indicate whether we should prompt to save
void QgisApp::fileNew( bool promptToSaveFlag, bool forceBlank )
bool QgisApp::fileNew( bool promptToSaveFlag, bool forceBlank )
{
if ( checkTasksDependOnProject() )
return;
return false;

if ( promptToSaveFlag )
{
if ( !saveDirty() )
{
return; //cancel pressed
return false; //cancel pressed
}
}

@@ -5119,7 +5125,7 @@ void QgisApp::fileNew( bool promptToSaveFlag, bool forceBlank )
// set the initial map tool
mMapCanvas->setMapTool( mMapTools.mPan );
mNonEditMapTool = mMapTools.mPan; // signals are not yet setup to catch this

return true;
}

bool QgisApp::fileNewFromTemplate( const QString &fileName )
@@ -1228,11 +1228,17 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! Open a project
void fileOpen();
//! Create a new project
void fileNew();
bool fileNew();
//! Create a new blank project (no template)
void fileNewBlank();
bool fileNewBlank();

/**
* Close the current open project and show the welcome screen again.
*/
void fileClose();

//! As above but allows forcing without prompt and forcing blank project
void fileNew( bool promptToSaveFlag, bool forceBlank = false );
bool fileNew( bool promptToSaveFlag, bool forceBlank = false );
//! What type of project to open after launch
void fileOpenAfterLaunch();
//! After project read, set any auto-opened project as successful
@@ -78,6 +78,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface

//! Add a project
bool addProject( const QString &projectName ) override;

//! Start a new blank project
void newProject( bool promptToSaveFlag = false ) override;

@@ -17,7 +17,7 @@
<x>0</x>
<y>0</y>
<width>1030</width>
<height>25</height>
<height>28</height>
</rect>
</property>
<property name="toolTip">
@@ -46,7 +46,7 @@
<addaction name="mActionOpenProject"/>
<addaction name="mProjectFromTemplateMenu"/>
<addaction name="mRecentProjectsMenu"/>
<addaction name="mActionWelcomePage"/>
<addaction name="mActionCloseProject"/>
<addaction name="separator"/>
<addaction name="mActionSaveProject"/>
<addaction name="mActionSaveProjectAs"/>
@@ -2960,9 +2960,12 @@ Acts on currently active editable layer</string>
<string>New Report</string>
</property>
</action>
<action name="mActionWelcomePage">
<action name="mActionCloseProject">
<property name="text">
<string>Welcome Page</string>
<string>Close Project</string>
</property>
<property name="toolTip">
<string>Close Project</string>
</property>
</action>
</widget>

0 comments on commit 993b9fd

Please sign in to comment.
You can’t perform that action at this time.