QAlphaCloud
0.0.1
Qt bindings for Alpha Cloud
|
API configuration. More...
#include <configuration.h>
Inherits QObject.
Public Slots | |
bool | loadFromFile (const QString &path) |
Load configuration from file. More... | |
bool | loadFromSettings (QSettings *settings) |
Load configuration from QSettings. More... | |
bool | loadDefault () |
Load the default configuration. More... | |
Public Member Functions | |
Configuration (QObject *parent=nullptr) | |
Create a configuration. More... | |
Q_REQUIRED_RESULT QUrl | apiUrl () const |
void | setApiUrl (const QUrl &apiUrl) |
void | resetApiUrl () |
Reset API URL to the default. | |
Q_SIGNAL void | apiUrlChanged (const QUrl &apiUrl) |
Q_REQUIRED_RESULT QString | appId () const |
void | setAppId (const QString &appId) |
Q_SIGNAL void | appIdChanged (const QString &appId) |
Q_REQUIRED_RESULT QString | appSecret () const |
void | setAppSecret (const QString &appSecret) |
Q_SIGNAL void | appSecretChanged (const QString &appSecret) |
Q_REQUIRED_RESULT int | requestTimeout () const |
void | setRequestTimeout (int requestTimeout) |
void | resetRequestTimeout () |
Q_SIGNAL void | requestTimeoutChanged (int requestTimeout) |
bool | valid () const |
Q_SIGNAL void | validChanged (bool valid) |
Static Public Member Functions | |
static Configuration * | defaultConfiguration (QObject *parent=nullptr) |
Create a default configuration. More... | |
static QString | defaultConfigurationPath () |
The default configuration path. More... | |
Properties | |
QUrl | apiUrl |
The URL to send requests to. More... | |
QString | appId |
The App ID. More... | |
QString | appSecret |
The API secret. | |
int | requestTimeout |
Request timeout (ms). More... | |
bool | valid |
Whether the configuration is valid. More... | |
API configuration.
This class provides the configuration of your API connector, i.e. the URL, App ID and secret.
Additionally, the request timeout can be configured.
The default configuration can be placed in an INI file ~/.config/Broulik/QAlphaloud
:
|
explicit |
Create a configuration.
It will be empty and invalid.
parent | The owner. |
|
static |
Create a default configuration.
This is typically what you want to pass to the Connector
. It will be read from the configuration file.
|
static |
The default configuration path.
This is is "qalphacloud.ini" within the user's configuration directory.
|
slot |
Load the default configuration.
It will be loaded from the configuration file.
|
slot |
Load configuration from file.
path | The file path |
|
slot |
Load configuration from QSettings.
settings | The QSettings object |
|
readwrite |
The URL to send requests to.
Default is the API_URL
configure option, which by default is the official API endpoint.
|
readwrite |
The App ID.
The application ID registered on the API. Typically starts with alpha...
|
readwrite |
Request timeout (ms).
Time out requests automatically after ms.
Default is 30,000 (30 seconds).
|
read |
Whether the configuration is valid.
You cannot make requests with an invalid configuration.