1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
/***************************************************************************
Drag.h - Drag&Drop container for Kwave's audio data
-------------------
begin : Jan 24 2002
copyright : (C) 2002 by Thomas Eschenbacher
email : Thomas Eschenbacher <thomas.eschenbacher@gmx.de>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DRAG_H
#define DRAG_H
#include "config.h"
#include "libkwave_export.h"
#include <QtGlobal>
#include <QByteArray>
#include <QDrag>
#include <QObject>
#include <QString>
#include "libkwave/Sample.h"
class QMimeData;
class QWidget;
namespace Kwave
{
class MetaDataList;
class MultiTrackReader;
class SignalManager;
/**
* Simple class for drag & drop of wav data.
* @todo the current storage mechanism is straight-forward and stupid, it
* should be extended to use virtual memory
*/
class LIBKWAVE_EXPORT Drag: public QDrag
{
Q_OBJECT
public:
/**
* Constructor
* @see QDragObject
*/
explicit Drag(QWidget *dragSource = nullptr);
/** Destructor */
~Drag() override;
/**
* Encodes wave data received from a MultiTrackReader into a byte
* array that is compatible with the format of a wav file.
* @param widget the widget used for displaying error messages
* @param src source of the samples
* @param meta_data information about the signal, sample rate,
* resolution and other meta data
* @return true if successful
*/
bool encode(QWidget *widget, Kwave::MultiTrackReader &src,
const Kwave::MetaDataList &meta_data);
/** Returns true if the mime type of the given source can be decoded */
static bool canDecode(const QMimeData *data);
/**
* Decodes the encoded byte data of the given mime source and
* initializes a MultiTrackReader.
* @param widget the widget used for displaying error messages
* @param e mime source
* @param sig signal that receives the mime data
* @param pos position within the signal where to insert the data
* @return number of decoded samples if successful, zero if failed
*/
static sample_index_t decode(QWidget *widget, const QMimeData *e,
Kwave::SignalManager &sig,
sample_index_t pos);
};
}
#endif /* DRAG_H */
//***************************************************************************
//***************************************************************************
|