| 1 | // Aseprite | 
|---|---|
| 2 | // Copyright (C) 2019-2021 Igara Studio S.A. | 
| 3 | // Copyright (C) 2001-2016 David Capello | 
| 4 | // | 
| 5 | // This program is distributed under the terms of | 
| 6 | // the End-User License Agreement for Aseprite. | 
| 7 | |
| 8 | #ifndef APP_UI_HOME_VIEW_H_INCLUDED | 
| 9 | #define APP_UI_HOME_VIEW_H_INCLUDED | 
| 10 | #pragma once | 
| 11 | |
| 12 | #include "app/check_update_delegate.h" | 
| 13 | #include "app/ui/tabs.h" | 
| 14 | #include "app/ui/workspace_view.h" | 
| 15 | #include "ui/box.h" | 
| 16 | |
| 17 | #include "home_view.xml.h" | 
| 18 | |
| 19 | namespace ui { | 
| 20 | class View; | 
| 21 | } | 
| 22 | |
| 23 | namespace app { | 
| 24 | |
| 25 | class DataRecoveryView; | 
| 26 | class NewsListBox; | 
| 27 | class RecentFilesListBox; | 
| 28 | class RecentFoldersListBox; | 
| 29 | |
| 30 | namespace crash { | 
| 31 | class DataRecovery; | 
| 32 | } | 
| 33 | |
| 34 | class HomeView : public app::gen::HomeView | 
| 35 | , public TabView | 
| 36 | , public WorkspaceView | 
| 37 | #ifdef ENABLE_UPDATER | 
| 38 | , public CheckUpdateDelegate | 
| 39 | #endif | 
| 40 | { | 
| 41 | public: | 
| 42 | HomeView(); | 
| 43 | ~HomeView(); | 
| 44 | |
| 45 | // When crash::DataRecovery finish to search for sessions, this | 
| 46 | // function is called. | 
| 47 | void dataRecoverySessionsAreReady(); | 
| 48 | |
| 49 | #if ENABLE_SENTRY | 
| 50 | void updateConsentCheckbox(); | 
| 51 | #endif | 
| 52 | |
| 53 | // TabView implementation | 
| 54 | std::string getTabText() override; | 
| 55 | TabIcon getTabIcon() override; | 
| 56 | gfx::Color getTabColor() override; | 
| 57 | |
| 58 | // WorkspaceView implementation | 
| 59 | ui::Widget* getContentWidget() override { return this; } | 
| 60 | bool onCloseView(Workspace* workspace, bool quitting) override; | 
| 61 | void onAfterRemoveView(Workspace* workspace) override; | 
| 62 | void onTabPopup(Workspace* workspace) override; | 
| 63 | void onWorkspaceViewSelected() override; | 
| 64 | |
| 65 | protected: | 
| 66 | void onResize(ui::ResizeEvent& ev) override; | 
| 67 | #ifdef ENABLE_UPDATER | 
| 68 | // CheckUpdateDelegate impl | 
| 69 | void onCheckingUpdates() override; | 
| 70 | void onUpToDate() override; | 
| 71 | void onNewUpdate(const std::string& url, const std::string& version) override; | 
| 72 | #endif | 
| 73 | |
| 74 | private: | 
| 75 | void onNewFile(); | 
| 76 | void onOpenFile(); | 
| 77 | void onRecoverSprites(); | 
| 78 | |
| 79 | RecentFilesListBox* m_files; | 
| 80 | RecentFoldersListBox* m_folders; | 
| 81 | NewsListBox* m_news; | 
| 82 | crash::DataRecovery* m_dataRecovery; | 
| 83 | DataRecoveryView* m_dataRecoveryView; | 
| 84 | }; | 
| 85 | |
| 86 | } // namespace app | 
| 87 | |
| 88 | #endif | 
| 89 | 
