Mercurial > minori
view include/gui/window.h @ 337:a7d4e5107531
dep/animone: REFACTOR ALL THE THINGS
1: animone now has its own syntax divergent from anisthesia,
making different platforms actually have their own sections
2: process names in animone are now called `comm' (this will
probably break things). this is what its called in bsd/linux
so I'm just going to use it everywhere
3: the X11 code now checks for the existence of a UTF-8 window title
and passes it if available
4: ANYTHING THATS NOT LINUX IS 100% UNTESTED AND CAN AND WILL BREAK!
I still actually need to test the bsd code. to be honest I'm probably
going to move all of the bsds into separate files because they're
all essentially different operating systems at this point
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 19 Jun 2024 12:51:15 -0400 |
parents | 34347fd2a2de |
children |
line wrap: on
line source
#ifndef MINORI_WINDOW_H_ #define MINORI_WINDOW_H_ #include "core/config.h" #include "gui/widgets/sidebar.h" /* pages; these should really be in a namespace */ #include "gui/pages/anime_list.h" #include "gui/pages/history.h" #include "gui/pages/now_playing.h" #include "gui/pages/search.h" #include "gui/pages/seasons.h" #include "gui/pages/statistics.h" #include "gui/pages/torrents.h" #include <QMainWindow> #include <QCloseEvent> #include <QStackedWidget> #include <QThread> #include <QTimer> #include <QWidget> #include <memory> class QMenu; class AnimeListPage; /* ... :) */ Q_DECLARE_METATYPE(std::vector<std::string>); Q_DECLARE_METATYPE(std::string); class MainWindowPlayingThread final : public QThread { Q_OBJECT public: MainWindowPlayingThread(QObject* object = nullptr) : QThread(object) {} protected: void run() override; signals: void Done(const std::vector<std::string>& files); }; class MainWindowAsyncSynchronizeThread final : public QThread { Q_OBJECT public: MainWindowAsyncSynchronizeThread(QAction* action, AnimeListPage* page, QObject* object = nullptr); void SetAction(QAction* action); void SetPage(AnimeListPage* page); protected: void run() override; private: QAction* action_ = nullptr; AnimeListPage* page_ = nullptr; }; class MainWindow final : public QMainWindow { Q_OBJECT public: enum class Pages { NOW_PLAYING, ANIME_LIST, HISTORY, STATISTICS, SEARCH, SEASONS, TORRENTS }; MainWindow(QWidget* parent = nullptr); void SetActivePage(QWidget* page); void CreateBars(); void AddMainWidgets(); void RetranslateUI(); void UpdateFolderMenu(); void AsyncSynchronize(QAction* action, QStackedWidget* stack); void changeEvent(QEvent* event) override; void showEvent(QShowEvent* event) override; void closeEvent(QCloseEvent* event) override; public slots: void SetStatusMessage(const std::string& message); private: QWidget main_widget_; QStackedWidget stack_; SideBar sidebar_; AnimeListPage anime_list_page_; HistoryPage history_page_; NowPlayingPage now_playing_page_; SearchPage search_page_; SeasonsPage seasons_page_; StatisticsPage statistics_page_; TorrentsPage torrents_page_; MainWindowPlayingThread playing_thread_; QTimer playing_thread_timer_; MainWindowAsyncSynchronizeThread async_synchronize_thread_; QMenu* folder_menu = nullptr; }; #endif // MINORI_WINDOW_H_