Sayonara Player
EqualizerSetting.h
1 /* EqualizerSetting.h */
2 
3 /* Copyright (C) 2011 Michael Lugmair (Lucio Carreras)
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef EQUALIZER_SETTING_H_
22 #define EQUALIZER_SETTING_H_
23 
24 #include "Utils/Pimpl.h"
25 #include "Utils/Settings/SettingConvertible.h"
26 
27 #include <QString>
28 #include <array>
29 
36  public SettingConvertible
37 {
38  PIMPL(EqualizerSetting)
39 
40 public:
41 
42  using ValueArray=std::array<int, 10>;
43 
44  EqualizerSetting(const QString& name=QString());
45  EqualizerSetting(const QString& name, const ValueArray& values);
46  EqualizerSetting(const EqualizerSetting& other);
47  ~EqualizerSetting() override;
48 
49  EqualizerSetting& operator=(const EqualizerSetting& s);
50 
56  bool operator==(const EqualizerSetting& s) const;
57 
62  QString name() const;
63 
68  void setName(const QString& name);
69 
74  ValueArray values() const;
75 
81  int value(int idx) const;
82 
88  void setValue(int idx, int val);
89 
96  void setValues(const ValueArray& values);
97 
103 // void append_value(int val);
104 
109  bool isDefault() const;
110 
115  bool isDefaultName() const;
116 
122 
129  static ValueArray getDefaultValues(const QString& name);
130 
136  static bool isDefaultName(const QString& name);
137 
144  bool loadFromString(const QString& str) override;
145 
150  QString toString() const override;
151 };
152 
153 #endif
EqualizerSetting::loadFromString
bool loadFromString(const QString &str) override
converts a string to a EQ_Setting. If not possible a default constructed EQ_Setting is returned
EqualizerSetting::setValue
void setValue(int idx, int val)
set specific value for band
EqualizerSetting::operator==
bool operator==(const EqualizerSetting &s) const
Compares the case insensitive string representation of two settings.
EqualizerSetting::setValues
void setValues(const ValueArray &values)
set all values for a specific index. If there are more than 10 values, list is stripped....
EqualizerSetting::isDefault
bool isDefault() const
append a value. If there are already more than 10 values, nothing happens
QList
Definition: EngineUtils.h:33
SettingConvertible
Definition: SettingConvertible.h:28
EqualizerSetting
The EQ_Setting class. Container for Equalizer configurations.
Definition: EqualizerSetting.h:35
EqualizerSetting::name
QString name() const
get name of setting
EqualizerSetting::isDefaultName
bool isDefaultName() const
checks, if the preset name belongs to a default preset
EqualizerSetting::value
int value(int idx) const
get specific value for a band idx. if idx is not valid, 0 is returned
EqualizerSetting::getDefaults
static QList< EqualizerSetting > getDefaults()
get default settings
EqualizerSetting::values
ValueArray values() const
get database values for setting
EqualizerSetting::toString
QString toString() const override
converts EQ_Setting to string
EqualizerSetting::setName
void setName(const QString &name)
set name of setting
EqualizerSetting::getDefaultValues
static ValueArray getDefaultValues(const QString &name)
get default values for a specific preset. If the preset does not have default values,...