Skip to content

Commit

Permalink
Improved animation and added config module
Browse files Browse the repository at this point in the history
  • Loading branch information
Iktwo committed Aug 27, 2016
1 parent 7e6b86b commit cdc22ce
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/qml/ApplicationGrid.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ScrollView {
text: model.name

onClicked: PackageManager.launchApplication(model.packageName)
// onPressAndHold: root.pressAndHold(model)
onPressAndHold: root.pressAndHold(model)
}

onHeightChanged: {
Expand Down
18 changes: 11 additions & 7 deletions src/qml/ExpandableItem.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QtQuick 2.5
import com.iktwo.qutelauncher 1.0
import config 1.0 as Config

Item {
default property alias content: itemContainer.data
Expand Down Expand Up @@ -39,7 +40,7 @@ Item {
Rectangle {
id: rectangleMinizedIndicator

color: "#f5f5f5"
color: Config.Theme.colorGridContainer

width: minimizedWidth
height: minimizedHeight
Expand Down Expand Up @@ -92,14 +93,14 @@ Item {
to: "opened"
reversible: true
ParallelAnimation {
PropertyAnimation { property: "y"; duration: 350; easing.type: Easing.InOutCubic }
PropertyAnimation { property: "y"; duration: 275; easing.type: Easing.InOutCubic }

SequentialAnimation {
PauseAnimation { duration: 250 }
PauseAnimation { duration: 50 }
ParallelAnimation {
PropertyAnimation { target: rectangleMinizedIndicator; properties: "height, width"; easing.type: Easing.InOutCubic }
PropertyAnimation { target: rectangleMinizedIndicator; property: "radius"; easing.type: Easing.InOutCubic }
PropertyAnimation { target: rectangleMinizedIndicator; property: "x"; easing.type: Easing.InOutCubic }
PropertyAnimation { target: rectangleMinizedIndicator; properties: "height, width"; easing.type: Easing.InOutCubic; duration: 250 }
PropertyAnimation { target: rectangleMinizedIndicator; property: "radius"; easing.type: Easing.InOutCubic; duration: 250 }
PropertyAnimation { target: rectangleMinizedIndicator; property: "x"; easing.type: Easing.InOutCubic; duration: 250 }
SequentialAnimation {
PauseAnimation { duration: 150 }
PropertyAnimation { target: itemContainer; property: "opacity"; easing.type: Easing.InOutCubic}
Expand All @@ -114,7 +115,10 @@ Item {
Item {
id: itemContainer

anchors.centerIn: rectangleMinizedIndicator
anchors {
right: rectangleMinizedIndicator.right; rightMargin: -ScreenValues.dp
verticalCenter: rectangleMinizedIndicator.verticalCenter
}

width: targetWidth
height: targetHeight
Expand Down
4 changes: 3 additions & 1 deletion src/qml/IntroView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ FocusScope {

snapMode: ListView.SnapToItem

boundsBehavior: Flickable.StopAtBounds

onContentXChanged: {
if (previousX > contentX)
movingLeft = true
Expand All @@ -95,7 +97,7 @@ FocusScope {
highlightRangeMode: ListView.StrictlyEnforceRange

preferredHighlightBegin: 0
preferredHighlightEnd: width / 2
preferredHighlightEnd: width

delegate: Rectangle {
height: ListView.view.height
Expand Down
7 changes: 7 additions & 0 deletions src/qml/config/Dimensions.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pragma Singleton
import QtQuick 2.0
import com.iktwo.qutelauncher 1.0 as QL

Item {
property int navbarShadowBorderSize: 5 * QL.ScreenValues.dp
}
6 changes: 6 additions & 0 deletions src/qml/config/Theme.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pragma Singleton
import QtQuick 2.0

Item {
property color colorGridContainer: "#f5f5f5"
}
2 changes: 2 additions & 0 deletions src/qml/config/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
singleton Dimensions 1.0 Dimensions.qml
singleton Theme 1.0 Theme.qml
22 changes: 12 additions & 10 deletions src/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Window 2.2
import com.iktwo.qutelauncher 1.0
import config 1.0 as Config

ApplicationWindow {
id: applicationWindow
Expand Down Expand Up @@ -106,10 +107,10 @@ ApplicationWindow {
height: ScreenValues.statusBarHeight

border {
left: 5 * ScreenValues.dp
top: 5 * ScreenValues.dp
right: 5 * ScreenValues.dp
bottom: 5 * ScreenValues.dp
left: Config.Dimensions.navbarShadowBorderSize
top: Config.Dimensions.navbarShadowBorderSize
right: Config.Dimensions.navbarShadowBorderSize
bottom: Config.Dimensions.navbarShadowBorderSize
}

source: "qrc:/images/shadow"
Expand All @@ -128,10 +129,10 @@ ApplicationWindow {
source: ScreenValues.navBarVisible ? "qrc:/images/shadow_navigationbar" : ""

border {
left: 5 * ScreenValues.dp
top: 5 * ScreenValues.dp
right: 5 * ScreenValues.dp
bottom: 5 * ScreenValues.dp
left: Config.Dimensions.navbarShadowBorderSize
top: Config.Dimensions.navbarShadowBorderSize
right: Config.Dimensions.navbarShadowBorderSize
bottom: Config.Dimensions.navbarShadowBorderSize
}
}

Expand All @@ -154,8 +155,9 @@ ApplicationWindow {
anchors.fill: parent

onPressAndHold: {
applicationTile.source = "image://icon/" + model.packageName
applicationTile.text = model.name
/// TODO: implement this
// applicationTile.source = "image://icon/" + model.packageName
// applicationTile.text = model.name

explandableItem.close()
}
Expand Down
3 changes: 3 additions & 0 deletions src/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<file>qml/ExpandableItem.qml</file>
<file>qml/ApplicationTile.qml</file>
<file>qml/IntroView.qml</file>
<file>qml/config/qmldir</file>
<file>qml/config/Theme.qml</file>
<file>qml/config/Dimensions.qml</file>
</qresource>
<qresource prefix="/images">
<file alias="test">resources/images/test.png</file>
Expand Down
2 changes: 2 additions & 0 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ android {
android/AndroidManifest.xml
}

QML_IMPORT_PATH = $$PWD/qml

ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android

HEADERS += $$files($$PWD/src/*.h)
Expand Down
1 change: 1 addition & 0 deletions src/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ int main(int argc, char *argv[])
qmlRegisterSingletonType<Launcher>("com.iktwo.qutelauncher", 1, 0, "Launcher", launcher_provider);

engine.addImageProvider(QLatin1String("icon"), new IconImageProvider());
engine.addImportPath("qrc:/qml/qml");

engine.load(QUrl("qrc:/qml/qml/main.qml"));

Expand Down

0 comments on commit cdc22ce

Please sign in to comment.