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

97 lines
2.4 KiB
C
Raw Normal View History

2018-06-02 17:29:21 +03: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 21:56:17 +03:00
namespace Ui {
class VerticalLayout;
class Checkbox;
class ScrollArea;
2018-06-15 21:56:17 +03:00
} // namespace Ui
2018-06-02 17:29:21 +03:00
namespace Export {
namespace View {
class SettingsWidget : public Ui::RpWidget {
public:
2018-06-22 22:32:00 +01:00
SettingsWidget(QWidget *parent, Settings data);
2018-06-02 17:29:21 +03:00
2018-06-22 22:32:00 +01:00
rpl::producer<Settings> value() const;
rpl::producer<Settings> changes() const;
rpl::producer<> startClicks() const;
2018-06-02 17:29:21 +03:00
rpl::producer<> cancelClicks() const;
private:
using Type = Settings::Type;
using Types = Settings::Types;
using MediaType = MediaSettings::Type;
using MediaTypes = MediaSettings::Types;
using Format = Output::Format;
2018-06-02 17:29:21 +03: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);
void setupMediaOptions(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-23 00:53:03 +01:00
void addOptionWithAbout(
not_null<Ui::VerticalLayout*> container,
LangKey key,
Types types,
LangKey about);
void addChatOption(
not_null<Ui::VerticalLayout*> container,
LangKey key,
Types types);
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-06-20 19:12:47 +01:00
void chooseFolder();
2018-06-22 22:32:00 +01:00
void refreshButtons(
not_null<Ui::RpWidget*> container,
bool canStart);
const Settings &readData() const;
template <typename Callback>
void changeData(Callback &&callback);
// Use through readData / changeData wrappers.
Settings _internal_data;
2018-06-02 17:29:21 +03:00
struct Wrap {
Wrap(rpl::producer<> value = rpl::never<>())
: value(std::move(value)) {
}
rpl::producer<> value;
};
2018-06-22 22:32:00 +01:00
rpl::event_stream<Settings> _changes;
rpl::variable<Wrap> _startClicks;
2018-06-02 17:29:21 +03:00
rpl::variable<Wrap> _cancelClicks;
};
} // namespace View
} // namespace Export