tdesktop/Telegram/SourceFiles/export/view/export_view_settings.h

119 lines
3.0 KiB
C
Raw Normal View History

2018-06-02 14:29:21 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "export/export_settings.h"
#include "ui/rp_widget.h"
enum LangKey : int;
2018-06-15 18:56:17 +00:00
namespace Ui {
class VerticalLayout;
class Checkbox;
class ScrollArea;
2018-06-15 18:56:17 +00:00
} // namespace Ui
2018-06-02 14:29:21 +00:00
namespace Export {
namespace View {
2018-12-06 15:47:28 +00:00
constexpr auto kSizeValueCount = 80;
int SizeLimitByIndex(int index);
2018-06-02 14:29:21 +00:00
class SettingsWidget : public Ui::RpWidget {
public:
2018-06-22 21:32:00 +00:00
SettingsWidget(QWidget *parent, Settings data);
2018-06-02 14:29:21 +00:00
2018-06-22 21:32:00 +00:00
rpl::producer<Settings> value() const;
rpl::producer<Settings> changes() const;
rpl::producer<> startClicks() const;
2018-06-02 14:29:21 +00:00
rpl::producer<> cancelClicks() const;
2018-10-06 11:06:07 +00:00
void setShowBoxCallback(Fn<void(object_ptr<BoxContent>)> callback) {
_showBoxCallback = std::move(callback);
}
2018-06-02 14:29:21 +00:00
private:
using Type = Settings::Type;
using Types = Settings::Types;
using MediaType = MediaSettings::Type;
using MediaTypes = MediaSettings::Types;
using Format = Output::Format;
2018-06-02 14:29:21 +00:00
void setupContent();
not_null<Ui::RpWidget*> setupButtons(
not_null<Ui::ScrollArea*> scroll,
not_null<Ui::RpWidget*> wrap);
void setupOptions(not_null<Ui::VerticalLayout*> container);
2018-07-23 13:11:56 +00:00
void setupFullExportOptions(not_null<Ui::VerticalLayout*> container);
void setupMediaOptions(not_null<Ui::VerticalLayout*> container);
2018-07-23 13:11:56 +00:00
void setupOtherOptions(not_null<Ui::VerticalLayout*> container);
void setupPathAndFormat(not_null<Ui::VerticalLayout*> container);
void addHeader(
not_null<Ui::VerticalLayout*> container,
LangKey key);
not_null<Ui::Checkbox*> addOption(
not_null<Ui::VerticalLayout*> container,
LangKey key,
Types types);
2018-06-24 00:33:47 +00:00
not_null<Ui::Checkbox*> addOptionWithAbout(
2018-06-22 23:53:03 +00:00
not_null<Ui::VerticalLayout*> container,
LangKey key,
Types types,
LangKey about);
2018-06-24 00:33:47 +00:00
void addChatOption(
not_null<Ui::VerticalLayout*> container,
LangKey key,
Types types);
2018-07-23 13:11:56 +00:00
void addMediaOptions(not_null<Ui::VerticalLayout*> container);
void addMediaOption(
not_null<Ui::VerticalLayout*> container,
LangKey key,
MediaType type);
void addSizeSlider(not_null<Ui::VerticalLayout*> container);
void addLocationLabel(
not_null<Ui::VerticalLayout*> container);
2018-10-06 11:06:07 +00:00
void addLimitsLabel(
not_null<Ui::VerticalLayout*> container);
2018-06-20 18:12:47 +00:00
void chooseFolder();
2018-06-22 21:32:00 +00:00
void refreshButtons(
not_null<Ui::RpWidget*> container,
bool canStart);
2018-10-06 11:06:07 +00:00
void editDateLimit(
TimeId current,
TimeId min,
TimeId max,
LangKey resetLabel,
Fn<void(TimeId)> done);
2018-06-22 21:32:00 +00:00
const Settings &readData() const;
template <typename Callback>
void changeData(Callback &&callback);
2018-07-23 13:11:56 +00:00
PeerId _singlePeerId = 0;
2018-10-06 11:06:07 +00:00
Fn<void(object_ptr<BoxContent>)> _showBoxCallback;
2018-07-23 13:11:56 +00:00
2018-06-22 21:32:00 +00:00
// Use through readData / changeData wrappers.
Settings _internal_data;
2018-06-02 14:29:21 +00:00
struct Wrap {
Wrap(rpl::producer<> value = rpl::never<>())
: value(std::move(value)) {
}
rpl::producer<> value;
};
2018-06-22 21:32:00 +00:00
rpl::event_stream<Settings> _changes;
rpl::variable<Wrap> _startClicks;
2018-06-02 14:29:21 +00:00
rpl::variable<Wrap> _cancelClicks;
};
} // namespace View
} // namespace Export