From b30211f43c08dd807bec44b7f3b68ff6121cf3e1 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 26 Apr 2022 16:46:25 +0200 Subject: [PATCH 1/6] Fix scaling of animated images in fullscreen image viewer --- src/ui/MxcAnimatedImage.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ui/MxcAnimatedImage.cpp b/src/ui/MxcAnimatedImage.cpp index b8e707bb..2f3af137 100644 --- a/src/ui/MxcAnimatedImage.cpp +++ b/src/ui/MxcAnimatedImage.cpp @@ -153,8 +153,11 @@ MxcAnimatedImage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGe QQuickItem::geometryChanged(newGeometry, oldGeometry); if (newGeometry.size() != oldGeometry.size()) { - if (height() != 0 && width() != 0) - movie.setScaledSize(newGeometry.size().toSize()); + if (height() != 0 && width() != 0) { + QSizeF r = movie.scaledSize(); + r.scale(newGeometry.size(), Qt::KeepAspectRatio); + movie.setScaledSize(r.toSize()); + } } } @@ -184,7 +187,10 @@ MxcAnimatedImage::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeD return nullptr; } - n->setRect(0, 0, width(), height()); + QSizeF r = img.size(); + r.scale(size(), Qt::KeepAspectRatio); + + n->setRect((width() - r.width()) / 2, (height() - r.height()) / 2, r.width(), r.height()); n->setFiltering(QSGTexture::Linear); n->setMipmapFiltering(QSGTexture::None); From 8436b5c498e4037657688ec5b16249bc6df8d713 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Tue, 19 Apr 2022 23:42:47 -0400 Subject: [PATCH 2/6] Allow users to see through the spinner --- resources/qml/TimelineView.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index a7bfe1ef..87e931df 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -46,6 +46,15 @@ Item { // height is somewhat arbitrary here... don't set width because width scales w/ height height: parent.height / 16 z: 3 + opacity: hh.hovered ? 0.3 : 1 + + Behavior on opacity { + NumberAnimation { duration: 100; } + } + + HoverHandler { + id: hh + } } ColumnLayout { From e9112912b879f795959efc3892b2d6cde634c9ed Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Tue, 19 Apr 2022 23:43:00 -0400 Subject: [PATCH 3/6] Better handle pluralization --- resources/qml/TimelineView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 87e931df..fc5a5ead 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -208,7 +208,7 @@ Item { Layout.alignment: Qt.AlignHCenter MatrixText { - text: qsTr("%1 member(s)").arg(room ? room.roomMemberCount : 0) + text: qsTr("%n member(s)", "", room ? room.roomMemberCount : 0) cursorShape: Qt.PointingHandCursor } From a75ee1a61884b494305b26737698af6bdc7eb642 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Thu, 21 Apr 2022 23:19:14 -0400 Subject: [PATCH 4/6] Set default size for hidden events dialog --- resources/qml/dialogs/HiddenEventsDialog.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/dialogs/HiddenEventsDialog.qml b/resources/qml/dialogs/HiddenEventsDialog.qml index e0e79604..444ce6a1 100644 --- a/resources/qml/dialogs/HiddenEventsDialog.qml +++ b/resources/qml/dialogs/HiddenEventsDialog.qml @@ -17,6 +17,8 @@ ApplicationWindow { modality: Qt.NonModal flags: Qt.Dialog | Qt.WindowTitleHint + width: 275 + height: 220 minimumWidth: 250 minimumHeight: 220 From 05e6dd9d0d1e03aa1b1c7f5b8bb039c0a7e12da0 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Sat, 23 Apr 2022 18:53:22 -0400 Subject: [PATCH 5/6] Modifications to member list buttons --- resources/qml/TimelineView.qml | 1 - resources/qml/dialogs/RoomSettings.qml | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index fc5a5ead..a9d48fb9 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -209,7 +209,6 @@ Item { MatrixText { text: qsTr("%n member(s)", "", room ? room.roomMemberCount : 0) - cursorShape: Qt.PointingHandCursor } ImageButton { diff --git a/resources/qml/dialogs/RoomSettings.qml b/resources/qml/dialogs/RoomSettings.qml index 110475c7..4a7b24fe 100644 --- a/resources/qml/dialogs/RoomSettings.qml +++ b/resources/qml/dialogs/RoomSettings.qml @@ -159,22 +159,25 @@ ApplicationWindow { } + RowLayout { + spacing: Nheko.paddingMedium + Layout.alignment: Qt.AlignHCenter + Label { text: qsTr("%n member(s)", "", roomSettings.memberCount) - Layout.alignment: Qt.AlignHCenter color: Nheko.colors.text - - TapHandler { - onSingleTapped: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId)) - } - - CursorShape { - cursorShape: Qt.PointingHandCursor - anchors.fill: parent - } - } + ImageButton { + image: ":/icons/icons/ui/people.svg" + hoverEnabled: true + ToolTip.visible: hovered + ToolTip.text: qsTr("View members of %1").arg(roomSettings.roomName) + onClicked: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId)) + } + + } + TextArea { id: roomTopic property bool cut: implicitHeight > 100 From e6b6a76437920cb3abd72db2b28dd7570ee3b8ad Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Thu, 28 Apr 2022 19:34:05 -0400 Subject: [PATCH 6/6] Specify every linter option --- .clang-format | 168 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 159 insertions(+), 9 deletions(-) diff --git a/.clang-format b/.clang-format index e9ebcb6d..ed1c696b 100644 --- a/.clang-format +++ b/.clang-format @@ -1,15 +1,165 @@ --- -Language: Cpp -Standard: c++17 +Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: true +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: Consecutive +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: InlineOnly -BasedOnStyle: Mozilla -ColumnLimit: 100 -IndentCaseLabels: false -IndentWidth: 4 -KeepEmptyLinesAtTheStartOfBlocks: false -PointerAlignment: Right +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: TopLevel +AlwaysBreakAfterReturnType: TopLevel +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: + - __capability +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: Never + AfterEnum: true + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: false + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: true +BreakBeforeBraces: Mozilla +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeComma +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 100 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: false +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +StatementAttributeLikeMacros: + - Q_EMIT +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 1 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentCaseLabels: false +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: AfterExternBlock +IndentRequires: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: false +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 0 +PenaltyIndentedWhitespace: 0 +PointerAlignment: Right +ReflowComments: true +SortIncludes: true +SortJavaStaticImport: Before +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceAroundPointerQualifiers: Default +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +BitFieldColonSpacing: Both +Standard: c++17 +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseCRLF: false +UseTab: Never +WhitespaceSensitiveMacros: + - STRINGIZE + - PP_STRINGIZE + - BOOST_PP_STRINGIZE + - NS_SWIFT_NAME + - CF_SWIFT_NAME +... +