Skip to content

Commit

Permalink
Remove corner widget for profiles. Make it normal menu
Browse files Browse the repository at this point in the history
Hopefully for now until I work out better UX
  • Loading branch information
NathanW2 committed Jul 24, 2017
1 parent 601dd41 commit b9e545a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
47 changes: 29 additions & 18 deletions src/app/qgisapp.cpp
Expand Up @@ -1283,7 +1283,6 @@ QgisApp::QgisApp()
, mDatabaseMenu( nullptr )
, mWebMenu( nullptr )
, mConfigMenu( nullptr )
, mConfigMenuBar( nullptr )
, mToolPopupOverviews( nullptr )
, mToolPopupDisplay( nullptr )
, mMapCanvas( nullptr )
Expand Down Expand Up @@ -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();
}
Expand Down
1 change: 0 additions & 1 deletion src/app/qgisapp.h
Expand Up @@ -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;
Expand Down

5 comments on commit b9e545a

@Gustry
Copy link
Contributor

@Gustry Gustry commented on b9e545a Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or slot it in the settings menu?

@NathanW2
Copy link
Member Author

@NathanW2 NathanW2 commented on b9e545a Jul 25, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirvn
Copy link
Contributor

@nirvn nirvn commented on b9e545a Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to move it into the settings menu.

@NathanW2
Copy link
Member Author

@NathanW2 NathanW2 commented on b9e545a Jul 25, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.