1 #ifndef OPTIONS_H
2 #define OPTIONS_H
3
4 #include <QTabWidget>
5 #include <QColorDialog>
6 #include <QScrollArea>
7 #include <QDebug>
8
9 #include "settingswidgets.h"
10
11 #include "../../../configuration.h"
12
13 class MainWindow;
14 class ViewOptionsWidget;
15
16 class OptionsPage : public QObject
17 {
18 Q_OBJECT
19
20 public:
21 OptionsPage(QObject *parent = nullptr)
QObject(parent)22 : QObject(parent)
23 {
24 }
25
displayName()26 QString displayName() const
27 {
28 return m_displayName;
29 }
30
31 virtual QWidget *widget() = 0;
load()32 virtual void load() {}
apply()33 virtual void apply() {}
34
35 protected:
setDisplayName(msg_hash_enums name)36 void setDisplayName(msg_hash_enums name)
37 {
38 m_displayName = msg_hash_to_str(name);
39 }
40
setDisplayName(const QString & name)41 void setDisplayName(const QString& name)
42 {
43 m_displayName = name;
44 }
45
46 QString m_displayName = "General";
47 };
48
49 class OptionsCategory : public QObject
50 {
51 Q_OBJECT
52 public:
QObject(parent)53 OptionsCategory(QObject *parent = nullptr) : QObject(parent) {}
QObject(parent)54 OptionsCategory(MainWindow *mainwindow, QObject *parent = nullptr) : QObject(parent) {}
55 virtual QVector<OptionsPage*> pages() = 0;
displayName()56 QString displayName() const { return m_displayName; }
categoryIconName()57 QString categoryIconName() const { return m_categoryIconName; }
load()58 virtual void load()
59 {
60 unsigned i;
61 size_t size = m_pages.size();
62 for (i = 0; i < size; i++)
63 m_pages.at(i)->load();
64 }
apply()65 virtual void apply()
66 {
67 unsigned i;
68 size_t size = m_pages.size();
69 for (i = 0; i < size; i++)
70 m_pages.at(i)->apply();
71 }
72 protected:
setDisplayName(msg_hash_enums name)73 void setDisplayName(msg_hash_enums name) { m_displayName = msg_hash_to_str(name); }
setCategoryIcon(const QString & categoryIconName)74 void setCategoryIcon(const QString &categoryIconName) { m_categoryIconName = categoryIconName; }
75 QString m_displayName;
76 QString m_categoryIconName = "setting";
77 QVector<OptionsPage*> m_pages;
78 };
79
80 /***********************************************************
81 Drivers
82 ************************************************************/
83 class DriversCategory : public OptionsCategory
84 {
85 public:
86 DriversCategory(QWidget *parent);
87 QVector<OptionsPage*> pages();
88 };
89
90 class DriversPage : public OptionsPage
91 {
92 Q_OBJECT
93 public:
94 DriversPage(QObject *parent = nullptr);
95 QWidget *widget();
96 };
97
98 /***********************************************************
99 AI Service
100 ************************************************************/
101 class AIServiceCategory : public OptionsCategory
102 {
103 public:
104 AIServiceCategory(QWidget *parent);
105 QVector<OptionsPage*> pages();
106 };
107
108 class AIServicePage : public OptionsPage
109 {
110 Q_OBJECT
111 public:
112 AIServicePage(QObject *parent = nullptr);
113 QWidget *widget();
114 };
115
116 /************************************************************
117 Video
118 ************************************************************/
119 class VideoCategory : public OptionsCategory
120 {
121 public:
122 VideoCategory(QWidget *parent);
123 QVector<OptionsPage*> pages();
124 };
125
126 class AspectRatioRadioButton : public QRadioButton
127 {
128 Q_OBJECT
129 public:
130 AspectRatioRadioButton(unsigned min, unsigned max, QWidget *parent = 0);
131 private:
132 unsigned m_min;
133 unsigned m_max;
134 };
135
136 class AspectRatioGroup : public SettingsGroup
137 {
138 Q_OBJECT
139 public:
140 AspectRatioGroup(const QString &title, QWidget *parent = 0);
141 private slots:
142 void paintEvent(QPaintEvent *event);
143 void onAspectRadioToggled(bool checked);
144 void onAspectRadioClicked(bool checked);
145 private:
146 AspectRatioRadioButton *m_radioButton;
147 UIntComboBox *m_comboBox;
148 };
149
150 class VideoPage : public OptionsPage
151 {
152 Q_OBJECT
153 public:
154 VideoPage(QObject *parent = nullptr);
155 QWidget *widget();
156 private slots:
157 void onResolutionComboIndexChanged(const QString& value);
158 private:
159 QComboBox *m_resolutionCombo;
160 };
161
162 class CrtSwitchresPage : public OptionsPage
163 {
164 Q_OBJECT
165 public:
166 CrtSwitchresPage(QObject *parent = nullptr);
167 QWidget *widget();
168 private slots:
169 void onCrtSuperResolutionComboIndexChanged(int index);
170 private:
171 QComboBox *m_crtSuperResolutionCombo;
172 };
173
174 /************************************************************
175 Audio
176 ************************************************************/
177 class AudioCategory : public OptionsCategory
178 {
179 public:
180 AudioCategory(QWidget *parent);
181 QVector<OptionsPage*> pages();
182 };
183
184 class AudioPage : public OptionsPage
185 {
186 Q_OBJECT
187 public:
188 AudioPage(QObject *parent = nullptr);
189 QWidget *widget();
190 };
191
192 class MenuSoundsPage : public OptionsPage
193 {
194 Q_OBJECT
195 public:
196 MenuSoundsPage(QObject *parent = nullptr);
197 QWidget *widget();
198 };
199
200 /************************************************************
201 Input
202 ************************************************************/
203 class InputCategory : public OptionsCategory
204 {
205 public:
206 InputCategory(QWidget *parent);
207 QVector<OptionsPage*> pages();
208 };
209
210 class InputPage : public OptionsPage
211 {
212 Q_OBJECT
213 public:
214 InputPage(QObject *parent = nullptr);
215 QWidget *widget();
216 };
217
218 class HotkeyBindsPage : public OptionsPage
219 {
220 Q_OBJECT
221 public:
222 HotkeyBindsPage(QObject *parent = nullptr);
223 QWidget *widget();
224 };
225
226 class UserBindsPage : public OptionsPage
227 {
228 Q_OBJECT
229 public:
230 UserBindsPage(QObject *parent = nullptr);
231 QWidget *widget();
232 };
233
234 /************************************************************
235 Latency
236 ************************************************************/
237 class LatencyCategory : public OptionsCategory
238 {
239 public:
240 LatencyCategory(QWidget *parent);
241 QVector<OptionsPage*> pages();
242 };
243
244 class LatencyPage : public OptionsPage
245 {
246 Q_OBJECT
247 public:
248 LatencyPage(QObject *parent = nullptr);
249 QWidget *widget();
250 };
251
252 /************************************************************
253 Core
254 ************************************************************/
255 class CoreCategory : public OptionsCategory
256 {
257 public:
258 CoreCategory(QWidget *parent);
259 QVector<OptionsPage*> pages();
260 };
261
262 class CorePage : public OptionsPage
263 {
264 Q_OBJECT
265 public:
266 CorePage(QObject *parent = nullptr);
267 QWidget *widget();
268 };
269
270 /************************************************************
271 Configuration
272 ************************************************************/
273 class ConfigurationCategory : public OptionsCategory
274 {
275 public:
276 ConfigurationCategory(QWidget *parent);
277 QVector<OptionsPage*> pages();
278 };
279
280 class ConfigurationPage : public OptionsPage
281 {
282 Q_OBJECT
283 public:
284 ConfigurationPage(QObject *parent = nullptr);
285 QWidget *widget();
286 };
287
288 /************************************************************
289 Saving
290 ************************************************************/
291 class SavingCategory : public OptionsCategory
292 {
293 public:
294 SavingCategory(QWidget *parent);
295 QVector<OptionsPage*> pages();
296 };
297
298 class SavingPage : public OptionsPage
299 {
300 Q_OBJECT
301 public:
302 SavingPage(QObject *parent = nullptr);
303 QWidget *widget();
304 };
305
306 /************************************************************
307 Logging
308 ************************************************************/
309 class LoggingCategory : public OptionsCategory
310 {
311 public:
312 LoggingCategory(QWidget *parent);
313 QVector<OptionsPage*> pages();
314 };
315
316 class LoggingPage : public OptionsPage
317 {
318 Q_OBJECT
319 public:
320 LoggingPage(QObject *parent = nullptr);
321 QWidget *widget();
322 };
323
324 /************************************************************
325 Frame Throttle
326 ************************************************************/
327 class FrameThrottleCategory : public OptionsCategory
328 {
329 public:
330 FrameThrottleCategory(QWidget *parent);
331 QVector<OptionsPage*> pages();
332 };
333
334 class FrameThrottlePage : public OptionsPage
335 {
336 Q_OBJECT
337 public:
338 FrameThrottlePage(QObject *parent = nullptr);
339 QWidget *widget();
340 };
341
342 class RewindPage : public OptionsPage
343 {
344 Q_OBJECT
345 public:
346 RewindPage(QObject *parent = nullptr);
347 QWidget *widget();
348 };
349
350 /************************************************************
351 Recording
352 ************************************************************/
353 class RecordingCategory : public OptionsCategory
354 {
355 public:
356 RecordingCategory(QWidget *parent);
357 QVector<OptionsPage*> pages();
358 };
359
360 class RecordingPage : public OptionsPage
361 {
362 Q_OBJECT
363 public:
364 RecordingPage(QObject *parent = nullptr);
365 QWidget *widget();
366 };
367
368 /************************************************************
369 User Interface
370 ************************************************************/
371 class UserInterfaceCategory : public OptionsCategory
372 {
373 public:
374 UserInterfaceCategory(QWidget *parent);
375 UserInterfaceCategory(MainWindow *mainwindow, QWidget *parent);
376 QVector<OptionsPage*> pages();
377 private:
378 MainWindow *m_mainwindow;
379 };
380
381 class UserInterfacePage : public OptionsPage
382 {
383 Q_OBJECT
384 public:
385 UserInterfacePage(QObject *parent = nullptr);
386 QWidget *widget();
387 };
388
389 class ViewsPage : public OptionsPage
390 {
391 Q_OBJECT
392 public:
393 ViewsPage(QObject *parent = nullptr);
394 QWidget *widget();
395 };
396
397 class QuickMenuPage : public OptionsPage
398 {
399 Q_OBJECT
400 public:
401 QuickMenuPage(QObject *parent = nullptr);
402 QWidget *widget();
403 };
404
405 class AppearancePage : public OptionsPage
406 {
407 Q_OBJECT
408 public:
409 AppearancePage(QObject *parent = nullptr);
410 QWidget *widget();
411 };
412
413 class DesktopMenuPage : public OptionsPage
414 {
415 Q_OBJECT
416 public:
417 DesktopMenuPage(MainWindow *mainwindow, QObject *parent = nullptr);
418 QWidget *widget();
419 void load();
420 void apply();
421 private:
422 ViewOptionsWidget *m_widget;
423 };
424
425 /************************************************************
426 Onscreen Display
427 ************************************************************/
428 class OnscreenDisplayCategory : public OptionsCategory
429 {
430 public:
431 OnscreenDisplayCategory(QWidget *parent);
432 QVector<OptionsPage*> pages();
433 };
434
435 class OverlayPage : public OptionsPage
436 {
437 Q_OBJECT
438 public:
439 OverlayPage(QObject *parent = nullptr);
440 QWidget *widget();
441 };
442
443 class NotificationsPage : public OptionsPage
444 {
445 Q_OBJECT
446 public:
447 NotificationsPage(QObject *parent = nullptr);
448 QWidget *widget();
449 };
450
451 /************************************************************
452 Achievements
453 ************************************************************/
454 class AchievementsCategory : public OptionsCategory
455 {
456 public:
457 AchievementsCategory(QWidget *parent);
458 QVector<OptionsPage*> pages();
459 };
460
461 class AchievementsPage : public OptionsPage
462 {
463 Q_OBJECT
464 public:
465 AchievementsPage(QObject *parent = nullptr);
466 QWidget *widget();
467 };
468
469 /************************************************************
470 Network
471 ************************************************************/
472 class NetworkCategory : public OptionsCategory
473 {
474 public:
475 NetworkCategory(QWidget *parent);
476 QVector<OptionsPage*> pages();
477 };
478
479 class NetplayPage : public OptionsPage
480 {
481 Q_OBJECT
482 public:
483 NetplayPage(QObject *parent = nullptr);
484 QWidget *widget();
485 private slots:
486 void onRadioButtonClicked(int);
487 private:
488 QGroupBox* createMitmServerGroup();
489 };
490
491 class UpdaterPage : public OptionsPage
492 {
493 Q_OBJECT
494 public:
495 UpdaterPage(QObject *parent = nullptr);
496 QWidget *widget();
497 };
498
499 /************************************************************
500 Playlists
501 ************************************************************/
502 class PlaylistsCategory : public OptionsCategory
503 {
504 public:
505 PlaylistsCategory(QWidget *parent);
506 QVector<OptionsPage*> pages();
507 };
508
509 class PlaylistsPage : public OptionsPage
510 {
511 Q_OBJECT
512 public:
513 PlaylistsPage(QObject *parent = nullptr);
514 QWidget *widget();
515 };
516
517 class AccountsPage : public OptionsPage
518 {
519 Q_OBJECT
520 public:
521 AccountsPage(QObject *parent = nullptr);
522 QWidget *widget();
523 };
524
525 /************************************************************
526 User
527 ************************************************************/
528 class UserCategory : public OptionsCategory
529 {
530 public:
531 UserCategory(QWidget *parent);
532 QVector<OptionsPage*> pages();
533 };
534
535 class UserPage : public OptionsPage
536 {
537 Q_OBJECT
538 public:
539 UserPage(QObject *parent = nullptr);
540 QWidget *widget();
541 };
542
543 /************************************************************
544 Directory
545 ************************************************************/
546 class DirectoryCategory : public OptionsCategory
547 {
548 public:
549 DirectoryCategory(QWidget *parent);
550 QVector<OptionsPage*> pages();
551 };
552
553 class DirectoryPage : public OptionsPage
554 {
555 Q_OBJECT
556 public:
557 DirectoryPage(QObject *parent = nullptr);
558 QWidget *widget();
559 };
560
create_widget(enum menu_displaylist_ctl_state name)561 static inline QWidget *create_widget(enum menu_displaylist_ctl_state name)
562 {
563 unsigned i;
564 QWidget *widget = new QWidget;
565 FormLayout *layout = new FormLayout;
566 file_list_t *list = (file_list_t*)calloc(1, sizeof(*list));
567 settings_t *settings = config_get_ptr();
568
569 menu_displaylist_build_list(list, settings, name, true);
570
571 for (i = 0; i < list->size; i++)
572 {
573 menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
574 file_list_get_actiondata_at_offset(list, i);
575
576 layout->add(cbs->enum_idx);
577 }
578
579 file_list_free(list);
580
581 widget->setLayout(layout);
582
583 return widget;
584 }
585
586 #endif
587