diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-01-09 00:28:03 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-01-09 01:02:25 +0100 |
commit | f1a23355bdd7d2fe08c5efa73ee21ece14979a7f (patch) | |
tree | 4ec98d825fcb20c4948e689f119a4e47b979273c /src/MainWindow.cpp | |
parent | 8d52c17f293bc2185699442c994b8fc1a8f8536a (diff) |
Port usersettings to qml
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r-- | src/MainWindow.cpp | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 6a62e353..5bfce89e 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -56,11 +56,10 @@ MainWindow::MainWindow(QWidget *parent) trayIcon_ = new TrayIcon(QStringLiteral(":/logos/nheko.svg"), this); - welcome_page_ = new WelcomePage(this); - login_page_ = new LoginPage(this); - register_page_ = new RegisterPage(this); - chat_page_ = new ChatPage(userSettings_, this); - userSettingsPage_ = new UserSettingsPage(userSettings_, this); + welcome_page_ = new WelcomePage(this); + login_page_ = new LoginPage(this); + register_page_ = new RegisterPage(this); + chat_page_ = new ChatPage(userSettings_, this); // Initialize sliding widget manager. pageStack_ = new QStackedWidget(this); @@ -68,7 +67,6 @@ MainWindow::MainWindow(QWidget *parent) pageStack_->addWidget(login_page_); pageStack_->addWidget(register_page_); pageStack_->addWidget(chat_page_); - pageStack_->addWidget(userSettingsPage_); setCentralWidget(pageStack_); @@ -93,13 +91,7 @@ MainWindow::MainWindow(QWidget *parent) showLoginPage(); }); - connect(userSettingsPage_, &UserSettingsPage::moveBack, this, [this]() { - pageStack_->setCurrentWidget(chat_page_); - }); - - connect(userSettingsPage_, SIGNAL(trayOptionChanged(bool)), trayIcon_, SLOT(setVisible(bool))); - connect( - userSettingsPage_, &UserSettingsPage::themeChanged, chat_page_, &ChatPage::themeChanged); + connect(userSettings_.get(), &UserSettings::trayChanged, trayIcon_, &TrayIcon::setVisible); connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, @@ -109,8 +101,6 @@ MainWindow::MainWindow(QWidget *parent) connect(this, &MainWindow::focusChanged, chat_page_, &ChatPage::chatFocusChanged); - connect(chat_page_, &ChatPage::showUserSettingsPage, this, &MainWindow::showUserSettingsPage); - connect(login_page_, &LoginPage::loginOk, this, [this](const mtx::responses::Login &res) { http::client()->set_user(res.user_id); showChatPage(); @@ -247,14 +237,8 @@ MainWindow::showChatPage() login_page_->reset(); chat_page_->bootstrap(userid, homeserver, token); - connect(cache::client(), - &Cache::databaseReady, - userSettingsPage_, - &UserSettingsPage::updateSecretStatus); - connect(cache::client(), - &Cache::secretChanged, - userSettingsPage_, - &UserSettingsPage::updateSecretStatus); + connect(cache::client(), &Cache::databaseReady, this, &MainWindow::secretsChanged); + connect(cache::client(), &Cache::secretChanged, this, &MainWindow::secretsChanged); emit reload(); } @@ -403,9 +387,3 @@ MainWindow::showRegisterPage() pageStack_->addWidget(register_page_); pageStack_->setCurrentWidget(register_page_); } - -void -MainWindow::showUserSettingsPage() -{ - pageStack_->setCurrentWidget(userSettingsPage_); -} |