aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-08-20 18:32:35 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-08-20 18:32:35 +0000
commit2377d964117b1ec23f43ce0ec26c98da8c89cb97 (patch)
tree48ed6426bd0f18a84c79d95c140d586db164f291 /lib
parent3005121db65b4d0ce8829755eb9a43d8e94d17ba (diff)
downloadqmmp-2377d964117b1ec23f43ce0ec26c98da8c89cb97.tar.gz
qmmp-2377d964117b1ec23f43ce0ec26c98da8c89cb97.tar.bz2
qmmp-2377d964117b1ec23f43ce0ec26c98da8c89cb97.zip
added copy constructor for OutputState class
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@115 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'lib')
-rw-r--r--lib/output.h109
1 files changed, 82 insertions, 27 deletions
diff --git a/lib/output.h b/lib/output.h
index c5fa0941a..57bee8c9d 100644
--- a/lib/output.h
+++ b/lib/output.h
@@ -32,49 +32,99 @@ public:
OutputState()
: m_type(Stopped), m_error_msg(0), m_elasped_seconds(0),
- m_written_bytes(0), m_brate(0), m_freq(0), m_prec(0), m_chan(0),
- m_left(0), m_right(0)
+ m_written_bytes(0), m_brate(0), m_freq(0), m_prec(0), m_chan(0),
+ m_left(0), m_right(0)
{}
+ OutputState(const OutputState &st)
+ : m_type(Stopped), m_error_msg(0), m_elasped_seconds(0),
+ m_written_bytes(0), m_brate(0), m_freq(0), m_prec(0), m_chan(0),
+ m_left(0), m_right(0)
+ {
+ m_type = st.type();
+ if (m_type == Info)
+ {
+ m_elasped_seconds = st.elapsedSeconds();
+ m_written_bytes = st.writtenBytes();
+ m_brate = st.bitrate();
+ m_freq = st.frequency();
+ m_prec = st.precision();
+ m_chan = st.channels();
+ m_left = st.leftVolume();
+ m_right = st.rightVolume();
+ }
+ else if (m_type == Error)
+ m_error_msg = new QString(*st.errorMessage());
+ }
OutputState(Type t)
: m_type(t), m_error_msg(0), m_elasped_seconds(0),
- m_written_bytes(0), m_brate(0), m_freq(0), m_prec(0), m_chan(0),
- m_left(0), m_right(0)
- {}
+ m_written_bytes(0), m_brate(0), m_freq(0), m_prec(0), m_chan(0),
+ m_left(0), m_right(0)
+{}
OutputState(long s, unsigned long w, int b, int f, int p, int c)
: m_type(Info), m_error_msg(0), m_elasped_seconds(s),
- m_written_bytes(w), m_brate(b), m_freq(f), m_prec(p), m_chan(c),
- m_left(0), m_right(0)
+ m_written_bytes(w), m_brate(b), m_freq(f), m_prec(p), m_chan(c),
+ m_left(0), m_right(0)
{}
OutputState(int L, int R)
: m_type(Volume), m_error_msg(0), m_elasped_seconds(0),
- m_written_bytes(0), m_brate(0), m_freq(0), m_prec(0), m_chan(0),
- m_left(L), m_right(R)
+ m_written_bytes(0), m_brate(0), m_freq(0), m_prec(0), m_chan(0),
+ m_left(L), m_right(R)
{}
OutputState(const QString &e)
: m_type(Error), m_elasped_seconds(0), m_written_bytes(0),
- m_brate(0), m_freq(0), m_prec(0), m_chan(0),
- m_left(0), m_right(0)
+ m_brate(0), m_freq(0), m_prec(0), m_chan(0),
+ m_left(0), m_right(0)
{
- m_error_msg = new QString(e);
+ m_error_msg = new QString(e);
}
~OutputState()
{
- if (m_error_msg)
- delete m_error_msg;
+ if (m_error_msg)
+ delete m_error_msg;
}
- const QString *errorMessage() const { return m_error_msg; }
+ const QString *errorMessage() const
+ {
+ return m_error_msg;
+ }
- const long &elapsedSeconds() const { return m_elasped_seconds; }
- const unsigned long &writtenBytes() const { return m_written_bytes; }
- const int &bitrate() const { return m_brate; }
- const int &frequency() const { return m_freq; }
- const int &precision() const { return m_prec; }
- const int &channels() const { return m_chan; }
- const Type &type() const { return m_type; }
- const int leftVolume() const { return m_left; }
- const int rightVolume() const { return m_right; }
+ const long &elapsedSeconds() const
+ {
+ return m_elasped_seconds;
+ }
+ const unsigned long &writtenBytes() const
+ {
+ return m_written_bytes;
+ }
+ const int &bitrate() const
+ {
+ return m_brate;
+ }
+ const int &frequency() const
+ {
+ return m_freq;
+ }
+ const int &precision() const
+ {
+ return m_prec;
+ }
+ const int &channels() const
+ {
+ return m_chan;
+ }
+ const Type &type() const
+ {
+ return m_type;
+ }
+ const int leftVolume() const
+ {
+ return m_left;
+ }
+ const int rightVolume() const
+ {
+ return m_right;
+ }
private:
Type m_type;
@@ -111,7 +161,10 @@ public:
return &mtx;
}
- VolumeType volumeControl(){return m_vol; };
+ VolumeType volumeControl()
+ {
+ return m_vol;
+ };
// abstract
virtual bool isInitialized() const = 0;
@@ -123,7 +176,8 @@ public:
virtual long written() = 0;
virtual long latency() = 0;
virtual void seek(long) = 0;
- virtual void setVolume(int, int) {};
+ virtual void setVolume(int, int)
+ {};
static void registerFactory(OutputFactory *);
static Output *create(QObject *);
@@ -131,7 +185,8 @@ public:
static QStringList outputFiles();
public slots:
- virtual void checkVolume() {};
+ virtual void checkVolume()
+ {};
signals:
void stateChanged(const OutputState&);