spacepaste

  1.  
  2. /***************************************************************************
  3. * Copyright (c) 2013 Nikita Mikhaylov <nslqqq@gmail.com>
  4. *
  5. * Permission is hereby granted, free of charge, to any person
  6. * obtaining a copy of this software and associated documentation
  7. * files (the "Software"), to deal in the Software without restriction,
  8. * including without limitation the rights to use, copy, modify, merge,
  9. * publish, distribute, sublicense, and/or sell copies of the Software,
  10. * and to permit persons to whom the Software is furnished to do so,
  11. * subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included
  14. * in all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  22. * OR OTHER DEALINGS IN THE SOFTWARE.
  23. *
  24. ***************************************************************************/
  25. import QtQuick 2.0
  26. ComboBox {
  27. id: combo
  28. model: keyboard.layouts
  29. index: keyboard.currentLayout
  30. onValueChanged: keyboard.currentLayout = id
  31. Connections {
  32. target: keyboard
  33. onCurrentLayoutChanged: combo.index = keyboard.currentLayout
  34. }
  35. rowDelegate: Rectangle {
  36. color: "transparent"
  37. Image {
  38. id: img
  39. source: "/usr/share/sddm/flags/%1.png".arg(modelItem ? modelItem.modelData.shortName : "zz")
  40. anchors.margins: 4
  41. fillMode: Image.PreserveAspectFit
  42. anchors.left: parent.left
  43. anchors.top: parent.top
  44. anchors.bottom: parent.bottom
  45. }
  46. Text {
  47. anchors.margins: 4
  48. anchors.left: img.right
  49. anchors.top: parent.top
  50. anchors.bottom: parent.bottom
  51. verticalAlignment: Text.AlignVCenter
  52. text: modelItem ? modelItem.modelData.shortName : "zz"
  53. font.pixelSize: 14
  54. }
  55. }
  56. }
  57.