mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed unused code of box for filters choosing.
This commit is contained in:
parent
8642eb23a7
commit
bfa3655c7b
2 changed files with 0 additions and 87 deletions
|
@ -15,7 +15,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "ui/filter_icons.h"
|
#include "ui/filter_icons.h"
|
||||||
#include "ui/layers/generic_box.h"
|
|
||||||
#include "ui/text/text_utilities.h" // Ui::Text::Bold
|
#include "ui/text/text_utilities.h" // Ui::Text::Bold
|
||||||
#include "ui/toast/toast.h"
|
#include "ui/toast/toast.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
@ -27,46 +26,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class FolderButton : public Ui::SettingsButton {
|
|
||||||
public:
|
|
||||||
FolderButton(
|
|
||||||
not_null<Ui::RpWidget*> parent,
|
|
||||||
const Data::ChatFilter &filter);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *e) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const Ui::FilterIcon _icon;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
FolderButton::FolderButton(
|
|
||||||
not_null<Ui::RpWidget*> parent,
|
|
||||||
const Data::ChatFilter &filter)
|
|
||||||
: SettingsButton(
|
|
||||||
parent,
|
|
||||||
rpl::single(filter.title()),
|
|
||||||
st::paymentsSectionButton)
|
|
||||||
, _icon(Ui::ComputeFilterIcon(filter)) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void FolderButton::paintEvent(QPaintEvent *e) {
|
|
||||||
SettingsButton::paintEvent(e);
|
|
||||||
|
|
||||||
Painter p(this);
|
|
||||||
const auto over = isOver() || isDown();
|
|
||||||
const auto icon = Ui::LookupFilterIcon(_icon).normal;
|
|
||||||
icon->paint(
|
|
||||||
p,
|
|
||||||
st::settingsFilterIconLeft,
|
|
||||||
(height() - icon->height()) / 2,
|
|
||||||
width(),
|
|
||||||
(over
|
|
||||||
? st::dialogsUnreadBgMutedOver
|
|
||||||
: st::dialogsUnreadBgMuted)->c);
|
|
||||||
}
|
|
||||||
|
|
||||||
Data::ChatFilter ChangedFilter(
|
Data::ChatFilter ChangedFilter(
|
||||||
const Data::ChatFilter &filter,
|
const Data::ChatFilter &filter,
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
|
@ -165,47 +124,6 @@ void ChooseFilterValidator::remove(FilterId filterId) const {
|
||||||
ChangeFilterById(filterId, _history, false);
|
ChangeFilterById(filterId, _history, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChooseFilterBox(
|
|
||||||
not_null<Ui::GenericBox*> box,
|
|
||||||
not_null<History*> history) {
|
|
||||||
box->setTitle(tr::lng_filters_add_box_title());
|
|
||||||
|
|
||||||
const auto validator = ChooseFilterValidator(history);
|
|
||||||
|
|
||||||
const auto container = box->verticalLayout()->add(
|
|
||||||
object_ptr<Ui::VerticalLayout>(box->verticalLayout()));
|
|
||||||
|
|
||||||
const auto rebuild = [=] {
|
|
||||||
while (container->count()) {
|
|
||||||
delete container->widgetAt(0);
|
|
||||||
}
|
|
||||||
for (const auto &filter : history->owner().chatsFilters().list()) {
|
|
||||||
if (filter.contains(history)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
container->add(
|
|
||||||
object_ptr<FolderButton>(box, filter),
|
|
||||||
style::margins()
|
|
||||||
)->setClickedCallback([=, id = filter.id()] {
|
|
||||||
validator.add(id);
|
|
||||||
box->closeBox();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
container->resizeToWidth(box->verticalLayout()->width());
|
|
||||||
if (!container->count()) {
|
|
||||||
box->closeBox();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
history->owner().chatsFilters().changed(
|
|
||||||
) | rpl::start_with_next([=] {
|
|
||||||
rebuild();
|
|
||||||
}, box->lifetime());
|
|
||||||
rebuild();
|
|
||||||
|
|
||||||
box->addButton(tr::lng_close(), [=] { box->closeBox(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void FillChooseFilterMenu(
|
void FillChooseFilterMenu(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<History*> history) {
|
not_null<History*> history) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class GenericBox;
|
|
||||||
class PopupMenu;
|
class PopupMenu;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
@ -29,10 +28,6 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void ChooseFilterBox(
|
|
||||||
not_null<Ui::GenericBox*> box,
|
|
||||||
not_null<History*> history);
|
|
||||||
|
|
||||||
void FillChooseFilterMenu(
|
void FillChooseFilterMenu(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<History*> history);
|
not_null<History*> history);
|
||||||
|
|
Loading…
Add table
Reference in a new issue