main.qml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import QtQuick 2.5
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Layouts 1.0
  4. ApplicationWindow {
  5. visible: true
  6. width: 640
  7. height: 480
  8. title: qsTr("Hello World")
  9. SetNetworkInterface {
  10. id: setEth0
  11. mode: "static"
  12. ifacename: "eth0"
  13. address: "192.168.0.126"
  14. netmask: "255.255.255.0"
  15. nameserver: "192.168.0.101"
  16. gateway: "192.168.0.10"
  17. // infile: "/home/ru/BUILD/QT562_di-soric/GfA/board/GfA/Display001/rootfs/etc/network/interfaces"
  18. // outfile: "/root/out.txt"
  19. infile: "/home/ru/IFACE/interfaces"
  20. outfile: "/home/ru/IFACE/interfaces"
  21. onAddressChanged: {
  22. ipAddress.ipAddress = address;
  23. }
  24. }
  25. Button {
  26. x:10
  27. y:10
  28. height: 40
  29. width:120
  30. text: "Eth0 static"
  31. onClicked: {
  32. setEth0.mode = "static";
  33. setEth0.doSetInterface();
  34. }
  35. }
  36. Button {
  37. x:10
  38. y:80
  39. height: 40
  40. width:120
  41. text: "Eth0 dhcp"
  42. onClicked: {
  43. setEth0.mode = "dhcp";
  44. setEth0.doSetInterface();
  45. }
  46. }
  47. Button {
  48. x:10
  49. y:150
  50. height: 40
  51. width:120
  52. text: "restart Netw."
  53. onClicked: {
  54. //setEth0.doRestartNetwork();
  55. setEth0.doGetInterface();
  56. }
  57. }
  58. Label {
  59. x:500
  60. y:220
  61. text: ipAddress.ipAddress
  62. }
  63. Label {
  64. x:500
  65. y:240
  66. text: ipNetmask.ipAddress
  67. }
  68. IpAddressInput {
  69. id: ipAddress
  70. posX: 20
  71. posY: 220
  72. ipwidth: 200
  73. ipcolor: "black"
  74. ipAddress: setEth0.address
  75. ipFontSize: 20
  76. Component.onCompleted: {
  77. setEth0.doGetInterface();
  78. }
  79. onIpAddressChanged: {
  80. setEth0.address = ipAddress.ipAddress;
  81. }
  82. }
  83. IpAddressInput {
  84. id: ipNetmask
  85. posX: 20
  86. posY: 240
  87. ipwidth: 200
  88. ipcolor: "black"
  89. ipAddress: setEth0.netmask
  90. ipFontSize: 20
  91. Component.onCompleted: {
  92. setEth0.doGetInterface();
  93. }
  94. onIpAddressChanged: {
  95. setEth0.netmask = ipNetmask.ipAddress;
  96. }
  97. }
  98. }