mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-26 13:17:20 +00:00
Compare commits
3 Commits
master
...
fix/tentat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
029ac4a05b | ||
|
|
f6b36105ce | ||
|
|
f4facfed3b |
18
app/main.cpp
18
app/main.cpp
@@ -4,12 +4,11 @@
|
||||
#include <QQmlContext>
|
||||
#include <QStringList>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QIcon>
|
||||
#include <QQuickStyle>
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QQuickWindow>
|
||||
|
||||
#include <kdsingleapplication.h>
|
||||
|
||||
@@ -46,9 +45,10 @@ int main(int argc, char *argv[])
|
||||
QLoggingCategory::setFilterRules("qt.qml.connections.warning=false");
|
||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
|
||||
|
||||
// #if defined (Q_OS_LINUX)
|
||||
// setenv("QSG_RENDER_LOOP", "threaded", 0);
|
||||
// #endif
|
||||
// Set render loop to basic for debug/test builds.
|
||||
#if defined (Q_OS_LINUX)
|
||||
setenv("QSG_RENDER_LOOP", "basic", 0);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
// This allows UTF-8 characters usage in OSX.
|
||||
@@ -90,6 +90,12 @@ int main(int argc, char *argv[])
|
||||
app.setOrganizationDomain(QStringLiteral("cool-retro-term"));
|
||||
app.setApplicationVersion(appVersion);
|
||||
|
||||
qInfo() << "cool-retro-term version" << appVersion;
|
||||
qInfo() << "Qt version" << QT_VERSION_STR;
|
||||
qInfo() << "Platform" << QGuiApplication::platformName();
|
||||
qInfo() << "QSG_RENDER_LOOP" << qgetenv("QSG_RENDER_LOOP");
|
||||
qInfo() << "QQuickWindow graphicsApi" << QQuickWindow::graphicsApi();
|
||||
|
||||
KDSingleApplication singleApp(QStringLiteral("cool-retro-term"));
|
||||
|
||||
if (!singleApp.isPrimaryInstance()) {
|
||||
@@ -127,7 +133,7 @@ int main(int argc, char *argv[])
|
||||
engine.rootContext()->setContextProperty("defaultCmd", command);
|
||||
engine.rootContext()->setContextProperty("defaultCmdArgs", commandArgs);
|
||||
|
||||
engine.rootContext()->setContextProperty("workdir", getNamedArgument(args, "--workdir", QDir::currentPath()));
|
||||
engine.rootContext()->setContextProperty("workdir", getNamedArgument(args, "--workdir", "$HOME"));
|
||||
engine.rootContext()->setContextProperty("fileIO", &fileIO);
|
||||
|
||||
// Manage import paths for Linux and OSX.
|
||||
|
||||
@@ -38,6 +38,7 @@ QtObject {
|
||||
readonly property real maxBurnInFadeTime: 1.6
|
||||
|
||||
property bool isMacOS: Qt.platform.os === "osx"
|
||||
property bool isLinux: Qt.platform.os === "linux"
|
||||
|
||||
// GENERAL SETTINGS ///////////////////////////////////////////////////////
|
||||
property bool showMenubar: false
|
||||
@@ -52,6 +53,7 @@ QtObject {
|
||||
property real burnInQuality: 0.5
|
||||
|
||||
property bool blinkingCursor: false
|
||||
property bool preferAcceleratedFontRendering: false
|
||||
|
||||
|
||||
// PROFILE SETTINGS ///////////////////////////////////////////////////////
|
||||
@@ -167,7 +169,8 @@ QtObject {
|
||||
"bloomQuality": bloomQuality,
|
||||
"burnInQuality": burnInQuality,
|
||||
"useCustomCommand": useCustomCommand,
|
||||
"customCommand": customCommand
|
||||
"customCommand": customCommand,
|
||||
"preferAcceleratedFontRendering": preferAcceleratedFontRendering
|
||||
}
|
||||
return stringify(settings)
|
||||
}
|
||||
@@ -260,6 +263,8 @@ QtObject {
|
||||
!== undefined ? settings.useCustomCommand : useCustomCommand
|
||||
customCommand = settings.customCommand
|
||||
!== undefined ? settings.customCommand : customCommand
|
||||
preferAcceleratedFontRendering = settings.preferAcceleratedFontRendering
|
||||
!== undefined ? settings.preferAcceleratedFontRendering : preferAcceleratedFontRendering
|
||||
}
|
||||
|
||||
function loadProfileString(profileString) {
|
||||
|
||||
@@ -40,7 +40,6 @@ Item{
|
||||
property real scaleTexture: 1.0
|
||||
property alias title: ksession.title
|
||||
property alias kterminal: kterminal
|
||||
property bool isActive: false
|
||||
|
||||
property size terminalSize: kterminal.terminalSize
|
||||
property size fontMetrics: kterminal.fontMetrics
|
||||
@@ -50,18 +49,14 @@ Item{
|
||||
target: copyAction
|
||||
|
||||
onTriggered: {
|
||||
if (terminalContainer.isActive) {
|
||||
kterminal.copyClipboard()
|
||||
}
|
||||
kterminal.copyClipboard()
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: pasteAction
|
||||
|
||||
onTriggered: {
|
||||
if (terminalContainer.isActive) {
|
||||
kterminal.pasteClipboard()
|
||||
}
|
||||
kterminal.pasteClipboard()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,16 +93,16 @@ Item{
|
||||
|
||||
property int textureResolutionScale: appSettings.lowResolutionFont ? Screen.devicePixelRatio : 1
|
||||
property int margin: appSettings.margin / screenScaling
|
||||
property int totalWidth: Math.floor(parent.width / (screenScaling * fontWidth))
|
||||
property int totalHeight: Math.floor(parent.height / screenScaling)
|
||||
property int totalWidth: Math.max(1, Math.floor(parent.width / (screenScaling * fontWidth)))
|
||||
property int totalHeight: Math.max(1, Math.floor(parent.height / screenScaling))
|
||||
|
||||
property int rawWidth: totalWidth - 2 * margin
|
||||
property int rawHeight: totalHeight - 2 * margin
|
||||
property int rawWidth: Math.max(1, totalWidth - 2 * margin)
|
||||
property int rawHeight: Math.max(1, totalHeight - 2 * margin)
|
||||
|
||||
textureSize: Qt.size(width / textureResolutionScale, height / textureResolutionScale)
|
||||
|
||||
width: ensureMultiple(rawWidth, Screen.devicePixelRatio)
|
||||
height: ensureMultiple(rawHeight, Screen.devicePixelRatio)
|
||||
width: Math.max(1, ensureMultiple(rawWidth, Screen.devicePixelRatio))
|
||||
height: Math.max(1, ensureMultiple(rawHeight, Screen.devicePixelRatio))
|
||||
|
||||
/** Ensure size is a multiple of factor. This is needed for pixel perfect scaling on highdpi screens. */
|
||||
function ensureMultiple(size, factor) {
|
||||
@@ -116,6 +111,7 @@ Item{
|
||||
|
||||
fullCursorHeight: true
|
||||
blinkingCursor: appSettings.blinkingCursor
|
||||
useFBORendering: appSettings.preferAcceleratedFontRendering
|
||||
|
||||
colorScheme: "cool-retro-term"
|
||||
|
||||
@@ -271,8 +267,11 @@ Item{
|
||||
hideSource: true
|
||||
wrapMode: ShaderEffectSource.Repeat
|
||||
visible: false
|
||||
textureSize: Qt.size(kterminal.totalWidth * scaleTexture, kterminal.totalHeight * scaleTexture)
|
||||
sourceRect: Qt.rect(-kterminal.margin, -kterminal.margin, kterminal.totalWidth, kterminal.totalHeight)
|
||||
textureSize: Qt.size(Math.max(1, kterminal.totalWidth * scaleTexture),
|
||||
Math.max(1, kterminal.totalHeight * scaleTexture))
|
||||
sourceRect: Qt.rect(-kterminal.margin, -kterminal.margin,
|
||||
Math.max(1, kterminal.totalWidth),
|
||||
Math.max(1, kterminal.totalHeight))
|
||||
}
|
||||
|
||||
Item {
|
||||
|
||||
@@ -146,6 +146,14 @@ ColumnLayout {
|
||||
SizedLabel {
|
||||
text: Math.round(burnInSlider.value * 100) + "%"
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
Layout.columnSpan: 4
|
||||
text: qsTr("Prefer accelerated font rendering")
|
||||
visible: appSettings.isLinux
|
||||
checked: appSettings.preferAcceleratedFontRendering
|
||||
onCheckedChanged: appSettings.preferAcceleratedFontRendering = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import "utils.js" as Utils
|
||||
ShaderTerminal {
|
||||
property alias title: terminal.title
|
||||
property alias terminalSize: terminal.terminalSize
|
||||
property bool isActive: false
|
||||
signal sessionFinished()
|
||||
|
||||
property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0
|
||||
@@ -45,7 +44,6 @@ ShaderTerminal {
|
||||
PreprocessedTerminal {
|
||||
id: terminal
|
||||
anchors.fill: parent
|
||||
isActive: mainShader.isActive
|
||||
onSessionFinished: mainShader.sessionFinished()
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,6 @@ Item {
|
||||
model: tabsModel
|
||||
TerminalContainer {
|
||||
property bool shouldHaveFocus: terminalWindow.active && StackLayout.isCurrentItem
|
||||
isActive: StackLayout.isCurrentItem
|
||||
onShouldHaveFocusChanged: {
|
||||
if (shouldHaveFocus) {
|
||||
activate()
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
import QtQuick
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
import "menus"
|
||||
|
||||
@@ -114,60 +114,9 @@ ApplicationWindow {
|
||||
Action {
|
||||
id: newTabAction
|
||||
text: qsTr("New Tab")
|
||||
shortcut: appSettings.isMacOS ? "Meta+T" : "Ctrl+Shift+T"
|
||||
shortcut: appSettings.isMacOS ? StandardKey.AddTab : "Ctrl+Shift+T"
|
||||
onTriggered: terminalTabs.addTab()
|
||||
}
|
||||
Action {
|
||||
id: closeTabAction
|
||||
text: qsTr("Close Tab")
|
||||
shortcut: appSettings.isMacOS ? "Meta+W" : "Ctrl+Shift+W"
|
||||
onTriggered: terminalTabs.closeTab(terminalTabs.currentIndex)
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+1" : "Alt+1"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 0) terminalTabs.currentIndex = 0
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+2" : "Alt+2"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 1) terminalTabs.currentIndex = 1
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+3" : "Alt+3"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 2) terminalTabs.currentIndex = 2
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+4" : "Alt+4"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 3) terminalTabs.currentIndex = 3
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+5" : "Alt+5"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 4) terminalTabs.currentIndex = 4
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+6" : "Alt+6"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 5) terminalTabs.currentIndex = 5
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+7" : "Alt+7"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 6) terminalTabs.currentIndex = 6
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+8" : "Alt+8"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 7) terminalTabs.currentIndex = 7
|
||||
}
|
||||
Shortcut {
|
||||
sequence: appSettings.isMacOS ? "Meta+9" : "Alt+9"
|
||||
context: Qt.WindowShortcut
|
||||
onActivated: if (terminalTabs.count > 8) terminalTabs.currentIndex = 8
|
||||
}
|
||||
TerminalTabs {
|
||||
id: terminalTabs
|
||||
width: parent.width
|
||||
|
||||
@@ -28,7 +28,6 @@ MenuBar {
|
||||
title: qsTr("File")
|
||||
MenuItem { action: newWindowAction }
|
||||
MenuItem { action: newTabAction }
|
||||
MenuItem { action: closeTabAction }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: quitAction }
|
||||
}
|
||||
|
||||
Submodule qmltermwidget updated: d86ebbc396...f1ff80ec69
Reference in New Issue
Block a user