Snappy sidebar

This commit is contained in:
Konstantinos Sideris 2017-05-19 19:55:38 +03:00
parent 30fce32161
commit c480f8f4bc
11 changed files with 174 additions and 238 deletions

View file

@ -24,16 +24,12 @@
#include "MatrixClient.h"
#include "RoomList.h"
#include "RoomState.h"
#include "Splitter.h"
#include "TextInputWidget.h"
#include "TimelineViewManager.h"
#include "TopRoomBar.h"
#include "UserInfoWidget.h"
namespace Ui
{
class ChatPage;
}
class ChatPage : public QWidget
{
Q_OBJECT
@ -64,7 +60,20 @@ private slots:
private:
void updateRoomState(RoomState &room_state, const QJsonArray &events);
Ui::ChatPage *ui;
QHBoxLayout *topLayout_;
Splitter *splitter;
QWidget *sideBar_;
QVBoxLayout *sideBarLayout_;
QVBoxLayout *sideBarTopLayout_;
QVBoxLayout *sideBarMainLayout_;
QWidget *sideBarTopWidget_;
QVBoxLayout *sideBarTopWidgetLayout_;
QWidget *content_;
QVBoxLayout *contentLayout_;
QHBoxLayout *topBarLayout_;
QVBoxLayout *mainContentLayout_;
RoomList *room_list_;
TimelineViewManager *view_manager_;

View file

@ -23,14 +23,11 @@ class Splitter : public QSplitter
{
Q_OBJECT
public:
explicit Splitter(int first_step, int second_step, QWidget *parent = nullptr);
explicit Splitter(QWidget *parent = nullptr);
private:
void onSplitterMoved(int pos, int index);
int firstStep_ = 60;
int secondStep_ = 300;
int moveEventLimit_ = 50;
int leftMoveCount_ = 0;

View file

@ -42,6 +42,9 @@ public:
signals:
void logout();
protected:
void resizeEvent(QResizeEvent *event) override;
private:
Avatar *userAvatar_;

View file

@ -12,6 +12,11 @@ enum class AvatarType {
Letter
};
namespace sidebar
{
static const int SmallSize = 60;
static const int NormalSize = 300;
}
// Default font size.
const int FontSize = 16;