added mechanic for deleting a BaseWindow on focus out

This commit is contained in:
fourtf
2018-07-05 10:34:04 +02:00
parent 335cbf8758
commit f02a89690e
5 changed files with 60 additions and 44 deletions
+8 -16
View File
@@ -21,8 +21,7 @@
namespace chatterino {
UserInfoPopup::UserInfoPopup()
: BaseWindow(nullptr, BaseWindow::Flags(BaseWindow::Frameless | BaseWindow::DeleteOnFocusOut |
BaseWindow::FramelessDraggable))
: BaseWindow(nullptr, BaseWindow::Flags(BaseWindow::Frameless | BaseWindow::FramelessDraggable))
, hack_(new bool)
{
this->setStayInScreenRect(true);
@@ -364,11 +363,9 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
}
a->setBorderColor(color1);
QObject::connect(
a.getElement(), &RippleEffectLabel2::clicked,
[this, timeout = std::get<1>(item)] {
this->buttonClicked.invoke(std::make_pair(Action::Timeout, timeout));
});
QObject::connect(a.getElement(), &RippleEffectLabel2::clicked, [
this, timeout = std::get<1>(item)
] { this->buttonClicked.invoke(std::make_pair(Action::Timeout, timeout)); });
}
}
};
@@ -377,21 +374,16 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
addTimeouts("sec", {{"1", 1}});
addTimeouts("min", {
{"1", 1 * 60},
{"5", 5 * 60},
{"10", 10 * 60},
{"1", 1 * 60}, {"5", 5 * 60}, {"10", 10 * 60},
});
addTimeouts("hour", {
{"1", 1 * 60 * 60},
{"4", 4 * 60 * 60},
{"1", 1 * 60 * 60}, {"4", 4 * 60 * 60},
});
addTimeouts("days", {
{"1", 1 * 60 * 60 * 24},
{"3", 3 * 60 * 60 * 24},
{"1", 1 * 60 * 60 * 24}, {"3", 3 * 60 * 60 * 24},
});
addTimeouts("weeks", {
{"1", 1 * 60 * 60 * 24 * 7},
{"2", 2 * 60 * 60 * 24 * 7},
{"1", 1 * 60 * 60 * 24 * 7}, {"2", 2 * 60 * 60 * 24 * 7},
});
addButton(Ban, "ban", getApp()->resources->buttons.ban);