Utils: More forward declarations / drop unused headers [P-R]

Round 1 - focus on headers.
For classes with initial in range [P-R].
Try to keep the same separators between different kind of headers.

Change-Id: I01fb80b93164a7fe4c0bd2cd8f9e4f27523efefa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-05-24 12:14:24 +02:00
parent 9508ee1347
commit 304ab10642
22 changed files with 43 additions and 27 deletions

View File

@@ -49,6 +49,7 @@
#include "workspacedialog.h"
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <algorithm>

View File

@@ -27,6 +27,7 @@
#include "commandline.h"
#include "environment.h"
#include "fileutils.h"
#include "hostosinfo.h"
#include "macroexpander.h"
#include "qtcassert.h"
@@ -231,7 +232,7 @@ FilePath PathChooserPrivate::expandedPath(const QString &input) const
case PathChooser::File:
case PathChooser::SaveFile:
if (!m_baseDirectory.isEmpty()) {
Utils::FilePath fp = m_baseDirectory.resolvePath(path.path()).absoluteFilePath();
FilePath fp = m_baseDirectory.resolvePath(path.path()).absoluteFilePath();
// FIXME bad hotfix for manually editing PathChooser (invalid paths, jumping cursor)
// examples: have an absolute path and try to change the device letter by typing the new
// letter and removing the original afterwards ends up in

View File

@@ -25,8 +25,10 @@
#pragma once
#include "utils_global.h"
#include "fancylineedit.h"
#include "fileutils.h"
#include "filepath.h"
#include <QWidget>
@@ -35,11 +37,9 @@ class QAbstractButton;
class QLineEdit;
QT_END_NAMESPACE
namespace Utils {
class CommandLine;
class FancyLineEdit;
class MacroExpander;
class Environment;
class EnvironmentChange;
@@ -126,7 +126,7 @@ public:
void setCommandVersionArguments(const QStringList &arguments);
// Utility to run a tool and return its stdout.
static QString toolVersion(const Utils::CommandLine &cmd);
static QString toolVersion(const CommandLine &cmd);
// Install a tooltip on lineedits used for binaries showing the version.
static void installLineEditVersionToolTip(QLineEdit *le, const QStringList &arguments);

View File

@@ -31,9 +31,7 @@
#include <functional>
QT_BEGIN_NAMESPACE
class QPushButton;
QT_END_NAMESPACE
QT_FORWARD_DECLARE_CLASS(QPushButton)
namespace Utils {

View File

@@ -25,6 +25,9 @@
#include "persistentsettings.h"
#include "fileutils.h"
#include <QCoreApplication>
#include <QDateTime>
#include <QDebug>
#include <QDir>

View File

@@ -25,9 +25,10 @@
#pragma once
#include "fileutils.h"
#include "utils_global.h"
#include "filepath.h"
#include <QVariant>
QT_BEGIN_NAMESPACE

View File

@@ -43,7 +43,7 @@ QList<Port> Port::parseFromSedOutput(const QByteArray &output)
if (portString.size() != 4)
continue;
bool ok;
const Utils::Port port(portString.toInt(&ok, 16));
const Port port(portString.toInt(&ok, 16));
if (ok) {
if (!ports.contains(port))
ports << port;
@@ -60,7 +60,7 @@ QList<Port> Port::parseFromNetstatOutput(const QByteArray &output)
QList<Port> ports;
const QList<QByteArray> lines = output.split('\n');
for (const QByteArray &line : lines) {
const Port port(Utils::parseUsedPortFromNetstatOutput(line));
const Port port(parseUsedPortFromNetstatOutput(line));
if (port.isValid() && !ports.contains(port))
ports.append(port);
}

View File

@@ -26,6 +26,7 @@
#pragma once
#include "utils_global.h"
#include "qtcassert.h"
#include <QMetaType>

View File

@@ -26,6 +26,7 @@
#pragma once
#include "utils_global.h"
#include "port.h"
QT_FORWARD_DECLARE_CLASS(QString)

View File

@@ -26,6 +26,7 @@
#pragma once
#include <QMetaType>
#include <functional>
namespace Utils {

View File

@@ -191,7 +191,7 @@ QList<ProcessInfo> ProcessInfo::processInfoList()
ProcessInfo p;
p.processId = pe.th32ProcessID;
// Image has the absolute path, but can fail.
const QString image = Utils::imageName(pe.th32ProcessID);
const QString image = imageName(pe.th32ProcessID);
p.executable = p.commandLine = image.isEmpty() ?
QString::fromWCharArray(pe.szExeFile) : image;
processes << p;

View File

@@ -96,7 +96,7 @@ signals:
// This should be emitted when being in Starting or Running state.
// When being in Starting state, the resultData should set error to FailedToStart.
// After emitting this signal the process enters NotRunning state.
void done(const Utils::ProcessResultData &resultData);
void done(const ProcessResultData &resultData);
protected:
static int controlSignalToInt(ControlSignal controlSignal);

View File

@@ -26,7 +26,6 @@
#pragma once
#include "processenums.h"
#include "processreaper.h"
#include <QIODevice>
#include <QProcess>

View File

@@ -25,11 +25,11 @@
#pragma once
#include "overlaywidget.h"
#include "utils_global.h"
#include "overlaywidget.h"
#include <QTimer>
#include <QWidget>
#include <functional>
#include <memory>

View File

@@ -27,6 +27,7 @@
#include "ui_projectintropage.h"
#include "filenamevalidatinglineedit.h"
#include "fileutils.h"
#include "wizard.h"
#include <QDir>

View File

@@ -39,7 +39,7 @@ class QTCREATOR_UTILS_EXPORT ProjectIntroPage : public WizardPage
{
Q_OBJECT
Q_PROPERTY(QString description READ description WRITE setDescription DESIGNABLE true)
Q_PROPERTY(FilePath filePath READ filePath WRITE setFilePath DESIGNABLE true)
Q_PROPERTY(Utils::FilePath filePath READ filePath WRITE setFilePath DESIGNABLE true)
Q_PROPERTY(QString projectName READ projectName WRITE setProjectName DESIGNABLE true)
Q_PROPERTY(bool useAsDefaultPath READ useAsDefaultPath WRITE setUseAsDefaultPath DESIGNABLE true)
Q_PROPERTY(bool forceSubProject READ forceSubProject WRITE setForceSubProject DESIGNABLE true)
@@ -61,7 +61,7 @@ public:
bool forceSubProject() const;
void setForceSubProject(bool force);
void setProjectList(const QStringList &projectList);
void setProjectDirectories(const Utils::FilePaths &directoryList);
void setProjectDirectories(const FilePaths &directoryList);
int projectIndex() const;
bool validateProjectName(const QString &name, QString *errorMessage);

View File

@@ -26,6 +26,7 @@
#pragma once
#include "utils_global.h"
#include <QDialog>
QT_FORWARD_DECLARE_CLASS(QNetworkProxy)

View File

@@ -24,14 +24,18 @@
****************************************************************************/
#pragma once
#include "utils_global.h"
#include <QMap>
#include <QSharedPointer>
#include <QString>
#include <QStringList>
QT_FORWARD_DECLARE_CLASS(QLocale)
QT_BEGIN_NAMESPACE
class QLocale;
template <typename K, typename V>
class QMap;
QT_END_NAMESPACE
namespace Utils {
@@ -50,7 +54,7 @@ public:
QString firstFileAtPath(const QString &path, const QLocale &locale) const;
void collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = nullptr) const;
bool hasDirAtPath(const QString &path, const QLocale *locale = nullptr) const;
void collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs = false,
void collectFilesInPath(const QString &path, QMap<QString, QStringList> *res, bool addDirs = false,
const QLocale *locale = nullptr) const;
void collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *results,
const QLocale *locale = nullptr) const;

View File

@@ -793,9 +793,9 @@ bool QtcProcessPrivate::flushFor(SignalType signalType)
QList<ProcessInterfaceSignal *> oldSignals;
{
QMutexLocker locker(&m_mutex);
const QList<SignalType> storedSignals =
Utils::transform(qAsConst(m_signals), [](const ProcessInterfaceSignal *aSignal) {
return aSignal->signalType();
const QList<SignalType> storedSignals = transform(qAsConst(m_signals),
[](const ProcessInterfaceSignal *aSignal) {
return aSignal->signalType();
});
// If we are flushing for ReadyRead or Done - flush all.

View File

@@ -25,9 +25,10 @@
#pragma once
#include "utils_global.h"
#include "functiontraits.h"
#include "optional.h"
#include "utils_global.h"
#include <QCoreApplication>
#include <QFuture>
@@ -481,7 +482,7 @@ runAsync(QThread::Priority priority, Function &&function, Args&&... args)
template<typename Function,
typename... Args,
typename ResultType = typename Internal::resultType<Function>::type>
QFuture<ResultType> runAsync(Utils::StackSizeInBytes stackSize, Function &&function, Args &&... args)
QFuture<ResultType> runAsync(StackSizeInBytes stackSize, Function &&function, Args &&... args)
{
return Internal::runAsync_internal(static_cast<QThreadPool *>(nullptr),
stackSize,
@@ -500,7 +501,7 @@ QFuture<ResultType> runAsync(Utils::StackSizeInBytes stackSize, Function &&funct
template<typename Function,
typename... Args,
typename ResultType = typename Internal::resultType<Function>::type>
QFuture<ResultType> runAsync(Utils::StackSizeInBytes stackSize,
QFuture<ResultType> runAsync(StackSizeInBytes stackSize,
QThread::Priority priority,
Function &&function,
Args &&... args)

View File

@@ -27,6 +27,7 @@
#include "jsonfieldpage.h"
#include <utils/fileutils.h>
#include <utils/pathchooser.h>
#include <QWidget>

View File

@@ -30,6 +30,8 @@
#include "sshkeycreationdialog.h"
#include <projectexplorer/devicesupport/sshparameters.h>
#include <utils/fileutils.h>
#include <utils/pathchooser.h>
#include <utils/utilsicons.h>