void MediaView::onSave() { if (!_photo || !_photo->full->loaded()) return; QString file; if (filedialogGetSaveFile(file, lang(lng_save_photo), qsl("JPEG Image (*.jpg);;All files (*.*)"), filedialogDefaultName(qsl("photo"), qsl(".jpg")))) { if (!file.isEmpty()) { _photo->full->pix().toImage().save(file, "JPG"); } } }
bool filedialogGetSaveFile( QString &file, const QString &caption, const QString &filter, const QString &initialPath) { return filedialogGetSaveFile( Messenger::Instance().getFileDialogParent(), file, caption, filter, initialPath); }
void GetWritePath( QPointer<QWidget> parent, const QString &caption, const QString &filter, const QString &initialPath, Fn<void(QString &&result)> callback, Fn<void()> failed) { InvokeQueued(QApplication::instance(), [=] { auto file = QString(); if (filedialogGetSaveFile(parent, file, caption, filter, initialPath)) { if (callback) { callback(std::move(file)); } } else if (failed) { failed(); } }); }