Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename Welcome Page action to Close Project
  • Loading branch information
NathanW2 committed Mar 5, 2018
1 parent 8d2b3be commit 993b9fd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
24 changes: 15 additions & 9 deletions src/app/qgisapp.cpp
Expand Up @@ -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(); } );
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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 )
Expand Down
12 changes: 9 additions & 3 deletions src/app/qgisapp.h
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/app/qgisappinterface.h
Expand Up @@ -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;

Expand Down
11 changes: 7 additions & 4 deletions src/ui/qgisapp.ui
Expand Up @@ -17,7 +17,7 @@
<x>0</x>
<y>0</y>
<width>1030</width>
<height>25</height>
<height>28</height>
</rect>
</property>
<property name="toolTip">
Expand Down Expand Up @@ -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"/>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 993b9fd

Please sign in to comment.