2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Removed legacy FileDialog::query* methods.

Everything is done easier and better through the FileDialog::Get*.
This commit is contained in:
John Preston
2017-02-28 18:43:03 +03:00
parent f8318177b9
commit 12705c9065
23 changed files with 359 additions and 626 deletions

View File

@@ -741,7 +741,7 @@ void MediaView::onSaveAs() {
if (pattern.isEmpty()) {
filter = QString();
} else {
filter = mimeType.filterString() + qsl(";;") + filedialogAllFilesFilter();
filter = mimeType.filterString() + qsl(";;") + FileDialog::AllFilesFilter();
}
psBringToBack(this);
@@ -772,14 +772,15 @@ void MediaView::onSaveAs() {
if (!_photo || !_photo->loaded()) return;
psBringToBack(this);
auto filter = qsl("JPEG Image (*.jpg);;") + filedialogAllFilesFilter();
auto gotName = filedialogGetSaveFile(file, lang(lng_save_photo), filter, filedialogDefaultName(qsl("photo"), qsl(".jpg")));
psShowOverAll(this);
if (gotName) {
if (!file.isEmpty()) {
_photo->full->pix().toImage().save(file, "JPG");
auto filter = qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter();
FileDialog::GetWritePath(lang(lng_save_photo), filter, filedialogDefaultName(qsl("photo"), qsl(".jpg")), base::lambda_guarded(this, [this, photo = _photo](const QString &result) {
if (!result.isEmpty() && _photo == photo && photo->loaded()) {
photo->full->pix().toImage().save(result, "JPG");
}
}
psShowOverAll(this);
}), base::lambda_guarded(this, [this] {
psShowOverAll(this);
}));
}
activateWindow();
Sandbox::setActiveWindow(this);