Don't show the notification flag on Advanced Mode

This commit is contained in:
David Capello 2020-06-17 12:40:11 -03:00
parent 89a896d627
commit f0c9db7041
4 changed files with 13 additions and 8 deletions

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2018-2019 Igara Studio S.A. // Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello // Copyright (C) 2001-2018 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -533,6 +533,7 @@ void MainWindow::configureWorkspaceLayout()
} }
m_menuBar->setVisible(normal); m_menuBar->setVisible(normal);
m_notifications->setVisible(normal && m_notifications->hasNotifications());
m_tabsBar->setVisible(normal); m_tabsBar->setVisible(normal);
colorBarPlaceholder()->setVisible(normal && isDoc); colorBarPlaceholder()->setVisible(normal && isDoc);
m_toolBar->setVisible(normal && isDoc); m_toolBar->setVisible(normal && isDoc);

View File

@ -1,4 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -41,14 +42,14 @@ private:
Notifications::Notifications() Notifications::Notifications()
: Button("") : Button("")
, m_flagStyle(skin::SkinTheme::instance()->styles.flag()) , m_flagStyle(skin::SkinTheme::instance()->styles.flag())
, m_withNotifications(false) , m_red(false)
{ {
} }
void Notifications::addLink(INotificationDelegate* del) void Notifications::addLink(INotificationDelegate* del)
{ {
m_popup.addChild(new NotificationItem(del)); m_popup.addChild(new NotificationItem(del));
m_withNotifications = true; m_red = true;
} }
void Notifications::onSizeHint(SizeHintEvent& ev) void Notifications::onSizeHint(SizeHintEvent& ev)
@ -62,7 +63,7 @@ void Notifications::onPaint(PaintEvent& ev)
PaintWidgetPartInfo info; PaintWidgetPartInfo info;
if (hasMouseOver()) info.styleFlags |= ui::Style::Layer::kMouse; if (hasMouseOver()) info.styleFlags |= ui::Style::Layer::kMouse;
if (m_withNotifications) info.styleFlags |= ui::Style::Layer::kFocus; if (m_red) info.styleFlags |= ui::Style::Layer::kFocus;
if (isSelected()) info.styleFlags |= ui::Style::Layer::kSelected; if (isSelected()) info.styleFlags |= ui::Style::Layer::kSelected;
theme()->paintWidgetPart( theme()->paintWidgetPart(
@ -71,7 +72,7 @@ void Notifications::onPaint(PaintEvent& ev)
void Notifications::onClick(ui::Event& ev) void Notifications::onClick(ui::Event& ev)
{ {
m_withNotifications = false; m_red = false;
invalidate(); invalidate();
gfx::Rect bounds = this->bounds(); gfx::Rect bounds = this->bounds();

View File

@ -1,4 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -23,6 +24,7 @@ namespace app {
Notifications(); Notifications();
void addLink(INotificationDelegate* del); void addLink(INotificationDelegate* del);
bool hasNotifications() const { return m_popup.hasChildren(); }
protected: protected:
void onSizeHint(ui::SizeHintEvent& ev) override; void onSizeHint(ui::SizeHintEvent& ev) override;
@ -31,7 +33,7 @@ namespace app {
private: private:
ui::Style* m_flagStyle; ui::Style* m_flagStyle;
bool m_withNotifications; bool m_red;
ui::Menu m_popup; ui::Menu m_popup;
}; };

View File

@ -167,16 +167,17 @@ namespace ui {
// Returns a list of children. // Returns a list of children.
const WidgetsList& children() const { return m_children; } const WidgetsList& children() const { return m_children; }
bool hasChildren() const { return !m_children.empty(); }
Widget* at(int index) { return m_children[index]; } Widget* at(int index) { return m_children[index]; }
int getChildIndex(Widget* child); int getChildIndex(Widget* child);
// Returns the first/last child or nullptr if it doesn't exist. // Returns the first/last child or nullptr if it doesn't exist.
Widget* firstChild() { Widget* firstChild() {
return (!m_children.empty() ? m_children.front(): nullptr); return (hasChildren() ? m_children.front(): nullptr);
} }
Widget* lastChild() { Widget* lastChild() {
return (!m_children.empty() ? m_children.back(): nullptr); return (hasChildren() ? m_children.back(): nullptr);
} }
// Returns the next or previous siblings. // Returns the next or previous siblings.