2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2012-2022 Mnemosyne LLC.
|
2022-08-08 18:05:39 +00:00
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
2022-01-20 18:27:56 +00:00
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
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
|
|
|
|
2020-05-27 21:53:12 +00:00
|
|
|
AddData() = default;
|
2010-08-01 18:55:04 +00:00
|
|
|
|
2020-11-01 21:47:57 +00:00
|
|
|
explicit 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;
|
|
|
|
}
|
|
|
|
|
2020-05-27 21:53:12 +00:00
|
|
|
int type = NONE;
|
2015-06-12 22:12:12 +00:00
|
|
|
QByteArray metainfo;
|
|
|
|
QString filename;
|
|
|
|
QString magnet;
|
|
|
|
QUrl url;
|
2010-08-01 18:55:04 +00:00
|
|
|
};
|