forked from qt-creator/qt-creator
QtSupport: Modernize
modernize-* Change-Id: Id52c06ff440a35d9a4169306c5636f54bfc2125a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -1478,7 +1478,7 @@ QList<Task> BaseQtVersion::reportIssues(const QString &proFile, const QString &b
|
|||||||
|
|
||||||
QtConfigWidget *BaseQtVersion::createConfigurationWidget() const
|
QtConfigWidget *BaseQtVersion::createConfigurationWidget() const
|
||||||
{
|
{
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QByteArray runQmakeQuery(const FileName &binary, const Environment &env,
|
static QByteArray runQmakeQuery(const FileName &binary, const Environment &env,
|
||||||
|
@@ -45,7 +45,7 @@ template <class Predicate>
|
|||||||
bool changeDomElementContents(const QDomElement &element,
|
bool changeDomElementContents(const QDomElement &element,
|
||||||
Predicate p,
|
Predicate p,
|
||||||
const QString &newValue,
|
const QString &newValue,
|
||||||
QString *ptrToOldValue = 0)
|
QString *ptrToOldValue = nullptr)
|
||||||
{
|
{
|
||||||
// Find text in "<element>text</element>"
|
// Find text in "<element>text</element>"
|
||||||
const QDomNodeList children = element.childNodes();
|
const QDomNodeList children = element.childNodes();
|
||||||
|
@@ -90,8 +90,7 @@ void CodeGenSettingsPageWidget::setUiEmbedding(int v)
|
|||||||
|
|
||||||
// ---------- CodeGenSettingsPage
|
// ---------- CodeGenSettingsPage
|
||||||
CodeGenSettingsPage::CodeGenSettingsPage(QObject *parent) :
|
CodeGenSettingsPage::CodeGenSettingsPage(QObject *parent) :
|
||||||
Core::IOptionsPage(parent),
|
Core::IOptionsPage(parent)
|
||||||
m_widget(0)
|
|
||||||
{
|
{
|
||||||
m_parameters.fromSettings(Core::ICore::settings());
|
m_parameters.fromSettings(Core::ICore::settings());
|
||||||
setId(Constants::CODEGEN_SETTINGS_PAGE_ID);
|
setId(Constants::CODEGEN_SETTINGS_PAGE_ID);
|
||||||
|
@@ -40,7 +40,7 @@ class CodeGenSettingsPageWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CodeGenSettingsPageWidget(QWidget *parent = 0);
|
explicit CodeGenSettingsPageWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
CodeGenSettings parameters() const;
|
CodeGenSettings parameters() const;
|
||||||
void setParameters(const CodeGenSettings &p);
|
void setParameters(const CodeGenSettings &p);
|
||||||
@@ -55,11 +55,11 @@ private:
|
|||||||
class CodeGenSettingsPage : public Core::IOptionsPage
|
class CodeGenSettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CodeGenSettingsPage(QObject *parent = 0);
|
explicit CodeGenSettingsPage(QObject *parent = nullptr);
|
||||||
|
|
||||||
QWidget *widget();
|
QWidget *widget() override;
|
||||||
void apply();
|
void apply() override;
|
||||||
void finish();
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<CodeGenSettingsPageWidget> m_widget;
|
QPointer<CodeGenSettingsPageWidget> m_widget;
|
||||||
|
@@ -114,11 +114,7 @@ QString DesktopQtVersion::qmlsceneCommand() const
|
|||||||
return m_qmlsceneCommand;
|
return m_qmlsceneCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopQtVersion::DesktopQtVersion(const DesktopQtVersion &other)
|
DesktopQtVersion::DesktopQtVersion(const DesktopQtVersion &other) = default;
|
||||||
: BaseQtVersion(other),
|
|
||||||
m_qmlsceneCommand(other.m_qmlsceneCommand)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DesktopQtVersion::findTargetBinary(TargetBinaries binary) const
|
QString DesktopQtVersion::findTargetBinary(TargetBinaries binary) const
|
||||||
{
|
{
|
||||||
|
@@ -38,10 +38,7 @@ DesktopQtVersionFactory::DesktopQtVersionFactory(QObject *parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopQtVersionFactory::~DesktopQtVersionFactory()
|
DesktopQtVersionFactory::~DesktopQtVersionFactory() = default;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DesktopQtVersionFactory::canRestore(const QString &type)
|
bool DesktopQtVersionFactory::canRestore(const QString &type)
|
||||||
{
|
{
|
||||||
@@ -51,8 +48,8 @@ bool DesktopQtVersionFactory::canRestore(const QString &type)
|
|||||||
BaseQtVersion *DesktopQtVersionFactory::restore(const QString &type, const QVariantMap &data)
|
BaseQtVersion *DesktopQtVersionFactory::restore(const QString &type, const QVariantMap &data)
|
||||||
{
|
{
|
||||||
if (!canRestore(type))
|
if (!canRestore(type))
|
||||||
return 0;
|
return nullptr;
|
||||||
DesktopQtVersion *v = new DesktopQtVersion;
|
auto v = new DesktopQtVersion;
|
||||||
v->fromMap(data);
|
v->fromMap(data);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@@ -70,5 +67,5 @@ BaseQtVersion *DesktopQtVersionFactory::create(const Utils::FileName &qmakePath,
|
|||||||
QFileInfo fi = qmakePath.toFileInfo();
|
QFileInfo fi = qmakePath.toFileInfo();
|
||||||
if (fi.exists() && fi.isExecutable() && fi.isFile())
|
if (fi.exists() && fi.isExecutable() && fi.isFile())
|
||||||
return new DesktopQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
return new DesktopQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@@ -33,14 +33,15 @@ namespace Internal {
|
|||||||
class DesktopQtVersionFactory : public QtVersionFactory
|
class DesktopQtVersionFactory : public QtVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit DesktopQtVersionFactory(QObject *parent = 0);
|
explicit DesktopQtVersionFactory(QObject *parent = nullptr);
|
||||||
~DesktopQtVersionFactory();
|
~DesktopQtVersionFactory() override;
|
||||||
|
|
||||||
virtual bool canRestore(const QString &type);
|
bool canRestore(const QString &type) override;
|
||||||
virtual BaseQtVersion *restore(const QString &type, const QVariantMap &data);
|
BaseQtVersion *restore(const QString &type, const QVariantMap &data) override;
|
||||||
|
|
||||||
virtual int priority() const;
|
int priority() const override;
|
||||||
virtual BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString());
|
BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator,
|
||||||
|
bool isAutoDetected = false, const QString &autoDetectionSource = QString()) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
@@ -129,7 +129,7 @@ void ExampleSetModel::recreateModel(const QList<BaseQtVersion *> &qtVersions)
|
|||||||
QSet<QString> extraManifestDirs;
|
QSet<QString> extraManifestDirs;
|
||||||
for (int i = 0; i < m_extraExampleSets.size(); ++i) {
|
for (int i = 0; i < m_extraExampleSets.size(); ++i) {
|
||||||
const ExtraExampleSet &set = m_extraExampleSets.at(i);
|
const ExtraExampleSet &set = m_extraExampleSets.at(i);
|
||||||
QStandardItem *newItem = new QStandardItem();
|
auto newItem = new QStandardItem();
|
||||||
newItem->setData(set.displayName, Qt::DisplayRole);
|
newItem->setData(set.displayName, Qt::DisplayRole);
|
||||||
newItem->setData(set.displayName, Qt::UserRole + 1);
|
newItem->setData(set.displayName, Qt::UserRole + 1);
|
||||||
newItem->setData(QVariant(), Qt::UserRole + 2);
|
newItem->setData(QVariant(), Qt::UserRole + 2);
|
||||||
@@ -148,7 +148,7 @@ void ExampleSetModel::recreateModel(const QList<BaseQtVersion *> &qtVersions)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QStandardItem *newItem = new QStandardItem();
|
auto newItem = new QStandardItem();
|
||||||
newItem->setData(version->displayName(), Qt::DisplayRole);
|
newItem->setData(version->displayName(), Qt::DisplayRole);
|
||||||
newItem->setData(version->displayName(), Qt::UserRole + 1);
|
newItem->setData(version->displayName(), Qt::UserRole + 1);
|
||||||
newItem->setData(version->uniqueId(), Qt::UserRole + 2);
|
newItem->setData(version->uniqueId(), Qt::UserRole + 2);
|
||||||
|
@@ -99,8 +99,8 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
|
|||||||
{
|
{
|
||||||
const QString projectDir = proFileInfo.canonicalPath();
|
const QString projectDir = proFileInfo.canonicalPath();
|
||||||
QDialog d(ICore::mainWindow());
|
QDialog d(ICore::mainWindow());
|
||||||
QGridLayout *lay = new QGridLayout(&d);
|
auto lay = new QGridLayout(&d);
|
||||||
QLabel *descrLbl = new QLabel;
|
auto descrLbl = new QLabel;
|
||||||
d.setWindowTitle(tr("Copy Project to writable Location?"));
|
d.setWindowTitle(tr("Copy Project to writable Location?"));
|
||||||
descrLbl->setTextFormat(Qt::RichText);
|
descrLbl->setTextFormat(Qt::RichText);
|
||||||
descrLbl->setWordWrap(false);
|
descrLbl->setWordWrap(false);
|
||||||
@@ -116,8 +116,8 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
|
|||||||
"be able to alter or compile your project in the current location.</p>")
|
"be able to alter or compile your project in the current location.</p>")
|
||||||
.arg(nativeProjectDir));
|
.arg(nativeProjectDir));
|
||||||
lay->addWidget(descrLbl, 0, 0, 1, 2);
|
lay->addWidget(descrLbl, 0, 0, 1, 2);
|
||||||
QLabel *txt = new QLabel(tr("&Location:"));
|
auto txt = new QLabel(tr("&Location:"));
|
||||||
PathChooser *chooser = new PathChooser;
|
auto chooser = new PathChooser;
|
||||||
txt->setBuddy(chooser);
|
txt->setBuddy(chooser);
|
||||||
chooser->setExpectedKind(PathChooser::ExistingDirectory);
|
chooser->setExpectedKind(PathChooser::ExistingDirectory);
|
||||||
chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History"));
|
chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History"));
|
||||||
@@ -127,7 +127,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
|
|||||||
lay->addWidget(txt, 1, 0);
|
lay->addWidget(txt, 1, 0);
|
||||||
lay->addWidget(chooser, 1, 1);
|
lay->addWidget(chooser, 1, 1);
|
||||||
enum { Copy = QDialog::Accepted + 1, Keep = QDialog::Accepted + 2 };
|
enum { Copy = QDialog::Accepted + 1, Keep = QDialog::Accepted + 2 };
|
||||||
QDialogButtonBox *bb = new QDialogButtonBox;
|
auto bb = new QDialogButtonBox;
|
||||||
QPushButton *copyBtn = bb->addButton(tr("&Copy Project and Open"), QDialogButtonBox::AcceptRole);
|
QPushButton *copyBtn = bb->addButton(tr("&Copy Project and Open"), QDialogButtonBox::AcceptRole);
|
||||||
connect(copyBtn, &QAbstractButton::released, &d, [&d] { d.done(Copy); });
|
connect(copyBtn, &QAbstractButton::released, &d, [&d] { d.done(Copy); });
|
||||||
copyBtn->setDefault(true);
|
copyBtn->setDefault(true);
|
||||||
@@ -298,9 +298,6 @@ class GridProxyModel : public QAbstractItemModel
|
|||||||
public:
|
public:
|
||||||
using OptModelIndex = Utils::optional<QModelIndex>;
|
using OptModelIndex = Utils::optional<QModelIndex>;
|
||||||
|
|
||||||
GridProxyModel()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void setSourceModel(QAbstractItemModel *newModel)
|
void setSourceModel(QAbstractItemModel *newModel)
|
||||||
{
|
{
|
||||||
if (m_sourceModel == newModel)
|
if (m_sourceModel == newModel)
|
||||||
@@ -544,7 +541,7 @@ public:
|
|||||||
m_currentTagRects.clear();
|
m_currentTagRects.clear();
|
||||||
int xx = 0;
|
int xx = 0;
|
||||||
int yy = y + tagsBase;
|
int yy = y + tagsBase;
|
||||||
for (const QString tag : item.tags) {
|
for (const QString &tag : item.tags) {
|
||||||
const int ww = tagsFontMetrics.width(tag) + 5;
|
const int ww = tagsFontMetrics.width(tag) + 5;
|
||||||
if (xx + ww > w - 30) {
|
if (xx + ww > w - 30) {
|
||||||
yy += 15;
|
yy += 15;
|
||||||
@@ -579,7 +576,7 @@ public:
|
|||||||
const QPoint pos = mev->pos();
|
const QPoint pos = mev->pos();
|
||||||
if (pos.y() > option.rect.y() + tagsSeparatorY) {
|
if (pos.y() > option.rect.y() + tagsSeparatorY) {
|
||||||
//const QStringList tags = idx.data(Tags).toStringList();
|
//const QStringList tags = idx.data(Tags).toStringList();
|
||||||
for (auto it : m_currentTagRects) {
|
for (const auto &it : m_currentTagRects) {
|
||||||
if (it.second.contains(pos))
|
if (it.second.contains(pos))
|
||||||
emit tagClicked(it.first);
|
emit tagClicked(it.first);
|
||||||
}
|
}
|
||||||
@@ -594,7 +591,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QAbstractItemDelegate::editorEvent(ev, model, option, idx);
|
return QStyledItemDelegate::editorEvent(ev, model, option, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setShowExamples(bool showExamples) { m_showExamples = showExamples; goon(); }
|
void setShowExamples(bool showExamples) { m_showExamples = showExamples; goon(); }
|
||||||
@@ -624,7 +621,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_exampleDelegate.setShowExamples(isExamples);
|
m_exampleDelegate.setShowExamples(isExamples);
|
||||||
const int sideMargin = 27;
|
const int sideMargin = 27;
|
||||||
static ExamplesListModel *s_examplesModel = new ExamplesListModel(this);
|
static auto s_examplesModel = new ExamplesListModel(this);
|
||||||
m_examplesModel = s_examplesModel;
|
m_examplesModel = s_examplesModel;
|
||||||
|
|
||||||
auto filteredModel = new ExamplesListModelFilter(m_examplesModel, !m_isExamples, this);
|
auto filteredModel = new ExamplesListModelFilter(m_examplesModel, !m_isExamples, this);
|
||||||
|
@@ -118,12 +118,10 @@ QHash<ProFile *, QVector<ProFile *> > ProFileReader::includeFiles() const
|
|||||||
return m_includeFiles;
|
return m_includeFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProFileCacheManager *ProFileCacheManager::s_instance = 0;
|
ProFileCacheManager *ProFileCacheManager::s_instance = nullptr;
|
||||||
|
|
||||||
ProFileCacheManager::ProFileCacheManager(QObject *parent) :
|
ProFileCacheManager::ProFileCacheManager(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent)
|
||||||
m_cache(0),
|
|
||||||
m_refCount(0)
|
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
m_timer.setInterval(5000);
|
m_timer.setInterval(5000);
|
||||||
@@ -147,7 +145,7 @@ void ProFileCacheManager::decRefCount()
|
|||||||
|
|
||||||
ProFileCacheManager::~ProFileCacheManager()
|
ProFileCacheManager::~ProFileCacheManager()
|
||||||
{
|
{
|
||||||
s_instance = 0;
|
s_instance = nullptr;
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +163,7 @@ void ProFileCacheManager::clear()
|
|||||||
// obtaining a cache pointer and using it is atomic as far as the main
|
// obtaining a cache pointer and using it is atomic as far as the main
|
||||||
// loop is concerned. Use a shared pointer once this is not true anymore.
|
// loop is concerned. Use a shared pointer once this is not true anymore.
|
||||||
delete m_cache;
|
delete m_cache;
|
||||||
m_cache = 0;
|
m_cache = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProFileCacheManager::discardFiles(const QString &prefix, QMakeVfs *vfs)
|
void ProFileCacheManager::discardFiles(const QString &prefix, QMakeVfs *vfs)
|
||||||
|
@@ -44,7 +44,7 @@ class QTSUPPORT_EXPORT ProMessageHandler : public QObject, public QMakeHandler
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ProMessageHandler(bool verbose = true, bool exact = true);
|
ProMessageHandler(bool verbose = true, bool exact = true);
|
||||||
~ProMessageHandler() override {}
|
~ProMessageHandler() override = default;
|
||||||
|
|
||||||
void aboutToEval(ProFile *, ProFile *, EvalFileType) override {}
|
void aboutToEval(ProFile *, ProFile *, EvalFileType) override {}
|
||||||
void doneWithEval(ProFile *) override {}
|
void doneWithEval(ProFile *) override {}
|
||||||
@@ -102,8 +102,8 @@ private:
|
|||||||
ProFileCacheManager(QObject *parent);
|
ProFileCacheManager(QObject *parent);
|
||||||
~ProFileCacheManager() override;
|
~ProFileCacheManager() override;
|
||||||
void clear();
|
void clear();
|
||||||
ProFileCache *m_cache;
|
ProFileCache *m_cache = nullptr;
|
||||||
int m_refCount;
|
int m_refCount = 0;
|
||||||
QTimer m_timer;
|
QTimer m_timer;
|
||||||
|
|
||||||
static ProFileCacheManager *s_instance;
|
static ProFileCacheManager *s_instance;
|
||||||
|
Reference in New Issue
Block a user