1 //=============================================================================
2 //  MuseScore
3 //  Music Composition & Notation
4 //
5 //  Copyright (C) 2002-2016 Werner Schweer and others
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 version 2.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #include "voicingSelect.h"
21 
22 namespace Ms {
23 
VoicingSelect(QWidget * parent)24 VoicingSelect::VoicingSelect(QWidget* parent)
25    : QWidget(parent)
26       {
27       setupUi(this);
28 
29       //setup changed signals
30       connect(interpretBox, SIGNAL(currentIndexChanged(int)), SLOT(_voicingChanged()));
31       connect(voicingBox, SIGNAL(currentIndexChanged(int)), SLOT(_voicingChanged()));
32       connect(durationBox, SIGNAL(currentIndexChanged(int)), SLOT(_voicingChanged()));
33       }
34 
_voicingChanged()35 void VoicingSelect::_voicingChanged()
36       {
37       emit voicingChanged(interpretBox->currentIndex(), voicingBox->currentIndex(), durationBox->currentIndex());
38       }
39 
blockVoicingSignals(bool val)40 void VoicingSelect::blockVoicingSignals(bool val)
41       {
42       interpretBox->blockSignals(val);
43       voicingBox->blockSignals(val);
44       durationBox->blockSignals(val);
45       }
46 
setVoicing(int idx)47 void VoicingSelect::setVoicing(int idx)
48       {
49       blockVoicingSignals(true);
50       voicingBox->setCurrentIndex(idx);
51       blockVoicingSignals(false);
52       }
53 
setLiteral(bool literal)54 void VoicingSelect::setLiteral(bool literal)
55       {
56       blockVoicingSignals(true);
57       interpretBox->setCurrentIndex(literal);
58       blockVoicingSignals(false);
59       }
60 
setDuration(int idx)61 void VoicingSelect::setDuration(int idx)
62       {
63       blockVoicingSignals(true);
64       durationBox->setCurrentIndex(idx);
65       blockVoicingSignals(false);
66       }
67 
68 }
69