summaryrefslogtreecommitdiff
path: root/src/ui/devicespage.h
blob: feedcdd0dc43bb9226023160d66e7aef032a0c13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once

#include <stdint.h>
#include <tqwidget.h>
#include <tqmap.h>
#include <tqvaluelist.h>
#include <tqstring.h>
#include "../model/pulsemodel.h"

class TQGridLayout;
class TQScrollView;
class TQComboBox;
class TQLabel;
class TQVBoxLayout;
class AudioDevice;

struct PortWidgets {
    TQLabel *dot;
};

class DevicesPage : public TQWidget
{
    TQ_OBJECT

public:
    explicit DevicesPage( PulseModel *model, TQWidget *parent = 0 );

private slots:
    void onCardAdded( uint32_t index );
    void onCardRemoved( uint32_t index );
    void onCardUpdated( uint32_t index );
    void onProfileActivated( int comboIndex );
    void onSinkPortActivated( int comboIndex );
    void onSourcePortActivated( int comboIndex );
    void onSinkUpdated( uint32_t paIndex );
    void onSourceUpdated( uint32_t paIndex );

private:
    void rebuild();
    void addPortCombos( TQGridLayout *grid, int &gridRow, TQWidget *grp,
                        const TQValueList<PulseModel::DevicePortInfo> &devices,
                        bool isSink );
    void updatePortCombo( uint32_t paIndex, bool isSink );

    PulseModel   *m_model;
    TQScrollView  *m_scroll;
    TQWidget      *m_container;

    // Profile combos
    TQMap<TQComboBox*, uint32_t>               m_comboCard;
    TQMap<TQComboBox*, TQValueList<TQString>>  m_profileNames;
    TQMap<uint32_t, TQComboBox*>              m_cardCombo;
    TQMap<uint32_t, TQValueList<PortWidgets>> m_cardPorts;

    // Sink port combos
    TQMap<TQComboBox*, uint32_t>               m_sinkPortComboSink;
    TQMap<TQComboBox*, TQValueList<TQString>>  m_sinkPortComboNames;
    TQMap<uint32_t, TQComboBox*>              m_sinkPortCombos;

    // Source port combos
    TQMap<TQComboBox*, uint32_t>               m_sourcePortComboSource;
    TQMap<TQComboBox*, TQValueList<TQString>>  m_sourcePortComboNames;
    TQMap<uint32_t, TQComboBox*>              m_sourcePortCombos;
};