2010-08-01 18:55:04 +00:00
|
|
|
/*
|
2016-04-19 20:41:59 +00:00
|
|
|
* This file Copyright (C) 2012-2016 Mnemosyne LLC
|
2010-08-01 18:55:04 +00:00
|
|
|
*
|
2014-01-21 03:10:30 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2010-08-01 18:55:04 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2010-08-01 18:55:04 +00:00
|
|
|
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <QString>
|
|
|
|
#include <QUrl>
|
|
|
|
|
|
|
|
class AddData
|
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
public:
|
2015-06-12 22:12:12 +00:00
|
|
|
enum
|
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
NONE,
|
|
|
|
MAGNET,
|
|
|
|
URL,
|
|
|
|
FILENAME,
|
|
|
|
METAINFO
|
2015-06-12 22:12:12 +00:00
|
|
|
};
|
2010-08-01 18:55:04 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
public:
|
|
|
|
AddData() :
|
|
|
|
type(NONE)
|
|
|
|
{
|
|
|
|
}
|
2010-08-01 18:55:04 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
AddData(QString const& str)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
set(str);
|
|
|
|
}
|
2010-08-01 18:55:04 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
int set(QString const&);
|
2010-08-01 18:55:04 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
QByteArray toBase64() const;
|
|
|
|
QString readableName() const;
|
|
|
|
QString readableShortName() const;
|
2011-01-21 21:51:50 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
static bool isSupported(QString const& str)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return AddData(str).type != NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2015-06-12 22:12:12 +00:00
|
|
|
int type;
|
|
|
|
QByteArray metainfo;
|
|
|
|
QString filename;
|
|
|
|
QString magnet;
|
|
|
|
QUrl url;
|
2010-08-01 18:55:04 +00:00
|
|
|
};
|