|
|
@ -1,6 +1,8 @@ |
|
|
|
#include <QIcon> |
|
|
|
#include <QIcon> |
|
|
|
|
|
|
|
|
|
|
|
#include "Config.h" |
|
|
|
#include "Config.h" |
|
|
|
|
|
|
|
#include "MainWindow.h" |
|
|
|
|
|
|
|
#include "OverlayModal.h" |
|
|
|
#include "SideBarActions.h" |
|
|
|
#include "SideBarActions.h" |
|
|
|
#include "Theme.h" |
|
|
|
#include "Theme.h" |
|
|
|
|
|
|
|
|
|
|
@ -27,12 +29,53 @@ SideBarActions::SideBarActions(QWidget *parent) |
|
|
|
settingsBtn_->setIconSize( |
|
|
|
settingsBtn_->setIconSize( |
|
|
|
QSize(conf::sidebarActions::iconSize, conf::sidebarActions::iconSize)); |
|
|
|
QSize(conf::sidebarActions::iconSize, conf::sidebarActions::iconSize)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addMenu_ = new Menu(this); |
|
|
|
|
|
|
|
createRoomAction_ = new QAction(tr("Create new room"), this); |
|
|
|
|
|
|
|
joinRoomAction_ = new QAction(tr("Join a room"), this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(joinRoomAction_, &QAction::triggered, this, [=]() { |
|
|
|
|
|
|
|
if (joinRoomDialog_.isNull()) { |
|
|
|
|
|
|
|
joinRoomDialog_ = |
|
|
|
|
|
|
|
QSharedPointer<dialogs::JoinRoom>(new dialogs::JoinRoom(this)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(joinRoomDialog_.data(), |
|
|
|
|
|
|
|
&dialogs::JoinRoom::closing, |
|
|
|
|
|
|
|
this, |
|
|
|
|
|
|
|
[=](bool isJoining, const QString &room) { |
|
|
|
|
|
|
|
joinRoomModal_->fadeOut(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isJoining && !room.isEmpty()) |
|
|
|
|
|
|
|
emit joinRoom(room); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (joinRoomModal_.isNull()) { |
|
|
|
|
|
|
|
joinRoomModal_ = QSharedPointer<OverlayModal>( |
|
|
|
|
|
|
|
new OverlayModal(MainWindow::instance(), joinRoomDialog_.data())); |
|
|
|
|
|
|
|
joinRoomModal_->setDuration(0); |
|
|
|
|
|
|
|
joinRoomModal_->setColor(QColor(30, 30, 30, 170)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
joinRoomModal_->fadeIn(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addMenu_->addAction(createRoomAction_); |
|
|
|
|
|
|
|
addMenu_->addAction(joinRoomAction_); |
|
|
|
|
|
|
|
|
|
|
|
createRoomBtn_ = new FlatButton(this); |
|
|
|
createRoomBtn_ = new FlatButton(this); |
|
|
|
createRoomBtn_->setIcon(createRoomIcon); |
|
|
|
createRoomBtn_->setIcon(createRoomIcon); |
|
|
|
createRoomBtn_->setCornerRadius(conf::sidebarActions::iconSize / 2); |
|
|
|
createRoomBtn_->setCornerRadius(conf::sidebarActions::iconSize / 2); |
|
|
|
createRoomBtn_->setIconSize( |
|
|
|
createRoomBtn_->setIconSize( |
|
|
|
QSize(conf::sidebarActions::iconSize, conf::sidebarActions::iconSize)); |
|
|
|
QSize(conf::sidebarActions::iconSize, conf::sidebarActions::iconSize)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(createRoomBtn_, &QPushButton::clicked, this, [=]() { |
|
|
|
|
|
|
|
auto pos = mapToGlobal(createRoomBtn_->pos()); |
|
|
|
|
|
|
|
auto padding = conf::sidebarActions::iconSize / 2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addMenu_->popup( |
|
|
|
|
|
|
|
QPoint(pos.x() + padding, pos.y() - padding - addMenu_->sizeHint().height())); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
joinRoomBtn_ = new FlatButton(this); |
|
|
|
joinRoomBtn_ = new FlatButton(this); |
|
|
|
joinRoomBtn_->setIcon(joinRoomIcon); |
|
|
|
joinRoomBtn_->setIcon(joinRoomIcon); |
|
|
|
joinRoomBtn_->setCornerRadius(conf::sidebarActions::iconSize / 2); |
|
|
|
joinRoomBtn_->setCornerRadius(conf::sidebarActions::iconSize / 2); |
|
|
|