diff options
author | hjk <[email protected]> | 2021-09-30 17:45:40 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2021-10-05 09:45:50 +0000 |
commit | cc8d65aa2547c64f092725af6dad18c56a246a89 (patch) | |
tree | 4bbbc0c8ee1db717c5c16b57e73c178c91de5b0a /src/plugins/debugger/shared | |
parent | bdb7aed82edf06038f5508c527963097bb5ca351 (diff) |
Debugger: Use FilePath in CdbSymbolPathsListEditor
Change-Id: I8935284cf3712903660f61cd06083d4da6f1c7c2
Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/plugins/debugger/shared')
4 files changed, 29 insertions, 21 deletions
diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp index 2e67bf675ed..18fcdce5dc3 100644 --- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp +++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp @@ -35,7 +35,6 @@ #include "symbolpathsdialog.h" #include <QCheckBox> -#include <QDir> #include <QDebug> #include <QAction> #include <QFormLayout> @@ -165,7 +164,7 @@ void CdbSymbolPathListEditor::addSymbolPath(CdbSymbolPathListEditor::SymbolPathM { FilePath cacheDir; if (promptCacheDirectory(this, &cacheDir)) - insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(cacheDir.path(), mode)); + insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(cacheDir, mode)); } void CdbSymbolPathListEditor::setupSymbolPaths() @@ -174,13 +173,13 @@ void CdbSymbolPathListEditor::setupSymbolPaths() const int indexOfSymbolServer = indexOfSymbolPath(currentPaths, SymbolServerPath); const int indexOfSymbolCache = indexOfSymbolPath(currentPaths, SymbolCachePath); - QString path; + FilePath path; if (indexOfSymbolServer != -1) - path = currentPaths.at(indexOfSymbolServer); + path = FilePath::fromString(currentPaths.at(indexOfSymbolServer)); if (path.isEmpty() && indexOfSymbolCache != -1) - path = currentPaths.at(indexOfSymbolCache); + path = FilePath::fromString(currentPaths.at(indexOfSymbolCache)); if (path.isEmpty()) - path = TemporaryDirectory::masterDirectoryPath() + "/symbolcache"; + path = FilePath::fromString(TemporaryDirectory::masterDirectoryPath() + "/symbolcache"); bool useSymbolServer = true; bool useSymbolCache = true; @@ -193,20 +192,20 @@ void CdbSymbolPathListEditor::setupSymbolPaths() if (useSymbolCache) { insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(path, SymbolCachePath)); if (useSymbolServer) - insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(QString(), SymbolServerPath)); + insertPathAtCursor(CdbSymbolPathListEditor::symbolPath({}, SymbolServerPath)); } else if (useSymbolServer) { insertPathAtCursor(CdbSymbolPathListEditor::symbolPath(path, SymbolServerPath)); } } -QString CdbSymbolPathListEditor::symbolPath(const QString &cacheDir, +QString CdbSymbolPathListEditor::symbolPath(const FilePath &cacheDir, CdbSymbolPathListEditor::SymbolPathMode mode) { if (mode == SymbolCachePath) - return symbolCachePrefixC + QDir::toNativeSeparators(cacheDir); + return symbolCachePrefixC + cacheDir.toUserOutput(); QString s = QLatin1String(symbolServerPrefixC); if (!cacheDir.isEmpty()) - s += QDir::toNativeSeparators(cacheDir) + '*'; + s += cacheDir.toUserOutput() + '*'; s += QLatin1String(symbolServerPostfixC); return s; } diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h index df64b35bfed..f7dffcdda09 100644 --- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h +++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h @@ -53,7 +53,7 @@ public: static bool promptCacheDirectory(QWidget *parent, Utils::FilePath *cacheDirectory); // Format a symbol path specification - static QString symbolPath(const QString &cacheDir, SymbolPathMode mode); + static QString symbolPath(const Utils::FilePath &cacheDir, SymbolPathMode mode); // Check for a symbol server path and extract local cache directory static bool isSymbolServerPath(const QString &path, QString *cacheDir = nullptr); // Check for a symbol cache path and extract local cache directory diff --git a/src/plugins/debugger/shared/symbolpathsdialog.cpp b/src/plugins/debugger/shared/symbolpathsdialog.cpp index db0354cca47..be8ef21afec 100644 --- a/src/plugins/debugger/shared/symbolpathsdialog.cpp +++ b/src/plugins/debugger/shared/symbolpathsdialog.cpp @@ -26,10 +26,14 @@ #include "symbolpathsdialog.h" #include "ui_symbolpathsdialog.h" +#include <utils/filepath.h> + #include <QMessageBox> -using namespace Debugger; -using namespace Internal; +using namespace Utils; + +namespace Debugger { +namespace Internal { SymbolPathsDialog::SymbolPathsDialog(QWidget *parent) : QDialog(parent), @@ -54,9 +58,9 @@ bool SymbolPathsDialog::useSymbolServer() const return ui->useSymbolServer->isChecked(); } -QString SymbolPathsDialog::path() const +FilePath SymbolPathsDialog::path() const { - return ui->pathChooser->filePath().toString(); + return ui->pathChooser->filePath(); } void SymbolPathsDialog::setUseSymbolCache(bool useSymbolCache) @@ -69,13 +73,13 @@ void SymbolPathsDialog::setUseSymbolServer(bool useSymbolServer) ui->useSymbolServer->setChecked(useSymbolServer); } -void SymbolPathsDialog::setPath(const QString &path) +void SymbolPathsDialog::setPath(const FilePath &path) { - ui->pathChooser->setPath(path); + ui->pathChooser->setFilePath(path); } bool SymbolPathsDialog::useCommonSymbolPaths(bool &useSymbolCache, bool &useSymbolServer, - QString &path) + FilePath &path) { SymbolPathsDialog dialog; dialog.setUseSymbolCache(useSymbolCache); @@ -87,3 +91,6 @@ bool SymbolPathsDialog::useCommonSymbolPaths(bool &useSymbolCache, bool &useSymb path = dialog.path(); return ret == QDialog::Accepted; } + +} // Internal +} // Debugger diff --git a/src/plugins/debugger/shared/symbolpathsdialog.h b/src/plugins/debugger/shared/symbolpathsdialog.h index c3534fbcf6a..c77e112ea41 100644 --- a/src/plugins/debugger/shared/symbolpathsdialog.h +++ b/src/plugins/debugger/shared/symbolpathsdialog.h @@ -28,6 +28,8 @@ #include <QDialog> #include <QString> +namespace Utils { class FilePath; } + namespace Debugger { namespace Internal { @@ -43,15 +45,15 @@ public: bool useSymbolCache() const; bool useSymbolServer() const; - QString path() const; + Utils::FilePath path() const; bool doNotAskAgain() const; void setUseSymbolCache(bool useSymbolCache); void setUseSymbolServer(bool useSymbolServer); - void setPath(const QString &path); + void setPath(const Utils::FilePath &path); void setDoNotAskAgain(bool doNotAskAgain) const; - static bool useCommonSymbolPaths(bool &useSymbolCache, bool &useSymbolServer, QString &path); + static bool useCommonSymbolPaths(bool &useSymbolCache, bool &useSymbolServer, Utils::FilePath &path); private: Ui::SymbolPathsDialog *ui; |