Skip to content
Permalink
Browse files

Remove corner widget for profiles. Make it normal menu

Hopefully for now until I work out better UX
  • Loading branch information
NathanW2 committed Jul 24, 2017
1 parent 601dd41 commit b9e545a465791ea3f9571f265e266ae2c3255078
Showing with 29 additions and 19 deletions.
  1. +29 −18 src/app/qgisapp.cpp
  2. +0 −1 src/app/qgisapp.h
@@ -1283,7 +1283,6 @@ QgisApp::QgisApp()
, mDatabaseMenu( nullptr )
, mWebMenu( nullptr )
, mConfigMenu( nullptr )
, mConfigMenuBar( nullptr )
, mToolPopupOverviews( nullptr )
, mToolPopupDisplay( nullptr )
, mMapCanvas( nullptr )
@@ -2302,40 +2301,52 @@ void QgisApp::refreshProfileMenu()
{
mConfigMenu->clear();
QgsUserProfile *profile = userProfileManager()->userProfile();
mConfigMenu->setTitle( tr( "&User Profile: %1" ).arg( profile->alias() ) );
QString activeName = profile->name();
mConfigMenu->setTitle( tr( "&User Profiles" ) );

mConfigMenu->addSection( tr( "Active Profile" ) );

QAction *profileSection = mConfigMenu->addSection( tr( "Profiles" ) );

QAction *configSection = mConfigMenu->addSection( tr( "Config" ) );

QAction *openProfileFolderAction = mConfigMenu->addAction( tr( "Open current profile folder" ) );
connect( openProfileFolderAction, &QAction::triggered, this, [this]()
{
QDesktopServices::openUrl( QUrl::fromLocalFile( userProfileManager()->userProfile()->folder() ) );
} );

QAction *newProfileAction = mConfigMenu->addAction( tr( "New profile" ) );
connect( newProfileAction, &QAction::triggered, this, &QgisApp::newProfile );

Q_FOREACH ( const QString &name, userProfileManager()->allProfiles() )
{
profile = userProfileManager()->profileForName( name );
QAction *action = mConfigMenu->addAction( profile->icon(), profile->alias() );
QAction *action = new QAction( profile->icon(), profile->alias() );

This comment has been minimized.

Copy link
@3nids

3nids Jul 24, 2017

Member

@NathanW2 this line is failing on Travis https://dash.orfeo-toolbox.org/viewBuildError.php?buildid=283145
no issue locally here....any idea?

also, next line is duplicated.

This comment has been minimized.

Copy link
@NathanW2

NathanW2 via email Jul 24, 2017

Author Member

This comment has been minimized.

Copy link
@3nids

3nids Jul 24, 2017

Member

missing default param in Qt 5.5
fixed in dcec6bb

action->setToolTip( profile->folder() );
action->setToolTip( profile->folder() );
delete profile;

if ( name == activeName )
{
mConfigMenu->insertAction( profileSection, action );
}
else
{
mConfigMenu->insertAction( configSection, action );
}
connect( action, &QAction::triggered, this, [this, name]()
{
userProfileManager()->loadUserProfile( name );
} );
}
mConfigMenu->addSeparator();
QAction *openProfileFolderAction = mConfigMenu->addAction( tr( "Open profile folder" ) );
connect( openProfileFolderAction, &QAction::triggered, this, [this]()
{
QDesktopServices::openUrl( QUrl::fromLocalFile( userProfileManager()->userProfile()->folder() ) );
} );

QAction *newProfileAction = mConfigMenu->addAction( tr( "New profile" ) );
connect( newProfileAction, &QAction::triggered, this, &QgisApp::newProfile );
}

void QgisApp::createProfileMenu()
{
mConfigMenu = new QMenu();
mConfigMenu->addSeparator();
mConfigMenu->addAction( tr( "Manage Configs" ) );

mConfigMenuBar = new QMenuBar( menuBar() );
mConfigMenuBar->addMenu( mConfigMenu );
menuBar()->setCornerWidget( mConfigMenuBar );
mConfigMenuBar->show();
menuBar()->addMenu( mConfigMenu );

refreshProfileMenu();
}
@@ -1891,7 +1891,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QMenu *mWebMenu = nullptr;

QMenu *mConfigMenu = nullptr;
QMenuBar *mConfigMenuBar = nullptr;

//! Popup menu for the map overview tools
QMenu *mToolPopupOverviews = nullptr;

5 comments on commit b9e545a

@Gustry

This comment has been minimized.

Copy link
Contributor

@Gustry Gustry replied Jul 25, 2017

Thanks for the quick fix, it works now!
screen shot 2017-07-25 at 11 55 20

The QGIS toolbar starts hidding my own status toolbar on the right.
I don't think we need a new menu item. Can we move it the QGIS menu on MacOS?

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Jul 25, 2017

Or slot it in the settings menu?

@NathanW2

This comment has been minimized.

Copy link
Member Author

@NathanW2 NathanW2 replied Jul 25, 2017

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn replied Jul 25, 2017

+1 to move it into the settings menu.

@NathanW2

This comment has been minimized.

Copy link
Member Author

@NathanW2 NathanW2 replied Jul 25, 2017

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