diff --git a/.gitignore b/.gitignore
index 43c9b7b4..23b84039 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,11 @@
-build
+/build*
tags
cscope*
.clang_complete
*wintoastlib*
+/.ccls-cache
+/.exrc
+.gdb_history
# GTAGS
GTAGS
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d5aff7a..b9726dd8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,7 +69,7 @@ include(LMDB)
#
# Discover Qt dependencies.
#
-find_package(Qt5 COMPONENTS Core Widgets LinguistTools Concurrent Svg Multimedia REQUIRED)
+find_package(Qt5 COMPONENTS Core Widgets LinguistTools Concurrent Svg Multimedia Qml QuickControls2 REQUIRED)
find_package(Qt5DBus)
if (APPLE)
@@ -191,13 +191,14 @@ set(SRC_FILES
src/emoji/Provider.cpp
# Timeline
- src/timeline/TimelineViewManager.cpp
- src/timeline/TimelineItem.cpp
- src/timeline/TimelineView.cpp
- src/timeline/widgets/AudioItem.cpp
- src/timeline/widgets/FileItem.cpp
- src/timeline/widgets/ImageItem.cpp
- src/timeline/widgets/VideoItem.cpp
+ src/timeline2/TimelineViewManager.cpp
+ #src/timeline/TimelineViewManager.cpp
+ #src/timeline/TimelineItem.cpp
+ #src/timeline/TimelineView.cpp
+ #src/timeline/widgets/AudioItem.cpp
+ #src/timeline/widgets/FileItem.cpp
+ #src/timeline/widgets/ImageItem.cpp
+ #src/timeline/widgets/VideoItem.cpp
# UI components
src/ui/Avatar.cpp
@@ -333,13 +334,14 @@ qt5_wrap_cpp(MOC_HEADERS
src/emoji/PickButton.h
# Timeline
- src/timeline/TimelineItem.h
- src/timeline/TimelineView.h
- src/timeline/TimelineViewManager.h
- src/timeline/widgets/AudioItem.h
- src/timeline/widgets/FileItem.h
- src/timeline/widgets/ImageItem.h
- src/timeline/widgets/VideoItem.h
+ src/timeline2/TimelineViewManager.h
+ #src/timeline/TimelineItem.h
+ #src/timeline/TimelineView.h
+ #src/timeline/TimelineViewManager.h
+ #src/timeline/widgets/AudioItem.h
+ #src/timeline/widgets/FileItem.h
+ #src/timeline/widgets/ImageItem.h
+ #src/timeline/widgets/VideoItem.h
# UI components
src/ui/Avatar.h
@@ -405,6 +407,8 @@ set(COMMON_LIBS
Qt5::Svg
Qt5::Concurrent
Qt5::Multimedia
+ Qt5::Qml
+ Qt5::QuickControls2
nlohmann_json::nlohmann_json)
if(APPVEYOR_BUILD)
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
new file mode 100644
index 00000000..d81e3ae1
--- /dev/null
+++ b/resources/qml/TimelineView.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.1
+
+Rectangle {
+ anchors.fill: parent
+
+ Text {
+ anchors.centerIn: parent
+ text: qsTr("No room open")
+ font.pointSize: 24
+ }
+}
diff --git a/resources/res.qrc b/resources/res.qrc
index ad27af5a..65770c8c 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -114,4 +114,7 @@
styles/nheko.qss
styles/nheko-dark.qss
+
+ qml/TimelineView.qml
+
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 21ded4b3..594a41c2 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -44,7 +44,7 @@
#include "dialogs/ReadReceipts.h"
#include "popups/UserMentions.h"
-#include "timeline/TimelineViewManager.h"
+#include "timeline2/TimelineViewManager.h"
// TODO: Needs to be updated with an actual secret.
static const std::string STORAGE_SECRET_KEY("secret");
@@ -113,7 +113,7 @@ ChatPage::ChatPage(QSharedPointer userSettings, QWidget *parent)
view_manager_ = new TimelineViewManager(this);
contentLayout_->addWidget(top_bar_);
- contentLayout_->addWidget(view_manager_);
+ contentLayout_->addWidget(view_manager_->getWidget());
connect(this,
&ChatPage::removeTimelineEvent,
diff --git a/src/popups/UserMentions.cpp b/src/popups/UserMentions.cpp
index 3480959a..3be5c462 100644
--- a/src/popups/UserMentions.cpp
+++ b/src/popups/UserMentions.cpp
@@ -7,7 +7,7 @@
#include "ChatPage.h"
#include "Logging.h"
#include "UserMentions.h"
-#include "timeline/TimelineItem.h"
+//#include "timeline/TimelineItem.h"
using namespace popups;
@@ -116,39 +116,46 @@ UserMentions::pushItem(const QString &event_id,
const QString &room_id,
const QString ¤t_room_id)
{
- setUpdatesEnabled(false);
-
- // Add to the 'all' section
- TimelineItem *view_item = new TimelineItem(
- mtx::events::MessageType::Text, user_id, body, true, room_id, all_scroll_widget_);
- view_item->setEventId(event_id);
- view_item->hide();
-
- all_scroll_layout_->addWidget(view_item);
- QTimer::singleShot(0, this, [view_item, this]() {
- view_item->show();
- view_item->adjustSize();
- setUpdatesEnabled(true);
- });
-
- // if it matches the current room... add it to the current room as well.
- if (QString::compare(room_id, current_room_id, Qt::CaseInsensitive) == 0) {
- // Add to the 'local' section
- TimelineItem *local_view_item = new TimelineItem(mtx::events::MessageType::Text,
- user_id,
- body,
- true,
- room_id,
- local_scroll_widget_);
- local_view_item->setEventId(event_id);
- local_view_item->hide();
- local_scroll_layout_->addWidget(local_view_item);
-
- QTimer::singleShot(0, this, [local_view_item]() {
- local_view_item->show();
- local_view_item->adjustSize();
- });
- }
+ (void)event_id;
+ (void)user_id;
+ (void)body;
+ (void)room_id;
+ (void)current_room_id;
+ // setUpdatesEnabled(false);
+ //
+ // // Add to the 'all' section
+ // TimelineItem *view_item = new TimelineItem(
+ // mtx::events::MessageType::Text, user_id, body, true, room_id,
+ // all_scroll_widget_);
+ // view_item->setEventId(event_id);
+ // view_item->hide();
+ //
+ // all_scroll_layout_->addWidget(view_item);
+ // QTimer::singleShot(0, this, [view_item, this]() {
+ // view_item->show();
+ // view_item->adjustSize();
+ // setUpdatesEnabled(true);
+ // });
+ //
+ // // if it matches the current room... add it to the current room as well.
+ // if (QString::compare(room_id, current_room_id, Qt::CaseInsensitive) == 0) {
+ // // Add to the 'local' section
+ // TimelineItem *local_view_item = new
+ // TimelineItem(mtx::events::MessageType::Text,
+ // user_id,
+ // body,
+ // true,
+ // room_id,
+ // local_scroll_widget_);
+ // local_view_item->setEventId(event_id);
+ // local_view_item->hide();
+ // local_scroll_layout_->addWidget(local_view_item);
+ //
+ // QTimer::singleShot(0, this, [local_view_item]() {
+ // local_view_item->show();
+ // local_view_item->adjustSize();
+ // });
+ // }
}
void
@@ -158,4 +165,4 @@ UserMentions::paintEvent(QPaintEvent *)
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
-}
\ No newline at end of file
+}
diff --git a/src/timeline2/TimelineViewManager.cpp b/src/timeline2/TimelineViewManager.cpp
new file mode 100644
index 00000000..b932b6ac
--- /dev/null
+++ b/src/timeline2/TimelineViewManager.cpp
@@ -0,0 +1,10 @@
+#include "TimelineViewManager.h"
+
+TimelineViewManager::TimelineViewManager(QWidget *parent)
+{
+ view = new QQuickView();
+ container = QWidget::createWindowContainer(view, parent);
+ container->setMinimumSize(200, 200);
+ view->setSource(QUrl("qrc:///qml/TimelineView.qml"));
+ // view->rootContext()->setContextProperty(room);
+}
diff --git a/src/timeline2/TimelineViewManager.h b/src/timeline2/TimelineViewManager.h
new file mode 100644
index 00000000..23d30065
--- /dev/null
+++ b/src/timeline2/TimelineViewManager.h
@@ -0,0 +1,72 @@
+#pragma once
+
+#include
+#include
+
+#include
+
+#include "Cache.h"
+#include "Utils.h"
+
+// temporary for stubs
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+
+class TimelineViewManager : public QObject
+{
+ Q_OBJECT
+public:
+ TimelineViewManager(QWidget *parent = 0);
+ QWidget *getWidget() const { return container; }
+
+ void initialize(const mtx::responses::Rooms &rooms) {}
+ void addRoom(const QString &room_id) {}
+
+ void sync(const mtx::responses::Rooms &rooms) {}
+ void clearAll() {}
+
+signals:
+ void clearRoomMessageCount(QString roomid);
+ void updateRoomsLastMessage(const QString &user, const DescInfo &info);
+
+public slots:
+ void updateReadReceipts(const QString &room_id, const std::vector &event_ids) {}
+ void removeTimelineEvent(const QString &room_id, const QString &event_id) {}
+ void initWithMessages(const std::map &msgs) {}
+
+ void setHistoryView(const QString &room_id) {}
+ void queueTextMessage(const QString &msg) {}
+ void queueReplyMessage(const QString &reply, const RelatedInfo &related) {}
+ void queueEmoteMessage(const QString &msg) {}
+ void queueImageMessage(const QString &roomid,
+ const QString &filename,
+ const QString &url,
+ const QString &mime,
+ uint64_t dsize,
+ const QSize &dimensions)
+ {}
+ void queueFileMessage(const QString &roomid,
+ const QString &filename,
+ const QString &url,
+ const QString &mime,
+ uint64_t dsize)
+ {}
+ void queueAudioMessage(const QString &roomid,
+ const QString &filename,
+ const QString &url,
+ const QString &mime,
+ uint64_t dsize)
+ {}
+ void queueVideoMessage(const QString &roomid,
+ const QString &filename,
+ const QString &url,
+ const QString &mime,
+ uint64_t dsize)
+ {}
+
+private:
+ QQuickView *view;
+ QWidget *container;
+};
+
+#pragma GCC diagnostic pop