ripping.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef RIPPING_H
00022 #define RIPPING_H
00023
00024 #include <QPointer>
00025 #include "streamripper_base.h"
00026 #include "propertyvalue.h"
00027
00046 class ripping : public streamripper_base
00047 {
00048
00049 Q_OBJECT
00050
00087 Q_PROPERTY(PropertyValue bitrate READ bitrate)
00088
00089
00116 Q_PROPERTY(PropertyValue dataSize READ dataSize)
00117
00155 Q_PROPERTY(PropertyValue error READ error)
00156
00200 Q_PROPERTY(bool isRunning READ isRunning)
00201
00235 Q_PROPERTY(PropertyValue metaInterval READ metaInterval)
00236
00273 Q_PROPERTY(PropertyValue metaInterval_milliSeconds READ metaInterval_milliSeconds STORED false)
00274
00304 Q_PROPERTY(PropertyValue relayPort READ relayPort)
00305
00324 Q_PROPERTY(PropertyValue serverName READ serverName)
00325
00342 Q_PROPERTY(PropertyValue song READ song)
00343
00358 Q_PROPERTY(PropertyValue status READ status)
00359
00378 Q_PROPERTY(PropertyValue streamName READ streamName)
00379
00380 public:
00381
00403 enum statusType {
00404 idle,
00405 is_starting,
00406 is_connecting,
00407 is_buffering,
00408 is_skipping,
00409 is_ripping,
00410 is_saving };
00411
00412
00415 ripping(QObject *parent);
00417 virtual ~ripping();
00418
00419
00421 virtual PropertyValue bitrate() const;
00423 virtual PropertyValue dataSize() const;
00427 bool doesTheUserWantsThatTheStreamIsRipping() const;
00429 virtual PropertyValue error() const;
00431 virtual bool isRunning() const;
00433 virtual PropertyValue metaInterval() const;
00435 virtual PropertyValue metaInterval_milliSeconds() const;
00437 virtual PropertyValue relayPort() const;
00439 virtual PropertyValue serverName() const;
00441 virtual PropertyValue song() const;
00443 virtual PropertyValue status() const;
00445 virtual PropertyValue streamName() const;
00446
00447
00449 static qint64 default_value_of_bitrate();
00451 static qint64 default_value_of_dataSize();
00453 static QString default_value_of_error();
00455 static bool default_value_of_isRunning();
00457 static qint64 default_value_of_metaInterval();
00459 static qint64 default_value_of_relayPort();
00461 static QString default_value_of_serverName();
00463 static QString default_value_of_song();
00465 static statusType default_value_of_status();
00467 static QString default_value_of_streamName();
00480 static bool doesTheUserWantsThatTheStreamIsRipping(const statusType theStatus);
00482 static PropertyValue formatedBitrate(const qint64 theBitrate);
00484 static PropertyValue formatedDataSize(const qint64 theDataSize);
00486 static PropertyValue formatedError(const QString & theError);
00488 static PropertyValue formatedMetaInterval(const qint64 theMetaInterval);
00491 static PropertyValue formatedMetaInterval_milliSeconds(
00492 const qint64 theMetaInterval_milliSeconds);
00494 static PropertyValue formatedRelayPort(const qint64 theRelayPort);
00496 static PropertyValue formatedServerName(const QString & theServerName);
00498 static PropertyValue formatedSong(const QString & theSong);
00500 static PropertyValue formatedStatus(const statusType theStatus);
00502 static PropertyValue formatedStreamName(const QString & theStreamName);
00503
00504 signals:
00505
00507 void bitrateChanged(void *index, PropertyValue newBitrate);
00509 void dataSizeChanged(void *index, PropertyValue newDataSize);
00511 void errorChanged(void *index, PropertyValue newError);
00513 void metaIntervalChanged(void *index, PropertyValue newMetaInterval);
00515 void metaInterval_milliSecondsChanged(void *index,
00516 PropertyValue newMetaInterval_milliSeconds);
00518 void not_running();
00520 void relayPortChanged(void *index, PropertyValue newRelayPort);
00522 void running();
00524 void serverNameChanged(void *index, PropertyValue newServerName);
00526 void songChanged(void *index, PropertyValue newSong);
00528 void statusChanged(void *index, PropertyValue newStatus);
00530 void streamNameChanged(void *index, PropertyValue newStreamName);
00531
00532 public slots:
00536 void shutDown();
00543 virtual void startStreamripper();
00544
00545 protected:
00556 virtual void interpretate_console_output(QStringList & stringList);
00560 virtual QStringList parameterList() const;
00564 virtual void resetStreamripperProperties();
00567 virtual QString serverUri() const = 0;
00569 virtual void setBitrate(const qint64 newBitrate);
00571 virtual void setDataSize(const qint64 newDataSize);
00573 virtual void setError(const QString & newError);
00575 virtual void setMetaInterval(const qint64 newMetaInterval);
00577 virtual void setRelayPort(const qint64 newRelayPort);
00579 virtual void setServerName(const QString & newServerName);
00581 virtual void setSong(const QString & newSong);
00583 virtual void setStatus(const statusType newStatus);
00585 virtual void setStreamName(const QString & newStreamName);
00588 virtual QString streamripperCommand() const;
00590 virtual QString workingDirectory() const = 0;
00591
00592 private:
00593
00600 void helper_interpretate_metainfo_and_datasize(QString my_line);
00601
00602
00604 PropertyValue internal_bitrate;
00606 PropertyValue internal_dataSize;
00608 PropertyValue internal_error;
00610 bool internal_isRunning;
00612 PropertyValue internal_metaInterval;
00614 PropertyValue internal_relayPort;
00616 PropertyValue internal_serverName;
00618 PropertyValue internal_song;
00620 PropertyValue internal_status;
00622 PropertyValue internal_streamName;
00623
00628 qint64 lastRecognizedRelayPort;
00629
00630 private slots:
00632 void emit_metaInterval_milliSecondsChanged();
00647 void errorOccured(const QProcess::ProcessError error);
00653 void refreshRelayPort();
00666 void streamripperStateChange(const QProcess::ProcessState newState);
00667 };
00668
00669 Q_DECLARE_METATYPE(ripping::statusType)
00670
00671 #endif