forked from qt-creator/qt-creator
Utils: Modernize
range-based for, nullptr, member initializers, override. Change-Id: I21ac5b23883c08dbd75819bb3298bc956cdb972c Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
9364e4b8ec
commit
d88a0d8e68
@@ -54,7 +54,7 @@ public:
|
||||
}
|
||||
|
||||
Tool(const QString &name, const QString &elementType,
|
||||
const QString &stereotype = QString::null)
|
||||
const QString &stereotype = QString())
|
||||
: m_name(name),
|
||||
m_elementType(elementType),
|
||||
m_stereotype(stereotype)
|
||||
|
||||
@@ -236,7 +236,7 @@ void FancyLineEdit::updateButtonPositions()
|
||||
{
|
||||
QRect contentRect = rect();
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
Side iconpos = (Side)i;
|
||||
Side iconpos = Side(i);
|
||||
if (layoutDirection() == Qt::RightToLeft)
|
||||
iconpos = (iconpos == Left ? Right : Left);
|
||||
|
||||
@@ -473,9 +473,9 @@ void FancyLineEdit::validate()
|
||||
|
||||
// Check buttons.
|
||||
if (d->m_oldText.isEmpty() || t.isEmpty()) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (d->m_iconbutton[i]->hasAutoHide())
|
||||
d->m_iconbutton[i]->animateShow(!t.isEmpty());
|
||||
for (auto &button : qAsConst(d->m_iconbutton)) {
|
||||
if (button->hasAutoHide())
|
||||
button->animateShow(!t.isEmpty());
|
||||
}
|
||||
d->m_oldText = t;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
MimeType mimeTypeForName(const QString &nameOrAlias);
|
||||
MimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device, int *priorityPtr);
|
||||
MimeType findByData(const QByteArray &data, int *priorityPtr);
|
||||
QStringList mimeTypeForFileName(const QString &fileName, QString *foundSuffix = 0);
|
||||
QStringList mimeTypeForFileName(const QString &fileName, QString *foundSuffix = nullptr);
|
||||
|
||||
mutable MimeProviderBase *m_provider;
|
||||
const QString m_defaultMimeType;
|
||||
|
||||
@@ -58,15 +58,11 @@ namespace Internal {
|
||||
|
||||
struct MimeGlobMatchResult
|
||||
{
|
||||
MimeGlobMatchResult()
|
||||
: m_weight(0), m_matchingPatternLength(0)
|
||||
{}
|
||||
|
||||
void addMatch(const QString &mimeType, int weight, const QString &pattern);
|
||||
|
||||
QStringList m_matchingMimeTypes;
|
||||
int m_weight;
|
||||
int m_matchingPatternLength;
|
||||
int m_weight = 0;
|
||||
int m_matchingPatternLength = 0;
|
||||
QString m_foundSuffix;
|
||||
};
|
||||
|
||||
|
||||
@@ -141,14 +141,14 @@ class MimeXMLProvider : public MimeProviderBase
|
||||
public:
|
||||
MimeXMLProvider(MimeDatabasePrivate *db);
|
||||
|
||||
virtual bool isValid();
|
||||
virtual MimeType mimeTypeForName(const QString &name);
|
||||
virtual QStringList findByFileName(const QString &fileName, QString *foundSuffix);
|
||||
virtual QStringList parents(const QString &mime);
|
||||
virtual QString resolveAlias(const QString &name);
|
||||
virtual QStringList listAliases(const QString &name);
|
||||
virtual MimeType findByMagic(const QByteArray &data, int *accuracyPtr);
|
||||
virtual QList<MimeType> allMimeTypes();
|
||||
bool isValid() override;
|
||||
MimeType mimeTypeForName(const QString &name) override;
|
||||
QStringList findByFileName(const QString &fileName, QString *foundSuffix) override;
|
||||
QStringList parents(const QString &mime) override;
|
||||
QString resolveAlias(const QString &name) override;
|
||||
QStringList listAliases(const QString &name) override;
|
||||
MimeType findByMagic(const QByteArray &data, int *accuracyPtr) override;
|
||||
QList<MimeType> allMimeTypes() override;
|
||||
|
||||
bool load(const QString &fileName, QString *errorMessage);
|
||||
|
||||
@@ -161,9 +161,9 @@ public:
|
||||
|
||||
// Qt Creator additions
|
||||
void addData(const QString &id, const QByteArray &data);
|
||||
QMap<int, QList<MimeMagicRule> > magicRulesForMimeType(const MimeType &mimeType);
|
||||
void setGlobPatternsForMimeType(const MimeType &mimeType, const QStringList &patterns);
|
||||
void setMagicRulesForMimeType(const MimeType &mimeType, const QMap<int, QList<MimeMagicRule> > &rules);
|
||||
QMap<int, QList<MimeMagicRule> > magicRulesForMimeType(const MimeType &mimeType) override;
|
||||
void setGlobPatternsForMimeType(const MimeType &mimeType, const QStringList &patterns) override;
|
||||
void setMagicRulesForMimeType(const MimeType &mimeType, const QMap<int, QList<MimeMagicRule> > &rules) override;
|
||||
|
||||
private:
|
||||
void ensureLoaded();
|
||||
|
||||
@@ -101,22 +101,22 @@ public:
|
||||
explicit MimeTypeParser(MimeXMLProvider &provider) : m_provider(provider) {}
|
||||
|
||||
protected:
|
||||
inline bool mimeTypeExists(const QString &mimeTypeName)
|
||||
inline bool mimeTypeExists(const QString &mimeTypeName) override
|
||||
{ return m_provider.mimeTypeForName(mimeTypeName).isValid(); }
|
||||
|
||||
inline bool process(const MimeType &t, QString *)
|
||||
inline bool process(const MimeType &t, QString *) override
|
||||
{ m_provider.addMimeType(t); return true; }
|
||||
|
||||
inline bool process(const MimeGlobPattern &glob, QString *)
|
||||
inline bool process(const MimeGlobPattern &glob, QString *) override
|
||||
{ m_provider.addGlobPattern(glob); return true; }
|
||||
|
||||
inline void processParent(const QString &child, const QString &parent)
|
||||
inline void processParent(const QString &child, const QString &parent) override
|
||||
{ m_provider.addParent(child, parent); }
|
||||
|
||||
inline void processAlias(const QString &alias, const QString &name)
|
||||
inline void processAlias(const QString &alias, const QString &name) override
|
||||
{ m_provider.addAlias(alias, name); }
|
||||
|
||||
inline void processMagicMatcher(const MimeMagicRuleMatcher &matcher)
|
||||
inline void processMagicMatcher(const MimeMagicRuleMatcher &matcher) override
|
||||
{ m_provider.addMagicMatcher(matcher); }
|
||||
|
||||
private:
|
||||
|
||||
@@ -37,16 +37,12 @@ namespace Internal {
|
||||
class OutputFormatterPrivate
|
||||
{
|
||||
public:
|
||||
OutputFormatterPrivate()
|
||||
: plainTextEdit(nullptr), overwriteOutput(false)
|
||||
{}
|
||||
|
||||
QPlainTextEdit *plainTextEdit;
|
||||
QPlainTextEdit *plainTextEdit = nullptr;
|
||||
QTextCharFormat formats[NumberOfFormats];
|
||||
QFont font;
|
||||
QTextCursor cursor;
|
||||
AnsiEscapeCodeHandler escapeCodeHandler;
|
||||
bool overwriteOutput;
|
||||
bool overwriteOutput = false;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
QHBoxLayout *m_hLayout = nullptr;
|
||||
FancyLineEdit *m_lineEdit = nullptr;
|
||||
|
||||
PathChooser::Kind m_acceptingKind;
|
||||
PathChooser::Kind m_acceptingKind = PathChooser::ExistingDirectory;
|
||||
QString m_dialogTitleOverride;
|
||||
QString m_dialogFilter;
|
||||
QString m_initialBrowsePathOverride;
|
||||
@@ -181,7 +181,6 @@ public:
|
||||
PathChooserPrivate::PathChooserPrivate() :
|
||||
m_hLayout(new QHBoxLayout),
|
||||
m_lineEdit(new FancyLineEdit),
|
||||
m_acceptingKind(PathChooser::ExistingDirectory),
|
||||
m_macroExpander(globalMacroExpander())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -60,22 +60,19 @@ class ProjectIntroPagePrivate
|
||||
public:
|
||||
ProjectIntroPagePrivate();
|
||||
Ui::ProjectIntroPage m_ui;
|
||||
bool m_complete;
|
||||
bool m_complete = false;
|
||||
QRegularExpressionValidator m_projectNameValidator;
|
||||
// Status label style sheets
|
||||
const QString m_errorStyleSheet;
|
||||
const QString m_warningStyleSheet;
|
||||
const QString m_hintStyleSheet;
|
||||
bool m_forceSubProject;
|
||||
bool m_forceSubProject = false;
|
||||
QStringList m_projectDirectories;
|
||||
};
|
||||
|
||||
ProjectIntroPagePrivate:: ProjectIntroPagePrivate() :
|
||||
m_complete(false),
|
||||
m_errorStyleSheet(QLatin1String("background : red;")),
|
||||
m_warningStyleSheet(QLatin1String("background : yellow;")),
|
||||
m_hintStyleSheet(),
|
||||
m_forceSubProject(false)
|
||||
m_warningStyleSheet(QLatin1String("background : yellow;"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -63,14 +63,14 @@ class TextTip : public QTipLabel
|
||||
public:
|
||||
TextTip(QWidget *parent);
|
||||
|
||||
virtual void setContent(const QVariant &content);
|
||||
virtual bool isInteractive() const;
|
||||
virtual void configure(const QPoint &pos, QWidget *w);
|
||||
virtual bool canHandleContentReplacement(int typeId) const;
|
||||
virtual int showTime() const;
|
||||
virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
void setContent(const QVariant &content) override;
|
||||
bool isInteractive() const override;
|
||||
void configure(const QPoint &pos, QWidget *w) override;
|
||||
bool canHandleContentReplacement(int typeId) const override;
|
||||
int showTime() const override;
|
||||
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
@@ -81,12 +81,12 @@ class ColorTip : public QTipLabel
|
||||
public:
|
||||
ColorTip(QWidget *parent);
|
||||
|
||||
virtual void setContent(const QVariant &content);
|
||||
virtual void configure(const QPoint &pos, QWidget *w);
|
||||
virtual bool canHandleContentReplacement(int typeId) const;
|
||||
virtual int showTime() const { return 4000; }
|
||||
virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
void setContent(const QVariant &content) override;
|
||||
void configure(const QPoint &pos, QWidget *w) override;
|
||||
bool canHandleContentReplacement(int typeId) const override;
|
||||
int showTime() const override { return 4000; }
|
||||
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
QColor m_color;
|
||||
@@ -98,15 +98,15 @@ class WidgetTip : public QTipLabel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WidgetTip(QWidget *parent = 0);
|
||||
explicit WidgetTip(QWidget *parent = nullptr);
|
||||
void pinToolTipWidget(QWidget *parent);
|
||||
|
||||
virtual void setContent(const QVariant &content);
|
||||
virtual void configure(const QPoint &pos, QWidget *w);
|
||||
virtual bool canHandleContentReplacement(int typeId) const;
|
||||
virtual int showTime() const { return 30000; }
|
||||
virtual bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const;
|
||||
virtual bool isInteractive() const { return true; }
|
||||
void setContent(const QVariant &content) override;
|
||||
void configure(const QPoint &pos, QWidget *w) override;
|
||||
bool canHandleContentReplacement(int typeId) const override;
|
||||
int showTime() const override { return 30000; }
|
||||
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
|
||||
bool isInteractive() const override { return true; }
|
||||
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
|
||||
Reference in New Issue
Block a user