mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-23 00:05:43 -04:00
Add first run and settings migration screen (#5838)
This commit is contained in:
parent
a15b54d997
commit
3046979a5f
@ -42,6 +42,7 @@ SET(QGIS_APP_SRCS
|
||||
qgsdiagramproperties.cpp
|
||||
qgsdisplayangle.cpp
|
||||
qgsfieldcalculator.cpp
|
||||
qgsfirstrundialog.cpp
|
||||
qgssourcefieldsproperties.cpp
|
||||
qgsattributesformproperties.cpp
|
||||
qgsidentifyresultsdialog.cpp
|
||||
@ -263,6 +264,7 @@ SET (QGIS_APP_MOC_HDRS
|
||||
qgsdxfexportdialog.h
|
||||
qgsfeatureaction.h
|
||||
qgsfieldcalculator.h
|
||||
qgsfirstrundialog.h
|
||||
qgssourcefieldsproperties.h
|
||||
qgsattributesformproperties.h
|
||||
qgsformannotationdialog.h
|
||||
|
@ -100,6 +100,7 @@ typedef SInt32 SRefCon;
|
||||
#include "qgscrashhandler.h"
|
||||
#include "qgsziputils.h"
|
||||
#include "qgsversionmigration.h"
|
||||
#include "qgsfirstrundialog.h"
|
||||
|
||||
#include "qgsuserprofilemanager.h"
|
||||
#include "qgsuserprofile.h"
|
||||
@ -862,11 +863,29 @@ int main( int argc, char *argv[] )
|
||||
// Settings migration is only supported on the default profile for now.
|
||||
if ( profileName == "default" )
|
||||
{
|
||||
// Note: this flag is ka version number so that we can reset it once we change the version.
|
||||
// Note2: Is this a good idea can we do it better.
|
||||
|
||||
int firstRunVersion = settings.value( QStringLiteral( "migration/firstRunVersionFlag" ), 0 ).toInt();
|
||||
bool showWelcome = ( firstRunVersion == 0 || Qgis::QGIS_VERSION_INT > firstRunVersion );
|
||||
|
||||
std::unique_ptr< QgsVersionMigration > migration( QgsVersionMigration::canMigrate( 20000, Qgis::QGIS_VERSION_INT ) );
|
||||
if ( migration && ( mySettingsMigrationForce || migration->requiresMigration() ) )
|
||||
{
|
||||
QgsDebugMsg( "RUNNING MIGRATION" );
|
||||
migration->runMigration();
|
||||
bool runMigration = true;
|
||||
if ( !mySettingsMigrationForce && showWelcome )
|
||||
{
|
||||
QgsFirstRunDialog dlg;
|
||||
dlg.exec();
|
||||
runMigration = dlg.migrateSettings();
|
||||
settings.setValue( QStringLiteral( "migration/firstRunVersionFlag" ), Qgis::QGIS_VERSION_INT );
|
||||
}
|
||||
|
||||
if ( runMigration )
|
||||
{
|
||||
QgsDebugMsg( "RUNNING MIGRATION" );
|
||||
migration->runMigration();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
33
src/app/qgsfirstrundialog.cpp
Normal file
33
src/app/qgsfirstrundialog.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
/***************************************************************************
|
||||
qgsfirstrundialog.cpp - qgsfirstrundialog
|
||||
|
||||
---------------------
|
||||
begin : 11.12.2017
|
||||
copyright : (C) 2017 by Nathan Woodrow
|
||||
email : woodrow.nathan@gmail.com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgsfirstrundialog.h"
|
||||
#include "qgis.h"
|
||||
|
||||
QgsFirstRunDialog::QgsFirstRunDialog( QWidget *parent ) : QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
mWelcomeDevLabel->hide();
|
||||
mWelcomeLabel->setText( tr( "Welcome to QGIS %1" ).arg( Qgis::QGIS_VERSION ) );
|
||||
if ( Qgis::QGIS_VERSION.endsWith( QLatin1String( "Master" ) ) )
|
||||
{
|
||||
mWelcomeDevLabel->show();
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsFirstRunDialog::migrateSettings()
|
||||
{
|
||||
return ( mImportSettingsYes->isChecked() );
|
||||
}
|
38
src/app/qgsfirstrundialog.h
Normal file
38
src/app/qgsfirstrundialog.h
Normal file
@ -0,0 +1,38 @@
|
||||
/***************************************************************************
|
||||
qgsfirstrundialog.h - qgsfirstrundialog
|
||||
|
||||
---------------------
|
||||
begin : 11.12.2017
|
||||
copyright : (C) 2017 by Nathan Woodrow
|
||||
email : woodrow.nathan@gmail.com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#ifndef QGSFIRSTRUNDIALOG_H
|
||||
#define QGSFIRSTRUNDIALOG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include "qgis_app.h"
|
||||
|
||||
#include "ui_qgsfirstrundialog.h"
|
||||
|
||||
class APP_EXPORT QgsFirstRunDialog : public QDialog, private Ui::QgsFirstRunDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QgsFirstRunDialog( QWidget *parent = 0 );
|
||||
|
||||
bool migrateSettings();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // QGSFIRSTRUNDIALOG_H
|
199
src/ui/qgsfirstrundialog.ui
Normal file
199
src/ui/qgsfirstrundialog.ui
Normal file
@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsFirstRunDialog</class>
|
||||
<widget class="QDialog" name="QgsFirstRunDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>659</width>
|
||||
<height>464</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Let's get started!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="1" rowspan="2">
|
||||
<widget class="QLabel" name="mWelcomeLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>23</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Welcome to QGIS 3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" rowspan="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../images/images.qrc">:/images/icons/qgis-icon-60x60.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="http://changelog.qgis.org/en/qgis/version/3.0.0/"><span style=" text-decoration: underline; color:#2a76c6;">Check out </span></a>the change log for all the new stuff.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="mWelcomeDevLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-style:italic;">You are running a dev version. We would love your feedback and testing.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../images/images.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QgsFirstRunDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>350</x>
|
||||
<y>424</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>188</x>
|
||||
<y>453</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user