summaryrefslogblamecommitdiffstats
path: root/src/slxoutput.h
blob: 4df64fa8fb4915aae3608cfc0f54c0178394fdb6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                      











                                                                       

                         



                                                                       

                                                          







                                                                               



                
                   
                



                       






                                        
#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; }
    bool isDevice() const { return !_deviceId.isEmpty(); }
    ItemType type() const { return _type; }

    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