diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-05-08 18:43:56 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-05-08 18:43:56 +0300 |
commit | 4c4ea557b344b035507652cfbc3b616904f958e9 (patch) | |
tree | e8e610bfdaebb0ffb3a472f89b699bc3f65852b8 /src/LoginPage.cc | |
parent | ffb43836e4a71718949b4971b42f402931845625 (diff) |
Replace shared pointers of MatrixClient with a single instance
Diffstat (limited to 'src/LoginPage.cc')
-rw-r--r-- | src/LoginPage.cc | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/LoginPage.cc b/src/LoginPage.cc index b8207226..c7f9b042 100644 --- a/src/LoginPage.cc +++ b/src/LoginPage.cc @@ -30,10 +30,9 @@ using namespace mtx::identifiers; -LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent) +LoginPage::LoginPage(QWidget *parent) : QWidget(parent) , inferredServerAddress_() - , client_{client} { top_layout_ = new QVBoxLayout(); @@ -143,11 +142,11 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent) connect(matrixid_input_, SIGNAL(returnPressed()), login_button_, SLOT(click())); connect(password_input_, SIGNAL(returnPressed()), login_button_, SLOT(click())); connect(serverInput_, SIGNAL(returnPressed()), login_button_, SLOT(click())); - connect(client_.data(), SIGNAL(loginError(QString)), this, SLOT(loginError(QString))); - connect(client_.data(), SIGNAL(loginError(QString)), this, SIGNAL(errorOccurred())); + connect(http::client(), SIGNAL(loginError(QString)), this, SLOT(loginError(QString))); + connect(http::client(), SIGNAL(loginError(QString)), this, SIGNAL(errorOccurred())); connect(matrixid_input_, SIGNAL(editingFinished()), this, SLOT(onMatrixIdEntered())); - connect(client_.data(), SIGNAL(versionError(QString)), this, SLOT(versionError(QString))); - connect(client_.data(), SIGNAL(versionSuccess()), this, SLOT(versionSuccess())); + connect(http::client(), SIGNAL(versionError(QString)), this, SLOT(versionError(QString))); + connect(http::client(), SIGNAL(versionSuccess()), this, SLOT(versionSuccess())); connect(serverInput_, SIGNAL(editingFinished()), this, SLOT(onServerAddressEntered())); } @@ -181,8 +180,8 @@ LoginPage::onMatrixIdEntered() inferredServerAddress_ = homeServer; serverInput_->setText(homeServer); - client_->setServer(homeServer); - client_->versions(); + http::client()->setServer(homeServer); + http::client()->versions(); } } @@ -190,8 +189,8 @@ void LoginPage::onServerAddressEntered() { error_label_->setText(""); - client_->setServer(serverInput_->text()); - client_->versions(); + http::client()->setServer(serverInput_->text()); + http::client()->versions(); serverLayout_->removeWidget(errorIcon_); errorIcon_->hide(); @@ -202,7 +201,7 @@ LoginPage::onServerAddressEntered() void LoginPage::versionError(QString error) { - QUrl currentServer = client_->getHomeServer(); + QUrl currentServer = http::client()->getHomeServer(); QString mxidAddress = matrixid_input_->text().split(":").at(1); error_label_->setText(error); @@ -242,8 +241,8 @@ LoginPage::onLoginButtonClicked() if (password_input_->text().isEmpty()) return loginError(tr("Empty password")); - client_->setServer(serverInput_->text()); - client_->login(QString::fromStdString(user.localpart()), password_input_->text()); + http::client()->setServer(serverInput_->text()); + http::client()->login(QString::fromStdString(user.localpart()), password_input_->text()); emit loggingIn(); } |