forked from qt-creator/qt-creator
QmlDesigner: Fix example download missing setting
When starting with a clean config the location for download/extraction of an example is empty. The first call to the settings needed a default location. Change-Id: I2d63f805dc46c564f13346648f3e3bf29a0970d8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
8538f919ca
commit
61d5bbbdad
@@ -239,9 +239,7 @@ FileExtractor::FileExtractor(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
m_targetPath = Utils::FilePath::fromString(
|
m_targetPath = Utils::FilePath::fromString(
|
||||||
Core::ICore::settings()
|
StudioWelcome::Internal::StudioWelcomePlugin::examplesPathSetting());
|
||||||
->value(StudioWelcome::Internal::EXAMPLES_DOWNLOAD_PATH)
|
|
||||||
.toString());
|
|
||||||
|
|
||||||
m_timer.setInterval(100);
|
m_timer.setInterval(100);
|
||||||
m_timer.setSingleShot(false);
|
m_timer.setSingleShot(false);
|
||||||
|
@@ -98,6 +98,8 @@ const char STATISTICS_COLLECTION_MODE[] = "StatisticsCollectionMode";
|
|||||||
const char NO_TELEMETRY[] = "NoTelemetry";
|
const char NO_TELEMETRY[] = "NoTelemetry";
|
||||||
const char CRASH_REPORTER_SETTING[] = "CrashReportingEnabled";
|
const char CRASH_REPORTER_SETTING[] = "CrashReportingEnabled";
|
||||||
|
|
||||||
|
const char EXAMPLES_DOWNLOAD_PATH[] = "StudioWelcome/ExamplesDownloadPath";
|
||||||
|
|
||||||
QPointer<QQuickWidget> s_view = nullptr;
|
QPointer<QQuickWidget> s_view = nullptr;
|
||||||
static StudioWelcomePlugin *s_pluginInstance = nullptr;
|
static StudioWelcomePlugin *s_pluginInstance = nullptr;
|
||||||
|
|
||||||
@@ -676,6 +678,20 @@ void StudioWelcomePlugin::resumeRemoveSplashTimer()
|
|||||||
m_removeSplashTimer.start(m_removeSplashRemainingTime);
|
m_removeSplashTimer.start(m_removeSplashRemainingTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils::FilePath StudioWelcomePlugin::defaultExamplesPath()
|
||||||
|
{
|
||||||
|
return Utils::FilePath::fromString(
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))
|
||||||
|
.pathAppended("QtDesignStudio");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StudioWelcomePlugin::examplesPathSetting()
|
||||||
|
{
|
||||||
|
return Core::ICore::settings()
|
||||||
|
->value(EXAMPLES_DOWNLOAD_PATH, defaultExamplesPath().toString())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
WelcomeMode::WelcomeMode()
|
WelcomeMode::WelcomeMode()
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Studio"));
|
setDisplayName(tr("Studio"));
|
||||||
@@ -778,18 +794,6 @@ void setSettingIfDifferent(const QString &key, bool value, bool &dirty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Utils::FilePath defaultExamplesPath = Utils::FilePath::fromString(
|
|
||||||
QStandardPaths::writableLocation(
|
|
||||||
QStandardPaths::DocumentsLocation))
|
|
||||||
.pathAppended("QtDesignStudio");
|
|
||||||
|
|
||||||
static QString examplesPathSetting()
|
|
||||||
{
|
|
||||||
return Core::ICore::settings()
|
|
||||||
->value(EXAMPLES_DOWNLOAD_PATH, defaultExamplesPath.toString())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
WelcomeMode::~WelcomeMode()
|
WelcomeMode::~WelcomeMode()
|
||||||
{
|
{
|
||||||
delete m_modeWidget;
|
delete m_modeWidget;
|
||||||
@@ -836,11 +840,12 @@ StudioSettingsPage::StudioSettingsPage()
|
|||||||
examplesGroupBox->setLayout(horizontalLayout);
|
examplesGroupBox->setLayout(horizontalLayout);
|
||||||
|
|
||||||
auto label = new QLabel(tr("Examples path:"));
|
auto label = new QLabel(tr("Examples path:"));
|
||||||
m_pathChooser->setFilePath(Utils::FilePath::fromString(examplesPathSetting()));
|
m_pathChooser->setFilePath(
|
||||||
|
Utils::FilePath::fromString(StudioWelcomePlugin::examplesPathSetting()));
|
||||||
auto resetButton = new QPushButton(tr("Reset Path"));
|
auto resetButton = new QPushButton(tr("Reset Path"));
|
||||||
|
|
||||||
connect(resetButton, &QPushButton::clicked, this, [this]() {
|
connect(resetButton, &QPushButton::clicked, this, [this]() {
|
||||||
m_pathChooser->setFilePath(defaultExamplesPath);
|
m_pathChooser->setFilePath(StudioWelcomePlugin::defaultExamplesPath());
|
||||||
});
|
});
|
||||||
|
|
||||||
horizontalLayout->addWidget(label);
|
horizontalLayout->addWidget(label);
|
||||||
|
@@ -36,8 +36,6 @@ QT_FORWARD_DECLARE_CLASS(QCheckBox)
|
|||||||
namespace StudioWelcome {
|
namespace StudioWelcome {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char EXAMPLES_DOWNLOAD_PATH[] = "StudioWelcome/ExamplesDownloadPath";
|
|
||||||
|
|
||||||
class StudioSettingsPage : public Core::IOptionsPageWidget
|
class StudioSettingsPage : public Core::IOptionsPageWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -80,6 +78,9 @@ public:
|
|||||||
void pauseRemoveSplashTimer();
|
void pauseRemoveSplashTimer();
|
||||||
void resumeRemoveSplashTimer();
|
void resumeRemoveSplashTimer();
|
||||||
|
|
||||||
|
static Utils::FilePath defaultExamplesPath();
|
||||||
|
static QString examplesPathSetting();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void examplesDownloadPathChanged(const QString &path);
|
void examplesDownloadPathChanged(const QString &path);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user