comparison src/gui/dialog/settings/recognition.cc @ 258:862d0d8619f6

*: HUUUGE changes animia has been renamed to animone, so instead of thinking of a health condition, you think of a beautiful flower :) I've also edited some of the code for animone, but I have no idea if it even works or not because I don't have a mac or windows machine lying around. whoops! ... anyway, all of the changes divergent from Anisthesia are now licensed under BSD. it's possible that I could even rewrite most of the code to where I don't even have to keep the MIT license, but that's thinking too far into the future I've been slacking off on implementing the anime seasons page, mostly out of laziness. I think I'd have to create another db file specifically for the seasons anyway, this code is being pushed *primarily* because the hard drive it's on is failing! yay :)
author Paper <paper@paper.us.eu.org>
date Mon, 01 Apr 2024 02:43:44 -0400
parents ff0061e75f0f
children 99cbc51433e4
comparison
equal deleted inserted replaced
257:699a20c57dc8 258:862d0d8619f6
1 #include "core/session.h" 1 #include "core/session.h"
2 #include "core/strings.h" 2 #include "core/strings.h"
3 #include "gui/dialog/settings.h" 3 #include "gui/dialog/settings.h"
4 4
5 #include <QCheckBox>
6 #include <QGroupBox>
7 #include <QLabel>
5 #include <QListWidget> 8 #include <QListWidget>
6 #include <QListWidgetItem> 9 #include <QListWidgetItem>
7 #include <QGroupBox>
8 #include <QCheckBox>
9 #include <QLabel>
10 #include <QSizePolicy> 10 #include <QSizePolicy>
11 #include <QVBoxLayout> 11 #include <QVBoxLayout>
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
35 35
36 { 36 {
37 QListWidget* listwidget = new QListWidget(widget); 37 QListWidget* listwidget = new QListWidget(widget);
38 for (size_t i = 0; i < players.size(); i++) { 38 for (size_t i = 0; i < players.size(); i++) {
39 const auto& [enabled, player] = players[i]; 39 const auto& [enabled, player] = players[i];
40 if (player.type == animia::PlayerType::Default) { 40 if (player.type == animone::PlayerType::Default) {
41 QListWidgetItem* item = new QListWidgetItem(listwidget); 41 QListWidgetItem* item = new QListWidgetItem(listwidget);
42 item->setCheckState(enabled ? Qt::Checked : Qt::Unchecked); 42 item->setCheckState(enabled ? Qt::Checked : Qt::Unchecked);
43 item->setText(Strings::ToQString(player.name)); 43 item->setText(Strings::ToQString(player.name));
44 item->setData(Qt::UserRole, QVariant::fromValue(i)); 44 item->setData(Qt::UserRole, QVariant::fromValue(i));
45 } 45 }
46 } 46 }
47 connect(listwidget, &QListWidget::itemChanged, this, [this](QListWidgetItem* item){ 47 connect(listwidget, &QListWidget::itemChanged, this, [this](QListWidgetItem* item) {
48 if (!item) 48 if (!item)
49 return; 49 return;
50 size_t i = item->data(Qt::UserRole).toUInt(); 50 size_t i = item->data(Qt::UserRole).toUInt();
51 players[i].enabled = item->checkState(); 51 players[i].enabled = item->checkState();
52 }); 52 });
72 session.config.recognition.detect_media_players = detect_media_players; 72 session.config.recognition.detect_media_players = detect_media_players;
73 session.config.recognition.players = players; 73 session.config.recognition.players = players;
74 } 74 }
75 75
76 SettingsPageRecognition::SettingsPageRecognition(QWidget* parent) 76 SettingsPageRecognition::SettingsPageRecognition(QWidget* parent)
77 : SettingsPage(parent, tr("Recognition")), 77 : SettingsPage(parent, tr("Recognition")), players(session.config.recognition.players) {
78 players(session.config.recognition.players) {
79 detect_media_players = session.config.recognition.detect_media_players; 78 detect_media_players = session.config.recognition.detect_media_players;
80 AddTab(CreatePlayersWidget(), tr("Media players")); 79 AddTab(CreatePlayersWidget(), tr("Media players"));
81 } 80 }