From d59ac20e38fbe73102895400998ae31eb0a8c04d Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Wed, 11 Jan 2017 17:36:37 -0800 Subject: [PATCH] merge multiterm branch --- app/main.cpp | 2 +- app/qml/CRTMainMenuBar.qml | 6 ++++++ app/qml/main.qml | 20 ++++++++++++++++++-- app/qml/resources.qrc | 1 + app/qml/root.qml | 33 +++++++++++++++++++++++++++++++++ qmltermwidget | 2 +- 6 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 app/qml/root.qml diff --git a/app/main.cpp b/app/main.cpp index 0cf128f..b8438a7 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) importPathList.prepend(QCoreApplication::applicationDirPath() + "/../../../qmltermwidget"); engine.setImportPathList(importPathList); - engine.load(QUrl(QStringLiteral ("qrc:/main.qml"))); + engine.load(QUrl(QStringLiteral ("qrc:/root.qml"))); if (engine.rootObjects().isEmpty()) { qDebug() << "Cannot load QML interface"; diff --git a/app/qml/CRTMainMenuBar.qml b/app/qml/CRTMainMenuBar.qml index 5be179d..0d27a1c 100644 --- a/app/qml/CRTMainMenuBar.qml +++ b/app/qml/CRTMainMenuBar.qml @@ -9,6 +9,12 @@ MenuBar { visible: defaultMenuBar.visible MenuItem {action: quitAction} } + Menu { + title: qsTr("Terminal") + visible: defaultMenuBar.visible + MenuItem {action: newAction} + MenuItem {action: closeAction} + } Menu { title: qsTr("Edit") visible: defaultMenuBar.visible diff --git a/app/qml/main.qml b/app/qml/main.qml index ed0801c..3d18a46 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -65,6 +65,22 @@ ApplicationWindow{ color: "#00000000" title: terminalContainer.title || qsTr("cool-retro-term") + Action { + id: newAction + text: qsTr("New Window") + shortcut: Qt.platform.os === "osx" ? StandardKey.New : "Ctrl+Shift+N" + onTriggered: { + root.newWindow() + } + } + Action { + id: closeAction + text: qsTr("Close Window") + shortcut: Qt.platform.os === "osx" ? StandardKey.Close : "Ctrl+Shift+W" + onTriggered: { + terminalWindow.close() + } + } Action { id: showMenubarAction text: qsTr("Show Menubar") @@ -162,7 +178,7 @@ ApplicationWindow{ onClosing: { // OSX Since we are currently supporting only one window // quit the application when it is closed. - if (Qt.platform.os === "osx") - Qt.quit() + //if (Qt.platform.os === "osx") + // Qt.quit() } } diff --git a/app/qml/resources.qrc b/app/qml/resources.qrc index 97f23c9..b5639f7 100644 --- a/app/qml/resources.qrc +++ b/app/qml/resources.qrc @@ -26,6 +26,7 @@ InsertNameDialog.qml SettingsEffectsTab.qml main.qml + root.qml SettingsTerminalTab.qml FontScanlines.qml fonts/1982-commodore64/C64_Pro_Mono_v1.0-STYLE.ttf diff --git a/app/qml/root.qml b/app/qml/root.qml new file mode 100644 index 0000000..bd279d9 --- /dev/null +++ b/app/qml/root.qml @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2013 "Filippo Scognamiglio" + * https://github.com/Swordfish90/cool-retro-term + * + * This file is part of cool-retro-term. + * + * cool-retro-term 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 . + *******************************************************************************/ +import QtQuick 2.2 +import QtQuick.Window 2.1 + +QtObject { + id: root + function newWindow() { + var component = Qt.createComponent("main.qml") + var window = component.createObject() + window.show() + } + Component.onCompleted: { + root.newWindow() + } +} diff --git a/qmltermwidget b/qmltermwidget index 490eeaf..65225a5 160000 --- a/qmltermwidget +++ b/qmltermwidget @@ -1 +1 @@ -Subproject commit 490eeaf195cd5764a3798c2a2340ced648db4526 +Subproject commit 65225a5c47faf9358de82ba3c0de1230d87835f2