@@ -29,7 +29,7 @@ QgsUserProfileOptionsWidget::QgsUserProfileOptionsWidget( QWidget *parent )
29
29
{
30
30
setupUi ( this );
31
31
32
- auto manager = QgisApp::instance ()->userProfileManager ();
32
+ QgsUserProfileManager * manager = QgisApp::instance ()->userProfileManager ();
33
33
34
34
// Disable combobox if default profile is not selected
35
35
mDefaultProfileComboBox ->setEnabled ( false );
@@ -40,40 +40,35 @@ QgsUserProfileOptionsWidget::QgsUserProfileOptionsWidget( QWidget *parent )
40
40
connect ( mAskUser , &QRadioButton::toggled, mProfileSelectorGroupBox , &QGroupBox::setEnabled );
41
41
42
42
// Connect icon size and allow profile creation
43
- mIconSize ->setCurrentText ( QString::number ( manager->profileSelectorIconSize () ) );
44
- mAllowProfileCreation ->setChecked ( manager->profileSelectorProfileCreationAllowed () );
43
+ mIconSize ->setCurrentText ( QString::number ( QSettings ().value ( QStringLiteral ( " /selector/iconSize" ), 24 ).toInt () ) );
45
44
connect ( mIconSize , &QComboBox::currentTextChanged, this , []( const QString & text )
46
45
{
47
- auto manager = QgisApp::instance ()->userProfileManager ();
48
- manager->setProfileSelectorIconSize ( text.toInt () );
49
- } );
50
- connect ( mAllowProfileCreation , &QCheckBox::toggled, this , []( bool checked )
51
- {
52
- auto manager = QgisApp::instance ()->userProfileManager ();
53
- manager->setProfileSelectorProfileCreationAllowed ( checked );
46
+ QSettings settings;
47
+ settings.setValue ( QStringLiteral ( " /selector/iconSize" ), text.toInt () );
48
+ settings.sync ();
54
49
} );
55
50
56
51
// Connect change icon button
57
52
connect ( mChangeIconButton , &QToolButton::clicked, this , &QgsUserProfileOptionsWidget::onChangeIconClicked );
58
53
connect ( mResetIconButton , &QToolButton::clicked, this , &QgsUserProfileOptionsWidget::onResetIconClicked );
59
54
60
55
// Init radio buttons
61
- if ( manager->userProfileSelectionPolicy () == QgsUserProfileManager ::UserProfileSelectionPolicy::LastProfile )
56
+ if ( manager->userProfileSelectionPolicy () == Qgis ::UserProfileSelectionPolicy::LastProfile )
62
57
{
63
58
mLastProfile ->setChecked ( true );
64
59
}
65
- else if ( manager->userProfileSelectionPolicy () == QgsUserProfileManager ::UserProfileSelectionPolicy::AskUser )
60
+ else if ( manager->userProfileSelectionPolicy () == Qgis ::UserProfileSelectionPolicy::AskUser )
66
61
{
67
62
mAskUser ->setChecked ( true );
68
63
}
69
- else if ( manager->userProfileSelectionPolicy () == QgsUserProfileManager ::UserProfileSelectionPolicy::DefaultProfile )
64
+ else if ( manager->userProfileSelectionPolicy () == Qgis ::UserProfileSelectionPolicy::DefaultProfile )
70
65
{
71
66
mDefaultProfile ->setChecked ( true );
72
67
}
73
68
74
69
// Fill combobox with profiles
75
70
mDefaultProfileComboBox ->clear ();
76
- for ( auto profile : manager->allProfiles () )
71
+ for ( const QString & profile : manager->allProfiles () )
77
72
{
78
73
QIcon icon = manager->profileForName ( profile )->icon ();
79
74
mDefaultProfileComboBox ->addItem ( icon, profile );
@@ -87,26 +82,26 @@ QgsUserProfileOptionsWidget::QgsUserProfileOptionsWidget( QWidget *parent )
87
82
88
83
void QgsUserProfileOptionsWidget::apply ()
89
84
{
90
- auto manager = QgisApp::instance ()->userProfileManager ();
85
+ QgsUserProfileManager * manager = QgisApp::instance ()->userProfileManager ();
91
86
if ( mLastProfile ->isChecked () )
92
87
{
93
- manager->setUserProfileSelectionPolicy ( QgsUserProfileManager ::UserProfileSelectionPolicy::LastProfile );
88
+ manager->setUserProfileSelectionPolicy ( Qgis ::UserProfileSelectionPolicy::LastProfile );
94
89
}
95
90
else if ( mAskUser ->isChecked () )
96
91
{
97
- manager->setUserProfileSelectionPolicy ( QgsUserProfileManager ::UserProfileSelectionPolicy::AskUser );
92
+ manager->setUserProfileSelectionPolicy ( Qgis ::UserProfileSelectionPolicy::AskUser );
98
93
}
99
94
else if ( mDefaultProfile ->isChecked () )
100
95
{
101
- manager->setUserProfileSelectionPolicy ( QgsUserProfileManager ::UserProfileSelectionPolicy::DefaultProfile );
96
+ manager->setUserProfileSelectionPolicy ( Qgis ::UserProfileSelectionPolicy::DefaultProfile );
102
97
manager->setDefaultProfileName ( mDefaultProfileComboBox ->currentText () );
103
98
}
104
99
}
105
100
106
101
void QgsUserProfileOptionsWidget::onChangeIconClicked ()
107
102
{
108
- auto activeProfile = QgisApp::instance ()->userProfileManager ()->userProfile ();
109
- const QString iconPath = QFileDialog::getOpenFileName ( this , tr ( " Select icon " ), " " , tr ( " Images (*.png *.jpg *.jpeg *.gif *.bmp *.svg)" ) );
103
+ const QgsUserProfile * activeProfile = QgisApp::instance ()->userProfileManager ()->userProfile ();
104
+ const QString iconPath = QFileDialog::getOpenFileName ( this , tr ( " Select Icon " ), " " , tr ( " Images (*.png *.jpg *.jpeg *.gif *.bmp *.svg)" ) );
110
105
if ( !iconPath.isEmpty () )
111
106
{
112
107
// Remove existing icon files
@@ -129,7 +124,7 @@ void QgsUserProfileOptionsWidget::onChangeIconClicked()
129
124
130
125
void QgsUserProfileOptionsWidget::onResetIconClicked ()
131
126
{
132
- auto activeProfile = QgisApp::instance ()->userProfileManager ()->userProfile ();
127
+ const QgsUserProfile * activeProfile = QgisApp::instance ()->userProfileManager ()->userProfile ();
133
128
// Remove existing icon files
134
129
QDir dir ( activeProfile->folder (), " icon.*" , QDir::Name, QDir::Files );
135
130
for ( const QString &file : dir.entryList () )
0 commit comments