1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 *
10 * $Id: add-data.h 12212 2011-03-23 18:22:23Z jordan $
11 */
12
13#ifndef ADD_DATA_H
14#define ADD_DATA_H
15
16#include <QByteArray>
17#include <QString>
18#include <QUrl>
19
20class AddData
21{
22    public:
23
24        enum { NONE, MAGNET, URL, FILENAME, METAINFO };
25        int type;
26
27        QByteArray metainfo;
28        QString filename;
29        QString magnet;
30        QUrl url;
31
32    public:
33
34        int set( const QString& );
35        AddData( const QString& str ) { set(str); }
36        AddData( ): type(NONE) { }
37
38        QByteArray toBase64( ) const;
39
40        QString readableName( ) const;
41
42    public:
43
44        static bool isSupported( const QString& str ) { return AddData(str).type != NONE; }
45};
46
47#endif
48