Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c96109e9b7 | ||
|
|
3f01b3badf | ||
|
|
093412c788 | ||
|
|
c5ddb61981 | ||
|
|
ad4e52b20d | ||
|
|
5991d59ddd | ||
|
|
de49a26462 | ||
|
|
4924702c15 | ||
|
|
8060edd1c6 | ||
|
|
89bf5d3a31 | ||
|
|
60762b934c | ||
|
|
7729fec259 | ||
|
|
026769b07f | ||
|
|
5be14a4b8f | ||
|
|
0b70d2b33f | ||
|
|
dab77b8d07 | ||
|
|
2acdf61b16 | ||
|
|
defa3d4b77 | ||
|
|
be709a2732 |
@@ -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
16
cmake/Flatpak.cmake
Normal 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/
|
||||
)
|
||||
|
||||
23
cmake/Flatpak/99-noto-mono-color-emoji.conf
Normal file
23
cmake/Flatpak/99-noto-mono-color-emoji.conf
Normal 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>
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ Kirigami.OverlaySheet {
|
||||
enabled: canChangeName
|
||||
}
|
||||
|
||||
TextField {
|
||||
TextArea {
|
||||
id: roomTopicField
|
||||
Layout.fillWidth: true
|
||||
text: room.topic
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[Global]
|
||||
IconName=neochat
|
||||
IconName=org.kde.neochat
|
||||
Name=Neochat
|
||||
Name[ca]=Neochat
|
||||
Name[ca@valencia]=Neochat
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
15
qml/main.qml
15
qml/main.qml
@@ -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) {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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>", "");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user