mirror of https://github.com/Nheko-Reborn/nheko
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
512 lines
17 KiB
512 lines
17 KiB
8 years ago
|
/*
|
||
|
* 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/>.
|
||
|
*/
|
||
|
|
||
7 years ago
|
#include <QApplication>
|
||
8 years ago
|
#include <QLayout>
|
||
|
#include <QSettings>
|
||
7 years ago
|
#include <QShortcut>
|
||
7 years ago
|
|
||
7 years ago
|
#include <mtx/requests.hpp>
|
||
|
|
||
7 years ago
|
#include "ChatPage.h"
|
||
|
#include "Config.h"
|
||
6 years ago
|
#include "Logging.h"
|
||
7 years ago
|
#include "LoginPage.h"
|
||
|
#include "MainWindow.h"
|
||
|
#include "MatrixClient.h"
|
||
|
#include "RegisterPage.h"
|
||
|
#include "TrayIcon.h"
|
||
7 years ago
|
#include "UserSettingsPage.h"
|
||
7 years ago
|
#include "WelcomePage.h"
|
||
6 years ago
|
#include "ui/LoadingIndicator.h"
|
||
|
#include "ui/OverlayModal.h"
|
||
|
#include "ui/SnackBar.h"
|
||
7 years ago
|
|
||
|
#include "dialogs/CreateRoom.h"
|
||
|
#include "dialogs/InviteUsers.h"
|
||
|
#include "dialogs/JoinRoom.h"
|
||
7 years ago
|
#include "dialogs/LeaveRoom.h"
|
||
7 years ago
|
#include "dialogs/Logout.h"
|
||
6 years ago
|
#include "dialogs/MemberList.h"
|
||
|
#include "dialogs/RoomSettings.h"
|
||
8 years ago
|
|
||
8 years ago
|
MainWindow *MainWindow::instance_ = nullptr;
|
||
|
|
||
8 years ago
|
MainWindow::MainWindow(QWidget *parent)
|
||
7 years ago
|
: QMainWindow(parent)
|
||
7 years ago
|
, progressModal_{nullptr}
|
||
|
, spinner_{nullptr}
|
||
8 years ago
|
{
|
||
7 years ago
|
setWindowTitle("nheko");
|
||
|
setObjectName("MainWindow");
|
||
8 years ago
|
|
||
7 years ago
|
restoreWindowSize();
|
||
8 years ago
|
|
||
7 years ago
|
QFont font("Open Sans");
|
||
|
font.setPixelSize(conf::fontSize);
|
||
|
font.setStyleStrategy(QFont::PreferAntialias);
|
||
|
setFont(font);
|
||
8 years ago
|
|
||
7 years ago
|
userSettings_ = QSharedPointer<UserSettings>(new UserSettings);
|
||
|
trayIcon_ = new TrayIcon(":/logos/nheko-32.png", this);
|
||
8 years ago
|
|
||
7 years ago
|
welcome_page_ = new WelcomePage(this);
|
||
7 years ago
|
login_page_ = new LoginPage(this);
|
||
|
register_page_ = new RegisterPage(this);
|
||
|
chat_page_ = new ChatPage(userSettings_, this);
|
||
7 years ago
|
userSettingsPage_ = new UserSettingsPage(userSettings_, this);
|
||
8 years ago
|
|
||
7 years ago
|
// Initialize sliding widget manager.
|
||
7 years ago
|
pageStack_ = new QStackedWidget(this);
|
||
|
pageStack_->addWidget(welcome_page_);
|
||
|
pageStack_->addWidget(login_page_);
|
||
|
pageStack_->addWidget(register_page_);
|
||
|
pageStack_->addWidget(chat_page_);
|
||
7 years ago
|
pageStack_->addWidget(userSettingsPage_);
|
||
8 years ago
|
|
||
7 years ago
|
setCentralWidget(pageStack_);
|
||
8 years ago
|
|
||
7 years ago
|
connect(welcome_page_, SIGNAL(userLogin()), this, SLOT(showLoginPage()));
|
||
|
connect(welcome_page_, SIGNAL(userRegister()), this, SLOT(showRegisterPage()));
|
||
8 years ago
|
|
||
7 years ago
|
connect(login_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
|
||
7 years ago
|
connect(login_page_, &LoginPage::loggingIn, this, &MainWindow::showOverlayProgressBar);
|
||
7 years ago
|
connect(
|
||
7 years ago
|
register_page_, &RegisterPage::registering, this, &MainWindow::showOverlayProgressBar);
|
||
|
connect(
|
||
|
login_page_, &LoginPage::errorOccurred, this, [this]() { removeOverlayProgressBar(); });
|
||
|
connect(register_page_, &RegisterPage::errorOccurred, this, [this]() {
|
||
|
removeOverlayProgressBar();
|
||
|
});
|
||
7 years ago
|
connect(register_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
|
||
8 years ago
|
|
||
7 years ago
|
connect(chat_page_, &ChatPage::closing, this, &MainWindow::showWelcomePage);
|
||
7 years ago
|
connect(
|
||
|
chat_page_, &ChatPage::showOverlayProgressBar, this, &MainWindow::showOverlayProgressBar);
|
||
7 years ago
|
connect(
|
||
|
chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString)));
|
||
|
connect(chat_page_, SIGNAL(unreadMessages(int)), trayIcon_, SLOT(setUnreadCount(int)));
|
||
7 years ago
|
connect(chat_page_, &ChatPage::showLoginPage, this, [this](const QString &msg) {
|
||
7 years ago
|
login_page_->loginError(msg);
|
||
|
showLoginPage();
|
||
|
});
|
||
8 years ago
|
|
||
7 years ago
|
connect(userSettingsPage_, &UserSettingsPage::moveBack, this, [this]() {
|
||
7 years ago
|
pageStack_->setCurrentWidget(chat_page_);
|
||
|
});
|
||
|
|
||
7 years ago
|
connect(
|
||
|
userSettingsPage_, SIGNAL(trayOptionChanged(bool)), trayIcon_, SLOT(setVisible(bool)));
|
||
7 years ago
|
|
||
7 years ago
|
connect(trayIcon_,
|
||
|
SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||
|
this,
|
||
|
SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
|
||
8 years ago
|
|
||
7 years ago
|
connect(chat_page_, SIGNAL(contentLoaded()), this, SLOT(removeOverlayProgressBar()));
|
||
7 years ago
|
connect(
|
||
|
chat_page_, &ChatPage::showUserSettingsPage, this, &MainWindow::showUserSettingsPage);
|
||
8 years ago
|
|
||
7 years ago
|
connect(login_page_, &LoginPage::loginOk, this, [this](const mtx::responses::Login &res) {
|
||
6 years ago
|
http::client()->set_user(res.user_id);
|
||
7 years ago
|
showChatPage();
|
||
7 years ago
|
});
|
||
7 years ago
|
|
||
7 years ago
|
connect(register_page_, &RegisterPage::registerOk, this, &MainWindow::showChatPage);
|
||
|
|
||
7 years ago
|
QShortcut *quitShortcut = new QShortcut(QKeySequence::Quit, this);
|
||
|
connect(quitShortcut, &QShortcut::activated, this, QApplication::quit);
|
||
|
|
||
7 years ago
|
QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this);
|
||
7 years ago
|
connect(quickSwitchShortcut, &QShortcut::activated, this, [this]() {
|
||
7 years ago
|
if (chat_page_->isVisible() && !hasActiveDialogs())
|
||
|
chat_page_->showQuickSwitcher();
|
||
7 years ago
|
});
|
||
|
|
||
7 years ago
|
QSettings settings;
|
||
8 years ago
|
|
||
7 years ago
|
trayIcon_->setVisible(userSettings_->isTrayEnabled());
|
||
|
|
||
7 years ago
|
if (hasActiveUser()) {
|
||
|
QString token = settings.value("auth/access_token").toString();
|
||
|
QString home_server = settings.value("auth/home_server").toString();
|
||
|
QString user_id = settings.value("auth/user_id").toString();
|
||
7 years ago
|
QString device_id = settings.value("auth/device_id").toString();
|
||
8 years ago
|
|
||
6 years ago
|
http::client()->set_access_token(token.toStdString());
|
||
|
http::client()->set_server(home_server.toStdString());
|
||
|
http::client()->set_device_id(device_id.toStdString());
|
||
7 years ago
|
|
||
|
try {
|
||
|
using namespace mtx::identifiers;
|
||
6 years ago
|
http::client()->set_user(parse<User>(user_id.toStdString()));
|
||
7 years ago
|
} catch (const std::invalid_argument &e) {
|
||
7 years ago
|
nhlog::ui()->critical("bootstrapped with invalid user_id: {}",
|
||
7 years ago
|
user_id.toStdString());
|
||
|
}
|
||
|
|
||
|
showChatPage();
|
||
7 years ago
|
}
|
||
8 years ago
|
}
|
||
|
|
||
6 years ago
|
void
|
||
|
MainWindow::showEvent(QShowEvent *event)
|
||
|
{
|
||
|
adjustSideBars();
|
||
|
QMainWindow::showEvent(event);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
MainWindow::resizeEvent(QResizeEvent *event)
|
||
|
{
|
||
|
adjustSideBars();
|
||
|
QMainWindow::resizeEvent(event);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
MainWindow::adjustSideBars()
|
||
|
{
|
||
|
const int timelineWidth = chat_page_->timelineWidth();
|
||
|
const int minAvailableWidth =
|
||
|
conf::sideBarCollapsePoint + ui::sidebar::CommunitiesSidebarSize;
|
||
|
|
||
|
if (timelineWidth < minAvailableWidth && !chat_page_->isSideBarExpanded()) {
|
||
|
chat_page_->hideSideBars();
|
||
|
} else {
|
||
|
chat_page_->showSideBars();
|
||
|
}
|
||
|
}
|
||
|
|
||
7 years ago
|
void
|
||
|
MainWindow::restoreWindowSize()
|
||
7 years ago
|
{
|
||
7 years ago
|
QSettings settings;
|
||
|
int savedWidth = settings.value("window/width").toInt();
|
||
|
int savedheight = settings.value("window/height").toInt();
|
||
|
|
||
|
if (savedWidth == 0 || savedheight == 0)
|
||
|
resize(conf::window::width, conf::window::height);
|
||
|
else
|
||
|
resize(savedWidth, savedheight);
|
||
7 years ago
|
}
|
||
|
|
||
7 years ago
|
void
|
||
|
MainWindow::saveCurrentWindowSize()
|
||
7 years ago
|
{
|
||
7 years ago
|
QSettings settings;
|
||
|
QSize current = size();
|
||
7 years ago
|
|
||
7 years ago
|
settings.setValue("window/width", current.width());
|
||
|
settings.setValue("window/height", current.height());
|
||
7 years ago
|
}
|
||
|
|
||
7 years ago
|
void
|
||
|
MainWindow::removeOverlayProgressBar()
|
||
8 years ago
|
{
|
||
7 years ago
|
QTimer *timer = new QTimer(this);
|
||
|
timer->setSingleShot(true);
|
||
8 years ago
|
|
||
7 years ago
|
connect(timer, &QTimer::timeout, [this, timer]() {
|
||
7 years ago
|
timer->deleteLater();
|
||
8 years ago
|
|
||
7 years ago
|
if (!progressModal_.isNull())
|
||
7 years ago
|
progressModal_->hide();
|
||
8 years ago
|
|
||
7 years ago
|
if (!spinner_.isNull())
|
||
|
spinner_->stop();
|
||
8 years ago
|
|
||
7 years ago
|
progressModal_.reset();
|
||
|
spinner_.reset();
|
||
7 years ago
|
});
|
||
|
|
||
7 years ago
|
// FIXME: Snackbar doesn't work if it's initialized in the constructor.
|
||
7 years ago
|
QTimer::singleShot(0, this, [this]() {
|
||
7 years ago
|
snackBar_ = QSharedPointer<SnackBar>(new SnackBar(this));
|
||
|
connect(chat_page_,
|
||
|
&ChatPage::showNotification,
|
||
|
snackBar_.data(),
|
||
|
&SnackBar::showMessage);
|
||
|
});
|
||
|
|
||
7 years ago
|
timer->start(500);
|
||
8 years ago
|
}
|
||
|
|
||
7 years ago
|
void
|
||
7 years ago
|
MainWindow::showChatPage()
|
||
8 years ago
|
{
|
||
6 years ago
|
auto userid = QString::fromStdString(http::client()->user_id().to_string());
|
||
|
auto device_id = QString::fromStdString(http::client()->device_id());
|
||
|
auto homeserver = QString::fromStdString(http::client()->server() + ":" +
|
||
|
std::to_string(http::client()->port()));
|
||
|
auto token = QString::fromStdString(http::client()->access_token());
|
||
7 years ago
|
|
||
7 years ago
|
QSettings settings;
|
||
|
settings.setValue("auth/access_token", token);
|
||
|
settings.setValue("auth/home_server", homeserver);
|
||
|
settings.setValue("auth/user_id", userid);
|
||
7 years ago
|
settings.setValue("auth/device_id", device_id);
|
||
7 years ago
|
|
||
7 years ago
|
showOverlayProgressBar();
|
||
7 years ago
|
|
||
7 years ago
|
pageStack_->setCurrentWidget(chat_page_);
|
||
7 years ago
|
|
||
6 years ago
|
pageStack_->removeWidget(welcome_page_);
|
||
|
pageStack_->removeWidget(login_page_);
|
||
|
pageStack_->removeWidget(register_page_);
|
||
|
|
||
7 years ago
|
login_page_->reset();
|
||
|
chat_page_->bootstrap(userid, homeserver, token);
|
||
|
|
||
|
instance_ = this;
|
||
8 years ago
|
}
|
||
|
|
||
7 years ago
|
void
|
||
|
MainWindow::closeEvent(QCloseEvent *event)
|
||
8 years ago
|
{
|
||
6 years ago
|
if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() &&
|
||
|
userSettings_->isTrayEnabled()) {
|
||
7 years ago
|
event->ignore();
|
||
|
hide();
|
||
|
}
|
||
8 years ago
|
}
|
||
|
|
||
7 years ago
|
void
|
||
|
MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
|
||
8 years ago
|
{
|
||
7 years ago
|
switch (reason) {
|
||
|
case QSystemTrayIcon::Trigger:
|
||
|
if (!isVisible()) {
|
||
|
show();
|
||
|
} else {
|
||
|
hide();
|
||
|
}
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
8 years ago
|
}
|
||
|
|
||
7 years ago
|
bool
|
||
|
MainWindow::hasActiveUser()
|
||
8 years ago
|
{
|
||
7 years ago
|
QSettings settings;
|
||
8 years ago
|
|
||
7 years ago
|
return settings.contains("auth/access_token") && settings.contains("auth/home_server") &&
|
||
|
settings.contains("auth/user_id");
|
||
8 years ago
|
}
|
||
|
|
||
7 years ago
|
void
|
||
|
MainWindow::openRoomSettings(const QString &room_id)
|
||
|
{
|
||
|
const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : "";
|
||
|
|
||
7 years ago
|
roomSettingsDialog_ =
|
||
|
QSharedPointer<dialogs::RoomSettings>(new dialogs::RoomSettings(roomToSearch, this));
|
||
7 years ago
|
|
||
|
connect(roomSettingsDialog_.data(), &dialogs::RoomSettings::closing, this, [this]() {
|
||
|
roomSettingsModal_->hide();
|
||
|
});
|
||
|
|
||
|
roomSettingsModal_ =
|
||
|
QSharedPointer<OverlayModal>(new OverlayModal(this, roomSettingsDialog_.data()));
|
||
|
|
||
|
roomSettingsModal_->show();
|
||
|
}
|
||
|
|
||
7 years ago
|
void
|
||
|
MainWindow::openMemberListDialog(const QString &room_id)
|
||
|
{
|
||
|
const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : "";
|
||
|
|
||
7 years ago
|
memberListDialog_ =
|
||
|
QSharedPointer<dialogs::MemberList>(new dialogs::MemberList(roomToSearch, this));
|
||
7 years ago
|
|
||
|
memberListModal_ =
|
||
|
QSharedPointer<OverlayModal>(new OverlayModal(this, memberListDialog_.data()));
|
||
|
|
||
|
memberListModal_->show();
|
||
|
}
|
||
|
|
||
7 years ago
|
void
|
||
|
MainWindow::openLeaveRoomDialog(const QString &room_id)
|
||
|
{
|
||
|
auto roomToLeave = room_id.isEmpty() ? chat_page_->currentRoom() : room_id;
|
||
|
|
||
|
leaveRoomDialog_ = QSharedPointer<dialogs::LeaveRoom>(new dialogs::LeaveRoom(this));
|
||
|
|
||
7 years ago
|
connect(leaveRoomDialog_.data(),
|
||
|
&dialogs::LeaveRoom::closing,
|
||
|
this,
|
||
7 years ago
|
[this, roomToLeave](bool leaving) {
|
||
7 years ago
|
leaveRoomModal_->hide();
|
||
7 years ago
|
|
||
7 years ago
|
if (leaving)
|
||
7 years ago
|
chat_page_->leaveRoom(roomToLeave);
|
||
7 years ago
|
});
|
||
7 years ago
|
|
||
|
leaveRoomModal_ =
|
||
|
QSharedPointer<OverlayModal>(new OverlayModal(this, leaveRoomDialog_.data()));
|
||
|
leaveRoomModal_->setColor(QColor(30, 30, 30, 170));
|
||
|
|
||
7 years ago
|
leaveRoomModal_->show();
|
||
7 years ago
|
}
|
||
7 years ago
|
|
||
|
void
|
||
|
MainWindow::showOverlayProgressBar()
|
||
|
{
|
||
|
if (spinner_.isNull()) {
|
||
|
spinner_ = QSharedPointer<LoadingIndicator>(
|
||
|
new LoadingIndicator(this),
|
||
7 years ago
|
[](LoadingIndicator *indicator) { indicator->deleteLater(); });
|
||
7 years ago
|
spinner_->setFixedHeight(100);
|
||
|
spinner_->setFixedWidth(100);
|
||
|
spinner_->setObjectName("ChatPageLoadSpinner");
|
||
|
spinner_->start();
|
||
|
}
|
||
|
|
||
|
if (progressModal_.isNull()) {
|
||
|
progressModal_ =
|
||
|
QSharedPointer<OverlayModal>(new OverlayModal(this, spinner_.data()),
|
||
7 years ago
|
[](OverlayModal *modal) { modal->deleteLater(); });
|
||
7 years ago
|
progressModal_->setColor(QColor(30, 30, 30));
|
||
7 years ago
|
progressModal_->setDismissible(false);
|
||
|
progressModal_->show();
|
||
|
}
|
||
|
}
|
||
7 years ago
|
|
||
7 years ago
|
void
|
||
|
MainWindow::openInviteUsersDialog(std::function<void(const QStringList &invitees)> callback)
|
||
|
{
|
||
|
if (inviteUsersDialog_.isNull()) {
|
||
|
inviteUsersDialog_ =
|
||
|
QSharedPointer<dialogs::InviteUsers>(new dialogs::InviteUsers(this));
|
||
|
|
||
|
connect(inviteUsersDialog_.data(),
|
||
|
&dialogs::InviteUsers::closing,
|
||
|
this,
|
||
|
[this, callback](bool isSending, QStringList invitees) {
|
||
|
inviteUsersModal_->hide();
|
||
|
|
||
|
if (isSending && !invitees.isEmpty())
|
||
|
callback(invitees);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (inviteUsersModal_.isNull()) {
|
||
|
inviteUsersModal_ = QSharedPointer<OverlayModal>(
|
||
|
new OverlayModal(MainWindow::instance(), inviteUsersDialog_.data()));
|
||
|
inviteUsersModal_->setColor(QColor(30, 30, 30, 170));
|
||
|
}
|
||
|
|
||
|
inviteUsersModal_->show();
|
||
|
}
|
||
|
|
||
|
void
|
||
|
MainWindow::openJoinRoomDialog(std::function<void(const QString &room_id)> callback)
|
||
|
{
|
||
|
if (joinRoomDialog_.isNull()) {
|
||
|
joinRoomDialog_ = QSharedPointer<dialogs::JoinRoom>(new dialogs::JoinRoom(this));
|
||
|
|
||
|
connect(joinRoomDialog_.data(),
|
||
|
&dialogs::JoinRoom::closing,
|
||
|
this,
|
||
|
[this, callback](bool isJoining, const QString &room) {
|
||
|
joinRoomModal_->hide();
|
||
|
|
||
|
if (isJoining && !room.isEmpty())
|
||
|
callback(room);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (joinRoomModal_.isNull()) {
|
||
|
joinRoomModal_ = QSharedPointer<OverlayModal>(
|
||
|
new OverlayModal(MainWindow::instance(), joinRoomDialog_.data()));
|
||
|
}
|
||
|
|
||
|
joinRoomModal_->show();
|
||
|
}
|
||
|
|
||
|
void
|
||
|
MainWindow::openCreateRoomDialog(
|
||
|
std::function<void(const mtx::requests::CreateRoom &request)> callback)
|
||
|
{
|
||
|
if (createRoomDialog_.isNull()) {
|
||
|
createRoomDialog_ =
|
||
|
QSharedPointer<dialogs::CreateRoom>(new dialogs::CreateRoom(this));
|
||
|
|
||
|
connect(
|
||
|
createRoomDialog_.data(),
|
||
|
&dialogs::CreateRoom::closing,
|
||
|
this,
|
||
|
[this, callback](bool isCreating, const mtx::requests::CreateRoom &request) {
|
||
|
createRoomModal_->hide();
|
||
|
|
||
|
if (isCreating)
|
||
|
callback(request);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (createRoomModal_.isNull()) {
|
||
|
createRoomModal_ = QSharedPointer<OverlayModal>(
|
||
|
new OverlayModal(MainWindow::instance(), createRoomDialog_.data()));
|
||
|
}
|
||
|
|
||
|
createRoomModal_->show();
|
||
|
}
|
||
|
|
||
|
void
|
||
|
MainWindow::openLogoutDialog(std::function<void()> callback)
|
||
|
{
|
||
|
if (logoutDialog_.isNull()) {
|
||
|
logoutDialog_ = QSharedPointer<dialogs::Logout>(new dialogs::Logout(this));
|
||
|
connect(logoutDialog_.data(),
|
||
|
&dialogs::Logout::closing,
|
||
|
this,
|
||
|
[this, callback](bool logging_out) {
|
||
|
logoutModal_->hide();
|
||
|
|
||
|
if (logging_out)
|
||
|
callback();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (logoutModal_.isNull()) {
|
||
|
logoutModal_ = QSharedPointer<OverlayModal>(
|
||
|
new OverlayModal(MainWindow::instance(), logoutDialog_.data()));
|
||
|
}
|
||
|
|
||
|
logoutModal_->show();
|
||
|
}
|
||
|
|
||
7 years ago
|
bool
|
||
|
MainWindow::hasActiveDialogs() const
|
||
|
{
|
||
|
return (!leaveRoomModal_.isNull() && leaveRoomModal_->isVisible()) ||
|
||
7 years ago
|
(!progressModal_.isNull() && progressModal_->isVisible()) ||
|
||
|
(!inviteUsersModal_.isNull() && inviteUsersModal_->isVisible()) ||
|
||
|
(!joinRoomModal_.isNull() && joinRoomModal_->isVisible()) ||
|
||
|
(!createRoomModal_.isNull() && createRoomModal_->isVisible()) ||
|
||
|
(!logoutModal_.isNull() && logoutModal_->isVisible());
|
||
7 years ago
|
}
|
||
6 years ago
|
|
||
|
bool
|
||
|
MainWindow::pageSupportsTray() const
|
||
|
{
|
||
|
return !welcome_page_->isVisible() && !login_page_->isVisible() &&
|
||
|
!register_page_->isVisible();
|
||
|
}
|