diff --git a/README.md b/README.md index 1eea638..b845be6 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,2 @@ ## Conversations -op Maemo: -``` -sudo apt install -y ccache cmake build-essential libx11-dev zlib1g-dev libpng-dev qtbase5-dev libqt5svg5-dev libqt5svg5-dev libqt5maemo5-dev libqt5x11extras5-dev gdb libqt5quickcontrols2-5 qtquickcontrols2-5-dev qml-module-qtquick-controls2 qml-module-qtquick2 qml-module-qtquick-layouts qml-module-qtquick-controls qml-module-qtquick-extras qml-module-qtquick-dialogs libqt5x11extras5-dev qml-module-qtquick-controls qml-module-qtquick-layouts qtquickcontrols2-5-dev -``` - -As `user`: - -```bash -cmake -Bbuild . -make -Cbuild -j2 -./build/bin/conversations - -# mem usage -/usr/bin/time -v ./build/bin/conversations -``` - -### remote debug (dev) - -Since we run as root we need env. variables: - -``` -QTWEBENGINE_DISABLE_SANDBOX=1 -DISPLAY=:0.0 -``` - - -# Stacked windows -https://github.com/maemo-leste-extras/dorian/commit/5e8f2e1b87c87ded67030d723c1c5fad3e967b78#diff-e12fae2282221bbdc52470acd3d3170f13683567557cca988671189c88ba7c45L43 - -# link -https://github.com/maemo-leste/rtcom-eventlogger - -# rtcom-eventlogger-ui - -```bash -sudo apt install -y dpkg-dev debhelper libglib2.0-dev libxml2-dev libosso-dev libhildon1-dev libebook1.2-dev libedataserver1.2-dev libgconf2-dev libtelepathy-glib-dev librtcom-eventlogger-dev maemo-launcher-dev libhildonfm2-dev libhildonmime-dev libcairo2-dev libgofono-dev mobile-broadband-provider-info libmodest-dbus-client-dev libglibutil-dev librtcom-eventlogger-plugins-dev libclockcore0-dev libcityinfo-dev libtime-dev -git clone https://github.com/maemo-leste/rtcom-eventlogger-ui.git -git clone https://github.com/maemo-leste/osso-abook.git -dpkg-buildpackage -b -uc -apt-get build-dep . -``` - -## bla - -``` -QTWEBENGINE_DISABLE_SANDBOX=1 QT_STYLE_OVERRIDE=maemo5 QT_QPA_PLATFORM=maemo DISPLAY=:0.0 /tmp/tmp.jESqXMl9IW/cmake-build-debug-remote/bin/conversations -``` \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 67dc449..f5e1e43 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,6 @@ endif() qt5_add_resources(RESOURCES assets.qrc - assets/images/flags/flags.qrc qml/components/qml_components.qrc qml/chat/chatty/chatty.qrc qml/chat/whatsthat/whatsthat.qrc diff --git a/src/assets.qrc b/src/assets.qrc index d44eb91..a454e69 100644 --- a/src/assets.qrc +++ b/src/assets.qrc @@ -1,7 +1,6 @@ assets/appicon.icns - assets/country-codes.csv assets/images/video_tab_icon.svg qml/overview.qml diff --git a/src/chatwindow.cpp b/src/chatwindow.cpp index b154f4d..2cef94d 100644 --- a/src/chatwindow.cpp +++ b/src/chatwindow.cpp @@ -11,7 +11,6 @@ #include "chatwindow.h" #include "config-conversations.h" #include "lib/globals.h" -#include "wsclient.h" #include "ui_chatwindow.h" diff --git a/src/conversations.cpp b/src/conversations.cpp index 5f09c03..261624a 100644 --- a/src/conversations.cpp +++ b/src/conversations.cpp @@ -16,16 +16,13 @@ Conversations::Conversations(QCommandLineParser *cmdargs) { // Paths pathGenericData = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); configRoot = QDir::homePath(); - accountName = Utils::getUnixAccountName(); + accountName = qgetenv("USER"); homeDir = QDir::homePath(); configDirectory = QString("%1/.config/%2/").arg(configRoot, QCoreApplication::applicationName()); // Create some directories createConfigDirectory(configDirectory); - // flags, iso codes, etc - countries = new Countries(); - m_textScaling = config()->get(ConfigKeys::TextScaling).toFloat(); if(this->isDebug) { diff --git a/src/conversations.h b/src/conversations.h index d803b0d..1ef09b8 100644 --- a/src/conversations.h +++ b/src/conversations.h @@ -7,10 +7,8 @@ #include #include "lib/http.h" -#include "lib/countries.h" #include "lib/config.h" #include "models/ChatModel.h" -#include "wsclient.h" class Conversations : public QObject { Q_OBJECT @@ -36,12 +34,10 @@ public: QString pathGenericData; QString homeDir; QString accountName; - QHash countries_iso_3166_1; QString applicationPath; static void createConfigDirectory(const QString &dir) ; - Countries *countries; ChatModel *chatOverviewModel; void setWindowTitle(const QString &title); diff --git a/src/mainwindow.h b/src/mainwindow.h index 976a8ab..6d54077 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -17,7 +17,6 @@ #include "conversations.h" #include "chatwindow.h" #include "settings.h" -#include "wsclient.h" #include "lib/config.h" namespace Ui { diff --git a/src/qml/chat/whatsthat/whatsthat.qml b/src/qml/chat/whatsthat/whatsthat.qml index 200fd98..e996315 100644 --- a/src/qml/chat/whatsthat/whatsthat.qml +++ b/src/qml/chat/whatsthat/whatsthat.qml @@ -126,7 +126,11 @@ Components.ChatRoot { // if we dont the list scrolling bugs out by "jumping" chatListView.visible = false; var count_results = chatModel.getPage(); - chatListView.positionViewAtIndex(count_results, ListView.Visible) + if(!chatListView.atBottom) { + var jump_to = count_results <= 1 ? 0 : count_results + 1 + chatListView.positionViewAtIndex(jump_to, ListView.Beginning) + } + chatListView.visible = true; } } diff --git a/src/qml/components/ChatListView.qml b/src/qml/components/ChatListView.qml index 43288b5..12d401a 100644 --- a/src/qml/components/ChatListView.qml +++ b/src/qml/components/ChatListView.qml @@ -9,7 +9,7 @@ ListView { signal scrollToBottom() - boundsBehavior: Flickable.StopAtBounds + //boundsBehavior: Flickable.StopAtBounds property var chatScroll: chatScroll property bool scrollable: root.childrenRect.height > parent.height property bool atBottom: (chatScroll.position + chatScroll.size) == 1 diff --git a/src/qml/components/ChatRoot.qml b/src/qml/components/ChatRoot.qml index 7af397f..5e63c5c 100644 --- a/src/qml/components/ChatRoot.qml +++ b/src/qml/components/ChatRoot.qml @@ -10,6 +10,8 @@ Rectangle { color: "grey" property var chatList + property string historyPopupBackgroundColor: "#b2b2b2" + property string historyPopupTextColor: "black" signal scrollToBottom() signal fetchHistory() @@ -25,11 +27,33 @@ Rectangle { onClicked: scrollBottomTimer.start(); } - Item { - visible: chatList.atTop && !chatModel.exhausted - onVisibleChanged: { - if(!chatModel.exhausted && chatList.atTop && visible && chatListView.count >= chatModel.limit) - fetchHistory(); + Rectangle { + // detect requesting history - endless scroll + visible: chatList.chatScroll.position < 0.0 + opacity: Math.abs(chatList.chatScroll.position * 10) + z: parent.z + 2 + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 20 + + width: parent.width / 2 + height: 32 + color: "grey" + radius: 6 + + Text { + font.pointSize: 16 + text: !chatModel.exhausted ? "Load history" : "No more history" + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + } + + Item { + visible: chatList.chatScroll.position <= -0.1 + onVisibleChanged: { + if(visible && !chatModel.exhausted && chatListView.count >= chatModel.limit) + fetchHistory(); + } } } @@ -85,6 +109,12 @@ Rectangle { font.pointSize: parent.pointSize } + Text { + color: "lime" + text: "scrollable: " + chatList.scrollable + font.pointSize: parent.pointSize + } + Text { color: "lime" text: "scaling: " + ctx.scaleFactor @@ -97,6 +127,9 @@ Rectangle { interval: 10 repeat: false running: false - onTriggered: chatList.positionViewAtEnd(); + onTriggered: { + console.log("scrolling to bottom"); + chatList.positionViewAtEnd(); + } } } \ No newline at end of file