QEverCloud  6.1.0
Unofficial Evernote Cloud API for Qt
Public Member Functions | List of all members
qevercloud::InkNoteImageDownloader Class Reference

the InkNoteImageDownloader class is for downloading the images of ink notes which can be created with the official Evernote client on Windows (only with it, at least at the time of this writing). More...

#include <InkNoteImageDownloader.h>

Public Member Functions

 InkNoteImageDownloader ()
 Default constructor. More...
 
 InkNoteImageDownloader (QString host, QString shardId, QString authenticationToken, int width, int height)
 Constructs InkNoteImageDownloader. More...
 
virtual ~InkNoteImageDownloader ()
 
InkNoteImageDownloadersetHost (QString host)
 
InkNoteImageDownloadersetShardId (QString shardId)
 
InkNoteImageDownloadersetAuthenticationToken (QString authenticationToken)
 
InkNoteImageDownloadersetWidth (int width)
 
InkNoteImageDownloadersetHeight (int height)
 
QByteArray download (Guid guid, const bool isPublic=false, const qint64 timeoutMsec=30000)
 Downloads the image for the ink note. More...
 

Detailed Description

the InkNoteImageDownloader class is for downloading the images of ink notes which can be created with the official Evernote client on Windows (only with it, at least at the time of this writing).

On all other platforms the most one can get instead of the actual ink note is its non-editable image. This class retrieves just these, exclusively in PNG format.

NOTE: almost the entirety of this class' content represents an ad-hoc solution to a completely undocumented feature of Evernote service. A very small glimpse of information was once available on Evernote forums but it's deleted now... I collected an even smaller glimpse of information in this SO question: https://stackoverflow.com/q/39179012/1217285. For all practical purposes it is the only piece of information on this feature in existence now.

Constructor & Destructor Documentation

◆ InkNoteImageDownloader() [1/2]

qevercloud::InkNoteImageDownloader::InkNoteImageDownloader ( )

Default constructor.

host, shardId, authenticationToken, width, height have to be specified before calling download or createPostRequest

◆ InkNoteImageDownloader() [2/2]

qevercloud::InkNoteImageDownloader::InkNoteImageDownloader ( QString  host,
QString  shardId,
QString  authenticationToken,
int  width,
int  height 
)

Constructs InkNoteImageDownloader.

Parameters
hostwww.evernote.com or sandbox.evernote.com
shardIdYou can get the value from UserStore service or as a result of an authentication.
authenticationTokenFor working private ink notes you must supply a valid authentication token. For public resources the value specified is not used.
widthWidth of the ink note's resource
heightHeight of the ink note's resource

◆ ~InkNoteImageDownloader()

virtual qevercloud::InkNoteImageDownloader::~InkNoteImageDownloader ( )
virtual

Member Function Documentation

◆ download()

QByteArray qevercloud::InkNoteImageDownloader::download ( Guid  guid,
const bool  isPublic = false,
const qint64  timeoutMsec = 30000 
)

Downloads the image for the ink note.

Unlike other pieces of QEverCloud API, downloading of ink note images is currently synchronous only. The reason for that is that AsyncResult is bounded to a single QNetworkRequest object but downloading of the ink note image might take multiple requests for several ink note image's vertical stripes which are then merged together to form a single image. Downloading the entire ink note's image via a single request works sometimes but sometimes Evernote replies to such request with messed up data which cannot be loaded into a QImage. The reason for that behaviour is unknown at the moment, and, given the state of official documentation

  • missing - it is likely to stay so. if someone has an idea how to make it more reliable, please let me know.
Parameters
guidThe guid of the ink note's resource
isPublicSpecify true for public ink notes. In this case authentication token is not sent to with the request as it should be according to the docs.
timeoutMsecTimeout for download request in milliseconds
Returns
downloaded data.

◆ setAuthenticationToken()

InkNoteImageDownloader& qevercloud::InkNoteImageDownloader::setAuthenticationToken ( QString  authenticationToken)
Parameters
authenticationTokenFor working private ink notes you must supply a valid authentication token. For public resources the value specified is not used.

◆ setHeight()

InkNoteImageDownloader& qevercloud::InkNoteImageDownloader::setHeight ( int  height)
Parameters
heightHeight of the ink note's resource

◆ setHost()

InkNoteImageDownloader& qevercloud::InkNoteImageDownloader::setHost ( QString  host)
Parameters
hostwww.evernote.com or sandbox.evernote.com

◆ setShardId()

InkNoteImageDownloader& qevercloud::InkNoteImageDownloader::setShardId ( QString  shardId)
Parameters
shardIdYou can get the value from UserStore service or as a result of an authentication.

◆ setWidth()

InkNoteImageDownloader& qevercloud::InkNoteImageDownloader::setWidth ( int  width)
Parameters
widthWidth of the ink note's resource