2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Remove Session::Exists() global access point.

This commit is contained in:
John Preston
2020-06-10 17:24:41 +04:00
parent 5f8d22f1f2
commit 598fb67cdf
19 changed files with 119 additions and 133 deletions

View File

@@ -163,18 +163,19 @@ auto GenerateCodes() {
return;
}
const auto weak = base::make_weak(&window->session());
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open audio file", audioFilters, crl::guard(&window->session(), [=](const FileDialog::OpenResult &result) {
if (Main::Session::Exists() && !result.paths.isEmpty()) {
if (weak && !result.paths.isEmpty()) {
auto track = Media::Audio::Current().createTrack();
track->fillFromFile(result.paths.front());
if (track->failed()) {
Ui::show(Box<InformBox>(
"Could not audio :( Errors in 'log.txt'."));
} else {
window->session().settings().setSoundOverride(
weak->settings().setSoundOverride(
key,
result.paths.front());
window->session().saveSettingsDelayed();
weak->saveSettingsDelayed();
}
}
}));