diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-09-21 13:56:39 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-09-21 13:56:39 +0300 |
commit | b0e3a7c7fac407b12b5bee3cef9dbd6f4ced7a50 (patch) | |
tree | 8e223a237db7beac1e77b0a88feea7970a8200d5 | |
parent | Center dialogs around the main window (diff) | |
download | nheko-b0e3a7c7fac407b12b5bee3cef9dbd6f4ced7a50.tar.xz |
Add close buttons to all dialogs
-rw-r--r-- | src/dialogs/MemberList.cpp | 9 | ||||
-rw-r--r-- | src/dialogs/ReadReceipts.cpp | 10 | ||||
-rw-r--r-- | src/dialogs/RoomSettings.cpp | 9 | ||||
-rw-r--r-- | src/dialogs/UserProfile.cpp | 9 |
4 files changed, 37 insertions, 0 deletions
diff --git a/src/dialogs/MemberList.cpp b/src/dialogs/MemberList.cpp index bd9b1edf..df539666 100644 --- a/src/dialogs/MemberList.cpp +++ b/src/dialogs/MemberList.cpp @@ -95,8 +95,16 @@ MemberList::MemberList(const QString &room_id, QWidget *parent) topLabel_->setAlignment(Qt::AlignCenter); topLabel_->setFont(font); + auto okBtn = new QPushButton("OK", this); + + auto buttonLayout = new QHBoxLayout(); + buttonLayout->setSpacing(15); + buttonLayout->addStretch(1); + buttonLayout->addWidget(okBtn); + layout->addWidget(topLabel_); layout->addWidget(list_); + layout->addLayout(buttonLayout); list_->clear(); @@ -125,6 +133,7 @@ MemberList::MemberList(const QString &room_id, QWidget *parent) auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this); connect(closeShortcut, &QShortcut::activated, this, &MemberList::close); + connect(okBtn, &QPushButton::clicked, this, &MemberList::close); } void diff --git a/src/dialogs/ReadReceipts.cpp b/src/dialogs/ReadReceipts.cpp index 5a36bd89..d0bfd36c 100644 --- a/src/dialogs/ReadReceipts.cpp +++ b/src/dialogs/ReadReceipts.cpp @@ -2,6 +2,7 @@ #include <QIcon> #include <QListWidgetItem> #include <QPainter> +#include <QPushButton> #include <QShortcut> #include <QStyleOption> #include <QTimer> @@ -119,11 +120,20 @@ ReadReceipts::ReadReceipts(QWidget *parent) topLabel_->setAlignment(Qt::AlignCenter); topLabel_->setFont(font); + auto okBtn = new QPushButton(tr("Close"), this); + + auto buttonLayout = new QHBoxLayout(); + buttonLayout->setSpacing(15); + buttonLayout->addStretch(1); + buttonLayout->addWidget(okBtn); + layout->addWidget(topLabel_); layout->addWidget(userList_); + layout->addLayout(buttonLayout); auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this); connect(closeShortcut, &QShortcut::activated, this, &ReadReceipts::close); + connect(okBtn, &QPushButton::clicked, this, &ReadReceipts::close); } void diff --git a/src/dialogs/RoomSettings.cpp b/src/dialogs/RoomSettings.cpp index 5e285064..c4bb7af5 100644 --- a/src/dialogs/RoomSettings.cpp +++ b/src/dialogs/RoomSettings.cpp @@ -384,6 +384,13 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent) spinnerLayout->setMargin(0); spinnerLayout->setSpacing(0); + auto okBtn = new QPushButton("OK", this); + + auto buttonLayout = new QHBoxLayout(); + buttonLayout->setSpacing(15); + buttonLayout->addStretch(1); + buttonLayout->addWidget(okBtn); + layout->addWidget(avatar_, Qt::AlignCenter | Qt::AlignTop); layout->addLayout(textLayout); layout->addLayout(btnLayout_); @@ -395,6 +402,7 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent) layout->addWidget(infoLabel, Qt::AlignLeft); layout->addLayout(roomIdLayout); layout->addWidget(errorLabel_); + layout->addLayout(buttonLayout); layout->addLayout(spinnerLayout); layout->addStretch(1); @@ -422,6 +430,7 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent) auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this); connect(closeShortcut, &QShortcut::activated, this, &RoomSettings::close); + connect(okBtn, &QPushButton::clicked, this, &RoomSettings::close); } void diff --git a/src/dialogs/UserProfile.cpp b/src/dialogs/UserProfile.cpp index 5b8280f2..14aa6819 100644 --- a/src/dialogs/UserProfile.cpp +++ b/src/dialogs/UserProfile.cpp @@ -148,12 +148,20 @@ UserProfile::UserProfile(QWidget *parent) devicesLabel_->setFont(descriptionLabelFont); devicesLabel_->hide(); + auto okBtn = new QPushButton("OK", this); + + auto closeLayout = new QHBoxLayout(); + closeLayout->setSpacing(15); + closeLayout->addStretch(1); + closeLayout->addWidget(okBtn); + auto vlayout = new QVBoxLayout{this}; vlayout->addWidget(avatar_); vlayout->addLayout(textLayout); vlayout->addLayout(btnLayout); vlayout->addWidget(devicesLabel_, Qt::AlignLeft); vlayout->addWidget(devices_); + vlayout->addLayout(closeLayout); vlayout->addStretch(1); vlayout->setAlignment(avatar_, Qt::AlignCenter | Qt::AlignTop); @@ -178,6 +186,7 @@ UserProfile::UserProfile(QWidget *parent) auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this); connect(closeShortcut, &QShortcut::activated, this, &UserProfile::close); + connect(okBtn, &QPushButton::clicked, this, &UserProfile::close); } void |