| 24 | using namespace deskflow::gui; |
| 25 | |
| 26 | SettingsDialog::SettingsDialog(QWidget *parent, const IServerConfig &serverConfig, const CoreProcess &coreProcess) |
| 27 | : QDialog(parent), |
| 28 | ui{std::make_unique<Ui::SettingsDialog>()}, |
| 29 | m_serverConfig(serverConfig), |
| 30 | m_coreProcess(coreProcess) |
| 31 | { |
| 32 | |
| 33 | ui->setupUi(this); |
| 34 | |
| 35 | // set up the language combo |
| 36 | I18N::reDetectLanguages(); |
| 37 | ui->comboLanguage->addItems(I18N::detectedLanguages()); |
| 38 | ui->comboLanguage->setCurrentText(I18N::toNativeName(I18N::currentLanguage())); |
| 39 | |
| 40 | updateText(); |
| 41 | |
| 42 | ui->comboTlsKeyLength->setItemIcon(0, QIcon::fromTheme(QStringLiteral("security-medium"))); |
| 43 | ui->comboTlsKeyLength->setItemIcon(1, QIcon::fromTheme(QIcon::ThemeIcon::SecurityHigh)); |
| 44 | ui->lblTlsCertInfo->setFixedSize(28, 28); |
| 45 | |
| 46 | ui->rbIconMono->setIcon(QIcon::fromTheme(QStringLiteral("%1-symbolic").arg(kRevFqdnName))); |
| 47 | ui->rbIconColorful->setIcon(QIcon::fromTheme(kRevFqdnName)); |
| 48 | |
| 49 | // force the first tab, since qt creator sets the active tab as the last one |
| 50 | // the developer was looking at, and it's easy to accidentally save that. |
| 51 | ui->tabWidget->setCurrentIndex(0); |
| 52 | |
| 53 | // Populate the list of IP addresses |
| 54 | NetworkMonitor networkMonitor(this); |
| 55 | for (const auto &address : networkMonitor.getAvailableIPv4Addresses()) { |
| 56 | QString ipString = address; |
| 57 | if (ui->comboInterface->findText(ipString) == -1) { |
| 58 | ui->comboInterface->addItem(ipString, ipString); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | loadFromConfig(); |
| 63 | |
| 64 | adjustSize(); |
| 65 | QApplication::processEvents(); |
| 66 | setFixedHeight(height()); |
| 67 | setWindowFlags((windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMinMaxButtonsHint); |
| 68 | |
| 69 | initConnections(); |
| 70 | } |
| 71 | |
| 72 | void SettingsDialog::changeEvent(QEvent *e) |
| 73 | { |
nothing calls this directly
no test coverage detected