|
a/HelperStructs/CustomMimeData.h |
|
b/HelperStructs/CustomMimeData.h |
|
... |
|
... |
15 |
* GNU General Public License for more details.
|
15 |
* GNU General Public License for more details.
|
16 |
|
16 |
|
17 |
* You should have received a copy of the GNU General Public License
|
17 |
* You should have received a copy of the GNU General Public License
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19 |
*/
|
19 |
*/
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
#ifndef _CUSTOMMIMEDATA_H
|
20 |
#ifndef _CUSTOMMIMEDATA_H
|
24 |
#define _CUSTOMMIMEDATA_H
|
21 |
#define _CUSTOMMIMEDATA_H
|
25 |
|
22 |
|
|
|
23 |
#include <QMimeData>
|
|
|
24 |
|
26 |
#include "HelperStructs/MetaData.h"
|
25 |
#include "HelperStructs/MetaData.h"
|
27 |
#include <QMimeData>
|
|
|
28 |
#include <QDebug>
|
|
|
29 |
|
|
|
30 |
|
26 |
|
31 |
class CustomMimeData : public QMimeData {
|
27 |
class CustomMimeData : public QMimeData {
|
32 |
|
|
|
33 |
|
|
|
34 |
private:
|
28 |
private:
|
35 |
MetaDataList _v_md;
|
29 |
MetaDataList _v_md;
|
36 |
bool _has_meta_data;
|
|
|
37 |
|
|
|
38 |
|
30 |
|
39 |
public:
|
31 |
public:
|
40 |
CustomMimeData() : QMimeData(){
|
32 |
CustomMimeData()
|
41 |
|
33 |
: QMimeData() {
|
42 |
_has_meta_data = false;
|
|
|
43 |
}
|
34 |
}
|
44 |
|
35 |
|
45 |
virtual ~CustomMimeData(){
|
36 |
void setMetaData(const MetaDataList& v_md) {
|
|
|
37 |
_v_md = v_md;
|
46 |
}
|
38 |
}
|
47 |
|
39 |
|
48 |
void setMetaData(const MetaDataList& v_md){
|
|
|
49 |
|
|
|
50 |
_v_md = v_md;
|
|
|
51 |
_has_meta_data = (v_md.size() > 0);
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
uint getMetaData(MetaDataList& v_md) const {
|
40 |
uint getMetaData(MetaDataList& v_md) const {
|
55 |
|
|
|
56 |
if(!_has_meta_data) return 0;
|
|
|
57 |
if(_v_md.size() == 0) return 0;
|
41 |
if(_v_md.size()) {
|
58 |
v_md = _v_md;
|
42 |
// Why not reset the output? Inherited from sayonara and
|
|
|
43 |
// left alone.
|
|
|
44 |
v_md = _v_md;
|
|
|
45 |
}
|
59 |
return _v_md.size();
|
46 |
return _v_md.size();
|
60 |
}
|
47 |
}
|
61 |
|
48 |
|
62 |
bool hasMetaData() const {
|
49 |
bool hasMetaData() const {
|
63 |
|
50 |
return _v_md.size();
|
64 |
return _has_meta_data;
|
|
|
65 |
}
|
51 |
}
|
66 |
};
|
52 |
};
|
67 |
|
53 |
|
68 |
|
|
|
69 |
#endif
|
54 |
#endif
|