~ubuntu-branches/ubuntu/breezy/kdemultimedia/breezy

« back to all changes in this revision

Viewing changes to krec/krecexport_template.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-03-24 04:48:58 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050324044858-8ff88o9jxej6ii3d
Tags: 4:3.4.0-0ubuntu3
Add kubuntu_02_hide_arts_menu_entries.diff to hide artsbuilder and artscontrol k-menu entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    copyright            : (C) 2003 by Arnold Krille
 
3
    email                : arnold@arnoldarts.de
 
4
 ***************************************************************************/
 
5
 
 
6
/***************************************************************************
 
7
 *                                                                         *
 
8
 *   This program is free software; you can redistribute it and/or modify  *
 
9
 *   it under the terms of the GNU General Public License as published by  *
 
10
 *   the Free Software Foundation; version 2 of the License.               *
 
11
 *                                                                         *
 
12
 ***************************************************************************/
 
13
 
 
14
#ifndef KREC_EXPORT_TEMPLATE_H
 
15
#define KREC_EXPORT_TEMPLATE_H
 
16
 
 
17
#include <qobject.h>
 
18
 
 
19
#include <qstring.h>
 
20
#include <qstringlist.h>
 
21
#include <qcstring.h>
 
22
#include <arts/common.h>
 
23
 
 
24
/**
 
25
 * This class is the template for all exportitems in KRec.
 
26
 *
 
27
 * To register your ExportItem you have to do @code registerAtGlobal( this ); @code
 
28
 * at the end of your constructor.
 
29
 *
 
30
 * @author Arnold Krille <arnold@arnoldarts.de>
 
31
*/
 
32
class KRecExportItem : public QObject {
 
33
   Q_OBJECT
 
34
private:
 
35
        /// Controls wether an export is running, or not...
 
36
        bool _running;
 
37
        int _samplingRate, _bits, _channels;
 
38
protected:
 
39
        KRecExportItem( QObject*, const char* =0, const QStringList& =0 );
 
40
 
 
41
        /**
 
42
         * This registers this class at the KRecGlobal.
 
43
         */
 
44
        static void registerAtGlobal( KRecExportItem* );
 
45
 
 
46
        int samplingRate() const;
 
47
        int bits() const;
 
48
        int channels() const;
 
49
 
 
50
        /// Helpers for reading and writing to an char-array
 
51
        Q_INT16 read16( char* array, int index );
 
52
        void write16(  char* array, Q_INT16 value, int index );
 
53
        void write32(  char* array, Q_INT32 value, int index );
 
54
public:
 
55
        ~KRecExportItem();
 
56
 
 
57
        /**
 
58
         * Returns a new Item for your export.
 
59
         */
 
60
        virtual KRecExportItem* newItem()=0;
 
61
 
 
62
        /// Returns a list with the extensions.
 
63
        virtual QStringList extensions()=0;
 
64
        /// Returns the export format.
 
65
        virtual QString exportFormat()=0;
 
66
 
 
67
        bool running() const { return _running; }
 
68
public slots:
 
69
        /**
 
70
         * Initializes the sound-settings.
 
71
         * Has to be called before the initialize( const QString & ) function.
 
72
         */
 
73
        void initialize( int samplingRate, int bits, int channels );
 
74
        /// Initializes the export.
 
75
        virtual bool initialize( const QString &filename )=0;
 
76
        /**
 
77
         * Start the real export (including the emission of @see getData() while running=true).
 
78
         * Best way to do this is to use @see QTimer::singleShot() since then the events are
 
79
         * put at the end of the EventLoop not blocking the gui and everything else.
 
80
         */
 
81
        bool start();
 
82
        virtual bool process() =0;
 
83
 
 
84
        /// Stops the export by setting running=false.
 
85
        void stop();
 
86
        /// Finish the export.
 
87
        virtual bool finalize()=0;
 
88
        //virtual void data( QByteArray& );
 
89
signals:
 
90
        /// Is emitted when this Item wants data to export.
 
91
        void getData( QByteArray& );
 
92
 
 
93
        void running( bool );
 
94
};
 
95
 
 
96
 
 
97
#endif
 
98
 
 
99
// vim:sw=4:ts=4