File indexing completed on 2024-05-05 04:48:25
0001 /**************************************************************************************** 0002 * Copyright (c) 2004-2009 Mark Kretschmann <kretschmann@kde.org> * 0003 * Copyright (c) 2009 Artur Szymiec <artur.szymiec@gmail.com> * 0004 * Copyright (c) 2013 Ralf Engels <ralf-engels@gmx.de> * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify it under * 0007 * the terms of the GNU General Public License as published by the Free Software * 0008 * Foundation; either version 2 of the License, or (at your option) any later * 0009 * version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0013 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License along with * 0016 * this program. If not, see <http://www.gnu.org/licenses/>. * 0017 ****************************************************************************************/ 0018 0019 #ifndef EQUALIZERDIALOG_H 0020 #define EQUALIZERDIALOG_H 0021 0022 #include "ui_EqualizerDialog.h" 0023 0024 #include <equalizer/EqualizerPresets.h> 0025 0026 #include <QDialog> 0027 0028 class EqualizerDialog : public QDialog, public Ui_EqualizerDialog 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 ~EqualizerDialog() override; 0034 0035 static void showOnce( QWidget *parent = nullptr ); 0036 0037 /** Returns the untranslated current preset name. */ 0038 QString selectedPresetName() const; 0039 0040 /** Returns the current gain settings */ 0041 QList<int> gains() const; 0042 0043 private Q_SLOTS: 0044 /** Updates the enabled states of different ui components. */ 0045 void updateUi(); 0046 0047 /** Set the index of the current preset. 0048 Will update the UI */ 0049 void presetApplied( int index ); 0050 0051 /** Updates the tool tips, labels, configuration and engine */ 0052 void bandsChanged(); 0053 0054 void updatePresets(); 0055 0056 void savePreset(); 0057 void deletePreset(); 0058 void restorePreset(); 0059 void restoreOriginalSettings(); 0060 void gainsChanged( const QList<int> &gains ); 0061 void presetsChanged( const QString &name ); 0062 void toggleEqualizer( bool enabled ); 0063 0064 private: 0065 explicit EqualizerDialog( QWidget *parent = nullptr ); 0066 0067 void updateToolTips(); 0068 void updateLabels(); 0069 void storeOriginalSettings(); 0070 0071 double mValueScale; 0072 QVector<QSlider*> m_bands; 0073 QVector<QLabel*> m_bandValues; 0074 QVector<QLabel*> m_bandLabels; 0075 0076 /** The preset and gains at the time "showOnce" was called. */ 0077 bool m_originalActivated; 0078 QString m_originalPreset; 0079 QList<int> m_originalGains; 0080 0081 static EqualizerDialog *s_instance; 0082 }; 0083 0084 0085 #endif // EQUALIZERDIALOG_H