| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef KSNIP_IMGURUPLOADERSETTINGS_H |
| 21 |
#define KSNIP_IMGURUPLOADERSETTINGS_H |
| 22 |
|
| 23 |
#include <QGroupBox> |
| 24 |
#include <QCheckBox> |
| 25 |
#include <QLineEdit> |
| 26 |
#include <QLabel> |
| 27 |
#include <QGridLayout> |
| 28 |
#include <QPushButton> |
| 29 |
#include <QDesktopServices> |
| 30 |
|
| 31 |
#include "src/backend/config/IConfig.h" |
| 32 |
#include "src/backend/uploader/imgur/ImgurWrapper.h" |
| 33 |
#include "src/gui/ImgurHistoryDialog.h" |
| 34 |
#include "src/widgets/CustomLineEdit.h" |
| 35 |
#include "src/common/constants/DefaultValues.h" |
| 36 |
|
| 37 |
class ImgurUploaderSettings : public QGroupBox |
| 38 |
{ |
| 39 |
Q_OBJECT |
| 40 |
public: |
| 41 |
explicit ImgurUploaderSettings(const QSharedPointer<IConfig> &config); |
| 42 |
~ImgurUploaderSettings() override = default; |
| 43 |
void saveSettings(); |
| 44 |
|
| 45 |
private: |
| 46 |
QSharedPointer<IConfig> mConfig; |
| 47 |
QCheckBox *mForceAnonymousCheckbox; |
| 48 |
QCheckBox *mDirectLinkToImageCheckbox; |
| 49 |
QCheckBox *mAlwaysCopyToClipboardCheckBox; |
| 50 |
QCheckBox *mOpenLinkInBrowserCheckbox; |
| 51 |
QLineEdit *mClientIdLineEdit; |
| 52 |
QLineEdit *mClientSecretLineEdit; |
| 53 |
QLineEdit *mPinLineEdit; |
| 54 |
QLineEdit *mUsernameLineEdit; |
| 55 |
CustomLineEdit *mBaseUrlLineEdit; |
| 56 |
CustomLineEdit *mUploadTitleEdit; |
| 57 |
CustomLineEdit *mUploadDescriptionEdit; |
| 58 |
QLabel *mUsernameLabel; |
| 59 |
QLabel *mBaseUrlLabel; |
| 60 |
QLabel *mUploadTitleLabel; |
| 61 |
QLabel *mUploadDescriptionLabel; |
| 62 |
QPushButton *mGetPinButton; |
| 63 |
QPushButton *mGetTokenButton; |
| 64 |
QPushButton *mClearTokenButton; |
| 65 |
QPushButton *mHistoryButton; |
| 66 |
ImgurWrapper *mImgurWrapper; |
| 67 |
QGridLayout *mLayout; |
| 68 |
|
| 69 |
void initGui(); |
| 70 |
void loadConfig(); |
| 71 |
|
| 72 |
private slots: |
| 73 |
void requestImgurPin(); |
| 74 |
void getImgurToken(); |
| 75 |
void clearImgurToken(); |
| 76 |
void imgurClientEntered(const QString &text); |
| 77 |
void imgurTokenUpdated(const QString &accessToken, const QString &refreshToken, const QString &username); |
| 78 |
void imgurTokenError(QNetworkReply::NetworkError networkError, const QString &message); |
| 79 |
void showImgurHistoryDialog(); |
| 80 |
void usernameChanged(); |
| 81 |
}; |
| 82 |
|
| 83 |
#endif |