| 392 | } |
| 393 | |
| 394 | void DialogSettings::onApply() const |
| 395 | { |
| 396 | buttonApply->setEnabled(false); |
| 397 | |
| 398 | bool themeChanged = settings->data.MainTheme != themeCombo->currentText(); |
| 399 | bool fontChanged = settings->data.FontSize != fontSizeSpin->value() || settings->data.FontFamily != fontFamilyCombo->currentText(); |
| 400 | |
| 401 | if(themeChanged) { |
| 402 | settings->data.MainTheme = themeCombo->currentText(); |
| 403 | |
| 404 | if (auto* style = settings->getMainAdaptix()->qlementineStyle) { |
| 405 | QString userPath = userAppThemeDir() + "/" + settings->data.MainTheme + ".json"; |
| 406 | QString themePath = QFile::exists(userPath) ? userPath : QString(":/qlementine-themes/%1").arg(settings->data.MainTheme); |
| 407 | style->setThemeJsonPath(themePath); |
| 408 | } |
| 409 | |
| 410 | TitleBarStyle::applyForTheme(settings->getMainAdaptix()->mainUI, settings->data.MainTheme); |
| 411 | } |
| 412 | |
| 413 | if(fontChanged) { |
| 414 | settings->data.FontSize = fontSizeSpin->value(); |
| 415 | settings->data.FontFamily = fontFamilyCombo->currentText(); |
| 416 | } |
| 417 | |
| 418 | if(themeChanged || fontChanged) { |
| 419 | settings->getMainAdaptix()->ApplyApplicationFont(); |
| 420 | } |
| 421 | |
| 422 | if (settings->data.GraphVersion != graphCombo1->currentText()) { |
| 423 | settings->data.GraphVersion = graphCombo1->currentText(); |
| 424 | settings->getMainAdaptix()->mainUI->UpdateGraphIcons(); |
| 425 | } |
| 426 | |
| 427 | settings->data.RemoteTerminalBufferSize = terminalSizeSpin->value(); |
| 428 | |
| 429 | settings->data.ConsoleBufferSize = consoleSizeSpin->value(); |
| 430 | settings->data.ConsoleTime = consoleTimeCheckbox->isChecked(); |
| 431 | settings->data.ConsoleNoWrap = consoleNoWrapCheckbox->isChecked(); |
| 432 | settings->data.ConsoleAutoScroll = consoleAutoScrollCheckbox->isChecked(); |
| 433 | |
| 434 | bool bgChanged = settings->data.ConsoleShowBackground != consoleShowBackgroundCheckbox->isChecked(); |
| 435 | settings->data.ConsoleShowBackground = consoleShowBackgroundCheckbox->isChecked(); |
| 436 | |
| 437 | if (settings->data.ConsoleTheme != consoleThemeCombo->currentText() || bgChanged) { |
| 438 | settings->data.ConsoleTheme = consoleThemeCombo->currentText(); |
| 439 | ConsoleThemeManager::instance().loadTheme(settings->data.ConsoleTheme); |
| 440 | } |
| 441 | |
| 442 | bool updateTable = false; |
| 443 | for ( int i = 0; i < sessionsCheckCount; i++) { |
| 444 | if (settings->data.SessionsTableColumns[i] != sessionsCheck[i]->isChecked()) { |
| 445 | settings->data.SessionsTableColumns[i] = sessionsCheck[i]->isChecked(); |
| 446 | updateTable = true; |
| 447 | } |
| 448 | } |
| 449 | if (updateTable) |
| 450 | settings->getMainAdaptix()->mainUI->UpdateSessionsTableColumns(); |
| 451 |
nothing calls this directly
no test coverage detected