| 20 | namespace advss { |
| 21 | |
| 22 | static void showBackupDialogs(const QString &json) |
| 23 | { |
| 24 | const bool backupWasConfirmed = DisplayMessage( |
| 25 | obs_module_text("AdvSceneSwitcher.askBackup"), true, false); |
| 26 | |
| 27 | if (!backupWasConfirmed) { |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | QString path = QFileDialog::getSaveFileName( |
| 32 | nullptr, |
| 33 | obs_module_text( |
| 34 | "AdvSceneSwitcher.generalTab.saveOrLoadsettings.exportWindowTitle"), |
| 35 | GetDefaultSettingsSaveLocation(), |
| 36 | obs_module_text( |
| 37 | "AdvSceneSwitcher.generalTab.saveOrLoadsettings.textType")); |
| 38 | if (path.isEmpty()) { |
| 39 | return; |
| 40 | } |
| 41 | |
| 42 | QFile file(path); |
| 43 | if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { |
| 44 | return; |
| 45 | } |
| 46 | auto out = QTextStream(&file); |
| 47 | out << json; |
| 48 | } |
| 49 | |
| 50 | void AskForBackup(obs_data_t *settings) |
| 51 | { |
no test coverage detected