Mercurial > minori
comparison src/gui/window.cpp @ 44:619cbd6e69f9
filesystem: fix CreateDirectories function
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Fri, 22 Sep 2023 13:52:11 -0400 |
parents | 9ae9365dd4ea |
children | d0adc4aedfc8 |
comparison
equal
deleted
inserted
replaced
43:eb9a78345ecb | 44:619cbd6e69f9 |
---|---|
119 | 119 |
120 action = menu->addAction("&Settings", [this] { | 120 action = menu->addAction("&Settings", [this] { |
121 SettingsDialog dialog(this); | 121 SettingsDialog dialog(this); |
122 dialog.exec(); | 122 dialog.exec(); |
123 }); | 123 }); |
124 action->setMenuRole(QAction::PreferencesRole); | |
125 | |
126 menu = menubar->addMenu("&View"); | |
127 | |
128 std::map<QAction*, int> page_to_index_map = {}; | |
129 | |
130 QActionGroup* pages_group = new QActionGroup(this); | |
131 pages_group->setExclusive(true); | |
132 | |
133 action = pages_group->addAction(menu->addAction("&Now Playing")); | |
134 page_to_index_map[action] = 0; | |
135 action = pages_group->addAction(menu->addAction("&Anime List")); | |
136 page_to_index_map[action] = 1; | |
137 action->setChecked(true); | |
138 action = pages_group->addAction(menu->addAction("&History")); | |
139 page_to_index_map[action] = 2; | |
140 action = pages_group->addAction(menu->addAction("&Statistics")); | |
141 page_to_index_map[action] = 3; | |
142 action = pages_group->addAction(menu->addAction("S&earch")); | |
143 page_to_index_map[action] = 4; | |
144 action = pages_group->addAction(menu->addAction("Se&asons")); | |
145 page_to_index_map[action] = 5; | |
146 action = pages_group->addAction(menu->addAction("&Torrents")); | |
147 page_to_index_map[action] = 6; | |
148 | |
149 connect(pages_group, &QActionGroup::triggered, this, [page_to_index_map, stack](QAction* action) { | |
150 int index = page_to_index_map.at(action); | |
151 switch (index) { | |
152 case 0: | |
153 case 1: stack->setCurrentIndex(index); break; | |
154 case 3: stack->setCurrentIndex(2); | |
155 default: break; | |
156 } | |
157 }); | |
158 | |
159 menu = menubar->addMenu("&Help"); | |
160 action = menu->addAction("About &Qt", qApp, [this]{ | |
161 qApp->aboutQt(); | |
162 }); | |
163 action->setMenuRole(QAction::AboutQtRole); | |
124 | 164 |
125 setMenuBar(menubar); | 165 setMenuBar(menubar); |
126 | 166 |
127 QHBoxLayout* layout = new QHBoxLayout(main_widget); | 167 QHBoxLayout* layout = new QHBoxLayout(main_widget); |
128 layout->addWidget(sidebar); | 168 layout->addWidget(sidebar); |