| 569 | } |
| 570 | |
| 571 | void OptionsDialog::init() |
| 572 | { |
| 573 | // Make the scroll area share the Tab Widget background color |
| 574 | ui.optionsScrollArea->setStyleSheet("QScrollArea { background-color: transparent; } #scrollAreaWidgetContents { background-color: transparent; }"); |
| 575 | |
| 576 | ui.browsePushButton->setIcon(os::icon("folder")); |
| 577 | ui.namingOptionsButton->setIcon(os::icon("configure")); |
| 578 | |
| 579 | // Export/Import menu . |
| 580 | QMenu *optionsMenu = new QMenu(tr("Options")); |
| 581 | |
| 582 | QAction *exportAction = new QAction(tr("&Export.."), optionsMenu); |
| 583 | connect(exportAction, &QAction::triggered, this, &OptionsDialog::exportSettings); |
| 584 | |
| 585 | QAction *importAction = new QAction(tr("&Import.."), optionsMenu); |
| 586 | connect(importAction, &QAction::triggered, this, &OptionsDialog::importSettings); |
| 587 | |
| 588 | QAction *restoreAction = new QAction(tr("&Restore Defaults"), optionsMenu); |
| 589 | connect(restoreAction, &QAction::triggered, this, &OptionsDialog::restoreDefaults); |
| 590 | |
| 591 | optionsMenu->addAction(exportAction); |
| 592 | optionsMenu->addAction(importAction); |
| 593 | optionsMenu->addSeparator(); |
| 594 | optionsMenu->addAction(restoreAction); |
| 595 | |
| 596 | QPushButton *optionsButton = new QPushButton(tr("Options"), this); |
| 597 | optionsButton->setMenu(optionsMenu); |
| 598 | ui.buttonBox->addButton(optionsButton, QDialogButtonBox::ResetRole); |
| 599 | |
| 600 | // Set up the autocomplete for the directory. |
| 601 | QCompleter *completer = new QCompleter(this); |
| 602 | completer->setModel(new QDirModel(QStringList(), QDir::Dirs, QDir::Name, completer)); |
| 603 | ui.targetLineEdit->setCompleter(completer); |
| 604 | |
| 605 | // HotkeyWidget icons. |
| 606 | ui.screenHotkeyWidget->setIcon(os::icon("screen")); |
| 607 | ui.windowHotkeyWidget->setIcon(os::icon("window")); |
| 608 | ui.windowPickerHotkeyWidget->setIcon(os::icon("pickWindow")); |
| 609 | ui.areaHotkeyWidget->setIcon(os::icon("area")); |
| 610 | ui.openHotkeyWidget->setIcon(QIcon(":/icons/lightscreen.small")); |
| 611 | ui.directoryHotkeyWidget->setIcon(os::icon("folder")); |
| 612 | |
| 613 | // Version |
| 614 | ui.versionLabel->setText(tr("Version %1").arg(qApp->applicationVersion())); |
| 615 | |
| 616 | ui.uploadSslWarningLabel->setVisible(false); |
| 617 | |
| 618 | // Run the SSL check in another thread (slows down dialog startup considerably). |
| 619 | auto futureWatcher = new QFutureWatcher<bool>(this); |
| 620 | connect(futureWatcher, &QFutureWatcher<bool>::finished, futureWatcher, &QFutureWatcher<bool>::deleteLater); |
| 621 | connect(futureWatcher, &QFutureWatcher<bool>::finished, this, [&, futureWatcher] { |
| 622 | ui.uploadSslWarningLabel->setVisible(!futureWatcher->future().result()); |
| 623 | }); |
| 624 | |
| 625 | futureWatcher->setFuture(QtConcurrent::run([]() -> bool { return QSslSocket::supportsSsl(); })); |
| 626 | |
| 627 | // |
| 628 | // Connections |