1 /*************************************************************************** 2 ** ** 3 ** Polyphone, a soundfont editor ** 4 ** Copyright (C) 2013-2020 Davy Triponney ** 5 ** 2014 Andrea Celani ** 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 ** Author: Davy Triponney ** 22 ** Website/Contact: https://www.polyphone-soundfonts.com ** 23 ** Date: 01.01.2013 ** 24 ***************************************************************************/ 25 26 #ifndef MODULATORCOMBODEST_H 27 #define MODULATORCOMBODEST_H 28 29 #include <QComboBox> 30 #include "basetypes.h" 31 32 class ModulatorComboDest : public QComboBox 33 { 34 Q_OBJECT 35 36 public: 37 ModulatorComboDest(QWidget* parent = nullptr); 38 39 // Initialize the combobox 40 void initialize(EltID id); 41 void initialize(quint16 index); 42 43 // Load value 44 void loadValue(); 45 46 // Get the attribute 47 AttributeType getCurrentAttribute(); 48 49 // Keep a minimum width of 50px, regardless the content of the ComboBox sizeHint()50 QSize sizeHint() const override { return minimumSizeHint(); } minimumSizeHint()51 QSize minimumSizeHint() const override { return QSize(50, QComboBox::minimumSizeHint().height()); } 52 53 private slots: 54 void onCurrentIndexChanged(int index); 55 56 private: 57 void selectAttribute(AttributeType attribute); 58 void selectIndex(int index); 59 int getCurrentIndex(); 60 61 QList<AttributeType> _destIndex; 62 EltID _id; 63 QList<int> _listIndex; 64 }; 65 66 #endif // MODULATORCOMBODEST_H 67