From d3603606e7ed66953fded300d7ecfaffc6e33799 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sat, 13 Jan 2018 17:52:23 +0200 Subject: [PATCH] Make some functions inline --- include/MainWindow.h | 47 +++++++++++++++++++++++--------------------- src/MainWindow.cc | 24 ---------------------- 2 files changed, 25 insertions(+), 46 deletions(-) diff --git a/include/MainWindow.h b/include/MainWindow.h index d7c5e41d..b899e2d3 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -22,17 +22,18 @@ #include #include +#include "LoginPage.h" +#include "RegisterPage.h" +#include "UserSettingsPage.h" +#include "WelcomePage.h" + class ChatPage; class LoadingIndicator; -class LoginPage; class MatrixClient; class OverlayModal; -class RegisterPage; class SnackBar; class TrayIcon; -class UserSettingsPage; class UserSettings; -class WelcomePage; class MainWindow : public QMainWindow { @@ -49,20 +50,22 @@ protected: void closeEvent(QCloseEvent *event); private slots: - // Handle interaction with the tray icon. + //! Handle interaction with the tray icon. void iconActivated(QSystemTrayIcon::ActivationReason reason); - // Show the welcome page in the main window. - void showWelcomePage(); + //! Show the welcome page in the main window. + void showWelcomePage() { pageStack_->setCurrentWidget(welcome_page_); } - // Show the login page in the main window. - void showLoginPage(); + //! Show the login page in the main window. + void showLoginPage() { pageStack_->setCurrentWidget(login_page_); } - // Show the register page in the main window. - void showRegisterPage(); - void showUserSettingsPage(); + //! Show the register page in the main window. + void showRegisterPage() { pageStack_->setCurrentWidget(register_page_); } - // Show the chat page and start communicating with the given access token. + //! Show user settings page. + void showUserSettingsPage() { pageStack_->setCurrentWidget(userSettingsPage_); } + + //! Show the chat page and start communicating with the given access token. void showChatPage(QString user_id, QString home_server, QString token); void removeOverlayProgressBar(); @@ -73,33 +76,33 @@ private: static MainWindow *instance_; - // The initial welcome screen. + //! The initial welcome screen. WelcomePage *welcome_page_; - // The login screen. + //! The login screen. LoginPage *login_page_; - // The register page. + //! The register page. RegisterPage *register_page_; - // A stacked widget that handles the transitions between widgets. + //! A stacked widget that handles the transitions between widgets. QStackedWidget *pageStack_; - // The main chat area. + //! The main chat area. ChatPage *chat_page_; UserSettingsPage *userSettingsPage_; QSharedPointer userSettings_; - // Used to hide undefined states between page transitions. + //! Used to hide undefined states between page transitions. QSharedPointer progressModal_; QSharedPointer spinner_; - // Matrix Client API provider. + //! Matrix Client API provider. QSharedPointer client_; - // Tray icon that shows the unread message count. + //! Tray icon that shows the unread message count. TrayIcon *trayIcon_; - // Notifications display. + //! Notifications display. QSharedPointer snackBar_; }; diff --git a/src/MainWindow.cc b/src/MainWindow.cc index f2b7005b..fb55d189 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc @@ -223,30 +223,6 @@ MainWindow::showChatPage(QString userid, QString homeserver, QString token) instance_ = this; } -void -MainWindow::showWelcomePage() -{ - pageStack_->setCurrentWidget(welcome_page_); -} - -void -MainWindow::showLoginPage() -{ - pageStack_->setCurrentWidget(login_page_); -} - -void -MainWindow::showRegisterPage() -{ - pageStack_->setCurrentWidget(register_page_); -} - -void -MainWindow::showUserSettingsPage() -{ - pageStack_->setCurrentWidget(userSettingsPage_); -} - void MainWindow::closeEvent(QCloseEvent *event) {