forked from qt-creator/qt-creator
AssetExport: UI improvements
Add checkbox to export assets and fix progress bar Task-number: QDS-1560 Change-Id: I8a23f4bc4a2f7ba99fcc4cf235ce94fa69ac151a Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "utils/fileutils.h"
|
||||
#include "utils/outputformatter.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QListView>
|
||||
#include <QPlainTextEdit>
|
||||
@@ -86,6 +87,15 @@ AssetExportDialog::AssetExportDialog(const Utils::FilePath &exportPath,
|
||||
Core::FileUtils::showInGraphicalShell(Core::ICore::mainWindow(), m_ui->exportPath->path());
|
||||
});
|
||||
|
||||
auto optionsWidget = new QWidget;
|
||||
m_ui->advancedOptions->setSummaryText(tr("Advanced Options"));
|
||||
m_ui->advancedOptions->setWidget(optionsWidget);
|
||||
auto optionsLayout = new QHBoxLayout(optionsWidget);
|
||||
optionsLayout->setMargin(8);
|
||||
m_exportAssetsCheck = new QCheckBox(tr("Export assets"), this);
|
||||
m_exportAssetsCheck->setChecked(true);
|
||||
optionsLayout->addWidget(m_exportAssetsCheck);
|
||||
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false);
|
||||
|
||||
m_ui->stackedWidget->addWidget(m_filesView);
|
||||
@@ -138,7 +148,8 @@ void AssetExportDialog::onExport()
|
||||
TaskHub::clearTasks(Constants::TASK_CATEGORY_ASSET_EXPORT);
|
||||
m_exportLogs->clear();
|
||||
|
||||
m_assetExporter.exportQml(m_filePathModel.files(), m_ui->exportPath->fileName());
|
||||
m_assetExporter.exportQml(m_filePathModel.files(), m_ui->exportPath->fileName(),
|
||||
m_exportAssetsCheck->isChecked());
|
||||
}
|
||||
|
||||
void AssetExportDialog::onExportStateChanged(AssetExporter::ParsingState newState)
|
||||
|
@@ -34,6 +34,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPushButton;
|
||||
class QCheckBox;
|
||||
class QListView;
|
||||
class QPlainTextEdit;
|
||||
QT_END_NAMESPACE
|
||||
@@ -74,6 +75,7 @@ private:
|
||||
FilePathModel &m_filePathModel;
|
||||
std::unique_ptr<Ui::AssetExportDialog> m_ui;
|
||||
QPushButton *m_exportBtn = nullptr;
|
||||
QCheckBox *m_exportAssetsCheck = nullptr;
|
||||
QListView *m_filesView = nullptr;
|
||||
QPlainTextEdit *m_exportLogs = nullptr;
|
||||
Utils::OutputFormatter *m_outputFormatter = nullptr;
|
||||
|
@@ -14,9 +14,6 @@
|
||||
<string>Export QML</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="Utils::PathChooser" name="exportPath" native="true"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
@@ -30,10 +27,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QStackedWidget" name="stackedWidget"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QProgressBar" name="exportProgress">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
@@ -43,13 +40,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="Utils::DetailsWidget" name="advancedOptions" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>8</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Utils::PathChooser" name="exportPath" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -59,6 +69,12 @@
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Utils::DetailsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/detailswidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@@ -116,15 +116,17 @@ void AssetExporter::exportQml(const Utils::FilePaths &qmlFiles, const Utils::Fil
|
||||
ExportNotification::addInfo(tr("Exporting metadata at %1. Export assets: ")
|
||||
.arg(exportPath.toUserOutput())
|
||||
.arg(exportAssets? tr("Yes") : tr("No")));
|
||||
// TODO Asset export
|
||||
notifyProgress(0.0);
|
||||
Q_UNUSED(exportAssets);
|
||||
m_exportFiles = qmlFiles;
|
||||
m_totalFileCount = m_exportFiles.count();
|
||||
m_components = QJsonArray();
|
||||
m_exportPath = exportPath;
|
||||
m_currentState.change(ParsingState::Parsing);
|
||||
triggerLoadNextFile();
|
||||
m_assetDumper = make_unique<AssetDumper>();
|
||||
if (exportAssets)
|
||||
m_assetDumper = make_unique<AssetDumper>();
|
||||
else
|
||||
m_assetDumper.reset();
|
||||
}
|
||||
|
||||
void AssetExporter::cancel()
|
||||
@@ -159,6 +161,7 @@ void AssetExporter::exportComponent(const ModelNode &rootNode)
|
||||
Component exporter(*this, rootNode);
|
||||
exporter.exportComponent();
|
||||
m_components.append(exporter.json());
|
||||
notifyProgress((m_totalFileCount - m_exportFiles.count()) * 0.8 / m_totalFileCount);
|
||||
}
|
||||
|
||||
void AssetExporter::notifyLoadError(AssetExporterView::LoadState state)
|
||||
|
@@ -100,6 +100,7 @@ private:
|
||||
ProjectExplorer::Project *m_project = nullptr;
|
||||
AssetExporterView *m_view = nullptr;
|
||||
Utils::FilePaths m_exportFiles;
|
||||
unsigned int m_totalFileCount = 0;
|
||||
Utils::FilePath m_exportPath;
|
||||
QJsonArray m_components;
|
||||
QSet<QByteArray> m_usedHashes;
|
||||
|
Reference in New Issue
Block a user