main.qml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. IpAddressInput {
  64. id: ipAddress
  65. x: 20
  66. y: 220
  67. ipwidth: 150
  68. ipcolor: "red"
  69. ipAddress: setEth0.address
  70. Component.onCompleted: {
  71. setEth0.doGetInterface();
  72. }
  73. onIpAddressChanged: {
  74. setEth0.address = ipAddress.ipAddress;
  75. }
  76. }
  77. }