diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bde601..be46ae7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/gui/applyprogressdialog.cpp b/src/gui/applyprogressdialog.cpp index 77261a4..be0f97e 100644 --- a/src/gui/applyprogressdialog.cpp +++ b/src/gui/applyprogressdialog.cpp @@ -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) diff --git a/src/gui/applyprogressdialog.h b/src/gui/applyprogressdialog.h index 346c0a8..993f298 100644 --- a/src/gui/applyprogressdialog.h +++ b/src/gui/applyprogressdialog.h @@ -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; diff --git a/src/gui/createpartitiontabledialog.cpp b/src/gui/createpartitiontabledialog.cpp index 5dd540c..2c1cb32 100644 --- a/src/gui/createpartitiontabledialog.cpp +++ b/src/gui/createpartitiontabledialog.cpp @@ -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 diff --git a/src/gui/devicepropsdialog.cpp b/src/gui/devicepropsdialog.cpp index df2f9f9..c442c67 100644 --- a/src/gui/devicepropsdialog.cpp +++ b/src/gui/devicepropsdialog.cpp @@ -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("---"); diff --git a/src/gui/filesystemsupportdialog.cpp b/src/gui/filesystemsupportdialog.cpp index 5fd4d20..973d6de 100644 --- a/src/gui/filesystemsupportdialog.cpp +++ b/src/gui/filesystemsupportdialog.cpp @@ -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())); } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 6ca3260..385f376 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -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); } } diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 05eb78e..b269b04 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -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; diff --git a/src/gui/partitionmanagerwidget.cpp b/src/gui/partitionmanagerwidget.cpp index 663a328..a9fecec 100644 --- a/src/gui/partitionmanagerwidget.cpp +++ b/src/gui/partitionmanagerwidget.cpp @@ -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() diff --git a/src/gui/partitionmanagerwidget.h b/src/gui/partitionmanagerwidget.h index 8c94ead..778526e 100644 --- a/src/gui/partitionmanagerwidget.h +++ b/src/gui/partitionmanagerwidget.h @@ -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; diff --git a/src/gui/partpropsdialog.cpp b/src/gui/partpropsdialog.cpp index 1a169b0..b0e29d5 100644 --- a/src/gui/partpropsdialog.cpp +++ b/src/gui/partpropsdialog.cpp @@ -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()); diff --git a/src/gui/sizedialogbase.cpp b/src/gui/sizedialogbase.cpp index 8b01a9b..aefb137 100644 --- a/src/gui/sizedialogbase.cpp +++ b/src/gui/sizedialogbase.cpp @@ -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() diff --git a/src/gui/sizedialogbase.h b/src/gui/sizedialogbase.h index 519ec00..bf61826 100644 --- a/src/gui/sizedialogbase.h +++ b/src/gui/sizedialogbase.h @@ -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; diff --git a/src/gui/smartdialog.cpp b/src/gui/smartdialog.cpp index 6d97519..7f6b93d 100644 --- a/src/gui/smartdialog.cpp +++ b/src/gui/smartdialog.cpp @@ -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 diff --git a/src/gui/smartdialog.h b/src/gui/smartdialog.h index 2e51a84..da45cd8 100644 --- a/src/gui/smartdialog.h +++ b/src/gui/smartdialog.h @@ -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(); diff --git a/src/gui/smartdialogwidget.cpp b/src/gui/smartdialogwidget.cpp index 655c24f..a63a69d 100644 --- a/src/gui/smartdialogwidget.cpp +++ b/src/gui/smartdialogwidget.cpp @@ -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) diff --git a/src/gui/smartdialogwidget.h b/src/gui/smartdialogwidget.h index 270eb93..4e6f094 100644 --- a/src/gui/smartdialogwidget.h +++ b/src/gui/smartdialogwidget.h @@ -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: diff --git a/src/gui/treelog.cpp b/src/gui/treelog.cpp index fa89d92..14e9f05 100644 --- a/src/gui/treelog.cpp +++ b/src/gui/treelog.cpp @@ -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); } diff --git a/src/gui/treelog.h b/src/gui/treelog.h index 679710a..ef09d64 100644 --- a/src/gui/treelog.h +++ b/src/gui/treelog.h @@ -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;