summaryrefslogtreecommitdiffstats
path: root/src/yuzu/configuration/configuration_shared.h
blob: 312b9e549063042d8458947fdd77b4a9522d2d0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include <QCheckBox>
#include <QComboBox>
#include <QString>
#include "core/settings.h"

namespace ConfigurationShared {

constexpr int USE_GLOBAL_INDEX = 0;
constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1;
constexpr int USE_GLOBAL_OFFSET = 2;

enum class CheckState {
    Off,
    On,
    Global,
    Count,
};

// Global-aware apply and set functions

void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox,
                         const CheckState& tracker);
void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox);
void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting,
                         const QComboBox* combobox);
void ApplyPerGameSetting(Settings::Setting<Settings::GPUAccuracy>* setting,
                         const QComboBox* combobox);

void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting);
void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<int>* setting);
void SetPerGameSetting(QComboBox* combobox,
                       const Settings::Setting<Settings::RendererBackend>* setting);
void SetPerGameSetting(QComboBox* combobox,
                       const Settings::Setting<Settings::GPUAccuracy>* setting);

void SetHighlight(QWidget* widget, bool highlighted);
void SetColoredTristate(QCheckBox* checkbox, const Settings::Setting<bool>& setting,
                        CheckState& tracker);
void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state,
                        CheckState& tracker);
void SetColoredComboBox(QComboBox* combobox, QWidget* target, int global);

void InsertGlobalItem(QComboBox* combobox, int global_index);

} // namespace ConfigurationShared