Convert some signals and slots to the new syntax.

This commit is contained in:
Andrius Štikonas 2016-05-18 22:23:59 +01:00
parent 36caff20f6
commit 5a408305f2
19 changed files with 35 additions and 39 deletions

View File

@ -61,7 +61,6 @@ find_package(KF5 5.16 REQUIRED
# use sane compile flags
add_definitions(
# -fexceptions
-DQT_USE_QSTRINGBUILDER
-DQT_NO_CAST_TO_ASCII
-DQT_NO_CAST_FROM_ASCII

View File

@ -126,9 +126,9 @@ void ApplyProgressDialog::setupConnections()
connect(&timer(), SIGNAL(timeout()), SLOT(onSecondElapsed()));
connect(&detailsWidget().buttonSave(), SIGNAL(clicked()), SLOT(saveReport()));
connect(&detailsWidget().buttonBrowser(), SIGNAL(clicked()), SLOT(browserReport()));
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(detailsButton, SIGNAL(clicked()), this, SLOT(toggleDetails()));
connect(dialogButtonBox, &QDialogButtonBox::accepted, this, &ApplyProgressDialog::accept);
connect(dialogButtonBox, &QDialogButtonBox::rejected, this, &ApplyProgressDialog::reject);
connect(detailsButton, &QPushButton::clicked, this, &ApplyProgressDialog::toggleDetails);
}
/** Shows the dialog */
@ -277,8 +277,8 @@ void ApplyProgressDialog::onOpStarted(int num, Operation* op)
dialogWidget().progressSub().setValue(0);
dialogWidget().progressSub().setRange(0, op->totalProgress());
connect(op, SIGNAL(jobStarted(Job*, Operation*)), SLOT(onJobStarted(Job*, Operation*)));
connect(op, SIGNAL(jobFinished(Job*, Operation*)), SLOT(onJobFinished(Job*, Operation*)));
connect(op, &Operation::jobStarted, this, &ApplyProgressDialog::onJobStarted);
connect(op, &Operation::jobFinished, this, &ApplyProgressDialog::onJobFinished);
}
void ApplyProgressDialog::onJobStarted(Job* job, Operation* op)

View File

@ -73,15 +73,16 @@ protected Q_SLOTS:
void onOkButton();
void onOpStarted(int num, Operation* op);
void onOpFinished(int num, Operation* op);
void onJobStarted(Job* job, Operation* op);
void onJobFinished(Job* job, Operation* op);
void onSecondElapsed();
void saveReport();
void toggleDetails();
void browserReport();
void updateReport(bool force = false);
protected:
void onJobStarted(Job* job, Operation* op);
void onJobFinished(Job* job, Operation* op);
void toggleDetails();
void closeEvent(QCloseEvent* e) override;
void keyPressEvent(QKeyEvent* e) override;

View File

@ -45,8 +45,8 @@ CreatePartitionTableDialog::CreatePartitionTableDialog(QWidget* parent, const De
mainLayout->addWidget(dialogButtonBox);
connect(&widget().radioMSDOS(), SIGNAL(toggled(bool)), SLOT(onMSDOSToggled(bool)));
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(dialogButtonBox, &QDialogButtonBox::accepted, this, &CreatePartitionTableDialog::accept);
connect(dialogButtonBox, &QDialogButtonBox::rejected, this, &CreatePartitionTableDialog::reject);
}
PartitionTable::TableType CreatePartitionTableDialog::type() const

View File

@ -76,8 +76,8 @@ void DevicePropsDialog::setupDialog()
okButton->setEnabled(false);
cancelButton->setFocus();
cancelButton->setDefault(true);
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(dialogButtonBox, &QDialogButtonBox::accepted, this, &DevicePropsDialog::accept);
connect(dialogButtonBox, &QDialogButtonBox::rejected, this, &DevicePropsDialog::reject);
QString type = QStringLiteral("---");
QString maxPrimaries = QStringLiteral("---");

View File

@ -107,7 +107,7 @@ void FileSystemSupportDialog::setupDialog()
void FileSystemSupportDialog::setupConnections()
{
connect(dialogButtonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(close()));
connect(dialogButtonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &FileSystemSupportDialog::close);
connect(&dialogWidget().buttonRescan(), SIGNAL(clicked()), SLOT(onButtonRescanClicked()));
}

View File

@ -115,7 +115,7 @@ void MainWindow::init()
{
treeLog().init();
connect(GlobalLog::instance(), SIGNAL(newMessage(Log::Level, const QString&)), &treeLog(), SLOT(onNewLogMessage(Log::Level, const QString&)));
connect(GlobalLog::instance(), &GlobalLog::newMessage, &treeLog(), &TreeLog::onNewLogMessage);
setupActions();
setupStatusBar();
@ -657,7 +657,7 @@ void MainWindow::updateSeletedDeviceMenu()
action->setCheckable(true);
action->setChecked(d->deviceNode() == pmWidget().selectedDevice()->deviceNode());
action->setData(d->deviceNode());
connect(action, SIGNAL(triggered(bool)), SLOT(onSelectedDeviceMenuTriggered(bool)));
connect(action, &QAction::triggered, this, &MainWindow::onSelectedDeviceMenuTriggered);
devicesMenu->addAction(action);
}
}

View File

@ -211,6 +211,8 @@ protected:
return *m_ScanProgressDialog;
}
void onSelectedDeviceMenuTriggered(bool);
protected Q_SLOTS:
void on_m_PartitionManagerWidget_selectedPartitionChanged(const Partition* p);
void on_m_PartitionManagerWidget_contextMenuRequested(const QPoint& pos);
@ -251,7 +253,6 @@ protected Q_SLOTS:
void onSmartStatusDevice();
void onPropertiesDevice(const QString& device_node = QString());
void onSelectedDeviceMenuTriggered(bool);
private:
OperationStack* m_OperationStack;

View File

@ -153,7 +153,7 @@ void PartitionManagerWidget::saveConfig() const
void PartitionManagerWidget::setupConnections()
{
connect(treePartitions().header(), SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(onHeaderContextMenu(const QPoint&)));
connect(treePartitions().header(), &QHeaderView::customContextMenuRequested, this, &PartitionManagerWidget::onHeaderContextMenu);
}
void PartitionManagerWidget::clear()

View File

@ -135,6 +135,8 @@ protected:
return *m_TreePartitions;
}
void onHeaderContextMenu(const QPoint& p);
protected Q_SLOTS:
void on_m_TreePartitions_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
void on_m_TreePartitions_customContextMenuRequested(const QPoint& pos);
@ -144,8 +146,6 @@ protected Q_SLOTS:
void on_m_PartTableWidget_customContextMenuRequested(const QPoint& pos);
void on_m_PartTableWidget_itemDoubleClicked();
void onHeaderContextMenu(const QPoint& p);
private:
OperationStack* m_OperationStack;
Device* m_SelectedDevice;

View File

@ -107,8 +107,8 @@ void PartPropsDialog::setupDialog()
okButton->setEnabled(false);
cancelButton->setFocus();
cancelButton->setDefault(true);
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(dialogButtonBox, &QDialogButtonBox::accepted, this, &PartPropsDialog::accept);
connect(dialogButtonBox, &QDialogButtonBox::rejected, this, &PartPropsDialog::reject);
dialogWidget().partWidget().init(&partition());

View File

@ -71,9 +71,9 @@ SizeDialogBase::SizeDialogBase(QWidget* parent, Device& d, Partition& part, qint
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
mainLayout->addWidget(dialogButtonBox);
connect(dialogButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(dialogButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(detailsButton, SIGNAL(clicked()), this, SLOT(toggleDetails()));
connect(dialogButtonBox, &QDialogButtonBox::accepted, this, &SizeDialogBase::accept);
connect(dialogButtonBox, &QDialogButtonBox::rejected, this, &SizeDialogBase::reject);
connect(detailsButton, &QPushButton::clicked, this, &SizeDialogBase::toggleDetails);
}
void SizeDialogBase::setupDialog()

View File

@ -127,9 +127,9 @@ protected Q_SLOTS:
void onSpinLastSectorChanged(double newLast);
void onAlignToggled(bool);
protected:
void toggleDetails();
protected:
SizeDialogWidget* m_SizeDialogWidget;
SizeDetailsWidget* m_SizeDetailsWidget;
Device& m_Device;

View File

@ -141,8 +141,8 @@ void SmartDialog::setupDialog()
void SmartDialog::setupConnections()
{
connect(buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), SLOT(saveSmartReport()));
connect(buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), SLOT(close()));
connect(buttonBox->button(QDialogButtonBox::Save), &QPushButton::clicked, this, &SmartDialog::saveSmartReport);
connect(buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, this, &SmartDialog::close);
}
QString SmartDialog::toHtml() const

View File

@ -38,17 +38,15 @@ class QDialogButtonBox;
*/
class SmartDialog : public QDialog
{
Q_OBJECT
Q_DISABLE_COPY(SmartDialog)
public:
SmartDialog(QWidget* parent, Device& d);
~SmartDialog();
protected Q_SLOTS:
protected:
void saveSmartReport();
protected:
void setupDialog();
void setupConnections();

View File

@ -122,7 +122,7 @@ void SmartDialogWidget::saveConfig() const
void SmartDialogWidget::setupConnections()
{
connect(treeSmartAttributes().header(), SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(onHeaderContextMenu(const QPoint&)));
connect(treeSmartAttributes().header(), &QHeaderView::customContextMenuRequested, this, &SmartDialogWidget::onHeaderContextMenu);
}
void SmartDialogWidget::onHeaderContextMenu(const QPoint& p)

View File

@ -29,8 +29,6 @@ class QPoint;
*/
class SmartDialogWidget : public QWidget, public Ui::SmartDialogWidgetBase
{
Q_OBJECT
public:
SmartDialogWidget(QWidget* parent);
~SmartDialogWidget();
@ -95,8 +93,6 @@ protected:
void setupConnections();
void loadConfig();
void saveConfig() const;
protected Q_SLOTS:
void onHeaderContextMenu(const QPoint& p);
private:

View File

@ -51,7 +51,7 @@ TreeLog::TreeLog(QWidget* parent) :
setupUi(this);
treeLog().header()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(treeLog().header(), SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(onHeaderContextMenu(const QPoint&)));
connect(treeLog().header(), &QHeaderView::customContextMenuRequested, this, &TreeLog::onHeaderContextMenu);
}

View File

@ -44,15 +44,16 @@ Q_SIGNALS:
public:
void init();
void onNewLogMessage(Log::Level logLevel, const QString& s);
protected Q_SLOTS:
void onNewLogMessage(Log::Level logLevel, const QString& s);
void onHeaderContextMenu(const QPoint& pos);
void onClearLog();
void onSaveLog();
void on_m_TreeLog_customContextMenuRequested(const QPoint& pos);
protected:
void onHeaderContextMenu(const QPoint& pos);
QTreeWidget& treeLog() {
Q_ASSERT(m_TreeLog);
return *m_TreeLog;