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

NB Broken! Build in Xcode fixed, macOS notifications done by Manager.

This commit is contained in:
John Preston
2016-10-02 18:44:54 +03:00
parent 0bf55835f5
commit c2aa8d3c77
8 changed files with 508 additions and 377 deletions

View File

@@ -49,6 +49,7 @@ public:
void clearFromHistory(History *history) {
doClearFromHistory(history);
}
virtual ~Manager() = default;
protected:
virtual void doUpdateAll() = 0;

View File

@@ -35,20 +35,20 @@ namespace {
// 3 desktop notifies at the same time.
constexpr int kNotifyWindowsCount = 3;
NeverFreedPointer<Manager> FallbackManager;
NeverFreedPointer<Manager> ManagerInstance;
} // namespace
void start() {
FallbackManager.makeIfNull();
ManagerInstance.makeIfNull();
}
Manager *manager() {
return FallbackManager.data();
return ManagerInstance.data();
}
void finish() {
FallbackManager.reset();
ManagerInstance.clear();
}
Manager::Manager() {
@@ -340,7 +340,7 @@ void Widget::itemRemoved(HistoryItem *deleted) {
void Widget::unlinkHistoryAndNotify() {
unlinkHistory();
if (auto manager = FallbackManager.data()) {
if (auto manager = ManagerInstance.data()) {
manager->showNextFromQueue();
}
}
@@ -355,14 +355,14 @@ void Widget::unlinkHistory(History *history) {
void Widget::enterEvent(QEvent *e) {
if (!_history) return;
if (auto manager = FallbackManager.data()) {
if (auto manager = ManagerInstance.data()) {
manager->stopAllHiding();
}
}
void Widget::leaveEvent(QEvent *e) {
if (!_history) return;
if (auto manager = FallbackManager.data()) {
if (auto manager = ManagerInstance.data()) {
manager->startAllHiding();
}
}
@@ -446,7 +446,7 @@ void Widget::step_appearance(float64 ms, bool timer) {
}
Widget::~Widget() {
if (auto manager = FallbackManager.data()) {
if (auto manager = ManagerInstance.data()) {
manager->removeFromShown(this);
}
}