From 6835a97b15f642829ffe168464aeb1eae8f7b6a9 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 24 Dec 2017 13:13:07 +0200 Subject: Use a better regex to identify URLs --- include/Config.h | 9 +++++++++ include/TopRoomBar.h | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/Config.h b/include/Config.h index 781e910c..805e7c02 100644 --- a/include/Config.h +++ b/include/Config.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + // Non-theme app configuration. Layouts, fonts spacing etc. // // Font sizes are in pixels. @@ -16,6 +19,12 @@ namespace dialogs { static constexpr int labelSize = 15; } +namespace strings { +static const QString url_html = "\\1"; +static const QRegExp url_regex( + "((www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]\\)\\:])"); +} + // Window geometry. namespace window { static constexpr int height = 600; diff --git a/include/TopRoomBar.h b/include/TopRoomBar.h index 471662a4..13eaaa38 100644 --- a/include/TopRoomBar.h +++ b/include/TopRoomBar.h @@ -36,9 +36,6 @@ class Menu; class OverlayModal; class RoomSettings; -static const QString URL_HTML = "\\1"; -static const QRegExp URL_REGEX("((?:https?|ftp)://\\S+)"); - class TopRoomBar : public QWidget { Q_OBJECT -- cgit 1.5.1