Code cleanup.

This commit is contained in:
Black Hat 2018-07-19 16:29:50 +08:00
parent 7dd9132176
commit febff558fd
2 changed files with 1 additions and 15 deletions

View File

@ -34,9 +34,6 @@ Controller::~Controller() {
void Controller::login() {
if (!isLogin) {
qDebug() << "UserID:" << userID;
qDebug() << "Token:" << token;
m_connection->setHomeserver(QUrl(homeserver));
m_connection->connectWithToken(userID, token, "");
}
@ -45,29 +42,22 @@ void Controller::login() {
void Controller::loginWithCredentials(QString serverAddr, QString user,
QString pass) {
if (!isLogin) {
qDebug() << "Server:" << serverAddr;
qDebug() << "User:" << user;
qDebug() << "Pass:" << pass;
if (!user.isEmpty() && !pass.isEmpty()) {
qDebug() << "Using given credential.";
m_connection->setHomeserver(QUrl(serverAddr));
m_connection->connectToServer(user, pass, "");
}
} else {
qDebug() << "You are already logged in.";
qCritical() << "You are already logged in.";
}
}
void Controller::logout() {
qDebug() << "Logging out.";
setUserID("");
setToken("");
setIsLogin(false);
}
void Controller::connected() {
qDebug() << "Logged in.";
setHomeserver(m_connection->homeserver().toString());
setUserID(m_connection->userId());
setToken(m_connection->accessToken());
@ -77,7 +67,6 @@ void Controller::connected() {
}
void Controller::resync() {
qDebug() << "Syncing Matrix.";
m_connection->sync(30000);
m_connection->saveState();
}

View File

@ -31,7 +31,6 @@ void RoomListModel::setConnection(QMatrixClient::Connection* connection) {
}
void RoomListModel::doResetModel() {
qDebug() << "Resetting room list model.";
beginResetModel();
m_rooms.clear();
for (auto r : m_connection->roomMap()) doAddRoom(r);
@ -51,8 +50,6 @@ void RoomListModel::doAddRoom(QMatrixClient::Room* r) {
}
void RoomListModel::connectRoomSignals(QMatrixClient::Room* room) {
qDebug() << "Connecting signal for room" << room->displayName();
connect(room, &QMatrixClient::Room::displaynameChanged, this,
[=] { namesChanged(room); });
connect(room, &QMatrixClient::Room::unreadMessagesChanged, this,