Skip to content

Commit

Permalink
Show a small prompt to the add contact dialog on first run
Browse files Browse the repository at this point in the history
  • Loading branch information
special committed Feb 22, 2014
1 parent af67fed commit 53358c6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ui/qml/ContactList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ScrollView {
]

property QtObject selectedContact: contactsModel.contact(contactListView.currentIndex)
property ListView view: contactListView

ListView {
id: contactListView
Expand Down
34 changes: 34 additions & 0 deletions src/ui/qml/EmptyContactsHint.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0

Rectangle {
id: emptyContactsHint
x: -width + (targetButton.width / 2) + 15
y: parent.height + 14
width: text.contentWidth + 8
height: text.contentHeight + 8
color: "#c4e7ff"

property Item targetButton
property int maximumWidth

Rectangle {
rotation: 45
width: 10
height: 10
x: parent.width - 20
y: -5
color: parent.color
}

Label {
id: text
text: "Click to add contacts"
wrapMode: Text.Wrap
width: maximumWidth - 16
x: 4
y: 4
}
}

12 changes: 12 additions & 0 deletions src/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ApplicationWindow {

toolBar: ToolBar {
RowLayout {
id: toolBarLayout
width: parent.width

TorStateWidget { }
Expand All @@ -48,9 +49,19 @@ ApplicationWindow {
}

ToolButton {
id: addContactButton
action: addContactAction
implicitHeight: 24
implicitWidth: 24

Loader {
id: emptyState
active: contactList.view.count == 0
sourceComponent: EmptyContactsHint {
targetButton: addContactButton
maximumWidth: toolBarLayout.width
}
}
}

ToolButton {
Expand Down Expand Up @@ -139,4 +150,5 @@ ApplicationWindow {
id: contactList
anchors.fill: parent
}

}
1 change: 1 addition & 0 deletions src/ui/qml/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<file>AboutPreferences.qml</file>
<file>MessageDialogWrapper.qml</file>
<file>StartupStatusPage.qml</file>
<file>EmptyContactsHint.qml</file>
</qresource>
<qresource prefix="/ui/icons">
<file>plus.png</file>
Expand Down

0 comments on commit 53358c6

Please sign in to comment.