Commit 88e1ab06 by Paweł Wegner

HubiC: implemented.

parent 6f5111b3
......@@ -164,6 +164,7 @@ QString CloudContext::pretty(QString provider) const {
{"box", "Box"},
{"dropbox", "Dropbox"},
{"google", "Google Drive"},
{"hubic", "hubiC"},
{"mega", "Mega"},
{"onedrive", "One Drive"},
{"pcloud", "pCloud"},
......
......@@ -32,5 +32,6 @@
<file>qtquickcontrols2.conf</file>
<file>qml/QtPlayer.qml</file>
<file>qml/VlcPlayer.qml</file>
<file>resources/providers/hubic.png</file>
</qresource>
</RCC>
/*****************************************************************************
* HubiC.cpp
*
*****************************************************************************
* Copyright (C) 2016-2016 VideoLAN
*
* Authors: Paweł Wegner <pawel.wegner95@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef HUBIC_H
#define HUBIC_H
#include <json/json.h>
#include "CloudProvider.h"
namespace cloudstorage {
class HubiC : public CloudProvider {
public:
HubiC();
std::string name() const override;
std::string endpoint() const override;
void authorizeRequest(IHttpRequest& request) const override;
IItem::Pointer rootDirectory() const override;
bool reauthorize(int code,
const IHttpRequest::HeaderParameters&) const override;
AuthorizeRequest::Pointer authorizeAsync() override;
MoveItemRequest::Pointer moveItemAsync(IItem::Pointer source,
IItem::Pointer destination,
MoveItemCallback) override;
RenameItemRequest::Pointer renameItemAsync(IItem::Pointer item,
const std::string&,
RenameItemCallback) override;
DeleteItemRequest::Pointer deleteItemAsync(IItem::Pointer,
DeleteItemCallback) override;
IHttpRequest::Pointer getItemDataRequest(
const std::string&, std::ostream& input_stream) const override;
IHttpRequest::Pointer getItemUrlRequest(
const IItem&, std::ostream& input_stream) const override;
IHttpRequest::Pointer listDirectoryRequest(
const IItem&, const std::string& page_token,
std::ostream& input_stream) const override;
IHttpRequest::Pointer uploadFileRequest(
const IItem& directory, const std::string& filename,
std::ostream& prefix_stream, std::ostream& suffix_stream) const override;
IHttpRequest::Pointer downloadFileRequest(
const IItem&, std::ostream& input_stream) const override;
IHttpRequest::Pointer createDirectoryRequest(const IItem&,
const std::string& name,
std::ostream&) const override;
IItem::Pointer getItemDataResponse(std::istream& response) const override;
IItem::Pointer uploadFileResponse(const IItem& item,
const std::string& filename, uint64_t size,
std::istream&) const override;
IItem::Pointer createDirectoryResponse(const IItem& parent,
const std::string& name,
std::istream&) const override;
std::string getItemUrlResponse(const IItem& item,
const IHttpRequest::HeaderParameters&,
std::istream& response) const override;
std::vector<IItem::Pointer> listDirectoryResponse(
const IItem&, std::istream&, std::string& next_page_token) const override;
IItem::Pointer toItem(const Json::Value&) const;
class Auth : public cloudstorage::Auth {
public:
Auth();
std::string authorizeLibraryUrl() const override;
IHttpRequest::Pointer exchangeAuthorizationCodeRequest(
std::ostream& input_data) const override;
IHttpRequest::Pointer refreshTokenRequest(
std::ostream& input_data) const override;
Token::Pointer exchangeAuthorizationCodeResponse(
std::istream&) const override;
Token::Pointer refreshTokenResponse(std::istream&) const override;
};
private:
std::string openstack_endpoint() const;
std::string openstack_token() const;
std::string openstack_endpoint_;
std::string openstack_token_;
};
} // namespace cloudstorage
#endif // HUBIC_H
......@@ -28,6 +28,7 @@ libcloudstorage_la_SOURCES = \
CloudProvider/YandexDisk.cpp \
CloudProvider/WebDav.cpp \
CloudProvider/PCloud.cpp \
CloudProvider/HubiC.cpp \
Request/Request.cpp \
Request/HttpCallback.cpp \
Request/AuthorizeRequest.cpp \
......@@ -63,6 +64,7 @@ noinst_HEADERS = \
CloudProvider/YandexDisk.h \
CloudProvider/WebDav.h \
CloudProvider/PCloud.h \
CloudProvider/HubiC.h \
Request/HttpCallback.h \
Request/AuthorizeRequest.h \
Request/Request.h \
......
......@@ -28,6 +28,7 @@
#include "CloudProvider/Box.h"
#include "CloudProvider/Dropbox.h"
#include "CloudProvider/GoogleDrive.h"
#include "CloudProvider/HubiC.h"
#include "CloudProvider/OneDrive.h"
#include "CloudProvider/PCloud.h"
#include "CloudProvider/WebDav.h"
......@@ -175,6 +176,7 @@ CloudStorage::CloudStorage() {
add([]() { return std::make_shared<WebDav>(); });
add([]() { return std::make_shared<AmazonS3>(); });
add([]() { return std::make_shared<PCloud>(); });
add([]() { return std::make_shared<HubiC>(); });
#ifdef WITH_MEGA
add([]() { return std::make_shared<MegaNz>(); });
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment