ClientLauncher.qml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import QtQuick 2.0
  2. Item {
  3. readonly property alias isRunning: script.isRunning
  4. readonly property string gamePath: settings.gamePath
  5. Script {
  6. id: script
  7. workingDirectory: gamePath
  8. property bool stopRequested: false
  9. onOutputRead: {
  10. ui.log(output)
  11. }
  12. onFinished: {
  13. if (stopRequested) {
  14. stopRequested = false
  15. // so trying to kill .exe via script
  16. startClientWrapper("stop")
  17. }
  18. }
  19. function startClientWrapper(command) {
  20. start(scriptsPath + "client-wrapper", [command])
  21. }
  22. }
  23. function start() {
  24. script.stopRequested = false
  25. ui.log("")
  26. ui.log(qsTr("Starting client..."))
  27. script.startClientWrapper("start")
  28. }
  29. function stop() {
  30. script.stopRequested = true
  31. ui.log(qsTr("Terminating client..."))
  32. script.terminate() // doesn't work as it could.
  33. }
  34. function killWineServer() {
  35. ui.log(qsTr("Killing Wine server..."))
  36. script.startClientWrapper("killwineserver")
  37. }
  38. }