Make some functions inline

This commit is contained in:
Konstantinos Sideris 2018-01-13 17:52:23 +02:00
parent 3929261a8e
commit d3603606e7
2 changed files with 25 additions and 46 deletions

View File

@ -22,17 +22,18 @@
#include <QStackedWidget> #include <QStackedWidget>
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include "LoginPage.h"
#include "RegisterPage.h"
#include "UserSettingsPage.h"
#include "WelcomePage.h"
class ChatPage; class ChatPage;
class LoadingIndicator; class LoadingIndicator;
class LoginPage;
class MatrixClient; class MatrixClient;
class OverlayModal; class OverlayModal;
class RegisterPage;
class SnackBar; class SnackBar;
class TrayIcon; class TrayIcon;
class UserSettingsPage;
class UserSettings; class UserSettings;
class WelcomePage;
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
@ -49,20 +50,22 @@ protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
private slots: private slots:
// Handle interaction with the tray icon. //! Handle interaction with the tray icon.
void iconActivated(QSystemTrayIcon::ActivationReason reason); void iconActivated(QSystemTrayIcon::ActivationReason reason);
// Show the welcome page in the main window. //! Show the welcome page in the main window.
void showWelcomePage(); void showWelcomePage() { pageStack_->setCurrentWidget(welcome_page_); }
// Show the login page in the main window. //! Show the login page in the main window.
void showLoginPage(); void showLoginPage() { pageStack_->setCurrentWidget(login_page_); }
// Show the register page in the main window. //! Show the register page in the main window.
void showRegisterPage(); void showRegisterPage() { pageStack_->setCurrentWidget(register_page_); }
void showUserSettingsPage();
// 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 showChatPage(QString user_id, QString home_server, QString token);
void removeOverlayProgressBar(); void removeOverlayProgressBar();
@ -73,33 +76,33 @@ private:
static MainWindow *instance_; static MainWindow *instance_;
// The initial welcome screen. //! The initial welcome screen.
WelcomePage *welcome_page_; WelcomePage *welcome_page_;
// The login screen. //! The login screen.
LoginPage *login_page_; LoginPage *login_page_;
// The register page. //! The register page.
RegisterPage *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_; QStackedWidget *pageStack_;
// The main chat area. //! The main chat area.
ChatPage *chat_page_; ChatPage *chat_page_;
UserSettingsPage *userSettingsPage_; UserSettingsPage *userSettingsPage_;
QSharedPointer<UserSettings> userSettings_; QSharedPointer<UserSettings> userSettings_;
// Used to hide undefined states between page transitions. //! Used to hide undefined states between page transitions.
QSharedPointer<OverlayModal> progressModal_; QSharedPointer<OverlayModal> progressModal_;
QSharedPointer<LoadingIndicator> spinner_; QSharedPointer<LoadingIndicator> spinner_;
// Matrix Client API provider. //! Matrix Client API provider.
QSharedPointer<MatrixClient> client_; QSharedPointer<MatrixClient> client_;
// Tray icon that shows the unread message count. //! Tray icon that shows the unread message count.
TrayIcon *trayIcon_; TrayIcon *trayIcon_;
// Notifications display. //! Notifications display.
QSharedPointer<SnackBar> snackBar_; QSharedPointer<SnackBar> snackBar_;
}; };

View File

@ -223,30 +223,6 @@ MainWindow::showChatPage(QString userid, QString homeserver, QString token)
instance_ = this; 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 void
MainWindow::closeEvent(QCloseEvent *event) MainWindow::closeEvent(QCloseEvent *event)
{ {