/usr/include/qt5qevercloud/thumbnail.h is in qt5qevercloud-dev 3.0.3+ds-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | /**
* Original work: Copyright (c) 2014 Sergey Skoblikov
* Modified work: Copyright (c) 2015-2016 Dmitry Ivanov
*
* This file is a part of QEverCloud project and is distributed under the terms of MIT license:
* https://opensource.org/licenses/MIT
*/
#ifndef QEVERCLOUD_THUMBNAIL_H
#define QEVERCLOUD_THUMBNAIL_H
#include "export.h"
#include "AsyncResult.h"
#include "generated/types.h"
#include <QByteArray>
#include <QString>
#include <QNetworkAccessManager>
namespace qevercloud {
/** @cond HIDDEN_SYMBOLS */
class ThumbnailPrivate;
/** @endcond */
/**
* @brief The class is for downloading thumbnails for notes and resources from Evernote servers.
*
* These thumbnails are not available with general EDAM Thrift interface as explained in the
* <a href="http://dev.evernote.com/doc/articles/thumbnails.php">documentation.</a>
*
* Usage:
@code
Thumbnail thumb("www.evernote.com", sharId, authenticationToken);
QByteArray pngImage = thumb.download(noteGuid);
@endcode
*
* By defualt 300x300 PNG images are requested.
*/
class QEVERCLOUD_EXPORT Thumbnail {
public:
/**
* Specifies image type of the returned thumbnail.
*
* Can be PNG, JPEG, GIF or BMP.
*/
struct ImageType {
enum type {PNG, JPEG, GIF, BMP};
};
/**
* @brief Default constructor.
*
* host, shardId, authenticationToken have to be specified before calling
* @link download @endlink or @link createPostRequest @endlink
*/
Thumbnail();
/**
* @brief Constructs Thumbnail.
* @param host
* www.evernote.com or sandbox.evernote.com
* @param shardId
* You can get the value from UserStore service or as a result of an authentication.
* @param authenticationToken
* For working private notes/resources you must supply a valid authentication token.
* For public resources the value specified is not used.
* @param size
* The size of the thumbnail. Evernote supports values from from 1 to 300. By defualt 300 is used.
* @param imageType
* Thumbnail image type. See ImageType. By default PNG is used.
*/
Thumbnail(QString host, QString shardId, QString authenticationToken,
int size = 300, ImageType::type imageType = ImageType::PNG);
virtual ~Thumbnail();
/**
* @param host
* www.evernote.com or sandbox.evernote.com
*/
Thumbnail & setHost(QString host);
/**
* @param shardId
* You can get the value from UserStore service or as a result of an authentication.
*/
Thumbnail & setShardId(QString shardId);
/**
* @param authenticationToken
* For working private notes/resources you must supply a valid authentication token.
* For public resources the value specified is not used.
*/
Thumbnail & setAuthenticationToken(QString authenticationToken);
/**
* @param size
* The size of the thumbnail. Evernote supports values from from 1 to 300. By defualt 300 is used.
*/
Thumbnail & setSize(int size);
/**
* @param imageType
* Thumbnail image type. See ImageType. By default PNG is used.
*/
Thumbnail & setImageType(ImageType::type imageType);
/**
* @brief Downloads the thumbnail for a resource or a note.
* @param guid
* The note or resource guid
* @param isPublic
* Specify true for public notes/resources. In this case authentication token is not sent to
* with the request as it shoud be according to the docs.
* @param isResourceGuid
* true if guid denotes a resource and false if it denotes a note.
* @return downloaded data.
*
*/
QByteArray download(Guid guid, bool isPublic = false, bool isResourceGuid = false);
/** Asynchronous version of @link download @endlink function*/
AsyncResult * downloadAsync(Guid guid, bool isPublic = false, bool isResourceGuid = false);
/**
* @brief Prepares a POST request for a thumbnail download.
* @param guid
* The note or resource guid
* @param isPublic
* Specify true for public notes/resources. In this case authentication token is not sent to
* with the request as it shoud be according to the docs.
* @param isResourceGuid
* true if guid denotes a resource and false if it denotes a note.
* @return a pair of QNetworkRequest for the POST request and data that must be posted with the request.
*/
QPair<QNetworkRequest, QByteArray> createPostRequest(qevercloud::Guid guid,
bool isPublic = false,
bool isResourceGuid = false);
private:
ThumbnailPrivate * const d_ptr;
Q_DECLARE_PRIVATE(Thumbnail)
};
} // namespace qevercloud
#endif // QEVERCLOUD_THUMBNAIL_H
|