2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2017-07-15 17:11:46 +03:00
|
|
|
#pragma once
|
|
|
|
|
2019-05-01 13:11:19 +03:00
|
|
|
#include <QRegularExpression>
|
2017-12-24 14:13:07 +03:00
|
|
|
#include <QString>
|
|
|
|
|
2021-12-29 00:30:12 +03:00
|
|
|
// clazy:excludeall=non-pod-global-static
|
|
|
|
|
2017-07-15 17:11:46 +03:00
|
|
|
// Non-theme app configuration. Layouts, fonts spacing etc.
|
|
|
|
//
|
|
|
|
// Font sizes are in pixels.
|
2017-10-15 22:08:51 +03:00
|
|
|
namespace conf {
|
2017-07-15 17:11:46 +03:00
|
|
|
// Global settings.
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int fontSize = 14;
|
|
|
|
constexpr int textInputFontSize = 14;
|
|
|
|
constexpr int emojiSize = 14;
|
|
|
|
constexpr int headerFontSize = 21;
|
|
|
|
constexpr int typingNotificationFontSize = 11;
|
2017-07-15 17:11:46 +03:00
|
|
|
|
2018-03-25 00:16:15 +03:00
|
|
|
namespace popup {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int font = fontSize;
|
|
|
|
constexpr int avatar = 28;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace modals {
|
|
|
|
constexpr int errorFont = conf::fontSize - 2;
|
2018-03-25 00:16:15 +03:00
|
|
|
}
|
|
|
|
|
2018-01-03 19:05:49 +03:00
|
|
|
namespace receipts {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int font = 12;
|
2018-01-03 19:05:49 +03:00
|
|
|
}
|
|
|
|
|
2017-12-21 15:36:05 +03:00
|
|
|
namespace dialogs {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int labelSize = 15;
|
2017-12-21 15:36:05 +03:00
|
|
|
}
|
|
|
|
|
2018-07-22 18:03:12 +03:00
|
|
|
namespace modals {
|
|
|
|
constexpr int MIN_WIDGET_WIDTH = 400;
|
|
|
|
constexpr int MIN_WIDGET_HEIGHT = 400;
|
|
|
|
|
|
|
|
constexpr int WIDGET_MARGIN = 20;
|
|
|
|
constexpr int WIDGET_SPACING = 15;
|
|
|
|
constexpr int WIDGET_TOP_MARGiN = 2 * WIDGET_MARGIN;
|
|
|
|
|
|
|
|
constexpr int TEXT_SPACING = 4;
|
|
|
|
|
|
|
|
constexpr int BUTTON_SIZE = 36;
|
|
|
|
constexpr int BUTTON_RADIUS = BUTTON_SIZE / 2;
|
|
|
|
|
2018-09-25 14:41:47 +03:00
|
|
|
constexpr auto LABEL_MEDIUM_SIZE_RATIO = 1.3;
|
|
|
|
constexpr auto LABEL_BIG_SIZE_RATIO = 2;
|
2018-07-22 18:03:12 +03:00
|
|
|
}
|
|
|
|
|
2017-12-24 14:13:07 +03:00
|
|
|
namespace strings {
|
2021-12-29 00:30:12 +03:00
|
|
|
const QString url_html = QStringLiteral("<a href=\"\\1\">\\1</a>");
|
2019-05-01 13:11:19 +03:00
|
|
|
const QRegularExpression url_regex(
|
|
|
|
// match an URL, that is not quoted, i.e.
|
2020-07-09 14:26:01 +03:00
|
|
|
// vvvvvv match quote via negative lookahead/lookbehind vv
|
|
|
|
// vvvv atomic match url -> fail if there is a " before or after vvv
|
2021-12-29 00:30:12 +03:00
|
|
|
QStringLiteral(
|
|
|
|
R"((?<!["'])(?>((www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'"]+[^!,\.\s<>'"\]\)\:]))(?!["']))"));
|
2021-03-15 22:59:18 +03:00
|
|
|
// match any markdown matrix.to link. Capture group 1 is the link name, group 2 is the target.
|
2021-12-29 00:30:12 +03:00
|
|
|
static const QRegularExpression matrixToMarkdownLink(
|
|
|
|
R"(\[(.*?)(?<!\\)\]\((https://matrix.to/#/.*?\)))"); // clazy:exclude=non-pod-global-static
|
|
|
|
static const QRegularExpression matrixToLink(
|
|
|
|
R"(<a href=\"(https://matrix.to/#/.*?)\">(.*?)</a>)"); // clazy:exclude=non-pod-global-static
|
2017-12-24 14:13:07 +03:00
|
|
|
}
|
|
|
|
|
2017-07-30 13:59:28 +03:00
|
|
|
// Window geometry.
|
2017-10-15 22:08:51 +03:00
|
|
|
namespace window {
|
2018-09-30 13:37:38 +03:00
|
|
|
constexpr int height = 600;
|
|
|
|
constexpr int width = 1066;
|
|
|
|
constexpr int minModalWidth = 340;
|
2017-07-30 13:59:28 +03:00
|
|
|
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int minHeight = height;
|
|
|
|
constexpr int minWidth = 950;
|
2017-10-15 22:08:51 +03:00
|
|
|
} // namespace window
|
|
|
|
|
|
|
|
namespace textInput {
|
2018-09-29 14:05:59 +03:00
|
|
|
constexpr int height = 44;
|
2017-07-30 13:59:28 +03:00
|
|
|
}
|
|
|
|
|
2017-10-15 22:08:51 +03:00
|
|
|
namespace sidebarActions {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int height = textInput::height;
|
2018-07-20 17:44:09 +03:00
|
|
|
constexpr int iconSize = 24;
|
2017-07-15 17:11:46 +03:00
|
|
|
}
|
|
|
|
|
2017-10-15 22:08:51 +03:00
|
|
|
// Button settings.
|
|
|
|
namespace btn {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int fontSize = 20;
|
|
|
|
constexpr int cornerRadius = 3;
|
2017-10-15 22:08:51 +03:00
|
|
|
} // namespace btn
|
|
|
|
|
2017-07-15 17:11:46 +03:00
|
|
|
// RoomList specific.
|
2017-10-15 22:08:51 +03:00
|
|
|
namespace roomlist {
|
|
|
|
namespace fonts {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int heading = 13;
|
|
|
|
constexpr int timestamp = heading;
|
|
|
|
constexpr int badge = 10;
|
|
|
|
constexpr int bubble = 20;
|
|
|
|
constexpr int communityBubble = bubble - 4;
|
2017-08-20 13:47:22 +03:00
|
|
|
} // namespace fonts
|
|
|
|
} // namespace roomlist
|
2017-07-15 17:11:46 +03:00
|
|
|
|
2017-10-15 22:08:51 +03:00
|
|
|
namespace userInfoWidget {
|
|
|
|
namespace fonts {
|
2018-05-25 16:13:38 +03:00
|
|
|
constexpr int displayName = 15;
|
|
|
|
constexpr int userid = 13;
|
2017-08-20 13:47:22 +03:00
|
|
|
} // namespace fonts
|
|
|
|
} // namespace userInfoWidget
|
2017-07-15 17:11:46 +03:00
|
|
|
|
2017-10-15 22:08:51 +03:00
|
|
|
namespace topRoomBar {
|
|
|
|
namespace fonts {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int roomName = 15;
|
|
|
|
constexpr int roomDescription = 14;
|
2017-08-20 13:47:22 +03:00
|
|
|
} // namespace fonts
|
|
|
|
} // namespace topRoomBar
|
2017-07-15 17:11:46 +03:00
|
|
|
|
2017-10-15 22:08:51 +03:00
|
|
|
namespace timeline {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int msgAvatarTopMargin = 15;
|
|
|
|
constexpr int msgTopMargin = 2;
|
|
|
|
constexpr int msgLeftMargin = 14;
|
|
|
|
constexpr int avatarSize = 36;
|
|
|
|
constexpr int headerSpacing = 3;
|
|
|
|
constexpr int headerLeftMargin = 15;
|
2017-07-15 17:11:46 +03:00
|
|
|
|
2017-10-15 22:08:51 +03:00
|
|
|
namespace fonts {
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int timestamp = 13;
|
2018-07-01 19:40:53 +03:00
|
|
|
constexpr int indicator = timestamp - 2;
|
2018-05-16 20:40:42 +03:00
|
|
|
constexpr int dateSeparator = conf::fontSize;
|
2017-10-15 22:08:51 +03:00
|
|
|
} // namespace fonts
|
|
|
|
} // namespace timeline
|
2017-07-15 17:11:46 +03:00
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
} // namespace conf
|