diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index 5412589ca8cd0b80f6a623e2c7c8f0fac8a4dff2..287eb79ac61ad82c0aeffdcca15cfca9318f68ba 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -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\ diff --git a/modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml b/modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml new file mode 100644 index 0000000000000000000000000000000000000000..053d7a6a7a983cd7dd609ddcd5fc9c89e7799fe6 --- /dev/null +++ b/modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml @@ -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 { } + } + } +} diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc index 3cda8faf6ca3ce2b1212be772185138a4e9215fb..5ea2ae71b997b01b160c5bc3df8a40ee1835a968 100644 --- a/modules/gui/qt/vlc.qrc +++ b/modules/gui/qt/vlc.qrc @@ -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> diff --git a/po/POTFILES.in b/po/POTFILES.in index 0df7774a5e732abedc494a0e9ff5835dbcc7c7f9..9648c2b60d4f41c9d1d34de4f3893df703155239 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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