Mercurial > minori
diff src/main.cpp @ 6:1d82f6e04d7d
Update: add first parts to the settings dialog
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 16 Aug 2023 00:49:17 -0400 |
parents | 51ae25154b70 |
children | 07a9095eaeed |
line wrap: on
line diff
--- a/src/main.cpp Sat Aug 12 13:10:34 2023 -0400 +++ b/src/main.cpp Wed Aug 16 00:49:17 2023 -0400 @@ -1,6 +1,9 @@ #include "window.h" #include "config.h" #include "anime.h" +#include "sidebar.h" +#include "ui_utils.h" +#include "settings.h" #if MACOSX #include "sys/osx/dark_theme.h" #elif WIN32 @@ -17,6 +20,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { + main_widget = new QWidget(parent); /* Menu Bar */ QAction* action; QMenuBar* menubar = new QMenuBar(parent); @@ -40,8 +44,8 @@ menu->addSeparator(); submenu = menu->addMenu("&AniList"); - action = menu->addAction("Go to my &profile"); - action = menu->addAction("Go to my &stats"); + action = submenu->addAction("Go to my &profile"); + action = submenu->addAction("Go to my &stats"); submenu = menu->addMenu("&Kitsu"); action = submenu->addAction("Go to my &feed"); @@ -69,11 +73,34 @@ menu->addSeparator(); - action = menu->addAction("&Settings"); + action = menu->addAction("&Settings", [this]{ + SettingsDialog dialog(this); + dialog.exec(); + }); setMenuBar(menubar); /* Side toolbar */ + SideBar* sidebar = new SideBar(main_widget); + sidebar->AddItem("Now Playing", UiUtils::CreateSideBarIcon(":/icons/16x16/film.png")); + sidebar->AddSeparator(); + sidebar->AddItem("Anime List", UiUtils::CreateSideBarIcon(":/icons/16x16/document-list.png")); + sidebar->AddItem("History", UiUtils::CreateSideBarIcon(":/icons/16x16/clock-history-frame.png")); + sidebar->AddItem("Statistics", UiUtils::CreateSideBarIcon(":/icons/16x16/chart.png")); + sidebar->AddSeparator(); + sidebar->AddItem("Search", UiUtils::CreateSideBarIcon(":/icons/16x16/magnifier.png")); + sidebar->AddItem("Seasons", UiUtils::CreateSideBarIcon(":/icons/16x16/calendar.png")); + sidebar->AddItem("Torrents", UiUtils::CreateSideBarIcon(":/icons/16x16/feed.png")); + sidebar->setFixedWidth(128); + sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + + anime_list_page = new AnimeListPage(parent); + + QHBoxLayout* layout = new QHBoxLayout(main_widget); + layout->addWidget(sidebar, 0, Qt::AlignLeft | Qt::AlignTop); + layout->addWidget(anime_list_page); + SetActivePage(main_widget); +/* QToolBar* toolbar = new QToolBar(parent); QActionGroup* tb_action_group = new QActionGroup(toolbar); @@ -112,9 +139,14 @@ toolbar->setMovable(false); toolbar->setFloatable(false); + toolbar->setMinimumSize(QSize(140, 0)); + toolbar->setObjectName("sidebar"); + toolbar->setStyleSheet("QToolBar#sidebar{margin: 6px;}"); + //toolbar->setFrameShape(QFrame::NoFrame); + toolbar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum); addToolBar(Qt::LeftToolBarArea, toolbar); - +*/ ThemeChanged(); } @@ -174,6 +206,9 @@ } } #else + /* Currently OS detection only supports Windows and macOS. + Please don't be shy if you're willing to port it to other OSes + (or desktop environments, or window managers) */ SetStyleSheet(LIGHT); #endif break;