Compare commits

...

19 Commits
v22.09 ... v1.0

Author SHA1 Message Date
Devin Lin
c96109e9b7 Fix room header text alignment and add support for two line room descriptions
(cherry picked from commit 93f35faf95)
2020-12-23 09:06:33 +00:00
Devin Lin
3f01b3badf Show feedback on avatar hover
(cherry picked from commit 87a7a34d80)
2020-12-23 08:51:29 +00:00
Tobias Fella
093412c788 Revert "Add symbolic icon"
This reverts commit 89bf5d3a31
2020-12-22 23:43:35 +00:00
Carl Schwan
c5ddb61981 Use correct version 2020-12-22 23:12:46 +01:00
Nicolas Fella
ad4e52b20d Fix icon in notifyrc
(cherry picked from commit ef8c21213a)
2020-12-22 22:02:23 +00:00
Carl Schwan
5991d59ddd Fix not eliding text in USerDetailDialog
Fix: #169
2020-12-22 16:23:49 +01:00
Carl Schwan
de49a26462 Switch back to plain text editing
See https://bugreports.qt.io/browse/QTBUG-89630


(cherry picked from commit 6482f08eba)
2020-12-21 09:25:07 +00:00
Carl Schwan
4924702c15 Use TextArea instead of simple field for room topic
(cherry picked from commit f61eff2937)
2020-12-20 19:27:26 +00:00
Tobias Fella
8060edd1c6 Allow opening links in the MessageDelegateContextMenu
Fixes #167


(cherry picked from commit 449adf993c)
2020-12-20 18:17:46 +00:00
Jan Blackquill
89bf5d3a31 Add symbolic icon
(cherry picked from commit 9189a8ca30)
2020-12-20 09:19:53 +00:00
Carl Schwan
60762b934c Fix current page not getting updated after switching a page
This was caused by myself not updating the index after updating the
content.
2020-12-19 23:03:01 +01:00
Carl Schwan
7729fec259 Add special font configuration for flatpak
(cherry picked from commit 6e659c853b)
2020-12-19 10:49:32 +00:00
Carl Schwan
026769b07f Make kquickimageeditor a required dependency 2020-12-17 13:19:03 +01:00
Carl Schwan
5be14a4b8f Last icon fix 2020-12-17 10:37:22 +01:00
Carl Schwan
0b70d2b33f fix icon 2020-12-17 10:37:22 +01:00
Carl Schwan
dab77b8d07 Rename icon and set icon name explicitely
Fix #140
2020-12-17 10:37:22 +01:00
Carl Schwan
2acdf61b16 Don't recreate RoomPage each time and add a small loading indicator
(cherry picked from commit bd41dcc986)
2020-12-17 08:59:36 +00:00
Carl Schwan
defa3d4b77 Improve autocompletion
(cherry picked from commit 2b84c5dd02)
2020-12-17 08:58:30 +00:00
Mathew Broady
be709a2732 Remove forgotten NeoChat.Effect imports
Fixes the "Start Chat" and "Explore Rooms" pages


(cherry picked from commit 79dab63993)
2020-12-17 06:24:29 +00:00
19 changed files with 124 additions and 28 deletions

View File

@@ -20,10 +20,12 @@ include(KDEClangFormat)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(cmake/Flatpak.cmake)
# Fix a crash due to problems with quotient's event system. Can probably be removed once the reworked event system is in
cmake_policy(SET CMP0063 OLD)
ecm_setup_version(0.1.0
ecm_setup_version(1.0.0
VARIABLE_PREFIX NEOCHAT
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/neochat-version.h
)
@@ -58,6 +60,7 @@ ecm_find_qmlmodule(org.kde.kquickimageeditor 1.0)
find_package(KQuickImageEditor COMPONENTS)
set_package_properties(KQuickImageEditor PROPERTIES
TYPE REQUIRED
DESCRIPTION "Simple image editor for QtQuick applications"
URL "https://invent.kde.org/libraries/kquickimageeditor/"
PURPOSE "Add image editing capability to image attachments"
@@ -65,7 +68,7 @@ set_package_properties(KQuickImageEditor PROPERTIES
install(FILES org.kde.neochat.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.neochat.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(FILES neochat.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
install(FILES org.kde.neochat.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
install(FILES neochat.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
# add_definitions(-DQT_NO_KEYWORDS) Need to fix libQuotient first

16
cmake/Flatpak.cmake Normal file
View File

@@ -0,0 +1,16 @@
if(NOT NEOCHAT_FLATPAK)
# Only include this if we build a Flatpak
return()
endif()
include(GNUInstallDirs)
# Include FontConfig config which uses the Emoji One font from the
# KDE Flatpak SDK.
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Flatpak/99-noto-mono-color-emoji.conf
DESTINATION
${CMAKE_INSTALL_SYSCONFDIR}/fonts/conf.d/
)

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>Emoji One</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Emoji One</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Emoji One</family>
</prefer>
</alias>
</fontconfig>

View File

@@ -133,8 +133,8 @@ ToolBar {
keyNavigationWraps: true
delegate: Control {
property string displayText: modelData.displayName ?? modelData.unicode
property bool isEmoji: modelData.unicode != null
readonly property string displayText: modelData.displayName ?? modelData.unicode
readonly property bool isEmoji: modelData.unicode != null
readonly property bool highlighted: autoCompleteListView.currentIndex == index
padding: Kirigami.Units.smallSpacing
@@ -176,7 +176,7 @@ ToolBar {
anchors.fill: parent
onClicked: {
autoCompleteListView.currentIndex = index
documentHandler.replaceAutoComplete(displayText)
inputField.autoComplete();
}
}
}
@@ -342,7 +342,8 @@ ToolBar {
Keys.onReturnPressed: {
if (isAutoCompleting) {
documentHandler.replaceAutoComplete(autoCompleteListView.currentItem.displayText)
inputField.autoComplete();
isAutoCompleting = false;
return;
}
@@ -397,7 +398,7 @@ ToolBar {
autoAppeared = false;
}
documentHandler.replaceAutoComplete(autoCompleteListView.currentItem.displayText)
inputField.autoComplete();
}
onTextChanged: {
@@ -434,10 +435,22 @@ ToolBar {
}
function postMessage() {
documentHandler.postMessage(inputField.text, attachmentPath, replyEventID);
// Qt wraps lines so we need to use a small hack
// to remove the wrapped lines but not break the empty
// lines.
const updatedText = inputField.text.trim()
.replace(/@([^: ]*):([^ ]*\.[^ ]*)/, "[@$1:$2](https://matrix.to/#/@$1:$2)");
documentHandler.postMessage(updatedText, attachmentPath, replyEventID);
clearAttachment();
currentRoom.markAllMessagesAsRead();
clear();
text = Qt.binding(function() {
return currentRoom != null ? currentRoom.cachedInput : "";
});
}
function autoComplete() {
documentHandler.replaceAutoComplete(autoCompleteListView.currentItem.displayText)
}
}

View File

@@ -64,6 +64,7 @@ RowLayout {
MouseArea {
anchors.fill: parent
onClicked: userDetailDialog.createObject(QQC2.ApplicationWindow.overlay, {"room": currentRoom, "user": author.object, "displayName": author.displayName, "avatarMediaId": author.avatarMediaId, "avatarUrl": author.avatarUrl}).open()
cursorShape: Qt.PointingHandCursor
}
}

View File

@@ -74,7 +74,7 @@ Kirigami.OverlaySheet {
enabled: canChangeName
}
TextField {
TextArea {
id: roomTopicField
Layout.fillWidth: true
text: room.topic

View File

@@ -29,7 +29,11 @@ Kirigami.OverlaySheet {
topPadding: 0
header: Kirigami.Heading {
id: heading
text: i18nc("Account detail dialog", "Account detail - %1", displayName)
elide: Text.ElideRight
QQC2.ToolTip.visible: truncated && hovered
QQC2.ToolTip.text: text
}
contentItem: ColumnLayout {

View File

@@ -55,6 +55,18 @@ Kirigami.OverlaySheet {
text: message
Layout.fillWidth: true
wrapMode: Text.WordWrap
onLinkActivated: {
if (link.startsWith("https://matrix.to/")) {
var result = link.replace(/\?.*/, "").match("https://matrix.to/#/(!.*:.*)/(\\$.*:.*)")
if (!result || result.length < 3) return
if (result[1] != currentRoom.id) return
if (!result[2]) return
goToEvent(result[2])
} else {
Qt.openUrlExternally(link)
}
}
}
}
}

View File

@@ -11,7 +11,6 @@ import org.kde.kirigami 2.13 as Kirigami
import org.kde.neochat 1.0
import NeoChat.Component 1.0
import NeoChat.Effect 1.0
import NeoChat.Setting 1.0
import org.kde.neochat 1.0

View File

@@ -35,23 +35,26 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth + 1 // The +1 is to make sure we do not trigger eliding at max width
Layout.minimumWidth: 0
spacing: Kirigami.Units.gridUnit * 0.8
Kirigami.Heading {
level: 1
id: titleLabel
level: 2
Layout.alignment: Qt.AlignVCenter
text: page.title
opacity: page.isCurrentPage ? 1 : 0.4
maximumLineCount: 1
elide: Text.ElideRight
Layout.leftMargin: Kirigami.Units.largeSpacing
Layout.alignment: Qt.AlignBottom
}
QQC2.Label {
Layout.alignment: Qt.AlignBottom
text: currentRoom.topic
Layout.fillWidth: true
maximumLineCount: 1
//wrapMode: Text.WordWrap
Layout.alignment: Qt.AlignVCenter
anchors.baseline: lineCount < 2 ? titleLabel.baseline : undefined // necessary, since there is no way to do this with Layout.alignment
text: currentRoom.topic
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Text.ElideRight
color: Kirigami.Theme.disabledTextColor
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.9
}
}
}
@@ -121,6 +124,14 @@ Kirigami.ScrollablePage {
room: currentRoom
}
Kirigami.PlaceholderMessage {
anchors.centerIn: parent
visible: messageListView.count === 0 && !currentRoom.allHistoryLoaded
QQC2.BusyIndicator {
running: true
}
}
QQC2.Popup {
anchors.centerIn: parent

View File

@@ -10,7 +10,6 @@ import QtQuick.Layouts 1.12
import org.kde.kirigami 2.14 as Kirigami
import NeoChat.Component 1.0
import NeoChat.Effect 1.0
import NeoChat.Setting 1.0
import org.kde.neochat 1.0

View File

@@ -1,5 +1,5 @@
[Global]
IconName=neochat
IconName=org.kde.neochat
Name=Neochat
Name[ca]=Neochat
Name[ca@valencia]=Neochat

View File

@@ -52,6 +52,6 @@ Comment[uk]=Клієнт протоколу Matrix
Comment[x-test]=xxClient for the Matrix protocolxx
Exec=neochat
Terminal=false
Icon=neochat
Icon=org.kde.neochat
Type=Application
Categories=Network;InstantMessaging;

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -41,6 +41,7 @@ Kirigami.ApplicationWindow {
property alias pageStack: root.pageStack
property bool invitationOpen: false
property var roomList: null
property Item roomItem: null
readonly property bool hasOpenRoom: currentRoom !== null
@@ -51,8 +52,8 @@ Kirigami.ApplicationWindow {
if (Config.openRoom) {
const room = Controller.activeConnection.room(Config.openRoom);
currentRoom = room;
let item = pageStack.push(roomPage, { 'currentRoom': room, });
connectRoomToSignal(item);
roomItem = pageStack.push(roomPage, { 'currentRoom': room, });
connectRoomToSignal(roomItem);
} else {
// TODO create welcome page
}
@@ -61,16 +62,16 @@ Kirigami.ApplicationWindow {
function enterRoom(room) {
let item = null;
if (currentRoom != null || invitationOpen) {
currentRoom = null;
item = pageStack.replace(roomPage, { 'currentRoom': room, });
roomItem.currentRoom = room;
pageStack.currentIndex = pageStack.depth - 1;
} else {
item = pageStack.push(roomPage, { 'currentRoom': room, });
roomItem = pageStack.push(roomPage, { 'currentRoom': room, });
}
currentRoom = room;
Config.openRoom = room.id;
Config.save();
connectRoomToSignal(item);
return item;
connectRoomToSignal(roomItem);
return roomItem;
}
function openInvitation(room) {

View File

@@ -27,6 +27,10 @@ target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(neochat PRIVATE Qt5::Quick Qt5::Qml Qt5::Gui Qt5::Network Qt5::QuickControls2 KF5::I18n KF5::Kirigami2 KF5::Notifications KF5::ConfigCore KF5::ConfigGui KF5::CoreAddons Quotient cmark::cmark)
kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc)
if(NEOCHAT_FLATPAK)
target_compile_definitions(neochat PRIVATE NEOCHAT_FLATPAK)
endif()
if (KQuickImageEditor_FOUND)
target_compile_definitions(neochat PRIVATE HAS_KQUICKIMAGEEDITOR)
endif()

View File

@@ -64,7 +64,7 @@ Controller::Controller(QObject *parent)
#ifndef Q_OS_ANDROID
TrayIcon *trayIcon = new TrayIcon(this);
connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow);
trayIcon->setIconSource("neochat");
trayIcon->setIconSource("org.kde.neochat");
trayIcon->setIsOnline(true);
#endif

View File

@@ -69,11 +69,19 @@ int main(int argc, char *argv[])
about.setOrganizationDomain("kde.org");
KAboutData::setApplicationData(about);
QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("org.kde.neochat")));
#ifndef Q_OS_ANDROID
KDBusService service(KDBusService::Unique);
#endif
#ifdef NEOCHAT_FLATPAK
// Copy over the included FontConfig configuration to the
// app's config dir:
QFile::copy("/app/etc/fonts/conf.d/99-noto-mono-color-emoji.conf",
"/var/config/fontconfig/conf.d/99-noto-mono-color-emoji.conf");
#endif
Clipboard clipboard;
auto config = NeoChatConfig::self();

View File

@@ -467,6 +467,8 @@ QString NeoChatRoom::markdownToHTML(const QString &markdown)
auto result = QString::fromStdString(html).trimmed();
result.replace("<!-- raw HTML omitted -->", "<br />");
result.replace(QRegularExpression("(<br />)*$"), "");
result.replace("<p>", "");
result.replace("</p>", "");