diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1.0) project(kamera) # KDE Application Version, managed by release script @@ -8,6 +8,10 @@ set(KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") set(PROJECT_VERSION ${KDE_APPLICATIONS_VERSION}) +# At least C++14 is required +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + find_package(ECM REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}) include(KDEInstallDirs) diff --git a/kcontrol/kamera.cpp b/kcontrol/kamera.cpp --- a/kcontrol/kamera.cpp +++ b/kcontrol/kamera.cpp @@ -110,62 +110,62 @@ m_deviceSel->setModel(m_deviceModel); - connect(m_deviceSel, SIGNAL(customContextMenuRequested(QPoint)), - SLOT(slot_deviceMenu(QPoint))); - connect(m_deviceSel, SIGNAL(doubleClicked(QModelIndex)), - SLOT(slot_configureCamera())); - connect(m_deviceSel, SIGNAL(activated(QModelIndex)), - SLOT(slot_deviceSelected(QModelIndex))); - connect(m_deviceSel, SIGNAL(clicked(QModelIndex)), - SLOT(slot_deviceSelected(QModelIndex))); + connect(m_deviceSel, &QListView::customContextMenuRequested, + this, &KKameraConfig::slot_deviceMenu); + connect(m_deviceSel, &QListView::doubleClicked, + this, &KKameraConfig::slot_configureCamera); + connect(m_deviceSel, &QListView::activated, + this, &KKameraConfig::slot_deviceSelected); + connect(m_deviceSel, &QListView::clicked, + this, &KKameraConfig::slot_deviceSelected); m_deviceSel->setViewMode(QListView::IconMode); - m_deviceSel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + m_deviceSel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_deviceSel->setContextMenuPolicy(Qt::CustomContextMenu); // create actions, add to the toolbar QAction *act; act = m_actions->addAction("camera_add"); - act->setIcon(QIcon::fromTheme("camera-photo")); - act->setText(i18n("Add")); - connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_addCamera())); + act->setIcon(QIcon::fromTheme("camera-photo")); + act->setText(i18n("Add")); + connect(act, &QAction::triggered, this, &KKameraConfig::slot_addCamera); act->setWhatsThis(i18n("Click this button to add a new camera.")); m_toolbar->addAction(act); m_toolbar->addSeparator(); act = m_actions->addAction("camera_test"); - act->setIcon(QIcon::fromTheme("dialog-ok")); - act->setText(i18n("Test")); - connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_testCamera())); + act->setIcon(QIcon::fromTheme("dialog-ok")); + act->setText(i18n("Test")); + connect(act, &QAction::triggered, this, &KKameraConfig::slot_testCamera); act->setWhatsThis(i18n("Click this button to test the connection to the selected camera.")); m_toolbar->addAction(act); act = m_actions->addAction("camera_remove"); - act->setIcon(QIcon::fromTheme("user-trash")); - act->setText(i18n("Remove")); - connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_removeCamera())); + act->setIcon(QIcon::fromTheme("user-trash")); + act->setText(i18n("Remove")); + connect(act, &QAction::triggered, this, &KKameraConfig::slot_removeCamera); act->setWhatsThis(i18n("Click this button to remove the selected camera from the list.")); m_toolbar->addAction(act); act = m_actions->addAction("camera_configure"); - act->setIcon(QIcon::fromTheme("configure")); - act->setText(i18n("Configure...")); - connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_configureCamera())); + act->setIcon(QIcon::fromTheme("configure")); + act->setText(i18n("Configure...")); + connect(act, &QAction::triggered, this, &KKameraConfig::slot_configureCamera); act->setWhatsThis(i18n("Click this button to change the configuration of the selected camera.

The availability of this feature and the contents of the Configuration dialog depend on the camera model.")); m_toolbar->addAction(act); act = m_actions->addAction("camera_summary"); - act->setIcon(QIcon::fromTheme("hwinfo")); - act->setText(i18n("Information")); - connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_cameraSummary())); + act->setIcon(QIcon::fromTheme("hwinfo")); + act->setText(i18n("Information")); + connect(act, &QAction::triggered, this, &KKameraConfig::slot_cameraSummary); act->setWhatsThis(i18n("Click this button to view a summary of the current status of the selected camera.

The availability of this feature and the contents of the Information dialog depend on the camera model.")); m_toolbar->addAction(act); m_toolbar->addSeparator(); act = m_actions->addAction("camera_cancel"); - act->setIcon(QIcon::fromTheme("process-stop")); - act->setText(i18n("Cancel")); - connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_cancelOperation())); + act->setIcon(QIcon::fromTheme("process-stop")); + act->setText(i18n("Cancel")); + connect(act, &QAction::triggered, this, &KKameraConfig::slot_cancelOperation); act->setWhatsThis(i18n("Click this button to cancel the current camera operation.")); act->setEnabled(false); m_toolbar->addAction(act); @@ -202,27 +202,31 @@ { QStringList groupList = m_config->groupList(); - QStringList::Iterator it; - int i, count; - CameraList *list; - CameraAbilitiesList *al; - GPPortInfoList *il; - const char *model, *value; + QStringList::Iterator it; + int i, count; + CameraList *list; + CameraAbilitiesList *al; + GPPortInfoList *il; + const char *model, *value; KCamera *kcamera; for (it = groupList.begin(); it != groupList.end(); it++) { if (*it != "") { KConfigGroup cg(m_config, *it); - if (cg.readEntry("Path").contains("usb:")) { + if (cg.readEntry("Path").contains("usb:")) { continue; - } + } - // Load configuration for Serial port cameras - qCDebug(KAMERA_KCONTROL) << "Loading configuration for serial port camera: " + // Load configuration for Serial port cameras + qCDebug(KAMERA_KCONTROL) << "Loading configuration for serial port camera: " << *it; kcamera = new KCamera(*it, cg.readEntry("Path")); - connect(kcamera, SIGNAL(error(QString)), SLOT(slot_error(QString))); - connect(kcamera, SIGNAL(error(QString,QString)), SLOT(slot_error(QString,QString))); + connect(kcamera, qOverload(&KCamera::error), + this, qOverload(&KKameraConfig::slot_error)); + + connect(kcamera, qOverload(&KCamera::error), + this, qOverload(&KKameraConfig::slot_error)); + kcamera->load(m_config); m_devices[*it] = kcamera; } @@ -231,15 +235,15 @@ gp_list_new (&list); - gp_abilities_list_new (&al); - gp_abilities_list_load (al, m_context); - gp_port_info_list_new (&il); - gp_port_info_list_load (il); - gp_abilities_list_detect (al, il, list, m_context); - gp_abilities_list_free (al); - gp_port_info_list_free (il); + gp_abilities_list_new (&al); + gp_abilities_list_load (al, m_context); + gp_port_info_list_new (&il); + gp_port_info_list_load (il); + gp_abilities_list_detect (al, il, list, m_context); + gp_abilities_list_free (al); + gp_port_info_list_free (il); - count = gp_list_count (list); + count = gp_list_count (list); QMap ports, names; @@ -248,24 +252,29 @@ gp_list_get_value (list, i, &value); ports[value] = model; - if (!strcmp(value,"usb:")) { + if (!strcmp(value,"usb:")) { names[model] = value; - } + } } - if (ports.contains("usb:") && names[ports["usb:"]]!="usb:") { + if (ports.contains("usb:") && names[ports["usb:"]]!="usb:") { ports.remove("usb:"); - } + } QMap::iterator portit; for (portit = ports.begin() ; portit != ports.end(); portit++) { - qCDebug(KAMERA_KCONTROL) << "Adding USB camera: " << portit.value() << " at " << portit.key(); + qCDebug(KAMERA_KCONTROL) << "Adding USB camera: " << portit.value() << " at " << portit.key(); kcamera = new KCamera(portit.value(), portit.key()); - connect(kcamera, SIGNAL(error(QString)), SLOT(slot_error(QString))); - connect(kcamera, SIGNAL(error(QString,QString)), SLOT(slot_error(QString,QString))); - m_devices[portit.value()] = kcamera; + + connect(kcamera, qOverload(&KCamera::error), + this, qOverload(&KKameraConfig::slot_error)); + + connect(kcamera, qOverload(&KCamera::error), + this, qOverload(&KKameraConfig::slot_error)); + + m_devices[portit.value()] = kcamera; } populateDeviceListView(); @@ -319,8 +328,13 @@ void KKameraConfig::slot_addCamera() { KCamera *m_device = new KCamera(QString::null, QString()); //krazy:exclusion=nullstrassign for old broken gcc - connect(m_device, SIGNAL(error(QString)), SLOT(slot_error(QString))); - connect(m_device, SIGNAL(error(QString,QString)), SLOT(slot_error(QString,QString))); + + connect(m_device, qOverload(&KCamera::error), + this, qOverload(&KKameraConfig::slot_error)); + + connect(m_device, qOverload(&KCamera::error), + this, qOverload(&KKameraConfig::slot_error)); + KameraDeviceSelectDialog dialog(this, m_device); if (dialog.exec() == QDialog::Accepted) { dialog.save(); diff --git a/kcontrol/kameraconfigdialog.cpp b/kcontrol/kameraconfigdialog.cpp --- a/kcontrol/kameraconfigdialog.cpp +++ b/kcontrol/kameraconfigdialog.cpp @@ -62,8 +62,8 @@ okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &KameraConfigDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &KameraConfigDialog::reject); okButton->setDefault(true); setModal( true ); @@ -78,7 +78,7 @@ appendWidget(main, widget); - connect(okButton,SIGNAL(clicked()),this,SLOT(slotOk())); + connect(okButton, &QPushButton::clicked, this, &KameraConfigDialog::slotOk); mainLayout->addWidget(buttonBox); } diff --git a/kcontrol/kameradevice.cpp b/kcontrol/kameradevice.cpp --- a/kcontrol/kameradevice.cpp +++ b/kcontrol/kameradevice.cpp @@ -300,10 +300,11 @@ setModal( true ); m_device = device; - connect(m_device, SIGNAL(error(QString)), - SLOT(slot_error(QString))); - connect(m_device, SIGNAL(error(QString,QString)), - SLOT(slot_error(QString,QString))); + connect(m_device, qOverload(&KCamera::error), + this, qOverload(&KameraDeviceSelectDialog::slot_error)); + + connect(m_device, qOverload(&KCamera::error), + this, qOverload(&KameraDeviceSelectDialog::slot_error)); QWidget *page = new QWidget( this ); @@ -320,10 +321,9 @@ m_modelSel->setModel(m_model); topLayout->addWidget( m_modelSel ); - connect(m_modelSel, SIGNAL(activated(QModelIndex)), - SLOT(slot_setModel(QModelIndex))); - connect(m_modelSel, SIGNAL(clicked(QModelIndex)), - SLOT(slot_setModel(QModelIndex))); + connect(m_modelSel, &QListView::activated, this, &KameraDeviceSelectDialog::slot_setModel); + connect(m_modelSel, &QListView::clicked, this, &KameraDeviceSelectDialog::slot_setModel); + // make sure listview only as wide as it needs to be m_modelSel->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred)); @@ -362,10 +362,9 @@ lay->addWidget(grid2); lay->addWidget( m_settingsStack ); - connect(m_serialRB, SIGNAL(toggled(bool)), - this, SLOT(changeCurrentIndex()) ); - connect(m_USBRB, SIGNAL(toggled(bool)), - this, SLOT(changeCurrentIndex()) ); + connect(m_serialRB, &QRadioButton::toggled, this, &KameraDeviceSelectDialog::changeCurrentIndex); + connect(m_USBRB, &QRadioButton::toggled, this, &KameraDeviceSelectDialog::changeCurrentIndex); + // none tab m_settingsStack->insertWidget(INDEX_NONE, new QLabel(i18n("No port type selected."), @@ -400,8 +399,8 @@ // to enableButtonOk(true) in slot_setModel. okButton->setEnabled(false); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); - connect(okButton, SIGNAL(clicked(bool)), SLOT(accept())); - connect(cancelButton, SIGNAL(clicked(bool)), SLOT(close())); + connect(okButton, &QPushButton::clicked, this, &KameraDeviceSelectDialog::accept); + connect(cancelButton, &QPushButton::clicked, this, &KameraDeviceSelectDialog::close); rightLayout->addWidget(m_OkCancelButtonBox); // query gphoto2 for existing serial ports