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 <QSystemTrayIcon>
#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> userSettings_;
// Used to hide undefined states between page transitions.
//! Used to hide undefined states between page transitions.
QSharedPointer<OverlayModal> progressModal_;
QSharedPointer<LoadingIndicator> spinner_;
// Matrix Client API provider.
//! Matrix Client API provider.
QSharedPointer<MatrixClient> 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> snackBar_;
};

View File

@ -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)
{