mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-22 14:43:46 +00:00
Clazy warnings (#2371)
* Refactor some of the connect calls. * Refactor more old style signal connect calls.
This commit is contained in:
parent
c149f38f11
commit
d6d2e90028
@ -24,7 +24,7 @@
|
|||||||
UpdateWorker::UpdateWorker(QObject *parent) :
|
UpdateWorker::UpdateWorker(QObject *parent) :
|
||||||
QObject(parent), pending(false)
|
QObject(parent), pending(false)
|
||||||
{
|
{
|
||||||
connect(&t, &QTimer::timeout, [this]() {
|
connect(&t, &QTimer::timeout, this, [this]() {
|
||||||
if (pending) {
|
if (pending) {
|
||||||
disconnect(checkReply, nullptr, this, nullptr);
|
disconnect(checkReply, nullptr, this, nullptr);
|
||||||
checkReply->close();
|
checkReply->close();
|
||||||
@ -102,7 +102,7 @@ void UpdateWorker::showUpdateDialog(bool showDontCheckForUpdatesButton)
|
|||||||
QProgressDialog progressDial(tr("Downloading update..."),
|
QProgressDialog progressDial(tr("Downloading update..."),
|
||||||
tr("Cancel"),
|
tr("Cancel"),
|
||||||
0, 100);
|
0, 100);
|
||||||
connect(this, &UpdateWorker::downloadProcess,
|
connect(this, &UpdateWorker::downloadProcess, &progressDial,
|
||||||
[&progressDial](size_t curr, size_t total) {
|
[&progressDial](size_t curr, size_t total) {
|
||||||
progressDial.setValue(100.0f * curr / total);
|
progressDial.setValue(100.0f * curr / total);
|
||||||
});
|
});
|
||||||
@ -110,7 +110,7 @@ void UpdateWorker::showUpdateDialog(bool showDontCheckForUpdatesButton)
|
|||||||
this, &UpdateWorker::abortDownload);
|
this, &UpdateWorker::abortDownload);
|
||||||
connect(this, &UpdateWorker::downloadFinished,
|
connect(this, &UpdateWorker::downloadFinished,
|
||||||
&progressDial, &QProgressDialog::cancel);
|
&progressDial, &QProgressDialog::cancel);
|
||||||
connect(this, &UpdateWorker::downloadFinished,
|
connect(this, &UpdateWorker::downloadFinished, this,
|
||||||
[](QString filePath){
|
[](QString filePath){
|
||||||
QMessageBox info(QMessageBox::Information,
|
QMessageBox info(QMessageBox::Information,
|
||||||
tr("Download finished!"),
|
tr("Download finished!"),
|
||||||
|
@ -169,9 +169,9 @@ void MainWindow::initUI()
|
|||||||
|
|
||||||
// G and S goes to goto entry
|
// G and S goes to goto entry
|
||||||
QShortcut *goto_shortcut = new QShortcut(QKeySequence(Qt::Key_G), this);
|
QShortcut *goto_shortcut = new QShortcut(QKeySequence(Qt::Key_G), this);
|
||||||
connect(goto_shortcut, SIGNAL(activated()), this->omnibar, SLOT(setFocus()));
|
connect(goto_shortcut, &QShortcut::activated, this->omnibar, [this](){ this->omnibar->setFocus(); });
|
||||||
QShortcut *seek_shortcut = new QShortcut(QKeySequence(Qt::Key_S), this);
|
QShortcut *seek_shortcut = new QShortcut(QKeySequence(Qt::Key_S), this);
|
||||||
connect(seek_shortcut, SIGNAL(activated()), this->omnibar, SLOT(setFocus()));
|
connect(seek_shortcut, &QShortcut::activated, this->omnibar, [this](){ this->omnibar->setFocus(); });
|
||||||
QShortcut *seek_to_func_end_shortcut = new QShortcut(QKeySequence(Qt::Key_Dollar), this);
|
QShortcut *seek_to_func_end_shortcut = new QShortcut(QKeySequence(Qt::Key_Dollar), this);
|
||||||
connect(seek_to_func_end_shortcut, &QShortcut::activated, this, &MainWindow::seekToFunctionLastInstruction);
|
connect(seek_to_func_end_shortcut, &QShortcut::activated, this, &MainWindow::seekToFunctionLastInstruction);
|
||||||
QShortcut *seek_to_func_start_shortcut = new QShortcut(QKeySequence(Qt::Key_AsciiCircum), this);
|
QShortcut *seek_to_func_start_shortcut = new QShortcut(QKeySequence(Qt::Key_AsciiCircum), this);
|
||||||
@ -184,8 +184,7 @@ void MainWindow::initUI()
|
|||||||
connect(ui->actionZoomOut, &QAction::triggered, this, &MainWindow::onZoomOut);
|
connect(ui->actionZoomOut, &QAction::triggered, this, &MainWindow::onZoomOut);
|
||||||
connect(ui->actionZoomReset, &QAction::triggered, this, &MainWindow::onZoomReset);
|
connect(ui->actionZoomReset, &QAction::triggered, this, &MainWindow::onZoomReset);
|
||||||
|
|
||||||
connect(core, SIGNAL(projectSaved(bool, const QString &)), this, SLOT(projectSaved(bool,
|
connect(core, &CutterCore::projectSaved, this, &MainWindow::projectSaved);
|
||||||
const QString &)));
|
|
||||||
|
|
||||||
connect(core, &CutterCore::toggleDebugView, this, &MainWindow::toggleDebugView);
|
connect(core, &CutterCore::toggleDebugView, this, &MainWindow::toggleDebugView);
|
||||||
|
|
||||||
@ -319,7 +318,7 @@ void MainWindow::initToolBar()
|
|||||||
this->visualNavbar->setMovable(false);
|
this->visualNavbar->setMovable(false);
|
||||||
addToolBarBreak(Qt::TopToolBarArea);
|
addToolBarBreak(Qt::TopToolBarArea);
|
||||||
addToolBar(visualNavbar);
|
addToolBar(visualNavbar);
|
||||||
QObject::connect(configuration, &Configuration::colorsUpdated, [this]() {
|
QObject::connect(configuration, &Configuration::colorsUpdated, this, [this]() {
|
||||||
this->visualNavbar->updateGraphicsScene();
|
this->visualNavbar->updateGraphicsScene();
|
||||||
});
|
});
|
||||||
QObject::connect(configuration, &Configuration::interfaceThemeChanged, this, &MainWindow::chooseThemeIcons);
|
QObject::connect(configuration, &Configuration::interfaceThemeChanged, this, &MainWindow::chooseThemeIcons);
|
||||||
@ -619,7 +618,6 @@ void MainWindow::finalizeOpen()
|
|||||||
setFocus();
|
setFocus();
|
||||||
bool graphContainsFunc = false;
|
bool graphContainsFunc = false;
|
||||||
for (auto dockWidget : dockWidgets) {
|
for (auto dockWidget : dockWidgets) {
|
||||||
const QString className = dockWidget->metaObject()->className();
|
|
||||||
auto graphWidget = qobject_cast<GraphWidget *>(dockWidget);
|
auto graphWidget = qobject_cast<GraphWidget *>(dockWidget);
|
||||||
if (graphWidget && dockWidget->isVisibleToUser()) {
|
if (graphWidget && dockWidget->isVisibleToUser()) {
|
||||||
graphContainsFunc = !graphWidget->getGraphView()->getBlocks().empty();
|
graphContainsFunc = !graphWidget->getGraphView()->getBlocks().empty();
|
||||||
|
@ -13,7 +13,8 @@ EditVariablesDialog::EditVariablesDialog(RVA offset, QString initialVar, QWidget
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &EditVariablesDialog::applyFields);
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &EditVariablesDialog::applyFields);
|
||||||
connect(ui->dropdownLocalVars, SIGNAL(currentIndexChanged(int)), SLOT(updateFields()));
|
connect<void(QComboBox::*)(int)>(ui->dropdownLocalVars, &QComboBox::currentIndexChanged,
|
||||||
|
this, &EditVariablesDialog::updateFields);
|
||||||
|
|
||||||
QString fcnName = Core()->cmdRawAt("afn.", offset).trimmed();
|
QString fcnName = Core()->cmdRawAt("afn.", offset).trimmed();
|
||||||
setWindowTitle(tr("Set Variable Types for Function: %1").arg(fcnName));
|
setWindowTitle(tr("Set Variable Types for Function: %1").arg(fcnName));
|
||||||
|
@ -91,7 +91,7 @@ InitialOptionsDialog::InitialOptionsDialog(MainWindow *main):
|
|||||||
|
|
||||||
connect(ui->scriptCheckBox, &QCheckBox::stateChanged, this, &InitialOptionsDialog::updateScriptLayout);
|
connect(ui->scriptCheckBox, &QCheckBox::stateChanged, this, &InitialOptionsDialog::updateScriptLayout);
|
||||||
|
|
||||||
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
connect(ui->cancelButton, &QPushButton::clicked, this, &InitialOptionsDialog::reject);
|
||||||
|
|
||||||
ui->programLineEdit->setText(main->getFilename());
|
ui->programLineEdit->setText(main->getFilename());
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ AsmOptionsWidget::AsmOptionsWidget(PreferencesDialog *dialog)
|
|||||||
&AsmOptionsWidget::asmComboBoxChanged);
|
&AsmOptionsWidget::asmComboBoxChanged);
|
||||||
connect(ui->offsetCheckBox, &QCheckBox::toggled, this, &AsmOptionsWidget::offsetCheckBoxToggled);
|
connect(ui->offsetCheckBox, &QCheckBox::toggled, this, &AsmOptionsWidget::offsetCheckBoxToggled);
|
||||||
connect(ui->relOffsetCheckBox, &QCheckBox::toggled, this, &AsmOptionsWidget::relOffCheckBoxToggled);
|
connect(ui->relOffsetCheckBox, &QCheckBox::toggled, this, &AsmOptionsWidget::relOffCheckBoxToggled);
|
||||||
connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(updateAsmOptionsFromVars()));
|
connect(Core(), &CutterCore::asmOptionsChanged, this, &AsmOptionsWidget::updateAsmOptionsFromVars);
|
||||||
updateAsmOptionsFromVars();
|
updateAsmOptionsFromVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,9 @@ DebugOptionsWidget::DebugOptionsWidget(PreferencesDialog *dialog)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
updateDebugPlugin();
|
updateDebugPlugin();
|
||||||
|
|
||||||
|
connect(ui->pluginComboBox, &QComboBox::currentTextChanged,
|
||||||
|
this, &DebugOptionsWidget::onDebugPluginChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugOptionsWidget::~DebugOptionsWidget() {}
|
DebugOptionsWidget::~DebugOptionsWidget() {}
|
||||||
@ -24,8 +27,8 @@ DebugOptionsWidget::~DebugOptionsWidget() {}
|
|||||||
void DebugOptionsWidget::updateDebugPlugin()
|
void DebugOptionsWidget::updateDebugPlugin()
|
||||||
{
|
{
|
||||||
ui->esilBreakOnInvalid->setChecked(Config()->getConfigBool("esil.breakoninvalid"));
|
ui->esilBreakOnInvalid->setChecked(Config()->getConfigBool("esil.breakoninvalid"));
|
||||||
disconnect(ui->pluginComboBox, SIGNAL(currentIndexChanged(const QString &)), this,
|
disconnect(ui->pluginComboBox, &QComboBox::currentTextChanged,
|
||||||
SLOT(on_pluginComboBox_currentIndexChanged(const QString &)));
|
this, &DebugOptionsWidget::onDebugPluginChanged);
|
||||||
|
|
||||||
QStringList plugins = Core()->getDebugPlugins();
|
QStringList plugins = Core()->getDebugPlugins();
|
||||||
for (const QString &str : plugins)
|
for (const QString &str : plugins)
|
||||||
@ -34,8 +37,8 @@ void DebugOptionsWidget::updateDebugPlugin()
|
|||||||
QString plugin = Core()->getActiveDebugPlugin();
|
QString plugin = Core()->getActiveDebugPlugin();
|
||||||
ui->pluginComboBox->setCurrentText(plugin);
|
ui->pluginComboBox->setCurrentText(plugin);
|
||||||
|
|
||||||
connect(ui->pluginComboBox, SIGNAL(currentIndexChanged(const QString &)), this,
|
connect(ui->pluginComboBox, &QComboBox::currentTextChanged,
|
||||||
SLOT(on_pluginComboBox_currentIndexChanged(const QString &)));
|
this, &DebugOptionsWidget::onDebugPluginChanged);
|
||||||
|
|
||||||
QString stackSize = Core()->getConfig("esil.stack.size");
|
QString stackSize = Core()->getConfig("esil.stack.size");
|
||||||
ui->stackSize->setText(stackSize);
|
ui->stackSize->setText(stackSize);
|
||||||
@ -47,7 +50,7 @@ void DebugOptionsWidget::updateDebugPlugin()
|
|||||||
connect(ui->stackSize, &QLineEdit::editingFinished, this, &DebugOptionsWidget::updateStackSize);
|
connect(ui->stackSize, &QLineEdit::editingFinished, this, &DebugOptionsWidget::updateStackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugOptionsWidget::on_pluginComboBox_currentIndexChanged(const QString &plugin)
|
void DebugOptionsWidget::onDebugPluginChanged(const QString &plugin)
|
||||||
{
|
{
|
||||||
Core()->setDebugPlugin(plugin);
|
Core()->setDebugPlugin(plugin);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,6 @@ private slots:
|
|||||||
void updateDebugPlugin();
|
void updateDebugPlugin();
|
||||||
void updateStackAddr();
|
void updateStackAddr();
|
||||||
void updateStackSize();
|
void updateStackSize();
|
||||||
void on_pluginComboBox_currentIndexChanged(const QString &index);
|
void onDebugPluginChanged(const QString &index);
|
||||||
void on_esilBreakOnInvalid_toggled(bool checked);
|
void on_esilBreakOnInvalid_toggled(bool checked);
|
||||||
};
|
};
|
||||||
|
@ -590,7 +590,8 @@ ClassesWidget::ClassesWidget(MainWindow *main) :
|
|||||||
|
|
||||||
ui->classSourceCombo->setCurrentIndex(1);
|
ui->classSourceCombo->setCurrentIndex(1);
|
||||||
|
|
||||||
connect(ui->classSourceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshClasses()));
|
connect<void(QComboBox::*)(int)>(ui->classSourceCombo, &QComboBox::currentIndexChanged,
|
||||||
|
this, &ClassesWidget::refreshClasses);
|
||||||
connect(ui->classesTreeView, &QTreeView::customContextMenuRequested, this, &ClassesWidget::showContextMenu);
|
connect(ui->classesTreeView, &QTreeView::customContextMenuRequested, this, &ClassesWidget::showContextMenu);
|
||||||
|
|
||||||
refreshClasses();
|
refreshClasses();
|
||||||
|
@ -158,7 +158,7 @@ FlagsWidget::FlagsWidget(MainWindow *main) :
|
|||||||
|
|
||||||
// Ctrl-F to move the focus to the Filter search box
|
// Ctrl-F to move the focus to the Filter search box
|
||||||
QShortcut *searchShortcut = new QShortcut(QKeySequence::Find, this);
|
QShortcut *searchShortcut = new QShortcut(QKeySequence::Find, this);
|
||||||
connect(searchShortcut, SIGNAL(activated()), ui->filterLineEdit, SLOT(setFocus()));
|
connect(searchShortcut, &QShortcut::activated, ui->filterLineEdit, [this]() { ui->filterLineEdit->setFocus(); });
|
||||||
searchShortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
searchShortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||||
|
|
||||||
// Esc to clear the filter entry
|
// Esc to clear the filter entry
|
||||||
|
@ -24,7 +24,7 @@ Omnibar::Omnibar(MainWindow *main, QWidget *parent) :
|
|||||||
|
|
||||||
// Esc clears omnibar
|
// Esc clears omnibar
|
||||||
QShortcut *clear_shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
QShortcut *clear_shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
||||||
connect(clear_shortcut, SIGNAL(activated()), this, SLOT(clear()));
|
connect(clear_shortcut, &QShortcut::activated, this, &Omnibar::clear);
|
||||||
clear_shortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
clear_shortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,14 +149,16 @@ RegisterRefsWidget::RegisterRefsWidget(MainWindow *main) :
|
|||||||
|
|
||||||
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged,
|
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged,
|
||||||
registerRefProxyModel, &QSortFilterProxyModel::setFilterWildcard);
|
registerRefProxyModel, &QSortFilterProxyModel::setFilterWildcard);
|
||||||
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->registerRefTreeView, SLOT(setFocus()));
|
connect(ui->quickFilterView, &QuickFilterView::filterClosed, ui->registerRefTreeView, [this](){
|
||||||
|
ui->registerRefTreeView->setFocus();
|
||||||
|
});
|
||||||
setScrollMode();
|
setScrollMode();
|
||||||
connect(Core(), &CutterCore::refreshAll, this, &RegisterRefsWidget::refreshRegisterRef);
|
connect(Core(), &CutterCore::refreshAll, this, &RegisterRefsWidget::refreshRegisterRef);
|
||||||
connect(Core(), &CutterCore::registersChanged, this, &RegisterRefsWidget::refreshRegisterRef);
|
connect(Core(), &CutterCore::registersChanged, this, &RegisterRefsWidget::refreshRegisterRef);
|
||||||
connect(actionCopyValue, &QAction::triggered, [ = ] () {
|
connect(actionCopyValue, &QAction::triggered, this, [this] () {
|
||||||
copyClip(RegisterRefModel::ValueColumn);
|
copyClip(RegisterRefModel::ValueColumn);
|
||||||
});
|
});
|
||||||
connect(actionCopyRef, &QAction::triggered, [ = ] () {
|
connect(actionCopyRef, &QAction::triggered, this, [this] () {
|
||||||
copyClip(RegisterRefModel::RefColumn);
|
copyClip(RegisterRefModel::RefColumn);
|
||||||
});
|
});
|
||||||
ui->registerRefTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->registerRefTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
@ -16,7 +16,7 @@ SdbWidget::SdbWidget(MainWindow *main) :
|
|||||||
|
|
||||||
path.clear();
|
path.clear();
|
||||||
|
|
||||||
connect(Core(), SIGNAL(refreshAll()), this, SLOT(reload()));
|
connect(Core(), &CutterCore::refreshAll, this, [this](){ reload(); });
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ VTablesWidget::VTablesWidget(MainWindow *main) :
|
|||||||
|
|
||||||
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, proxy,
|
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, proxy,
|
||||||
&QSortFilterProxyModel::setFilterWildcard);
|
&QSortFilterProxyModel::setFilterWildcard);
|
||||||
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->vTableTreeView, SLOT(setFocus()));
|
connect(ui->quickFilterView, &QuickFilterView::filterClosed, ui->vTableTreeView, [this](){ ui->vTableTreeView->setFocus(); });
|
||||||
|
|
||||||
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
|
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
|
||||||
tree->showItemsNumber(proxy->rowCount());
|
tree->showItemsNumber(proxy->rowCount());
|
||||||
|
Loading…
Reference in New Issue
Block a user