comparison src/gui/window.cpp @ 48:e613772f41d5

statistics.cpp: show requests made
author Paper <mrpapersonic@gmail.com>
date Mon, 25 Sep 2023 01:07:22 -0400
parents d0adc4aedfc8
children 75c804f713b2
comparison
equal deleted inserted replaced
47:d8eb763e6661 48:e613772f41d5
66 66
67 /* Menu Bar */ 67 /* Menu Bar */
68 QAction* action; 68 QAction* action;
69 QMenuBar* menubar = new QMenuBar(parent); 69 QMenuBar* menubar = new QMenuBar(parent);
70 QMenu* menu = menubar->addMenu("&File"); 70 QMenu* menu = menubar->addMenu("&File");
71
71 QMenu* submenu = menu->addMenu("&Library folders"); 72 QMenu* submenu = menu->addMenu("&Library folders");
72 action = submenu->addAction("&Add new folder..."); 73 action = submenu->addAction("&Add new folder...");
74
73 action = menu->addAction("&Scan available episodes"); 75 action = menu->addAction("&Scan available episodes");
74 76
75 menu->addSeparator(); 77 menu->addSeparator();
76 78
77 action = menu->addAction("Play &next episode"); 79 action = menu->addAction("Play &next episode");
80 action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
78 action = menu->addAction("Play &random episode"); 81 action = menu->addAction("Play &random episode");
79 menu->addSeparator(); 82 action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
83
84 menu->addSeparator();
85
80 action = menu->addAction("E&xit", qApp, &QApplication::quit); 86 action = menu->addAction("E&xit", qApp, &QApplication::quit);
81 87
82 menu = menubar->addMenu("&Services"); 88 menu = menubar->addMenu("&Services");
83 action = menu->addAction("Synchronize &list", [this, stack] { 89 action = menu->addAction("Synchronize &list", [this, stack] {
84 Services::Synchronize(); 90 Services::Synchronize();
85 ((AnimeListWidget*)stack->widget((int)Pages::ANIME_LIST))->Refresh(); 91 ((AnimeListWidget*)stack->widget((int)Pages::ANIME_LIST))->Refresh();
86 }); 92 });
93 action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
87 94
88 menu->addSeparator(); 95 menu->addSeparator();
89 96
90 submenu = menu->addMenu("&AniList"); 97 submenu = menu->addMenu("&AniList");
91 action = submenu->addAction("Go to my &profile"); 98 action = submenu->addAction("Go to my &profile");
129 136
130 QActionGroup* pages_group = new QActionGroup(this); 137 QActionGroup* pages_group = new QActionGroup(this);
131 pages_group->setExclusive(true); 138 pages_group->setExclusive(true);
132 139
133 action = pages_group->addAction(menu->addAction("&Now Playing")); 140 action = pages_group->addAction(menu->addAction("&Now Playing"));
141 action->setCheckable(true);
134 page_to_index_map[action] = 0; 142 page_to_index_map[action] = 0;
143
135 action = pages_group->addAction(menu->addAction("&Anime List")); 144 action = pages_group->addAction(menu->addAction("&Anime List"));
136 page_to_index_map[action] = 1; 145 page_to_index_map[action] = 1;
146
147 action->setCheckable(true);
137 action->setChecked(true); 148 action->setChecked(true);
138 action = pages_group->addAction(menu->addAction("&History")); 149 action = pages_group->addAction(menu->addAction("&History"));
150 action->setCheckable(true);
139 page_to_index_map[action] = 2; 151 page_to_index_map[action] = 2;
152
140 action = pages_group->addAction(menu->addAction("&Statistics")); 153 action = pages_group->addAction(menu->addAction("&Statistics"));
154 action->setCheckable(true);
141 page_to_index_map[action] = 3; 155 page_to_index_map[action] = 3;
156
142 action = pages_group->addAction(menu->addAction("S&earch")); 157 action = pages_group->addAction(menu->addAction("S&earch"));
158 action->setCheckable(true);
143 page_to_index_map[action] = 4; 159 page_to_index_map[action] = 4;
160
144 action = pages_group->addAction(menu->addAction("Se&asons")); 161 action = pages_group->addAction(menu->addAction("Se&asons"));
162 action->setCheckable(true);
145 page_to_index_map[action] = 5; 163 page_to_index_map[action] = 5;
164
146 action = pages_group->addAction(menu->addAction("&Torrents")); 165 action = pages_group->addAction(menu->addAction("&Torrents"));
166 action->setCheckable(true);
147 page_to_index_map[action] = 6; 167 page_to_index_map[action] = 6;
148 168
149 connect(pages_group, &QActionGroup::triggered, this, [page_to_index_map, stack](QAction* action) { 169 connect(pages_group, &QActionGroup::triggered, this, [page_to_index_map, stack](QAction* action) {
150 int index = page_to_index_map.at(action); 170 int index = page_to_index_map.at(action);
151 switch (index) { 171 switch (index) {
153 case 1: stack->setCurrentIndex(index); break; 173 case 1: stack->setCurrentIndex(index); break;
154 case 3: stack->setCurrentIndex(2); 174 case 3: stack->setCurrentIndex(2);
155 default: break; 175 default: break;
156 } 176 }
157 }); 177 });
178 menu->addSeparator();
179 menu->addAction("Show sidebar");
158 180
159 menu = menubar->addMenu("&Help"); 181 menu = menubar->addMenu("&Help");
160 action = menu->addAction("About &Qt", qApp, [this] { qApp->aboutQt(); }); 182 action = menu->addAction("About &Qt", qApp, [this] { qApp->aboutQt(); });
161 action->setMenuRole(QAction::AboutQtRole); 183 action->setMenuRole(QAction::AboutQtRole);
162 184