AyuGramDesktop/Telegram/SourceFiles/export/view/export_view_progress.cpp
John Preston 5f01751660 Display errors in export UI.
All errors are now fatal errors :(
2018-06-19 13:35:21 +01:00

46 lines
1.1 KiB
C++

/*
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
*/
#include "export/view/export_view_progress.h"
#include "ui/widgets/labels.h"
#include "styles/style_boxes.h"
namespace Export {
namespace View {
ProgressWidget::ProgressWidget(
QWidget *parent,
rpl::producer<Content> content)
: RpWidget(parent) {
const auto label = Ui::CreateChild<Ui::FlatLabel>(this, st::boxLabel);
sizeValue(
) | rpl::start_with_next([=](QSize size) {
label->setGeometry(QRect(QPoint(), size));
}, label->lifetime());
std::move(
content
) | rpl::start_with_next([=](Content &&content) {
auto text = QString();
for (const auto &row : content.rows) {
text += row.id + ' ' + row.info + ' ' + row.label + '\n';
}
label->setText(text);
updateState(std::move(content));
}, lifetime());
}
void ProgressWidget::updateState(Content &&content) {
_content = std::move(content);
}
ProgressWidget::~ProgressWidget() = default;
} // namespace View
} // namespace Export