forked from qt-creator/qt-creator
Utils: Modernize
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using modernize-use-default-member-init modernize-use-equals-default Change-Id: I8d44d9405011a1878353baf9325f7af90b89db02 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -33,8 +33,7 @@ using namespace Utils;
|
|||||||
AnnotatedItemDelegate::AnnotatedItemDelegate(QObject *parent) : QStyledItemDelegate(parent)
|
AnnotatedItemDelegate::AnnotatedItemDelegate(QObject *parent) : QStyledItemDelegate(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AnnotatedItemDelegate::~AnnotatedItemDelegate()
|
AnnotatedItemDelegate::~AnnotatedItemDelegate() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void AnnotatedItemDelegate::setAnnotationRole(int role)
|
void AnnotatedItemDelegate::setAnnotationRole(int role)
|
||||||
{
|
{
|
||||||
@@ -110,5 +109,5 @@ QSize AnnotatedItemDelegate::sizeHint(const QStyleOptionViewItem &option,
|
|||||||
if (!annotation.isEmpty())
|
if (!annotation.isEmpty())
|
||||||
opt.text += m_delimiter + annotation;
|
opt.text += m_delimiter + annotation;
|
||||||
|
|
||||||
return QApplication::style()->sizeFromContents(QStyle::CT_ItemViewItem, &opt, QSize(), 0);
|
return QApplication::style()->sizeFromContents(QStyle::CT_ItemViewItem, &opt, QSize(), nullptr);
|
||||||
}
|
}
|
||||||
|
@@ -50,19 +50,19 @@ class BaseTreeViewPrivate : public QObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit BaseTreeViewPrivate(BaseTreeView *parent)
|
explicit BaseTreeViewPrivate(BaseTreeView *parent)
|
||||||
: q(parent), m_settings(0), m_expectUserChanges(false), m_progressIndicator(0)
|
: q(parent)
|
||||||
{
|
{
|
||||||
m_settingsTimer.setSingleShot(true);
|
m_settingsTimer.setSingleShot(true);
|
||||||
connect(&m_settingsTimer, &QTimer::timeout,
|
connect(&m_settingsTimer, &QTimer::timeout,
|
||||||
this, &BaseTreeViewPrivate::doSaveState);
|
this, &BaseTreeViewPrivate::doSaveState);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eventFilter(QObject *, QEvent *event)
|
bool eventFilter(QObject *, QEvent *event) override
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::MouseMove) {
|
if (event->type() == QEvent::MouseMove) {
|
||||||
// At this time we don't know which section will get which size.
|
// At this time we don't know which section will get which size.
|
||||||
// But we know that a resizedSection() will be emitted later.
|
// But we know that a resizedSection() will be emitted later.
|
||||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
const auto *me = static_cast<QMouseEvent *>(event);
|
||||||
if (me->buttons() & Qt::LeftButton)
|
if (me->buttons() & Qt::LeftButton)
|
||||||
m_expectUserChanges = true;
|
m_expectUserChanges = true;
|
||||||
}
|
}
|
||||||
@@ -219,11 +219,11 @@ public:
|
|||||||
public:
|
public:
|
||||||
BaseTreeView *q;
|
BaseTreeView *q;
|
||||||
QMap<int, int> m_userHandled; // column -> width, "not present" means "automatic"
|
QMap<int, int> m_userHandled; // column -> width, "not present" means "automatic"
|
||||||
QSettings *m_settings;
|
QSettings *m_settings = nullptr;
|
||||||
QTimer m_settingsTimer;
|
QTimer m_settingsTimer;
|
||||||
QString m_settingsKey;
|
QString m_settingsKey;
|
||||||
bool m_expectUserChanges;
|
bool m_expectUserChanges = false;
|
||||||
ProgressIndicator *m_progressIndicator;
|
ProgressIndicator *m_progressIndicator = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseTreeViewDelegate : public QItemDelegate
|
class BaseTreeViewDelegate : public QItemDelegate
|
||||||
@@ -232,7 +232,7 @@ public:
|
|||||||
BaseTreeViewDelegate(QObject *parent): QItemDelegate(parent) {}
|
BaseTreeViewDelegate(QObject *parent): QItemDelegate(parent) {}
|
||||||
|
|
||||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const override
|
||||||
{
|
{
|
||||||
Q_UNUSED(option);
|
Q_UNUSED(option);
|
||||||
QLabel *label = new QLabel(parent);
|
QLabel *label = new QLabel(parent);
|
||||||
@@ -283,7 +283,7 @@ BaseTreeView::~BaseTreeView()
|
|||||||
|
|
||||||
void BaseTreeView::setModel(QAbstractItemModel *m)
|
void BaseTreeView::setModel(QAbstractItemModel *m)
|
||||||
{
|
{
|
||||||
if (BaseTreeModel *oldModel = qobject_cast<BaseTreeModel *>(model())) {
|
if (auto oldModel = qobject_cast<BaseTreeModel *>(model())) {
|
||||||
disconnect(oldModel, &BaseTreeModel::requestExpansion, this, &BaseTreeView::expand);
|
disconnect(oldModel, &BaseTreeModel::requestExpansion, this, &BaseTreeView::expand);
|
||||||
disconnect(oldModel, &BaseTreeModel::requestCollapse, this, &BaseTreeView::collapse);
|
disconnect(oldModel, &BaseTreeModel::requestCollapse, this, &BaseTreeView::collapse);
|
||||||
}
|
}
|
||||||
@@ -291,7 +291,7 @@ void BaseTreeView::setModel(QAbstractItemModel *m)
|
|||||||
TreeView::setModel(m);
|
TreeView::setModel(m);
|
||||||
|
|
||||||
if (m) {
|
if (m) {
|
||||||
if (BaseTreeModel *newModel = qobject_cast<BaseTreeModel *>(m)) {
|
if (auto newModel = qobject_cast<BaseTreeModel *>(m)) {
|
||||||
connect(newModel, &BaseTreeModel::requestExpansion, this, &BaseTreeView::expand);
|
connect(newModel, &BaseTreeModel::requestExpansion, this, &BaseTreeView::expand);
|
||||||
connect(newModel, &BaseTreeModel::requestCollapse, this, &BaseTreeView::collapse);
|
connect(newModel, &BaseTreeModel::requestCollapse, this, &BaseTreeView::collapse);
|
||||||
}
|
}
|
||||||
|
@@ -116,8 +116,8 @@ QList<ChangeSet::EditOp> ChangeSet::operationList() const
|
|||||||
|
|
||||||
void ChangeSet::clear()
|
void ChangeSet::clear()
|
||||||
{
|
{
|
||||||
m_string = 0;
|
m_string = nullptr;
|
||||||
m_cursor = 0;
|
m_cursor = nullptr;
|
||||||
m_operationList.clear();
|
m_operationList.clear();
|
||||||
m_error = false;
|
m_error = false;
|
||||||
}
|
}
|
||||||
@@ -334,14 +334,14 @@ void ChangeSet::apply(QString *s)
|
|||||||
{
|
{
|
||||||
m_string = s;
|
m_string = s;
|
||||||
apply_helper();
|
apply_helper();
|
||||||
m_string = 0;
|
m_string = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChangeSet::apply(QTextCursor *textCursor)
|
void ChangeSet::apply(QTextCursor *textCursor)
|
||||||
{
|
{
|
||||||
m_cursor = textCursor;
|
m_cursor = textCursor;
|
||||||
apply_helper();
|
apply_helper();
|
||||||
m_cursor = 0;
|
m_cursor = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ChangeSet::textAt(int pos, int length)
|
QString ChangeSet::textAt(int pos, int length)
|
||||||
|
@@ -52,7 +52,6 @@ class CheckableMessageBoxPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CheckableMessageBoxPrivate(QDialog *q)
|
CheckableMessageBoxPrivate(QDialog *q)
|
||||||
: clickedButton(0)
|
|
||||||
{
|
{
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
|
|
||||||
@@ -63,7 +62,7 @@ public:
|
|||||||
pixmapLabel->setSizePolicy(sizePolicy);
|
pixmapLabel->setSizePolicy(sizePolicy);
|
||||||
pixmapLabel->setVisible(false);
|
pixmapLabel->setVisible(false);
|
||||||
|
|
||||||
QSpacerItem *pixmapSpacer =
|
auto pixmapSpacer =
|
||||||
new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
messageLabel = new QLabel(q);
|
messageLabel = new QLabel(q);
|
||||||
@@ -72,9 +71,9 @@ public:
|
|||||||
messageLabel->setOpenExternalLinks(true);
|
messageLabel->setOpenExternalLinks(true);
|
||||||
messageLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse);
|
messageLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse);
|
||||||
|
|
||||||
QSpacerItem *checkBoxRightSpacer =
|
auto checkBoxRightSpacer =
|
||||||
new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
QSpacerItem *buttonSpacer =
|
auto buttonSpacer =
|
||||||
new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::Minimum);
|
new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
|
|
||||||
checkBox = new QCheckBox(q);
|
checkBox = new QCheckBox(q);
|
||||||
@@ -84,30 +83,30 @@ public:
|
|||||||
buttonBox->setOrientation(Qt::Horizontal);
|
buttonBox->setOrientation(Qt::Horizontal);
|
||||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout = new QVBoxLayout();
|
auto verticalLayout = new QVBoxLayout();
|
||||||
verticalLayout->addWidget(pixmapLabel);
|
verticalLayout->addWidget(pixmapLabel);
|
||||||
verticalLayout->addItem(pixmapSpacer);
|
verticalLayout->addItem(pixmapSpacer);
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
auto horizontalLayout_2 = new QHBoxLayout();
|
||||||
horizontalLayout_2->addLayout(verticalLayout);
|
horizontalLayout_2->addLayout(verticalLayout);
|
||||||
horizontalLayout_2->addWidget(messageLabel);
|
horizontalLayout_2->addWidget(messageLabel);
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
auto horizontalLayout = new QHBoxLayout();
|
||||||
horizontalLayout->addWidget(checkBox);
|
horizontalLayout->addWidget(checkBox);
|
||||||
horizontalLayout->addItem(checkBoxRightSpacer);
|
horizontalLayout->addItem(checkBoxRightSpacer);
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout_2 = new QVBoxLayout(q);
|
auto verticalLayout_2 = new QVBoxLayout(q);
|
||||||
verticalLayout_2->addLayout(horizontalLayout_2);
|
verticalLayout_2->addLayout(horizontalLayout_2);
|
||||||
verticalLayout_2->addLayout(horizontalLayout);
|
verticalLayout_2->addLayout(horizontalLayout);
|
||||||
verticalLayout_2->addItem(buttonSpacer);
|
verticalLayout_2->addItem(buttonSpacer);
|
||||||
verticalLayout_2->addWidget(buttonBox);
|
verticalLayout_2->addWidget(buttonBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
QLabel *pixmapLabel;
|
QLabel *pixmapLabel = nullptr;
|
||||||
QLabel *messageLabel;
|
QLabel *messageLabel = nullptr;
|
||||||
QCheckBox *checkBox;
|
QCheckBox *checkBox = nullptr;
|
||||||
QDialogButtonBox *buttonBox;
|
QDialogButtonBox *buttonBox = nullptr;
|
||||||
QAbstractButton *clickedButton;
|
QAbstractButton *clickedButton = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
CheckableMessageBox::CheckableMessageBox(QWidget *parent) :
|
CheckableMessageBox::CheckableMessageBox(QWidget *parent) :
|
||||||
@@ -215,7 +214,7 @@ QPushButton *CheckableMessageBox::addButton(const QString &text, QDialogButtonBo
|
|||||||
QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
|
QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
|
||||||
{
|
{
|
||||||
foreach (QAbstractButton *b, d->buttonBox->buttons())
|
foreach (QAbstractButton *b, d->buttonBox->buttons())
|
||||||
if (QPushButton *pb = qobject_cast<QPushButton *>(b))
|
if (auto *pb = qobject_cast<QPushButton *>(b))
|
||||||
if (pb->isDefault())
|
if (pb->isDefault())
|
||||||
return d->buttonBox->standardButton(pb);
|
return d->buttonBox->standardButton(pb);
|
||||||
return QDialogButtonBox::NoButton;
|
return QDialogButtonBox::NoButton;
|
||||||
|
@@ -45,17 +45,14 @@ struct ClassNameValidatingLineEditPrivate {
|
|||||||
|
|
||||||
QRegExp m_nameRegexp;
|
QRegExp m_nameRegexp;
|
||||||
QString m_namespaceDelimiter;
|
QString m_namespaceDelimiter;
|
||||||
bool m_namespacesEnabled;
|
bool m_namespacesEnabled = false;
|
||||||
bool m_lowerCaseFileName;
|
bool m_lowerCaseFileName = true;
|
||||||
bool m_forceFirstCapitalLetter;
|
bool m_forceFirstCapitalLetter = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Match something like "Namespace1::Namespace2::ClassName".
|
// Match something like "Namespace1::Namespace2::ClassName".
|
||||||
ClassNameValidatingLineEditPrivate:: ClassNameValidatingLineEditPrivate() :
|
ClassNameValidatingLineEditPrivate:: ClassNameValidatingLineEditPrivate() :
|
||||||
m_namespaceDelimiter(QLatin1String("::")),
|
m_namespaceDelimiter(QLatin1String("::"))
|
||||||
m_namespacesEnabled(false),
|
|
||||||
m_lowerCaseFileName(true),
|
|
||||||
m_forceFirstCapitalLetter(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ bool CompletingLineEdit::event(QEvent *e)
|
|||||||
if (e->type() == QEvent::ShortcutOverride) {
|
if (e->type() == QEvent::ShortcutOverride) {
|
||||||
if (QCompleter *comp = completer()) {
|
if (QCompleter *comp = completer()) {
|
||||||
if (comp->popup() && comp->popup()->isVisible()) {
|
if (comp->popup() && comp->popup()->isVisible()) {
|
||||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
auto ke = static_cast<QKeyEvent *>(e);
|
||||||
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||||
ke->accept();
|
ke->accept();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -55,17 +55,15 @@ public:
|
|||||||
|
|
||||||
bool acceptsCompletionPrefix(const QString &prefix) const;
|
bool acceptsCompletionPrefix(const QString &prefix) const;
|
||||||
|
|
||||||
QCompleter *m_completer;
|
QCompleter *m_completer = nullptr;
|
||||||
int m_completionLengthThreshold;
|
int m_completionLengthThreshold = 3;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CompletingTextEdit *m_backPointer;
|
CompletingTextEdit *m_backPointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
CompletingTextEditPrivate::CompletingTextEditPrivate(CompletingTextEdit *textEdit)
|
CompletingTextEditPrivate::CompletingTextEditPrivate(CompletingTextEdit *textEdit)
|
||||||
: m_completer(0),
|
: m_backPointer(textEdit)
|
||||||
m_completionLengthThreshold(3),
|
|
||||||
m_backPointer(textEdit)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +105,7 @@ CompletingTextEdit::~CompletingTextEdit()
|
|||||||
void CompletingTextEdit::setCompleter(QCompleter *c)
|
void CompletingTextEdit::setCompleter(QCompleter *c)
|
||||||
{
|
{
|
||||||
if (completer())
|
if (completer())
|
||||||
disconnect(completer(), 0, this, 0);
|
disconnect(completer(), nullptr, this, nullptr);
|
||||||
|
|
||||||
d->m_completer = c;
|
d->m_completer = c;
|
||||||
|
|
||||||
@@ -153,12 +151,12 @@ void CompletingTextEdit::keyPressEvent(QKeyEvent *e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool isShortcut = ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_E); // CTRL+E
|
const bool isShortcut = ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_E); // CTRL+E
|
||||||
if (completer() == 0 || !isShortcut) // do not process the shortcut when we have a completer
|
if (completer() == nullptr || !isShortcut) // do not process the shortcut when we have a completer
|
||||||
QTextEdit::keyPressEvent(e);
|
QTextEdit::keyPressEvent(e);
|
||||||
|
|
||||||
const bool ctrlOrShift = e->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier);
|
const bool ctrlOrShift = e->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier);
|
||||||
const QString text = e->text();
|
const QString text = e->text();
|
||||||
if (completer() == 0 || (ctrlOrShift && text.isEmpty()))
|
if (completer() == nullptr || (ctrlOrShift && text.isEmpty()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const bool hasModifier = (e->modifiers() != Qt::NoModifier) && !ctrlOrShift;
|
const bool hasModifier = (e->modifiers() != Qt::NoModifier) && !ctrlOrShift;
|
||||||
@@ -183,7 +181,7 @@ void CompletingTextEdit::keyPressEvent(QKeyEvent *e)
|
|||||||
|
|
||||||
void CompletingTextEdit::focusInEvent(QFocusEvent *e)
|
void CompletingTextEdit::focusInEvent(QFocusEvent *e)
|
||||||
{
|
{
|
||||||
if (completer() != 0)
|
if (completer() != nullptr)
|
||||||
completer()->setWidget(this);
|
completer()->setWidget(this);
|
||||||
QTextEdit::focusInEvent(e);
|
QTextEdit::focusInEvent(e);
|
||||||
}
|
}
|
||||||
@@ -193,7 +191,7 @@ bool CompletingTextEdit::event(QEvent *e)
|
|||||||
// workaround for QTCREATORBUG-9453
|
// workaround for QTCREATORBUG-9453
|
||||||
if (e->type() == QEvent::ShortcutOverride && completer()
|
if (e->type() == QEvent::ShortcutOverride && completer()
|
||||||
&& completer()->popup() && completer()->popup()->isVisible()) {
|
&& completer()->popup() && completer()->popup()->isVisible()) {
|
||||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
auto ke = static_cast<QKeyEvent *>(e);
|
||||||
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||||
ke->accept();
|
ke->accept();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -39,14 +39,14 @@ namespace Utils {
|
|||||||
ConsoleProcessPrivate::ConsoleProcessPrivate() :
|
ConsoleProcessPrivate::ConsoleProcessPrivate() :
|
||||||
m_mode(ConsoleProcess::Run),
|
m_mode(ConsoleProcess::Run),
|
||||||
m_appPid(0),
|
m_appPid(0),
|
||||||
m_stubSocket(0),
|
m_stubSocket(nullptr),
|
||||||
m_tempFile(0),
|
m_tempFile(nullptr),
|
||||||
m_error(QProcess::UnknownError),
|
m_error(QProcess::UnknownError),
|
||||||
m_appMainThreadId(0),
|
m_appMainThreadId(0),
|
||||||
m_pid(0),
|
m_pid(nullptr),
|
||||||
m_hInferior(NULL),
|
m_hInferior(NULL),
|
||||||
inferiorFinishedNotifier(0),
|
inferiorFinishedNotifier(nullptr),
|
||||||
processFinishedNotifier(0)
|
processFinishedNotifier(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
|
|||||||
stubServerShutdown();
|
stubServerShutdown();
|
||||||
emitError(QProcess::FailedToStart, msgCannotCreateTempFile(d->m_tempFile->errorString()));
|
emitError(QProcess::FailedToStart, msgCannotCreateTempFile(d->m_tempFile->errorString()));
|
||||||
delete d->m_tempFile;
|
delete d->m_tempFile;
|
||||||
d->m_tempFile = 0;
|
d->m_tempFile = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QTextStream out(d->m_tempFile);
|
QTextStream out(d->m_tempFile);
|
||||||
@@ -109,7 +109,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
|
|||||||
stubServerShutdown();
|
stubServerShutdown();
|
||||||
emitError(QProcess::FailedToStart, msgCannotWriteTempFile());
|
emitError(QProcess::FailedToStart, msgCannotWriteTempFile());
|
||||||
delete d->m_tempFile;
|
delete d->m_tempFile;
|
||||||
d->m_tempFile = 0;
|
d->m_tempFile = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,9 +143,9 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
|
|||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
delete d->m_pid;
|
delete d->m_pid;
|
||||||
d->m_pid = 0;
|
d->m_pid = nullptr;
|
||||||
delete d->m_tempFile;
|
delete d->m_tempFile;
|
||||||
d->m_tempFile = 0;
|
d->m_tempFile = nullptr;
|
||||||
stubServerShutdown();
|
stubServerShutdown();
|
||||||
emitError(QProcess::FailedToStart, tr("The process \"%1\" could not be started: %2").arg(cmdLine, winErrorMessage(GetLastError())));
|
emitError(QProcess::FailedToStart, tr("The process \"%1\" could not be started: %2").arg(cmdLine, winErrorMessage(GetLastError())));
|
||||||
return false;
|
return false;
|
||||||
@@ -183,7 +183,7 @@ void ConsoleProcess::stop()
|
|||||||
|
|
||||||
bool ConsoleProcess::isRunning() const
|
bool ConsoleProcess::isRunning() const
|
||||||
{
|
{
|
||||||
return d->m_pid != 0;
|
return d->m_pid != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ConsoleProcess::stubServerListen()
|
QString ConsoleProcess::stubServerListen()
|
||||||
@@ -198,7 +198,7 @@ QString ConsoleProcess::stubServerListen()
|
|||||||
void ConsoleProcess::stubServerShutdown()
|
void ConsoleProcess::stubServerShutdown()
|
||||||
{
|
{
|
||||||
delete d->m_stubSocket;
|
delete d->m_stubSocket;
|
||||||
d->m_stubSocket = 0;
|
d->m_stubSocket = nullptr;
|
||||||
if (d->m_stubServer.isListening())
|
if (d->m_stubServer.isListening())
|
||||||
d->m_stubServer.close();
|
d->m_stubServer.close();
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ void ConsoleProcess::readStubOutput()
|
|||||||
} else if (out.startsWith("pid ")) {
|
} else if (out.startsWith("pid ")) {
|
||||||
// Will not need it any more
|
// Will not need it any more
|
||||||
delete d->m_tempFile;
|
delete d->m_tempFile;
|
||||||
d->m_tempFile = 0;
|
d->m_tempFile = nullptr;
|
||||||
d->m_appPid = out.mid(4).toLongLong();
|
d->m_appPid = out.mid(4).toLongLong();
|
||||||
|
|
||||||
d->m_hInferior = OpenProcess(
|
d->m_hInferior = OpenProcess(
|
||||||
@@ -251,7 +251,7 @@ void ConsoleProcess::readStubOutput()
|
|||||||
void ConsoleProcess::cleanupInferior()
|
void ConsoleProcess::cleanupInferior()
|
||||||
{
|
{
|
||||||
delete d->inferiorFinishedNotifier;
|
delete d->inferiorFinishedNotifier;
|
||||||
d->inferiorFinishedNotifier = 0;
|
d->inferiorFinishedNotifier = nullptr;
|
||||||
CloseHandle(d->m_hInferior);
|
CloseHandle(d->m_hInferior);
|
||||||
d->m_hInferior = NULL;
|
d->m_hInferior = NULL;
|
||||||
d->m_appPid = 0;
|
d->m_appPid = 0;
|
||||||
@@ -274,13 +274,13 @@ void ConsoleProcess::cleanupStub()
|
|||||||
{
|
{
|
||||||
stubServerShutdown();
|
stubServerShutdown();
|
||||||
delete d->processFinishedNotifier;
|
delete d->processFinishedNotifier;
|
||||||
d->processFinishedNotifier = 0;
|
d->processFinishedNotifier = nullptr;
|
||||||
CloseHandle(d->m_pid->hThread);
|
CloseHandle(d->m_pid->hThread);
|
||||||
CloseHandle(d->m_pid->hProcess);
|
CloseHandle(d->m_pid->hProcess);
|
||||||
delete d->m_pid;
|
delete d->m_pid;
|
||||||
d->m_pid = 0;
|
d->m_pid = nullptr;
|
||||||
delete d->m_tempFile;
|
delete d->m_tempFile;
|
||||||
d->m_tempFile = 0;
|
d->m_tempFile = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleProcess::stubExited()
|
void ConsoleProcess::stubExited()
|
||||||
|
@@ -100,7 +100,7 @@ DetailsWidgetPrivate::DetailsWidgetPrivate(QWidget *parent) :
|
|||||||
m_hovered(false),
|
m_hovered(false),
|
||||||
m_useCheckBox(false)
|
m_useCheckBox(false)
|
||||||
{
|
{
|
||||||
QHBoxLayout *summaryLayout = new QHBoxLayout;
|
auto summaryLayout = new QHBoxLayout;
|
||||||
summaryLayout->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
|
summaryLayout->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
|
||||||
summaryLayout->setSpacing(0);
|
summaryLayout->setSpacing(0);
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ void DetailsWidgetPrivate::updateControls()
|
|||||||
for (QWidget *w = q; w; w = w->parentWidget()) {
|
for (QWidget *w = q; w; w = w->parentWidget()) {
|
||||||
if (w->layout())
|
if (w->layout())
|
||||||
w->layout()->activate();
|
w->layout()->activate();
|
||||||
if (QScrollArea *area = qobject_cast<QScrollArea*>(w)) {
|
if (auto area = qobject_cast<QScrollArea*>(w)) {
|
||||||
QEvent e(QEvent::LayoutRequest);
|
QEvent e(QEvent::LayoutRequest);
|
||||||
QCoreApplication::sendEvent(area, &e);
|
QCoreApplication::sendEvent(area, &e);
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,7 @@ void DetailsWidget::setSummaryFontBold(bool b)
|
|||||||
|
|
||||||
void DetailsWidget::setIcon(const QIcon &icon)
|
void DetailsWidget::setIcon(const QIcon &icon)
|
||||||
{
|
{
|
||||||
int iconSize = style()->pixelMetric(QStyle::PM_ButtonIconSize, 0, this);
|
int iconSize = style()->pixelMetric(QStyle::PM_ButtonIconSize, nullptr, this);
|
||||||
d->m_summaryLabelIcon->setFixedWidth(icon.isNull() ? 0 : iconSize);
|
d->m_summaryLabelIcon->setFixedWidth(icon.isNull() ? 0 : iconSize);
|
||||||
d->m_summaryLabelIcon->setPixmap(icon.pixmap(iconSize, iconSize));
|
d->m_summaryLabelIcon->setPixmap(icon.pixmap(iconSize, iconSize));
|
||||||
d->m_summaryCheckBox->setIcon(icon);
|
d->m_summaryCheckBox->setIcon(icon);
|
||||||
@@ -347,10 +347,10 @@ QWidget *DetailsWidget::widget() const
|
|||||||
QWidget *DetailsWidget::takeWidget()
|
QWidget *DetailsWidget::takeWidget()
|
||||||
{
|
{
|
||||||
QWidget *widget = d->m_widget;
|
QWidget *widget = d->m_widget;
|
||||||
d->m_widget = 0;
|
d->m_widget = nullptr;
|
||||||
d->m_grid->removeWidget(widget);
|
d->m_grid->removeWidget(widget);
|
||||||
if (widget)
|
if (widget)
|
||||||
widget->setParent(0);
|
widget->setParent(nullptr);
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,10 +39,10 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
static bool isFileDrop(const QMimeData *d, QList<DropSupport::FileSpec> *files = 0)
|
static bool isFileDrop(const QMimeData *d, QList<DropSupport::FileSpec> *files = nullptr)
|
||||||
{
|
{
|
||||||
// internal drop
|
// internal drop
|
||||||
if (const DropMimeData *internalData = qobject_cast<const DropMimeData *>(d)) {
|
if (const auto internalData = qobject_cast<const DropMimeData *>(d)) {
|
||||||
if (files)
|
if (files)
|
||||||
*files = internalData->files();
|
*files = internalData->files();
|
||||||
return !internalData->files().isEmpty();
|
return !internalData->files().isEmpty();
|
||||||
@@ -99,7 +99,7 @@ bool DropSupport::isFileDrop(QDropEvent *event) const
|
|||||||
|
|
||||||
bool DropSupport::isValueDrop(QDropEvent *event) const
|
bool DropSupport::isValueDrop(QDropEvent *event) const
|
||||||
{
|
{
|
||||||
if (const DropMimeData *internalData = qobject_cast<const DropMimeData *>(event->mimeData())) {
|
if (const auto internalData = qobject_cast<const DropMimeData *>(event->mimeData())) {
|
||||||
return !internalData->values().isEmpty();
|
return !internalData->values().isEmpty();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -123,7 +123,7 @@ bool DropSupport::eventFilter(QObject *obj, QEvent *event)
|
|||||||
bool accepted = false;
|
bool accepted = false;
|
||||||
auto de = static_cast<QDropEvent *>(event);
|
auto de = static_cast<QDropEvent *>(event);
|
||||||
if (!m_filterFunction || m_filterFunction(de, this)) {
|
if (!m_filterFunction || m_filterFunction(de, this)) {
|
||||||
const DropMimeData *fileDropMimeData = qobject_cast<const DropMimeData *>(de->mimeData());
|
const auto fileDropMimeData = qobject_cast<const DropMimeData *>(de->mimeData());
|
||||||
QList<FileSpec> tempFiles;
|
QList<FileSpec> tempFiles;
|
||||||
if (Utils::isFileDrop(de->mimeData(), &tempFiles)) {
|
if (Utils::isFileDrop(de->mimeData(), &tempFiles)) {
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@@ -108,7 +108,7 @@ bool ElfMapper::map()
|
|||||||
|
|
||||||
fdlen = file.size();
|
fdlen = file.size();
|
||||||
ustart = file.map(0, fdlen);
|
ustart = file.map(0, fdlen);
|
||||||
if (ustart == 0) {
|
if (ustart == nullptr) {
|
||||||
// Try reading the data into memory instead.
|
// Try reading the data into memory instead.
|
||||||
try {
|
try {
|
||||||
raw = file.readAll();
|
raw = file.readAll();
|
||||||
@@ -221,7 +221,7 @@ ElfReader::Result ElfReader::readIt()
|
|||||||
QTC_CHECK(data == mapper.ustart + (is64Bit ? 64 : 52));
|
QTC_CHECK(data == mapper.ustart + (is64Bit ? 64 : 52));
|
||||||
|
|
||||||
if (quint64(e_shnum) * e_shentsize > fdlen) {
|
if (quint64(e_shnum) * e_shentsize > fdlen) {
|
||||||
const QString reason = tr("announced %n sections, each %1 bytes, exceed file size", 0, e_shnum)
|
const QString reason = tr("announced %n sections, each %1 bytes, exceed file size", nullptr, e_shnum)
|
||||||
.arg(e_shentsize);
|
.arg(e_shentsize);
|
||||||
m_errorString = msgInvalidElfObject(m_binary, reason);
|
m_errorString = msgInvalidElfObject(m_binary, reason);
|
||||||
return Corrupt;
|
return Corrupt;
|
||||||
|
@@ -91,7 +91,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *)
|
void paintEvent(QPaintEvent *) override
|
||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
p.setRenderHint(QPainter::Antialiasing);
|
p.setRenderHint(QPainter::Antialiasing);
|
||||||
|
@@ -52,9 +52,9 @@ FakeToolTip::FakeToolTip(QWidget *parent) :
|
|||||||
p.setColor(QPalette::Inactive, QPalette::ButtonText, toolTipTextColor);
|
p.setColor(QPalette::Inactive, QPalette::ButtonText, toolTipTextColor);
|
||||||
setPalette(p);
|
setPalette(p);
|
||||||
|
|
||||||
const int margin = 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this);
|
const int margin = 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, nullptr, this);
|
||||||
setContentsMargins(margin + 1, margin, margin, margin);
|
setContentsMargins(margin + 1, margin, margin, margin);
|
||||||
setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
|
setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, nullptr, this) / 255.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeToolTip::paintEvent(QPaintEvent *)
|
void FakeToolTip::paintEvent(QPaintEvent *)
|
||||||
|
@@ -89,7 +89,7 @@ public:
|
|||||||
|
|
||||||
FancyLineEdit *m_lineEdit;
|
FancyLineEdit *m_lineEdit;
|
||||||
IconButton *m_iconbutton[2];
|
IconButton *m_iconbutton[2];
|
||||||
HistoryCompleter *m_historyCompleter = 0;
|
HistoryCompleter *m_historyCompleter = nullptr;
|
||||||
FancyLineEdit::ValidationFunction m_validationFunction = &FancyLineEdit::validateWithValidator;
|
FancyLineEdit::ValidationFunction m_validationFunction = &FancyLineEdit::validateWithValidator;
|
||||||
QString m_oldText;
|
QString m_oldText;
|
||||||
QMenu *m_menu[2];
|
QMenu *m_menu[2];
|
||||||
@@ -119,7 +119,7 @@ FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) :
|
|||||||
m_iconbutton[i]->hide();
|
m_iconbutton[i]->hide();
|
||||||
m_iconbutton[i]->setAutoHide(false);
|
m_iconbutton[i]->setAutoHide(false);
|
||||||
|
|
||||||
m_menu[i] = 0;
|
m_menu[i] = nullptr;
|
||||||
|
|
||||||
m_menuTabFocusTrigger[i] = false;
|
m_menuTabFocusTrigger[i] = false;
|
||||||
m_iconEnabled[i] = false;
|
m_iconEnabled[i] = false;
|
||||||
@@ -194,7 +194,7 @@ QAbstractButton *FancyLineEdit::button(FancyLineEdit::Side side) const
|
|||||||
|
|
||||||
void FancyLineEdit::iconClicked()
|
void FancyLineEdit::iconClicked()
|
||||||
{
|
{
|
||||||
IconButton *button = qobject_cast<IconButton *>(sender());
|
auto button = qobject_cast<IconButton *>(sender());
|
||||||
int index = -1;
|
int index = -1;
|
||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
if (d->m_iconbutton[i] == button)
|
if (d->m_iconbutton[i] == button)
|
||||||
|
@@ -73,9 +73,9 @@ class DockWidget : public QDockWidget
|
|||||||
public:
|
public:
|
||||||
DockWidget(QWidget *inner, FancyMainWindow *parent, bool immutable = false);
|
DockWidget(QWidget *inner, FancyMainWindow *parent, bool immutable = false);
|
||||||
|
|
||||||
bool eventFilter(QObject *, QEvent *event);
|
bool eventFilter(QObject *, QEvent *event) override;
|
||||||
void enterEvent(QEvent *event);
|
void enterEvent(QEvent *event) override;
|
||||||
void leaveEvent(QEvent *event);
|
void leaveEvent(QEvent *event) override;
|
||||||
void handleMouseTimeout();
|
void handleMouseTimeout();
|
||||||
void handleToplevelChanged(bool floating);
|
void handleToplevelChanged(bool floating);
|
||||||
|
|
||||||
@@ -98,13 +98,13 @@ public:
|
|||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize sizeHint() const
|
QSize sizeHint() const override
|
||||||
{
|
{
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
|
|
||||||
int size = 2*style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this);
|
int size = 2*style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, nullptr, this);
|
||||||
if (!icon().isNull()) {
|
if (!icon().isNull()) {
|
||||||
int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
|
int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
|
||||||
QSize sz = icon().actualSize(QSize(iconSize, iconSize));
|
QSize sz = icon().actualSize(QSize(iconSize, iconSize));
|
||||||
size += qMax(sz.width(), sz.height());
|
size += qMax(sz.width(), sz.height());
|
||||||
}
|
}
|
||||||
@@ -112,23 +112,23 @@ public:
|
|||||||
return QSize(size, size);
|
return QSize(size, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize minimumSizeHint() const { return sizeHint(); }
|
QSize minimumSizeHint() const override { return sizeHint(); }
|
||||||
|
|
||||||
void enterEvent(QEvent *event)
|
void enterEvent(QEvent *event) override
|
||||||
{
|
{
|
||||||
if (isEnabled())
|
if (isEnabled())
|
||||||
update();
|
update();
|
||||||
QAbstractButton::enterEvent(event);
|
QAbstractButton::enterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void leaveEvent(QEvent *event)
|
void leaveEvent(QEvent *event) override
|
||||||
{
|
{
|
||||||
if (isEnabled())
|
if (isEnabled())
|
||||||
update();
|
update();
|
||||||
QAbstractButton::leaveEvent(event);
|
QAbstractButton::leaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
void DockWidgetTitleButton::paintEvent(QPaintEvent *)
|
void DockWidgetTitleButton::paintEvent(QPaintEvent *)
|
||||||
@@ -139,11 +139,11 @@ void DockWidgetTitleButton::paintEvent(QPaintEvent *)
|
|||||||
opt.init(this);
|
opt.init(this);
|
||||||
opt.state |= QStyle::State_AutoRaise;
|
opt.state |= QStyle::State_AutoRaise;
|
||||||
opt.icon = icon();
|
opt.icon = icon();
|
||||||
opt.subControls = 0;
|
opt.subControls = nullptr;
|
||||||
opt.activeSubControls = 0;
|
opt.activeSubControls = nullptr;
|
||||||
opt.features = QStyleOptionToolButton::None;
|
opt.features = QStyleOptionToolButton::None;
|
||||||
opt.arrowType = Qt::NoArrow;
|
opt.arrowType = Qt::NoArrow;
|
||||||
int size = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
|
int size = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
|
||||||
opt.iconSize = QSize(size, size);
|
opt.iconSize = QSize(size, size);
|
||||||
style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &p, this);
|
style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &p, this);
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ public:
|
|||||||
setProperty("managed_titlebar", 1);
|
setProperty("managed_titlebar", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void enterEvent(QEvent *event)
|
void enterEvent(QEvent *event) override
|
||||||
{
|
{
|
||||||
setActive(true);
|
setActive(true);
|
||||||
QWidget::enterEvent(event);
|
QWidget::enterEvent(event);
|
||||||
@@ -219,13 +219,13 @@ public:
|
|||||||
return m_active || !q->q->autoHideTitleBars();
|
return m_active || !q->q->autoHideTitleBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize sizeHint() const
|
QSize sizeHint() const override
|
||||||
{
|
{
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
return isClickable() ? m_maximumActiveSize : m_maximumInactiveSize;
|
return isClickable() ? m_maximumActiveSize : m_maximumInactiveSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize minimumSizeHint() const
|
QSize minimumSizeHint() const override
|
||||||
{
|
{
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
return isClickable() ? m_minimumActiveSize : m_minimumInactiveSize;
|
return isClickable() ? m_minimumActiveSize : m_minimumInactiveSize;
|
||||||
@@ -292,7 +292,7 @@ DockWidget::DockWidget(QWidget *inner, FancyMainWindow *parent, bool immutable)
|
|||||||
bool DockWidget::eventFilter(QObject *, QEvent *event)
|
bool DockWidget::eventFilter(QObject *, QEvent *event)
|
||||||
{
|
{
|
||||||
if (!m_immutable && event->type() == QEvent::MouseMove && q->autoHideTitleBars()) {
|
if (!m_immutable && event->type() == QEvent::MouseMove && q->autoHideTitleBars()) {
|
||||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
auto me = static_cast<QMouseEvent *>(event);
|
||||||
int y = me->pos().y();
|
int y = me->pos().y();
|
||||||
int x = me->pos().x();
|
int x = me->pos().x();
|
||||||
int h = qMin(8, m_titleBar->m_floatButton->height());
|
int h = qMin(8, m_titleBar->m_floatButton->height());
|
||||||
@@ -350,11 +350,11 @@ void DockWidget::handleToplevelChanged(bool floating)
|
|||||||
FancyMainWindowPrivate::FancyMainWindowPrivate(FancyMainWindow *parent) :
|
FancyMainWindowPrivate::FancyMainWindowPrivate(FancyMainWindow *parent) :
|
||||||
q(parent),
|
q(parent),
|
||||||
m_handleDockVisibilityChanges(true),
|
m_handleDockVisibilityChanges(true),
|
||||||
m_showCentralWidget(FancyMainWindow::tr("Central Widget"), 0),
|
m_showCentralWidget(FancyMainWindow::tr("Central Widget"), nullptr),
|
||||||
m_menuSeparator1(0),
|
m_menuSeparator1(nullptr),
|
||||||
m_menuSeparator2(0),
|
m_menuSeparator2(nullptr),
|
||||||
m_resetLayoutAction(FancyMainWindow::tr("Reset to Default Layout"), 0),
|
m_resetLayoutAction(FancyMainWindow::tr("Reset to Default Layout"), nullptr),
|
||||||
m_autoHideTitleBars(FancyMainWindow::tr("Automatically Hide View Title Bars"), 0)
|
m_autoHideTitleBars(FancyMainWindow::tr("Automatically Hide View Title Bars"), nullptr)
|
||||||
{
|
{
|
||||||
m_showCentralWidget.setCheckable(true);
|
m_showCentralWidget.setCheckable(true);
|
||||||
m_showCentralWidget.setChecked(true);
|
m_showCentralWidget.setChecked(true);
|
||||||
@@ -391,7 +391,7 @@ FancyMainWindow::~FancyMainWindow()
|
|||||||
|
|
||||||
QDockWidget *FancyMainWindow::addDockForWidget(QWidget *widget, bool immutable)
|
QDockWidget *FancyMainWindow::addDockForWidget(QWidget *widget, bool immutable)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(widget, return 0);
|
QTC_ASSERT(widget, return nullptr);
|
||||||
QTC_CHECK(widget->objectName().size());
|
QTC_CHECK(widget->objectName().size());
|
||||||
QTC_CHECK(widget->windowTitle().size());
|
QTC_CHECK(widget->windowTitle().size());
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ QDockWidget *FancyMainWindow::addDockForWidget(QWidget *widget, bool immutable)
|
|||||||
|
|
||||||
void FancyMainWindow::onDockActionTriggered()
|
void FancyMainWindow::onDockActionTriggered()
|
||||||
{
|
{
|
||||||
QDockWidget *dw = qobject_cast<QDockWidget *>(sender()->parent());
|
auto dw = qobject_cast<QDockWidget *>(sender()->parent());
|
||||||
if (dw) {
|
if (dw) {
|
||||||
if (dw->isVisible())
|
if (dw->isVisible())
|
||||||
dw->raise();
|
dw->raise();
|
||||||
|
@@ -63,9 +63,7 @@ static bool checkPath(const QString &candidate, FileInProjectFinder::FindMode fi
|
|||||||
\endlist
|
\endlist
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FileInProjectFinder::FileInProjectFinder()
|
FileInProjectFinder::FileInProjectFinder() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString stripTrailingSlashes(const QString &path)
|
static QString stripTrailingSlashes(const QString &path)
|
||||||
{
|
{
|
||||||
|
@@ -42,14 +42,14 @@ static inline QString msgCanceled(const QString &searchTerm, int numMatches, int
|
|||||||
{
|
{
|
||||||
return QCoreApplication::translate("Utils::FileSearch",
|
return QCoreApplication::translate("Utils::FileSearch",
|
||||||
"%1: canceled. %n occurrences found in %2 files.",
|
"%1: canceled. %n occurrences found in %2 files.",
|
||||||
0, numMatches).arg(searchTerm).arg(numFilesSearched);
|
nullptr, numMatches).arg(searchTerm).arg(numFilesSearched);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched)
|
static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched)
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Utils::FileSearch",
|
return QCoreApplication::translate("Utils::FileSearch",
|
||||||
"%1: %n occurrences found in %2 files.",
|
"%1: %n occurrences found in %2 files.",
|
||||||
0, numMatches).arg(searchTerm).arg(numFilesSearched);
|
nullptr, numMatches).arg(searchTerm).arg(numFilesSearched);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -301,7 +301,7 @@ struct SearchState
|
|||||||
{
|
{
|
||||||
SearchState(const QString &term, FileIterator *iterator) : searchTerm(term), files(iterator) {}
|
SearchState(const QString &term, FileIterator *iterator) : searchTerm(term), files(iterator) {}
|
||||||
QString searchTerm;
|
QString searchTerm;
|
||||||
FileIterator *files = 0;
|
FileIterator *files = nullptr;
|
||||||
FileSearchResultList cachedResults;
|
FileSearchResultList cachedResults;
|
||||||
int numFilesSearched = 0;
|
int numFilesSearched = 0;
|
||||||
int numMatches = 0;
|
int numMatches = 0;
|
||||||
@@ -649,7 +649,7 @@ SubDirFileIterator::SubDirFileIterator(const QStringList &directories, const QSt
|
|||||||
: m_filterFiles(filterFilesFunction(filters, exclusionFilters)),
|
: m_filterFiles(filterFilesFunction(filters, exclusionFilters)),
|
||||||
m_progress(0)
|
m_progress(0)
|
||||||
{
|
{
|
||||||
m_encoding = (encoding == 0 ? QTextCodec::codecForLocale() : encoding);
|
m_encoding = (encoding == nullptr ? QTextCodec::codecForLocale() : encoding);
|
||||||
qreal maxPer = qreal(MAX_PROGRESS) / directories.count();
|
qreal maxPer = qreal(MAX_PROGRESS) / directories.count();
|
||||||
foreach (const QString &directoryEntry, directories) {
|
foreach (const QString &directoryEntry, directories) {
|
||||||
if (!directoryEntry.isEmpty()) {
|
if (!directoryEntry.isEmpty()) {
|
||||||
|
@@ -87,32 +87,32 @@ class FileSystemWatcherStaticData
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FileSystemWatcherStaticData() :
|
FileSystemWatcherStaticData() :
|
||||||
maxFileOpen(getFileLimit()) , m_objectCount(0), m_watcher(0) {}
|
maxFileOpen(getFileLimit()) {}
|
||||||
|
|
||||||
quint64 maxFileOpen;
|
quint64 maxFileOpen;
|
||||||
int m_objectCount;
|
int m_objectCount = 0;
|
||||||
QHash<QString, int> m_fileCount;
|
QHash<QString, int> m_fileCount;
|
||||||
QHash<QString, int> m_directoryCount;
|
QHash<QString, int> m_directoryCount;
|
||||||
QFileSystemWatcher *m_watcher;
|
QFileSystemWatcher *m_watcher = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QMap<int, FileSystemWatcherStaticData> FileSystemWatcherStaticDataMap;
|
using FileSystemWatcherStaticDataMap = QMap<int, FileSystemWatcherStaticData>;
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(FileSystemWatcherStaticDataMap, fileSystemWatcherStaticDataMap)
|
Q_GLOBAL_STATIC(FileSystemWatcherStaticDataMap, fileSystemWatcherStaticDataMap)
|
||||||
|
|
||||||
class WatchEntry
|
class WatchEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef FileSystemWatcher::WatchMode WatchMode;
|
using WatchMode = FileSystemWatcher::WatchMode;
|
||||||
|
|
||||||
explicit WatchEntry(const QString &file, WatchMode wm) :
|
explicit WatchEntry(const QString &file, WatchMode wm) :
|
||||||
watchMode(wm), modifiedTime(QFileInfo(file).lastModified()) {}
|
watchMode(wm), modifiedTime(QFileInfo(file).lastModified()) {}
|
||||||
|
|
||||||
WatchEntry() : watchMode(FileSystemWatcher::WatchAllChanges) {}
|
WatchEntry() = default;
|
||||||
|
|
||||||
bool trigger(const QString &fileName);
|
bool trigger(const QString &fileName);
|
||||||
|
|
||||||
WatchMode watchMode;
|
WatchMode watchMode = FileSystemWatcher::WatchAllChanges;
|
||||||
QDateTime modifiedTime;
|
QDateTime modifiedTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -131,13 +131,13 @@ bool WatchEntry::trigger(const QString &fileName)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef QHash<QString, WatchEntry> WatchEntryMap;
|
using WatchEntryMap = QHash<QString, WatchEntry>;
|
||||||
typedef WatchEntryMap::iterator WatchEntryMapIterator;
|
using WatchEntryMapIterator = WatchEntryMap::iterator;
|
||||||
|
|
||||||
class FileSystemWatcherPrivate
|
class FileSystemWatcherPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FileSystemWatcherPrivate(int id) : m_id(id), m_staticData(0) {}
|
explicit FileSystemWatcherPrivate(int id) : m_id(id), m_staticData(nullptr) {}
|
||||||
|
|
||||||
WatchEntryMap m_files;
|
WatchEntryMap m_files;
|
||||||
WatchEntryMap m_directories;
|
WatchEntryMap m_directories;
|
||||||
@@ -208,7 +208,7 @@ FileSystemWatcher::~FileSystemWatcher()
|
|||||||
|
|
||||||
if (--(d->m_staticData->m_objectCount) == 0) {
|
if (--(d->m_staticData->m_objectCount) == 0) {
|
||||||
delete d->m_staticData->m_watcher;
|
delete d->m_staticData->m_watcher;
|
||||||
d->m_staticData->m_watcher = 0;
|
d->m_staticData->m_watcher = nullptr;
|
||||||
d->m_staticData->m_fileCount.clear();
|
d->m_staticData->m_fileCount.clear();
|
||||||
d->m_staticData->m_directoryCount.clear();
|
d->m_staticData->m_directoryCount.clear();
|
||||||
if (debug)
|
if (debug)
|
||||||
|
@@ -305,7 +305,7 @@ QString FileUtils::normalizePathName(const QString &name)
|
|||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
const QString nativeSeparatorName(QDir::toNativeSeparators(name));
|
const QString nativeSeparatorName(QDir::toNativeSeparators(name));
|
||||||
const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(nativeSeparatorName.utf16()); // MinGW
|
const auto nameC = reinterpret_cast<LPCTSTR>(nativeSeparatorName.utf16()); // MinGW
|
||||||
PIDLIST_ABSOLUTE file;
|
PIDLIST_ABSOLUTE file;
|
||||||
HRESULT hr = SHParseDisplayName(nameC, NULL, &file, 0, NULL);
|
HRESULT hr = SHParseDisplayName(nameC, NULL, &file, 0, NULL);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
@@ -514,7 +514,7 @@ bool FileSaver::finalize()
|
|||||||
if (!m_isSafe)
|
if (!m_isSafe)
|
||||||
return FileSaverBase::finalize();
|
return FileSaverBase::finalize();
|
||||||
|
|
||||||
SaveFile *sf = static_cast<SaveFile *>(m_file.get());
|
auto sf = static_cast<SaveFile *>(m_file.get());
|
||||||
if (m_hasError) {
|
if (m_hasError) {
|
||||||
if (sf->isOpen())
|
if (sf->isOpen())
|
||||||
sf->rollback();
|
sf->rollback();
|
||||||
@@ -529,7 +529,7 @@ TempFileSaver::TempFileSaver(const QString &templ)
|
|||||||
: m_autoRemove(true)
|
: m_autoRemove(true)
|
||||||
{
|
{
|
||||||
m_file.reset(new QTemporaryFile{});
|
m_file.reset(new QTemporaryFile{});
|
||||||
QTemporaryFile *tempFile = static_cast<QTemporaryFile *>(m_file.get());
|
auto tempFile = static_cast<QTemporaryFile *>(m_file.get());
|
||||||
if (!templ.isEmpty())
|
if (!templ.isEmpty())
|
||||||
tempFile->setFileTemplate(templ);
|
tempFile->setFileTemplate(templ);
|
||||||
tempFile->setAutoRemove(false);
|
tempFile->setAutoRemove(false);
|
||||||
|
@@ -44,16 +44,11 @@ namespace Utils {
|
|||||||
class FileWizardPagePrivate
|
class FileWizardPagePrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FileWizardPagePrivate();
|
FileWizardPagePrivate() = default;
|
||||||
Ui::WizardPage m_ui;
|
Ui::WizardPage m_ui;
|
||||||
bool m_complete;
|
bool m_complete = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
FileWizardPagePrivate::FileWizardPagePrivate() :
|
|
||||||
m_complete(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
FileWizardPage::FileWizardPage(QWidget *parent) :
|
FileWizardPage::FileWizardPage(QWidget *parent) :
|
||||||
WizardPage(parent),
|
WizardPage(parent),
|
||||||
d(new FileWizardPagePrivate)
|
d(new FileWizardPagePrivate)
|
||||||
|
@@ -84,12 +84,12 @@ QLayoutItem *FlowLayout::takeAt(int index)
|
|||||||
if (index >= 0 && index < itemList.size())
|
if (index >= 0 && index < itemList.size())
|
||||||
return itemList.takeAt(index);
|
return itemList.takeAt(index);
|
||||||
else
|
else
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Orientations FlowLayout::expandingDirections() const
|
Qt::Orientations FlowLayout::expandingDirections() const
|
||||||
{
|
{
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlowLayout::hasHeightForWidth() const
|
bool FlowLayout::hasHeightForWidth() const
|
||||||
@@ -167,8 +167,8 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
|
|||||||
if (!parent) {
|
if (!parent) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (parent->isWidgetType()) {
|
} else if (parent->isWidgetType()) {
|
||||||
QWidget *pw = static_cast<QWidget *>(parent);
|
auto pw = static_cast<QWidget *>(parent);
|
||||||
return pw->style()->pixelMetric(pm, 0, pw);
|
return pw->style()->pixelMetric(pm, nullptr, pw);
|
||||||
} else {
|
} else {
|
||||||
return static_cast<QLayout *>(parent)->spacing();
|
return static_cast<QLayout *>(parent)->spacing();
|
||||||
}
|
}
|
||||||
|
@@ -85,9 +85,7 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
Guard::Guard()
|
Guard::Guard() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Guard::~Guard()
|
Guard::~Guard()
|
||||||
{
|
{
|
||||||
|
@@ -57,18 +57,18 @@ bool HeaderViewStretcher::eventFilter(QObject *obj, QEvent *ev)
|
|||||||
{
|
{
|
||||||
if (obj == parent()) {
|
if (obj == parent()) {
|
||||||
if (ev->type() == QEvent::Show) {
|
if (ev->type() == QEvent::Show) {
|
||||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
auto hv = qobject_cast<QHeaderView*>(obj);
|
||||||
for (int i = 0; i < hv->count(); ++i)
|
for (int i = 0; i < hv->count(); ++i)
|
||||||
hv->setSectionResizeMode(i, QHeaderView::Interactive);
|
hv->setSectionResizeMode(i, QHeaderView::Interactive);
|
||||||
} else if (ev->type() == QEvent::Hide) {
|
} else if (ev->type() == QEvent::Hide) {
|
||||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
auto hv = qobject_cast<QHeaderView*>(obj);
|
||||||
for (int i = 0; i < hv->count(); ++i)
|
for (int i = 0; i < hv->count(); ++i)
|
||||||
hv->setSectionResizeMode(i, i == m_columnToStretch
|
hv->setSectionResizeMode(i, i == m_columnToStretch
|
||||||
? QHeaderView::Stretch : QHeaderView::ResizeToContents);
|
? QHeaderView::Stretch : QHeaderView::ResizeToContents);
|
||||||
} else if (ev->type() == QEvent::Resize) {
|
} else if (ev->type() == QEvent::Resize) {
|
||||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
auto hv = qobject_cast<QHeaderView*>(obj);
|
||||||
if (hv->sectionResizeMode(m_columnToStretch) == QHeaderView::Interactive) {
|
if (hv->sectionResizeMode(m_columnToStretch) == QHeaderView::Interactive) {
|
||||||
QResizeEvent *re = static_cast<QResizeEvent*>(ev);
|
auto re = static_cast<QResizeEvent*>(ev);
|
||||||
int diff = re->size().width() - re->oldSize().width() ;
|
int diff = re->size().width() - re->oldSize().width() ;
|
||||||
hv->resizeSection(m_columnToStretch, qMax(32, hv->sectionSize(m_columnToStretch) + diff));
|
hv->resizeSection(m_columnToStretch, qMax(32, hv->sectionSize(m_columnToStretch) + diff));
|
||||||
}
|
}
|
||||||
|
@@ -135,7 +135,7 @@ int HighlightingItemDelegate::drawLineNumber(QPainter *painter, const QStyleOpti
|
|||||||
opt.palette.setColor(cg, QPalette::Text, Qt::darkGray);
|
opt.palette.setColor(cg, QPalette::Text, Qt::darkGray);
|
||||||
|
|
||||||
const QStyle *style = QApplication::style();
|
const QStyle *style = QApplication::style();
|
||||||
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
|
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, nullptr) + 1;
|
||||||
|
|
||||||
const QRect rowRect
|
const QRect rowRect
|
||||||
= lineNumberAreaRect.adjusted(-textMargin, 0,
|
= lineNumberAreaRect.adjusted(-textMargin, 0,
|
||||||
@@ -263,7 +263,7 @@ void HighlightingItemDelegate::drawDisplay(QPainter *painter,
|
|||||||
|
|
||||||
const QWidget *widget = option.widget;
|
const QWidget *widget = option.widget;
|
||||||
QStyle *style = widget ? widget->style() : QApplication::style();
|
QStyle *style = widget ? widget->style() : QApplication::style();
|
||||||
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1;
|
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, widget) + 1;
|
||||||
QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding
|
QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding
|
||||||
const bool wrapText = opt.features & QStyleOptionViewItem::WrapText;
|
const bool wrapText = opt.features & QStyleOptionViewItem::WrapText;
|
||||||
QTextOption textOption;
|
QTextOption textOption;
|
||||||
|
@@ -41,14 +41,14 @@
|
|||||||
namespace Utils {
|
namespace Utils {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static QSettings *theSettings = 0;
|
static QSettings *theSettings = nullptr;
|
||||||
|
|
||||||
class HistoryCompleterPrivate : public QAbstractListModel
|
class HistoryCompleterPrivate : public QAbstractListModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
|
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||||
|
|
||||||
void clearHistory();
|
void clearHistory();
|
||||||
void addEntry(const QString &str);
|
void addEntry(const QString &str);
|
||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
, icon(Icons::EDIT_CLEAR.icon())
|
, icon(Icons::EDIT_CLEAR.icon())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
||||||
{
|
{
|
||||||
// from QHistoryCompleter
|
// from QHistoryCompleter
|
||||||
QStyleOptionViewItem optCopy = option;
|
QStyleOptionViewItem optCopy = option;
|
||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void mousePressEvent(QMouseEvent *event)
|
void mousePressEvent(QMouseEvent *event) override
|
||||||
{
|
{
|
||||||
const QSize clearButtonSize = delegate->clearIconSize;
|
const QSize clearButtonSize = delegate->clearIconSize;
|
||||||
if (clearButtonSize.isValid()) {
|
if (clearButtonSize.isValid()) {
|
||||||
|
@@ -47,10 +47,10 @@ static QPixmap maskToColorAndAlpha(const QPixmap &mask, const QColor &color)
|
|||||||
{
|
{
|
||||||
QImage result(mask.toImage().convertToFormat(QImage::Format_ARGB32));
|
QImage result(mask.toImage().convertToFormat(QImage::Format_ARGB32));
|
||||||
result.setDevicePixelRatio(mask.devicePixelRatio());
|
result.setDevicePixelRatio(mask.devicePixelRatio());
|
||||||
QRgb *bitsStart = reinterpret_cast<QRgb*>(result.bits());
|
auto bitsStart = reinterpret_cast<QRgb*>(result.bits());
|
||||||
const QRgb *bitsEnd = bitsStart + result.width() * result.height();
|
const QRgb *bitsEnd = bitsStart + result.width() * result.height();
|
||||||
const QRgb tint = color.rgb() & 0x00ffffff;
|
const QRgb tint = color.rgb() & 0x00ffffff;
|
||||||
const QRgb alpha = QRgb(color.alpha());
|
const auto alpha = QRgb(color.alpha());
|
||||||
for (QRgb *pixel = bitsStart; pixel < bitsEnd; ++pixel) {
|
for (QRgb *pixel = bitsStart; pixel < bitsEnd; ++pixel) {
|
||||||
QRgb pixelAlpha = (((~*pixel) & 0xff) * alpha) >> 8;
|
QRgb pixelAlpha = (((~*pixel) & 0xff) * alpha) >> 8;
|
||||||
*pixel = (pixelAlpha << 24) | tint;
|
*pixel = (pixelAlpha << 24) | tint;
|
||||||
@@ -58,8 +58,8 @@ static QPixmap maskToColorAndAlpha(const QPixmap &mask, const QColor &color)
|
|||||||
return QPixmap::fromImage(result);
|
return QPixmap::fromImage(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef QPair<QPixmap, QColor> MaskAndColor;
|
using MaskAndColor = QPair<QPixmap, QColor>;
|
||||||
typedef QList<MaskAndColor> MasksAndColors;
|
using MasksAndColors = QList<MaskAndColor>;
|
||||||
static MasksAndColors masksAndColors(const Icon &icon, int dpr)
|
static MasksAndColors masksAndColors(const Icon &icon, int dpr)
|
||||||
{
|
{
|
||||||
MasksAndColors result;
|
MasksAndColors result;
|
||||||
@@ -154,9 +154,7 @@ static QPixmap masksToIcon(const MasksAndColors &masks, const QPixmap &combinedM
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Icon::Icon()
|
Icon::Icon() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Icon::Icon(std::initializer_list<IconMaskAndColor> args, Icon::IconStyleOptions style)
|
Icon::Icon(std::initializer_list<IconMaskAndColor> args, Icon::IconStyleOptions style)
|
||||||
: QVector<IconMaskAndColor>(args)
|
: QVector<IconMaskAndColor>(args)
|
||||||
|
@@ -46,14 +46,13 @@ JsonValue::JsonValue(Kind kind)
|
|||||||
: m_kind(kind)
|
: m_kind(kind)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
JsonValue::~JsonValue()
|
JsonValue::~JsonValue() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
JsonValue *JsonValue::create(const QString &s, JsonMemoryPool *pool)
|
JsonValue *JsonValue::create(const QString &s, JsonMemoryPool *pool)
|
||||||
{
|
{
|
||||||
const QJsonDocument document = QJsonDocument::fromJson(s.toUtf8());
|
const QJsonDocument document = QJsonDocument::fromJson(s.toUtf8());
|
||||||
if (document.isNull())
|
if (document.isNull())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return build(document.toVariant(), pool);
|
return build(document.toVariant(), pool);
|
||||||
}
|
}
|
||||||
@@ -92,14 +91,14 @@ JsonValue *JsonValue::build(const QVariant &variant, JsonMemoryPool *pool)
|
|||||||
switch (variant.type()) {
|
switch (variant.type()) {
|
||||||
|
|
||||||
case QVariant::List: {
|
case QVariant::List: {
|
||||||
JsonArrayValue *newValue = new (pool) JsonArrayValue;
|
auto newValue = new (pool) JsonArrayValue;
|
||||||
foreach (const QVariant &element, variant.toList())
|
foreach (const QVariant &element, variant.toList())
|
||||||
newValue->addElement(build(element, pool));
|
newValue->addElement(build(element, pool));
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
case QVariant::Map: {
|
case QVariant::Map: {
|
||||||
JsonObjectValue *newValue = new (pool) JsonObjectValue;
|
auto newValue = new (pool) JsonObjectValue;
|
||||||
const QVariantMap variantMap = variant.toMap();
|
const QVariantMap variantMap = variant.toMap();
|
||||||
for (QVariantMap::const_iterator it = variantMap.begin(); it != variantMap.end(); ++it)
|
for (QVariantMap::const_iterator it = variantMap.begin(); it != variantMap.end(); ++it)
|
||||||
newValue->addMember(it.key(), build(it.value(), pool));
|
newValue->addMember(it.key(), build(it.value(), pool));
|
||||||
@@ -125,7 +124,7 @@ JsonValue *JsonValue::build(const QVariant &variant, JsonMemoryPool *pool)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -295,7 +294,7 @@ JsonObjectValue *JsonSchema::propertySchema(const QString &property,
|
|||||||
if (JsonObjectValue *base = resolveBase(v))
|
if (JsonObjectValue *base = resolveBase(v))
|
||||||
return propertySchema(property, base);
|
return propertySchema(property, base);
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JsonSchema::hasPropertySchema(const QString &property) const
|
bool JsonSchema::hasPropertySchema(const QString &property) const
|
||||||
@@ -526,14 +525,14 @@ bool JsonSchema::maybeSchemaName(const QString &s)
|
|||||||
|
|
||||||
JsonObjectValue *JsonSchema::rootValue() const
|
JsonObjectValue *JsonSchema::rootValue() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_schemas.isEmpty(), return 0);
|
QTC_ASSERT(!m_schemas.isEmpty(), return nullptr);
|
||||||
|
|
||||||
return m_schemas.first().m_value;
|
return m_schemas.first().m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonObjectValue *JsonSchema::currentValue() const
|
JsonObjectValue *JsonSchema::currentValue() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_schemas.isEmpty(), return 0);
|
QTC_ASSERT(!m_schemas.isEmpty(), return nullptr);
|
||||||
|
|
||||||
return m_schemas.last().m_value;
|
return m_schemas.last().m_value;
|
||||||
}
|
}
|
||||||
@@ -616,14 +615,14 @@ JsonObjectValue *JsonSchema::resolveBase(JsonObjectValue *ov) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonStringValue *JsonSchema::getStringValue(const QString &name, JsonObjectValue *value)
|
JsonStringValue *JsonSchema::getStringValue(const QString &name, JsonObjectValue *value)
|
||||||
{
|
{
|
||||||
JsonValue *v = value->member(name);
|
JsonValue *v = value->member(name);
|
||||||
if (!v)
|
if (!v)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return v->toString();
|
return v->toString();
|
||||||
}
|
}
|
||||||
@@ -632,7 +631,7 @@ JsonObjectValue *JsonSchema::getObjectValue(const QString &name, JsonObjectValue
|
|||||||
{
|
{
|
||||||
JsonValue *v = value->member(name);
|
JsonValue *v = value->member(name);
|
||||||
if (!v)
|
if (!v)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return v->toObject();
|
return v->toObject();
|
||||||
}
|
}
|
||||||
@@ -641,7 +640,7 @@ JsonBooleanValue *JsonSchema::getBooleanValue(const QString &name, JsonObjectVal
|
|||||||
{
|
{
|
||||||
JsonValue *v = value->member(name);
|
JsonValue *v = value->member(name);
|
||||||
if (!v)
|
if (!v)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return v->toBoolean();
|
return v->toBoolean();
|
||||||
}
|
}
|
||||||
@@ -650,7 +649,7 @@ JsonArrayValue *JsonSchema::getArrayValue(const QString &name, JsonObjectValue *
|
|||||||
{
|
{
|
||||||
JsonValue *v = value->member(name);
|
JsonValue *v = value->member(name);
|
||||||
if (!v)
|
if (!v)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return v->toArray();
|
return v->toArray();
|
||||||
}
|
}
|
||||||
@@ -659,7 +658,7 @@ JsonDoubleValue *JsonSchema::getDoubleValue(const QString &name, JsonObjectValue
|
|||||||
{
|
{
|
||||||
JsonValue *v = value->member(name);
|
JsonValue *v = value->member(name);
|
||||||
if (!v)
|
if (!v)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return v->toDouble();
|
return v->toDouble();
|
||||||
}
|
}
|
||||||
@@ -717,7 +716,7 @@ JsonSchema *JsonSchemaManager::schemaByName(const QString &baseName) const
|
|||||||
|
|
||||||
it = m_schemas.find(baseName);
|
it = m_schemas.find(baseName);
|
||||||
if (it == m_schemas.end())
|
if (it == m_schemas.end())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
JsonSchemaData *schemaData = &it.value();
|
JsonSchemaData *schemaData = &it.value();
|
||||||
if (!schemaData->m_schema) {
|
if (!schemaData->m_schema) {
|
||||||
@@ -743,5 +742,5 @@ JsonSchema *JsonSchemaManager::parseSchema(const QString &schemaFileName) const
|
|||||||
return new JsonSchema(json->toObject(), this);
|
return new JsonSchema(json->toObject(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@@ -49,11 +49,9 @@ const char kFileBaseNamePostfix[] = ":FileBaseName";
|
|||||||
class MacroExpanderPrivate : public AbstractMacroExpander
|
class MacroExpanderPrivate : public AbstractMacroExpander
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MacroExpanderPrivate()
|
MacroExpanderPrivate() = default;
|
||||||
: m_accumulating(false), m_aborted(false), m_lockDepth(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool resolveMacro(const QString &name, QString *ret, QSet<AbstractMacroExpander *> &seen)
|
bool resolveMacro(const QString &name, QString *ret, QSet<AbstractMacroExpander *> &seen) override
|
||||||
{
|
{
|
||||||
// Prevent loops:
|
// Prevent loops:
|
||||||
const int count = seen.count();
|
const int count = seen.count();
|
||||||
@@ -113,10 +111,10 @@ public:
|
|||||||
QMap<QByteArray, QString> m_descriptions;
|
QMap<QByteArray, QString> m_descriptions;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
QVector<MacroExpanderProvider> m_subProviders;
|
QVector<MacroExpanderProvider> m_subProviders;
|
||||||
bool m_accumulating;
|
bool m_accumulating = false;
|
||||||
|
|
||||||
bool m_aborted;
|
bool m_aborted = false;
|
||||||
int m_lockDepth;
|
int m_lockDepth = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
@@ -328,7 +328,7 @@ MimeDatabase::MimeDatabase() :
|
|||||||
*/
|
*/
|
||||||
MimeDatabase::~MimeDatabase()
|
MimeDatabase::~MimeDatabase()
|
||||||
{
|
{
|
||||||
d = 0;
|
d = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Utils::addMimeTypes(const QString &fileName, const QByteArray &data)
|
void Utils::addMimeTypes(const QString &fileName, const QByteArray &data)
|
||||||
|
@@ -98,7 +98,7 @@ public:
|
|||||||
quint32 number;
|
quint32 number;
|
||||||
quint32 numberMask;
|
quint32 numberMask;
|
||||||
|
|
||||||
typedef bool (*MatchFunction)(const MimeMagicRulePrivate *d, const QByteArray &data);
|
using MatchFunction = bool (*)(const MimeMagicRulePrivate*, const QByteArray&);
|
||||||
MatchFunction matchFunction;
|
MatchFunction matchFunction;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ MimeMagicRule::MimeMagicRule(MimeMagicRule::Type theType,
|
|||||||
d->startPos = theStartPos;
|
d->startPos = theStartPos;
|
||||||
d->endPos = theEndPos;
|
d->endPos = theEndPos;
|
||||||
d->mask = theMask;
|
d->mask = theMask;
|
||||||
d->matchFunction = 0;
|
d->matchFunction = nullptr;
|
||||||
|
|
||||||
if (d->value.isEmpty()) {
|
if (d->value.isEmpty()) {
|
||||||
d->type = Invalid;
|
d->type = Invalid;
|
||||||
@@ -365,9 +365,7 @@ MimeMagicRule::MimeMagicRule(const MimeMagicRule &other) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MimeMagicRule::~MimeMagicRule()
|
MimeMagicRule::~MimeMagicRule() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
MimeMagicRule &MimeMagicRule::operator=(const MimeMagicRule &other)
|
MimeMagicRule &MimeMagicRule::operator=(const MimeMagicRule &other)
|
||||||
{
|
{
|
||||||
|
@@ -139,10 +139,7 @@ MimeType::MimeType() :
|
|||||||
\fn MimeType::MimeType(const MimeType &other);
|
\fn MimeType::MimeType(const MimeType &other);
|
||||||
Constructs this MimeType object as a copy of \a other.
|
Constructs this MimeType object as a copy of \a other.
|
||||||
*/
|
*/
|
||||||
MimeType::MimeType(const MimeType &other) :
|
MimeType::MimeType(const MimeType &other) = default;
|
||||||
d(other.d)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn MimeType &MimeType::operator=(const MimeType &other);
|
\fn MimeType &MimeType::operator=(const MimeType &other);
|
||||||
@@ -181,9 +178,7 @@ MimeType::MimeType(const MimeTypePrivate &dd) :
|
|||||||
\fn MimeType::~MimeType();
|
\fn MimeType::~MimeType();
|
||||||
Destroys the MimeType object, and releases the d pointer.
|
Destroys the MimeType object, and releases the d pointer.
|
||||||
*/
|
*/
|
||||||
MimeType::~MimeType()
|
MimeType::~MimeType() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool MimeType::operator==(const MimeType &other) const;
|
\fn bool MimeType::operator==(const MimeType &other) const;
|
||||||
|
@@ -295,7 +295,7 @@ bool MimeTypeParserBase::parse(const QByteArray &content, const QString &fileNam
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ParseMagicMatchRule: {
|
case ParseMagicMatchRule: {
|
||||||
MimeMagicRule *rule = 0;
|
MimeMagicRule *rule = nullptr;
|
||||||
if (!createMagicMatchRule(atts, errorMessage, rule))
|
if (!createMagicMatchRule(atts, errorMessage, rule))
|
||||||
return false;
|
return false;
|
||||||
QList<MimeMagicRule> *ruleList;
|
QList<MimeMagicRule> *ruleList;
|
||||||
|
@@ -47,12 +47,12 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
static NetworkAccessManager *namInstance = 0;
|
static NetworkAccessManager *namInstance = nullptr;
|
||||||
|
|
||||||
void cleanupNetworkAccessManager()
|
void cleanupNetworkAccessManager()
|
||||||
{
|
{
|
||||||
delete namInstance;
|
delete namInstance;
|
||||||
namInstance = 0;
|
namInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkAccessManager *NetworkAccessManager::instance()
|
NetworkAccessManager *NetworkAccessManager::instance()
|
||||||
|
@@ -51,34 +51,24 @@ struct NewClassWidgetPrivate {
|
|||||||
QString m_headerExtension;
|
QString m_headerExtension;
|
||||||
QString m_sourceExtension;
|
QString m_sourceExtension;
|
||||||
QString m_formExtension;
|
QString m_formExtension;
|
||||||
bool m_valid;
|
bool m_valid = false;
|
||||||
bool m_classEdited;
|
bool m_classEdited = false;
|
||||||
// Store the "visible" values to prevent the READ accessors from being
|
// Store the "visible" values to prevent the READ accessors from being
|
||||||
// fooled by a temporarily hidden widget
|
// fooled by a temporarily hidden widget
|
||||||
bool m_baseClassInputVisible;
|
bool m_baseClassInputVisible = true;
|
||||||
bool m_formInputVisible;
|
bool m_formInputVisible = true;
|
||||||
bool m_headerInputVisible;
|
bool m_headerInputVisible = true;
|
||||||
bool m_sourceInputVisible;
|
bool m_sourceInputVisible = true;
|
||||||
bool m_pathInputVisible;
|
bool m_pathInputVisible = true;
|
||||||
bool m_qobjectCheckBoxVisible;
|
bool m_qobjectCheckBoxVisible = false;
|
||||||
bool m_formInputCheckable;
|
bool m_formInputCheckable = false;
|
||||||
QRegExp m_classNameValidator;
|
QRegExp m_classNameValidator;
|
||||||
};
|
};
|
||||||
|
|
||||||
NewClassWidgetPrivate:: NewClassWidgetPrivate() :
|
NewClassWidgetPrivate:: NewClassWidgetPrivate() :
|
||||||
m_headerExtension(QLatin1Char('h')),
|
m_headerExtension(QLatin1Char('h')),
|
||||||
m_sourceExtension(QLatin1String("cpp")),
|
m_sourceExtension(QLatin1String("cpp")),
|
||||||
m_formExtension(QLatin1String("ui")),
|
m_formExtension(QLatin1String("ui"))
|
||||||
m_valid(false),
|
|
||||||
m_classEdited(false),
|
|
||||||
m_baseClassInputVisible(true),
|
|
||||||
m_formInputVisible(true),
|
|
||||||
m_headerInputVisible(true),
|
|
||||||
m_sourceInputVisible(true),
|
|
||||||
m_pathInputVisible(true),
|
|
||||||
m_qobjectCheckBoxVisible(false),
|
|
||||||
m_formInputCheckable(false)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ class OutputFormatterPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OutputFormatterPrivate()
|
OutputFormatterPrivate()
|
||||||
: plainTextEdit(0), overwriteOutput(false)
|
: plainTextEdit(nullptr), overwriteOutput(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QPlainTextEdit *plainTextEdit;
|
QPlainTextEdit *plainTextEdit;
|
||||||
|
@@ -102,7 +102,7 @@ bool BinaryVersionToolTipEventFilter::eventFilter(QObject *o, QEvent *e)
|
|||||||
{
|
{
|
||||||
if (e->type() != QEvent::ToolTip)
|
if (e->type() != QEvent::ToolTip)
|
||||||
return false;
|
return false;
|
||||||
QLineEdit *le = qobject_cast<QLineEdit *>(o);
|
auto le = qobject_cast<QLineEdit *>(o);
|
||||||
QTC_ASSERT(le, return false);
|
QTC_ASSERT(le, return false);
|
||||||
|
|
||||||
const QString binary = le->text();
|
const QString binary = le->text();
|
||||||
@@ -674,7 +674,7 @@ QString PathChooser::toolVersion(const QString &binary, const QStringList &argum
|
|||||||
|
|
||||||
void PathChooser::installLineEditVersionToolTip(QLineEdit *le, const QStringList &arguments)
|
void PathChooser::installLineEditVersionToolTip(QLineEdit *le, const QStringList &arguments)
|
||||||
{
|
{
|
||||||
BinaryVersionToolTipEventFilter *ef = new BinaryVersionToolTipEventFilter(le);
|
auto ef = new BinaryVersionToolTipEventFilter(le);
|
||||||
ef->setArguments(arguments);
|
ef->setArguments(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ const int PathListEditor::lastInsertButtonIndex = 0;
|
|||||||
|
|
||||||
class PathListPlainTextEdit : public QPlainTextEdit {
|
class PathListPlainTextEdit : public QPlainTextEdit {
|
||||||
public:
|
public:
|
||||||
explicit PathListPlainTextEdit(QWidget *parent = 0);
|
explicit PathListPlainTextEdit(QWidget *parent = nullptr);
|
||||||
protected:
|
protected:
|
||||||
void insertFromMimeData (const QMimeData *source) override;
|
void insertFromMimeData (const QMimeData *source) override;
|
||||||
};
|
};
|
||||||
@@ -149,7 +149,7 @@ QPushButton *PathListEditor::addButton(const QString &text, QObject *parent,
|
|||||||
QPushButton *PathListEditor::insertButton(int index /* -1 */, const QString &text, QObject *parent,
|
QPushButton *PathListEditor::insertButton(int index /* -1 */, const QString &text, QObject *parent,
|
||||||
std::function<void()> slotFunc)
|
std::function<void()> slotFunc)
|
||||||
{
|
{
|
||||||
QPushButton *rc = new QPushButton(text, this);
|
auto rc = new QPushButton(text, this);
|
||||||
QObject::connect(rc, &QPushButton::pressed, parent, slotFunc);
|
QObject::connect(rc, &QPushButton::pressed, parent, slotFunc);
|
||||||
d->buttonLayout->insertWidget(index, rc);
|
d->buttonLayout->insertWidget(index, rc);
|
||||||
return rc;
|
return rc;
|
||||||
|
@@ -108,7 +108,7 @@ namespace Utils {
|
|||||||
|
|
||||||
struct Context // Basic context containing element name string constants.
|
struct Context // Basic context containing element name string constants.
|
||||||
{
|
{
|
||||||
Context() {}
|
Context() = default;
|
||||||
const QString qtCreatorElement = QString("qtcreator");
|
const QString qtCreatorElement = QString("qtcreator");
|
||||||
const QString dataElement = QString("data");
|
const QString dataElement = QString("data");
|
||||||
const QString variableElement = QString("variable");
|
const QString variableElement = QString("variable");
|
||||||
@@ -281,7 +281,7 @@ QString ParseContext::formatWarning(const QXmlStreamReader &r, const QString &me
|
|||||||
{
|
{
|
||||||
QString result = QLatin1String("Warning reading ");
|
QString result = QLatin1String("Warning reading ");
|
||||||
if (const QIODevice *device = r.device())
|
if (const QIODevice *device = r.device())
|
||||||
if (const QFile *file = qobject_cast<const QFile *>(device))
|
if (const auto file = qobject_cast<const QFile *>(device))
|
||||||
result += QDir::toNativeSeparators(file->fileName()) + QLatin1Char(':');
|
result += QDir::toNativeSeparators(file->fileName()) + QLatin1Char(':');
|
||||||
result += QString::number(r.lineNumber());
|
result += QString::number(r.lineNumber());
|
||||||
result += QLatin1String(": ");
|
result += QLatin1String(": ");
|
||||||
@@ -327,9 +327,7 @@ QVariant ParseContext::readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttr
|
|||||||
|
|
||||||
// =================================== PersistentSettingsReader
|
// =================================== PersistentSettingsReader
|
||||||
|
|
||||||
PersistentSettingsReader::PersistentSettingsReader()
|
PersistentSettingsReader::PersistentSettingsReader() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant PersistentSettingsReader::restoreValue(const QString &variable, const QVariant &defaultValue) const
|
QVariant PersistentSettingsReader::restoreValue(const QString &variable, const QVariant &defaultValue) const
|
||||||
{
|
{
|
||||||
@@ -417,7 +415,7 @@ PersistentSettingsWriter::PersistentSettingsWriter(const FileName &fileName, con
|
|||||||
|
|
||||||
PersistentSettingsWriter::~PersistentSettingsWriter()
|
PersistentSettingsWriter::~PersistentSettingsWriter()
|
||||||
{
|
{
|
||||||
write(m_savedData, 0);
|
write(m_savedData, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentSettingsWriter::save(const QVariantMap &data, QString *errorString) const
|
bool PersistentSettingsWriter::save(const QVariantMap &data, QString *errorString) const
|
||||||
|
@@ -35,7 +35,7 @@ namespace Utils {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
typedef QPair<Port, Port> Range;
|
using Range = QPair<Port, Port>;
|
||||||
|
|
||||||
class PortsSpecParser
|
class PortsSpecParser
|
||||||
{
|
{
|
||||||
|
@@ -47,7 +47,7 @@ const wchar_t szTitle[] = L"qtcctrlcstub";
|
|||||||
const wchar_t szWindowClass[] = L"wcqtcctrlcstub";
|
const wchar_t szWindowClass[] = L"wcqtcctrlcstub";
|
||||||
UINT uiShutDownWindowMessage;
|
UINT uiShutDownWindowMessage;
|
||||||
UINT uiInterruptMessage;
|
UINT uiInterruptMessage;
|
||||||
HWND hwndMain = 0;
|
HWND hwndMain = nullptr;
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
BOOL WINAPI shutdownHandler(DWORD dwCtrlType);
|
BOOL WINAPI shutdownHandler(DWORD dwCtrlType);
|
||||||
@@ -68,7 +68,7 @@ int main(int argc, char **)
|
|||||||
WNDCLASSEX wcex = {0};
|
WNDCLASSEX wcex = {0};
|
||||||
wcex.cbSize = sizeof(wcex);
|
wcex.cbSize = sizeof(wcex);
|
||||||
wcex.lpfnWndProc = WndProc;
|
wcex.lpfnWndProc = WndProc;
|
||||||
wcex.hInstance = GetModuleHandle(0);
|
wcex.hInstance = GetModuleHandle(nullptr);
|
||||||
wcex.lpszClassName = szWindowClass;
|
wcex.lpszClassName = szWindowClass;
|
||||||
if (!RegisterClassEx(&wcex))
|
if (!RegisterClassEx(&wcex))
|
||||||
return 1;
|
return 1;
|
||||||
@@ -156,7 +156,7 @@ BOOL WINAPI interruptHandler(DWORD /*dwCtrlType*/)
|
|||||||
|
|
||||||
DWORD WINAPI processWatcherThread(LPVOID lpParameter)
|
DWORD WINAPI processWatcherThread(LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
HANDLE hProcess = reinterpret_cast<HANDLE>(lpParameter);
|
auto hProcess = reinterpret_cast<HANDLE>(lpParameter);
|
||||||
WaitForSingleObject(hProcess, INFINITE);
|
WaitForSingleObject(hProcess, INFINITE);
|
||||||
DWORD dwExitCode;
|
DWORD dwExitCode;
|
||||||
if (!GetExitCodeProcess(hProcess, &dwExitCode))
|
if (!GetExitCodeProcess(hProcess, &dwExitCode))
|
||||||
|
@@ -29,8 +29,8 @@ using namespace Utils;
|
|||||||
|
|
||||||
ProxyAction::ProxyAction(QObject *parent) :
|
ProxyAction::ProxyAction(QObject *parent) :
|
||||||
QAction(parent),
|
QAction(parent),
|
||||||
m_action(0),
|
m_action(nullptr),
|
||||||
m_attributes(0),
|
m_attributes(nullptr),
|
||||||
m_showShortcut(false),
|
m_showShortcut(false),
|
||||||
m_block(false)
|
m_block(false)
|
||||||
{
|
{
|
||||||
@@ -178,7 +178,7 @@ QString ProxyAction::stringWithAppendedShortcut(const QString &str, const QKeySe
|
|||||||
|
|
||||||
ProxyAction *ProxyAction::proxyActionWithIcon(QAction *original, const QIcon &newIcon)
|
ProxyAction *ProxyAction::proxyActionWithIcon(QAction *original, const QIcon &newIcon)
|
||||||
{
|
{
|
||||||
ProxyAction *proxyAction = new ProxyAction(original);
|
auto proxyAction = new ProxyAction(original);
|
||||||
proxyAction->setAction(original);
|
proxyAction->setAction(original);
|
||||||
proxyAction->setIcon(newIcon);
|
proxyAction->setIcon(newIcon);
|
||||||
proxyAction->setAttribute(UpdateText);
|
proxyAction->setAttribute(UpdateText);
|
||||||
|
@@ -236,9 +236,9 @@ void QtColorButton::mouseMoveEvent(QMouseEvent *event)
|
|||||||
#ifndef QT_NO_DRAGANDDROP
|
#ifndef QT_NO_DRAGANDDROP
|
||||||
if (event->buttons() & Qt::LeftButton &&
|
if (event->buttons() & Qt::LeftButton &&
|
||||||
(d_ptr->m_dragStart - event->pos()).manhattanLength() > QApplication::startDragDistance()) {
|
(d_ptr->m_dragStart - event->pos()).manhattanLength() > QApplication::startDragDistance()) {
|
||||||
QMimeData *mime = new QMimeData;
|
auto mime = new QMimeData;
|
||||||
mime->setColorData(color());
|
mime->setColorData(color());
|
||||||
QDrag *drg = new QDrag(this);
|
auto drg = new QDrag(this);
|
||||||
drg->setMimeData(mime);
|
drg->setMimeData(mime);
|
||||||
drg->setPixmap(d_ptr->generatePixmap());
|
drg->setPixmap(d_ptr->generatePixmap());
|
||||||
setDown(false);
|
setDown(false);
|
||||||
|
@@ -56,7 +56,7 @@ namespace Utils {
|
|||||||
SavedAction::SavedAction(QObject *parent)
|
SavedAction::SavedAction(QObject *parent)
|
||||||
: QAction(parent)
|
: QAction(parent)
|
||||||
{
|
{
|
||||||
m_widget = 0;
|
m_widget = nullptr;
|
||||||
connect(this, &QAction::triggered, this, &SavedAction::actionTriggered);
|
connect(this, &QAction::triggered, this, &SavedAction::actionTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ void SavedAction::connectWidget(QWidget *widget, ApplyMode applyMode)
|
|||||||
*/
|
*/
|
||||||
void SavedAction::disconnectWidget()
|
void SavedAction::disconnectWidget()
|
||||||
{
|
{
|
||||||
m_widget = 0;
|
m_widget = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavedAction::apply(QSettings *s)
|
void SavedAction::apply(QSettings *s)
|
||||||
@@ -335,7 +335,7 @@ void SavedAction::actionTriggered(bool)
|
|||||||
if (actionGroup() && actionGroup()->isExclusive()) {
|
if (actionGroup() && actionGroup()->isExclusive()) {
|
||||||
// FIXME: should be taken care of more directly
|
// FIXME: should be taken care of more directly
|
||||||
foreach (QAction *act, actionGroup()->actions())
|
foreach (QAction *act, actionGroup()->actions())
|
||||||
if (SavedAction *dact = qobject_cast<SavedAction *>(act))
|
if (auto dact = qobject_cast<SavedAction *>(act))
|
||||||
dact->setValue(bool(act == this));
|
dact->setValue(bool(act == this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
QFile::Permissions SaveFile::m_umask = 0;
|
QFile::Permissions SaveFile::m_umask = nullptr;
|
||||||
|
|
||||||
SaveFile::SaveFile(const QString &filename) :
|
SaveFile::SaveFile(const QString &filename) :
|
||||||
m_finalFileName(filename), m_finalized(true)
|
m_finalFileName(filename), m_finalized(true)
|
||||||
|
@@ -41,7 +41,7 @@ namespace Utils {
|
|||||||
SettingsSelector::SettingsSelector(QWidget *parent) :
|
SettingsSelector::SettingsSelector(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
auto layout = new QHBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->setSpacing(6);
|
layout->setSpacing(6);
|
||||||
|
|
||||||
@@ -77,8 +77,7 @@ SettingsSelector::SettingsSelector(QWidget *parent) :
|
|||||||
this, &SettingsSelector::currentChanged);
|
this, &SettingsSelector::currentChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsSelector::~SettingsSelector()
|
SettingsSelector::~SettingsSelector() = default;
|
||||||
{ }
|
|
||||||
|
|
||||||
void SettingsSelector::setConfigurationModel(QAbstractItemModel *model)
|
void SettingsSelector::setConfigurationModel(QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
|
@@ -314,7 +314,7 @@ void ShellCommand::run(QFutureInterface<void> &future)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_progressParser)
|
if (d->m_progressParser)
|
||||||
d->m_progressParser->setFuture(0);
|
d->m_progressParser->setFuture(nullptr);
|
||||||
// As it is used asynchronously, we need to delete ourselves
|
// As it is used asynchronously, we need to delete ourselves
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
}
|
}
|
||||||
@@ -503,7 +503,7 @@ void ShellCommand::setOutputProxyFactory(const std::function<OutputProxy *()> &f
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProgressParser::ProgressParser() :
|
ProgressParser::ProgressParser() :
|
||||||
m_future(0),
|
m_future(nullptr),
|
||||||
m_futureMutex(new QMutex)
|
m_futureMutex(new QMutex)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
StatusLabel::StatusLabel(QWidget *parent) : QLabel(parent), m_timer(0)
|
StatusLabel::StatusLabel(QWidget *parent) : QLabel(parent), m_timer(nullptr)
|
||||||
{
|
{
|
||||||
// A manual size let's us shrink below minimum text width which is what
|
// A manual size let's us shrink below minimum text width which is what
|
||||||
// we want in [fake] status bars.
|
// we want in [fake] status bars.
|
||||||
|
@@ -376,7 +376,7 @@ QPixmap StyleHelper::disabledSideBarIcon(const QPixmap &enabledicon)
|
|||||||
{
|
{
|
||||||
QImage im = enabledicon.toImage().convertToFormat(QImage::Format_ARGB32);
|
QImage im = enabledicon.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||||
for (int y=0; y<im.height(); ++y) {
|
for (int y=0; y<im.height(); ++y) {
|
||||||
QRgb *scanLine = reinterpret_cast<QRgb*>(im.scanLine(y));
|
auto scanLine = reinterpret_cast<QRgb*>(im.scanLine(y));
|
||||||
for (int x=0; x<im.width(); ++x) {
|
for (int x=0; x<im.width(); ++x) {
|
||||||
QRgb pixel = *scanLine;
|
QRgb pixel = *scanLine;
|
||||||
char intensity = char(qGray(pixel));
|
char intensity = char(qGray(pixel));
|
||||||
|
@@ -317,8 +317,8 @@ SynchronousProcess::SynchronousProcess() :
|
|||||||
|
|
||||||
SynchronousProcess::~SynchronousProcess()
|
SynchronousProcess::~SynchronousProcess()
|
||||||
{
|
{
|
||||||
disconnect(&d->m_timer, 0, this, 0);
|
disconnect(&d->m_timer, nullptr, this, nullptr);
|
||||||
disconnect(&d->m_process, 0, this, 0);
|
disconnect(&d->m_process, nullptr, this, nullptr);
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,10 +540,10 @@ static inline bool askToKill(const QString &binary = QString())
|
|||||||
msg += QLatin1Char(' ');
|
msg += QLatin1Char(' ');
|
||||||
msg += SynchronousProcess::tr("Would you like to terminate it?");
|
msg += SynchronousProcess::tr("Would you like to terminate it?");
|
||||||
// Restore the cursor that is set to wait while running.
|
// Restore the cursor that is set to wait while running.
|
||||||
const bool hasOverrideCursor = QApplication::overrideCursor() != 0;
|
const bool hasOverrideCursor = QApplication::overrideCursor() != nullptr;
|
||||||
if (hasOverrideCursor)
|
if (hasOverrideCursor)
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
QMessageBox::StandardButton answer = QMessageBox::question(0, title, msg, QMessageBox::Yes|QMessageBox::No);
|
QMessageBox::StandardButton answer = QMessageBox::question(nullptr, title, msg, QMessageBox::Yes|QMessageBox::No);
|
||||||
if (hasOverrideCursor)
|
if (hasOverrideCursor)
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
return answer == QMessageBox::Yes;
|
return answer == QMessageBox::Yes;
|
||||||
@@ -616,7 +616,7 @@ void SynchronousProcess::processStdErr(bool emitSignals)
|
|||||||
|
|
||||||
QSharedPointer<QProcess> SynchronousProcess::createProcess(unsigned flags)
|
QSharedPointer<QProcess> SynchronousProcess::createProcess(unsigned flags)
|
||||||
{
|
{
|
||||||
TerminalControllingProcess *process = new TerminalControllingProcess;
|
auto process = new TerminalControllingProcess;
|
||||||
process->setFlags(flags);
|
process->setFlags(flags);
|
||||||
return QSharedPointer<QProcess>(process);
|
return QSharedPointer<QProcess>(process);
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,7 @@ QDebug operator<<(QDebug d, const TextFileFormat &format)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
TextFileFormat::TextFileFormat() :
|
TextFileFormat::TextFileFormat() :
|
||||||
lineTerminationMode(NativeLineTerminator), hasUtf8Bom(false), codec(0)
|
lineTerminationMode(NativeLineTerminator), hasUtf8Bom(false), codec(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ TextFileFormat TextFileFormat::detect(const QByteArray &data)
|
|||||||
if (data.isEmpty())
|
if (data.isEmpty())
|
||||||
return result;
|
return result;
|
||||||
const int bytesRead = data.size();
|
const int bytesRead = data.size();
|
||||||
const unsigned char *buf = reinterpret_cast<const unsigned char *>(data.constData());
|
const auto buf = reinterpret_cast<const unsigned char *>(data.constData());
|
||||||
// code taken from qtextstream
|
// code taken from qtextstream
|
||||||
if (bytesRead >= 4 && ((buf[0] == 0xff && buf[1] == 0xfe && buf[2] == 0 && buf[3] == 0)
|
if (bytesRead >= 4 && ((buf[0] == 0xff && buf[1] == 0xfe && buf[2] == 0 && buf[3] == 0)
|
||||||
|| (buf[0] == 0 && buf[1] == 0 && buf[2] == 0xfe && buf[3] == 0xff))) {
|
|| (buf[0] == 0 && buf[1] == 0 && buf[2] == 0xfe && buf[3] == 0xff))) {
|
||||||
@@ -202,7 +202,7 @@ bool TextFileFormat::decode(const QByteArray &data, QStringList *target) const
|
|||||||
template <class Target>
|
template <class Target>
|
||||||
TextFileFormat::ReadResult readTextFile(const QString &fileName, const QTextCodec *defaultCodec,
|
TextFileFormat::ReadResult readTextFile(const QString &fileName, const QTextCodec *defaultCodec,
|
||||||
Target *target, TextFileFormat *format, QString *errorString,
|
Target *target, TextFileFormat *format, QString *errorString,
|
||||||
QByteArray *decodingErrorSampleIn = 0)
|
QByteArray *decodingErrorSampleIn = nullptr)
|
||||||
{
|
{
|
||||||
if (decodingErrorSampleIn)
|
if (decodingErrorSampleIn)
|
||||||
decodingErrorSampleIn->clear();
|
decodingErrorSampleIn->clear();
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
static Theme *m_creatorTheme = 0;
|
static Theme *m_creatorTheme = nullptr;
|
||||||
|
|
||||||
ThemePrivate::ThemePrivate()
|
ThemePrivate::ThemePrivate()
|
||||||
{
|
{
|
||||||
|
@@ -120,11 +120,11 @@ TextTip::TextTip(QWidget *parent) : QTipLabel(parent)
|
|||||||
setForegroundRole(QPalette::ToolTipText);
|
setForegroundRole(QPalette::ToolTipText);
|
||||||
setBackgroundRole(QPalette::ToolTipBase);
|
setBackgroundRole(QPalette::ToolTipBase);
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
|
setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, nullptr, this));
|
||||||
setFrameStyle(QFrame::NoFrame);
|
setFrameStyle(QFrame::NoFrame);
|
||||||
setAlignment(Qt::AlignLeft);
|
setAlignment(Qt::AlignLeft);
|
||||||
setIndent(1);
|
setIndent(1);
|
||||||
setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
|
setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, nullptr, this) / 255.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool likelyContainsLink(const QString &s)
|
static bool likelyContainsLink(const QString &s)
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
ToolTip::ToolTip() : m_tip(0), m_widget(0)
|
ToolTip::ToolTip() : m_tip(nullptr), m_widget(nullptr)
|
||||||
{
|
{
|
||||||
connect(&m_showTimer, &QTimer::timeout, this, &ToolTip::hideTipImmediately);
|
connect(&m_showTimer, &QTimer::timeout, this, &ToolTip::hideTipImmediately);
|
||||||
connect(&m_hideDelayTimer, &QTimer::timeout, this, &ToolTip::hideTipImmediately);
|
connect(&m_hideDelayTimer, &QTimer::timeout, this, &ToolTip::hideTipImmediately);
|
||||||
@@ -53,7 +53,7 @@ ToolTip::ToolTip() : m_tip(0), m_widget(0)
|
|||||||
|
|
||||||
ToolTip::~ToolTip()
|
ToolTip::~ToolTip()
|
||||||
{
|
{
|
||||||
m_tip = 0;
|
m_tip = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip *ToolTip::instance()
|
ToolTip *ToolTip::instance()
|
||||||
@@ -109,7 +109,7 @@ bool ToolTip::pinToolTip(QWidget *w, QWidget *parent)
|
|||||||
// Find the parent WidgetTip, tell it to pin/release the
|
// Find the parent WidgetTip, tell it to pin/release the
|
||||||
// widget and close.
|
// widget and close.
|
||||||
for (QWidget *p = w->parentWidget(); p ; p = p->parentWidget()) {
|
for (QWidget *p = w->parentWidget(); p ; p = p->parentWidget()) {
|
||||||
if (WidgetTip *wt = qobject_cast<WidgetTip *>(p)) {
|
if (auto wt = qobject_cast<WidgetTip *>(p)) {
|
||||||
wt->pinToolTipWidget(parent);
|
wt->pinToolTipWidget(parent);
|
||||||
ToolTip::hide();
|
ToolTip::hide();
|
||||||
return true;
|
return true;
|
||||||
@@ -234,7 +234,7 @@ void ToolTip::hideTipImmediately()
|
|||||||
if (m_tip) {
|
if (m_tip) {
|
||||||
m_tip->close();
|
m_tip->close();
|
||||||
m_tip->deleteLater();
|
m_tip->deleteLater();
|
||||||
m_tip = 0;
|
m_tip = nullptr;
|
||||||
}
|
}
|
||||||
m_showTimer.stop();
|
m_showTimer.stop();
|
||||||
m_hideDelayTimer.stop();
|
m_hideDelayTimer.stop();
|
||||||
@@ -246,7 +246,7 @@ void ToolTip::showInternal(const QPoint &pos, const QVariant &content,
|
|||||||
int typeId, QWidget *w, const QString &helpId, const QRect &rect)
|
int typeId, QWidget *w, const QString &helpId, const QRect &rect)
|
||||||
{
|
{
|
||||||
if (acceptShow(content, typeId, pos, w, helpId, rect)) {
|
if (acceptShow(content, typeId, pos, w, helpId, rect)) {
|
||||||
QWidget *target = 0;
|
QWidget *target = nullptr;
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
target = QApplication::desktop()->screen(Internal::screenNumber(pos, w));
|
target = QApplication::desktop()->screen(Internal::screenNumber(pos, w));
|
||||||
else
|
else
|
||||||
|
@@ -606,20 +606,20 @@ namespace Utils {
|
|||||||
// TreeItem
|
// TreeItem
|
||||||
//
|
//
|
||||||
TreeItem::TreeItem()
|
TreeItem::TreeItem()
|
||||||
: m_parent(0), m_model(0)
|
: m_parent(nullptr), m_model(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem::~TreeItem()
|
TreeItem::~TreeItem()
|
||||||
{
|
{
|
||||||
QTC_CHECK(m_parent == 0);
|
QTC_CHECK(m_parent == nullptr);
|
||||||
QTC_CHECK(m_model == 0);
|
QTC_CHECK(m_model == nullptr);
|
||||||
removeChildren();
|
removeChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *TreeItem::childAt(int pos) const
|
TreeItem *TreeItem::childAt(int pos) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(pos >= 0, return 0);
|
QTC_ASSERT(pos >= 0, return nullptr);
|
||||||
return pos < childCount() ? *(begin() + pos) : nullptr;
|
return pos < childCount() ? *(begin() + pos) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,7 +837,7 @@ void TreeItem::forChildrenAtLevel(int level, const std::function<void(TreeItem *
|
|||||||
|
|
||||||
TreeItem *TreeItem::findChildAtLevel(int level, const std::function<bool(TreeItem *)> &pred) const
|
TreeItem *TreeItem::findChildAtLevel(int level, const std::function<bool(TreeItem *)> &pred) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(level > 0, return 0);
|
QTC_ASSERT(level > 0, return nullptr);
|
||||||
if (level == 1) {
|
if (level == 1) {
|
||||||
for (TreeItem *item : *this)
|
for (TreeItem *item : *this)
|
||||||
if (pred(item))
|
if (pred(item))
|
||||||
@@ -848,7 +848,7 @@ TreeItem *TreeItem::findChildAtLevel(int level, const std::function<bool(TreeIte
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *TreeItem::findAnyChild(const std::function<bool(TreeItem *)> &pred) const
|
TreeItem *TreeItem::findAnyChild(const std::function<bool(TreeItem *)> &pred) const
|
||||||
@@ -859,7 +859,7 @@ TreeItem *TreeItem::findAnyChild(const std::function<bool(TreeItem *)> &pred) co
|
|||||||
if (TreeItem *found = item->findAnyChild(pred))
|
if (TreeItem *found = item->findAnyChild(pred))
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *TreeItem::reverseFindAnyChild(const std::function<bool (TreeItem *)> &pred) const
|
TreeItem *TreeItem::reverseFindAnyChild(const std::function<bool (TreeItem *)> &pred) const
|
||||||
@@ -878,8 +878,8 @@ void TreeItem::clear()
|
|||||||
{
|
{
|
||||||
while (childCount() != 0) {
|
while (childCount() != 0) {
|
||||||
TreeItem *item = m_children.takeLast();
|
TreeItem *item = m_children.takeLast();
|
||||||
item->m_model = 0;
|
item->m_model = nullptr;
|
||||||
item->m_parent = 0;
|
item->m_parent = nullptr;
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -908,7 +908,7 @@ void TreeItem::collapse()
|
|||||||
void TreeItem::propagateModel(BaseTreeModel *m)
|
void TreeItem::propagateModel(BaseTreeModel *m)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m, return);
|
QTC_ASSERT(m, return);
|
||||||
QTC_ASSERT(m_model == 0 || m_model == m, return);
|
QTC_ASSERT(m_model == nullptr || m_model == m, return);
|
||||||
if (m && !m_model) {
|
if (m && !m_model) {
|
||||||
m_model = m;
|
m_model = m;
|
||||||
for (TreeItem *item : *this)
|
for (TreeItem *item : *this)
|
||||||
@@ -945,9 +945,9 @@ BaseTreeModel::BaseTreeModel(TreeItem *root, QObject *parent)
|
|||||||
BaseTreeModel::~BaseTreeModel()
|
BaseTreeModel::~BaseTreeModel()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_root, return);
|
QTC_ASSERT(m_root, return);
|
||||||
QTC_ASSERT(m_root->m_parent == 0, return);
|
QTC_ASSERT(m_root->m_parent == nullptr, return);
|
||||||
QTC_ASSERT(m_root->m_model == this, return);
|
QTC_ASSERT(m_root->m_model == this, return);
|
||||||
m_root->m_model = 0;
|
m_root->m_model = nullptr;
|
||||||
delete m_root;
|
delete m_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1039,7 +1039,7 @@ bool BaseTreeModel::hasChildren(const QModelIndex &idx) const
|
|||||||
Qt::ItemFlags BaseTreeModel::flags(const QModelIndex &idx) const
|
Qt::ItemFlags BaseTreeModel::flags(const QModelIndex &idx) const
|
||||||
{
|
{
|
||||||
if (!idx.isValid())
|
if (!idx.isValid())
|
||||||
return 0;
|
return nullptr;
|
||||||
TreeItem *item = itemForIndex(idx);
|
TreeItem *item = itemForIndex(idx);
|
||||||
return item ? item->flags(idx.column())
|
return item ? item->flags(idx.column())
|
||||||
: (Qt::ItemIsEnabled|Qt::ItemIsSelectable);
|
: (Qt::ItemIsEnabled|Qt::ItemIsSelectable);
|
||||||
@@ -1070,19 +1070,19 @@ TreeItem *BaseTreeModel::rootItem() const
|
|||||||
void BaseTreeModel::setRootItem(TreeItem *item)
|
void BaseTreeModel::setRootItem(TreeItem *item)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(item, return);
|
QTC_ASSERT(item, return);
|
||||||
QTC_ASSERT(item->m_model == 0, return);
|
QTC_ASSERT(item->m_model == nullptr, return);
|
||||||
QTC_ASSERT(item->m_parent == 0, return);
|
QTC_ASSERT(item->m_parent == nullptr, return);
|
||||||
QTC_ASSERT(item != m_root, return);
|
QTC_ASSERT(item != m_root, return);
|
||||||
QTC_CHECK(m_root);
|
QTC_CHECK(m_root);
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
if (m_root) {
|
if (m_root) {
|
||||||
QTC_CHECK(m_root->m_parent == 0);
|
QTC_CHECK(m_root->m_parent == nullptr);
|
||||||
QTC_CHECK(m_root->m_model == this);
|
QTC_CHECK(m_root->m_model == this);
|
||||||
// needs to be done explicitly before setting the model to 0, otherwise it might lead to a
|
// needs to be done explicitly before setting the model to 0, otherwise it might lead to a
|
||||||
// crash inside a view or proxy model, especially if there are selected items
|
// crash inside a view or proxy model, especially if there are selected items
|
||||||
m_root->removeChildren();
|
m_root->removeChildren();
|
||||||
m_root->m_model = 0;
|
m_root->m_model = nullptr;
|
||||||
delete m_root;
|
delete m_root;
|
||||||
}
|
}
|
||||||
m_root = item;
|
m_root = item;
|
||||||
@@ -1118,8 +1118,8 @@ TreeItem *BaseTreeModel::itemForIndex(const QModelIndex &idx) const
|
|||||||
{
|
{
|
||||||
CHECK_INDEX(idx);
|
CHECK_INDEX(idx);
|
||||||
TreeItem *item = idx.isValid() ? static_cast<TreeItem*>(idx.internalPointer()) : m_root;
|
TreeItem *item = idx.isValid() ? static_cast<TreeItem*>(idx.internalPointer()) : m_root;
|
||||||
QTC_ASSERT(item, return 0);
|
QTC_ASSERT(item, return nullptr);
|
||||||
QTC_ASSERT(item->m_model == static_cast<const BaseTreeModel *>(this), return 0);
|
QTC_ASSERT(item->m_model == static_cast<const BaseTreeModel *>(this), return nullptr);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1132,7 +1132,7 @@ QModelIndex BaseTreeModel::indexForItem(const TreeItem *item) const
|
|||||||
TreeItem *p = item->parent();
|
TreeItem *p = item->parent();
|
||||||
QTC_ASSERT(p, return QModelIndex());
|
QTC_ASSERT(p, return QModelIndex());
|
||||||
|
|
||||||
TreeItem *mitem = const_cast<TreeItem *>(item);
|
auto mitem = const_cast<TreeItem *>(item);
|
||||||
int row = p->indexOf(mitem);
|
int row = p->indexOf(mitem);
|
||||||
return createIndex(row, 0, mitem);
|
return createIndex(row, 0, mitem);
|
||||||
}
|
}
|
||||||
@@ -1166,8 +1166,8 @@ TreeItem *BaseTreeModel::takeItem(TreeItem *item)
|
|||||||
|
|
||||||
QModelIndex idx = indexForItem(parent);
|
QModelIndex idx = indexForItem(parent);
|
||||||
beginRemoveRows(idx, pos, pos);
|
beginRemoveRows(idx, pos, pos);
|
||||||
item->m_parent = 0;
|
item->m_parent = nullptr;
|
||||||
item->m_model = 0;
|
item->m_model = nullptr;
|
||||||
parent->m_children.removeAt(pos);
|
parent->m_children.removeAt(pos);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
return item;
|
return item;
|
||||||
|
@@ -135,7 +135,7 @@ void TreeViewComboBox::setCurrentIndex(const QModelIndex &index)
|
|||||||
bool TreeViewComboBox::eventFilter(QObject *object, QEvent *event)
|
bool TreeViewComboBox::eventFilter(QObject *object, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::MouseButtonPress && object == view()->viewport()) {
|
if (event->type() == QEvent::MouseButtonPress && object == view()->viewport()) {
|
||||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
auto* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
QModelIndex index = view()->indexAt(mouseEvent->pos());
|
QModelIndex index = view()->indexAt(mouseEvent->pos());
|
||||||
if (!view()->visualRect(index).contains(mouseEvent->pos()))
|
if (!view()->visualRect(index).contains(mouseEvent->pos()))
|
||||||
m_skipNextHide = true;
|
m_skipNextHide = true;
|
||||||
|
@@ -80,9 +80,9 @@ QTCREATOR_UTILS_EXPORT QString winGetDLLVersion(WinDLLVersionType t,
|
|||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// Resolve required symbols from the version.dll
|
// Resolve required symbols from the version.dll
|
||||||
typedef DWORD (APIENTRY *GetFileVersionInfoSizeProtoType)(LPCTSTR, LPDWORD);
|
using GetFileVersionInfoSizeProtoType = DWORD (APIENTRY*)(LPCTSTR, LPDWORD);
|
||||||
typedef BOOL (APIENTRY *GetFileVersionInfoWProtoType)(LPCWSTR, DWORD, DWORD, LPVOID);
|
using GetFileVersionInfoWProtoType = BOOL (APIENTRY*)(LPCWSTR, DWORD, DWORD, LPVOID);
|
||||||
typedef BOOL (APIENTRY *VerQueryValueWProtoType)(const LPVOID, LPWSTR lpSubBlock, LPVOID, PUINT);
|
using VerQueryValueWProtoType = BOOL (APIENTRY*)(const LPVOID, LPWSTR lpSubBlock, LPVOID, PUINT);
|
||||||
|
|
||||||
const char *versionDLLC = "version.dll";
|
const char *versionDLLC = "version.dll";
|
||||||
QLibrary versionLib(QLatin1String(versionDLLC), 0);
|
QLibrary versionLib(QLatin1String(versionDLLC), 0);
|
||||||
@@ -91,9 +91,9 @@ QTCREATOR_UTILS_EXPORT QString winGetDLLVersion(WinDLLVersionType t,
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
// MinGW requires old-style casts
|
// MinGW requires old-style casts
|
||||||
GetFileVersionInfoSizeProtoType getFileVersionInfoSizeW = (GetFileVersionInfoSizeProtoType)(versionLib.resolve("GetFileVersionInfoSizeW"));
|
auto getFileVersionInfoSizeW = (GetFileVersionInfoSizeProtoType)(versionLib.resolve("GetFileVersionInfoSizeW"));
|
||||||
GetFileVersionInfoWProtoType getFileVersionInfoW = (GetFileVersionInfoWProtoType)(versionLib.resolve("GetFileVersionInfoW"));
|
auto getFileVersionInfoW = (GetFileVersionInfoWProtoType)(versionLib.resolve("GetFileVersionInfoW"));
|
||||||
VerQueryValueWProtoType verQueryValueW = (VerQueryValueWProtoType)(versionLib.resolve("VerQueryValueW"));
|
auto verQueryValueW = (VerQueryValueWProtoType)(versionLib.resolve("VerQueryValueW"));
|
||||||
if (!getFileVersionInfoSizeW || !getFileVersionInfoW || !verQueryValueW) {
|
if (!getFileVersionInfoSizeW || !getFileVersionInfoW || !verQueryValueW) {
|
||||||
*errorMessage = msgCannotResolve(versionDLLC);
|
*errorMessage = msgCannotResolve(versionDLLC);
|
||||||
return QString();
|
return QString();
|
||||||
@@ -101,7 +101,7 @@ QTCREATOR_UTILS_EXPORT QString winGetDLLVersion(WinDLLVersionType t,
|
|||||||
|
|
||||||
// Now go ahead, read version info resource
|
// Now go ahead, read version info resource
|
||||||
DWORD dummy = 0;
|
DWORD dummy = 0;
|
||||||
const LPCTSTR fileName = reinterpret_cast<LPCTSTR>(name.utf16()); // MinGWsy
|
const auto fileName = reinterpret_cast<LPCTSTR>(name.utf16()); // MinGWsy
|
||||||
const DWORD infoSize = (*getFileVersionInfoSizeW)(fileName, &dummy);
|
const DWORD infoSize = (*getFileVersionInfoSizeW)(fileName, &dummy);
|
||||||
if (infoSize == 0) {
|
if (infoSize == 0) {
|
||||||
*errorMessage = QString::fromLatin1("Unable to determine the size of the version information of %1: %2").arg(name, winErrorMessage(GetLastError()));
|
*errorMessage = QString::fromLatin1("Unable to determine the size of the version information of %1: %2").arg(name, winErrorMessage(GetLastError()));
|
||||||
|
@@ -57,7 +57,7 @@ class ProgressItemWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProgressItemWidget(const QPixmap &indicatorPixmap, const QString &title, QWidget *parent = 0)
|
ProgressItemWidget(const QPixmap &indicatorPixmap, const QString &title, QWidget *parent = nullptr)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
m_indicatorVisible(false),
|
m_indicatorVisible(false),
|
||||||
m_indicatorPixmap(indicatorPixmap)
|
m_indicatorPixmap(indicatorPixmap)
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
m_indicatorLabel = new QLabel(this);
|
m_indicatorLabel = new QLabel(this);
|
||||||
m_indicatorLabel->setFixedSize(m_indicatorPixmap.size());
|
m_indicatorLabel->setFixedSize(m_indicatorPixmap.size());
|
||||||
m_titleLabel = new QLabel(title, this);
|
m_titleLabel = new QLabel(title, this);
|
||||||
QHBoxLayout *l = new QHBoxLayout(this);
|
auto l = new QHBoxLayout(this);
|
||||||
l->setMargin(0);
|
l->setMargin(0);
|
||||||
l->addWidget(m_indicatorLabel);
|
l->addWidget(m_indicatorLabel);
|
||||||
l->addWidget(m_titleLabel);
|
l->addWidget(m_titleLabel);
|
||||||
@@ -97,7 +97,7 @@ class LinearProgressWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LinearProgressWidget(WizardProgress *progress, QWidget *parent = 0);
|
LinearProgressWidget(WizardProgress *progress, QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void slotItemAdded(WizardProgressItem *item);
|
void slotItemAdded(WizardProgressItem *item);
|
||||||
@@ -126,14 +126,14 @@ private:
|
|||||||
LinearProgressWidget::LinearProgressWidget(WizardProgress *progress, QWidget *parent)
|
LinearProgressWidget::LinearProgressWidget(WizardProgress *progress, QWidget *parent)
|
||||||
:
|
:
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_dotsItemWidget(0),
|
m_dotsItemWidget(nullptr),
|
||||||
m_disableUpdatesCount(0)
|
m_disableUpdatesCount(0)
|
||||||
{
|
{
|
||||||
m_indicatorPixmap = QIcon::fromTheme(QLatin1String("go-next"), QIcon(QLatin1String(":/utils/images/arrow.png"))).pixmap(16);
|
m_indicatorPixmap = QIcon::fromTheme(QLatin1String("go-next"), QIcon(QLatin1String(":/utils/images/arrow.png"))).pixmap(16);
|
||||||
m_wizardProgress = progress;
|
m_wizardProgress = progress;
|
||||||
m_mainLayout = new QVBoxLayout(this);
|
m_mainLayout = new QVBoxLayout(this);
|
||||||
m_itemWidgetLayout = new QVBoxLayout();
|
m_itemWidgetLayout = new QVBoxLayout();
|
||||||
QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding);
|
auto spacer = new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding);
|
||||||
m_mainLayout->addLayout(m_itemWidgetLayout);
|
m_mainLayout->addLayout(m_itemWidgetLayout);
|
||||||
m_mainLayout->addSpacerItem(spacer);
|
m_mainLayout->addSpacerItem(spacer);
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ void Wizard::_q_pageAdded(int pageId)
|
|||||||
Q_D(Wizard);
|
Q_D(Wizard);
|
||||||
|
|
||||||
QWizardPage *p = page(pageId);
|
QWizardPage *p = page(pageId);
|
||||||
WizardPage *wp = qobject_cast<WizardPage *>(p);
|
auto wp = qobject_cast<WizardPage *>(p);
|
||||||
if (wp)
|
if (wp)
|
||||||
wp->pageWasAdded();
|
wp->pageWasAdded();
|
||||||
|
|
||||||
@@ -501,8 +501,8 @@ void Wizard::_q_pageAdded(int pageId)
|
|||||||
if (index < pages.count() - 1)
|
if (index < pages.count() - 1)
|
||||||
nextId = pages.at(index + 1);
|
nextId = pages.at(index + 1);
|
||||||
|
|
||||||
WizardProgressItem *prevItem = 0;
|
WizardProgressItem *prevItem = nullptr;
|
||||||
WizardProgressItem *nextItem = 0;
|
WizardProgressItem *nextItem = nullptr;
|
||||||
|
|
||||||
if (prevId >= 0)
|
if (prevId >= 0)
|
||||||
prevItem = d->m_wizardProgress->item(prevId);
|
prevItem = d->m_wizardProgress->item(prevId);
|
||||||
@@ -538,8 +538,8 @@ void Wizard::_q_pageRemoved(int pageId)
|
|||||||
if (index < pages.count() - 1)
|
if (index < pages.count() - 1)
|
||||||
nextId = pages.at(index + 1);
|
nextId = pages.at(index + 1);
|
||||||
|
|
||||||
WizardProgressItem *prevItem = 0;
|
WizardProgressItem *prevItem = nullptr;
|
||||||
WizardProgressItem *nextItem = 0;
|
WizardProgressItem *nextItem = nullptr;
|
||||||
|
|
||||||
if (prevId >= 0)
|
if (prevId >= 0)
|
||||||
prevItem = d->m_wizardProgress->item(prevId);
|
prevItem = d->m_wizardProgress->item(prevId);
|
||||||
@@ -567,8 +567,8 @@ class WizardProgressPrivate
|
|||||||
public:
|
public:
|
||||||
WizardProgressPrivate()
|
WizardProgressPrivate()
|
||||||
:
|
:
|
||||||
m_currentItem(0),
|
m_currentItem(nullptr),
|
||||||
m_startItem(0)
|
m_startItem(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,7 +673,7 @@ QList<WizardProgressItem *> WizardProgressPrivate::singlePathBetween(WizardProgr
|
|||||||
void WizardProgressPrivate::updateReachableItems()
|
void WizardProgressPrivate::updateReachableItems()
|
||||||
{
|
{
|
||||||
m_reachableItems = m_visitedItems;
|
m_reachableItems = m_visitedItems;
|
||||||
WizardProgressItem *item = 0;
|
WizardProgressItem *item = nullptr;
|
||||||
if (m_visitedItems.count() > 0)
|
if (m_visitedItems.count() > 0)
|
||||||
item = m_visitedItems.last();
|
item = m_visitedItems.last();
|
||||||
if (!item) {
|
if (!item) {
|
||||||
@@ -712,7 +712,7 @@ WizardProgressItem *WizardProgress::addItem(const QString &title)
|
|||||||
{
|
{
|
||||||
Q_D(WizardProgress);
|
Q_D(WizardProgress);
|
||||||
|
|
||||||
WizardProgressItem *item = new WizardProgressItem(this, title);
|
auto item = new WizardProgressItem(this, title);
|
||||||
d->m_itemToItem.insert(item, item);
|
d->m_itemToItem.insert(item, item);
|
||||||
emit itemAdded(item);
|
emit itemAdded(item);
|
||||||
return item;
|
return item;
|
||||||
@@ -835,7 +835,7 @@ void WizardProgress::setCurrentPage(int pageId)
|
|||||||
Q_D(WizardProgress);
|
Q_D(WizardProgress);
|
||||||
|
|
||||||
if (pageId < 0) { // reset history
|
if (pageId < 0) { // reset history
|
||||||
d->m_currentItem = 0;
|
d->m_currentItem = nullptr;
|
||||||
d->m_visitedItems.clear();
|
d->m_visitedItems.clear();
|
||||||
d->m_reachableItems.clear();
|
d->m_reachableItems.clear();
|
||||||
d->updateReachableItems();
|
d->updateReachableItems();
|
||||||
@@ -903,7 +903,7 @@ WizardProgressItem::WizardProgressItem(WizardProgress *progress, const QString &
|
|||||||
d_ptr->m_title = title;
|
d_ptr->m_title = title;
|
||||||
d_ptr->m_titleWordWrap = false;
|
d_ptr->m_titleWordWrap = false;
|
||||||
d_ptr->m_wizardProgress = progress;
|
d_ptr->m_wizardProgress = progress;
|
||||||
d_ptr->m_nextShownItem = 0;
|
d_ptr->m_nextShownItem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
WizardProgressItem::~WizardProgressItem()
|
WizardProgressItem::~WizardProgressItem()
|
||||||
@@ -947,7 +947,7 @@ void WizardProgressItem::setNextItems(const QList<WizardProgressItem *> &items)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!items.contains(d->m_nextShownItem))
|
if (!items.contains(d->m_nextShownItem))
|
||||||
setNextShownItem(0);
|
setNextShownItem(nullptr);
|
||||||
|
|
||||||
// update prev items (remove this item from the old next items)
|
// update prev items (remove this item from the old next items)
|
||||||
for (int i = 0; i < d->m_nextItems.count(); i++) {
|
for (int i = 0; i < d->m_nextItems.count(); i++) {
|
||||||
|
@@ -43,7 +43,7 @@ WizardPage::WizardPage(QWidget *parent) : QWizardPage(parent)
|
|||||||
|
|
||||||
void WizardPage::pageWasAdded()
|
void WizardPage::pageWasAdded()
|
||||||
{
|
{
|
||||||
Wizard *wiz = qobject_cast<Wizard *>(wizard());
|
auto wiz = qobject_cast<Wizard *>(wizard());
|
||||||
if (!wiz)
|
if (!wiz)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ void WizardPage::registerFieldWithName(const QString &name, QWidget *widget,
|
|||||||
|
|
||||||
void WizardPage::registerFieldName(const QString &name)
|
void WizardPage::registerFieldName(const QString &name)
|
||||||
{
|
{
|
||||||
Wizard *wiz = qobject_cast<Wizard *>(wizard());
|
auto wiz = qobject_cast<Wizard *>(wizard());
|
||||||
if (wiz)
|
if (wiz)
|
||||||
wiz->registerFieldName(name);
|
wiz->registerFieldName(name);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user