Application.qml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright (C) 2015 Malte Veerman <maldela@halloarsch.de>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. *
  18. */
  19. import QtQuick 2.4
  20. import QtQuick.Controls 1.3
  21. import QtQuick.Dialogs 1.2
  22. import QtQuick.Layouts 1.1
  23. ApplicationWindow {
  24. id: window
  25. title: i18n("Fancontrol-GUI")
  26. width: 1024
  27. height: 768
  28. visible: true
  29. menuBar: MenuBar {
  30. Menu {
  31. title: i18n("File")
  32. MenuItem { action: loadAction }
  33. MenuItem { action: saveAction }
  34. MenuItem {
  35. text: i18n("Save configuration file as")
  36. onTriggered: saveFileDialog.open()
  37. shortcut: StandardKey.SaveAs
  38. }
  39. MenuItem {
  40. text: i18n("Exit")
  41. onTriggered: Qt.quit()
  42. shortcut: StandardKey.Quit
  43. }
  44. }
  45. }
  46. toolBar: ToolBar {
  47. RowLayout {
  48. anchors.fill: parent
  49. ToolButton { action: loadAction }
  50. ToolButton { action: saveAction }
  51. Loader {
  52. active: base.hasSystemdCommunicator()
  53. sourceComponent: ToolButton {
  54. iconName: base.systemdCom.serviceActive ? "system-reboot" : "system-run"
  55. onClicked: base.systemdCom.serviceActive ? base.systemdCom.restartService() : base.systemdCom.serviceActive = true;
  56. tooltip: base.systemdCom.serviceActive ? i18n("Restart fancontrol") : i18n("Start fancontrol")
  57. }
  58. }
  59. Loader {
  60. active: base.hasSystemdCommunicator()
  61. sourceComponent: ToolButton {
  62. iconName: "system-shutdown"
  63. enabled: base.systemdCom.serviceActive
  64. onClicked: base.systemdCom.serviceActive = false;
  65. tooltip: i18n("Stop fancontrol")
  66. }
  67. }
  68. Item {
  69. Layout.fillWidth: true
  70. }
  71. }
  72. }
  73. TabView {
  74. id: tabView
  75. anchors.fill: parent
  76. anchors.topMargin: 5
  77. frameVisible: true
  78. Tab {
  79. title: i18n("Sensors")
  80. SensorsTab {
  81. loader: base.loader
  82. }
  83. }
  84. Tab {
  85. title: i18n("PwmFans")
  86. PwmFansTab {
  87. size: sizeSlider.value
  88. baseObject: base
  89. }
  90. }
  91. Tab {
  92. title: i18n("Configfile")
  93. ConfigfileTab {
  94. loader: base.loader
  95. }
  96. }
  97. Tab {
  98. id: settingsTab
  99. title: i18n("Settings")
  100. SettingsTab {
  101. gui: base
  102. }
  103. }
  104. }
  105. Action {
  106. id: loadAction
  107. text: i18n("Load configuration file")
  108. iconName: "document-open"
  109. onTriggered: openFileDialog.open()
  110. tooltip: i18n("Load configuration file")
  111. shortcut: StandardKey.Open
  112. }
  113. Action {
  114. id: saveAction
  115. text: i18n("Save configuration file")
  116. onTriggered: base.loader.save()
  117. iconName: "document-save"
  118. tooltip: i18n("Save configuration file")
  119. shortcut: StandardKey.Save
  120. }
  121. FileDialog {
  122. id: openFileDialog
  123. title: i18n("Please choose a configuration file")
  124. folder: "file:///etc"
  125. selectExisting: true
  126. selectMultiple: false
  127. modality: Qt.NonModal
  128. onAccepted: {
  129. base.loader.load(fileUrl);
  130. }
  131. }
  132. FileDialog {
  133. id: saveFileDialog
  134. title: i18n("Save configuration file as")
  135. folder: "file:///etc"
  136. selectExisting: false
  137. selectMultiple: false
  138. modality: Qt.NonModal
  139. onAccepted: {
  140. base.loader.save(fileUrl);
  141. }
  142. }
  143. }