~ubuntu-branches/ubuntu/utopic/lmms/utopic

« back to all changes in this revision

Viewing changes to src/gui/widgets/SendButtonIndicator.cpp

  • Committer: Package Import Robot
  • Author(s): Israel Dahl
  • Date: 2014-04-30 18:49:37 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20140430184937-hozuuxonlbshciya
Tags: 1.0.1-src-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "SendButtonIndicator.h"
2
 
 
3
 
#include "engine.h"
4
 
#include "FxMixer.h"
5
 
#include "Model.h"
6
 
 
7
 
SendButtonIndicator:: SendButtonIndicator( QWidget * _parent, FxLine * _owner,
8
 
                                                                                   FxMixerView * _mv) :
9
 
        QLabel( _parent ),
10
 
        m_parent( _owner ),
11
 
        m_mv( _mv )
12
 
{
13
 
        qpmOff = embed::getIconPixmap("mixer_send_off", 23, 16);
14
 
        qpmOn = embed::getIconPixmap("mixer_send_on", 23, 16);
15
 
 
16
 
        // don't do any initializing yet, because the FxMixerView and FxLine
17
 
        // that were passed to this constructor are not done with their constructors
18
 
        // yet.
19
 
 
20
 
}
21
 
 
22
 
void SendButtonIndicator::mousePressEvent( QMouseEvent * e )
23
 
{
24
 
        FxMixer * mix = engine::fxMixer();
25
 
        int from = m_mv->currentFxLine()->channelIndex();
26
 
        int to = m_parent->channelIndex();
27
 
        FloatModel * sendModel = mix->channelSendModel(from, to);
28
 
        if( sendModel == NULL )
29
 
        {
30
 
                // not sending. create a mixer send.
31
 
                mix->createChannelSend( from, to );
32
 
        }
33
 
        else
34
 
        {
35
 
                // sending. delete the mixer send.
36
 
                mix->deleteChannelSend( from, to );
37
 
        }
38
 
 
39
 
        m_mv->updateFxLine(m_parent->channelIndex());
40
 
        updateLightStatus();
41
 
}
42
 
 
43
 
FloatModel * SendButtonIndicator::getSendModel()
44
 
{
45
 
        FxMixer * mix = engine::fxMixer();
46
 
        return mix->channelSendModel(
47
 
                m_mv->currentFxLine()->channelIndex(), m_parent->channelIndex());
48
 
}
49
 
 
50
 
void SendButtonIndicator::updateLightStatus()
51
 
{
52
 
        setPixmap( getSendModel() == NULL ? qpmOff : qpmOn );
53
 
}