qmlfrontend/Page1Form.ui.qml
author Pekka Ristola <pekkarr@protonmail.com>
Mon, 27 Jan 2025 19:08:05 +0100
changeset 16096 dbdb98dafd80
parent 16041 caba603f461f
permissions -rw-r--r--
Add support for ffmpeg 6.0 - Use the new send_frame/receive_packet API for encoding - Use the new channel layout API for audio - Fix audio recording - Copy codec parameters to the stream parameters - Set correct pts for audio frames - Read audio samples from file directly to the refcounted AVFrame buffer instead of the `g_pSamples` buffer - Use global AVPackets allocated with `av_packet_alloc` - Stop trying to write more audio frames when `WriteAudioFrame` fails with a negative error code - Fix segfault with `g_pContainer->url`. The field has to be allocated with `av_malloc` before writing to it. It's set to `NULL` by default. - Properly free allocations with `avcodec_free_context` and `avformat_free_context`

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

import Hedgewars.Engine 1.0

Item {
  id: element
  property alias button1: button1
  property alias previewImage: previewImage
  property alias preview: preview
  property alias gameButton: gameButton
  property alias netButton: netButton
  property alias tickButton: tickButton
  property alias gameView: gameView
  property alias gameMouseArea: gameMouseArea

  ColumnLayout {
    anchors.fill: parent

    RowLayout {
      Layout.alignment: Qt.AlignHCenter
      Layout.fillHeight: false

      Button {
        id: button1
        text: qsTr("Preview")
      }

      Button {
        id: gameButton
        text: qsTr("Game")
      }

      Button {
        id: tickButton
        text: qsTr("Tick")
      }
    }

    Rectangle {
      id: preview
      border.color: "orange"
      border.width: 5
      radius: 5

      Layout.minimumHeight: 256
      Layout.fillWidth: true

      gradient: Gradient {
        GradientStop {
          position: 0
          color: "lightblue"
        }
        GradientStop {
          position: 0.9
          color: "blue"
        }
        GradientStop {
          position: 0.9
          color: "darkblue"
        }
        GradientStop {
          position: 1.0
          color: "darkblue"
        }
      }

      Image {
        id: previewImage

        anchors.fill: parent
        anchors.margins: parent.radius
        source: "qrc:/res/iconTime.png"
        fillMode: Image.PreserveAspectFit
        cache: false
      }
    }

    GameView {
      id: gameView

      Layout.fillWidth: true
      Layout.fillHeight: true

      MouseArea {
        id: gameMouseArea
        anchors.fill: parent

        property point lastPoint
      }
    }
  }

  Button {
    id: netButton
    text: qsTr("Net")
    anchors.bottom: parent.bottom
    anchors.bottomMargin: 8
    anchors.left: parent.left
    anchors.leftMargin: 8
  }
}