From 7cee991c70669c477aefa5009108fc0a658248de Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 17 Jul 2018 23:21:05 +0300 Subject: [PATCH] Utils: Remove superfluous qualifications Change-Id: I36e17dac0cff87f82f0ddaf97bc613389110f218 Reviewed-by: Eike Ziller --- src/libs/utils/algorithm.h | 6 ++-- src/libs/utils/crumblepath.cpp | 2 +- src/libs/utils/dropsupport.h | 2 +- src/libs/utils/environment.cpp | 8 ++--- src/libs/utils/fadingindicator.cpp | 2 +- src/libs/utils/fancylineedit.h | 2 +- src/libs/utils/fileinprojectfinder.cpp | 4 +-- src/libs/utils/fileinprojectfinder.h | 4 +-- src/libs/utils/filesearch.cpp | 2 +- src/libs/utils/macroexpander.cpp | 2 +- src/libs/utils/outputformatter.h | 2 +- src/libs/utils/pathchooser.cpp | 8 ++--- src/libs/utils/pathchooser.h | 6 ++-- src/libs/utils/pointeralgorithm.h | 4 +-- src/libs/utils/progressindicator.cpp | 2 +- src/libs/utils/runextensions.h | 2 +- src/libs/utils/settingsaccessor.cpp | 18 +++++----- src/libs/utils/settingsaccessor.h | 38 ++++++++++---------- src/libs/utils/shellcommand.cpp | 50 +++++++++++++------------- src/libs/utils/shellcommand.h | 2 +- src/libs/utils/shellcommandpage.cpp | 6 ++-- src/libs/utils/smallstring.h | 6 ++-- src/libs/utils/textutils.cpp | 4 +-- src/libs/utils/textutils.h | 2 +- src/libs/utils/url.cpp | 2 +- src/libs/utils/utilsicons.cpp | 4 +-- 26 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h index 13aa992efc0..4a0d18e945a 100644 --- a/src/libs/utils/algorithm.h +++ b/src/libs/utils/algorithm.h @@ -727,15 +727,15 @@ auto toConstReferences(const SourceContainer &sources) ///////////////// template -Q_REQUIRED_RESULT Utils::optional take(C &container, P predicate) +Q_REQUIRED_RESULT optional take(C &container, P predicate) { const auto end = std::end(container); const auto it = std::find_if(std::begin(container), end, predicate); if (it == end) - return Utils::nullopt; + return nullopt; - Utils::optional result = Utils::make_optional(std::move(*it)); + optional result = Utils::make_optional(std::move(*it)); container.erase(it); return result; } diff --git a/src/libs/utils/crumblepath.cpp b/src/libs/utils/crumblepath.cpp index e30332a9078..ad8c81ef0a2 100644 --- a/src/libs/utils/crumblepath.cpp +++ b/src/libs/utils/crumblepath.cpp @@ -96,7 +96,7 @@ static QPixmap segmentPixmap(CrumblePathButton::SegmentType type, QStyle::State if (!QPixmapCache::find(pixmapKey, pixmap)) { const QString maskFileName = QStringLiteral(":/utils/images/crumblepath-segment-%1%2.png") .arg(segmentName).arg(QLatin1String(hover ? "-hover" : "")); - pixmap = Utils::Icon({{maskFileName, Theme::IconsBaseColor}}).pixmap(iconMode); + pixmap = Icon({{maskFileName, Theme::IconsBaseColor}}).pixmap(iconMode); QPixmapCache::insert(pixmapKey, pixmap); } diff --git a/src/libs/utils/dropsupport.h b/src/libs/utils/dropsupport.h index 720612ada3f..a423a360464 100644 --- a/src/libs/utils/dropsupport.h +++ b/src/libs/utils/dropsupport.h @@ -58,7 +58,7 @@ public: static QStringList mimeTypesForFilePaths(); signals: - void filesDropped(const QList &files, const QPoint &dropPos); + void filesDropped(const QList &files, const QPoint &dropPos); void valuesDropped(const QList &values, const QPoint &dropPos); public: diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index e8e8938739e..d7eb1e7c1dc 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -181,16 +181,16 @@ QDebug operator<<(QDebug debug, const EnvironmentItem &i) debug.nospace(); debug << "EnvironmentItem("; switch (i.operation) { - case Utils::EnvironmentItem::Set: + case EnvironmentItem::Set: debug << "set \"" << i.name << "\" to \"" << i.value << '"'; break; - case Utils::EnvironmentItem::Unset: + case EnvironmentItem::Unset: debug << "unset \"" << i.name << '"'; break; - case Utils::EnvironmentItem::Prepend: + case EnvironmentItem::Prepend: debug << "prepend to \"" << i.name << "\":\"" << i.value << '"'; break; - case Utils::EnvironmentItem::Append: + case EnvironmentItem::Append: debug << "append to \"" << i.name << "\":\"" << i.value << '"'; break; } diff --git a/src/libs/utils/fadingindicator.cpp b/src/libs/utils/fadingindicator.cpp index a9718c9118d..cbc28fc28b0 100644 --- a/src/libs/utils/fadingindicator.cpp +++ b/src/libs/utils/fadingindicator.cpp @@ -76,7 +76,7 @@ public: void setPixmap(const QString &uri) { m_label->hide(); - m_pixmap.load(Utils::StyleHelper::dpiSpecificImageFile(uri)); + m_pixmap.load(StyleHelper::dpiSpecificImageFile(uri)); layout()->setSizeConstraint(QLayout::SetNoConstraint); resize(m_pixmap.size() / m_pixmap.devicePixelRatio()); if (QWidget *parent = parentWidget()) diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h index 8cef228b0d3..8ba5c14532b 100644 --- a/src/libs/utils/fancylineedit.h +++ b/src/libs/utils/fancylineedit.h @@ -144,7 +144,7 @@ protected: virtual void handleChanged(const QString &) {} signals: - void buttonClicked(Utils::FancyLineEdit::Side side); + void buttonClicked(FancyLineEdit::Side side); void leftButtonClicked(); void rightButtonClicked(); diff --git a/src/libs/utils/fileinprojectfinder.cpp b/src/libs/utils/fileinprojectfinder.cpp index 8758da6bcce..7f6122b18d8 100644 --- a/src/libs/utils/fileinprojectfinder.cpp +++ b/src/libs/utils/fileinprojectfinder.cpp @@ -95,7 +95,7 @@ QString FileInProjectFinder::projectDirectory() const return m_projectDir; } -void FileInProjectFinder::setProjectFiles(const Utils::FileNameList &projectFiles) +void FileInProjectFinder::setProjectFiles(const FileNameList &projectFiles) { if (m_projectFiles == projectFiles) return; @@ -180,7 +180,7 @@ QString FileInProjectFinder::findFileOrDirectory(const QString &originalPath, Fi int prefixToIgnore = -1; const QChar separator = QLatin1Char('/'); if (originalPath.startsWith(m_projectDir + separator)) { - if (Utils::HostOsInfo::isMacHost()) { + if (HostOsInfo::isMacHost()) { // starting with the project path is not sufficient if the file was // copied in an insource build, e.g. into MyApp.app/Contents/Resources static const QString appResourcePath = QString::fromLatin1(".app/Contents/Resources"); diff --git a/src/libs/utils/fileinprojectfinder.h b/src/libs/utils/fileinprojectfinder.h index 546e36031e6..56acd0d15a6 100644 --- a/src/libs/utils/fileinprojectfinder.h +++ b/src/libs/utils/fileinprojectfinder.h @@ -49,7 +49,7 @@ public: void setProjectDirectory(const QString &absoluteProjectPath); QString projectDirectory() const; - void setProjectFiles(const Utils::FileNameList &projectFiles); + void setProjectFiles(const FileNameList &projectFiles); void setSysroot(const QString &sysroot); QString findFile(const QUrl &fileUrl, bool *success = nullptr) const; @@ -74,7 +74,7 @@ private: QString m_projectDir; QString m_sysroot; - Utils::FileNameList m_projectFiles; + FileNameList m_projectFiles; QStringList m_searchDirectories; mutable QHash m_cache; }; diff --git a/src/libs/utils/filesearch.cpp b/src/libs/utils/filesearch.cpp index 348c59e012f..4243ce7d7c7 100644 --- a/src/libs/utils/filesearch.cpp +++ b/src/libs/utils/filesearch.cpp @@ -482,7 +482,7 @@ static bool matches(const QList &exprList, const QString &filePath) { return Utils::anyOf(exprList, [&filePath](QRegExp reg) { return (reg.exactMatch(filePath) - || reg.exactMatch(Utils::FileName::fromString(filePath).fileName())); + || reg.exactMatch(FileName::fromString(filePath).fileName())); }); } diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp index 755f2e0a89c..37037061db1 100644 --- a/src/libs/utils/macroexpander.cpp +++ b/src/libs/utils/macroexpander.cpp @@ -396,7 +396,7 @@ void MacroExpander::registerFileVariables(const QByteArray &prefix, registerVariable(prefix + kFileNamePostfix, tr("%1: File name without path.").arg(heading), - [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : Utils::FileName::fromString(tmp).fileName(); }, + [base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : FileName::fromString(tmp).fileName(); }, visibleInChooser); registerVariable(prefix + kFileBaseNamePostfix, diff --git a/src/libs/utils/outputformatter.h b/src/libs/utils/outputformatter.h index d30a640b7b7..2091fb6d8cc 100644 --- a/src/libs/utils/outputformatter.h +++ b/src/libs/utils/outputformatter.h @@ -66,7 +66,7 @@ protected: void initFormats(); virtual void clearLastLine(); QTextCharFormat charFormat(OutputFormat format) const; - QList parseAnsi(const QString &text, const QTextCharFormat &format); + QList parseAnsi(const QString &text, const QTextCharFormat &format); void append(QTextCursor &cursor, const QString &text, const QTextCharFormat &format); private: diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 518023ac909..68a78222f32 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -49,9 +49,11 @@ This class has some validation logic for embedding into QWizardPage. */ +namespace Utils { + static QString appBundleExpandedPath(const QString &path) { - if (Utils::HostOsInfo::hostOs() == Utils::OsTypeMac && path.endsWith(".app")) { + if (HostOsInfo::hostOs() == OsTypeMac && path.endsWith(".app")) { // possibly expand to Foo.app/Contents/MacOS/Foo QFileInfo info(path); if (info.isDir()) { @@ -63,9 +65,7 @@ static QString appBundleExpandedPath(const QString &path) return path; } -Utils::PathChooser::AboutToShowContextMenuHandler Utils::PathChooser::s_aboutToShowContextMenuHandler; - -namespace Utils { +PathChooser::AboutToShowContextMenuHandler PathChooser::s_aboutToShowContextMenuHandler; // ------------------ BinaryVersionToolTipEventFilter // Event filter to be installed on a lineedit used for entering diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index 3f91ebc7cb1..deaaf4f05d7 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -95,7 +95,7 @@ public: FileName rawFileName() const; // The raw unexpanded input. FileName fileName() const; - static QString expandedDirectory(const QString &input, const Utils::Environment &env, + static QString expandedDirectory(const QString &input, const Environment &env, const QString &baseDir); QString baseDirectory() const; @@ -142,7 +142,7 @@ public: // global handler for adding context menus to ALL pathchooser // used by the coreplugin to add "Open in Terminal" and "Open in Explorer" context menu actions - using AboutToShowContextMenuHandler = std::function; + using AboutToShowContextMenuHandler = std::function; static void setAboutToShowContextMenuHandler(AboutToShowContextMenuHandler handler); QColor errorColor() const; @@ -166,7 +166,7 @@ signals: public slots: void setPath(const QString &); - void setFileName(const Utils::FileName &); + void setFileName(const FileName &); void setErrorColor(const QColor &errorColor); void setOkColor(const QColor &okColor); diff --git a/src/libs/utils/pointeralgorithm.h b/src/libs/utils/pointeralgorithm.h index 1ab336f5101..bb65c346a12 100644 --- a/src/libs/utils/pointeralgorithm.h +++ b/src/libs/utils/pointeralgorithm.h @@ -275,13 +275,13 @@ auto toRawPointer(const SourceContainer &sources) // take: ///////////////// template -Q_REQUIRED_RESULT Utils::optional> take(C &container, PointerType p) +Q_REQUIRED_RESULT optional> take(C &container, PointerType p) { return take(container, [p](const ValueType &v) { return v.get() == p; }); } template -Q_REQUIRED_RESULT Utils::optional> take(C &container, std::nullptr_t) +Q_REQUIRED_RESULT optional> take(C &container, std::nullptr_t) { return take(container, static_cast>(nullptr)); } diff --git a/src/libs/utils/progressindicator.cpp b/src/libs/utils/progressindicator.cpp index 407114282f7..dc2d8bb6268 100644 --- a/src/libs/utils/progressindicator.cpp +++ b/src/libs/utils/progressindicator.cpp @@ -205,7 +205,7 @@ void ProgressIndicatorPainter::stopAnimation() /*! \internal */ -void Utils::ProgressIndicatorPainter::nextAnimationStep() +void ProgressIndicatorPainter::nextAnimationStep() { m_rotation = (m_rotation + m_rotationStep + 360) % 360; } diff --git a/src/libs/utils/runextensions.h b/src/libs/utils/runextensions.h index 14cf5e49223..69255046939 100644 --- a/src/libs/utils/runextensions.h +++ b/src/libs/utils/runextensions.h @@ -59,7 +59,7 @@ struct hasCallOperator namespace Utils { -using StackSizeInBytes = Utils::optional; +using StackSizeInBytes = optional; namespace Internal { diff --git a/src/libs/utils/settingsaccessor.cpp b/src/libs/utils/settingsaccessor.cpp index aec17277c11..09210c37669 100644 --- a/src/libs/utils/settingsaccessor.cpp +++ b/src/libs/utils/settingsaccessor.cpp @@ -110,7 +110,7 @@ SettingsAccessor::RestoreData SettingsAccessor::readData(const FileName &path, Q /*! * Store the \a data in \a path on disk. Do all the necessary preprocessing of the data. */ -Utils::optional +optional SettingsAccessor::writeData(const FileName &path, const QVariantMap &data, QWidget *parent) const { Q_UNUSED(parent); @@ -155,7 +155,7 @@ SettingsAccessor::RestoreData SettingsAccessor::readFile(const FileName &path) c * * This method does not do *any* processing of the file contents. */ -Utils::optional +optional SettingsAccessor::writeFile(const FileName &path, const QVariantMap &data) const { if (data.isEmpty()) { @@ -239,11 +239,11 @@ int BackUpStrategy::compare(const SettingsAccessor::RestoreData &data1, return 0; } -Utils::optional +optional BackUpStrategy::backupName(const QVariantMap &oldData, const FileName &path, const QVariantMap &data) const { if (oldData == data) - return Utils::nullopt; + return nullopt; FileName backup = path; backup.appendString(".bak"); return backup; @@ -264,7 +264,7 @@ BackingUpSettingsAccessor::BackingUpSettingsAccessor(std::unique_ptr -BackingUpSettingsAccessor::writeData(const Utils::FileName &path, const QVariantMap &data, +optional +BackingUpSettingsAccessor::writeData(const FileName &path, const QVariantMap &data, QWidget *parent) const { if (data.isEmpty()) @@ -300,7 +300,7 @@ BackingUpSettingsAccessor::writeData(const Utils::FileName &path, const QVariant return SettingsAccessor::writeData(path, data, parent); } -FileNameList BackingUpSettingsAccessor::readFileCandidates(const Utils::FileName &path) const +FileNameList BackingUpSettingsAccessor::readFileCandidates(const FileName &path) const { FileNameList result = Utils::filteredUnique(m_strategy->readFileCandidates(path)); if (result.removeOne(baseFilePath())) @@ -752,7 +752,7 @@ static QVariant mergeQVariantMapsRecursion(const QVariantMap &mainTree, const QV global.key = keyPrefix + key; local.key = key; - Utils::optional> mergeResult = merge(global, local); + optional> mergeResult = merge(global, local); if (!mergeResult) continue; diff --git a/src/libs/utils/settingsaccessor.h b/src/libs/utils/settingsaccessor.h index d7859067ffb..e4310865536 100644 --- a/src/libs/utils/settingsaccessor.h +++ b/src/libs/utils/settingsaccessor.h @@ -63,7 +63,7 @@ QTCREATOR_UTILS_EXPORT void setVersionInMap(QVariantMap &data, int version); QTCREATOR_UTILS_EXPORT void setOriginalVersionInMap(QVariantMap &data, int version); QTCREATOR_UTILS_EXPORT void setSettingsIdInMap(QVariantMap &data, const QByteArray &id); -using SettingsMergeResult = Utils::optional>; +using SettingsMergeResult = optional>; // -------------------------------------------------------------------- // SettingsAccessor: @@ -99,7 +99,7 @@ public: class RestoreData { public: RestoreData() = default; - RestoreData(const Utils::FileName &path, const QVariantMap &data) : path{path}, data{data} { } + RestoreData(const FileName &path, const QVariantMap &data) : path{path}, data{data} { } RestoreData(const QString &title, const QString &message, const Issue::Type type) : RestoreData(Issue(title, message, type)) { } @@ -109,9 +109,9 @@ public: bool hasError() const { return hasIssue() && issue.value().type == Issue::Type::ERROR; } bool hasWarning() const { return hasIssue() && issue.value().type == Issue::Type::WARNING; } - Utils::FileName path; + FileName path; QVariantMap data; - Utils::optional issue; + optional issue; }; QVariantMap restoreSettings(QWidget *parent) const; @@ -121,26 +121,26 @@ public: const QString displayName; const QString applicationDisplayName; - void setBaseFilePath(const Utils::FileName &baseFilePath) { m_baseFilePath = baseFilePath; } + void setBaseFilePath(const FileName &baseFilePath) { m_baseFilePath = baseFilePath; } void setReadOnly() { m_readOnly = true; } - Utils::FileName baseFilePath() const { return m_baseFilePath; } + FileName baseFilePath() const { return m_baseFilePath; } - virtual RestoreData readData(const Utils::FileName &path, QWidget *parent) const; - virtual Utils::optional writeData(const Utils::FileName &path, const QVariantMap &data, QWidget *parent) const; + virtual RestoreData readData(const FileName &path, QWidget *parent) const; + virtual optional writeData(const FileName &path, const QVariantMap &data, QWidget *parent) const; protected: // Report errors: - QVariantMap restoreSettings(const Utils::FileName &settingsPath, QWidget *parent) const; + QVariantMap restoreSettings(const FileName &settingsPath, QWidget *parent) const; ProceedInfo reportIssues(const Issue &issue, const FileName &path, QWidget *parent) const; virtual QVariantMap preprocessReadSettings(const QVariantMap &data) const; virtual QVariantMap prepareToWriteSettings(const QVariantMap &data) const; - virtual RestoreData readFile(const Utils::FileName &path) const; - virtual Utils::optional writeFile(const Utils::FileName &path, const QVariantMap &data) const; + virtual RestoreData readFile(const FileName &path) const; + virtual optional writeFile(const FileName &path, const QVariantMap &data) const; private: - Utils::FileName m_baseFilePath; + FileName m_baseFilePath; mutable std::unique_ptr m_writer; bool m_readOnly = false; }; @@ -154,7 +154,7 @@ class QTCREATOR_UTILS_EXPORT BackUpStrategy public: virtual ~BackUpStrategy() = default; - virtual FileNameList readFileCandidates(const Utils::FileName &baseFileName) const; + virtual FileNameList readFileCandidates(const FileName &baseFileName) const; // Return -1 if data1 is better that data2, 0 if both are equally worthwhile // and 1 if data2 is better than data1 virtual int compare(const SettingsAccessor::RestoreData &data1, @@ -172,14 +172,14 @@ public: BackingUpSettingsAccessor(std::unique_ptr &&strategy, const QString &docType, const QString &displayName, const QString &applicationDisplayName); - RestoreData readData(const Utils::FileName &path, QWidget *parent) const override; - Utils::optional writeData(const Utils::FileName &path, const QVariantMap &data, - QWidget *parent) const override; + RestoreData readData(const FileName &path, QWidget *parent) const override; + optional writeData(const FileName &path, const QVariantMap &data, + QWidget *parent) const override; BackUpStrategy *strategy() const { return m_strategy.get(); } private: - Utils::FileNameList readFileCandidates(const FileName &path) const; + FileNameList readFileCandidates(const FileName &path) const; RestoreData bestReadFileData(const FileNameList &candidates, QWidget *parent) const; void backupFile(const FileName &path, const QVariantMap &data, QWidget *parent) const; @@ -251,7 +251,7 @@ public: bool isValidVersionAndId(const int version, const QByteArray &id) const; VersionUpgrader *upgrader(const int version) const; - RestoreData readData(const Utils::FileName &path, QWidget *parent) const override; + RestoreData readData(const FileName &path, QWidget *parent) const override; protected: QVariantMap prepareToWriteSettings(const QVariantMap &data) const override; @@ -284,7 +284,7 @@ public: const QString &docType, const QString &displayName, const QString &applicationDisplayName); - RestoreData readData(const Utils::FileName &path, QWidget *parent) const final; + RestoreData readData(const FileName &path, QWidget *parent) const final; void setSecondaryAccessor(std::unique_ptr &&secondary); diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index 05c515eabff..0d17f1ab411 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -68,11 +68,11 @@ class ShellCommandPrivate { public: struct Job { - explicit Job(const QString &wd, const Utils::FileName &b, const QStringList &a, int t, + explicit Job(const QString &wd, const FileName &b, const QStringList &a, int t, const ExitCodeInterpreter &interpreter); QString workingDirectory; - Utils::FileName binary; + FileName binary; QStringList arguments; ExitCodeInterpreter exitCodeInterpreter; int timeoutS; @@ -113,7 +113,7 @@ ShellCommandPrivate::~ShellCommandPrivate() delete m_progressParser; } -ShellCommandPrivate::Job::Job(const QString &wd, const Utils::FileName &b, const QStringList &a, +ShellCommandPrivate::Job::Job(const QString &wd, const FileName &b, const QStringList &a, int t, const ExitCodeInterpreter &interpreter) : workingDirectory(wd), binary(b), @@ -195,13 +195,13 @@ void ShellCommand::addFlags(unsigned f) d->m_flags |= f; } -void ShellCommand::addJob(const Utils::FileName &binary, const QStringList &arguments, +void ShellCommand::addJob(const FileName &binary, const QStringList &arguments, const QString &workingDirectory, const ExitCodeInterpreter &interpreter) { addJob(binary, arguments, defaultTimeoutS(), workingDirectory, interpreter); } -void ShellCommand::addJob(const Utils::FileName &binary, const QStringList &arguments, int timeoutS, +void ShellCommand::addJob(const FileName &binary, const QStringList &arguments, int timeoutS, const QString &workingDirectory, const ExitCodeInterpreter &interpreter) { d->m_jobs.push_back(Internal::ShellCommandPrivate::Job(workDirectory(workingDirectory), binary, @@ -286,13 +286,13 @@ void ShellCommand::run(QFutureInterface &future) d->m_lastExecSuccess = true; for (int j = 0; j < count; j++) { const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(j); - Utils::SynchronousProcessResponse resp + SynchronousProcessResponse resp = runCommand(job.binary, job.arguments, job.timeoutS, job.workingDirectory, job.exitCodeInterpreter); stdOut += resp.stdOut(); stdErr += resp.stdErr(); d->m_lastExecExitCode = resp.exitCode; - d->m_lastExecSuccess = resp.result == Utils::SynchronousProcessResponse::Finished; + d->m_lastExecSuccess = resp.result == SynchronousProcessResponse::Finished; if (!d->m_lastExecSuccess) break; } @@ -319,17 +319,17 @@ void ShellCommand::run(QFutureInterface &future) this->deleteLater(); } -Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName &binary, - const QStringList &arguments, int timeoutS, - const QString &workingDirectory, - const ExitCodeInterpreter &interpreter) +SynchronousProcessResponse ShellCommand::runCommand(const FileName &binary, + const QStringList &arguments, int timeoutS, + const QString &workingDirectory, + const ExitCodeInterpreter &interpreter) { - Utils::SynchronousProcessResponse response; + SynchronousProcessResponse response; const QString dir = workDirectory(workingDirectory); if (binary.isEmpty()) { - response.result = Utils::SynchronousProcessResponse::StartFailed; + response.result = SynchronousProcessResponse::StartFailed; return response; } @@ -345,7 +345,7 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName if (!d->m_aborted) { // Success/Fail message in appropriate window? - if (response.result == Utils::SynchronousProcessResponse::Finished) { + if (response.result == SynchronousProcessResponse::Finished) { if (d->m_flags & ShowSuccessMessage) proxy->appendMessage(response.exitMessage(binary.toUserOutput(), timeoutS)); } else if (!(d->m_flags & SuppressFailMessage)) { @@ -356,15 +356,15 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName return response; } -Utils::SynchronousProcessResponse ShellCommand::runFullySynchronous(const Utils::FileName &binary, - const QStringList &arguments, - QSharedPointer proxy, - int timeoutS, - const QString &workingDirectory, - const ExitCodeInterpreter &interpreter) +SynchronousProcessResponse ShellCommand::runFullySynchronous(const FileName &binary, + const QStringList &arguments, + QSharedPointer proxy, + int timeoutS, + const QString &workingDirectory, + const ExitCodeInterpreter &interpreter) { // Set up process - Utils::SynchronousProcess process; + SynchronousProcess process; process.setFlags(processFlags()); const QString dir = workDirectory(workingDirectory); if (!dir.isEmpty()) @@ -403,9 +403,9 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary, const QString &workingDirectory, const ExitCodeInterpreter &interpreter) { - Utils::SynchronousProcess process; + SynchronousProcess process; process.setExitCodeInterpreter(interpreter); - connect(this, &ShellCommand::terminate, &process, &Utils::SynchronousProcess::terminate); + connect(this, &ShellCommand::terminate, &process, &SynchronousProcess::terminate); process.setProcessEnvironment(processEnvironment()); process.setTimeoutS(timeoutS); if (d->m_codec) @@ -421,7 +421,7 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary, } else if (d->m_progressiveOutput || !(d->m_flags & SuppressStdErr)) { process.setStdErrBufferedSignalsEnabled(true); - connect(&process, &Utils::SynchronousProcess::stdErrBuffered, + connect(&process, &SynchronousProcess::stdErrBuffered, this, [this, proxy](const QString &text) { if (d->m_progressParser) @@ -436,7 +436,7 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary, // connect stdout to the output window if desired if (d->m_progressParser || d->m_progressiveOutput || (d->m_flags & ShowStdOut)) { process.setStdOutBufferedSignalsEnabled(true); - connect(&process, &Utils::SynchronousProcess::stdOutBuffered, + connect(&process, &SynchronousProcess::stdOutBuffered, this, [this, proxy](const QString &text) { if (d->m_progressParser) diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index eb3161e3a1e..3f933ee1146 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -79,7 +79,7 @@ signals: void append(const QString &text); void appendSilently(const QString &text); void appendError(const QString &text); - void appendCommand(const QString &workingDirectory, const Utils::FileName &binary, + void appendCommand(const QString &workingDirectory, const FileName &binary, const QStringList &args); void appendMessage(const QString &text); }; diff --git a/src/libs/utils/shellcommandpage.cpp b/src/libs/utils/shellcommandpage.cpp index 6f4690ef650..423fe646230 100644 --- a/src/libs/utils/shellcommandpage.cpp +++ b/src/libs/utils/shellcommandpage.cpp @@ -53,7 +53,7 @@ ShellCommandPage::ShellCommandPage(QWidget *parent) : resize(264, 200); auto verticalLayout = new QVBoxLayout(this); m_logPlainTextEdit = new QPlainTextEdit; - m_formatter = new Utils::OutputFormatter; + m_formatter = new OutputFormatter; m_logPlainTextEdit->setReadOnly(true); m_formatter->setPlainTextEdit(m_logPlainTextEdit); @@ -86,10 +86,10 @@ void ShellCommandPage::start(ShellCommand *command) m_command = command; command->setProgressiveOutput(true); connect(command, &ShellCommand::stdOutText, this, [this](const QString &text) { - m_formatter->appendMessage(text, Utils::StdOutFormat); + m_formatter->appendMessage(text, StdOutFormat); }); connect(command, &ShellCommand::stdErrText, this, [this](const QString &text) { - m_formatter->appendMessage(text, Utils::StdErrFormat); + m_formatter->appendMessage(text, StdErrFormat); }); connect(command, &ShellCommand::finished, this, &ShellCommandPage::slotFinished); QApplication::setOverrideCursor(Qt::WaitCursor); diff --git a/src/libs/utils/smallstring.h b/src/libs/utils/smallstring.h index 59fc3d6699a..dce302594b8 100644 --- a/src/libs/utils/smallstring.h +++ b/src/libs/utils/smallstring.h @@ -146,7 +146,7 @@ public: { } - BasicSmallString(std::initializer_list list) + BasicSmallString(std::initializer_list list) : m_data(Internal::StringDataLayout()) { appendInitializerList(list, 0); @@ -695,7 +695,7 @@ private: void appendInitializerList(std::initializer_list list, std::size_t initialSize) { - auto addSize = [] (std::size_t size, Utils::SmallStringView string) { + auto addSize = [] (std::size_t size, SmallStringView string) { return size + string.size(); }; @@ -706,7 +706,7 @@ private: char *currentData = data() + initialSize; - for (Utils::SmallStringView string : list) { + for (SmallStringView string : list) { std::memcpy(currentData, string.data(), string.size()); currentData += string.size(); } diff --git a/src/libs/utils/textutils.cpp b/src/libs/utils/textutils.cpp index 0eb16d2dd11..e3db9ba38af 100644 --- a/src/libs/utils/textutils.cpp +++ b/src/libs/utils/textutils.cpp @@ -46,9 +46,9 @@ bool convertPosition(const QTextDocument *document, int pos, int *line, int *col } } -Utils::OptionalLineColumn convertPosition(const QTextDocument *document, int pos) +OptionalLineColumn convertPosition(const QTextDocument *document, int pos) { - Utils::OptionalLineColumn optional; + OptionalLineColumn optional; QTextBlock block = document->findBlock(pos); diff --git a/src/libs/utils/textutils.h b/src/libs/utils/textutils.h index 7c87108832b..0f848417f96 100644 --- a/src/libs/utils/textutils.h +++ b/src/libs/utils/textutils.h @@ -41,7 +41,7 @@ QTCREATOR_UTILS_EXPORT bool convertPosition(const QTextDocument *document, int pos, int *line, int *column); QTCREATOR_UTILS_EXPORT -Utils::OptionalLineColumn convertPosition(const QTextDocument *document, int pos); +OptionalLineColumn convertPosition(const QTextDocument *document, int pos); // line and column are 1-based QTCREATOR_UTILS_EXPORT int positionInText(QTextDocument *textDocument, int line, int column); diff --git a/src/libs/utils/url.cpp b/src/libs/utils/url.cpp index 56b832eb5c9..026af262fc5 100644 --- a/src/libs/utils/url.cpp +++ b/src/libs/utils/url.cpp @@ -47,7 +47,7 @@ QUrl urlFromLocalSocket() { QUrl serverUrl; serverUrl.setScheme(urlSocketScheme()); - Utils::TemporaryFile file("qtcreator-freesocket"); + TemporaryFile file("qtcreator-freesocket"); if (file.open()) serverUrl.setPath(file.fileName()); return serverUrl; diff --git a/src/libs/utils/utilsicons.cpp b/src/libs/utils/utilsicons.cpp index 62f87437064..2c1159468bd 100644 --- a/src/libs/utils/utilsicons.cpp +++ b/src/libs/utils/utilsicons.cpp @@ -30,9 +30,9 @@ namespace Icons { const Icon HOME({ - {QLatin1String(":/utils/images/home.png"), Utils::Theme::PanelTextColorDark}}, Icon::Tint); + {QLatin1String(":/utils/images/home.png"), Theme::PanelTextColorDark}}, Icon::Tint); const Icon HOME_TOOLBAR({ - {QLatin1String(":/utils/images/home.png"), Utils::Theme::IconsBaseColor}}); + {QLatin1String(":/utils/images/home.png"), Theme::IconsBaseColor}}); const Icon EDIT_CLEAR({ {QLatin1String(":/utils/images/editclear.png"), Theme::PanelTextColorMid}}, Icon::Tint); const Icon EDIT_CLEAR_TOOLBAR({