| 171 | } |
| 172 | |
| 173 | QWidget *OptionsDialog::createGeneralTab() |
| 174 | { |
| 175 | auto *languageBox = new QGroupBox(tr("Language")); |
| 176 | auto *languageLayout = new QHBoxLayout(); |
| 177 | languageLayout->addWidget(new QLabel(tr("Application language"))); |
| 178 | languageCombo = new QComboBox(this); |
| 179 | languageCombo->addItem(tr("System default"), QString()); |
| 180 | const auto availableLanguages = YACReader::UiLanguage::availableLanguages("yacreaderlibrary"); |
| 181 | for (const auto &language : availableLanguages) { |
| 182 | languageCombo->addItem( |
| 183 | QString("%1 (%2)").arg(language.displayName, language.code), language.code); |
| 184 | } |
| 185 | languageLayout->addWidget(languageCombo); |
| 186 | languageBox->setLayout(languageLayout); |
| 187 | |
| 188 | // Tray icon settings |
| 189 | QGroupBox *trayIconBox = new QGroupBox(tr("Tray icon settings (experimental)")); |
| 190 | QVBoxLayout *trayLayout = new QVBoxLayout(); |
| 191 | |
| 192 | trayIconCheckbox = new QCheckBox(tr("Close to tray")); |
| 193 | startToTrayCheckbox = new QCheckBox(tr("Start into the system tray")); |
| 194 | |
| 195 | connect(trayIconCheckbox, &QCheckBox::clicked, this, |
| 196 | [=](bool checked) { |
| 197 | settings->setValue(CLOSE_TO_TRAY, checked); |
| 198 | startToTrayCheckbox->setEnabled(checked); |
| 199 | emit optionsChanged(); |
| 200 | }); |
| 201 | connect(startToTrayCheckbox, &QCheckBox::clicked, this, |
| 202 | [=](bool checked) { |
| 203 | settings->setValue(START_TO_TRAY, checked); |
| 204 | }); |
| 205 | |
| 206 | trayLayout->addWidget(trayIconCheckbox); |
| 207 | trayLayout->addWidget(startToTrayCheckbox); |
| 208 | trayIconBox->setLayout(trayLayout); |
| 209 | |
| 210 | auto apiKeyLayout = new QVBoxLayout(); |
| 211 | auto apiKeyButton = new QPushButton(tr("Edit Comic Vine API key")); |
| 212 | apiKeyLayout->addWidget(apiKeyButton); |
| 213 | |
| 214 | auto apiKeyBox = new QGroupBox(tr("Comic Vine API key")); |
| 215 | apiKeyBox->setLayout(apiKeyLayout); |
| 216 | |
| 217 | connect(apiKeyButton, &QAbstractButton::clicked, this, &OptionsDialog::editApiKey); |
| 218 | |
| 219 | auto comicInfoXMLBox = new QGroupBox(tr("ComicInfo.xml legacy support")); |
| 220 | |
| 221 | comicInfoXMLCheckbox = new QCheckBox(tr("Import metadata from ComicInfo.xml when adding new comics")); |
| 222 | connect(comicInfoXMLCheckbox, &QCheckBox::clicked, this, |
| 223 | [=](bool checked) { |
| 224 | settings->setValue(IMPORT_COMIC_INFO_XML_METADATA, checked); |
| 225 | }); |
| 226 | |
| 227 | auto comicInfoXMLBoxLayout = new QVBoxLayout(); |
| 228 | comicInfoXMLBoxLayout->addWidget(comicInfoXMLCheckbox); |
| 229 | comicInfoXMLBox->setLayout(comicInfoXMLBoxLayout); |
| 230 |
nothing calls this directly
no test coverage detected