File indexing completed on 2025-01-19 03:55:39

0001 #ifndef O1SMUGMUG_H
0002 #define O1SMUGMUG_H
0003 
0004 #include "o0export.h"
0005 #include "o1.h"
0006 
0007 #if QT_VERSION >= 0x050000
0008 #include <QUrlQuery>
0009 #endif
0010 
0011 /// SmugMug OAuth 1.0 client
0012 ///
0013 /// Simple usage:
0014 /// @code
0015 /// o1_ = new O1SmugMug(this);
0016 /// o1_->initAuthorizationUrl(O1SmugMug::AccessFull, O1SmugMug::PermissionsAdd);
0017 /// @endcode
0018 ///
0019 /// Advanced usage (Qt 5.0 or later):
0020 /// @code
0021 /// o1_ = new O1SmugMug(this, 0, secureStore);
0022 /// O1SmugMug::AuthorizationUrlBuilder builder;
0023 /// builder.setAccess(O1SmugMug::AccessFull);
0024 /// builder.setShowSignUpButton(false);
0025 /// builder.setPrepopulatedUsername(lastUsername_);
0026 /// o1_->initAuthorizationUrl(builder);
0027 /// @endcode
0028 class O0_EXPORT O1SmugMug: public O1 {
0029     Q_OBJECT
0030     Q_ENUMS(Access)
0031     Q_ENUMS(Permissions)
0032 
0033 public:
0034     enum Access {
0035         AccessPublic,
0036         AccessFull
0037     };
0038 
0039     enum Permissions {
0040         PermissionsRead,
0041         PermissionsAdd,
0042         PermissionsModify
0043     };
0044 
0045     Q_INVOKABLE void initAuthorizationUrl(Access access, Permissions permissions);
0046 
0047 #if QT_VERSION >= 0x050000
0048     class AuthorizationUrlBuilder {
0049     public:
0050         void setAccess(Access value);
0051         void setPermissions(Permissions value);
0052         void setAllowThirdPartyLogin(bool value);
0053         void setShowSignUpButton(bool value);
0054         void setPrepopulatedUsername(const QString &value);
0055         void setViewportScale(double value);
0056 
0057         QUrl url() const;
0058 
0059     private:
0060         QUrlQuery query_;
0061     };
0062 
0063     void initAuthorizationUrl(const AuthorizationUrlBuilder &builder);
0064 #endif // QT_VERSION >= 0x050000
0065 
0066     explicit O1SmugMug(QObject *parent = 0, QNetworkAccessManager *manager = 0, O0AbstractStore *store = 0);
0067 };
0068 
0069 #endif // O1SMUGMUG_H