comparison src/gui/window.cpp @ 63:3d2decf093bb

*: fix many clang warnings
author Paper <mrpapersonic@gmail.com>
date Sun, 01 Oct 2023 06:39:47 -0400
parents 4c6dd5999b39
children fe719c109dbc
comparison
equal deleted inserted replaced
62:4c6dd5999b39 63:3d2decf093bb
11 #include "gui/pages/seasons.h" 11 #include "gui/pages/seasons.h"
12 #include "gui/pages/statistics.h" 12 #include "gui/pages/statistics.h"
13 #include "gui/pages/torrents.h" 13 #include "gui/pages/torrents.h"
14 #include "gui/widgets/sidebar.h" 14 #include "gui/widgets/sidebar.h"
15 #include "services/services.h" 15 #include "services/services.h"
16 #include <QActionGroup>
16 #include <QApplication> 17 #include <QApplication>
17 #include <QFile> 18 #include <QFile>
18 #include <QMainWindow> 19 #include <QMainWindow>
19 #include <QMenuBar> 20 #include <QMenuBar>
21 #include <QMessageBox>
20 #include <QPlainTextEdit> 22 #include <QPlainTextEdit>
21 #include <QStackedWidget> 23 #include <QStackedWidget>
24 #include <QTextStream>
22 #include <QTimer> 25 #include <QTimer>
23 #include <QActionGroup>
24 #include <QMessageBox>
25 #include <QTextStream>
26 #if MACOSX 26 #if MACOSX
27 # include "sys/osx/dark_theme.h" 27 # include "sys/osx/dark_theme.h"
28 #elif defined(WIN32) 28 #elif defined(WIN32)
29 # include "sys/win32/dark_theme.h" 29 # include "sys/win32/dark_theme.h"
30 #endif 30 #endif
89 menu->addSeparator(); 89 menu->addSeparator();
90 90
91 action = menu->addAction(tr("E&xit"), qApp, &QApplication::quit); 91 action = menu->addAction(tr("E&xit"), qApp, &QApplication::quit);
92 92
93 menu = menubar->addMenu(tr("&Services")); 93 menu = menubar->addMenu(tr("&Services"));
94 action = menu->addAction(tr("Synchronize &list"), [this, stack] { 94 action = menu->addAction(tr("Synchronize &list"), [stack] {
95 Services::Synchronize(); 95 Services::Synchronize();
96 ((AnimeListWidget*)stack->widget((int)Pages::ANIME_LIST))->Refresh(); 96 ((AnimeListWidget*)stack->widget((int)Pages::ANIME_LIST))->Refresh();
97 }); 97 });
98 action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S)); 98 action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
99 99
169 169
170 action = pages_group->addAction(menu->addAction(tr("&Torrents"))); 170 action = pages_group->addAction(menu->addAction(tr("&Torrents")));
171 action->setCheckable(true); 171 action->setCheckable(true);
172 page_to_index_map[action] = 6; 172 page_to_index_map[action] = 6;
173 173
174 connect(sidebar, &SideBar::CurrentItemChanged, this, [pages_group](int index){ 174 connect(sidebar, &SideBar::CurrentItemChanged, this,
175 pages_group->actions()[index]->setChecked(true); 175 [pages_group](int index) { pages_group->actions()[index]->setChecked(true); });
176 }); 176
177 177 connect(pages_group, &QActionGroup::triggered, this,
178 connect(pages_group, &QActionGroup::triggered, this, [page_to_index_map, sidebar](QAction* action) { 178 [page_to_index_map, sidebar](QAction* action) { sidebar->SetCurrentItem(page_to_index_map.at(action)); });
179 sidebar->SetCurrentItem(page_to_index_map.at(action));
180 });
181 179
182 menu->addSeparator(); 180 menu->addSeparator();
183 menu->addAction(tr("Show sidebar")); 181 menu->addAction(tr("Show sidebar"));
184 182
185 menu = menubar->addMenu(tr("&Help")); 183 menu = menubar->addMenu(tr("&Help"));