summaryrefslogtreecommitdiffstats
path: root/src/slxoutput.h
blob: c1758993ad9381a55b22214bfd3e67ec59a0c890 (plain) (blame)
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
#ifndef _SLX_OUTPUT_H_
#define _SLX_OUTPUT_H_

#include <QWidget>
#include <QTimer>

#include "ui_slxoutput.h"

class SlxOutput : public QWidget, public Ui::SlxOutput
{
    Q_OBJECT
public:

    enum ItemType {
        UnknownItem,
        SinkPortItem,
        SourcePortItem,
        CardProfileItem,
    };

    SlxOutput(ItemType type, const QString &id,
                         const QString &card, const QString &profile,
                         const QString &sink, const QString &port,
                         const QString &heading, const QString &title);
    virtual ~SlxOutput();

    void updateDeviceAndPort(bool isDefault, bool isMuted, int volume);
    void updateCardAndProfile();

    const QString &deviceId() const { return _deviceId; }
    const bool isDevice() const { return !_deviceId.isEmpty(); }

    int compareTo(SlxOutput* other) const
    {
        int c = this->nameLabel->text().compare(other->nameLabel->text());
        if (c != 0)
            return c;
        return this->headingLabel->text().compare(other->headingLabel->text());
    }

    bool unused;

private:
    ItemType _type;
    QString _id;
    QString _cardId;
    QString _profileId;
    QString _deviceId;
    QString _portId;
    QTimer _volumeTimer;

private slots:
    void volumeSliderChanged(int value);
};

#endif