kwave  18.07.70
MimeData.h
Go to the documentation of this file.
1 /***************************************************************************
2  MimeData.h - mime data container for Kwave's audio data
3  -------------------
4  begin : Oct 04 2008
5  copyright : (C) 2008 by Thomas Eschenbacher
6  email : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef MIME_DATA_H
19 #define MIME_DATA_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QByteArray>
25 #include <QMimeData>
26 #include <QObject>
27 
28 #include "libkwave/MemoryManager.h"
29 #include "libkwave/Sample.h"
30 
31 class QWidget;
32 
33 namespace Kwave
34 {
35 
36  class MetaDataList;
37  class MultiTrackReader;
38  class SignalManager;
39 
40  class Q_DECL_EXPORT MimeData: public QMimeData
41  {
42  Q_OBJECT
43  public:
45  MimeData();
46 
48  virtual ~MimeData() Q_DECL_OVERRIDE;
49 
60  virtual bool encode(QWidget *widget,
62  const Kwave::MetaDataList &meta_data);
63 
73  static sample_index_t decode(QWidget *widget, const QMimeData *e,
75  sample_index_t pos);
76 
80  virtual void clear();
81 
82  private:
89  class Buffer: public QIODevice
90  {
91  public:
93  Buffer();
94 
96  virtual ~Buffer() Q_DECL_OVERRIDE;
97 
99  virtual qint64 size() const Q_DECL_OVERRIDE { return m_size; }
100 
104  bool mapToByteArray();
105 
109  inline const QByteArray &byteArray() const { return m_data; }
110 
115  virtual void close() Q_DECL_OVERRIDE;
116 
117  protected:
125  virtual qint64 readData(char *data, qint64 maxlen)
126  Q_DECL_OVERRIDE;
127 
136  virtual qint64 writeData(const char *data, qint64 len)
137  Q_DECL_OVERRIDE;
138 
139  private:
142 
144  qint64 m_size;
145 
147  QByteArray m_data;
148  };
149 
150  private:
151 
154 
155  };
156 }
157 
158 #endif /* MIME_DATA_H */
159 
160 //***************************************************************************
161 //***************************************************************************
Definition: App.h:33
Kwave::Handle m_block
Definition: MimeData.h:141
Kwave::MimeData::Buffer m_buffer
Definition: MimeData.h:153
virtual qint64 size() const Q_DECL_OVERRIDE
Definition: MimeData.h:99
quint64 sample_index_t
Definition: Sample.h:28
int Handle
Definition: MemoryManager.h:34
const QByteArray & byteArray() const
Definition: MimeData.h:109