forked from qt-creator/qt-creator
StudioWelcome: Remove unused code
Change-Id: I380a35cb735669feeeac5d0293ed43c4d2ef7059 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -47,11 +47,8 @@
|
|||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
ExampleCheckout::ExampleCheckout(QObject *) {}
|
|
||||||
|
|
||||||
void ExampleCheckout::registerTypes()
|
void ExampleCheckout::registerTypes()
|
||||||
{
|
{
|
||||||
FileDownloader::registerQmlType();
|
|
||||||
static bool once = []() {
|
static bool once = []() {
|
||||||
FileDownloader::registerQmlType();
|
FileDownloader::registerQmlType();
|
||||||
FileExtractor::registerQmlType();
|
FileExtractor::registerQmlType();
|
||||||
@@ -61,69 +58,6 @@ void ExampleCheckout::registerTypes()
|
|||||||
QTC_ASSERT(once, ;);
|
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);
|
|
||||||
m_dialog->setFixedSize(620, 300);
|
|
||||||
QHBoxLayout *layout = new QHBoxLayout(m_dialog.get());
|
|
||||||
layout->setContentsMargins(2, 2, 2, 2);
|
|
||||||
|
|
||||||
auto widget = new QQuickWidget(m_dialog.get());
|
|
||||||
|
|
||||||
layout->addWidget(widget);
|
|
||||||
widget->engine()->addImportPath("qrc:/studiofonts");
|
|
||||||
|
|
||||||
widget->engine()->addImportPath(
|
|
||||||
Core::ICore::resourcePath("/qmldesigner/propertyEditorQmlSources/imports").toString());
|
|
||||||
|
|
||||||
widget->setSource(QUrl("qrc:/qml/downloaddialog/main.qml"));
|
|
||||||
|
|
||||||
m_dialog->setWindowFlag(Qt::Tool, true);
|
|
||||||
widget->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
|
||||||
|
|
||||||
rootObject = widget->rootObject();
|
|
||||||
|
|
||||||
QTC_ASSERT(rootObject, qWarning() << "QML error"; return );
|
|
||||||
|
|
||||||
rootObject->setProperty("url", url);
|
|
||||||
rootObject->setProperty("tempFile", tempFile);
|
|
||||||
rootObject->setProperty("completeBaseName", completeBaseFileName);
|
|
||||||
|
|
||||||
m_dialog->show();
|
|
||||||
|
|
||||||
rootObject = widget->rootObject();
|
|
||||||
|
|
||||||
connect(rootObject, SIGNAL(canceled()), this, SLOT(handleCancel()));
|
|
||||||
connect(rootObject, SIGNAL(accepted()), this, SLOT(handleAccepted()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ExampleCheckout::extractionFolder() const
|
|
||||||
{
|
|
||||||
return m_extrationFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExampleCheckout::~ExampleCheckout() {}
|
|
||||||
|
|
||||||
void ExampleCheckout::handleCancel()
|
|
||||||
{
|
|
||||||
m_dialog->close();
|
|
||||||
m_dialog.release()->deleteLater();
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExampleCheckout::handleAccepted()
|
|
||||||
{
|
|
||||||
QQmlProperty property(rootObject, "path");
|
|
||||||
m_extrationFolder = property.read().toString();
|
|
||||||
m_dialog->close();
|
|
||||||
emit finishedSucessfully();
|
|
||||||
m_dialog.release()->deleteLater();
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileDownloader::registerQmlType()
|
void FileDownloader::registerQmlType()
|
||||||
{
|
{
|
||||||
qmlRegisterType<FileDownloader>("ExampleCheckout", 1, 0, "FileDownloader");
|
qmlRegisterType<FileDownloader>("ExampleCheckout", 1, 0, "FileDownloader");
|
||||||
|
@@ -33,36 +33,9 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
struct ExampleCheckout
|
||||||
class QDialog;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
class ExampleCheckout : public QObject
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ExampleCheckout(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
Q_INVOKABLE void checkoutExample(const QUrl &url, const QString &tempFile, const QString &completeBaseFileName);
|
|
||||||
|
|
||||||
QString extractionFolder() const;
|
|
||||||
|
|
||||||
~ExampleCheckout();
|
|
||||||
|
|
||||||
static void registerTypes();
|
static void registerTypes();
|
||||||
|
|
||||||
public slots:
|
|
||||||
void handleCancel();
|
|
||||||
void handleAccepted();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void finishedSucessfully();
|
|
||||||
void progressChanged(int);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<QDialog> m_dialog;
|
|
||||||
QObject *rootObject = nullptr;
|
|
||||||
QString m_extrationFolder;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileExtractor : public QObject
|
class FileExtractor : public QObject
|
||||||
|
@@ -271,31 +271,6 @@ public:
|
|||||||
const QString &tempFile,
|
const QString &tempFile,
|
||||||
const QString &completeBaseName)
|
const QString &completeBaseName)
|
||||||
{
|
{
|
||||||
if (!url.isEmpty()) {
|
|
||||||
ExampleCheckout *checkout = new ExampleCheckout;
|
|
||||||
checkout->checkoutExample(QUrl::fromUserInput(url), tempFile, completeBaseName);
|
|
||||||
connect(checkout,
|
|
||||||
&ExampleCheckout::finishedSucessfully,
|
|
||||||
this,
|
|
||||||
[checkout, formFile, example, explicitQmlproject]() {
|
|
||||||
const QString exampleFolder = checkout->extractionFolder() + "/" + example
|
|
||||||
+ "/";
|
|
||||||
|
|
||||||
QString projectFile = exampleFolder + example + ".qmlproject";
|
|
||||||
|
|
||||||
if (!explicitQmlproject.isEmpty())
|
|
||||||
projectFile = exampleFolder + explicitQmlproject;
|
|
||||||
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile);
|
|
||||||
|
|
||||||
const QString qmlFile = QFileInfo(projectFile).dir().absolutePath() + "/"
|
|
||||||
+ formFile;
|
|
||||||
|
|
||||||
Core::EditorManager::openEditor(Utils::FilePath::fromString(qmlFile));
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Utils::FilePath projectFile = Core::ICore::resourcePath("examples")
|
const Utils::FilePath projectFile = Core::ICore::resourcePath("examples")
|
||||||
/ example / example + ".qmlproject";
|
/ example / example + ".qmlproject";
|
||||||
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile.toString());
|
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile.toString());
|
||||||
|
Reference in New Issue
Block a user