Commit 60f092f6 authored by hjk's avatar hjk

Debugger: Cosmetics

Qt 5 connects, unused declaration, QLatin1Strings, ...

Change-Id: If09929993d750907ee3f4e2fa9f18acfcc28d9c1
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 3b83b8b9
......@@ -33,12 +33,6 @@
#include <QCoreApplication>
#include <QPointer>
//////////////////////////////////////////////////////////////////
//
// BreakHandler
//
//////////////////////////////////////////////////////////////////
namespace Debugger {
namespace Internal {
......
......@@ -36,7 +36,6 @@ QT_BEGIN_NAMESPACE
class QIcon;
class QMessageBox;
class QWidget;
class QTreeView;
QT_END_NAMESPACE
namespace CPlusPlus { class Snapshot; }
......@@ -51,6 +50,7 @@ class DebuggerEngine;
class Symbol;
class Section;
class GlobalDebuggerOptions;
class WatchTreeView;
enum TestCases
{
......@@ -87,7 +87,7 @@ void setThreadBoxContents(const QStringList &list, int index);
QSharedPointer<Internal::GlobalDebuggerOptions> globalDebuggerOptions();
QTreeView *inspectorView();
WatchTreeView *inspectorView();
QVariant sessionValue(const QByteArray &name);
void setSessionValue(const QByteArray &name, const QVariant &value);
QVariant configValue(const QByteArray &name);
......
......@@ -865,8 +865,8 @@ TypeFormatsDialog::TypeFormatsDialog(QWidget *parent)
m_ui->addPage(tr("Standard Types"));
m_ui->addPage(tr("Misc Types"));
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(accept()));
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
TypeFormatsDialog::~TypeFormatsDialog()
......
......@@ -33,20 +33,14 @@
#include <QDialog>
QT_BEGIN_NAMESPACE
class QModelIndex;
class QPushButton;
class QLineEdit;
class QDialogButtonBox;
class QSettings;
QT_END_NAMESPACE
namespace Core { class Id; }
namespace ProjectExplorer { class Kit; }
namespace Debugger {
namespace Internal {
class AttachCoreDialogPrivate;
class AttachToQmlPortDialogPrivate;
class DebuggerRunParameters;
class StartApplicationParameters;
......@@ -80,11 +74,9 @@ public:
static bool run(QWidget *parent, DebuggerRunParameters *rp, ProjectExplorer::Kit **kit);
private slots:
private:
void historyIndexChanged(int);
void updateState();
private:
StartApplicationParameters parameters() const;
void setParameters(const StartApplicationParameters &p);
void setHistory(const QList<StartApplicationParameters> &l);
......@@ -121,10 +113,8 @@ public:
QString connection() const;
void setConnection(const QString &);
private slots:
void textChanged(const QString &);
private:
void textChanged(const QString &);
void accept();
QPushButton *m_okButton;
......@@ -140,10 +130,8 @@ public:
void setAddress(quint64 a);
quint64 address() const;
private slots:
void textChanged();
private:
void textChanged();
void accept();
void setOkButtonEnabled(bool v);
......
This diff is collapsed.
......@@ -1007,7 +1007,7 @@ public:
BaseTreeView *m_returnView = 0;
BaseTreeView *m_localsView = 0;
BaseTreeView *m_watchersView = 0;
BaseTreeView *m_inspectorView = 0;
WatchTreeView *m_inspectorView = 0;
BaseTreeView *m_registerView = 0;
BaseTreeView *m_modulesView = 0;
BaseTreeView *m_snapshotView = 0;
......@@ -2809,7 +2809,7 @@ QVariant sessionValue(const QByteArray &key)
return SessionManager::value(QString::fromUtf8(key));
}
QTreeView *inspectorView()
WatchTreeView *inspectorView()
{
return dd->m_inspectorView;
}
......
......@@ -968,7 +968,7 @@ DebuggerToolTipManager::~DebuggerToolTipManager()
m_instance = 0;
}
void DebuggerToolTipManager::slotUpdateVisibleToolTips()
void DebuggerToolTipManager::updateVisibleToolTips()
{
purgeClosedToolTips();
if (m_tooltips.isEmpty())
......@@ -1010,7 +1010,7 @@ void DebuggerToolTipManager::updateEngine(DebuggerEngine *engine)
// all others release (arguable, this could be more precise?)
foreach (DebuggerToolTipHolder *tooltip, m_tooltips)
tooltip->updateTooltip(engine);
slotUpdateVisibleToolTips(); // Move tooltip when stepping in same file.
updateVisibleToolTips(); // Move tooltip when stepping in same file.
}
void DebuggerToolTipManager::registerEngine(DebuggerEngine *engine)
......@@ -1237,7 +1237,7 @@ static void slotEditorOpened(IEditor *e)
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(e)) {
TextEditorWidget *widget = textEditor->editorWidget();
QObject::connect(widget->verticalScrollBar(), &QScrollBar::valueChanged,
&DebuggerToolTipManager::slotUpdateVisibleToolTips);
&DebuggerToolTipManager::updateVisibleToolTips);
QObject::connect(widget, &TextEditorWidget::tooltipOverrideRequested,
slotTooltipOverrideRequested);
}
......@@ -1252,14 +1252,14 @@ void DebuggerToolTipManager::debugModeEntered()
topLevel->installEventFilter(this);
EditorManager *em = EditorManager::instance();
connect(em, &EditorManager::currentEditorChanged,
&DebuggerToolTipManager::slotUpdateVisibleToolTips);
&DebuggerToolTipManager::updateVisibleToolTips);
connect(em, &EditorManager::editorOpened, slotEditorOpened);
foreach (IEditor *e, DocumentModel::editorsForOpenedDocuments())
slotEditorOpened(e);
// Position tooltips delayed once all the editor placeholder layouting is done.
if (!m_tooltips.isEmpty())
QTimer::singleShot(0, this, SLOT(slotUpdateVisibleToolTips()));
QTimer::singleShot(0, this, &DebuggerToolTipManager::updateVisibleToolTips);
}
}
......
......@@ -94,9 +94,7 @@ public:
static void saveSessionData();
static void closeAllToolTips();
static void resetLocation();
public slots:
static void slotUpdateVisibleToolTips();
static void updateVisibleToolTips();
};
} // namespace Internal
......
......@@ -262,8 +262,8 @@ void GdbCoreEngine::handleRoundTrip(const DebuggerResponse &response)
CHECK_STATE(InferiorUnrunnable);
Q_UNUSED(response);
loadSymbolsForStack();
handleStop2();
QTimer::singleShot(1000, this, SLOT(loadAllSymbols()));
handleStop3();
QTimer::singleShot(1000, this, &GdbEngine::loadAllSymbols);
}
void GdbCoreEngine::interruptInferior()
......
......@@ -856,8 +856,8 @@ void GdbEngine::interruptInferior()
QTC_ASSERT(!m_signalOperation, notifyInferiorStopFailed());
m_signalOperation = runParameters().device->signalOperation();
QTC_ASSERT(m_signalOperation, notifyInferiorStopFailed());
connect(m_signalOperation.data(), SIGNAL(finished(QString)),
SLOT(handleInterruptDeviceInferior(QString)));
connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished,
this, &GdbEngine::handleInterruptDeviceInferior);
m_signalOperation->setDebuggerCommand(runParameters().debuggerCommand);
m_signalOperation->interruptProcess(inferiorPid());
......@@ -1637,10 +1637,10 @@ void GdbEngine::handleStop2(const GdbMi &data)
// Let the event loop run before deciding whether to update the stack.
m_stackNeeded = true; // setTokenBarrier() might reset this.
QTimer::singleShot(0, this, SLOT(handleStop2()));
QTimer::singleShot(0, this, &GdbEngine::handleStop3);
}
void GdbEngine::handleStop2()
void GdbEngine::handleStop3()
{
DebuggerCommand cmd("-thread-info", Discardable);
cmd.callback = CB(handleThreadInfo);
......
......@@ -123,6 +123,7 @@ protected: ////////// Gdb Process Management //////////
private slots:
friend class GdbPlainEngine;
friend class GdbCoreEngine;
void handleInterruptDeviceInferior(const QString &error);
void handleGdbFinished(int exitCode, QProcess::ExitStatus exitStatus);
void handleGdbError(QProcess::ProcessError error);
......@@ -170,7 +171,7 @@ private: ////////// Gdb Command Management //////////
void runCommand(const DebuggerCommand &command) override;
private:
Q_SLOT void commandTimeout();
void commandTimeout();
void setTokenBarrier();
// Sets up an "unexpected result" for the following commeand.
......@@ -200,13 +201,13 @@ private:
private: ////////// Gdb Output, State & Capability Handling //////////
protected:
Q_SLOT void handleResponse(const QByteArray &buff);
void handleResponse(const QByteArray &buff);
void handleAsyncOutput(const QByteArray &asyncClass, const GdbMi &result);
void handleStopResponse(const GdbMi &data);
void handleResultRecord(DebuggerResponse *response);
void handleStop1(const GdbMi &data);
void handleStop2(const GdbMi &data);
Q_SLOT void handleStop2();
void handleStop3();
void resetCommandQueue();
bool isSynchronous() const override { return true; }
......@@ -289,7 +290,7 @@ private: ////////// View & Data Stuff //////////
//
protected:
void loadSymbols(const QString &moduleName) override;
Q_SLOT void loadAllSymbols() override;
void loadAllSymbols() override;
void loadSymbolsForStack() override;
void requestModuleSymbols(const QString &moduleName) override;
void requestModuleSections(const QString &moduleName) override;
......@@ -309,7 +310,7 @@ private: ////////// View & Data Stuff //////////
//
// Register specific stuff
//
Q_SLOT void reloadRegisters() override;
void reloadRegisters() override;
void setRegisterValue(const QByteArray &name, const QString &value) override;
void handleRegisterListNames(const DebuggerResponse &response);
void handleRegisterListing(const DebuggerResponse &response);
......@@ -355,8 +356,8 @@ protected:
void handleThreadInfo(const DebuggerResponse &response);
void handleThreadNames(const DebuggerResponse &response);
DebuggerCommand stackCommand(int depth);
Q_SLOT void reloadStack();
Q_SLOT virtual void reloadFullStack() override;
void reloadStack();
virtual void reloadFullStack() override;
virtual void loadAdditionalQmlStack() override;
void handleQmlStackTrace(const DebuggerResponse &response);
int currentFrame() const;
......@@ -386,7 +387,7 @@ protected:
void handleThreadGroupCreated(const GdbMi &result);
void handleThreadGroupExited(const GdbMi &result);
Q_SLOT void createFullBacktrace();
void createFullBacktrace();
void doUpdateLocals(const UpdateParameters &parameters) override;
void handleFetchVariables(const DebuggerResponse &response);
......
......@@ -292,8 +292,8 @@ GdbOptionsPageWidget::GdbOptionsPageWidget()
//lineEditSelectedPluginBreakpointsPattern->
// setEnabled(action(SelectedPluginBreakpoints)->value().toBool());
//connect(radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
// lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
//connect(radioButtonSelectedPluginBreakpoints, &QRadioButton::toggled,
// lineEditSelectedPluginBreakpointsPattern, &QLineEdit::setEnabled);
}
GdbOptionsPage::GdbOptionsPage()
......
......@@ -162,9 +162,9 @@ private:
QHash<int, DebuggerCommand> m_commandForToken;
// Console handling.
Q_SLOT void stubError(const QString &msg);
Q_SLOT void stubExited();
Q_SLOT void stubStarted();
void stubError(const QString &msg);
void stubExited();
void stubStarted();
bool prepareCommand();
Utils::ConsoleProcess m_stubProc;
};
......
......@@ -414,14 +414,14 @@ LogWindow::LogWindow(QWidget *parent)
aggregate->add(m_inputText);
aggregate->add(new Core::BaseTextFind(m_inputText));
connect(m_inputText, SIGNAL(statusMessageRequested(QString,int)),
SIGNAL(statusMessageRequested(QString,int)));
connect(m_inputText, SIGNAL(commandSelected(int)),
m_combinedText, SLOT(gotoResult(int)));
connect(m_inputText, &InputPane::statusMessageRequested,
this, &LogWindow::statusMessageRequested);
connect(m_inputText, &InputPane::commandSelected,
m_combinedText, &CombinedPane::gotoResult);
connect(m_commandEdit, &QLineEdit::returnPressed,
this, &LogWindow::sendCommand);
connect(m_inputText, SIGNAL(executeLineRequested()),
SLOT(executeLine()));
connect(m_inputText, &InputPane::executeLineRequested,
this, &LogWindow::executeLine);
connect(repeatButton, &QAbstractButton::clicked,
this, &LogWindow::repeatLastCommand);
......
......@@ -32,8 +32,6 @@
QT_BEGIN_NAMESPACE
class QCursor;
class QLabel;
class QLineEdit;
class QPlainTextEdit;
QT_END_NAMESPACE
......@@ -42,7 +40,8 @@ namespace Utils { class FancyLineEdit; }
namespace Debugger {
namespace Internal {
class DebuggerPane;
class CombinedPane;
class InputPane;
class LogWindow : public QWidget
{
......@@ -79,8 +78,8 @@ signals:
void statusMessageRequested(const QString &msg, int);
private:
DebuggerPane *m_combinedText; // combined input/output
DebuggerPane *m_inputText; // scriptable input alone
CombinedPane *m_combinedText; // combined input/output
InputPane *m_inputText; // scriptable input alone
QTimer m_outputTimer;
QString m_queuedOutput;
Utils::FancyLineEdit *m_commandEdit;
......
......@@ -75,7 +75,7 @@ bool OutputCollector::listen()
if (m_server)
return m_server->isListening();
m_server = new QLocalServer(this);
connect(m_server, SIGNAL(newConnection()), SLOT(newConnectionAvailable()));
connect(m_server, &QLocalServer::newConnection, this, &OutputCollector::newConnectionAvailable);
return m_server->listen(QString::fromLatin1("creator-%1-%2")
.arg(QCoreApplication::applicationPid())
.arg(rand()));
......@@ -111,7 +111,7 @@ bool OutputCollector::listen()
return false;
}
m_serverNotifier = new QSocketNotifier(m_serverFd, QSocketNotifier::Read, this);
connect(m_serverNotifier, SIGNAL(activated(int)), SLOT(bytesAvailable()));
connect(m_serverNotifier, &QSocketNotifier::activated, this, &OutputCollector::bytesAvailable);
return true;
#endif
}
......@@ -156,7 +156,7 @@ void OutputCollector::newConnectionAvailable()
if (m_socket)
return;
m_socket = m_server->nextPendingConnection();
connect(m_socket, SIGNAL(readyRead()), SLOT(bytesAvailable()));
connect(m_socket, &QIODevice::readyRead, this, &OutputCollector::bytesAvailable);
}
#endif
......
......@@ -49,7 +49,7 @@ class OutputCollector : public QObject
public:
OutputCollector(QObject *parent = 0);
~OutputCollector();
~OutputCollector() override;
bool listen();
void shutdown();
QString serverName() const;
......@@ -58,14 +58,10 @@ public:
signals:
void byteDelivery(const QByteArray &data);
private slots:
private:
void bytesAvailable();
#ifdef Q_OS_WIN
void newConnectionAvailable();
#endif
private:
#ifdef Q_OS_WIN
QLocalServer *m_server;
QLocalSocket *m_socket;
#else
......
......@@ -59,6 +59,7 @@
#include <texteditor/texteditor.h>
#include <utils/treemodel.h>
#include <utils/basetreeview.h>
#include <utils/qtcassert.h>
#include <QDebug>
......@@ -248,8 +249,8 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
this, &QmlEngine::updateCurrentContext);
connect(stackHandler(), &StackHandler::currentIndexChanged,
this, &QmlEngine::updateCurrentContext);
connect(inspectorView(), SIGNAL(currentIndexChanged(QModelIndex)),
SLOT(updateCurrentContext()));
connect(inspectorView(), &WatchTreeView::currentIndexChanged,
this, &QmlEngine::updateCurrentContext);
connect(&d->applicationLauncher, &ApplicationLauncher::processExited,
this, &QmlEngine::disconnected);
......@@ -270,7 +271,8 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
// then just try to connect (application output might be redirected / blocked)
d->noDebugOutputTimer.setSingleShot(true);
d->noDebugOutputTimer.setInterval(8000);
connect(&d->noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(tryToConnect()));
connect(&d->noDebugOutputTimer, &QTimer::timeout,
this, [this] { tryToConnect(); });
// we won't get any debug output
if (startParameters.useTerminal) {
......@@ -407,7 +409,7 @@ void QmlEngine::connectionStartupFailed()
{
if (d->retryOnConnectFail) {
// retry after 3 seconds ...
QTimer::singleShot(3000, this, SLOT(beginConnection()));
QTimer::singleShot(3000, this, [this] { beginConnection(); });
return;
}
......
......@@ -33,12 +33,6 @@ namespace Internal {
class DebuggerEngine;
////////////////////////////////////////////////////////////////////////
//
// SnapshotModel
//
////////////////////////////////////////////////////////////////////////
class SnapshotHandler : public QAbstractTableModel
{
Q_OBJECT
......@@ -68,7 +62,6 @@ private:
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
Q_SLOT void resetModel() { beginResetModel(); endResetModel(); }
int m_currentIndex;
QList< QPointer<DebuggerEngine> > m_snapshots;
......
......@@ -83,7 +83,7 @@ private:
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
Q_SLOT void resetModel() { beginResetModel(); endResetModel(); }
void resetModel() { beginResetModel(); endResetModel(); }
DebuggerEngine *m_engine;
StackFrames m_stackFrames;
......
......@@ -68,7 +68,7 @@ public:
void watchExpression(const QString &exp, const QString &name = QString());
void updateWatchExpression(WatchItem *item, const QByteArray &newExp);
void watchVariable(const QString &exp);
Q_SLOT void clearWatches();
void clearWatches();
const WatchItem *watchItem(const QModelIndex &) const;
void fetchMore(const QByteArray &iname) const;
......
......@@ -1003,7 +1003,7 @@ void WatchTreeView::doItemsLayout()
m_sliderPosition = verticalScrollBar()->sliderPosition();
Utils::BaseTreeView::doItemsLayout();
if (m_sliderPosition)
QTimer::singleShot(0, this, SLOT(adjustSlider()));
QTimer::singleShot(0, this, &WatchTreeView::adjustSlider);
}
void WatchTreeView::adjustSlider()
......@@ -1056,8 +1056,9 @@ public:
m_lineEdit, &Utils::FancyLineEdit::onEditingFinished);
connect(m_buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(m_buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(m_hint, SIGNAL(linkActivated(QString)),
Core::HelpManager::instance(), SLOT(handleHelpRequest(QString)));
connect(m_hint, &QLabel::linkActivated, [](const QString &link) {
Core::HelpManager::handleHelpRequest(link);
});
}
void setLabelText(const QString &text)
......
......@@ -30,12 +30,6 @@
namespace Debugger {
namespace Internal {
/////////////////////////////////////////////////////////////////////
//
// WatchWindow
//
/////////////////////////////////////////////////////////////////////
enum WatchType { LocalsType, InspectType, WatchersType, ReturnType, TooltipType };
class WatchTreeView : public Utils::BaseTreeView
......@@ -53,7 +47,6 @@ public:
void fillFormatMenu(QMenu *, const QModelIndex &mi);
static void reexpand(QTreeView *view, const QModelIndex &idx);
public slots:
void watchExpression(const QString &exp);
void watchExpression(const QString &exp, const QString &name);
void handleItemIsExpanded(const QModelIndex &idx);
......@@ -65,7 +58,7 @@ private:
void resetHelper();
void expandNode(const QModelIndex &idx);
void collapseNode(const QModelIndex &idx);
Q_SLOT void adjustSlider(); // Used by single-shot timer.
void adjustSlider();
void showUnprintable(int base);
void doItemsLayout();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment