summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRokas Kupstys <rokupstys@gmail.com>2017-10-20 20:58:23 +0300
committermujx <mujx@users.noreply.github.com>2017-10-20 20:58:23 +0300
commit3205e5fdd303ccfc7f5a4bd5d236d2fbb5add2f6 (patch)
treeba7beeb593f481478375d688332aa3d7de20f4f0 /include
parent8299a74775bcdf917d58038fd35b2fdd208d4154 (diff)
Make sidebar topic expand on click and fix html formatting of elided text. (#96)
Fixes #95
Diffstat (limited to 'include')
-rw-r--r--include/TopRoomBar.h5
-rw-r--r--include/ui/Label.h26
2 files changed, 29 insertions, 2 deletions
diff --git a/include/TopRoomBar.h b/include/TopRoomBar.h
index 87037574..1b1d148c 100644
--- a/include/TopRoomBar.h
+++ b/include/TopRoomBar.h
@@ -29,6 +29,7 @@
#include "Avatar.h"
#include "FlatButton.h"
+#include "Label.h"
#include "LeaveRoomDialog.h"
#include "Menu.h"
#include "OverlayModal.h"
@@ -58,6 +59,7 @@ signals:
protected:
void paintEvent(QPaintEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
private slots:
void closeLeaveRoomDialog(bool leaving);
@@ -67,7 +69,7 @@ private:
QVBoxLayout *textLayout_;
QLabel *nameLabel_;
- QLabel *topicLabel_;
+ Label *topicLabel_;
QSharedPointer<RoomSettings> roomSettings_;
@@ -112,7 +114,6 @@ TopRoomBar::updateRoomName(const QString &name)
inline void
TopRoomBar::updateRoomTopic(QString topic)
{
- topic.replace(URL_REGEX, URL_HTML);
roomTopic_ = topic;
update();
}
diff --git a/include/ui/Label.h b/include/ui/Label.h
new file mode 100644
index 00000000..66e98115
--- /dev/null
+++ b/include/ui/Label.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <QLabel>
+
+class Label : public QLabel
+{
+ Q_OBJECT
+
+public:
+ explicit Label(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ explicit Label(const QString &text,
+ QWidget *parent = Q_NULLPTR,
+ Qt::WindowFlags f = Qt::WindowFlags());
+ ~Label() override {}
+
+signals:
+ void clicked(QMouseEvent *e);
+ void pressed(QMouseEvent *e);
+ void released(QMouseEvent *e);
+
+protected:
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+
+ QPoint pressPosition_;
+};