mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Improvements on the system theme
This commit is contained in:
parent
f108b8b915
commit
1716502eff
35 changed files with 348 additions and 425 deletions
|
@ -3,7 +3,9 @@
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Features
|
### Features
|
||||||
- Support for sending & receiving markdown formatted messages. (#283)
|
- Support for sending & receiving markdown formatted messages. (#283)
|
||||||
|
- Import/Export of megolm session keys. (Incompatible with Riot) (#358)
|
||||||
- Context menu option to show the raw text message of an event. (#437)
|
- Context menu option to show the raw text message of an event. (#437)
|
||||||
|
- Rooms with unread messages are marked in the room list. (#313)
|
||||||
- Clicking on a user pill link will open the user profile.
|
- Clicking on a user pill link will open the user profile.
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
|
@ -129,7 +129,7 @@ UserInfoWidget, UserInfoWidget > * {
|
||||||
|
|
||||||
UserInfoWidget {
|
UserInfoWidget {
|
||||||
border: none;
|
border: none;
|
||||||
qproperty-borderColor: #202228;
|
border-bottom: 1px solid #202228;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserSettingsPage {
|
UserSettingsPage {
|
||||||
|
@ -214,13 +214,13 @@ ScrollBar {
|
||||||
|
|
||||||
SideBarActions {
|
SideBarActions {
|
||||||
border: none;
|
border: none;
|
||||||
qproperty-borderColor: #202228;
|
border-top: 1px solid #202228;
|
||||||
background-color: #2d3139;
|
background-color: #2d3139;
|
||||||
}
|
}
|
||||||
|
|
||||||
TopRoomBar {
|
TopRoomBar {
|
||||||
border: none;
|
border: none;
|
||||||
qproperty-borderColor: #202228;
|
border-bottom: 1px solid #202228;
|
||||||
background-color: #2d3139;
|
background-color: #2d3139;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,10 +229,14 @@ QLineEdit {
|
||||||
color: #caccd1;
|
color: #caccd1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextInputWidget {
|
||||||
|
border: none;
|
||||||
|
border-top: 1px solid #2d3139;
|
||||||
|
}
|
||||||
|
|
||||||
TextInputWidget,
|
TextInputWidget,
|
||||||
TextInputWidget > QTextEdit,
|
TextInputWidget > QTextEdit,
|
||||||
TextInputWidget > QLineEdit {
|
TextInputWidget > QLineEdit {
|
||||||
qproperty-borderColor: #202228;
|
|
||||||
background-color: #2d3139;
|
background-color: #2d3139;
|
||||||
color: #caccd1;
|
color: #caccd1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ UserInfoWidget, UserInfoWidget > * {
|
||||||
|
|
||||||
UserInfoWidget {
|
UserInfoWidget {
|
||||||
border: none;
|
border: none;
|
||||||
qproperty-borderColor: #dcdcdc;
|
border-bottom: 1px solid #dcdcdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserSettingsPage {
|
UserSettingsPage {
|
||||||
|
@ -206,7 +206,8 @@ TextField {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextInputWidget {
|
TextInputWidget {
|
||||||
qproperty-borderColor: #dcdcdc;
|
border: none;
|
||||||
|
border-top: 1px solid #dcdcdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBar {
|
ScrollBar {
|
||||||
|
@ -216,12 +217,12 @@ ScrollBar {
|
||||||
|
|
||||||
SideBarActions {
|
SideBarActions {
|
||||||
border: none;
|
border: none;
|
||||||
qproperty-borderColor: #dcdcdc;
|
border-top: 1px solid #dcdcdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
TopRoomBar {
|
TopRoomBar {
|
||||||
border: none;
|
border: none;
|
||||||
qproperty-borderColor: #dcdcdc;
|
border-bottom: 1px solid #dcdcdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Toggle {
|
Toggle {
|
||||||
|
|
|
@ -1,53 +1,52 @@
|
||||||
OverlayWidget,
|
|
||||||
OverlayWidget > * {
|
|
||||||
background-color: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
#mainContent,
|
|
||||||
#mainContent > * {
|
|
||||||
background-color: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
#sideBar {
|
|
||||||
border: none;
|
|
||||||
border-right: 1px solid palette(text);
|
|
||||||
border-left: 1px solid palette(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
TopRoomBar {
|
|
||||||
qproperty-borderColor: palette(text);
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
TimelineView,
|
|
||||||
TimelineView > *,
|
|
||||||
TimelineItem,
|
|
||||||
TimelineItem > * {
|
|
||||||
background-color: palette(window);
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
QuickSwitcher {
|
|
||||||
background-color: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
TypingDisplay {
|
TypingDisplay {
|
||||||
qproperty-textColor: palette(text);
|
qproperty-textColor: palette(text);
|
||||||
qproperty-backgroundColor: palette(window);
|
qproperty-backgroundColor: palette(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoMessage {
|
TimelineView,
|
||||||
qproperty-textColor: palette(text);
|
TimelineView > * {
|
||||||
qproperty-boxColor: palette(window);
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
SuggestionsPopup {
|
TextInputWidget {
|
||||||
|
border: none;
|
||||||
|
border-top: 1px solid palette(mid);
|
||||||
|
}
|
||||||
|
|
||||||
|
SideBarActions {
|
||||||
|
border: none;
|
||||||
|
border-top: 1px solid palette(mid);
|
||||||
|
}
|
||||||
|
|
||||||
|
TopRoomBar {
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid palette(mid);
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomList,
|
||||||
|
RoomList > * {
|
||||||
background-color: palette(window);
|
background-color: palette(window);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInfoWidget {
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid palette(mid);
|
||||||
|
}
|
||||||
|
|
||||||
|
#sideBar {
|
||||||
|
border: none;
|
||||||
|
border-right: 1px solid palette(mid);
|
||||||
|
border-left: 1px solid palette(mid);
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoMessage {
|
||||||
|
qproperty-textColor: palette(text);
|
||||||
|
qproperty-boxColor: palette(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupItem {
|
PopupItem {
|
||||||
background-color: palette(window);
|
qproperty-hoverColor: palette(base);
|
||||||
qproperty-hoverColor: rgba(192, 193, 195, 120);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatButton {
|
FlatButton {
|
||||||
|
@ -74,47 +73,44 @@ TextField {
|
||||||
qproperty-backgroundColor: palette(window);
|
qproperty-backgroundColor: palette(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
WelcomePage,
|
QTextEdit,
|
||||||
LoginPage,
|
ReceiptItem,
|
||||||
RegisterPage {
|
MemberItem,
|
||||||
|
QLineEdit,
|
||||||
|
QListWidget {
|
||||||
background-color: palette(window);
|
background-color: palette(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomList,
|
|
||||||
RoomList > * {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
RoomInfoListItem {
|
RoomInfoListItem {
|
||||||
qproperty-highlightedBackgroundColor: palette(highlight);
|
qproperty-highlightedBackgroundColor: palette(highlight);
|
||||||
qproperty-hoverBackgroundColor: palette(light);
|
qproperty-hoverBackgroundColor: palette(base);
|
||||||
qproperty-backgroundColor: palette(window);
|
qproperty-backgroundColor: palette(window);
|
||||||
|
|
||||||
qproperty-titleColor: palette(text);
|
qproperty-titleColor: palette(text);
|
||||||
qproperty-subtitleColor: palette(text);
|
qproperty-subtitleColor: palette(text);
|
||||||
|
|
||||||
qproperty-highlightedTitleColor: palette(light);
|
qproperty-highlightedTitleColor: palette(highlightedtext);
|
||||||
qproperty-highlightedSubtitleColor: palette(light);
|
qproperty-highlightedSubtitleColor: palette(highlightedtext);
|
||||||
|
|
||||||
qproperty-btnColor: palette(mid);
|
qproperty-btnColor: palette(button);
|
||||||
qproperty-btnTextColor: palette(text);
|
qproperty-btnTextColor: palette(buttonText);
|
||||||
|
|
||||||
qproperty-timestampColor: palette(text);
|
qproperty-timestampColor: palette(text);
|
||||||
qproperty-highlightedTimestampColor: palette(light);
|
qproperty-highlightedTimestampColor: palette(highlightedtext);
|
||||||
|
|
||||||
qproperty-avatarBgColor: palette(mid);
|
qproperty-avatarBgColor: palette(base);
|
||||||
qproperty-avatarFgColor: palette(text);
|
qproperty-avatarFgColor: palette(text);
|
||||||
|
|
||||||
|
qproperty-bubbleBgColor: palette(base);
|
||||||
qproperty-bubbleFgColor: palette(text);
|
qproperty-bubbleFgColor: palette(text);
|
||||||
qproperty-bubbleBgColor: palette(mid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommunitiesListItem {
|
CommunitiesListItem {
|
||||||
qproperty-highlightedBackgroundColor: palette(highlight);
|
qproperty-highlightedBackgroundColor: palette(highlight);
|
||||||
qproperty-hoverBackgroundColor: palette(light);
|
qproperty-hoverBackgroundColor: palette(base);
|
||||||
qproperty-backgroundColor: palette(window);
|
qproperty-backgroundColor: palette(window);
|
||||||
|
|
||||||
qproperty-avatarBgColor: palette(mid);
|
qproperty-avatarBgColor: palette(base);
|
||||||
qproperty-avatarFgColor: palette(text);
|
qproperty-avatarFgColor: palette(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,42 +122,23 @@ LoadingIndicator {
|
||||||
qproperty-color: palette(light);
|
qproperty-color: palette(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserInfoWidget,
|
|
||||||
UserInfoWidget > * {
|
|
||||||
background-color: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
emoji--Category,
|
|
||||||
emoji--Category > * {
|
|
||||||
background-color: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
emoji--Panel,
|
|
||||||
emoji--Panel > * {
|
|
||||||
background-color: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextEdit,
|
|
||||||
QLineEdit {
|
|
||||||
background-color: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar {
|
|
||||||
qproperty-handleColor: palette(text);
|
|
||||||
qproperty-backgroundColor: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
FloatingButton {
|
FloatingButton {
|
||||||
qproperty-backgroundColor: palette(window);
|
qproperty-backgroundColor: palette(base);
|
||||||
qproperty-foregroundColor: palette(text);
|
qproperty-foregroundColor: palette(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
QListWidget {
|
|
||||||
background-color: palette(window);
|
|
||||||
color: palette(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
SnackBar {
|
SnackBar {
|
||||||
qproperty-textColor: palette(text);
|
qproperty-textColor: palette(text);
|
||||||
qproperty-bgColor: palette(base);
|
qproperty-bgColor: palette(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MemberItem {
|
||||||
|
background-color: palette(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
Toggle {
|
||||||
|
qproperty-activeColor: palette(highlight);
|
||||||
|
qproperty-disabledColor: palette(dark);
|
||||||
|
qproperty-inactiveColor: palette(mid);
|
||||||
|
qproperty-trackColor: palette(base);
|
||||||
|
}
|
||||||
|
|
|
@ -310,7 +310,8 @@ MainWindow::openUserProfile(const QString &user_id, const QString &room_id)
|
||||||
auto dialog = new dialogs::UserProfile(this);
|
auto dialog = new dialogs::UserProfile(this);
|
||||||
dialog->init(user_id, room_id);
|
dialog->init(user_id, room_id);
|
||||||
|
|
||||||
showTransparentOverlayModal(dialog);
|
dialog->raise();
|
||||||
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -319,20 +320,19 @@ MainWindow::openRoomSettings(const QString &room_id)
|
||||||
const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : "";
|
const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : "";
|
||||||
|
|
||||||
auto dialog = new dialogs::RoomSettings(roomToSearch, this);
|
auto dialog = new dialogs::RoomSettings(roomToSearch, this);
|
||||||
connect(dialog, &dialogs::RoomSettings::closing, this, [this]() {
|
|
||||||
if (modal_)
|
|
||||||
modal_->hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
showTransparentOverlayModal(dialog);
|
dialog->raise();
|
||||||
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::openMemberListDialog(const QString &room_id)
|
MainWindow::openMemberListDialog(const QString &room_id)
|
||||||
{
|
{
|
||||||
const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : "";
|
const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : "";
|
||||||
|
auto dialog = new dialogs::MemberList(roomToSearch, this);
|
||||||
|
|
||||||
showTransparentOverlayModal(new dialogs::MemberList(roomToSearch, this));
|
dialog->raise();
|
||||||
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -341,15 +341,12 @@ MainWindow::openLeaveRoomDialog(const QString &room_id)
|
||||||
auto roomToLeave = room_id.isEmpty() ? chat_page_->currentRoom() : room_id;
|
auto roomToLeave = room_id.isEmpty() ? chat_page_->currentRoom() : room_id;
|
||||||
|
|
||||||
auto dialog = new dialogs::LeaveRoom(this);
|
auto dialog = new dialogs::LeaveRoom(this);
|
||||||
connect(dialog, &dialogs::LeaveRoom::closing, this, [this, roomToLeave](bool leaving) {
|
connect(dialog, &dialogs::LeaveRoom::leaving, this, [this, roomToLeave]() {
|
||||||
if (modal_)
|
chat_page_->leaveRoom(roomToLeave);
|
||||||
modal_->hide();
|
|
||||||
|
|
||||||
if (leaving)
|
|
||||||
chat_page_->leaveRoom(roomToLeave);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
showTransparentOverlayModal(dialog, Qt::AlignCenter);
|
dialog->raise();
|
||||||
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -368,35 +365,26 @@ void
|
||||||
MainWindow::openInviteUsersDialog(std::function<void(const QStringList &invitees)> callback)
|
MainWindow::openInviteUsersDialog(std::function<void(const QStringList &invitees)> callback)
|
||||||
{
|
{
|
||||||
auto dialog = new dialogs::InviteUsers(this);
|
auto dialog = new dialogs::InviteUsers(this);
|
||||||
connect(dialog,
|
connect(dialog, &dialogs::InviteUsers::sendInvites, this, [callback](QStringList invitees) {
|
||||||
&dialogs::InviteUsers::closing,
|
if (!invitees.isEmpty())
|
||||||
this,
|
callback(invitees);
|
||||||
[this, callback](bool isSending, QStringList invitees) {
|
});
|
||||||
if (modal_)
|
|
||||||
modal_->hide();
|
|
||||||
if (isSending && !invitees.isEmpty())
|
|
||||||
callback(invitees);
|
|
||||||
});
|
|
||||||
|
|
||||||
showTransparentOverlayModal(dialog);
|
dialog->raise();
|
||||||
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::openJoinRoomDialog(std::function<void(const QString &room_id)> callback)
|
MainWindow::openJoinRoomDialog(std::function<void(const QString &room_id)> callback)
|
||||||
{
|
{
|
||||||
auto dialog = new dialogs::JoinRoom(this);
|
auto dialog = new dialogs::JoinRoom(this);
|
||||||
connect(dialog,
|
connect(dialog, &dialogs::JoinRoom::joinRoom, this, [callback](const QString &room) {
|
||||||
&dialogs::JoinRoom::closing,
|
if (!room.isEmpty())
|
||||||
this,
|
callback(room);
|
||||||
[this, callback](bool isJoining, const QString &room) {
|
});
|
||||||
if (modal_)
|
|
||||||
modal_->hide();
|
|
||||||
|
|
||||||
if (isJoining && !room.isEmpty())
|
dialog->raise();
|
||||||
callback(room);
|
dialog->show();
|
||||||
});
|
|
||||||
|
|
||||||
showTransparentOverlayModal(dialog, Qt::AlignCenter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -405,17 +393,12 @@ MainWindow::openCreateRoomDialog(
|
||||||
{
|
{
|
||||||
auto dialog = new dialogs::CreateRoom(this);
|
auto dialog = new dialogs::CreateRoom(this);
|
||||||
connect(dialog,
|
connect(dialog,
|
||||||
&dialogs::CreateRoom::closing,
|
&dialogs::CreateRoom::createRoom,
|
||||||
this,
|
this,
|
||||||
[this, callback](bool isCreating, const mtx::requests::CreateRoom &request) {
|
[callback](const mtx::requests::CreateRoom &request) { callback(request); });
|
||||||
if (modal_)
|
|
||||||
modal_->hide();
|
|
||||||
|
|
||||||
if (isCreating)
|
dialog->raise();
|
||||||
callback(request);
|
dialog->show();
|
||||||
});
|
|
||||||
|
|
||||||
showTransparentOverlayModal(dialog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -444,22 +427,11 @@ void
|
||||||
MainWindow::openLogoutDialog()
|
MainWindow::openLogoutDialog()
|
||||||
{
|
{
|
||||||
auto dialog = new dialogs::Logout(this);
|
auto dialog = new dialogs::Logout(this);
|
||||||
connect(dialog, &dialogs::Logout::closing, this, [this](bool logging_out) {
|
connect(
|
||||||
if (modal_)
|
dialog, &dialogs::Logout::loggingOut, this, [this]() { chat_page_->initiateLogout(); });
|
||||||
modal_->hide();
|
|
||||||
|
|
||||||
// By initiating the logout process a new overlay widget
|
dialog->raise();
|
||||||
// will replace & destroy the previous widget (logout dialog).
|
dialog->show();
|
||||||
//
|
|
||||||
// This will force the destruction of the logout widget to
|
|
||||||
// happen after the click event has been fully processed.
|
|
||||||
QTimer::singleShot(0, this, [logging_out, this]() {
|
|
||||||
if (logging_out)
|
|
||||||
chat_page_->initiateLogout();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
showTransparentOverlayModal(dialog, Qt::AlignCenter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -480,7 +452,8 @@ MainWindow::openReadReceiptsDialog(const QString &event_id)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
showTransparentOverlayModal(dialog);
|
dialog->raise();
|
||||||
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
constexpr int MaxUnreadCountDisplayed = 99;
|
constexpr int MaxUnreadCountDisplayed = 99;
|
||||||
|
|
||||||
constexpr int Padding = 9;
|
constexpr int Padding = 9;
|
||||||
constexpr int UnreadLineWidth = 4;
|
constexpr int UnreadLineWidth = 6;
|
||||||
constexpr int UnreadLineOffset = 4;
|
constexpr int UnreadLineOffset = 4;
|
||||||
constexpr int IconSize = 44;
|
constexpr int IconSize = 44;
|
||||||
constexpr int MaxHeight = IconSize + 2 * Padding;
|
constexpr int MaxHeight = IconSize + 2 * Padding;
|
||||||
|
|
|
@ -103,7 +103,4 @@ SideBarActions::paintEvent(QPaintEvent *)
|
||||||
opt.init(this);
|
opt.init(this);
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
|
||||||
p.setPen(QPen(borderColor()));
|
|
||||||
p.drawLine(QPointF(0, 0), QPointF(width(), 0));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -640,9 +640,6 @@ TextInputWidget::paintEvent(QPaintEvent *)
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
|
||||||
p.setPen(QPen(borderColor()));
|
|
||||||
p.drawLine(QPointF(0, 0), QPointF(width(), 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "TopRoomBar.h"
|
#include "TopRoomBar.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "timeline/TimelineItem.h"
|
||||||
#include "ui/Avatar.h"
|
#include "ui/Avatar.h"
|
||||||
#include "ui/FlatButton.h"
|
#include "ui/FlatButton.h"
|
||||||
#include "ui/Menu.h"
|
#include "ui/Menu.h"
|
||||||
|
@ -55,7 +56,9 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
||||||
QFont descriptionFont("Open Sans");
|
QFont descriptionFont("Open Sans");
|
||||||
descriptionFont.setPixelSize(conf::topRoomBar::fonts::roomDescription);
|
descriptionFont.setPixelSize(conf::topRoomBar::fonts::roomDescription);
|
||||||
|
|
||||||
topicLabel_ = new QLabel(this);
|
topicLabel_ = new TextLabel(this);
|
||||||
|
topicLabel_->setLineWrapMode(QTextEdit::NoWrap);
|
||||||
|
topicLabel_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
topicLabel_->setFont(descriptionFont);
|
topicLabel_->setFont(descriptionFont);
|
||||||
topicLabel_->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
topicLabel_->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
topicLabel_->setOpenExternalLinks(true);
|
topicLabel_->setOpenExternalLinks(true);
|
||||||
|
@ -180,6 +183,7 @@ void
|
||||||
TopRoomBar::updateRoomTopic(QString topic)
|
TopRoomBar::updateRoomTopic(QString topic)
|
||||||
{
|
{
|
||||||
topic.replace(conf::strings::url_regex, conf::strings::url_html);
|
topic.replace(conf::strings::url_regex, conf::strings::url_html);
|
||||||
topicLabel_->setText(topic);
|
topicLabel_->clearLinks();
|
||||||
|
topicLabel_->setHtml(topic);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
class Avatar;
|
class Avatar;
|
||||||
class FlatButton;
|
class FlatButton;
|
||||||
class Menu;
|
class Menu;
|
||||||
|
class TextLabel;
|
||||||
class OverlayModal;
|
class OverlayModal;
|
||||||
|
|
||||||
class TopRoomBar : public QWidget
|
class TopRoomBar : public QWidget
|
||||||
|
@ -76,22 +77,14 @@ protected:
|
||||||
opt.init(this);
|
opt.init(this);
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
|
||||||
#if !defined(Q_OS_MAC)
|
|
||||||
p.setPen(QPen(borderColor()));
|
|
||||||
p.drawLine(QPointF(0, height() - p.pen().width()), QPointF(width(), height()));
|
|
||||||
#else
|
|
||||||
p.setPen(QPen(borderColor()));
|
|
||||||
p.drawLine(QPointF(0, height()), QPointF(width(), height()));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHBoxLayout *topLayout_ = nullptr;
|
QHBoxLayout *topLayout_ = nullptr;
|
||||||
QVBoxLayout *textLayout_ = nullptr;
|
QVBoxLayout *textLayout_ = nullptr;
|
||||||
|
|
||||||
QLabel *nameLabel_ = nullptr;
|
QLabel *nameLabel_ = nullptr;
|
||||||
QLabel *topicLabel_ = nullptr;
|
TextLabel *topicLabel_ = nullptr;
|
||||||
|
|
||||||
Menu *menu_;
|
Menu *menu_;
|
||||||
QAction *leaveRoom_ = nullptr;
|
QAction *leaveRoom_ = nullptr;
|
||||||
|
|
|
@ -160,9 +160,4 @@ UserInfoWidget::paintEvent(QPaintEvent *event)
|
||||||
opt.init(this);
|
opt.init(this);
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
|
||||||
#if !defined(Q_OS_MAC)
|
|
||||||
p.setPen(QPen(borderColor()));
|
|
||||||
p.drawLine(QPointF(0, height() - p.pen().width()), QPointF(width(), height()));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,14 +66,11 @@ void
|
||||||
UserSettings::applyTheme()
|
UserSettings::applyTheme()
|
||||||
{
|
{
|
||||||
QFile stylefile;
|
QFile stylefile;
|
||||||
QPalette pal;
|
|
||||||
|
|
||||||
if (theme() == "light") {
|
if (theme() == "light") {
|
||||||
stylefile.setFileName(":/styles/styles/nheko.qss");
|
stylefile.setFileName(":/styles/styles/nheko.qss");
|
||||||
pal.setColor(QPalette::Link, QColor("#333"));
|
|
||||||
} else if (theme() == "dark") {
|
} else if (theme() == "dark") {
|
||||||
stylefile.setFileName(":/styles/styles/nheko-dark.qss");
|
stylefile.setFileName(":/styles/styles/nheko-dark.qss");
|
||||||
pal.setColor(QPalette::Link, QColor("#d7d9dc"));
|
|
||||||
} else {
|
} else {
|
||||||
stylefile.setFileName(":/styles/styles/system.qss");
|
stylefile.setFileName(":/styles/styles/system.qss");
|
||||||
}
|
}
|
||||||
|
@ -81,7 +78,6 @@ UserSettings::applyTheme()
|
||||||
stylefile.open(QFile::ReadOnly);
|
stylefile.open(QFile::ReadOnly);
|
||||||
QString stylesheet = QString(stylefile.readAll());
|
QString stylesheet = QString(stylefile.readAll());
|
||||||
|
|
||||||
QApplication::setPalette(pal);
|
|
||||||
qobject_cast<QApplication *>(QApplication::instance())->setStyleSheet(stylesheet);
|
qobject_cast<QApplication *>(QApplication::instance())->setStyleSheet(stylesheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +141,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
trayToggle_ = new Toggle(this);
|
trayToggle_ = new Toggle(this);
|
||||||
|
|
||||||
trayOptionLayout_->addWidget(trayLabel);
|
trayOptionLayout_->addWidget(trayLabel);
|
||||||
trayOptionLayout_->addWidget(trayToggle_, 0, Qt::AlignBottom | Qt::AlignRight);
|
trayOptionLayout_->addWidget(trayToggle_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
auto startInTrayOptionLayout_ = new QHBoxLayout;
|
auto startInTrayOptionLayout_ = new QHBoxLayout;
|
||||||
startInTrayOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
startInTrayOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
|
@ -156,8 +152,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
startInTrayToggle_->setDisabled(true);
|
startInTrayToggle_->setDisabled(true);
|
||||||
|
|
||||||
startInTrayOptionLayout_->addWidget(startInTrayLabel);
|
startInTrayOptionLayout_->addWidget(startInTrayLabel);
|
||||||
startInTrayOptionLayout_->addWidget(
|
startInTrayOptionLayout_->addWidget(startInTrayToggle_, 0, Qt::AlignRight);
|
||||||
startInTrayToggle_, 0, Qt::AlignBottom | Qt::AlignRight);
|
|
||||||
|
|
||||||
auto orderRoomLayout = new QHBoxLayout;
|
auto orderRoomLayout = new QHBoxLayout;
|
||||||
orderRoomLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
orderRoomLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
|
@ -166,7 +161,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
roomOrderToggle_ = new Toggle(this);
|
roomOrderToggle_ = new Toggle(this);
|
||||||
|
|
||||||
orderRoomLayout->addWidget(orderLabel);
|
orderRoomLayout->addWidget(orderLabel);
|
||||||
orderRoomLayout->addWidget(roomOrderToggle_, 0, Qt::AlignBottom | Qt::AlignRight);
|
orderRoomLayout->addWidget(roomOrderToggle_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
auto groupViewLayout = new QHBoxLayout;
|
auto groupViewLayout = new QHBoxLayout;
|
||||||
groupViewLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
groupViewLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
|
@ -175,7 +170,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
groupViewToggle_ = new Toggle(this);
|
groupViewToggle_ = new Toggle(this);
|
||||||
|
|
||||||
groupViewLayout->addWidget(groupViewLabel);
|
groupViewLayout->addWidget(groupViewLabel);
|
||||||
groupViewLayout->addWidget(groupViewToggle_, 0, Qt::AlignBottom | Qt::AlignRight);
|
groupViewLayout->addWidget(groupViewToggle_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
auto typingLayout = new QHBoxLayout;
|
auto typingLayout = new QHBoxLayout;
|
||||||
typingLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
typingLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
|
@ -184,7 +179,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
typingNotifications_ = new Toggle(this);
|
typingNotifications_ = new Toggle(this);
|
||||||
|
|
||||||
typingLayout->addWidget(typingLabel);
|
typingLayout->addWidget(typingLabel);
|
||||||
typingLayout->addWidget(typingNotifications_, 0, Qt::AlignBottom | Qt::AlignRight);
|
typingLayout->addWidget(typingNotifications_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
auto receiptsLayout = new QHBoxLayout;
|
auto receiptsLayout = new QHBoxLayout;
|
||||||
receiptsLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
receiptsLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
|
@ -193,7 +188,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
readReceipts_ = new Toggle(this);
|
readReceipts_ = new Toggle(this);
|
||||||
|
|
||||||
receiptsLayout->addWidget(receiptsLabel);
|
receiptsLayout->addWidget(receiptsLabel);
|
||||||
receiptsLayout->addWidget(readReceipts_, 0, Qt::AlignBottom | Qt::AlignRight);
|
receiptsLayout->addWidget(readReceipts_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
auto desktopLayout = new QHBoxLayout;
|
auto desktopLayout = new QHBoxLayout;
|
||||||
desktopLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
desktopLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
|
@ -202,7 +197,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
desktopNotifications_ = new Toggle(this);
|
desktopNotifications_ = new Toggle(this);
|
||||||
|
|
||||||
desktopLayout->addWidget(desktopLabel);
|
desktopLayout->addWidget(desktopLabel);
|
||||||
desktopLayout->addWidget(desktopNotifications_, 0, Qt::AlignBottom | Qt::AlignRight);
|
desktopLayout->addWidget(desktopNotifications_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
auto scaleFactorOptionLayout = new QHBoxLayout;
|
auto scaleFactorOptionLayout = new QHBoxLayout;
|
||||||
scaleFactorOptionLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
scaleFactorOptionLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
|
@ -220,7 +215,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
scaleFactorCombo_->addItem("3");
|
scaleFactorCombo_->addItem("3");
|
||||||
|
|
||||||
scaleFactorOptionLayout->addWidget(scaleFactorLabel);
|
scaleFactorOptionLayout->addWidget(scaleFactorLabel);
|
||||||
scaleFactorOptionLayout->addWidget(scaleFactorCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
|
scaleFactorOptionLayout->addWidget(scaleFactorCombo_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
auto themeOptionLayout_ = new QHBoxLayout;
|
auto themeOptionLayout_ = new QHBoxLayout;
|
||||||
themeOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
themeOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
|
@ -232,15 +227,15 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
themeCombo_->addItem("System");
|
themeCombo_->addItem("System");
|
||||||
|
|
||||||
themeOptionLayout_->addWidget(themeLabel_);
|
themeOptionLayout_->addWidget(themeLabel_);
|
||||||
themeOptionLayout_->addWidget(themeCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
|
themeOptionLayout_->addWidget(themeCombo_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
auto encryptionLayout_ = new QVBoxLayout;
|
auto encryptionLayout_ = new QVBoxLayout;
|
||||||
encryptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
encryptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
encryptionLayout_->setAlignment(Qt::AlignVCenter | Qt::AlignBottom);
|
encryptionLayout_->setAlignment(Qt::AlignVCenter);
|
||||||
|
|
||||||
QFont monospaceFont = QFont(font);
|
QFont monospaceFont;
|
||||||
monospaceFont.setFamily("Courier New");
|
monospaceFont.setFamily("Monospace");
|
||||||
monospaceFont.setStyleHint(QFont::Courier);
|
monospaceFont.setStyleHint(QFont::Monospace);
|
||||||
monospaceFont.setPointSizeF(monospaceFont.pointSizeF() * 0.9);
|
monospaceFont.setPointSizeF(monospaceFont.pointSizeF() * 0.9);
|
||||||
|
|
||||||
auto deviceIdLayout = new QHBoxLayout;
|
auto deviceIdLayout = new QHBoxLayout;
|
||||||
|
@ -248,6 +243,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
|
|
||||||
auto deviceIdLabel = new QLabel(tr("Device ID"), this);
|
auto deviceIdLabel = new QLabel(tr("Device ID"), this);
|
||||||
deviceIdLabel->setFont(font);
|
deviceIdLabel->setFont(font);
|
||||||
|
deviceIdLabel->setMargin(0);
|
||||||
deviceIdValue_ = new QLabel{this};
|
deviceIdValue_ = new QLabel{this};
|
||||||
deviceIdValue_->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
deviceIdValue_->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
deviceIdValue_->setFont(monospaceFont);
|
deviceIdValue_->setFont(monospaceFont);
|
||||||
|
@ -259,6 +255,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
|
|
||||||
auto deviceFingerprintLabel = new QLabel(tr("Device Fingerprint"), this);
|
auto deviceFingerprintLabel = new QLabel(tr("Device Fingerprint"), this);
|
||||||
deviceFingerprintLabel->setFont(font);
|
deviceFingerprintLabel->setFont(font);
|
||||||
|
deviceFingerprintLabel->setMargin(0);
|
||||||
deviceFingerprintValue_ = new QLabel{this};
|
deviceFingerprintValue_ = new QLabel{this};
|
||||||
deviceFingerprintValue_->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
deviceFingerprintValue_->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
deviceFingerprintValue_->setFont(monospaceFont);
|
deviceFingerprintValue_->setFont(monospaceFont);
|
||||||
|
@ -271,18 +268,18 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
sessionKeysLabel->setFont(font);
|
sessionKeysLabel->setFont(font);
|
||||||
sessionKeysLayout->addWidget(sessionKeysLabel, 1);
|
sessionKeysLayout->addWidget(sessionKeysLabel, 1);
|
||||||
|
|
||||||
auto sessionKeysImportBtn = new FlatButton(tr("IMPORT"), this);
|
auto sessionKeysImportBtn = new QPushButton{tr("IMPORT"), this};
|
||||||
connect(
|
connect(
|
||||||
sessionKeysImportBtn, &QPushButton::clicked, this, &UserSettingsPage::importSessionKeys);
|
sessionKeysImportBtn, &QPushButton::clicked, this, &UserSettingsPage::importSessionKeys);
|
||||||
auto sessionKeysExportBtn = new FlatButton(tr("EXPORT"), this);
|
auto sessionKeysExportBtn = new QPushButton{tr("EXPORT"), this};
|
||||||
connect(
|
connect(
|
||||||
sessionKeysExportBtn, &QPushButton::clicked, this, &UserSettingsPage::exportSessionKeys);
|
sessionKeysExportBtn, &QPushButton::clicked, this, &UserSettingsPage::exportSessionKeys);
|
||||||
sessionKeysLayout->addWidget(sessionKeysExportBtn);
|
sessionKeysLayout->addWidget(sessionKeysExportBtn, 0, Qt::AlignRight);
|
||||||
sessionKeysLayout->addWidget(sessionKeysImportBtn);
|
sessionKeysLayout->addWidget(sessionKeysImportBtn, 0, Qt::AlignRight);
|
||||||
|
|
||||||
encryptionLayout_->addLayout(deviceIdLayout);
|
encryptionLayout_->addLayout(deviceIdLayout);
|
||||||
encryptionLayout_->addLayout(deviceFingerprintLayout);
|
encryptionLayout_->addLayout(deviceFingerprintLayout);
|
||||||
encryptionLayout_->addWidget(new HorizontalLine(this));
|
encryptionLayout_->addWidget(new HorizontalLine{this});
|
||||||
encryptionLayout_->addLayout(sessionKeysLayout);
|
encryptionLayout_->addLayout(sessionKeysLayout);
|
||||||
|
|
||||||
font.setWeight(65);
|
font.setWeight(65);
|
||||||
|
@ -493,8 +490,10 @@ UserSettingsPage::importSessionKeys()
|
||||||
QLineEdit::Password,
|
QLineEdit::Password,
|
||||||
"",
|
"",
|
||||||
&ok);
|
&ok);
|
||||||
|
if (!ok)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!ok || password.isEmpty()) {
|
if (password.isEmpty()) {
|
||||||
QMessageBox::warning(this, tr("Error"), tr("The password cannot be empty"));
|
QMessageBox::warning(this, tr("Error"), tr("The password cannot be empty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -523,8 +522,10 @@ UserSettingsPage::exportSessionKeys()
|
||||||
QLineEdit::Password,
|
QLineEdit::Password,
|
||||||
"",
|
"",
|
||||||
&ok);
|
&ok);
|
||||||
|
if (!ok)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!ok || password.isEmpty()) {
|
if (password.isEmpty()) {
|
||||||
QMessageBox::warning(this, tr("Error"), tr("The password cannot be empty"));
|
QMessageBox::warning(this, tr("Error"), tr("The password cannot be empty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,3 +370,17 @@ utils::markdownToHtml(const QString &text)
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
utils::linkColor()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
const auto theme = settings.value("user/theme", "light").toString();
|
||||||
|
|
||||||
|
if (theme == "light")
|
||||||
|
return "#0077b5";
|
||||||
|
else if (theme == "dark")
|
||||||
|
return "#38A3D8";
|
||||||
|
|
||||||
|
return QPalette().color(QPalette::Link).name();
|
||||||
|
}
|
||||||
|
|
|
@ -220,4 +220,7 @@ linkifyMessage(const QString &body);
|
||||||
//! Convert the input markdown text to html.
|
//! Convert the input markdown text to html.
|
||||||
QString
|
QString
|
||||||
markdownToHtml(const QString &text);
|
markdownToHtml(const QString &text);
|
||||||
|
|
||||||
|
QString
|
||||||
|
linkColor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QStyleOption>
|
#include <QPushButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "dialogs/CreateRoom.h"
|
#include "dialogs/CreateRoom.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ui/FlatButton.h"
|
|
||||||
#include "ui/TextField.h"
|
#include "ui/TextField.h"
|
||||||
#include "ui/Theme.h"
|
#include "ui/Theme.h"
|
||||||
#include "ui/ToggleButton.h"
|
#include "ui/ToggleButton.h"
|
||||||
|
@ -16,6 +15,11 @@ using namespace dialogs;
|
||||||
CreateRoom::CreateRoom(QWidget *parent)
|
CreateRoom::CreateRoom(QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont doubleFont;
|
||||||
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
||||||
|
|
||||||
|
@ -29,21 +33,15 @@ CreateRoom::CreateRoom(QWidget *parent)
|
||||||
layout->setMargin(conf::modals::WIDGET_MARGIN);
|
layout->setMargin(conf::modals::WIDGET_MARGIN);
|
||||||
|
|
||||||
auto buttonLayout = new QHBoxLayout();
|
auto buttonLayout = new QHBoxLayout();
|
||||||
buttonLayout->setSpacing(0);
|
buttonLayout->setSpacing(15);
|
||||||
buttonLayout->setMargin(0);
|
|
||||||
|
|
||||||
QFont buttonFont;
|
confirmBtn_ = new QPushButton(tr("Create room"), this);
|
||||||
buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
|
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
||||||
|
cancelBtn_->setDefault(true);
|
||||||
confirmBtn_ = new FlatButton("CREATE", this);
|
|
||||||
confirmBtn_->setFont(buttonFont);
|
|
||||||
|
|
||||||
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
|
|
||||||
cancelBtn_->setFont(buttonFont);
|
|
||||||
|
|
||||||
buttonLayout->addStretch(1);
|
buttonLayout->addStretch(1);
|
||||||
buttonLayout->addWidget(confirmBtn_);
|
|
||||||
buttonLayout->addWidget(cancelBtn_);
|
buttonLayout->addWidget(cancelBtn_);
|
||||||
|
buttonLayout->addWidget(confirmBtn_);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(conf::headerFontSize);
|
font.setPixelSize(conf::headerFontSize);
|
||||||
|
@ -104,15 +102,14 @@ CreateRoom::CreateRoom(QWidget *parent)
|
||||||
request_.topic = topicInput_->text().toStdString();
|
request_.topic = topicInput_->text().toStdString();
|
||||||
request_.room_alias_name = aliasInput_->text().toStdString();
|
request_.room_alias_name = aliasInput_->text().toStdString();
|
||||||
|
|
||||||
emit closing(true, request_);
|
emit createRoom(request_);
|
||||||
|
|
||||||
clearFields();
|
clearFields();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(cancelBtn_, &QPushButton::clicked, this, [this]() {
|
connect(cancelBtn_, &QPushButton::clicked, this, [this]() {
|
||||||
emit closing(false, request_);
|
|
||||||
|
|
||||||
clearFields();
|
clearFields();
|
||||||
|
emit close();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(visibilityCombo_,
|
connect(visibilityCombo_,
|
||||||
|
@ -150,15 +147,6 @@ CreateRoom::clearFields()
|
||||||
aliasInput_->clear();
|
aliasInput_->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
CreateRoom::paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CreateRoom::showEvent(QShowEvent *event)
|
CreateRoom::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <mtx.hpp>
|
#include <mtx.hpp>
|
||||||
|
|
||||||
class FlatButton;
|
class QPushButton;
|
||||||
class TextField;
|
class TextField;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class Toggle;
|
class Toggle;
|
||||||
|
@ -18,10 +18,9 @@ public:
|
||||||
CreateRoom(QWidget *parent = nullptr);
|
CreateRoom(QWidget *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closing(bool isCreating, const mtx::requests::CreateRoom &request);
|
void createRoom(const mtx::requests::CreateRoom &request);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -32,8 +31,8 @@ private:
|
||||||
|
|
||||||
Toggle *directToggle_;
|
Toggle *directToggle_;
|
||||||
|
|
||||||
FlatButton *confirmBtn_;
|
QPushButton *confirmBtn_;
|
||||||
FlatButton *cancelBtn_;
|
QPushButton *cancelBtn_;
|
||||||
|
|
||||||
TextField *nameInput_;
|
TextField *nameInput_;
|
||||||
TextField *topicInput_;
|
TextField *topicInput_;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
@ -10,7 +11,6 @@
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "InviteeItem.h"
|
#include "InviteeItem.h"
|
||||||
#include "ui/FlatButton.h"
|
|
||||||
#include "ui/TextField.h"
|
#include "ui/TextField.h"
|
||||||
|
|
||||||
#include "mtx.hpp"
|
#include "mtx.hpp"
|
||||||
|
@ -20,6 +20,11 @@ using namespace dialogs;
|
||||||
InviteUsers::InviteUsers(QWidget *parent)
|
InviteUsers::InviteUsers(QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
|
@ -31,18 +36,14 @@ InviteUsers::InviteUsers(QWidget *parent)
|
||||||
buttonLayout->setSpacing(0);
|
buttonLayout->setSpacing(0);
|
||||||
buttonLayout->setMargin(0);
|
buttonLayout->setMargin(0);
|
||||||
|
|
||||||
QFont buttonFont;
|
confirmBtn_ = new QPushButton("Invite", this);
|
||||||
buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
|
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
||||||
|
cancelBtn_->setDefault(true);
|
||||||
confirmBtn_ = new FlatButton("INVITE", this);
|
|
||||||
confirmBtn_->setFont(buttonFont);
|
|
||||||
|
|
||||||
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
|
|
||||||
cancelBtn_->setFont(buttonFont);
|
|
||||||
|
|
||||||
buttonLayout->addStretch(1);
|
buttonLayout->addStretch(1);
|
||||||
buttonLayout->addWidget(confirmBtn_);
|
buttonLayout->setSpacing(15);
|
||||||
buttonLayout->addWidget(cancelBtn_);
|
buttonLayout->addWidget(cancelBtn_);
|
||||||
|
buttonLayout->addWidget(confirmBtn_);
|
||||||
|
|
||||||
inviteeInput_ = new TextField(this);
|
inviteeInput_ = new TextField(this);
|
||||||
inviteeInput_->setLabel(tr("User ID to invite"));
|
inviteeInput_->setLabel(tr("User ID to invite"));
|
||||||
|
@ -63,7 +64,7 @@ InviteUsers::InviteUsers(QWidget *parent)
|
||||||
|
|
||||||
connect(inviteeInput_, &TextField::returnPressed, this, &InviteUsers::addUser);
|
connect(inviteeInput_, &TextField::returnPressed, this, &InviteUsers::addUser);
|
||||||
connect(confirmBtn_, &QPushButton::clicked, [this]() {
|
connect(confirmBtn_, &QPushButton::clicked, [this]() {
|
||||||
emit closing(true, invitedUsers());
|
emit sendInvites(invitedUsers());
|
||||||
|
|
||||||
inviteeInput_->clear();
|
inviteeInput_->clear();
|
||||||
inviteeList_->clear();
|
inviteeList_->clear();
|
||||||
|
@ -71,12 +72,11 @@ InviteUsers::InviteUsers(QWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(cancelBtn_, &QPushButton::clicked, [this]() {
|
connect(cancelBtn_, &QPushButton::clicked, [this]() {
|
||||||
QStringList emptyList;
|
|
||||||
emit closing(false, emptyList);
|
|
||||||
|
|
||||||
inviteeInput_->clear();
|
inviteeInput_->clear();
|
||||||
inviteeList_->clear();
|
inviteeList_->clear();
|
||||||
errorLabel_->hide();
|
errorLabel_->hide();
|
||||||
|
|
||||||
|
emit close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,15 +119,6 @@ InviteUsers::removeInvitee(QListWidgetItem *item)
|
||||||
inviteeList_->removeItemWidget(widget);
|
inviteeList_->removeItemWidget(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
InviteUsers::paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList
|
QStringList
|
||||||
InviteUsers::invitedUsers() const
|
InviteUsers::invitedUsers() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
class FlatButton;
|
class QPushButton;
|
||||||
class TextField;
|
class TextField;
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
|
|
||||||
|
@ -18,11 +18,10 @@ public:
|
||||||
explicit InviteUsers(QWidget *parent = nullptr);
|
explicit InviteUsers(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closing(bool isLeaving, QStringList invitees);
|
void sendInvites(QStringList invitees);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void removeInvitee(QListWidgetItem *item);
|
void removeInvitee(QListWidgetItem *item);
|
||||||
|
@ -31,8 +30,8 @@ private:
|
||||||
void addUser();
|
void addUser();
|
||||||
QStringList invitedUsers() const;
|
QStringList invitedUsers() const;
|
||||||
|
|
||||||
FlatButton *confirmBtn_;
|
QPushButton *confirmBtn_;
|
||||||
FlatButton *cancelBtn_;
|
QPushButton *cancelBtn_;
|
||||||
|
|
||||||
TextField *inviteeInput_;
|
TextField *inviteeInput_;
|
||||||
QLabel *errorLabel_;
|
QLabel *errorLabel_;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "dialogs/JoinRoom.h"
|
#include "dialogs/JoinRoom.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ui/FlatButton.h"
|
|
||||||
#include "ui/TextField.h"
|
#include "ui/TextField.h"
|
||||||
#include "ui/Theme.h"
|
#include "ui/Theme.h"
|
||||||
|
|
||||||
|
@ -14,6 +14,11 @@ using namespace dialogs;
|
||||||
JoinRoom::JoinRoom(QWidget *parent)
|
JoinRoom::JoinRoom(QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
|
@ -22,21 +27,15 @@ JoinRoom::JoinRoom(QWidget *parent)
|
||||||
layout->setMargin(conf::modals::WIDGET_MARGIN);
|
layout->setMargin(conf::modals::WIDGET_MARGIN);
|
||||||
|
|
||||||
auto buttonLayout = new QHBoxLayout();
|
auto buttonLayout = new QHBoxLayout();
|
||||||
buttonLayout->setSpacing(0);
|
buttonLayout->setSpacing(15);
|
||||||
buttonLayout->setMargin(0);
|
|
||||||
|
|
||||||
QFont buttonFont;
|
confirmBtn_ = new QPushButton(tr("Join"), this);
|
||||||
buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
|
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
||||||
|
cancelBtn_->setDefault(true);
|
||||||
confirmBtn_ = new FlatButton("JOIN", this);
|
|
||||||
confirmBtn_->setFont(buttonFont);
|
|
||||||
|
|
||||||
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
|
|
||||||
cancelBtn_->setFont(buttonFont);
|
|
||||||
|
|
||||||
buttonLayout->addStretch(1);
|
buttonLayout->addStretch(1);
|
||||||
buttonLayout->addWidget(confirmBtn_);
|
|
||||||
buttonLayout->addWidget(cancelBtn_);
|
buttonLayout->addWidget(cancelBtn_);
|
||||||
|
buttonLayout->addWidget(confirmBtn_);
|
||||||
|
|
||||||
roomInput_ = new TextField(this);
|
roomInput_ = new TextField(this);
|
||||||
roomInput_->setLabel(tr("Room ID or alias"));
|
roomInput_->setLabel(tr("Room ID or alias"));
|
||||||
|
@ -47,7 +46,7 @@ JoinRoom::JoinRoom(QWidget *parent)
|
||||||
|
|
||||||
connect(roomInput_, &QLineEdit::returnPressed, this, &JoinRoom::handleInput);
|
connect(roomInput_, &QLineEdit::returnPressed, this, &JoinRoom::handleInput);
|
||||||
connect(confirmBtn_, &QPushButton::clicked, this, &JoinRoom::handleInput);
|
connect(confirmBtn_, &QPushButton::clicked, this, &JoinRoom::handleInput);
|
||||||
connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false, ""); });
|
connect(cancelBtn_, &QPushButton::clicked, this, &JoinRoom::close);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -57,19 +56,10 @@ JoinRoom::handleInput()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: input validation with error messages.
|
// TODO: input validation with error messages.
|
||||||
emit closing(true, roomInput_->text());
|
emit joinRoom(roomInput_->text());
|
||||||
roomInput_->clear();
|
roomInput_->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
JoinRoom::paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JoinRoom::showEvent(QShowEvent *event)
|
JoinRoom::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
class FlatButton;
|
class QPushButton;
|
||||||
class TextField;
|
class TextField;
|
||||||
|
|
||||||
namespace dialogs {
|
namespace dialogs {
|
||||||
|
@ -14,18 +14,17 @@ public:
|
||||||
JoinRoom(QWidget *parent = nullptr);
|
JoinRoom(QWidget *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closing(bool isJoining, const QString &room);
|
void joinRoom(const QString &room);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleInput();
|
void handleInput();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FlatButton *confirmBtn_;
|
QPushButton *confirmBtn_;
|
||||||
FlatButton *cancelBtn_;
|
QPushButton *cancelBtn_;
|
||||||
|
|
||||||
TextField *roomInput_;
|
TextField *roomInput_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "dialogs/LeaveRoom.h"
|
#include "dialogs/LeaveRoom.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ui/FlatButton.h"
|
|
||||||
#include "ui/Theme.h"
|
#include "ui/Theme.h"
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
@ -13,6 +13,11 @@ using namespace dialogs;
|
||||||
LeaveRoom::LeaveRoom(QWidget *parent)
|
LeaveRoom::LeaveRoom(QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
|
@ -24,37 +29,20 @@ LeaveRoom::LeaveRoom(QWidget *parent)
|
||||||
buttonLayout->setSpacing(0);
|
buttonLayout->setSpacing(0);
|
||||||
buttonLayout->setMargin(0);
|
buttonLayout->setMargin(0);
|
||||||
|
|
||||||
QFont buttonFont;
|
confirmBtn_ = new QPushButton("Leave", this);
|
||||||
buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
|
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
||||||
|
cancelBtn_->setDefault(true);
|
||||||
confirmBtn_ = new FlatButton("LEAVE", this);
|
|
||||||
confirmBtn_->setFont(buttonFont);
|
|
||||||
|
|
||||||
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
|
|
||||||
cancelBtn_->setFont(buttonFont);
|
|
||||||
|
|
||||||
buttonLayout->addStretch(1);
|
buttonLayout->addStretch(1);
|
||||||
buttonLayout->addWidget(confirmBtn_);
|
buttonLayout->setSpacing(15);
|
||||||
buttonLayout->addWidget(cancelBtn_);
|
buttonLayout->addWidget(cancelBtn_);
|
||||||
|
buttonLayout->addWidget(confirmBtn_);
|
||||||
QFont font;
|
|
||||||
font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);
|
|
||||||
|
|
||||||
auto label = new QLabel(tr("Are you sure you want to leave?"), this);
|
auto label = new QLabel(tr("Are you sure you want to leave?"), this);
|
||||||
label->setFont(font);
|
|
||||||
|
|
||||||
layout->addWidget(label);
|
layout->addWidget(label);
|
||||||
layout->addLayout(buttonLayout);
|
layout->addLayout(buttonLayout);
|
||||||
|
|
||||||
connect(confirmBtn_, &QPushButton::clicked, [this]() { emit closing(true); });
|
connect(confirmBtn_, &QPushButton::clicked, this, &LeaveRoom::leaving);
|
||||||
connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false); });
|
connect(cancelBtn_, &QPushButton::clicked, this, &LeaveRoom::close);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
LeaveRoom::paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
class FlatButton;
|
class QPushButton;
|
||||||
|
|
||||||
namespace dialogs {
|
namespace dialogs {
|
||||||
|
|
||||||
|
@ -12,14 +12,11 @@ class LeaveRoom : public QFrame
|
||||||
public:
|
public:
|
||||||
explicit LeaveRoom(QWidget *parent = nullptr);
|
explicit LeaveRoom(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closing(bool isLeaving);
|
void leaving();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FlatButton *confirmBtn_;
|
QPushButton *confirmBtn_;
|
||||||
FlatButton *cancelBtn_;
|
QPushButton *cancelBtn_;
|
||||||
};
|
};
|
||||||
} // dialogs
|
} // dialogs
|
||||||
|
|
|
@ -17,13 +17,14 @@
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "dialogs/Logout.h"
|
#include "dialogs/Logout.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ui/FlatButton.h"
|
|
||||||
#include "ui/Theme.h"
|
#include "ui/Theme.h"
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
@ -31,6 +32,11 @@ using namespace dialogs;
|
||||||
Logout::Logout(QWidget *parent)
|
Logout::Logout(QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
|
@ -42,40 +48,21 @@ Logout::Logout(QWidget *parent)
|
||||||
buttonLayout->setSpacing(0);
|
buttonLayout->setSpacing(0);
|
||||||
buttonLayout->setMargin(0);
|
buttonLayout->setMargin(0);
|
||||||
|
|
||||||
QFont buttonFont;
|
confirmBtn_ = new QPushButton("Logout", this);
|
||||||
buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
|
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
||||||
|
cancelBtn_->setDefault(true);
|
||||||
confirmBtn_ = new FlatButton("OK", this);
|
|
||||||
confirmBtn_->setFont(buttonFont);
|
|
||||||
confirmBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
|
|
||||||
|
|
||||||
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
|
|
||||||
cancelBtn_->setFont(buttonFont);
|
|
||||||
cancelBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
|
|
||||||
|
|
||||||
buttonLayout->addStretch(1);
|
buttonLayout->addStretch(1);
|
||||||
buttonLayout->addWidget(confirmBtn_);
|
buttonLayout->setSpacing(15);
|
||||||
buttonLayout->addWidget(cancelBtn_);
|
buttonLayout->addWidget(cancelBtn_);
|
||||||
|
buttonLayout->addWidget(confirmBtn_);
|
||||||
QFont font;
|
|
||||||
font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);
|
|
||||||
|
|
||||||
auto label = new QLabel(tr("Logout. Are you sure?"), this);
|
auto label = new QLabel(tr("Logout. Are you sure?"), this);
|
||||||
label->setFont(font);
|
|
||||||
|
|
||||||
layout->addWidget(label);
|
layout->addWidget(label);
|
||||||
layout->addLayout(buttonLayout);
|
layout->addLayout(buttonLayout);
|
||||||
layout->addStretch(1);
|
layout->addStretch(1);
|
||||||
|
|
||||||
connect(confirmBtn_, &QPushButton::clicked, [this]() { emit closing(true); });
|
connect(confirmBtn_, &QPushButton::clicked, this, &Logout::loggingOut);
|
||||||
connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false); });
|
connect(cancelBtn_, &QPushButton::clicked, this, &Logout::close);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Logout::paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
class FlatButton;
|
class QPushButton;
|
||||||
|
|
||||||
namespace dialogs {
|
namespace dialogs {
|
||||||
|
|
||||||
|
@ -29,14 +29,11 @@ class Logout : public QFrame
|
||||||
public:
|
public:
|
||||||
explicit Logout(QWidget *parent = nullptr);
|
explicit Logout(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closing(bool isLoggingOut);
|
void loggingOut();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FlatButton *confirmBtn_;
|
QPushButton *confirmBtn_;
|
||||||
FlatButton *cancelBtn_;
|
QPushButton *cancelBtn_;
|
||||||
};
|
};
|
||||||
} // dialogs
|
} // dialogs
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QShortcut>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
@ -11,7 +13,6 @@
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "ui/Avatar.h"
|
#include "ui/Avatar.h"
|
||||||
#include "ui/FlatButton.h"
|
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
|
||||||
|
@ -51,10 +52,22 @@ MemberItem::MemberItem(const RoomMember &member, QWidget *parent)
|
||||||
topLayout_->addLayout(textLayout_, 1);
|
topLayout_->addLayout(textLayout_, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MemberItem::paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
QStyleOption opt;
|
||||||
|
opt.init(this);
|
||||||
|
QPainter p(this);
|
||||||
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
}
|
||||||
|
|
||||||
MemberList::MemberList(const QString &room_id, QWidget *parent)
|
MemberList::MemberList(const QString &room_id, QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
, room_id_{room_id}
|
, room_id_{room_id}
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
|
@ -64,7 +77,6 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
|
||||||
list_ = new QListWidget;
|
list_ = new QListWidget;
|
||||||
list_->setFrameStyle(QFrame::NoFrame);
|
list_->setFrameStyle(QFrame::NoFrame);
|
||||||
list_->setSelectionMode(QAbstractItemView::NoSelection);
|
list_->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
list_->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
|
||||||
list_->setSpacing(5);
|
list_->setSpacing(5);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont doubleFont;
|
||||||
|
@ -89,7 +101,8 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
|
||||||
list_->clear();
|
list_->clear();
|
||||||
|
|
||||||
// Add button at the bottom.
|
// Add button at the bottom.
|
||||||
moreBtn_ = new FlatButton(tr("SHOW MORE"), this);
|
moreBtn_ = new QPushButton(tr("Show more"), this);
|
||||||
|
moreBtn_->setFlat(true);
|
||||||
auto item = new QListWidgetItem;
|
auto item = new QListWidgetItem;
|
||||||
item->setSizeHint(moreBtn_->minimumSizeHint());
|
item->setSizeHint(moreBtn_->minimumSizeHint());
|
||||||
item->setFlags(Qt::NoItemFlags);
|
item->setFlags(Qt::NoItemFlags);
|
||||||
|
@ -97,7 +110,7 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
|
||||||
list_->insertItem(0, item);
|
list_->insertItem(0, item);
|
||||||
list_->setItemWidget(item, moreBtn_);
|
list_->setItemWidget(item, moreBtn_);
|
||||||
|
|
||||||
connect(moreBtn_, &FlatButton::clicked, this, [this]() {
|
connect(moreBtn_, &QPushButton::clicked, this, [this]() {
|
||||||
const size_t numMembers = list_->count() - 1;
|
const size_t numMembers = list_->count() - 1;
|
||||||
|
|
||||||
if (numMembers > 0)
|
if (numMembers > 0)
|
||||||
|
@ -109,6 +122,9 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
|
||||||
} catch (const lmdb::error &e) {
|
} catch (const lmdb::error &e) {
|
||||||
qCritical() << e.what();
|
qCritical() << e.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this);
|
||||||
|
connect(closeShortcut, &QShortcut::activated, this, &MemberList::close);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -143,12 +159,3 @@ MemberList::addUsers(const std::vector<RoomMember> &members)
|
||||||
list_->setItemWidget(item, user);
|
list_->setItemWidget(item, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MemberList::paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
|
||||||
class Avatar;
|
class Avatar;
|
||||||
class FlatButton;
|
class QPushButton;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
@ -23,6 +23,9 @@ class MemberItem : public QWidget
|
||||||
public:
|
public:
|
||||||
MemberItem(const RoomMember &member, QWidget *parent);
|
MemberItem(const RoomMember &member, QWidget *parent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHBoxLayout *topLayout_;
|
QHBoxLayout *topLayout_;
|
||||||
QVBoxLayout *textLayout_;
|
QVBoxLayout *textLayout_;
|
||||||
|
@ -43,7 +46,6 @@ public slots:
|
||||||
void addUsers(const std::vector<RoomMember> &users);
|
void addUsers(const std::vector<RoomMember> &users);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
void hideEvent(QHideEvent *event) override
|
void hideEvent(QHideEvent *event) override
|
||||||
{
|
{
|
||||||
list_->clear();
|
list_->clear();
|
||||||
|
@ -56,6 +58,6 @@ private:
|
||||||
QString room_id_;
|
QString room_id_;
|
||||||
QLabel *topLabel_;
|
QLabel *topLabel_;
|
||||||
QListWidget *list_;
|
QListWidget *list_;
|
||||||
FlatButton *moreBtn_;
|
QPushButton *moreBtn_;
|
||||||
};
|
};
|
||||||
} // dialogs
|
} // dialogs
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QShortcut>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
@ -60,6 +61,15 @@ ReceiptItem::ReceiptItem(QWidget *parent,
|
||||||
[this](const QImage &img) { avatar_->setImage(img); });
|
[this](const QImage &img) { avatar_->setImage(img); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ReceiptItem::paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
QStyleOption opt;
|
||||||
|
opt.init(this);
|
||||||
|
QPainter p(this);
|
||||||
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
ReceiptItem::dateFormat(const QDateTime &then) const
|
ReceiptItem::dateFormat(const QDateTime &then) const
|
||||||
{
|
{
|
||||||
|
@ -79,6 +89,11 @@ ReceiptItem::dateFormat(const QDateTime &then) const
|
||||||
ReadReceipts::ReadReceipts(QWidget *parent)
|
ReadReceipts::ReadReceipts(QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
layout->setSpacing(conf::modals::WIDGET_SPACING);
|
layout->setSpacing(conf::modals::WIDGET_SPACING);
|
||||||
layout->setMargin(conf::modals::WIDGET_MARGIN);
|
layout->setMargin(conf::modals::WIDGET_MARGIN);
|
||||||
|
@ -86,7 +101,6 @@ ReadReceipts::ReadReceipts(QWidget *parent)
|
||||||
userList_ = new QListWidget;
|
userList_ = new QListWidget;
|
||||||
userList_->setFrameStyle(QFrame::NoFrame);
|
userList_->setFrameStyle(QFrame::NoFrame);
|
||||||
userList_->setSelectionMode(QAbstractItemView::NoSelection);
|
userList_->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
userList_->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
|
||||||
userList_->setSpacing(conf::modals::TEXT_SPACING);
|
userList_->setSpacing(conf::modals::TEXT_SPACING);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont doubleFont;
|
||||||
|
@ -107,6 +121,9 @@ ReadReceipts::ReadReceipts(QWidget *parent)
|
||||||
|
|
||||||
layout->addWidget(topLabel_);
|
layout->addWidget(topLabel_);
|
||||||
layout->addWidget(userList_);
|
layout->addWidget(userList_);
|
||||||
|
|
||||||
|
auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this);
|
||||||
|
connect(closeShortcut, &QShortcut::activated, this, &ReadReceipts::close);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -21,6 +21,9 @@ public:
|
||||||
uint64_t timestamp,
|
uint64_t timestamp,
|
||||||
const QString &room_id);
|
const QString &room_id);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString dateFormat(const QDateTime &then) const;
|
QString dateFormat(const QDateTime &then) const;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <QMimeDatabase>
|
#include <QMimeDatabase>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QShortcut>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
@ -54,24 +56,15 @@ EditModal::EditModal(const QString &roomId, QWidget *parent)
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QFont buttonFont;
|
applyBtn_ = new QPushButton(tr("Apply"), this);
|
||||||
buttonFont.setPointSizeF(buttonFont.pointSizeF() * 1.3);
|
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
||||||
|
cancelBtn_->setDefault(true);
|
||||||
applyBtn_ = new FlatButton(tr("APPLY"), this);
|
|
||||||
applyBtn_->setFont(buttonFont);
|
|
||||||
applyBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
|
|
||||||
applyBtn_->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
|
||||||
|
|
||||||
cancelBtn_ = new FlatButton(tr("CANCEL"), this);
|
|
||||||
cancelBtn_->setFont(buttonFont);
|
|
||||||
cancelBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
|
|
||||||
cancelBtn_->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
|
||||||
|
|
||||||
auto btnLayout = new QHBoxLayout;
|
auto btnLayout = new QHBoxLayout;
|
||||||
btnLayout->setMargin(5);
|
|
||||||
btnLayout->addStretch(1);
|
btnLayout->addStretch(1);
|
||||||
btnLayout->addWidget(applyBtn_);
|
btnLayout->setSpacing(15);
|
||||||
btnLayout->addWidget(cancelBtn_);
|
btnLayout->addWidget(cancelBtn_);
|
||||||
|
btnLayout->addWidget(applyBtn_);
|
||||||
|
|
||||||
nameInput_ = new TextField(this);
|
nameInput_ = new TextField(this);
|
||||||
nameInput_->setLabel(tr("Name").toUpper());
|
nameInput_->setLabel(tr("Name").toUpper());
|
||||||
|
@ -172,6 +165,11 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
|
||||||
{
|
{
|
||||||
retrieveRoomInfo();
|
retrieveRoomInfo();
|
||||||
|
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont doubleFont;
|
||||||
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
||||||
|
|
||||||
|
@ -422,6 +420,9 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
|
||||||
stopLoadingSpinner();
|
stopLoadingSpinner();
|
||||||
resetErrorLabel();
|
resetErrorLabel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this);
|
||||||
|
connect(closeShortcut, &QShortcut::activated, this, &RoomSettings::close);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -446,9 +447,10 @@ RoomSettings::setupEditButton()
|
||||||
connect(editFieldsBtn_, &QPushButton::clicked, this, [this]() {
|
connect(editFieldsBtn_, &QPushButton::clicked, this, [this]() {
|
||||||
retrieveRoomInfo();
|
retrieveRoomInfo();
|
||||||
|
|
||||||
auto modal = new EditModal(room_id_, this->parentWidget());
|
auto modal = new EditModal(room_id_, this);
|
||||||
modal->setFields(QString::fromStdString(info_.name),
|
modal->setFields(QString::fromStdString(info_.name),
|
||||||
QString::fromStdString(info_.topic));
|
QString::fromStdString(info_.topic));
|
||||||
|
modal->raise();
|
||||||
modal->show();
|
modal->show();
|
||||||
connect(modal, &EditModal::nameChanged, this, [this](const QString &newName) {
|
connect(modal, &EditModal::nameChanged, this, [this](const QString &newName) {
|
||||||
if (roomNameLabel_)
|
if (roomNameLabel_)
|
||||||
|
@ -505,15 +507,6 @@ RoomSettings::showEvent(QShowEvent *event)
|
||||||
QWidget::showEvent(event);
|
QWidget::showEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
RoomSettings::paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RoomSettings::canChangeJoinRules(const std::string &room_id, const std::string &user_id) const
|
RoomSettings::canChangeJoinRules(const std::string &room_id, const std::string &user_id) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
class Avatar;
|
class Avatar;
|
||||||
class FlatButton;
|
class FlatButton;
|
||||||
|
class QPushButton;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class QShowEvent;
|
class QShowEvent;
|
||||||
|
@ -100,8 +101,8 @@ private:
|
||||||
TextField *nameInput_;
|
TextField *nameInput_;
|
||||||
TextField *topicInput_;
|
TextField *topicInput_;
|
||||||
|
|
||||||
FlatButton *applyBtn_;
|
QPushButton *applyBtn_;
|
||||||
FlatButton *cancelBtn_;
|
QPushButton *cancelBtn_;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace dialogs {
|
namespace dialogs {
|
||||||
|
@ -113,13 +114,11 @@ public:
|
||||||
RoomSettings(const QString &room_id, QWidget *parent = nullptr);
|
RoomSettings(const QString &room_id, QWidget *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closing();
|
|
||||||
void enableEncryptionError(const QString &msg);
|
void enableEncryptionError(const QString &msg);
|
||||||
void showErrorMessage(const QString &msg);
|
void showErrorMessage(const QString &msg);
|
||||||
void accessRulesUpdated();
|
void accessRulesUpdated();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QShortcut>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
@ -48,6 +49,11 @@ DeviceItem::DeviceItem(DeviceInfo device, QWidget *parent)
|
||||||
UserProfile::UserProfile(QWidget *parent)
|
UserProfile::UserProfile(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
QIcon banIcon, kickIcon, ignoreIcon, startChatIcon;
|
QIcon banIcon, kickIcon, ignoreIcon, startChatIcon;
|
||||||
|
|
||||||
banIcon.addFile(":/icons/icons/ui/do-not-disturb-rounded-sign.png");
|
banIcon.addFile(":/icons/icons/ui/do-not-disturb-rounded-sign.png");
|
||||||
|
@ -134,6 +140,7 @@ UserProfile::UserProfile(QWidget *parent)
|
||||||
devices_->setSelectionMode(QAbstractItemView::NoSelection);
|
devices_->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
devices_->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
devices_->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||||
devices_->setSpacing(DEVICE_SPACING);
|
devices_->setSpacing(DEVICE_SPACING);
|
||||||
|
devices_->setMinimumHeight(devices_->sizeHint().height() * 1.2);
|
||||||
devices_->hide();
|
devices_->hide();
|
||||||
|
|
||||||
QFont descriptionLabelFont;
|
QFont descriptionLabelFont;
|
||||||
|
@ -170,6 +177,9 @@ UserProfile::UserProfile(QWidget *parent)
|
||||||
vlayout->setContentsMargins(WIDGET_MARGIN, TOP_WIDGET_MARGIN, WIDGET_MARGIN, WIDGET_MARGIN);
|
vlayout->setContentsMargins(WIDGET_MARGIN, TOP_WIDGET_MARGIN, WIDGET_MARGIN, WIDGET_MARGIN);
|
||||||
|
|
||||||
qRegisterMetaType<std::vector<DeviceInfo>>();
|
qRegisterMetaType<std::vector<DeviceInfo>>();
|
||||||
|
|
||||||
|
auto closeShortcut = new QShortcut(QKeySequence(tr("ESC")), this);
|
||||||
|
connect(closeShortcut, &QShortcut::activated, this, &UserProfile::close);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -292,12 +302,3 @@ UserProfile::updateDeviceList(const QString &user_id, const std::vector<DeviceIn
|
||||||
devicesLabel_->show();
|
devicesLabel_->show();
|
||||||
devices_->show();
|
devices_->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
UserProfile::paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
|
@ -48,9 +48,6 @@ public:
|
||||||
|
|
||||||
void init(const QString &userId, const QString &roomId);
|
void init(const QString &userId, const QString &roomId);
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *) override;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateDeviceList(const QString &user_id, const std::vector<DeviceInfo> &devices);
|
void updateDeviceList(const QString &user_id, const std::vector<DeviceInfo> &devices);
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,15 @@
|
||||||
constexpr int MSG_RIGHT_MARGIN = 7;
|
constexpr int MSG_RIGHT_MARGIN = 7;
|
||||||
constexpr int MSG_PADDING = 20;
|
constexpr int MSG_PADDING = 20;
|
||||||
|
|
||||||
|
TextLabel::TextLabel(QWidget *parent)
|
||||||
|
: TextLabel(QString(), parent)
|
||||||
|
{}
|
||||||
|
|
||||||
TextLabel::TextLabel(const QString &text, QWidget *parent)
|
TextLabel::TextLabel(const QString &text, QWidget *parent)
|
||||||
: QTextBrowser(parent)
|
: QTextBrowser(parent)
|
||||||
{
|
{
|
||||||
|
document()->setDefaultStyleSheet(QString("a {color: %1; }").arg(utils::linkColor()));
|
||||||
|
|
||||||
setText(text);
|
setText(text);
|
||||||
setOpenExternalLinks(true);
|
setOpenExternalLinks(true);
|
||||||
|
|
||||||
|
@ -722,6 +728,8 @@ void
|
||||||
TimelineItem::generateTimestamp(const QDateTime &time)
|
TimelineItem::generateTimestamp(const QDateTime &time)
|
||||||
{
|
{
|
||||||
QFont timestampFont;
|
QFont timestampFont;
|
||||||
|
timestampFont.setFamily("Monospace");
|
||||||
|
timestampFont.setStyleHint(QFont::Monospace);
|
||||||
timestampFont.setPixelSize(conf::timeline::fonts::timestamp);
|
timestampFont.setPixelSize(conf::timeline::fonts::timestamp);
|
||||||
|
|
||||||
timestamp_ = new QLabel(this);
|
timestamp_ = new QLabel(this);
|
||||||
|
|
|
@ -102,8 +102,10 @@ class TextLabel : public QTextBrowser
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextLabel(const QString &text, QWidget *parent = nullptr);
|
TextLabel(const QString &text, QWidget *parent = nullptr);
|
||||||
|
TextLabel(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void wheelEvent(QWheelEvent *event) override { event->ignore(); }
|
void wheelEvent(QWheelEvent *event) override { event->ignore(); }
|
||||||
|
void clearLinks() { link_.clear(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *e) override;
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
|
|
@ -13,21 +13,19 @@ TextField::TextField(QWidget *parent)
|
||||||
// Get rid of the focus border on macOS.
|
// Get rid of the focus border on macOS.
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, 0);
|
setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||||
|
|
||||||
|
QPalette pal;
|
||||||
|
|
||||||
state_machine_ = new TextFieldStateMachine(this);
|
state_machine_ = new TextFieldStateMachine(this);
|
||||||
label_ = 0;
|
label_ = 0;
|
||||||
label_font_size_ = 15;
|
label_font_size_ = 15;
|
||||||
show_label_ = false;
|
show_label_ = false;
|
||||||
background_color_ = QColor("white");
|
background_color_ = pal.color(QPalette::Window);
|
||||||
|
|
||||||
setFrame(false);
|
setFrame(false);
|
||||||
setAttribute(Qt::WA_Hover);
|
setAttribute(Qt::WA_Hover);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setTextMargins(0, 4, 0, 6);
|
setTextMargins(0, 4, 0, 6);
|
||||||
|
|
||||||
QFont font("Open Sans");
|
|
||||||
font.setPixelSize(14);
|
|
||||||
setFont(font);
|
|
||||||
|
|
||||||
state_machine_->start();
|
state_machine_->start();
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
@ -115,7 +113,7 @@ QColor
|
||||||
TextField::textColor() const
|
TextField::textColor() const
|
||||||
{
|
{
|
||||||
if (!text_color_.isValid()) {
|
if (!text_color_.isValid()) {
|
||||||
return QColor("black");
|
return QPalette().color(QPalette::Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return text_color_;
|
return text_color_;
|
||||||
|
@ -132,7 +130,7 @@ QColor
|
||||||
TextField::labelColor() const
|
TextField::labelColor() const
|
||||||
{
|
{
|
||||||
if (!label_color_.isValid()) {
|
if (!label_color_.isValid()) {
|
||||||
return QColor("#abb"); // TODO: Move this into Theme.h
|
return QPalette().color(QPalette::Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return label_color_;
|
return label_color_;
|
||||||
|
@ -149,7 +147,7 @@ QColor
|
||||||
TextField::inkColor() const
|
TextField::inkColor() const
|
||||||
{
|
{
|
||||||
if (!ink_color_.isValid()) {
|
if (!ink_color_.isValid()) {
|
||||||
return QColor("black");
|
return QPalette().color(QPalette::Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ink_color_;
|
return ink_color_;
|
||||||
|
@ -166,7 +164,7 @@ QColor
|
||||||
TextField::underlineColor() const
|
TextField::underlineColor() const
|
||||||
{
|
{
|
||||||
if (!underline_color_.isValid()) {
|
if (!underline_color_.isValid()) {
|
||||||
return QColor("black");
|
return QPalette().color(QPalette::Highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
return underline_color_;
|
return underline_color_;
|
||||||
|
@ -340,8 +338,8 @@ TextFieldLabel::TextFieldLabel(TextField *parent)
|
||||||
scale_ = 1;
|
scale_ = 1;
|
||||||
color_ = parent->labelColor();
|
color_ = parent->labelColor();
|
||||||
|
|
||||||
QFont font("Open Sans SemiBold");
|
QFont font;
|
||||||
font.setPixelSize(parent->labelFontSize());
|
font.setWeight(60);
|
||||||
font.setLetterSpacing(QFont::PercentageSpacing, 102);
|
font.setLetterSpacing(QFont::PercentageSpacing, 102);
|
||||||
setFont(font);
|
setFont(font);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue