forked from qt-creator/qt-creator
StudioWelcome: Enable integrating download progress
Change-Id: Iad18c1a0bc49f87a98dcdff46542cf4c373de875 Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -45,7 +45,7 @@ using namespace Utils;
|
||||
|
||||
ExampleCheckout::ExampleCheckout(QObject *) {}
|
||||
|
||||
void ExampleCheckout::checkoutExample(const QUrl &url)
|
||||
void ExampleCheckout::registerTypes()
|
||||
{
|
||||
FileDownloader::registerQmlType();
|
||||
static bool once = []() {
|
||||
@@ -55,6 +55,11 @@ void ExampleCheckout::checkoutExample(const QUrl &url)
|
||||
}();
|
||||
|
||||
QTC_ASSERT(once, ;);
|
||||
}
|
||||
|
||||
void ExampleCheckout::checkoutExample(const QUrl &url, const QString &tempFile, const QString &completeBaseFileName)
|
||||
{
|
||||
registerTypes();
|
||||
|
||||
m_dialog.reset(new QDialog(Core::ICore::dialogParent()));
|
||||
m_dialog->setModal(true);
|
||||
@@ -80,6 +85,8 @@ void ExampleCheckout::checkoutExample(const QUrl &url)
|
||||
QTC_ASSERT(rootObject, qWarning() << "QML error"; return );
|
||||
|
||||
rootObject->setProperty("url", url);
|
||||
rootObject->setProperty("tempFile", tempFile);
|
||||
rootObject->setProperty("completeBaseName", completeBaseFileName);
|
||||
|
||||
m_dialog->show();
|
||||
|
||||
@@ -260,6 +267,7 @@ void FileExtractor::setSourceFile(QString &sourceFilePath)
|
||||
void FileExtractor::setArchiveName(QString &filePath)
|
||||
{
|
||||
m_archiveName = filePath;
|
||||
emit targetFolderExistsChanged();
|
||||
}
|
||||
|
||||
const QString FileExtractor::detailedText()
|
||||
|
@@ -43,18 +43,21 @@ class ExampleCheckout : public QObject
|
||||
public:
|
||||
explicit ExampleCheckout(QObject *parent = nullptr);
|
||||
|
||||
Q_INVOKABLE void checkoutExample(const QUrl &url);
|
||||
Q_INVOKABLE void checkoutExample(const QUrl &url, const QString &tempFile, const QString &completeBaseFileName);
|
||||
|
||||
QString extractionFolder() const;
|
||||
|
||||
~ExampleCheckout();
|
||||
|
||||
static void registerTypes();
|
||||
|
||||
public slots:
|
||||
void handleCancel();
|
||||
void handleAccepted();
|
||||
|
||||
signals:
|
||||
void finishedSucessfully();
|
||||
void progressChanged(int);
|
||||
|
||||
private:
|
||||
std::unique_ptr<QDialog> m_dialog;
|
||||
|
@@ -45,15 +45,18 @@ Rectangle {
|
||||
signal canceled
|
||||
signal accepted
|
||||
|
||||
property string tempFile
|
||||
property string completeBaseName
|
||||
|
||||
StackLayout {
|
||||
id: stackLayout
|
||||
anchors.fill: parent
|
||||
currentIndex: 0
|
||||
currentIndex: root.tempFile.length === 0 ? 0 : 1
|
||||
|
||||
FileExtractor {
|
||||
id: fileExtractor
|
||||
sourceFile: downloader.tempFile
|
||||
archiveName: downloader.completeBaseName
|
||||
archiveName: root.completeBaseName.length === 0 ? downloader.completeBaseName : root.completeBaseName
|
||||
sourceFile: root.tempFile.length === 0 ? downloader.tempFile : root.tempFile
|
||||
}
|
||||
|
||||
FileDownloader {
|
||||
|
@@ -231,11 +231,13 @@ public:
|
||||
Q_INVOKABLE void openExample(const QString &example,
|
||||
const QString &formFile,
|
||||
const QString &url,
|
||||
const QString &explicitQmlproject)
|
||||
const QString &explicitQmlproject,
|
||||
const QString &tempFile,
|
||||
const QString &completeBaseName)
|
||||
{
|
||||
if (!url.isEmpty()) {
|
||||
ExampleCheckout *checkout = new ExampleCheckout;
|
||||
checkout->checkoutExample(QUrl::fromUserInput(url));
|
||||
checkout->checkoutExample(QUrl::fromUserInput(url), tempFile, completeBaseName);
|
||||
connect(checkout,
|
||||
&ExampleCheckout::finishedSucessfully,
|
||||
this,
|
||||
@@ -631,6 +633,7 @@ WelcomeMode::WelcomeMode()
|
||||
setContext(Core::Context(Core::Constants::C_WELCOME_MODE));
|
||||
|
||||
QFontDatabase::addApplicationFont(":/studiofonts/TitilliumWeb-Regular.ttf");
|
||||
ExampleCheckout::registerTypes();
|
||||
|
||||
m_modeWidget = new QQuickWidget;
|
||||
m_modeWidget->setMinimumSize(1024, 768);
|
||||
|
Reference in New Issue
Block a user