diff options
author | hjk <[email protected]> | 2021-08-17 16:36:42 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2021-08-19 08:33:22 +0000 |
commit | 584217a52f23212d1d56a2beda95ea4438c33aeb (patch) | |
tree | 4703c37de7523a3149864bd9687862163417a762 /src/plugins/qmlprofiler/qmlprofilertool.cpp | |
parent | 6e8c4aa835273d4bf4d5c35f54e3c613a3542420 (diff) |
Use more FileUtils based file dialogs
Change-Id: I1e7ec0493c26afe58e17afb8923a2b1023f6dcd4
Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilertool.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertool.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 3d49dbd59d5..2dc1b402a62 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -586,11 +586,11 @@ void QmlProfilerTool::showErrorDialog(const QString &error) errorDialog->show(); } -void saveLastTraceFile(const QString &filename) +static void saveLastTraceFile(const FilePath &filePath) { QmlProfilerSettings *settings = QmlProfilerPlugin::globalSettings(); - if (filename != settings->lastTraceFile.value()) { - settings->lastTraceFile.setValue(filename); + if (filePath != settings->lastTraceFile.filePath()) { + settings->lastTraceFile.setFilePath(filePath); settings->writeGlobalSettings(); } } @@ -599,16 +599,16 @@ void QmlProfilerTool::showSaveDialog() { QLatin1String tFile(QtdFileExtension); QLatin1String zFile(QztFileExtension); - QString filename = QFileDialog::getSaveFileName( - ICore::dialogParent(), tr("Save QML Trace"), - QmlProfilerPlugin::globalSettings()->lastTraceFile.value(), + FilePath filePath = FileUtils::getSaveFilePath( + nullptr, tr("Save QML Trace"), + QmlProfilerPlugin::globalSettings()->lastTraceFile.filePath(), tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile)); - if (!filename.isEmpty()) { - if (!filename.endsWith(zFile) && !filename.endsWith(tFile)) - filename += zFile; - saveLastTraceFile(filename); + if (!filePath.isEmpty()) { + if (!filePath.endsWith(zFile) && !filePath.endsWith(tFile)) + filePath = filePath + zFile; + saveLastTraceFile(filePath); Debugger::enableMainWindow(false); - Core::ProgressManager::addTask(d->m_profilerModelManager->save(filename), + Core::ProgressManager::addTask(d->m_profilerModelManager->save(filePath.toString()), tr("Saving Trace Data"), TASK_SAVE, Core::ProgressManager::ShowInApplicationIcon); } @@ -623,18 +623,18 @@ void QmlProfilerTool::showLoadDialog() QLatin1String tFile(QtdFileExtension); QLatin1String zFile(QztFileExtension); - QString filename = QFileDialog::getOpenFileName( - ICore::dialogParent(), tr("Load QML Trace"), - QmlProfilerPlugin::globalSettings()->lastTraceFile.value(), + FilePath filePath = FileUtils::getOpenFilePath( + nullptr, tr("Load QML Trace"), + QmlProfilerPlugin::globalSettings()->lastTraceFile.filePath(), tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile)); - if (!filename.isEmpty()) { - saveLastTraceFile(filename); + if (!filePath.isEmpty()) { + saveLastTraceFile(filePath); Debugger::enableMainWindow(false); connect(d->m_profilerModelManager, &QmlProfilerModelManager::recordedFeaturesChanged, this, &QmlProfilerTool::setRecordedFeatures); d->m_profilerModelManager->populateFileFinder(); - Core::ProgressManager::addTask(d->m_profilerModelManager->load(filename), + Core::ProgressManager::addTask(d->m_profilerModelManager->load(filePath.toString()), tr("Loading Trace Data"), TASK_LOAD); } } |