mirror of
https://code.videolan.org/videolan/vlc
synced 2024-08-27 04:21:53 +02:00
qml: add WindowDialog
WindowDialog is a wrapper of QtQuick.Window which provides a simple base for qml based dialogs. It is intended to be an alternative to Qt.labs.platform Dialog and Qt Quick Controls 2 Dialog. Signed-off-by: Pierre Lamot <pierre@videolabs.io>
This commit is contained in:
parent
de81809a25
commit
97019ddc6c
@ -646,6 +646,7 @@ libqt_plugin_la_QML = \
|
||||
gui/qt/dialogs/dialogs/qml/CustomDialog.qml \
|
||||
gui/qt/dialogs/dialogs/qml/Dialogs.qml \
|
||||
gui/qt/dialogs/dialogs/qml/ModalDialog.qml \
|
||||
gui/qt/dialogs/dialogs/qml/WindowDialog.qml \
|
||||
gui/qt/dialogs/help/qml/About.qml \
|
||||
gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml \
|
||||
gui/qt/dialogs/toolbar/qml/EditorDNDView.qml\
|
||||
|
101
modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml
Normal file
101
modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml
Normal file
@ -0,0 +1,101 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (C) 2021 VLC authors and VideoLAN
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* ( at your option ) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Window 2.11
|
||||
import QtQuick.Layouts 1.11
|
||||
import QtQuick.Controls 2.4
|
||||
|
||||
import "qrc:///widgets/" as Widgets
|
||||
import "qrc:///style/"
|
||||
|
||||
Window {
|
||||
id: root
|
||||
|
||||
flags: Qt.Dialog
|
||||
|
||||
property bool modal: false
|
||||
modality: modal ? Qt.ApplicationModal : Qt.NonModal
|
||||
|
||||
width: VLCStyle.appWidth * 0.75
|
||||
height: VLCStyle.appHeight * 0.85
|
||||
|
||||
title: i18n.qtr("Dialog")
|
||||
color: VLCStyle.colors.bg
|
||||
|
||||
property alias contentComponent: loader.sourceComponent
|
||||
property alias standardButtons: buttonBox.standardButtons
|
||||
|
||||
signal accepted()
|
||||
signal rejected(bool byButton)
|
||||
signal applied()
|
||||
signal discarded()
|
||||
signal reset()
|
||||
|
||||
onAccepted: hide()
|
||||
onRejected: if (byButton) hide()
|
||||
onApplied: hide()
|
||||
onDiscarded: hide()
|
||||
onReset: hide()
|
||||
|
||||
onClosing: {
|
||||
rejected(false)
|
||||
}
|
||||
|
||||
function open() {
|
||||
show()
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: VLCStyle.margin_small
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
clip: true
|
||||
sourceComponent: contentComponent
|
||||
}
|
||||
|
||||
DialogButtonBox {
|
||||
id: buttonBox
|
||||
|
||||
bottomPadding: 0
|
||||
topPadding: 0
|
||||
padding: VLCStyle.margin_small
|
||||
spacing: VLCStyle.margin_small
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: VLCStyle.icon_normal
|
||||
|
||||
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
|
||||
|
||||
onAccepted: root.accepted()
|
||||
onRejected: root.rejected(true)
|
||||
onApplied: root.applied()
|
||||
onDiscarded: root.discarded()
|
||||
onReset: root.reset()
|
||||
|
||||
// Customize DialogButtonBox so that it matches with the app theme
|
||||
background: Item { }
|
||||
delegate: Widgets.TextToolButton { }
|
||||
}
|
||||
}
|
||||
}
|
@ -339,6 +339,7 @@
|
||||
<file alias="CustomDialog.qml">dialogs/dialogs/qml/CustomDialog.qml</file>
|
||||
<file alias="Dialogs.qml">dialogs/dialogs/qml/Dialogs.qml</file>
|
||||
<file alias="ModalDialog.qml">dialogs/dialogs/qml/ModalDialog.qml</file>
|
||||
<file alias="WindowDialog.qml">dialogs/dialogs/qml/WindowDialog.qml</file>
|
||||
<file alias="EditorDummyButton.qml">dialogs/toolbar/qml/EditorDummyButton.qml</file>
|
||||
<file alias="EditorDNDDelegate.qml">dialogs/toolbar/qml/EditorDNDDelegate.qml</file>
|
||||
<file alias="ToolbarEditorButtonList.qml">dialogs/toolbar/qml/ToolbarEditorButtonList.qml</file>
|
||||
|
@ -801,6 +801,7 @@ modules/gui/qt/util/validators.cpp
|
||||
modules/gui/qt/util/validators.hpp
|
||||
modules/gui/qt/dialogs/dialogs/qml/CustomDialog.qml
|
||||
modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml
|
||||
modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml
|
||||
modules/gui/qt/dialogs/help/qml/About.qml
|
||||
modules/gui/qt/dialogs/toolbar/qml/ToolbarEditor.qml
|
||||
modules/gui/qt/maininterface/qml/BannerSources.qml
|
||||
|
Loading…
Reference in New Issue
Block a user