Skip to content

Commit

Permalink
Merge 02e5554 into d9032fd
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevCrow committed Jan 16, 2020
2 parents d9032fd + 02e5554 commit 5edeed2
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 13 deletions.
17 changes: 4 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/gui"
"github.com/therecipe/qt/qml"
"github.com/therecipe/qt/widgets"
)

func main() {
Expand All @@ -20,15 +19,8 @@ func main() {
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)

// Create a Qt Application
// On embedded devices, a `QGuiApplication` must be used instead
app := widgets.NewQApplication(len(os.Args), os.Args)

// Setup the splash screen
splashPixmap := gui.NewQPixmap3(":/images/resources/images/icons/appIcon/splash.png", "", core.Qt__AutoColor)
splash := widgets.NewQSplashScreen(splashPixmap, core.Qt__SplashScreen)
splash.Show()
// Process the pending `show` event
app.QCoreApplication.ProcessEvents(core.QEventLoop__AllEvents)
// Avoid using a `QApplication` as it requires `widgets` module
app := gui.NewQGuiApplication(len(os.Args), os.Args)

// Set the application information
app.SetOrganizationName("Simelo.Tech")
Expand All @@ -42,16 +34,15 @@ func main() {

engine := qml.NewQQmlApplicationEngine(nil)
// To speed up UI development, loading QML files from resources is disabled, but it must be re-enabled in order to make a release
// url := core.NewQUrl3("qrc:/ui/src/ui/main.qml", 0)
url := core.NewQUrl3("src/ui/main.qml", 0) // disable this to make a release
// url := core.NewQUrl3("qrc:/ui/src/ui/splash.qml", 0)
url := core.NewQUrl3("src/ui/splash.qml", 0) // disable this to make a release

engine.ConnectSignal(engine.ConnectObjectCreated, func(object *core.QObject, objUrl *core.QUrl) {
if object.Pointer() == nil && url.ToString(0) == objUrl.ToString(0)[len(objUrl.ToString(0)) - len(url.ToString(0)):] {
app.Exit(-1)
}
}, core.Qt__QueuedConnection)
engine.Load(url)
splash.QWidget.Close()

app.Exec()
}
1 change: 1 addition & 0 deletions qml.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/ui">
<file>src/ui/splash.qml</file>
<file>src/ui/main.qml</file>
<file>src/ui/PageWallets.qml</file>
<file>src/ui/PageSend.qml</file>
Expand Down
15 changes: 15 additions & 0 deletions src/ui/PageWallets.qml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ Page {
clip: true // limit the painting to it's bounding rectangle
model: walletModel
delegate: WalletListDelegate {}

populate: Transition {
id: transitionPopulate

SequentialAnimation {
PropertyAction { property: "opacity"; value: 0.0 }
PauseAnimation {
duration: transitionPopulate.ViewTransition.index === 0 ? 150 : 150 + (transitionPopulate.ViewTransition.index - transitionPopulate.ViewTransition.targetIndexes[0]) * 50
}
ParallelAnimation {
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 250; easing.type: Easing.OutCubic }
NumberAnimation { property: "scale"; from: 0.8; to: 1.0; duration: 250; easing.type: Easing.OutCubic }
}
}
}
}
}

Expand Down
74 changes: 74 additions & 0 deletions src/ui/splash.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Layouts 1.12

Window {
id: windowSplash

width: dialogSplash.width + 100
height: dialogSplash.height + 100
visible: true
flags: Qt.SplashScreen
color: "transparent"

Dialog {
id: dialogSplash
anchors.centerIn: Overlay.overlay
visible: true
closePolicy: Dialog.NoAutoClose

onClosed: windowSplash.visible = false

contentItem: ColumnLayout {
Image {
id: imageLogo
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
fillMode: Image.PreserveAspectFit
source: "qrc:/images/resources/images/icons/appIcon/appIcon.png"
sourceSize: "128x128"
}

Label {
id: labelApplicationName
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
text: Qt.application.name
// font.family: "???"
font.pointSize: Qt.application.font.pointSize * 2.25
}

Label {
id: labelApplicationDescription
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
text: qsTr("Multi-coin cryptocurrency wallet")
font.bold: true
}

RowLayout {
clip: true
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter

BusyIndicator {
running: visible
implicitWidth: 32
implicitHeight: implicitWidth
}
Label {
text: qsTr("Loading")
font.italic: true
}
}
} // ColumnLayout
} // Dialog

Loader {
id: loader
source: "main.qml"
asynchronous: true
visible: status == Loader.Ready

onLoaded: {
dialogSplash.close()
}
}
}

0 comments on commit 5edeed2

Please sign in to comment.