-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export panel minimizes to a top bar, like a Call.
- Loading branch information
1 parent
eaf3ea9
commit 329db0d
Showing
22 changed files
with
437 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
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_top_bar.h" | ||
|
||
#include "export/view/export_view_content.h" | ||
#include "ui/widgets/continuous_sliders.h" | ||
#include "ui/widgets/labels.h" | ||
#include "ui/widgets/buttons.h" | ||
#include "ui/widgets/shadow.h" | ||
#include "lang/lang_keys.h" | ||
#include "styles/style_export.h" | ||
#include "styles/style_media_player.h" | ||
|
||
namespace Export { | ||
namespace View { | ||
|
||
TopBar::TopBar(QWidget *parent, Content &&content) | ||
: RpWidget(parent) | ||
, _info(this, st::exportTopBarLabel) | ||
, _shadow(this) | ||
, _progress(this, st::mediaPlayerPlayback) | ||
, _button(this) { | ||
resize(width(), st::mediaPlayerHeight + st::lineWidth); | ||
_progress->setAttribute(Qt::WA_TransparentForMouseEvents); | ||
updateData(std::move(content)); | ||
} | ||
|
||
rpl::producer<> TopBar::clicks() const { | ||
return _button->clicks(); | ||
} | ||
|
||
void TopBar::updateData(Content &&content) { | ||
if (content.rows.empty()) { | ||
return; | ||
} | ||
const auto &row = content.rows[0]; | ||
const auto clean = &TextUtilities::Clean; | ||
_info->setRichText(textcmdStartSemibold() | ||
+ clean(lang(lng_export_progress_title)) | ||
+ textcmdStopSemibold() | ||
+ QString::fromUtf8(" \xe2\x80\x93 ") | ||
+ clean(row.label) | ||
+ ' ' | ||
+ textcmdLink(1, clean(row.info))); | ||
_progress->setValue(row.progress); | ||
} | ||
|
||
void TopBar::resizeEvent(QResizeEvent *e) { | ||
_info->moveToLeft( | ||
st::mediaPlayerPlayLeft + st::mediaPlayerPadding, | ||
st::mediaPlayerNameTop - st::mediaPlayerName.style.font->ascent); | ||
_button->setGeometry(0, 0, width(), height() - st::lineWidth); | ||
_progress->setGeometry( | ||
0, | ||
height() - st::mediaPlayerPlayback.fullWidth, | ||
width(), | ||
st::mediaPlayerPlayback.fullWidth); | ||
} | ||
|
||
void TopBar::paintEvent(QPaintEvent *e) { | ||
Painter p(this); | ||
auto fill = e->rect().intersected( | ||
QRect(0, 0, width(), st::mediaPlayerHeight)); | ||
if (!fill.isEmpty()) { | ||
p.fillRect(fill, st::mediaPlayerBg); | ||
} | ||
} | ||
|
||
void TopBar::setShadowGeometryToLeft(int x, int y, int w, int h) { | ||
_shadow->setGeometryToLeft(x, y, w, h); | ||
} | ||
|
||
void TopBar::showShadow() { | ||
_shadow->show(); | ||
_progress->show(); | ||
} | ||
|
||
void TopBar::hideShadow() { | ||
_shadow->hide(); | ||
_progress->hide(); | ||
} | ||
|
||
TopBar::~TopBar() = default; | ||
|
||
} // namespace View | ||
} // namespace Export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
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 "ui/rp_widget.h" | ||
|
||
namespace Ui { | ||
class FlatLabel; | ||
class FilledSlider; | ||
class AbstractButton; | ||
class PlainShadow; | ||
} // namespace Ui | ||
|
||
namespace Export { | ||
namespace View { | ||
|
||
struct Content; | ||
|
||
class TopBar : public Ui::RpWidget { | ||
public: | ||
TopBar(QWidget *parent, Content &&content); | ||
|
||
rpl::producer<> clicks() const; | ||
|
||
void updateData(Content &&content); | ||
|
||
void setShadowGeometryToLeft(int x, int y, int w, int h); | ||
void showShadow(); | ||
void hideShadow(); | ||
|
||
~TopBar(); | ||
|
||
protected: | ||
void resizeEvent(QResizeEvent *e) override; | ||
void paintEvent(QPaintEvent *e) override; | ||
|
||
private: | ||
object_ptr<Ui::FlatLabel> _info; | ||
object_ptr<Ui::PlainShadow> _shadow = { nullptr }; | ||
object_ptr<Ui::FilledSlider> _progress; | ||
object_ptr<Ui::AbstractButton> _button; | ||
|
||
}; | ||
|
||
} // namespace View | ||
} // namespace Export |
Oops, something went wrong.