2020-12-22 00:01:36 +00:00
|
|
|
/**
|
2021-05-03 15:31:37 +00:00
|
|
|
* Logarithmic Plotter - Create graphs with logarithm scales.
|
|
|
|
* Copyright (C) 2021 Ad5001
|
2020-12-22 00:01:36 +00:00
|
|
|
*
|
|
|
|
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
2020-12-22 22:19:00 +00:00
|
|
|
import "js/objects.js" as Objects
|
2021-04-06 17:06:09 +00:00
|
|
|
import "js/historylib.js" as HistoryLib
|
2020-12-22 00:01:36 +00:00
|
|
|
|
|
|
|
MenuBar {
|
|
|
|
Menu {
|
|
|
|
title: qsTr("&File")
|
|
|
|
Action {
|
|
|
|
text: qsTr("&Load...")
|
|
|
|
shortcut: StandardKey.Open
|
|
|
|
onTriggered: settings.load()
|
2020-12-23 23:06:52 +00:00
|
|
|
icon.name: 'document-open'
|
2020-12-22 00:01:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: qsTr("&Save")
|
|
|
|
shortcut: StandardKey.Save
|
|
|
|
onTriggered: settings.save()
|
2020-12-23 23:06:52 +00:00
|
|
|
icon.name: 'document-save'
|
2020-12-22 00:01:36 +00:00
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: qsTr("Save &As...")
|
|
|
|
shortcut: StandardKey.SaveAs
|
|
|
|
onTriggered: settings.saveAs()
|
2020-12-23 23:06:52 +00:00
|
|
|
icon.name: 'document-save-as'
|
2020-12-22 00:01:36 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
MenuSeparator { }
|
|
|
|
Action {
|
|
|
|
text: qsTr("&Quit")
|
|
|
|
shortcut: StandardKey.Quit
|
|
|
|
onTriggered: Qt.quit()
|
|
|
|
icon.name: 'application-exit'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Menu {
|
|
|
|
title: qsTr("&Edit")
|
2021-04-06 17:06:09 +00:00
|
|
|
Action {
|
|
|
|
text: qsTr("&Undo")
|
|
|
|
shortcut: StandardKey.Undo
|
|
|
|
onTriggered: history.undo()
|
|
|
|
icon.name: 'edit-undo'
|
|
|
|
icon.color: enabled ? sysPalette.windowText : sysPaletteIn.windowText
|
|
|
|
enabled: history.undoCount > 0
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: qsTr("&Redo")
|
|
|
|
shortcut: StandardKey.Redo
|
|
|
|
onTriggered: history.redo()
|
|
|
|
icon.name: 'edit-redo'
|
|
|
|
icon.color: enabled ? sysPalette.windowText : sysPaletteIn.windowText
|
|
|
|
enabled: history.redoCount > 0
|
|
|
|
}
|
|
|
|
MenuSeparator { }
|
2020-12-22 00:01:36 +00:00
|
|
|
Action {
|
|
|
|
text: qsTr("&Copy diagram")
|
|
|
|
shortcut: StandardKey.Copy
|
|
|
|
onTriggered: root.copyDiagramToClipboard()
|
2020-12-23 23:06:52 +00:00
|
|
|
icon.name: 'edit-copy'
|
2020-12-22 00:01:36 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-22 22:19:00 +00:00
|
|
|
Menu {
|
|
|
|
title: qsTr("&Create")
|
|
|
|
// Services repeater
|
|
|
|
Repeater {
|
|
|
|
model: Object.keys(Objects.types)
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: modelData
|
|
|
|
visible: Objects.types[modelData].createable()
|
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
icon.source: './icons/'+modelData+'.svg' // Default to dark version
|
2020-12-27 18:42:03 +00:00
|
|
|
icon.name: modelData
|
2020-12-27 17:42:04 +00:00
|
|
|
icon.color: sysPalette.windowText
|
2020-12-22 22:19:00 +00:00
|
|
|
onTriggered: {
|
2021-04-06 17:06:09 +00:00
|
|
|
var newObj = Objects.createNewRegisteredObject(modelData)
|
|
|
|
history.addToHistory(new HistoryLib.CreateNewObject(newObj.name, modelData, newObj.export()))
|
2020-12-22 22:19:00 +00:00
|
|
|
objectLists.update()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-12-22 00:01:36 +00:00
|
|
|
Menu {
|
|
|
|
title: qsTr("&Help")
|
2021-03-31 13:58:21 +00:00
|
|
|
Action {
|
|
|
|
text: qsTr("&About")
|
|
|
|
icon.name: 'about'
|
2021-05-03 15:31:37 +00:00
|
|
|
onTriggered: about.open()
|
2021-03-31 13:58:21 +00:00
|
|
|
}
|
2020-12-22 00:01:36 +00:00
|
|
|
}
|
|
|
|
}
|