Commit d4900e6a authored by Alexander Stippich's avatar Alexander Stippich
Browse files

move application menu to own file

Summary: small refactoring to reduce size of main qml file

Reviewers: #elisa, mgallien

Reviewed By: #elisa, mgallien

Subscribers: mgallien

Tags: #elisa

Differential Revision: https://phabricator.kde.org/D10240
parent 78ffb4b0
......@@ -36,11 +36,6 @@ if (Qt5Quick_FOUND AND Qt5Widgets_FOUND)
models/singlealbumproxymodel.cpp
qml/ElisaMainWindow.qml
qml/Theme.qml
qml/PlatformIntegration.qml
qml/LabelWithToolTip.qml
windows/WindowsTheme.qml
windows/PlatformIntegration.qml
......@@ -48,6 +43,12 @@ if (Qt5Quick_FOUND AND Qt5Widgets_FOUND)
android/AndroidTheme.qml
android/PlatformIntegration.qml
qml/ElisaMainWindow.qml
qml/ApplicationMenu.qml
qml/Theme.qml
qml/PlatformIntegration.qml
qml/LabelWithToolTip.qml
qml/RatingStar.qml
qml/PlayListEntry.qml
qml/MediaBrowser.qml
......
/*
* Copyright 2016-2018 Matthieu Gallien <matthieu_gallien@yahoo.fr>
* Copyright 2018 Alexander Stippich <a.stippich@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
import QtQuick 2.7
import QtQuick.Controls 1.4
Menu {
id: applicationMenu
title: i18nc("open application menu", "Application Menu")
property var helpAction: elisa.action("help_contents")
property var quitApplication: elisa.action("file_quit")
property var reportBugAction: elisa.action("help_report_bug")
property var aboutAppAction: elisa.action("help_about_app")
property var configureShortcutsAction: elisa.action("options_configure_keybinding")
property var configureAction: elisa.action("options_configure")
MenuItem {
text: configureAction.text
shortcut: configureAction.shortcut
iconName: elisa.iconName(configureAction.icon)
onTriggered: configureAction.trigger()
visible: configureAction.text !== ""
}
MenuItem {
text: configureShortcutsAction.text
shortcut: configureShortcutsAction.shortcut
iconName: elisa.iconName(configureShortcutsAction.icon)
onTriggered: configureShortcutsAction.trigger()
visible: configureShortcutsAction.text !== ""
}
MenuSeparator {
visible: reportBugAction.text !== ""
}
MenuItem {
text: reportBugAction.text
shortcut: reportBugAction.shortcut
iconName: elisa.iconName(reportBugAction.icon)
onTriggered: reportBugAction.trigger()
visible: reportBugAction.text !== ""
}
MenuSeparator {
visible: helpAction.text !== ""
}
MenuItem {
text: helpAction.text
shortcut: helpAction.shortcut
iconName: elisa.iconName(helpAction.icon)
onTriggered: helpAction.trigger()
visible: helpAction.text !== ""
}
MenuItem {
text: aboutAppAction.text
shortcut: aboutAppAction.shortcut
iconName: elisa.iconName(aboutAppAction.icon)
onTriggered: aboutAppAction.trigger()
visible: aboutAppAction.text !== ""
}
MenuSeparator {
visible: quitApplication.text !== ""
}
MenuItem {
text: quitApplication.text
shortcut: quitApplication.shortcut
iconName: elisa.iconName(quitApplication.icon)
onTriggered: quitApplication.trigger()
visible: quitApplication.text !== ""
}
}
......@@ -22,7 +22,6 @@ import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3
import QtQuick.Layouts 1.1
import QtQuick.Window 2.2
import Qt.labs.platform 1.0 as PlatformDialog
import org.kde.elisa 1.0
import Qt.labs.settings 1.0
......@@ -44,14 +43,29 @@ ApplicationWindow {
title: 'Elisa'
property var helpAction: elisa.action("help_contents")
property var quitApplication: elisa.action("file_quit")
property var reportBugAction: elisa.action("help_report_bug")
property var aboutAppAction: elisa.action("help_about_app")
property var configureShortcutsAction: elisa.action("options_configure_keybinding")
property var configureAction: elisa.action("options_configure")
property var goBackAction: elisa.action("go_back")
Action {
text: goBackAction.text
shortcut: goBackAction.shortcut
iconName: elisa.iconName(goBackAction.icon)
onTriggered: {
localAlbums.goBack()
localArtists.goBack()
}
}
Action {
id: applicationMenuAction
text: i18nc("open application menu", "Application Menu")
iconName: "application-menu"
onTriggered: applicationMenu.popup()
}
ApplicationMenu {
id: applicationMenu
}
SystemPalette {
id: myPalette
colorGroup: SystemPalette.Active
......@@ -79,24 +93,6 @@ ApplicationWindow {
property bool playControlItemMuted : false
}
Action {
text: goBackAction.text
shortcut: goBackAction.shortcut
iconName: elisa.iconName(goBackAction.icon)
onTriggered: {
localAlbums.goBack()
localArtists.goBack()
}
}
Action {
id: qmlQuitAction
text: quitApplication.text
shortcut: quitApplication.shortcut
iconName: elisa.iconName(quitApplication.icon)
onTriggered: quitApplication.trigger()
}
property string globalBrowseFlag: 'BrowseDirectChildren'
property string globalFilter: '*'
property string globalSortCriteria: ''
......@@ -271,77 +267,6 @@ ApplicationWindow {
currentTrack: playListModelItem.currentTrack
}
Menu {
id: applicationMenu
title: i18nc("open application menu", "Application Menu")
MenuItem {
text: configureAction.text
shortcut: configureAction.shortcut
iconName: 'configure'
onTriggered: configureAction.trigger()
visible: configureAction.text !== ""
}
MenuItem {
text: configureShortcutsAction.text
shortcut: configureShortcutsAction.shortcut
iconName: elisa.iconName(configureShortcutsAction.icon)
onTriggered: configureShortcutsAction.trigger()
visible: configureShortcutsAction.text !== ""
}
MenuSeparator {
visible: reportBugAction.text !== ""
}
MenuItem {
text: reportBugAction.text
shortcut: reportBugAction.shortcut
iconName: elisa.iconName(reportBugAction.icon)
onTriggered: reportBugAction.trigger()
visible: reportBugAction.text !== ""
}
MenuSeparator {
visible: helpAction.text !== ""
}
MenuItem {
text: helpAction.text
shortcut: helpAction.shortcut
iconName: elisa.iconName(helpAction.icon)
onTriggered: helpAction.trigger()
visible: helpAction.text !== ""
}
MenuItem {
text: aboutAppAction.text
shortcut: aboutAppAction.shortcut
iconName: elisa.iconName(aboutAppAction.icon)
onTriggered: aboutAppAction.trigger()
visible: aboutAppAction.text !== ""
}
MenuSeparator {
visible: qmlQuitAction.text !== ""
}
MenuItem {
action: qmlQuitAction
visible: qmlQuitAction.text !== ""
}
}
Action {
id: applicationMenuAction
text: i18nc("open application menu", "Application Menu")
iconName: "application-menu"
onTriggered: applicationMenu.popup()
}
PassiveNotification {
id: messageNotification
}
......
......@@ -5,6 +5,7 @@
<file>qml/MediaPlayListView.qml</file>
<file>qml/MediaAlbumView.qml</file>
<file>qml/ElisaMainWindow.qml</file>
<file>qml/ApplicationMenu.qml</file>
<file>qml/HeaderBar.qml</file>
<file>qml/ContextView.qml</file>
<file>qml/DraggableItem.qml</file>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment