Manage connection
This commit is contained in:
@@ -20,27 +20,37 @@ struct ConnectionConfig {
|
||||
QString port;
|
||||
QString rpcuser;
|
||||
QString rpcpassword;
|
||||
bool usingZcashConf;
|
||||
|
||||
ConnectionType connType;
|
||||
};
|
||||
|
||||
class LoadingDialog;
|
||||
class Connection;
|
||||
|
||||
class ConnectionLoader {
|
||||
|
||||
public:
|
||||
ConnectionLoader(MainWindow* main);
|
||||
ConnectionLoader(MainWindow* main, RPC* rpc);
|
||||
~ConnectionLoader();
|
||||
|
||||
void getConnection(std::function<void(RPC*)> cb);
|
||||
void loadConnection();
|
||||
|
||||
private:
|
||||
std::shared_ptr<ConnectionConfig*> autoDetectZcashConf();
|
||||
std::shared_ptr<ConnectionConfig*> loadFromSettings();
|
||||
std::shared_ptr<ConnectionConfig> autoDetectZcashConf();
|
||||
std::shared_ptr<ConnectionConfig> loadFromSettings();
|
||||
|
||||
LoadingDialog* d;
|
||||
Connection* makeConnection(std::shared_ptr<ConnectionConfig> config);
|
||||
|
||||
void refreshZcashdState(Connection* connection);
|
||||
int getProgressFromStatus(QString status);
|
||||
|
||||
void showError(QString explanation);
|
||||
|
||||
QDialog* d;
|
||||
Ui_ConnectionDialog* connD;
|
||||
|
||||
MainWindow* main;
|
||||
RPC* rpc;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -49,12 +59,13 @@ private:
|
||||
*/
|
||||
class Connection {
|
||||
public:
|
||||
Connection(QNetworkAccessManager* c, QNetworkRequest* r);
|
||||
Connection(QNetworkAccessManager* c, QNetworkRequest* r, std::shared_ptr<ConnectionConfig> conf);
|
||||
~Connection();
|
||||
|
||||
|
||||
QNetworkAccessManager* restclient;
|
||||
QNetworkRequest* request;
|
||||
QNetworkAccessManager* restclient;
|
||||
QNetworkRequest* request;
|
||||
std::shared_ptr<ConnectionConfig> config;
|
||||
|
||||
void doRPC(const json& payload, const std::function<void(json)>& cb,
|
||||
const std::function<void(QNetworkReply::NetworkError, const json&)>& ne);
|
||||
|
||||
Reference in New Issue
Block a user