ripping.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2008  Tim Fechtner < urwald at users dot sourceforge dot net >
00003 
00004     This program is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU General Public License as
00006     published by the Free Software Foundation; either version 2 of
00007     the License or (at your option) version 3 or any later version
00008     accepted by the membership of KDE e.V. (or its successor approved
00009     by the membership of KDE e.V.), which shall act as a proxy
00010     defined in Section 14 of version 3 of the license.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef RIPPING_H
00022 #define RIPPING_H
00023 
00024 #include "streamripper_base.h"
00025 #include "propertyvalue.h"
00026 
00042 class ripping : public streamripper_base
00043 {
00044 
00045      Q_OBJECT
00046 
00082      Q_PROPERTY(PropertyValue bitrate READ bitrate)
00083 
00084      
00111      Q_PROPERTY(PropertyValue dataSize READ dataSize)
00112 
00137      Q_PROPERTY(PropertyValue error READ error)
00138 
00182      Q_PROPERTY(bool isRunning READ isRunning)
00183 
00217      Q_PROPERTY(PropertyValue metaInterval READ metaInterval)
00218 
00245      Q_PROPERTY(PropertyValue relayPort READ relayPort)
00246 
00265      Q_PROPERTY(PropertyValue serverName READ serverName)
00266 
00283      Q_PROPERTY(PropertyValue song READ song)
00284 
00299      Q_PROPERTY(PropertyValue status READ status)
00300 
00319      Q_PROPERTY(PropertyValue streamName READ streamName)
00320 
00321   public:
00322      // typedefs
00344      enum statusType {
00345        idle,
00346        is_starting,
00347        is_connecting,
00348        is_buffering,
00349        is_skipping,
00350        is_ripping,
00351        is_saving };
00352 
00353      // contructor(s) and destructor(s)
00356      ripping(const QPointer<QObject> parent);
00358      virtual ~ripping();
00359 
00360      // properties
00362      virtual PropertyValue bitrate() const;
00364      virtual PropertyValue dataSize() const;
00368      bool doesTheUserWantsThatTheStreamIsRipping();
00370      virtual PropertyValue error() const;
00372      virtual bool isRunning() const;
00374      virtual PropertyValue metaInterval() const;
00376      virtual PropertyValue relayPort() const;
00378      virtual PropertyValue serverName() const;
00380      virtual PropertyValue song() const;
00382      virtual PropertyValue status() const;
00384      virtual PropertyValue streamName() const;
00385 
00386      // static functions
00388      static qint64 default_value_of_bitrate();
00390      static qint64 default_value_of_dataSize();
00392      static QString default_value_of_error();
00394      static bool default_value_of_isRunning();
00396      static qint64 default_value_of_metaInterval();
00398      static qint64 default_value_of_relayPort();
00400      static QString default_value_of_serverName();
00402      static QString default_value_of_song();
00404      static statusType default_value_of_status();
00406      static QString default_value_of_streamName();
00419      static bool doesTheUserWantsThatTheStreamIsRipping(const ripping::statusType theStatus);
00421      static PropertyValue formatedBitrate(const qint64 theBitrate);
00423      static PropertyValue formatedDataSize(const qint64 theDataSize);
00425      static PropertyValue formatedError(const QString theError);
00427      static PropertyValue formatedMetaInterval(const qint64 theMetaInterval);
00429      static PropertyValue formatedRelayPort(const qint64 theRelayPort);
00431      static PropertyValue formatedServerName(const QString theServerName);
00433      static PropertyValue formatedSong(const QString theSong);
00435      static PropertyValue formatedStatus(const statusType theStatus);
00437      static PropertyValue formatedStreamName(const QString theStreamName);
00438 
00439   signals:
00440      // properties
00442      void bitrateChanged(qlonglong index, PropertyValue newBitrate);
00444      void dataSizeChanged(qlonglong index, PropertyValue newDataSize);
00446      void errorChanged(qlonglong index, PropertyValue newError);
00448      void metaIntervalChanged(qlonglong index, PropertyValue newMetaInterval);
00450      void not_running();
00452      void relayPortChanged(qlonglong index, PropertyValue newRelayPort);
00454      void running();
00456      void serverNameChanged(qlonglong index, PropertyValue newServerName);
00458      void songChanged(qlonglong index, PropertyValue newSong);
00460      void statusChanged(qlonglong index, PropertyValue newStatus);
00462      void streamNameChanged(qlonglong index, PropertyValue newStreamName);
00463 
00464   public slots:
00468      void shutDown();
00474      virtual void startStreamripper();
00475 
00476   protected:
00487      virtual void interpretate_console_output(QStringList &stringList);
00491      virtual QStringList parameterList() const;
00495      virtual void resetStreamripperProperties();
00498      virtual QString serverUri() const = 0;
00500      virtual void setBitrate(const qint64 newBitrate);
00502      virtual void setDataSize(const qint64 newDataSize);
00504      virtual void setError(const QString newError);
00506      virtual void setMetaInterval(const qint64 newMetaInterval);
00508      virtual void setRelayPort(const qint64 newRelayPort);
00510      virtual void setServerName(const QString newServerName);
00512      virtual void setSong(const QString newSong);
00514      virtual void setStatus(const statusType newStatus);
00516      virtual void setStreamName(const QString newStreamName);
00519      virtual QString streamripperCommand() const;
00520 
00521 // TODO jetzt mit PropertyValue: nachgucken, ob die Dokumentation up-to-date ist.
00522 
00523   private:
00524      // help methods
00531      void helper_interpretate_metainfo_and_datasize(QString my_line);
00532 
00533      //properties
00535      PropertyValue internal_bitrate;
00537      PropertyValue internal_dataSize;
00539      PropertyValue internal_error;
00541      bool internal_isRunning;
00543      PropertyValue internal_metaInterval;
00545      PropertyValue internal_relayPort;
00547      PropertyValue internal_serverName;
00549      PropertyValue internal_song;
00551      PropertyValue internal_status;
00553      PropertyValue internal_streamName;
00554 
00555   private slots:
00570      void errorOccured(QProcess::ProcessError error);
00583      void streamripperStateChange(QProcess::ProcessState newState);
00584  };
00585 
00586 Q_DECLARE_METATYPE(ripping::statusType)
00587 
00588 #endif

Generated on Sat May 2 10:43:44 2009 for kradioripper by  doxygen 1.5.6