Skip to content

Commit

Permalink
Wlcome page: hide migration from QGIS2 option if settings do not exist
Browse files Browse the repository at this point in the history
Fixes #30082
  • Loading branch information
elpaso authored and nyalldawson committed Jun 5, 2019
1 parent 393983f commit 51045a3
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 60 deletions.
4 changes: 4 additions & 0 deletions src/app/main.cpp
Expand Up @@ -997,6 +997,10 @@ int main( int argc, char *argv[] )
if ( !settingsMigrationForce && showWelcome )
{
QgsFirstRunDialog dlg;
if ( ! QFile::exists( QSettings( "QGIS", "QGIS2" ).fileName() ) )
{
dlg.hideMigration();
}
dlg.exec();
runMigration = dlg.migrateSettings();
migSettings.setValue( QStringLiteral( "migration/firstRunVersionFlag" ), Qgis::QGIS_VERSION_INT );
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsfirstrundialog.cpp
Expand Up @@ -31,3 +31,8 @@ bool QgsFirstRunDialog::migrateSettings()
{
return ( mImportSettingsYes->isChecked() );
}

void QgsFirstRunDialog::hideMigration()
{
mMigrationWidget->hide();
}
6 changes: 6 additions & 0 deletions src/app/qgsfirstrundialog.h
Expand Up @@ -30,6 +30,12 @@ class APP_EXPORT QgsFirstRunDialog : public QDialog, private Ui::QgsFirstRunDial

bool migrateSettings();

/**
* Hides the migration checkboxes
*/
void hideMigration();


signals:

public slots:
Expand Down
126 changes: 66 additions & 60 deletions src/ui/qgsfirstrundialog.ui
Expand Up @@ -109,66 +109,72 @@
<item row="1" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Ready to go?</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mImportSettingsYes">
<property name="text">
<string>Import settings from QGIS 2.</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mImportSettingsNo">
<property name="text">
<string>I want a clean start. Don't import my QGIS 2 settings.</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Settings will be imported into the default profile and you will only see this screen once.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<widget class="QWidget" name="mMigrationWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>45</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Ready to go?</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mImportSettingsYes">
<property name="text">
<string>Import settings from QGIS 2.</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mImportSettingsNo">
<property name="text">
<string>I want a clean start. Don't import my QGIS 2 settings.</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Settings will be imported into the default profile and you will only see this screen once.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 51045a3

Please sign in to comment.