digiKam
DigikamGenericImgUrPlugin::ImgurTalker Class Reference
+ Inheritance diagram for DigikamGenericImgUrPlugin::ImgurTalker:

Public Slots

void slotOauthAuthorized ()
 
void slotOauthFailed ()
 
void slotOauthRequestPin (const QUrl &url)
 
void slotReplyFinished ()
 
void slotUploadProgress (qint64 sent, qint64 total)
 

Signals

void signalAuthError (const QString &msg)
 
void signalAuthorized (bool success, const QString &username)
 
void signalBusy (bool b)
 
void signalError (const QString &msg, const ImgurTalkerAction &action)
 
void signalProgress (unsigned int percent, const ImgurTalkerAction &action)
 
void signalRequestPin (const QUrl &url)
 
void signalSuccess (const ImgurTalkerResult &result)
 

Public Member Functions

void cancelAllWork ()
 
O2 & getAuth ()
 
 ImgurTalker (QObject *const parent=nullptr)
 
void queueWork (const ImgurTalkerAction &action)
 
unsigned int workQueueLength ()
 
 ~ImgurTalker () override
 

Static Public Member Functions

static QUrl urlForDeletehash (const QString &deletehash)
 

Protected Member Functions

void timerEvent (QTimerEvent *event) override
 

Detailed Description

Main class, handles the client side of the Imgur API v3.

Constructor & Destructor Documentation

◆ ImgurTalker()

DigikamGenericImgUrPlugin::ImgurTalker::ImgurTalker ( QObject *const  parent = nullptr)
explicit

◆ ~ImgurTalker()

DigikamGenericImgUrPlugin::ImgurTalker::~ImgurTalker ( )
override

References cancelAllWork().

Member Function Documentation

◆ cancelAllWork()

void DigikamGenericImgUrPlugin::ImgurTalker::cancelAllWork ( )

Referenced by slotOauthFailed(), and ~ImgurTalker().

◆ getAuth()

O2 & DigikamGenericImgUrPlugin::ImgurTalker::getAuth ( )

Use this method to read/write the access and refresh tokens.

◆ queueWork()

void DigikamGenericImgUrPlugin::ImgurTalker::queueWork ( const ImgurTalkerAction action)

◆ signalAuthError

void DigikamGenericImgUrPlugin::ImgurTalker::signalAuthError ( const QString &  msg)
signal

◆ signalAuthorized

void DigikamGenericImgUrPlugin::ImgurTalker::signalAuthorized ( bool  success,
const QString &  username 
)
signal

Called if authentication state changes.

Referenced by DigikamGenericImgUrPlugin::ImgurWindow::ImgurWindow(), and slotOauthAuthorized().

◆ signalBusy

void DigikamGenericImgUrPlugin::ImgurTalker::signalBusy ( bool  b)
signal

◆ signalError

void DigikamGenericImgUrPlugin::ImgurTalker::signalError ( const QString &  msg,
const ImgurTalkerAction action 
)
signal

◆ signalProgress

void DigikamGenericImgUrPlugin::ImgurTalker::signalProgress ( unsigned int  percent,
const ImgurTalkerAction action 
)
signal

Emitted on progress changes.

Referenced by DigikamGenericImgUrPlugin::ImgurWindow::ImgurWindow(), and slotUploadProgress().

◆ signalRequestPin

void DigikamGenericImgUrPlugin::ImgurTalker::signalRequestPin ( const QUrl &  url)
signal

Open url in a browser and let the user copy the pin. Call setPin(pin) to authorize.

Referenced by DigikamGenericImgUrPlugin::ImgurWindow::ImgurWindow(), and slotOauthRequestPin().

◆ signalSuccess

void DigikamGenericImgUrPlugin::ImgurTalker::signalSuccess ( const ImgurTalkerResult result)
signal

◆ slotOauthAuthorized

void DigikamGenericImgUrPlugin::ImgurTalker::slotOauthAuthorized ( )
slot

Connected to O2 linkedChanged().

References signalAuthorized(), and signalBusy().

Referenced by ImgurTalker().

◆ slotOauthFailed

void DigikamGenericImgUrPlugin::ImgurTalker::slotOauthFailed ( )
slot

Connected to O2 linkingFailed().

References cancelAllWork(), and signalAuthError().

Referenced by ImgurTalker().

◆ slotOauthRequestPin

void DigikamGenericImgUrPlugin::ImgurTalker::slotOauthRequestPin ( const QUrl &  url)
slot

Connected to O2 openBrowser(QUrl).

References signalBusy(), and signalRequestPin().

Referenced by ImgurTalker().

◆ slotReplyFinished

void DigikamGenericImgUrPlugin::ImgurTalker::slotReplyFinished ( )
slot

HTTP 403 Forbidden -> Invalid token? That needs to be handled internally, so don't emit signalProgress and keep the action in the queue for later retries.

References DigikamGenericImgUrPlugin::ImgurTalkerResult::account, DigikamGenericImgUrPlugin::ACCT_INFO, DigikamGenericImgUrPlugin::ImgurTalkerResult::action, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::animated, DigikamGenericImgUrPlugin::ANON_IMG_UPLOAD, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::bandwidth, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::datetime, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::deletehash, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::description, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::hash, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::height, DigikamGenericImgUrPlugin::ImgurTalkerResult::image, DigikamGenericImgUrPlugin::IMG_UPLOAD, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::name, signalError(), signalSuccess(), DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::size, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::title, DigikamGenericImgUrPlugin::ImgurTalkerAction::type, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::type, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::url, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurAccount::username, DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::views, and DigikamGenericImgUrPlugin::ImgurTalkerResult::ImgurImage::width.

◆ slotUploadProgress

void DigikamGenericImgUrPlugin::ImgurTalker::slotUploadProgress ( qint64  sent,
qint64  total 
)
slot

Connected to the current QNetworkReply.

References signalProgress().

◆ timerEvent()

void DigikamGenericImgUrPlugin::ImgurTalker::timerEvent ( QTimerEvent *  event)
overrideprotected

◆ urlForDeletehash()

QUrl DigikamGenericImgUrPlugin::ImgurTalker::urlForDeletehash ( const QString &  deletehash)
static

◆ workQueueLength()

unsigned int DigikamGenericImgUrPlugin::ImgurTalker::workQueueLength ( )

The documentation for this class was generated from the following files: