Clean up context menus.
This commit is contained in:
2
build.rs
2
build.rs
@@ -12,6 +12,8 @@ fn main() {
|
||||
"qml/ClideLogger.qml",
|
||||
"qml/Components/ClideScrollBar.qml",
|
||||
"qml/Components/ClideHandle.qml",
|
||||
"qml/Components/ClideMenu.qml",
|
||||
"qml/Components/ClideMenuItem.qml",
|
||||
"qml/Logger/Logger.qml",
|
||||
]))
|
||||
// Link Qt's Network library
|
||||
|
||||
@@ -15,122 +15,111 @@ MenuBar {
|
||||
|
||||
//
|
||||
// File Menu
|
||||
Action {
|
||||
ClideMenu {
|
||||
title: qsTr("&File")
|
||||
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
id: actionNewProject
|
||||
|
||||
text: qsTr("&New Project...")
|
||||
}
|
||||
Action {
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
id: actionOpen
|
||||
|
||||
text: qsTr("&Open...")
|
||||
}
|
||||
Action {
|
||||
|
||||
onTriggered: FileSystem.setDirectory(FileSystem.filePath)
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
id: actionSave
|
||||
|
||||
text: qsTr("&Save")
|
||||
}
|
||||
Action {
|
||||
}
|
||||
MenuSeparator {
|
||||
background: Rectangle {
|
||||
border.color: color
|
||||
color: Qt.darker(RustColors.menubar, 1)
|
||||
implicitHeight: 3
|
||||
implicitWidth: 200
|
||||
}
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
id: actionExit
|
||||
|
||||
text: qsTr("&Exit")
|
||||
|
||||
onTriggered: Qt.quit()
|
||||
}
|
||||
ClideMenu {
|
||||
title: qsTr("&File")
|
||||
|
||||
ClideMenuItem {
|
||||
action: actionNewProject
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionOpen
|
||||
|
||||
onTriggered: FileSystem.setDirectory(FileSystem.filePath)
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionSave
|
||||
}
|
||||
MenuSeparator {
|
||||
background: Rectangle {
|
||||
border.color: color
|
||||
color: RustColors.explorer_background
|
||||
implicitHeight: 3
|
||||
implicitWidth: 200
|
||||
}
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionExit
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Edit Menu
|
||||
Action {
|
||||
id: actionUndo
|
||||
|
||||
text: qsTr("&Undo")
|
||||
}
|
||||
Action {
|
||||
id: actionRedo
|
||||
|
||||
text: qsTr("&Redo")
|
||||
}
|
||||
Action {
|
||||
id: actionCut
|
||||
|
||||
text: qsTr("&Cut")
|
||||
}
|
||||
Action {
|
||||
id: actionCopy
|
||||
|
||||
text: qsTr("&Copy")
|
||||
}
|
||||
Action {
|
||||
id: actionPaste
|
||||
|
||||
text: qsTr("&Paste")
|
||||
}
|
||||
ClideMenu {
|
||||
title: qsTr("&Edit")
|
||||
|
||||
ClideMenuItem {
|
||||
action: actionUndo
|
||||
action: Action {
|
||||
id: actionUndo
|
||||
|
||||
text: qsTr("&Undo")
|
||||
}
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionRedo
|
||||
action: Action {
|
||||
id: actionRedo
|
||||
|
||||
text: qsTr("&Redo")
|
||||
}
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionCut
|
||||
action: Action {
|
||||
id: actionCut
|
||||
|
||||
text: qsTr("&Cut")
|
||||
}
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionCopy
|
||||
action: Action {
|
||||
id: actionCopy
|
||||
|
||||
text: qsTr("&Copy")
|
||||
}
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionPaste
|
||||
action: Action {
|
||||
id: actionPaste
|
||||
|
||||
text: qsTr("&Paste")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// View Menu
|
||||
Action {
|
||||
id: actionToolWindows
|
||||
|
||||
text: qsTr("&Tool Windows")
|
||||
}
|
||||
Action {
|
||||
id: actionAppearance
|
||||
|
||||
text: qsTr("&Appearance")
|
||||
}
|
||||
ClideMenu {
|
||||
title: qsTr("&View")
|
||||
|
||||
ClideMenuItem {
|
||||
action: actionToolWindows
|
||||
action: Action {
|
||||
id: actionAppearance
|
||||
|
||||
text: qsTr("&Appearance")
|
||||
}
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionAppearance
|
||||
action: Action {
|
||||
id: actionToolWindows
|
||||
|
||||
text: qsTr("&Tool Windows")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,12 +129,18 @@ MenuBar {
|
||||
id: clideAbout
|
||||
|
||||
}
|
||||
Action {
|
||||
ClideMenu {
|
||||
title: qsTr("&Help")
|
||||
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
id: actionDocumentation
|
||||
|
||||
text: qsTr("&Documentation")
|
||||
}
|
||||
Action {
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
id: actionAbout
|
||||
|
||||
text: qsTr("&About")
|
||||
@@ -153,39 +148,6 @@ MenuBar {
|
||||
// Toggle the about window with the menu item is clicked.
|
||||
onTriggered: clideAbout.visible = !clideAbout.visible
|
||||
}
|
||||
ClideMenu {
|
||||
title: qsTr("&Help")
|
||||
|
||||
ClideMenuItem {
|
||||
action: actionDocumentation
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: actionAbout
|
||||
}
|
||||
}
|
||||
|
||||
// Base settings for each Menu.
|
||||
component ClideMenu: Menu {
|
||||
background: Rectangle {
|
||||
color: RustColors.explorer_background
|
||||
border.color: Qt.darker(RustColors.menubar, 2)
|
||||
implicitWidth: 100
|
||||
radius: 2
|
||||
}
|
||||
}
|
||||
|
||||
// Base settings for each MenuItem.
|
||||
component ClideMenuItem: MenuItem {
|
||||
id: root
|
||||
|
||||
background: Rectangle {
|
||||
color: root.hovered ? RustColors.hovered : RustColors.unhovered
|
||||
radius: 1.0
|
||||
}
|
||||
contentItem: IconLabel {
|
||||
color: "black"
|
||||
font.family: "Helvetica"
|
||||
text: root.text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,12 @@ SplitView {
|
||||
|
||||
onSingleTapped: (eventPoint, button) => contextMenu.popup()
|
||||
}
|
||||
Menu {
|
||||
ClideMenu {
|
||||
id: contextMenu
|
||||
|
||||
Action {
|
||||
text: qsTr("Reset root index")
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
text: qsTr("Reset root")
|
||||
|
||||
onTriggered: {
|
||||
Logger.log("Resetting root directory: " + clideTreeView.originalRootDirectory);
|
||||
@@ -82,6 +83,7 @@ SplitView {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ClideTreeView {
|
||||
id: clideTreeView
|
||||
|
||||
|
||||
@@ -142,20 +142,23 @@ TreeView {
|
||||
}
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
ClideMenu {
|
||||
id: contextMenu
|
||||
|
||||
Action {
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
enabled: treeDelegate.hasChildren
|
||||
text: qsTr("Set as root index")
|
||||
text: qsTr("Set root")
|
||||
|
||||
onTriggered: {
|
||||
Logger.debug("Setting new root directory: " + treeDelegate.filePath);
|
||||
fileSystemTreeView.rootDirectory = treeDelegate.filePath;
|
||||
}
|
||||
}
|
||||
Action {
|
||||
text: qsTr("Reset root index")
|
||||
}
|
||||
ClideMenuItem {
|
||||
action: Action {
|
||||
text: qsTr("Reset root")
|
||||
|
||||
onTriggered: {
|
||||
Logger.log("Resetting root directory: " + fileSystemTreeView.originalRootDirectory);
|
||||
@@ -164,6 +167,7 @@ TreeView {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
selectionModel: ItemSelectionModel {
|
||||
}
|
||||
}
|
||||
|
||||
13
qml/Components/ClideMenu.qml
Normal file
13
qml/Components/ClideMenu.qml
Normal file
@@ -0,0 +1,13 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.Basic
|
||||
|
||||
import clide.module 1.0
|
||||
|
||||
Menu {
|
||||
background: Rectangle {
|
||||
border.color: Qt.darker(RustColors.menubar, 2)
|
||||
color: RustColors.menubar
|
||||
implicitWidth: 100
|
||||
radius: 2
|
||||
}
|
||||
}
|
||||
18
qml/Components/ClideMenuItem.qml
Normal file
18
qml/Components/ClideMenuItem.qml
Normal file
@@ -0,0 +1,18 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.Basic
|
||||
|
||||
import clide.module 1.0
|
||||
|
||||
MenuItem {
|
||||
id: root
|
||||
|
||||
background: Rectangle {
|
||||
color: root.hovered ? RustColors.hovered : RustColors.unhovered
|
||||
radius: 1.0
|
||||
}
|
||||
contentItem: IconLabel {
|
||||
color: "black"
|
||||
font.family: "Helvetica"
|
||||
text: root.text
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,4 @@
|
||||
ClideScrollBar ClideScrollBar.qml
|
||||
ClideHandle ClideHandle.qml
|
||||
ClideMenu ClideMenu.qml
|
||||
ClideMenuItem ClideMenuItem.qml
|
||||
|
||||
Reference in New Issue
Block a user