diff options
Diffstat (limited to 'src/model/ossmodel.h')
| -rw-r--r-- | src/model/ossmodel.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/model/ossmodel.h b/src/model/ossmodel.h new file mode 100644 index 0000000..8c3db8b --- /dev/null +++ b/src/model/ossmodel.h @@ -0,0 +1,50 @@ +#pragma once + +#include <tqobject.h> +#include <tqptrlist.h> +#include <tqvaluelist.h> +#include <tqstring.h> + +#include "ossdevice.h" + +class TQTimer; + +struct OssCard { + int index; + TQString path; + TQString name; +}; + +class OssModel : public TQObject +{ + TQ_OBJECT +public: + explicit OssModel( TQObject *parent = 0 ); + ~OssModel(); + + bool open(); + void close(); + + TQValueList<OssCard> cards() const { return m_cards; } + TQPtrList<OssDevice> devices() const { return m_devices; } + TQPtrList<OssDevice> devicesForCard( int cardIdx ) const; + OssDevice *defaultOutput() const; + OssDevice *preferredOutput() const; + void setPreferredOutput( int cardIdx, const TQString &name ); + +signals: + void deviceAdded( OssDevice *dev ); + void preferredOutputChanged( OssDevice *dev ); + void ready(); + +private slots: + void onPollTimer(); + +private: + void openCard( int cardIdx, const TQString &path ); + + TQValueList<OssCard> m_cards; + TQPtrList<OssDevice> m_devices; + TQValueList<int> m_fds; // one open fd per card, owned here + TQTimer *m_timer; +}; |
