Show confirmation dialog on logout

Minor stylistic refactoring

closes #29
This commit is contained in:
Konstantinos Sideris 2017-06-02 18:04:51 +03:00
parent 5c283a5cda
commit b8c8fed655
13 changed files with 155 additions and 15 deletions

36
include/LogoutDialog.h Normal file
View file

@ -0,0 +1,36 @@
/*
* nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QFrame>
#include "FlatButton.h"
class LogoutDialog : public QFrame
{
Q_OBJECT
public:
explicit LogoutDialog(QWidget *parent = nullptr);
signals:
void closing(bool isLoggingOut);
private:
FlatButton *confirmBtn_;
FlatButton *cancelBtn_;
};

View file

@ -38,6 +38,8 @@ public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
static MainWindow *instance();
protected:
void closeEvent(QCloseEvent *event);
@ -62,6 +64,8 @@ private slots:
private:
bool hasActiveUser();
static MainWindow *instance_;
// The initial welcome screen.
WelcomePage *welcome_page_;

View file

@ -24,6 +24,8 @@
#include "Avatar.h"
#include "FlatButton.h"
#include "LogoutDialog.h"
#include "OverlayModal.h"
class UserInfoWidget : public QWidget
{
@ -45,6 +47,9 @@ signals:
protected:
void resizeEvent(QResizeEvent *event) override;
private slots:
void closeLogoutDialog(bool isLoggingOut);
private:
Avatar *userAvatar_;
@ -62,4 +67,9 @@ private:
QString user_id_;
QImage avatar_image_;
OverlayModal *logoutModal_;
LogoutDialog *logoutDialog_;
int logoutButtonSize_;
};