Utils: Remove superfluous qualifications

Change-Id: I36e17dac0cff87f82f0ddaf97bc613389110f218
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Orgad Shaneh
2018-07-17 23:21:05 +03:00
committed by Tobias Hunger
parent 9f8dbc1d2f
commit 7cee991c70
26 changed files with 95 additions and 95 deletions

View File

@@ -727,15 +727,15 @@ auto toConstReferences(const SourceContainer &sources)
///////////////// /////////////////
template<class C, typename P> template<class C, typename P>
Q_REQUIRED_RESULT Utils::optional<typename C::value_type> take(C &container, P predicate) Q_REQUIRED_RESULT optional<typename C::value_type> take(C &container, P predicate)
{ {
const auto end = std::end(container); const auto end = std::end(container);
const auto it = std::find_if(std::begin(container), end, predicate); const auto it = std::find_if(std::begin(container), end, predicate);
if (it == end) if (it == end)
return Utils::nullopt; return nullopt;
Utils::optional<typename C::value_type> result = Utils::make_optional(std::move(*it)); optional<typename C::value_type> result = Utils::make_optional(std::move(*it));
container.erase(it); container.erase(it);
return result; return result;
} }

View File

@@ -96,7 +96,7 @@ static QPixmap segmentPixmap(CrumblePathButton::SegmentType type, QStyle::State
if (!QPixmapCache::find(pixmapKey, pixmap)) { if (!QPixmapCache::find(pixmapKey, pixmap)) {
const QString maskFileName = QStringLiteral(":/utils/images/crumblepath-segment-%1%2.png") const QString maskFileName = QStringLiteral(":/utils/images/crumblepath-segment-%1%2.png")
.arg(segmentName).arg(QLatin1String(hover ? "-hover" : "")); .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); QPixmapCache::insert(pixmapKey, pixmap);
} }

View File

@@ -58,7 +58,7 @@ public:
static QStringList mimeTypesForFilePaths(); static QStringList mimeTypesForFilePaths();
signals: signals:
void filesDropped(const QList<Utils::DropSupport::FileSpec> &files, const QPoint &dropPos); void filesDropped(const QList<DropSupport::FileSpec> &files, const QPoint &dropPos);
void valuesDropped(const QList<QVariant> &values, const QPoint &dropPos); void valuesDropped(const QList<QVariant> &values, const QPoint &dropPos);
public: public:

View File

@@ -181,16 +181,16 @@ QDebug operator<<(QDebug debug, const EnvironmentItem &i)
debug.nospace(); debug.nospace();
debug << "EnvironmentItem("; debug << "EnvironmentItem(";
switch (i.operation) { switch (i.operation) {
case Utils::EnvironmentItem::Set: case EnvironmentItem::Set:
debug << "set \"" << i.name << "\" to \"" << i.value << '"'; debug << "set \"" << i.name << "\" to \"" << i.value << '"';
break; break;
case Utils::EnvironmentItem::Unset: case EnvironmentItem::Unset:
debug << "unset \"" << i.name << '"'; debug << "unset \"" << i.name << '"';
break; break;
case Utils::EnvironmentItem::Prepend: case EnvironmentItem::Prepend:
debug << "prepend to \"" << i.name << "\":\"" << i.value << '"'; debug << "prepend to \"" << i.name << "\":\"" << i.value << '"';
break; break;
case Utils::EnvironmentItem::Append: case EnvironmentItem::Append:
debug << "append to \"" << i.name << "\":\"" << i.value << '"'; debug << "append to \"" << i.name << "\":\"" << i.value << '"';
break; break;
} }

View File

@@ -76,7 +76,7 @@ public:
void setPixmap(const QString &uri) void setPixmap(const QString &uri)
{ {
m_label->hide(); m_label->hide();
m_pixmap.load(Utils::StyleHelper::dpiSpecificImageFile(uri)); m_pixmap.load(StyleHelper::dpiSpecificImageFile(uri));
layout()->setSizeConstraint(QLayout::SetNoConstraint); layout()->setSizeConstraint(QLayout::SetNoConstraint);
resize(m_pixmap.size() / m_pixmap.devicePixelRatio()); resize(m_pixmap.size() / m_pixmap.devicePixelRatio());
if (QWidget *parent = parentWidget()) if (QWidget *parent = parentWidget())

View File

@@ -144,7 +144,7 @@ protected:
virtual void handleChanged(const QString &) {} virtual void handleChanged(const QString &) {}
signals: signals:
void buttonClicked(Utils::FancyLineEdit::Side side); void buttonClicked(FancyLineEdit::Side side);
void leftButtonClicked(); void leftButtonClicked();
void rightButtonClicked(); void rightButtonClicked();

View File

@@ -95,7 +95,7 @@ QString FileInProjectFinder::projectDirectory() const
return m_projectDir; return m_projectDir;
} }
void FileInProjectFinder::setProjectFiles(const Utils::FileNameList &projectFiles) void FileInProjectFinder::setProjectFiles(const FileNameList &projectFiles)
{ {
if (m_projectFiles == projectFiles) if (m_projectFiles == projectFiles)
return; return;
@@ -180,7 +180,7 @@ QString FileInProjectFinder::findFileOrDirectory(const QString &originalPath, Fi
int prefixToIgnore = -1; int prefixToIgnore = -1;
const QChar separator = QLatin1Char('/'); const QChar separator = QLatin1Char('/');
if (originalPath.startsWith(m_projectDir + separator)) { 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 // starting with the project path is not sufficient if the file was
// copied in an insource build, e.g. into MyApp.app/Contents/Resources // copied in an insource build, e.g. into MyApp.app/Contents/Resources
static const QString appResourcePath = QString::fromLatin1(".app/Contents/Resources"); static const QString appResourcePath = QString::fromLatin1(".app/Contents/Resources");

View File

@@ -49,7 +49,7 @@ public:
void setProjectDirectory(const QString &absoluteProjectPath); void setProjectDirectory(const QString &absoluteProjectPath);
QString projectDirectory() const; QString projectDirectory() const;
void setProjectFiles(const Utils::FileNameList &projectFiles); void setProjectFiles(const FileNameList &projectFiles);
void setSysroot(const QString &sysroot); void setSysroot(const QString &sysroot);
QString findFile(const QUrl &fileUrl, bool *success = nullptr) const; QString findFile(const QUrl &fileUrl, bool *success = nullptr) const;
@@ -74,7 +74,7 @@ private:
QString m_projectDir; QString m_projectDir;
QString m_sysroot; QString m_sysroot;
Utils::FileNameList m_projectFiles; FileNameList m_projectFiles;
QStringList m_searchDirectories; QStringList m_searchDirectories;
mutable QHash<QString,QString> m_cache; mutable QHash<QString,QString> m_cache;
}; };

View File

@@ -482,7 +482,7 @@ static bool matches(const QList<QRegExp> &exprList, const QString &filePath)
{ {
return Utils::anyOf(exprList, [&filePath](QRegExp reg) { return Utils::anyOf(exprList, [&filePath](QRegExp reg) {
return (reg.exactMatch(filePath) return (reg.exactMatch(filePath)
|| reg.exactMatch(Utils::FileName::fromString(filePath).fileName())); || reg.exactMatch(FileName::fromString(filePath).fileName()));
}); });
} }

View File

@@ -396,7 +396,7 @@ void MacroExpander::registerFileVariables(const QByteArray &prefix,
registerVariable(prefix + kFileNamePostfix, registerVariable(prefix + kFileNamePostfix,
tr("%1: File name without path.").arg(heading), 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); visibleInChooser);
registerVariable(prefix + kFileBaseNamePostfix, registerVariable(prefix + kFileBaseNamePostfix,

View File

@@ -66,7 +66,7 @@ protected:
void initFormats(); void initFormats();
virtual void clearLastLine(); virtual void clearLastLine();
QTextCharFormat charFormat(OutputFormat format) const; QTextCharFormat charFormat(OutputFormat format) const;
QList<Utils::FormattedText> parseAnsi(const QString &text, const QTextCharFormat &format); QList<FormattedText> parseAnsi(const QString &text, const QTextCharFormat &format);
void append(QTextCursor &cursor, const QString &text, const QTextCharFormat &format); void append(QTextCursor &cursor, const QString &text, const QTextCharFormat &format);
private: private:

View File

@@ -49,9 +49,11 @@
This class has some validation logic for embedding into QWizardPage. This class has some validation logic for embedding into QWizardPage.
*/ */
namespace Utils {
static QString appBundleExpandedPath(const QString &path) 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 // possibly expand to Foo.app/Contents/MacOS/Foo
QFileInfo info(path); QFileInfo info(path);
if (info.isDir()) { if (info.isDir()) {
@@ -63,9 +65,7 @@ static QString appBundleExpandedPath(const QString &path)
return path; return path;
} }
Utils::PathChooser::AboutToShowContextMenuHandler Utils::PathChooser::s_aboutToShowContextMenuHandler; PathChooser::AboutToShowContextMenuHandler PathChooser::s_aboutToShowContextMenuHandler;
namespace Utils {
// ------------------ BinaryVersionToolTipEventFilter // ------------------ BinaryVersionToolTipEventFilter
// Event filter to be installed on a lineedit used for entering // Event filter to be installed on a lineedit used for entering

View File

@@ -95,7 +95,7 @@ public:
FileName rawFileName() const; // The raw unexpanded input. FileName rawFileName() const; // The raw unexpanded input.
FileName fileName() const; 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); const QString &baseDir);
QString baseDirectory() const; QString baseDirectory() const;
@@ -142,7 +142,7 @@ public:
// global handler for adding context menus to ALL pathchooser // 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 // used by the coreplugin to add "Open in Terminal" and "Open in Explorer" context menu actions
using AboutToShowContextMenuHandler = std::function<void (Utils::PathChooser *, QMenu *)>; using AboutToShowContextMenuHandler = std::function<void (PathChooser *, QMenu *)>;
static void setAboutToShowContextMenuHandler(AboutToShowContextMenuHandler handler); static void setAboutToShowContextMenuHandler(AboutToShowContextMenuHandler handler);
QColor errorColor() const; QColor errorColor() const;
@@ -166,7 +166,7 @@ signals:
public slots: public slots:
void setPath(const QString &); void setPath(const QString &);
void setFileName(const Utils::FileName &); void setFileName(const FileName &);
void setErrorColor(const QColor &errorColor); void setErrorColor(const QColor &errorColor);
void setOkColor(const QColor &okColor); void setOkColor(const QColor &okColor);

View File

@@ -275,13 +275,13 @@ auto toRawPointer(const SourceContainer &sources)
// take: // take:
///////////////// /////////////////
template<typename C> template<typename C>
Q_REQUIRED_RESULT Utils::optional<ValueType<C>> take(C &container, PointerType<C> p) Q_REQUIRED_RESULT optional<ValueType<C>> take(C &container, PointerType<C> p)
{ {
return take(container, [p](const ValueType<C> &v) { return v.get() == p; }); return take(container, [p](const ValueType<C> &v) { return v.get() == p; });
} }
template <typename C> template <typename C>
Q_REQUIRED_RESULT Utils::optional<ValueType<C>> take(C &container, std::nullptr_t) Q_REQUIRED_RESULT optional<ValueType<C>> take(C &container, std::nullptr_t)
{ {
return take(container, static_cast<PointerType<C>>(nullptr)); return take(container, static_cast<PointerType<C>>(nullptr));
} }

View File

@@ -205,7 +205,7 @@ void ProgressIndicatorPainter::stopAnimation()
/*! /*!
\internal \internal
*/ */
void Utils::ProgressIndicatorPainter::nextAnimationStep() void ProgressIndicatorPainter::nextAnimationStep()
{ {
m_rotation = (m_rotation + m_rotationStep + 360) % 360; m_rotation = (m_rotation + m_rotationStep + 360) % 360;
} }

View File

@@ -59,7 +59,7 @@ struct hasCallOperator
namespace Utils { namespace Utils {
using StackSizeInBytes = Utils::optional<uint>; using StackSizeInBytes = optional<uint>;
namespace Internal { namespace Internal {

View File

@@ -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. * Store the \a data in \a path on disk. Do all the necessary preprocessing of the data.
*/ */
Utils::optional<SettingsAccessor::Issue> optional<SettingsAccessor::Issue>
SettingsAccessor::writeData(const FileName &path, const QVariantMap &data, QWidget *parent) const SettingsAccessor::writeData(const FileName &path, const QVariantMap &data, QWidget *parent) const
{ {
Q_UNUSED(parent); 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. * This method does not do *any* processing of the file contents.
*/ */
Utils::optional<SettingsAccessor::Issue> optional<SettingsAccessor::Issue>
SettingsAccessor::writeFile(const FileName &path, const QVariantMap &data) const SettingsAccessor::writeFile(const FileName &path, const QVariantMap &data) const
{ {
if (data.isEmpty()) { if (data.isEmpty()) {
@@ -239,11 +239,11 @@ int BackUpStrategy::compare(const SettingsAccessor::RestoreData &data1,
return 0; return 0;
} }
Utils::optional<Utils::FileName> optional<FileName>
BackUpStrategy::backupName(const QVariantMap &oldData, const FileName &path, const QVariantMap &data) const BackUpStrategy::backupName(const QVariantMap &oldData, const FileName &path, const QVariantMap &data) const
{ {
if (oldData == data) if (oldData == data)
return Utils::nullopt; return nullopt;
FileName backup = path; FileName backup = path;
backup.appendString(".bak"); backup.appendString(".bak");
return backup; return backup;
@@ -264,7 +264,7 @@ BackingUpSettingsAccessor::BackingUpSettingsAccessor(std::unique_ptr<BackUpStrat
{ } { }
SettingsAccessor::RestoreData SettingsAccessor::RestoreData
BackingUpSettingsAccessor::readData(const Utils::FileName &path, QWidget *parent) const BackingUpSettingsAccessor::readData(const FileName &path, QWidget *parent) const
{ {
const FileNameList fileList = readFileCandidates(path); const FileNameList fileList = readFileCandidates(path);
if (fileList.isEmpty()) // No settings found at all. if (fileList.isEmpty()) // No settings found at all.
@@ -288,8 +288,8 @@ BackingUpSettingsAccessor::readData(const Utils::FileName &path, QWidget *parent
return result; return result;
} }
Utils::optional<SettingsAccessor::Issue> optional<SettingsAccessor::Issue>
BackingUpSettingsAccessor::writeData(const Utils::FileName &path, const QVariantMap &data, BackingUpSettingsAccessor::writeData(const FileName &path, const QVariantMap &data,
QWidget *parent) const QWidget *parent) const
{ {
if (data.isEmpty()) if (data.isEmpty())
@@ -300,7 +300,7 @@ BackingUpSettingsAccessor::writeData(const Utils::FileName &path, const QVariant
return SettingsAccessor::writeData(path, data, parent); 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)); FileNameList result = Utils::filteredUnique(m_strategy->readFileCandidates(path));
if (result.removeOne(baseFilePath())) if (result.removeOne(baseFilePath()))
@@ -752,7 +752,7 @@ static QVariant mergeQVariantMapsRecursion(const QVariantMap &mainTree, const QV
global.key = keyPrefix + key; global.key = keyPrefix + key;
local.key = key; local.key = key;
Utils::optional<QPair<QString, QVariant>> mergeResult = merge(global, local); optional<QPair<QString, QVariant>> mergeResult = merge(global, local);
if (!mergeResult) if (!mergeResult)
continue; continue;

View File

@@ -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 setOriginalVersionInMap(QVariantMap &data, int version);
QTCREATOR_UTILS_EXPORT void setSettingsIdInMap(QVariantMap &data, const QByteArray &id); QTCREATOR_UTILS_EXPORT void setSettingsIdInMap(QVariantMap &data, const QByteArray &id);
using SettingsMergeResult = Utils::optional<QPair<QString, QVariant>>; using SettingsMergeResult = optional<QPair<QString, QVariant>>;
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// SettingsAccessor: // SettingsAccessor:
@@ -99,7 +99,7 @@ public:
class RestoreData { class RestoreData {
public: public:
RestoreData() = default; 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(const QString &title, const QString &message, const Issue::Type type) :
RestoreData(Issue(title, message, type)) RestoreData(Issue(title, message, type))
{ } { }
@@ -109,9 +109,9 @@ public:
bool hasError() const { return hasIssue() && issue.value().type == Issue::Type::ERROR; } bool hasError() const { return hasIssue() && issue.value().type == Issue::Type::ERROR; }
bool hasWarning() const { return hasIssue() && issue.value().type == Issue::Type::WARNING; } bool hasWarning() const { return hasIssue() && issue.value().type == Issue::Type::WARNING; }
Utils::FileName path; FileName path;
QVariantMap data; QVariantMap data;
Utils::optional<Issue> issue; optional<Issue> issue;
}; };
QVariantMap restoreSettings(QWidget *parent) const; QVariantMap restoreSettings(QWidget *parent) const;
@@ -121,26 +121,26 @@ public:
const QString displayName; const QString displayName;
const QString applicationDisplayName; 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; } 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 RestoreData readData(const FileName &path, QWidget *parent) const;
virtual Utils::optional<Issue> writeData(const Utils::FileName &path, const QVariantMap &data, QWidget *parent) const; virtual optional<Issue> writeData(const FileName &path, const QVariantMap &data, QWidget *parent) const;
protected: protected:
// Report errors: // 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; ProceedInfo reportIssues(const Issue &issue, const FileName &path, QWidget *parent) const;
virtual QVariantMap preprocessReadSettings(const QVariantMap &data) const; virtual QVariantMap preprocessReadSettings(const QVariantMap &data) const;
virtual QVariantMap prepareToWriteSettings(const QVariantMap &data) const; virtual QVariantMap prepareToWriteSettings(const QVariantMap &data) const;
virtual RestoreData readFile(const Utils::FileName &path) const; virtual RestoreData readFile(const FileName &path) const;
virtual Utils::optional<Issue> writeFile(const Utils::FileName &path, const QVariantMap &data) const; virtual optional<Issue> writeFile(const FileName &path, const QVariantMap &data) const;
private: private:
Utils::FileName m_baseFilePath; FileName m_baseFilePath;
mutable std::unique_ptr<PersistentSettingsWriter> m_writer; mutable std::unique_ptr<PersistentSettingsWriter> m_writer;
bool m_readOnly = false; bool m_readOnly = false;
}; };
@@ -154,7 +154,7 @@ class QTCREATOR_UTILS_EXPORT BackUpStrategy
public: public:
virtual ~BackUpStrategy() = default; 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 // Return -1 if data1 is better that data2, 0 if both are equally worthwhile
// and 1 if data2 is better than data1 // and 1 if data2 is better than data1
virtual int compare(const SettingsAccessor::RestoreData &data1, virtual int compare(const SettingsAccessor::RestoreData &data1,
@@ -172,14 +172,14 @@ public:
BackingUpSettingsAccessor(std::unique_ptr<BackUpStrategy> &&strategy, const QString &docType, BackingUpSettingsAccessor(std::unique_ptr<BackUpStrategy> &&strategy, const QString &docType,
const QString &displayName, const QString &applicationDisplayName); const QString &displayName, const QString &applicationDisplayName);
RestoreData readData(const Utils::FileName &path, QWidget *parent) const override; RestoreData readData(const FileName &path, QWidget *parent) const override;
Utils::optional<Issue> writeData(const Utils::FileName &path, const QVariantMap &data, optional<Issue> writeData(const FileName &path, const QVariantMap &data,
QWidget *parent) const override; QWidget *parent) const override;
BackUpStrategy *strategy() const { return m_strategy.get(); } BackUpStrategy *strategy() const { return m_strategy.get(); }
private: private:
Utils::FileNameList readFileCandidates(const FileName &path) const; FileNameList readFileCandidates(const FileName &path) const;
RestoreData bestReadFileData(const FileNameList &candidates, QWidget *parent) const; RestoreData bestReadFileData(const FileNameList &candidates, QWidget *parent) const;
void backupFile(const FileName &path, const QVariantMap &data, 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; bool isValidVersionAndId(const int version, const QByteArray &id) const;
VersionUpgrader *upgrader(const int version) 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: protected:
QVariantMap prepareToWriteSettings(const QVariantMap &data) const override; QVariantMap prepareToWriteSettings(const QVariantMap &data) const override;
@@ -284,7 +284,7 @@ public:
const QString &docType, const QString &displayName, const QString &docType, const QString &displayName,
const QString &applicationDisplayName); 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<SettingsAccessor> &&secondary); void setSecondaryAccessor(std::unique_ptr<SettingsAccessor> &&secondary);

View File

@@ -68,11 +68,11 @@ class ShellCommandPrivate
{ {
public: public:
struct Job { 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); const ExitCodeInterpreter &interpreter);
QString workingDirectory; QString workingDirectory;
Utils::FileName binary; FileName binary;
QStringList arguments; QStringList arguments;
ExitCodeInterpreter exitCodeInterpreter; ExitCodeInterpreter exitCodeInterpreter;
int timeoutS; int timeoutS;
@@ -113,7 +113,7 @@ ShellCommandPrivate::~ShellCommandPrivate()
delete m_progressParser; 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) : int t, const ExitCodeInterpreter &interpreter) :
workingDirectory(wd), workingDirectory(wd),
binary(b), binary(b),
@@ -195,13 +195,13 @@ void ShellCommand::addFlags(unsigned f)
d->m_flags |= 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) const QString &workingDirectory, const ExitCodeInterpreter &interpreter)
{ {
addJob(binary, arguments, defaultTimeoutS(), workingDirectory, 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) const QString &workingDirectory, const ExitCodeInterpreter &interpreter)
{ {
d->m_jobs.push_back(Internal::ShellCommandPrivate::Job(workDirectory(workingDirectory), binary, d->m_jobs.push_back(Internal::ShellCommandPrivate::Job(workDirectory(workingDirectory), binary,
@@ -286,13 +286,13 @@ void ShellCommand::run(QFutureInterface<void> &future)
d->m_lastExecSuccess = true; d->m_lastExecSuccess = true;
for (int j = 0; j < count; j++) { for (int j = 0; j < count; j++) {
const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(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, = runCommand(job.binary, job.arguments, job.timeoutS, job.workingDirectory,
job.exitCodeInterpreter); job.exitCodeInterpreter);
stdOut += resp.stdOut(); stdOut += resp.stdOut();
stdErr += resp.stdErr(); stdErr += resp.stdErr();
d->m_lastExecExitCode = resp.exitCode; d->m_lastExecExitCode = resp.exitCode;
d->m_lastExecSuccess = resp.result == Utils::SynchronousProcessResponse::Finished; d->m_lastExecSuccess = resp.result == SynchronousProcessResponse::Finished;
if (!d->m_lastExecSuccess) if (!d->m_lastExecSuccess)
break; break;
} }
@@ -319,17 +319,17 @@ void ShellCommand::run(QFutureInterface<void> &future)
this->deleteLater(); this->deleteLater();
} }
Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName &binary, SynchronousProcessResponse ShellCommand::runCommand(const FileName &binary,
const QStringList &arguments, int timeoutS, const QStringList &arguments, int timeoutS,
const QString &workingDirectory, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter) const ExitCodeInterpreter &interpreter)
{ {
Utils::SynchronousProcessResponse response; SynchronousProcessResponse response;
const QString dir = workDirectory(workingDirectory); const QString dir = workDirectory(workingDirectory);
if (binary.isEmpty()) { if (binary.isEmpty()) {
response.result = Utils::SynchronousProcessResponse::StartFailed; response.result = SynchronousProcessResponse::StartFailed;
return response; return response;
} }
@@ -345,7 +345,7 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName
if (!d->m_aborted) { if (!d->m_aborted) {
// Success/Fail message in appropriate window? // Success/Fail message in appropriate window?
if (response.result == Utils::SynchronousProcessResponse::Finished) { if (response.result == SynchronousProcessResponse::Finished) {
if (d->m_flags & ShowSuccessMessage) if (d->m_flags & ShowSuccessMessage)
proxy->appendMessage(response.exitMessage(binary.toUserOutput(), timeoutS)); proxy->appendMessage(response.exitMessage(binary.toUserOutput(), timeoutS));
} else if (!(d->m_flags & SuppressFailMessage)) { } else if (!(d->m_flags & SuppressFailMessage)) {
@@ -356,7 +356,7 @@ Utils::SynchronousProcessResponse ShellCommand::runCommand(const Utils::FileName
return response; return response;
} }
Utils::SynchronousProcessResponse ShellCommand::runFullySynchronous(const Utils::FileName &binary, SynchronousProcessResponse ShellCommand::runFullySynchronous(const FileName &binary,
const QStringList &arguments, const QStringList &arguments,
QSharedPointer<OutputProxy> proxy, QSharedPointer<OutputProxy> proxy,
int timeoutS, int timeoutS,
@@ -364,7 +364,7 @@ Utils::SynchronousProcessResponse ShellCommand::runFullySynchronous(const Utils:
const ExitCodeInterpreter &interpreter) const ExitCodeInterpreter &interpreter)
{ {
// Set up process // Set up process
Utils::SynchronousProcess process; SynchronousProcess process;
process.setFlags(processFlags()); process.setFlags(processFlags());
const QString dir = workDirectory(workingDirectory); const QString dir = workDirectory(workingDirectory);
if (!dir.isEmpty()) if (!dir.isEmpty())
@@ -403,9 +403,9 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary,
const QString &workingDirectory, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter) const ExitCodeInterpreter &interpreter)
{ {
Utils::SynchronousProcess process; SynchronousProcess process;
process.setExitCodeInterpreter(interpreter); process.setExitCodeInterpreter(interpreter);
connect(this, &ShellCommand::terminate, &process, &Utils::SynchronousProcess::terminate); connect(this, &ShellCommand::terminate, &process, &SynchronousProcess::terminate);
process.setProcessEnvironment(processEnvironment()); process.setProcessEnvironment(processEnvironment());
process.setTimeoutS(timeoutS); process.setTimeoutS(timeoutS);
if (d->m_codec) if (d->m_codec)
@@ -421,7 +421,7 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary,
} else if (d->m_progressiveOutput } else if (d->m_progressiveOutput
|| !(d->m_flags & SuppressStdErr)) { || !(d->m_flags & SuppressStdErr)) {
process.setStdErrBufferedSignalsEnabled(true); process.setStdErrBufferedSignalsEnabled(true);
connect(&process, &Utils::SynchronousProcess::stdErrBuffered, connect(&process, &SynchronousProcess::stdErrBuffered,
this, [this, proxy](const QString &text) this, [this, proxy](const QString &text)
{ {
if (d->m_progressParser) if (d->m_progressParser)
@@ -436,7 +436,7 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const FileName &binary,
// connect stdout to the output window if desired // connect stdout to the output window if desired
if (d->m_progressParser || d->m_progressiveOutput || (d->m_flags & ShowStdOut)) { if (d->m_progressParser || d->m_progressiveOutput || (d->m_flags & ShowStdOut)) {
process.setStdOutBufferedSignalsEnabled(true); process.setStdOutBufferedSignalsEnabled(true);
connect(&process, &Utils::SynchronousProcess::stdOutBuffered, connect(&process, &SynchronousProcess::stdOutBuffered,
this, [this, proxy](const QString &text) this, [this, proxy](const QString &text)
{ {
if (d->m_progressParser) if (d->m_progressParser)

View File

@@ -79,7 +79,7 @@ signals:
void append(const QString &text); void append(const QString &text);
void appendSilently(const QString &text); void appendSilently(const QString &text);
void appendError(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); const QStringList &args);
void appendMessage(const QString &text); void appendMessage(const QString &text);
}; };

View File

@@ -53,7 +53,7 @@ ShellCommandPage::ShellCommandPage(QWidget *parent) :
resize(264, 200); resize(264, 200);
auto verticalLayout = new QVBoxLayout(this); auto verticalLayout = new QVBoxLayout(this);
m_logPlainTextEdit = new QPlainTextEdit; m_logPlainTextEdit = new QPlainTextEdit;
m_formatter = new Utils::OutputFormatter; m_formatter = new OutputFormatter;
m_logPlainTextEdit->setReadOnly(true); m_logPlainTextEdit->setReadOnly(true);
m_formatter->setPlainTextEdit(m_logPlainTextEdit); m_formatter->setPlainTextEdit(m_logPlainTextEdit);
@@ -86,10 +86,10 @@ void ShellCommandPage::start(ShellCommand *command)
m_command = command; m_command = command;
command->setProgressiveOutput(true); command->setProgressiveOutput(true);
connect(command, &ShellCommand::stdOutText, this, [this](const QString &text) { 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) { 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); connect(command, &ShellCommand::finished, this, &ShellCommandPage::slotFinished);
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);

View File

@@ -146,7 +146,7 @@ public:
{ {
} }
BasicSmallString(std::initializer_list<Utils::SmallStringView> list) BasicSmallString(std::initializer_list<SmallStringView> list)
: m_data(Internal::StringDataLayout<Size>()) : m_data(Internal::StringDataLayout<Size>())
{ {
appendInitializerList(list, 0); appendInitializerList(list, 0);
@@ -695,7 +695,7 @@ private:
void appendInitializerList(std::initializer_list<SmallStringView> list, std::size_t initialSize) void appendInitializerList(std::initializer_list<SmallStringView> 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(); return size + string.size();
}; };
@@ -706,7 +706,7 @@ private:
char *currentData = data() + initialSize; char *currentData = data() + initialSize;
for (Utils::SmallStringView string : list) { for (SmallStringView string : list) {
std::memcpy(currentData, string.data(), string.size()); std::memcpy(currentData, string.data(), string.size());
currentData += string.size(); currentData += string.size();
} }

View File

@@ -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); QTextBlock block = document->findBlock(pos);

View File

@@ -41,7 +41,7 @@ QTCREATOR_UTILS_EXPORT bool convertPosition(const QTextDocument *document,
int pos, int pos,
int *line, int *column); int *line, int *column);
QTCREATOR_UTILS_EXPORT QTCREATOR_UTILS_EXPORT
Utils::OptionalLineColumn convertPosition(const QTextDocument *document, int pos); OptionalLineColumn convertPosition(const QTextDocument *document, int pos);
// line and column are 1-based // line and column are 1-based
QTCREATOR_UTILS_EXPORT int positionInText(QTextDocument *textDocument, int line, int column); QTCREATOR_UTILS_EXPORT int positionInText(QTextDocument *textDocument, int line, int column);

View File

@@ -47,7 +47,7 @@ QUrl urlFromLocalSocket()
{ {
QUrl serverUrl; QUrl serverUrl;
serverUrl.setScheme(urlSocketScheme()); serverUrl.setScheme(urlSocketScheme());
Utils::TemporaryFile file("qtcreator-freesocket"); TemporaryFile file("qtcreator-freesocket");
if (file.open()) if (file.open())
serverUrl.setPath(file.fileName()); serverUrl.setPath(file.fileName());
return serverUrl; return serverUrl;

View File

@@ -30,9 +30,9 @@ namespace Icons {
const Icon HOME({ 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({ const Icon HOME_TOOLBAR({
{QLatin1String(":/utils/images/home.png"), Utils::Theme::IconsBaseColor}}); {QLatin1String(":/utils/images/home.png"), Theme::IconsBaseColor}});
const Icon EDIT_CLEAR({ const Icon EDIT_CLEAR({
{QLatin1String(":/utils/images/editclear.png"), Theme::PanelTextColorMid}}, Icon::Tint); {QLatin1String(":/utils/images/editclear.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon EDIT_CLEAR_TOOLBAR({ const Icon EDIT_CLEAR_TOOLBAR({