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