From cb93ac3402a9b8d8862ce97d05386c52811166c5 Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Tue, 26 Jan 2021 00:03:09 -0500 Subject: [PATCH] Fix formatting --- .ci/format.sh | 10 ++++++++++ resources/qml/PrivacyScreen.qml | 27 +++++++++++++++++---------- resources/qml/TimelineView.qml | 1 + src/UserSettingsPage.cpp | 26 ++++++++++++-------------- src/UserSettingsPage.h | 7 ++++--- 5 files changed, 44 insertions(+), 27 deletions(-) diff --git a/.ci/format.sh b/.ci/format.sh index e1e6c1e4..7f201bb8 100755 --- a/.ci/format.sh +++ b/.ci/format.sh @@ -14,4 +14,14 @@ do clang-format -i "$f" done; +QMLFORMAT_PATH=$(which qmlformat) +if [ ! -z "$QMLFORMAT_PATH" ]; then + QML_FILES=$(find resources -type f -iname "*.qml") + + for f in $QML_FILES + do + qmlformat -i "$f" + done; +fi + git diff --exit-code diff --git a/resources/qml/PrivacyScreen.qml b/resources/qml/PrivacyScreen.qml index 497630f1..9fdd35e0 100644 --- a/resources/qml/PrivacyScreen.qml +++ b/resources/qml/PrivacyScreen.qml @@ -1,22 +1,24 @@ -import QtQuick 2.12 import QtGraphicalEffects 1.0 +import QtQuick 2.12 Item { property var timelineRoot property var imageSource property int screenTimeout + anchors.fill: parent Timer { id: screenSaverTimer + interval: screenTimeout * 1000 running: true onTriggered: { timelineRoot.grabToImage(function(result) { imageSource = result.url; - screenSaver.visible = true - particles.resume() - }, Qt.size(width, height)) + screenSaver.visible = true; + particles.resume(); + }, Qt.size(width, height)); } } @@ -34,13 +36,15 @@ Item { Rectangle { id: screenSaver + anchors.fill: parent visible: false color: "transparent" Image { id: image - visible : screenSaver.visible + + visible: screenSaver.visible anchors.fill: parent source: imageSource } @@ -50,11 +54,12 @@ Item { sourceItem: image anchors.fill: image - sourceRect: Qt.rect(0,0, width, height) + sourceRect: Qt.rect(0, 0, width, height) } - FastBlur{ + FastBlur { id: blur + anchors.fill: effectSource source: effectSource radius: 50 @@ -64,11 +69,13 @@ Item { anchors.fill: parent propagateComposedEvents: true hoverEnabled: true - onClicked: { + onClicked: { screenSaver.visible = false; screenSaverTimer.restart(); - mouse.accepted = false + mouse.accepted = false; } } + } -} \ No newline at end of file + +} diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 5f43de55..35d09d5a 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -189,6 +189,7 @@ Page { ColumnLayout { id: timelineLayout + visible: TimelineManager.timeline != null anchors.fill: parent spacing: 0 diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 1875e4f9..a8558e95 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -87,16 +87,16 @@ UserSettings::load(std::optional profile) settings.value("user/timeline/message_hover_highlight", false).toBool(); enlargeEmojiOnlyMessages_ = settings.value("user/timeline/enlarge_emoji_only_msg", false).toBool(); - markdown_ = settings.value("user/markdown_enabled", true).toBool(); - typingNotifications_ = settings.value("user/typing_notifications", true).toBool(); - sortByImportance_ = settings.value("user/sort_by_unread", true).toBool(); - readReceipts_ = settings.value("user/read_receipts", true).toBool(); - theme_ = settings.value("user/theme", defaultTheme_).toString(); - font_ = settings.value("user/font_family", "default").toString(); - avatarCircles_ = settings.value("user/avatar_circles", true).toBool(); - decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool(); - privacyScreen_ = settings.value("user/privacy_screen", false).toBool(); - privacyScreenTimeout_ = settings.value("user/privacy_screen_timeout", 0).toInt(); + markdown_ = settings.value("user/markdown_enabled", true).toBool(); + typingNotifications_ = settings.value("user/typing_notifications", true).toBool(); + sortByImportance_ = settings.value("user/sort_by_unread", true).toBool(); + readReceipts_ = settings.value("user/read_receipts", true).toBool(); + theme_ = settings.value("user/theme", defaultTheme_).toString(); + font_ = settings.value("user/font_family", "default").toString(); + avatarCircles_ = settings.value("user/avatar_circles", true).toBool(); + decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool(); + privacyScreen_ = settings.value("user/privacy_screen", false).toBool(); + privacyScreenTimeout_ = settings.value("user/privacy_screen_timeout", 0).toInt(); shareKeysWithTrustedUsers_ = settings.value("user/share_keys_with_trusted_users", true).toBool(); mobileMode_ = settings.value("user/mobile_mode", false).toBool(); @@ -842,7 +842,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge boxWrap(tr("Privacy screen timeout"), privacyScreenTimeout_, tr("Set timeout for how long after window loses\nfocus before the screen" - " will be blurred.\nSet to 0 to blur immediately after focus loss.")); + " will be blurred.\nSet to 0 to blur immediately after focus loss.")); boxWrap(tr("Show buttons in timeline"), timelineButtonsToggle_, tr("Show buttons to quickly reply, react or access additional options next to each " @@ -1168,9 +1168,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge connect(privacyScreenTimeout_, qOverload(&QSpinBox::valueChanged), this, - [this](int newValue) { - settings_->setPrivacyScreenTimeout(newValue); - }); + [this](int newValue) { settings_->setPrivacyScreenTimeout(newValue); }); connect( sessionKeysImportBtn, &QPushButton::clicked, this, &UserSettingsPage::importSessionKeys); diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index 7e475c3b..8654afcf 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -67,9 +67,10 @@ class UserSettings : public QObject bool avatarCircles READ avatarCircles WRITE setAvatarCircles NOTIFY avatarCirclesChanged) Q_PROPERTY(bool decryptSidebar READ decryptSidebar WRITE setDecryptSidebar NOTIFY decryptSidebarChanged) - Q_PROPERTY(bool privacyScreen READ privacyScreen WRITE setPrivacyScreen NOTIFY - privacyScreenChanged) - Q_PROPERTY(int privacyScreenTimeout READ privacyScreenTimeout WRITE setPrivacyScreenTimeout NOTIFY privacyScreenTimeoutChanged) + Q_PROPERTY( + bool privacyScreen READ privacyScreen WRITE setPrivacyScreen NOTIFY privacyScreenChanged) + Q_PROPERTY(int privacyScreenTimeout READ privacyScreenTimeout WRITE setPrivacyScreenTimeout + NOTIFY privacyScreenTimeoutChanged) Q_PROPERTY(int timelineMaxWidth READ timelineMaxWidth WRITE setTimelineMaxWidth NOTIFY timelineMaxWidthChanged) Q_PROPERTY(bool mobileMode READ mobileMode WRITE setMobileMode NOTIFY mobileModeChanged)