Changeset View
Changeset View
Standalone View
Standalone View
kcontrol/kameradevice.cpp
Show First 20 Lines • Show All 294 Lines • ▼ Show 20 Line(s) | |||||
295 | 295 | | |||
296 | KameraDeviceSelectDialog::KameraDeviceSelectDialog(QWidget *parent, KCamera *device) | 296 | KameraDeviceSelectDialog::KameraDeviceSelectDialog(QWidget *parent, KCamera *device) | ||
297 | : QDialog(parent) | 297 | : QDialog(parent) | ||
298 | { | 298 | { | ||
299 | setWindowTitle( i18n("Select Camera Device") ); | 299 | setWindowTitle( i18n("Select Camera Device") ); | ||
300 | 300 | | |||
301 | setModal( true ); | 301 | setModal( true ); | ||
302 | m_device = device; | 302 | m_device = device; | ||
303 | connect(m_device, SIGNAL(error(QString)), | 303 | connect(m_device, qOverload<const QString&>(&KCamera::error), | ||
304 | SLOT(slot_error(QString))); | 304 | this, qOverload<const QString&>(&KameraDeviceSelectDialog::slot_error)); | ||
Petross404: I didn't notice this earlier. Should I fix this? | |||||
305 | connect(m_device, SIGNAL(error(QString,QString)), | 305 | | ||
306 | SLOT(slot_error(QString,QString))); | 306 | connect(m_device, qOverload<const QString&, const QString&>(&KCamera::error), | ||
307 | this, qOverload<const QString&, const QString&>(&KameraDeviceSelectDialog::slot_error)); | ||||
307 | 308 | | |||
308 | QWidget *page = new QWidget( this ); | 309 | QWidget *page = new QWidget( this ); | ||
309 | 310 | | |||
310 | // a layout with horizontal boxes - this gives the two columns | 311 | // a layout with horizontal boxes - this gives the two columns | ||
311 | QHBoxLayout *topLayout = new QHBoxLayout(page); | 312 | QHBoxLayout *topLayout = new QHBoxLayout(page); | ||
312 | topLayout->setContentsMargins(0, 0, 0, 0); | 313 | topLayout->setContentsMargins(0, 0, 0, 0); | ||
313 | 314 | | |||
314 | // the models list | 315 | // the models list | ||
315 | m_modelSel = new QListView(page); | 316 | m_modelSel = new QListView(page); | ||
316 | m_model = new QStandardItemModel(this); | 317 | m_model = new QStandardItemModel(this); | ||
317 | m_model->setColumnCount(1); | 318 | m_model->setColumnCount(1); | ||
318 | m_model->setHeaderData(0, Qt::Horizontal, | 319 | m_model->setHeaderData(0, Qt::Horizontal, | ||
319 | i18nc("@title:column", "Supported Cameras")); | 320 | i18nc("@title:column", "Supported Cameras")); | ||
320 | m_modelSel->setModel(m_model); | 321 | m_modelSel->setModel(m_model); | ||
321 | 322 | | |||
322 | topLayout->addWidget( m_modelSel ); | 323 | topLayout->addWidget( m_modelSel ); | ||
323 | connect(m_modelSel, SIGNAL(activated(QModelIndex)), | 324 | connect(m_modelSel, &QListView::activated, this, &KameraDeviceSelectDialog::slot_setModel); | ||
324 | SLOT(slot_setModel(QModelIndex))); | 325 | connect(m_modelSel, &QListView::clicked, this, &KameraDeviceSelectDialog::slot_setModel); | ||
325 | connect(m_modelSel, SIGNAL(clicked(QModelIndex)), | 326 | | ||
326 | SLOT(slot_setModel(QModelIndex))); | | |||
327 | // make sure listview only as wide as it needs to be | 327 | // make sure listview only as wide as it needs to be | ||
328 | m_modelSel->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, | 328 | m_modelSel->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, | ||
329 | QSizePolicy::Preferred)); | 329 | QSizePolicy::Preferred)); | ||
330 | 330 | | |||
331 | QVBoxLayout *rightLayout = new QVBoxLayout(); | 331 | QVBoxLayout *rightLayout = new QVBoxLayout(); | ||
332 | rightLayout->setContentsMargins(0, 0, 0, 0); | 332 | rightLayout->setContentsMargins(0, 0, 0, 0); | ||
333 | topLayout->addLayout( rightLayout ); | 333 | topLayout->addLayout( rightLayout ); | ||
334 | 334 | | |||
Show All 22 Lines | |||||
357 | QWidget *grid2 = new QWidget(m_settingsStack); | 357 | QWidget *grid2 = new QWidget(m_settingsStack); | ||
358 | QGridLayout *gridLayout2 = new QGridLayout(grid2); | 358 | QGridLayout *gridLayout2 = new QGridLayout(grid2); | ||
359 | grid2->setLayout(gridLayout2); | 359 | grid2->setLayout(gridLayout2); | ||
360 | QLabel *label2 = new QLabel(i18n("Port"), grid2); | 360 | QLabel *label2 = new QLabel(i18n("Port"), grid2); | ||
361 | gridLayout2->addWidget(label2, 0, 0, Qt::AlignLeft); | 361 | gridLayout2->addWidget(label2, 0, 0, Qt::AlignLeft); | ||
362 | 362 | | |||
363 | lay->addWidget(grid2); | 363 | lay->addWidget(grid2); | ||
364 | lay->addWidget( m_settingsStack ); | 364 | lay->addWidget( m_settingsStack ); | ||
365 | connect(m_serialRB, SIGNAL(toggled(bool)), | 365 | connect(m_serialRB, &QRadioButton::toggled, this, &KameraDeviceSelectDialog::changeCurrentIndex); | ||
366 | this, SLOT(changeCurrentIndex()) ); | 366 | connect(m_USBRB, &QRadioButton::toggled, this, &KameraDeviceSelectDialog::changeCurrentIndex); | ||
367 | connect(m_USBRB, SIGNAL(toggled(bool)), | 367 | | ||
368 | this, SLOT(changeCurrentIndex()) ); | | |||
369 | // none tab | 368 | // none tab | ||
370 | m_settingsStack->insertWidget(INDEX_NONE, | 369 | m_settingsStack->insertWidget(INDEX_NONE, | ||
371 | new QLabel(i18n("No port type selected."), | 370 | new QLabel(i18n("No port type selected."), | ||
372 | m_settingsStack)); | 371 | m_settingsStack)); | ||
373 | 372 | | |||
374 | // serial tab | 373 | // serial tab | ||
375 | QWidget *grid = new QWidget(m_settingsStack); | 374 | QWidget *grid = new QWidget(m_settingsStack); | ||
376 | QGridLayout *gridLayout = new QGridLayout(grid); | 375 | QGridLayout *gridLayout = new QGridLayout(grid); | ||
Show All 18 Lines | 393 | m_OkCancelButtonBox = new QDialogButtonBox( | |||
395 | QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | 394 | QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | ||
396 | QPushButton *okButton = m_OkCancelButtonBox->button(QDialogButtonBox::Ok); | 395 | QPushButton *okButton = m_OkCancelButtonBox->button(QDialogButtonBox::Ok); | ||
397 | QPushButton *cancelButton = m_OkCancelButtonBox->button(QDialogButtonBox::Cancel); | 396 | QPushButton *cancelButton = m_OkCancelButtonBox->button(QDialogButtonBox::Cancel); | ||
398 | okButton->setDefault(true); | 397 | okButton->setDefault(true); | ||
399 | // Set false enabled to allow the use of an equivalent | 398 | // Set false enabled to allow the use of an equivalent | ||
400 | // to enableButtonOk(true) in slot_setModel. | 399 | // to enableButtonOk(true) in slot_setModel. | ||
401 | okButton->setEnabled(false); | 400 | okButton->setEnabled(false); | ||
402 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); | 401 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); | ||
403 | connect(okButton, SIGNAL(clicked(bool)), SLOT(accept())); | 402 | connect(okButton, &QPushButton::clicked, this, &KameraDeviceSelectDialog::accept); | ||
404 | connect(cancelButton, SIGNAL(clicked(bool)), SLOT(close())); | 403 | connect(cancelButton, &QPushButton::clicked, this, &KameraDeviceSelectDialog::close); | ||
405 | rightLayout->addWidget(m_OkCancelButtonBox); | 404 | rightLayout->addWidget(m_OkCancelButtonBox); | ||
406 | 405 | | |||
407 | // query gphoto2 for existing serial ports | 406 | // query gphoto2 for existing serial ports | ||
408 | GPPortInfoList *list; | 407 | GPPortInfoList *list; | ||
409 | GPPortInfo info; | 408 | GPPortInfo info; | ||
410 | int gphoto_ports=0; | 409 | int gphoto_ports=0; | ||
411 | gp_port_info_list_new(&list); | 410 | gp_port_info_list_new(&list); | ||
412 | if(gp_port_info_list_load(list) >= 0) { | 411 | if(gp_port_info_list_load(list) >= 0) { | ||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |
I didn't notice this earlier. Should I fix this?