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_controller.h"
|
2018-06-20 00:02:36 +00:00
|
|
|
#include "export/view/export_view_content.h"
|
2018-06-02 14:29:21 +00:00
|
|
|
#include "base/unique_qptr.h"
|
|
|
|
|
2018-06-20 17:30:57 +00:00
|
|
|
class BoxContent;
|
|
|
|
|
2018-06-02 14:29:21 +00:00
|
|
|
namespace Ui {
|
|
|
|
class SeparatePanel;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Export {
|
|
|
|
namespace View {
|
|
|
|
|
|
|
|
class Panel;
|
|
|
|
|
|
|
|
class PanelController {
|
|
|
|
public:
|
|
|
|
PanelController(not_null<ControllerWrap*> process);
|
|
|
|
|
2018-06-20 00:02:36 +00:00
|
|
|
void activatePanel();
|
2018-06-20 17:30:57 +00:00
|
|
|
void stopWithConfirmation(FnMut<void()> callback = nullptr);
|
2018-06-20 00:02:36 +00:00
|
|
|
|
2018-06-21 00:54:59 +00:00
|
|
|
rpl::producer<> stopRequests() const;
|
2018-06-02 14:29:21 +00:00
|
|
|
|
2018-06-20 00:02:36 +00:00
|
|
|
rpl::lifetime &lifetime() {
|
|
|
|
return _lifetime;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto progressState() const {
|
|
|
|
return ContentFromState(_process->state());
|
|
|
|
}
|
|
|
|
|
2018-06-02 14:29:21 +00:00
|
|
|
~PanelController();
|
|
|
|
|
|
|
|
private:
|
2018-06-20 15:54:13 +00:00
|
|
|
void stopExport();
|
2018-06-02 14:29:21 +00:00
|
|
|
void createPanel();
|
|
|
|
void updateState(State &&state);
|
|
|
|
void showSettings();
|
2018-06-19 18:31:30 +00:00
|
|
|
void showProgress();
|
2018-06-19 10:42:21 +00:00
|
|
|
void showError(const ApiErrorState &error);
|
|
|
|
void showError(const OutputErrorState &error);
|
|
|
|
void showError(const QString &text);
|
2018-06-21 00:54:59 +00:00
|
|
|
void showCriticalError(const QString &text);
|
2018-06-02 14:29:21 +00:00
|
|
|
|
|
|
|
not_null<ControllerWrap*> _process;
|
|
|
|
|
|
|
|
base::unique_qptr<Ui::SeparatePanel> _panel;
|
|
|
|
|
|
|
|
State _state;
|
2018-06-20 17:30:57 +00:00
|
|
|
QPointer<BoxContent> _confirmStopBox;
|
2018-06-02 14:29:21 +00:00
|
|
|
rpl::event_stream<rpl::producer<>> _panelCloseEvents;
|
2018-06-20 15:54:13 +00:00
|
|
|
bool _stopRequested = false;
|
2018-06-02 14:29:21 +00:00
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace View
|
|
|
|
} // namespace Export
|