mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Added ability to export chat for html and json formats simultaneously.
This commit is contained in:
parent
ca30c35c2b
commit
29bfe43386
3 changed files with 11 additions and 1 deletions
|
@ -3559,6 +3559,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_export_option_choose_format" = "Choose export format";
|
||||
"lng_export_option_html" = "Human-readable HTML";
|
||||
"lng_export_option_json" = "Machine-readable JSON";
|
||||
"lng_export_option_html_and_json" = "Both";
|
||||
"lng_export_limits" = "From: {from}, to: {till}";
|
||||
"lng_export_beginning" = "the oldest message";
|
||||
"lng_export_end" = "present";
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "export/output/export_output_abstract.h"
|
||||
|
||||
#include "export/output/export_output_html_and_json.h"
|
||||
#include "export/output/export_output_html.h"
|
||||
#include "export/output/export_output_json.h"
|
||||
#include "export/output/export_output_stats.h"
|
||||
|
@ -50,6 +51,7 @@ std::unique_ptr<AbstractWriter> CreateWriter(Format format) {
|
|||
switch (format) {
|
||||
case Format::Html: return std::make_unique<HtmlWriter>();
|
||||
case Format::Json: return std::make_unique<JsonWriter>();
|
||||
case Format::HtmlAndJson: return std::make_unique<HtmlAndJsonWriter>();
|
||||
}
|
||||
Unexpected("Format in Export::Output::CreateWriter.");
|
||||
}
|
||||
|
|
|
@ -75,6 +75,9 @@ void ChooseFormatBox(
|
|||
box->setTitle(tr::lng_export_option_choose_format());
|
||||
addFormatOption(tr::lng_export_option_html(tr::now), Format::Html);
|
||||
addFormatOption(tr::lng_export_option_json(tr::now), Format::Json);
|
||||
addFormatOption(
|
||||
tr::lng_export_option_html_and_json(tr::now),
|
||||
Format::HtmlAndJson);
|
||||
box->addButton(tr::lng_settings_save(), [=] { done(group->value()); });
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
}
|
||||
|
@ -347,7 +350,11 @@ void SettingsWidget::addFormatAndLocationLabel(
|
|||
return data.format;
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::map([](Format format) {
|
||||
const auto text = (format == Format::Html) ? "HTML" : "JSON";
|
||||
const auto text = (format == Format::Html)
|
||||
? "HTML"
|
||||
: (format == Format::Json)
|
||||
? "JSON"
|
||||
: tr::lng_export_option_html_and_json(tr::now);
|
||||
return Ui::Text::Link(text, u"internal:edit_format"_q);
|
||||
});
|
||||
const auto label = container->add(
|
||||
|
|
Loading…
Add table
Reference in a new issue