mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Remove unnecessary layouts
This commit is contained in:
parent
26904fe992
commit
a6b84fac45
7 changed files with 20 additions and 64 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
@ -109,17 +110,11 @@ private:
|
||||||
QHBoxLayout *topLayout_;
|
QHBoxLayout *topLayout_;
|
||||||
Splitter *splitter;
|
Splitter *splitter;
|
||||||
|
|
||||||
QWidget *sideBar_;
|
QFrame *sideBar_;
|
||||||
QVBoxLayout *sideBarLayout_;
|
QVBoxLayout *sideBarLayout_;
|
||||||
QVBoxLayout *sideBarTopLayout_;
|
|
||||||
QVBoxLayout *sideBarMainLayout_;
|
|
||||||
QWidget *sideBarTopWidget_;
|
|
||||||
QVBoxLayout *sideBarTopWidgetLayout_;
|
|
||||||
|
|
||||||
QWidget *content_;
|
QFrame *content_;
|
||||||
QVBoxLayout *contentLayout_;
|
QVBoxLayout *contentLayout_;
|
||||||
QHBoxLayout *topBarLayout_;
|
|
||||||
QVBoxLayout *mainContentLayout_;
|
|
||||||
|
|
||||||
RoomList *room_list_;
|
RoomList *room_list_;
|
||||||
TimelineViewManager *view_manager_;
|
TimelineViewManager *view_manager_;
|
||||||
|
|
|
@ -61,64 +61,39 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
|
||||||
topLayout_->addWidget(splitter);
|
topLayout_->addWidget(splitter);
|
||||||
|
|
||||||
// SideBar
|
// SideBar
|
||||||
sideBar_ = new QWidget(this);
|
sideBar_ = new QFrame(this);
|
||||||
sideBar_->setMinimumSize(QSize(ui::sidebar::NormalSize, 0));
|
sideBar_->setMinimumSize(QSize(ui::sidebar::NormalSize, 0));
|
||||||
sideBarLayout_ = new QVBoxLayout(sideBar_);
|
sideBarLayout_ = new QVBoxLayout(sideBar_);
|
||||||
sideBarLayout_->setSpacing(0);
|
sideBarLayout_->setSpacing(0);
|
||||||
sideBarLayout_->setMargin(0);
|
sideBarLayout_->setMargin(0);
|
||||||
|
|
||||||
sideBarTopLayout_ = new QVBoxLayout();
|
|
||||||
sideBarTopLayout_->setSpacing(0);
|
|
||||||
sideBarTopLayout_->setMargin(0);
|
|
||||||
sideBarMainLayout_ = new QVBoxLayout();
|
|
||||||
sideBarMainLayout_->setSpacing(0);
|
|
||||||
sideBarMainLayout_->setMargin(0);
|
|
||||||
|
|
||||||
sidebarActions_ = new SideBarActions(this);
|
sidebarActions_ = new SideBarActions(this);
|
||||||
connect(
|
connect(
|
||||||
sidebarActions_, &SideBarActions::showSettings, this, &ChatPage::showUserSettingsPage);
|
sidebarActions_, &SideBarActions::showSettings, this, &ChatPage::showUserSettingsPage);
|
||||||
|
|
||||||
sideBarLayout_->addLayout(sideBarTopLayout_);
|
user_info_widget_ = new UserInfoWidget(sideBar_);
|
||||||
sideBarLayout_->addLayout(sideBarMainLayout_);
|
room_list_ = new RoomList(client, sideBar_);
|
||||||
|
|
||||||
|
sideBarLayout_->addWidget(user_info_widget_);
|
||||||
|
sideBarLayout_->addWidget(room_list_);
|
||||||
sideBarLayout_->addWidget(sidebarActions_);
|
sideBarLayout_->addWidget(sidebarActions_);
|
||||||
|
|
||||||
sideBarTopWidget_ = new QWidget(sideBar_);
|
|
||||||
sideBarTopWidget_->setStyleSheet("background-color: #d6dde3; color: #ebebeb;");
|
|
||||||
|
|
||||||
sideBarTopLayout_->addWidget(sideBarTopWidget_);
|
|
||||||
|
|
||||||
sideBarTopWidgetLayout_ = new QVBoxLayout(sideBarTopWidget_);
|
|
||||||
sideBarTopWidgetLayout_->setSpacing(0);
|
|
||||||
sideBarTopWidgetLayout_->setMargin(0);
|
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
content_ = new QWidget(this);
|
content_ = new QFrame(this);
|
||||||
contentLayout_ = new QVBoxLayout(content_);
|
contentLayout_ = new QVBoxLayout(content_);
|
||||||
contentLayout_->setSpacing(0);
|
contentLayout_->setSpacing(0);
|
||||||
contentLayout_->setMargin(0);
|
contentLayout_->setMargin(0);
|
||||||
|
|
||||||
topBarLayout_ = new QHBoxLayout();
|
top_bar_ = new TopRoomBar(this);
|
||||||
topBarLayout_->setSpacing(0);
|
view_manager_ = new TimelineViewManager(client, this);
|
||||||
mainContentLayout_ = new QVBoxLayout();
|
|
||||||
mainContentLayout_->setSpacing(0);
|
|
||||||
mainContentLayout_->setMargin(0);
|
|
||||||
|
|
||||||
contentLayout_->addLayout(topBarLayout_);
|
contentLayout_->addWidget(top_bar_);
|
||||||
contentLayout_->addLayout(mainContentLayout_);
|
contentLayout_->addWidget(view_manager_);
|
||||||
|
|
||||||
// Splitter
|
// Splitter
|
||||||
splitter->addWidget(sideBar_);
|
splitter->addWidget(sideBar_);
|
||||||
splitter->addWidget(content_);
|
splitter->addWidget(content_);
|
||||||
|
|
||||||
room_list_ = new RoomList(client, sideBar_);
|
|
||||||
sideBarMainLayout_->addWidget(room_list_);
|
|
||||||
|
|
||||||
top_bar_ = new TopRoomBar(this);
|
|
||||||
topBarLayout_->addWidget(top_bar_);
|
|
||||||
|
|
||||||
view_manager_ = new TimelineViewManager(client, this);
|
|
||||||
mainContentLayout_->addWidget(view_manager_);
|
|
||||||
|
|
||||||
text_input_ = new TextInputWidget(this);
|
text_input_ = new TextInputWidget(this);
|
||||||
typingDisplay_ = new TypingDisplay(this);
|
typingDisplay_ = new TypingDisplay(this);
|
||||||
contentLayout_->addWidget(typingDisplay_);
|
contentLayout_->addWidget(typingDisplay_);
|
||||||
|
@ -127,9 +102,6 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
|
||||||
typingRefresher_ = new QTimer(this);
|
typingRefresher_ = new QTimer(this);
|
||||||
typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT);
|
typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT);
|
||||||
|
|
||||||
user_info_widget_ = new UserInfoWidget(sideBarTopWidget_);
|
|
||||||
sideBarTopWidgetLayout_->addWidget(user_info_widget_);
|
|
||||||
|
|
||||||
connect(user_info_widget_, SIGNAL(logout()), client_.data(), SLOT(logout()));
|
connect(user_info_widget_, SIGNAL(logout()), client_.data(), SLOT(logout()));
|
||||||
connect(client_.data(), SIGNAL(loggedOut()), this, SLOT(logout()));
|
connect(client_.data(), SIGNAL(loggedOut()), this, SLOT(logout()));
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,6 @@ RoomList::RoomList(QSharedPointer<MatrixClient> client, QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, client_(client)
|
, client_(client)
|
||||||
{
|
{
|
||||||
setStyleSheet("QWidget { border: none; }");
|
|
||||||
|
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
||||||
sizePolicy.setHorizontalStretch(0);
|
|
||||||
sizePolicy.setVerticalStretch(0);
|
|
||||||
setSizePolicy(sizePolicy);
|
|
||||||
|
|
||||||
topLayout_ = new QVBoxLayout(this);
|
topLayout_ = new QVBoxLayout(this);
|
||||||
topLayout_->setSpacing(0);
|
topLayout_->setSpacing(0);
|
||||||
topLayout_->setMargin(0);
|
topLayout_->setMargin(0);
|
||||||
|
@ -51,7 +44,7 @@ RoomList::RoomList(QSharedPointer<MatrixClient> client, QWidget *parent)
|
||||||
scrollArea_->setWidgetResizable(true);
|
scrollArea_->setWidgetResizable(true);
|
||||||
scrollArea_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
scrollArea_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
||||||
scrollAreaContents_ = new QWidget();
|
scrollAreaContents_ = new QWidget(this);
|
||||||
|
|
||||||
contentsLayout_ = new QVBoxLayout(scrollAreaContents_);
|
contentsLayout_ = new QVBoxLayout(scrollAreaContents_);
|
||||||
contentsLayout_->setSpacing(0);
|
contentsLayout_->setSpacing(0);
|
||||||
|
|
|
@ -9,9 +9,6 @@ SideBarActions::SideBarActions(QWidget *parent)
|
||||||
{
|
{
|
||||||
setFixedHeight(conf::sidebarActions::height);
|
setFixedHeight(conf::sidebarActions::height);
|
||||||
|
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
|
||||||
setSizePolicy(sizePolicy);
|
|
||||||
|
|
||||||
layout_ = new QHBoxLayout(this);
|
layout_ = new QHBoxLayout(this);
|
||||||
layout_->setMargin(0);
|
layout_->setMargin(0);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<MatrixClient> client, QW
|
||||||
: QStackedWidget(parent)
|
: QStackedWidget(parent)
|
||||||
, client_(client)
|
, client_(client)
|
||||||
{
|
{
|
||||||
setStyleSheet("QWidget { background: #fff; color: #e8e8e8; border: none;}");
|
setStyleSheet("border: none;");
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
client_.data(), &MatrixClient::messageSent, this, &TimelineViewManager::messageSent);
|
client_.data(), &MatrixClient::messageSent, this, &TimelineViewManager::messageSent);
|
||||||
|
|
|
@ -33,8 +33,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
||||||
, buttonSize_{32}
|
, buttonSize_{32}
|
||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
setMinimumSize(QSize(0, 65));
|
setFixedHeight(65);
|
||||||
setStyleSheet("background-color: #fff; color: #171919;");
|
|
||||||
|
|
||||||
topLayout_ = new QHBoxLayout();
|
topLayout_ = new QHBoxLayout();
|
||||||
topLayout_->setSpacing(10);
|
topLayout_->setSpacing(10);
|
||||||
|
|
|
@ -33,9 +33,7 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
|
||||||
, logoutDialog_{nullptr}
|
, logoutDialog_{nullptr}
|
||||||
, logoutButtonSize_{20}
|
, logoutButtonSize_{20}
|
||||||
{
|
{
|
||||||
QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
setFixedHeight(65);
|
||||||
setSizePolicy(sizePolicy);
|
|
||||||
setMinimumSize(QSize(0, 65));
|
|
||||||
|
|
||||||
topLayout_ = new QHBoxLayout(this);
|
topLayout_ = new QHBoxLayout(this);
|
||||||
topLayout_->setSpacing(0);
|
topLayout_->setSpacing(0);
|
||||||
|
@ -140,6 +138,8 @@ UserInfoWidget::resizeEvent(QResizeEvent *event)
|
||||||
displayNameLabel_->show();
|
displayNameLabel_->show();
|
||||||
userIdLabel_->show();
|
userIdLabel_->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue