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 "workspacedialog.h"
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <algorithm> #include <algorithm>

View File

@@ -27,6 +27,7 @@
#include "commandline.h" #include "commandline.h"
#include "environment.h" #include "environment.h"
#include "fileutils.h"
#include "hostosinfo.h" #include "hostosinfo.h"
#include "macroexpander.h" #include "macroexpander.h"
#include "qtcassert.h" #include "qtcassert.h"
@@ -231,7 +232,7 @@ FilePath PathChooserPrivate::expandedPath(const QString &input) const
case PathChooser::File: case PathChooser::File:
case PathChooser::SaveFile: case PathChooser::SaveFile:
if (!m_baseDirectory.isEmpty()) { 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) // 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 // 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 // letter and removing the original afterwards ends up in

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -793,8 +793,8 @@ bool QtcProcessPrivate::flushFor(SignalType signalType)
QList<ProcessInterfaceSignal *> oldSignals; QList<ProcessInterfaceSignal *> oldSignals;
{ {
QMutexLocker locker(&m_mutex); QMutexLocker locker(&m_mutex);
const QList<SignalType> storedSignals = const QList<SignalType> storedSignals = transform(qAsConst(m_signals),
Utils::transform(qAsConst(m_signals), [](const ProcessInterfaceSignal *aSignal) { [](const ProcessInterfaceSignal *aSignal) {
return aSignal->signalType(); return aSignal->signalType();
}); });

View File

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

View File

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

View File

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