-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gallery: basic model/view for notifications #2765
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
import QtQuick | ||
import QtQuick.Controls | ||
import QtQuick.Controls.Basic | ||
import "../Style.js" as Style | ||
import "." | ||
|
||
Drawer { | ||
id: control | ||
|
||
property alias picture: picture.source | ||
property alias title: title.text | ||
property alias description: description.text | ||
property alias boundedDescription: boundedDescription.text | ||
property alias primaryButton: primaryButton.text | ||
property alias secondaryButton: secondaryButton.text | ||
property alias specialComponent: loader.sourceComponent | ||
|
||
width: window.width | ||
height: mainColumn.height | ||
edge: Qt.BottomEdge | ||
|
||
Rectangle { | ||
id: roundedRect | ||
|
||
anchors.fill: parent | ||
color: Style.white | ||
radius: Style.commonSpacing | ||
|
||
// Make the bottom corners more rounded by masking them | ||
Rectangle { | ||
anchors.bottom: parent.bottom | ||
anchors.left: parent.left | ||
anchors.right: parent.right | ||
height: roundedRect.radius | ||
color: Style.white | ||
} | ||
|
||
Column { | ||
id: mainColumn | ||
|
||
width: parent.width | ||
spacing: Style.commonSpacing | ||
padding: Style.commonSpacing | ||
|
||
Image { | ||
id: closeButton | ||
|
||
source: Style.closeButtonIcon | ||
anchors.right: parent.right | ||
anchors.rightMargin: Style.commonSpacing | ||
|
||
MouseArea { | ||
anchors.fill: parent | ||
onClicked: control.visible = false | ||
} | ||
} | ||
|
||
Image { | ||
id: picture | ||
|
||
anchors.horizontalCenter: parent.horizontalCenter | ||
} | ||
|
||
Text { | ||
id: title | ||
|
||
anchors.horizontalCenter: parent.horizontalCenter | ||
font: Qt.font(Style.t1) | ||
width: parent.width - 2*Style.commonSpacing | ||
color: Style.forest | ||
visible: text.length > 0 | ||
horizontalAlignment: Text.AlignHCenter | ||
} | ||
|
||
Text { | ||
id: description | ||
|
||
anchors.horizontalCenter: parent.horizontalCenter | ||
font: Qt.font(Style.p5) | ||
width: parent.width - 2*Style.commonSpacing | ||
color: Style.night | ||
visible: text.length > 0 | ||
horizontalAlignment: Text.AlignHCenter | ||
wrapMode: Text.WordWrap | ||
lineHeight: 1.6 | ||
} | ||
|
||
Rectangle { | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
visible: boundedDescription.text.length > 0 | ||
width: parent.width - 2*Style.commonSpacing | ||
height: boundedDescription.height | ||
radius: 16 * __dp | ||
|
||
color: Style.lightGreen | ||
|
||
Text { | ||
id: boundedDescription | ||
|
||
anchors.horizontalCenter: parent.horizontalCenter | ||
font: Qt.font(Style.p6) | ||
width: parent.width | ||
color: Style.night | ||
visible: text.length > 0 | ||
horizontalAlignment: Text.AlignLeft | ||
wrapMode: Text.WordWrap | ||
lineHeight: 1.6 | ||
padding: Style.commonSpacing | ||
} | ||
} | ||
|
||
Loader { | ||
id: loader | ||
|
||
anchors.horizontalCenter: parent.horizontalCenter | ||
} | ||
|
||
Item { width: 1; height: 1 } | ||
|
||
MMButton { | ||
id: primaryButton | ||
|
||
width: parent.width - 2*Style.commonSpacing | ||
visible: text.length > 0 | ||
|
||
onClicked: control.visible = false | ||
} | ||
|
||
MMButton { | ||
id: secondaryButton | ||
|
||
width: parent.width - 2*Style.commonSpacing | ||
visible: text.length > 0 | ||
transparent: true | ||
topPadding: 0 | ||
|
||
onClicked: control.visible = false | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
import QtQuick | ||
import "../Style.js" as Style | ||
|
||
Row { | ||
id: notification | ||
|
||
width: listView.width * 0.95 | ||
height: 25 | ||
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined | ||
|
||
Rectangle { | ||
width: parent.width | ||
height: parent.height | ||
color: "#BBFFFFFF" // Style.white | ||
border.color: Style.mediumGreen | ||
border.width: 1 | ||
radius: 5 | ||
Text { | ||
anchors.fill: parent | ||
anchors.leftMargin: 5 | ||
text: message | ||
color: Style.forest | ||
verticalAlignment: Text.AlignVCenter | ||
horizontalAlignment: Text.AlignRight | ||
rightPadding: 20 | ||
} | ||
Text { | ||
anchors.right: parent.right | ||
anchors.rightMargin: 5 | ||
height: parent.height | ||
verticalAlignment: Text.AlignVCenter | ||
scale: maRemove.containsMouse ? 1.2 : 1 | ||
text: "✘" | ||
color: maRemove.containsMouse ? Style.forest : Style.mediumGreen | ||
MouseArea { | ||
id: maRemove | ||
anchors.fill: parent | ||
hoverEnabled: true | ||
onClicked: _notificationModel.remove(id) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
import QtQuick | ||
import "../Style.js" as Style | ||
|
||
Item { | ||
id: control | ||
|
||
z: 100 | ||
anchors.top: parent.top | ||
width: parent.width | ||
height: parent.height | ||
|
||
Rectangle { | ||
anchors.bottom: parent.bottom | ||
width: control.width | ||
height: 20 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From style |
||
color: Style.white | ||
|
||
Text { | ||
text: listView.count | ||
anchors.centerIn: parent | ||
color: Style.forest | ||
} | ||
} | ||
|
||
ListView { | ||
id: listView | ||
|
||
anchors.top: parent.top | ||
width: parent.width | ||
height: 25 * listView.count + spacing * (listView.count - 1) | ||
spacing: 3 | ||
clip: true | ||
model: _notificationModel | ||
delegate: MMNotification { | ||
|
||
} | ||
|
||
add: Transition { | ||
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 } | ||
NumberAnimation { property: "scale"; easing.type: Easing.OutCubic; from: 0; to: 1.0; duration: 200 } | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
z