2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Use layers and boxes from lib_ui.

This commit is contained in:
John Preston
2019-09-18 14:19:05 +03:00
parent 860353824b
commit a6c84c36c0
209 changed files with 586 additions and 3349 deletions

View File

@@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "facades.h"
#include "styles/style_export.h"
#include "styles/style_boxes.h"
#include "styles/style_layers.h"
namespace Export {
namespace View {
@@ -30,7 +30,7 @@ namespace {
constexpr auto kSaveSettingsTimeout = crl::time(1000);
class SuggestBox : public BoxContent {
class SuggestBox : public Ui::BoxContent {
public:
SuggestBox(QWidget*);
@@ -85,9 +85,9 @@ Environment PrepareEnvironment() {
return result;
}
QPointer<BoxContent> SuggestStart() {
QPointer<Ui::BoxContent> SuggestStart() {
ClearSuggestStart();
return Ui::show(Box<SuggestBox>(), LayerOption::KeepOther).data();
return Ui::show(Box<SuggestBox>(), Ui::LayerOption::KeepOther).data();
}
void ClearSuggestStart() {
@@ -166,10 +166,10 @@ void PanelController::showSettings() {
auto settings = base::make_unique_q<SettingsWidget>(
_panel,
*_settings);
settings->setShowBoxCallback([=](object_ptr<BoxContent> box) {
settings->setShowBoxCallback([=](object_ptr<Ui::BoxContent> box) {
_panel->showBox(
std::move(box),
LayerOption::KeepOther,
Ui::LayerOption::KeepOther,
anim::type::normal);
});
@@ -256,7 +256,7 @@ void PanelController::showError(const QString &text) {
const auto hidden = _panel->isHidden();
_panel->showBox(
std::move(box),
LayerOption::CloseOther,
Ui::LayerOption::CloseOther,
hidden ? anim::type::instant : anim::type::normal);
weak->setCloseByEscape(false);
weak->setCloseByOutsideClick(false);
@@ -330,7 +330,7 @@ void PanelController::stopWithConfirmation(FnMut<void()> callback) {
_confirmStopBox = box.data();
_panel->showBox(
std::move(box),
LayerOption::CloseOther,
Ui::LayerOption::CloseOther,
hidden ? anim::type::instant : anim::type::normal);
if (hidden) {
_panel->showAndActivate();

View File

@@ -12,10 +12,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unique_qptr.h"
#include "base/timer.h"
class BoxContent;
namespace Ui {
class SeparatePanel;
class BoxContent;
} // namespace Ui
namespace Export {
@@ -25,7 +24,7 @@ struct Environment;
namespace View {
Environment PrepareEnvironment();
QPointer<BoxContent> SuggestStart();
QPointer<Ui::BoxContent> SuggestStart();
void ClearSuggestStart();
bool IsDefaultPath(const QString &path);
void ResolveSettings(Settings &settings);
@@ -71,7 +70,7 @@ private:
base::unique_qptr<Ui::SeparatePanel> _panel;
State _state;
QPointer<BoxContent> _confirmStopBox;
QPointer<Ui::BoxContent> _confirmStopBox;
rpl::event_stream<rpl::producer<>> _panelCloseEvents;
bool _stopRequested = false;
rpl::lifetime _lifetime;

View File

@@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "styles/style_widgets.h"
#include "styles/style_export.h"
#include "styles/style_boxes.h"
#include "styles/style_layers.h"
namespace Export {
namespace View {

View File

@@ -11,12 +11,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/rp_widget.h"
#include "base/object_ptr.h"
class BoxContent;
namespace Ui {
class VerticalLayout;
class Checkbox;
class ScrollArea;
class BoxContent;
} // namespace Ui
namespace Export {
@@ -34,7 +33,7 @@ public:
rpl::producer<> startClicks() const;
rpl::producer<> cancelClicks() const;
void setShowBoxCallback(Fn<void(object_ptr<BoxContent>)> callback) {
void setShowBoxCallback(Fn<void(object_ptr<Ui::BoxContent>)> callback) {
_showBoxCallback = std::move(callback);
}
@@ -97,7 +96,7 @@ private:
void changeData(Callback &&callback);
PeerId _singlePeerId = 0;
Fn<void(object_ptr<BoxContent>)> _showBoxCallback;
Fn<void(object_ptr<Ui::BoxContent>)> _showBoxCallback;
// Use through readData / changeData wrappers.
Settings _internal_data;