mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 13:08:48 +03:00
Clean up Top Bar
This commit is contained in:
parent
4a2f1af090
commit
74ff905582
2 changed files with 0 additions and 25 deletions
|
@ -31,7 +31,6 @@ class FlatButton;
|
||||||
class Label;
|
class Label;
|
||||||
class Menu;
|
class Menu;
|
||||||
class OverlayModal;
|
class OverlayModal;
|
||||||
class RoomSettings;
|
|
||||||
|
|
||||||
class TopRoomBar : public QWidget
|
class TopRoomBar : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -47,7 +46,6 @@ public:
|
||||||
void updateRoomName(const QString &name);
|
void updateRoomName(const QString &name);
|
||||||
void updateRoomTopic(QString topic);
|
void updateRoomTopic(QString topic);
|
||||||
void updateRoomAvatarFromName(const QString &name);
|
void updateRoomAvatarFromName(const QString &name);
|
||||||
void setRoomSettings(QSharedPointer<RoomSettings> settings);
|
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
@ -68,10 +66,7 @@ private:
|
||||||
QLabel *nameLabel_;
|
QLabel *nameLabel_;
|
||||||
Label *topicLabel_;
|
Label *topicLabel_;
|
||||||
|
|
||||||
QSharedPointer<RoomSettings> roomSettings_;
|
|
||||||
|
|
||||||
QMenu *menu_;
|
QMenu *menu_;
|
||||||
QAction *toggleNotifications_;
|
|
||||||
QAction *leaveRoom_;
|
QAction *leaveRoom_;
|
||||||
QAction *inviteUsers_;
|
QAction *inviteUsers_;
|
||||||
|
|
||||||
|
|
|
@ -85,11 +85,6 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
||||||
|
|
||||||
menu_ = new Menu(this);
|
menu_ = new Menu(this);
|
||||||
|
|
||||||
toggleNotifications_ = new QAction(tr("Disable notifications"), this);
|
|
||||||
connect(toggleNotifications_, &QAction::triggered, this, [this]() {
|
|
||||||
roomSettings_->toggleNotifications();
|
|
||||||
});
|
|
||||||
|
|
||||||
inviteUsers_ = new QAction(tr("Invite users"), this);
|
inviteUsers_ = new QAction(tr("Invite users"), this);
|
||||||
connect(inviteUsers_, &QAction::triggered, this, [this]() {
|
connect(inviteUsers_, &QAction::triggered, this, [this]() {
|
||||||
MainWindow::instance()->openInviteUsersDialog(
|
MainWindow::instance()->openInviteUsersDialog(
|
||||||
|
@ -101,19 +96,10 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
||||||
MainWindow::instance()->openLeaveRoomDialog();
|
MainWindow::instance()->openLeaveRoomDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
menu_->addAction(toggleNotifications_);
|
|
||||||
menu_->addAction(inviteUsers_);
|
menu_->addAction(inviteUsers_);
|
||||||
menu_->addAction(leaveRoom_);
|
menu_->addAction(leaveRoom_);
|
||||||
|
|
||||||
connect(settingsBtn_, &QPushButton::clicked, this, [this]() {
|
connect(settingsBtn_, &QPushButton::clicked, this, [this]() {
|
||||||
if (roomSettings_.isNull())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (roomSettings_->isNotificationsEnabled())
|
|
||||||
toggleNotifications_->setText(tr("Disable notifications"));
|
|
||||||
else
|
|
||||||
toggleNotifications_->setText(tr("Enable notifications"));
|
|
||||||
|
|
||||||
auto pos = mapToGlobal(settingsBtn_->pos());
|
auto pos = mapToGlobal(settingsBtn_->pos());
|
||||||
menu_->popup(
|
menu_->popup(
|
||||||
QPoint(pos.x() + buttonSize_ - menu_->sizeHint().width(), pos.y() + buttonSize_));
|
QPoint(pos.x() + buttonSize_ - menu_->sizeHint().width(), pos.y() + buttonSize_));
|
||||||
|
@ -182,12 +168,6 @@ TopRoomBar::mousePressEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
TopRoomBar::setRoomSettings(QSharedPointer<RoomSettings> settings)
|
|
||||||
{
|
|
||||||
roomSettings_ = settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TopRoomBar::updateRoomAvatar(const QImage &avatar_image)
|
TopRoomBar::updateRoomAvatar(const QImage &avatar_image)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue