Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
vranki committed Dec 29, 2013
1 parent 73788ec commit 03fb4e5
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 17 deletions.
8 changes: 6 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
}
}

// viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
// viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // @todo how to do this in Qt5?
shm.setContextProperties(); // Root ctx may change when loading, so redo this
//viewer.showExpanded();
#ifdef FULLSCREEN
viewer.showFullScreen();
#else
viewer.resize(540, 960);
viewer.show();
#endif
shm.launchSiilihai(false);
int ret = app.exec();
// Ugly hack to make sure Siilihai quits graceously after swipe close
Expand Down
57 changes: 57 additions & 0 deletions qml/siilihai-mobile-nocomponents/InactiveScreen.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import QtQuick 2.0

Rectangle {
property int busyforums: 0
property int totalforums: subscriptions.length
visible: !Qt.application.active
anchors.fill: parent

gradient: Gradient {
GradientStop {
position: 0;
color: "#71c2ff";
}
GradientStop {
position: 1;
color: "#646464";
}
}

Image {
source: "gfx/siilis3.png"
anchors.centerIn: parent
}

Item {
width: parent.width*0.98
height: parent.height / 4
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: parent.height/10
opacity: 0.5
visible: busyforums
Rectangle {
anchors.fill: parent
color: "transparent"
border.color: "white"
border.width: parent.width / 50
}
Rectangle {
height: parent.height
width: totalforums ? parent.width * ((totalforums - busyforums) / totalforums) : 0
color: "white"
}
}

Timer {
running: parent.visible
repeat: true
onTriggered: {
var busycount = 0
for(var i=0;i<subscriptions.length;i++) {
if(subscriptions[i].beingUpdated || subscriptions[i].beingSynced || subscriptions[i].scheduledForUpdate) busycount++;
}
busyforums = busycount
}
}
}
9 changes: 7 additions & 2 deletions qml/siilihai-mobile-nocomponents/MessageListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ ListView {
footer: Column {
width: parent.width * 0.5
anchors.horizontalCenter: parent.horizontalCenter
spacing: 10
spacing: 20
Item {
width: 1
height: 1
height: 50
}
ButtonWithUnreadCount {
text: "Download more messages"
Expand All @@ -44,6 +44,11 @@ ListView {
onClicked: markAll(false)
icon: "gfx/Gnome-mail-mark-unread.svg"
}
Item {
width: 1
height: toolbar.height
}

}
ButtonWithUnreadCount {
anchors.fill: parent
Expand Down
2 changes: 1 addition & 1 deletion qml/siilihai-mobile-nocomponents/SettingsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SimpleDialog {
color: color_b_text
font.pointSize: headerPointSize
}
SimpleButton {
ConfirmationButton {
text: "Unregister this copy of Siilihai"
onClicked: siilihaimobile.unregisterSiilihai()
anchors.horizontalCenter: parent.horizontalCenter
Expand Down
2 changes: 1 addition & 1 deletion qml/siilihai-mobile-nocomponents/ThreadListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ListView {
icon: "gfx/Gnome-folder-open.svg"
}
delegate: ThreadButton {}
footer: Item {width: 1; height: 50}
footer: Item { width: 1; height: toolbar.height}
ButtonWithUnreadCount {
anchors.fill: parent
z: -10
Expand Down
7 changes: 7 additions & 0 deletions qml/siilihai-mobile-nocomponents/Toolbar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import QtQuick 2.0
Item {
width: parent.width
height: 80
Rectangle {
color: "black"
opacity: 0.5
anchors.fill: parent
}
Row {
anchors.fill: parent
ToolbarButton {
Expand All @@ -23,6 +28,7 @@ Item {
ToolbarButton {
image: "gfx/Gnome-view-refresh.svg"
onClicked: siilihaimobile.updateClicked()
visible: !subscribeForumDialog.topItem && !threadListView.topItem && !messageListView.topItem
}
ToolbarButton {
id: scrollDownButton
Expand Down Expand Up @@ -54,6 +60,7 @@ Item {
ToolbarButton {
image: "gfx/Gnome-preferences-system.svg"
onClicked: settingsDialog.topItem = true
visible: !subscribeForumDialog.topItem && !threadListView.topItem && !messageListView.topItem
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SimpleDialog {
username: selectedforum ? selectedforum.username : ""
password: selectedforum ? selectedforum.password : ""
}
SimpleButton {
ConfirmationButton {
text: "Unsubscribe forum"
width: parent.width / 3
buttonColor: "red"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ SimpleButton {
height: 42 + (isSelectedForum ? forumDetails.height + 20 : 0)
Behavior on height { SmoothedAnimation { velocity: 800 } }
onClicked: {
if(isSelectedForum) return
enterUrl = false
subscribeForumDialog.subscribeForumId = forumId
siilihaimobile.getForumDetails(modelData.forumId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ SimpleDialog {
width: parent.width
}
SubscribeCustomButton {}
Item {width: 1;height: 50}
}
model: forumList
delegate: SubscribeForumButton { }
footer: Item {width: 1;height: toolbar.height}
}
}
21 changes: 13 additions & 8 deletions qml/siilihai-mobile-nocomponents/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import QtQuick 2.0
import "forum"
import "account"

Image {
Item {
property string color1: "#7d7dc0"
property string color2: "#ffd884"
property string colorDark: "#003e5e"
Expand All @@ -19,22 +19,26 @@ Image {

property int defaultButtonHeight: 32
property int tallButtonHeight: 42

source: "gfx/backbround-bright.png"
fillMode: Image.Tile

Image {
source: "gfx/backbround-bright.png"
fillMode: Image.Tile
width: parent.width
height: parent.height*2 + forumListView.height
y: -parent.height - forumListView.contentY
}
ForumListView {
id: forumListView
property bool topItem: !threadListView.topItem && !messageListView.topItem
width: parent.width * 0.98
height: parent.height - toolbar.height
anchors.horizontalCenter: parent.horizontalCenter
HideEffect {}
}
ThreadListView {
id: threadListView
property bool topItem: siilihaimobile.selectedGroupId
width: parent.width
height: parent.height - toolbar.height
height: parent.height
x: topItem ? 0 : parent.width
Behavior on x { SmoothedAnimation { velocity: 1500; easing.type: Easing.InOutQuad } }
HideEffect {}
Expand All @@ -43,15 +47,15 @@ Image {
id: messageListView
property bool topItem: siilihaimobile.selectedThreadId
width: parent.width
height: parent.height - toolbar.height
height: parent.height
x: topItem ? 0 : parent.width
Behavior on x { SmoothedAnimation { velocity: 1500; easing.type: Easing.InOutQuad } }
HideEffect {}
}
SubscribeForumDialog {
id: subscribeForumDialog
width: parent.width
height: parent.height - toolbar.height
height: parent.height
}

Toolbar {
Expand All @@ -72,4 +76,5 @@ Image {
}
CredentialsDialog {}
MessageDialog {}
InactiveScreen {}
}
29 changes: 29 additions & 0 deletions qml/siilihai-mobile-nocomponents/widgets/ConfirmationButton.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import QtQuick 2.0

SimpleButton {
property string origText: text
buttonColor: "red"
MouseArea {
anchors.fill: parent
onPressed: {
hintText.visible = true
origText = text
text = "Hold to confirm"
}
onPressAndHold: {
hintText.visible = false
text = origText
parent.clicked(mouse)
}
onReleased: {
hintText.visible = false
text = origText
}
}
Text {
id: hintText
color: buttonColor
anchors.centerIn: parent
visible: false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import QtQuick 2.0
import ".."

SimpleButton {
property string text: ""
property bool checked: false
anchors.horizontalCenter: parent.horizontalCenter
outline: false
Expand Down
8 changes: 7 additions & 1 deletion siilihaimobile.pro
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ HEADERS += siilihaimobile.h
OTHER_FILES += \
rpm/harbour-siilihai-mobile.spec \
rpm/harbour-siilihai-mobile.yaml \
harbour-siilihai-mobile.desktop
harbour-siilihai-mobile.desktop \
qml/siilihai-mobile-nocomponents/InactiveScreen.qml \
qml/siilihai-mobile-nocomponents/widgets/ConfirmationButton.qml

OTHER_FILES += debian/rules \
debian/control\
Expand Down Expand Up @@ -108,6 +110,10 @@ OTHER_FILES += debian/rules \
android/src/org/qtproject/qt5/android/bindings/QtApplication.java \
android/src/org/qtproject/qt5/android/bindings/QtActivity.java


android|nemo {
DEFINES += FULLSCREEN
}
#desktops.files = siilihai-mobile.desktop
#desktops.path = /usr/share/applications

Expand Down

0 comments on commit 03fb4e5

Please sign in to comment.