mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 15:12:28 +00:00 
			
		
		
		
	Using new plugin. This is ported by me from qtermwidget (konsole). Removing manual management of the signals to rely more on Qt implementations.
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | [submodule "qmltermwidget"] | ||||||
|  | 	path = qmltermwidget | ||||||
|  | 	url = https://github.com/Swordfish90/qmltermwidget | ||||||
| @@ -39,7 +39,8 @@ int main(int argc, char *argv[]) | |||||||
|  |  | ||||||
|     // Manage import paths for Linux and OSX. |     // Manage import paths for Linux and OSX. | ||||||
|     QStringList importPathList = engine.importPathList(); |     QStringList importPathList = engine.importPathList(); | ||||||
|     importPathList.prepend(QCoreApplication::applicationDirPath() + "/imports/"); |     importPathList.prepend(QCoreApplication::applicationDirPath() + "/qmltermwidget"); | ||||||
|  |     //importPathList.prepend(QCoreApplication::applicationDirPath() + "/imports/"); | ||||||
|     importPathList.prepend(QCoreApplication::applicationDirPath() + "/../PlugIns"); |     importPathList.prepend(QCoreApplication::applicationDirPath() + "/../PlugIns"); | ||||||
|     engine.setImportPathList(importPathList); |     engine.setImportPathList(importPathList); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -22,7 +22,7 @@ import QtQuick 2.2 | |||||||
| import QtGraphicalEffects 1.0 | import QtGraphicalEffects 1.0 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 1.1 | ||||||
|  |  | ||||||
| import org.crt.konsole 0.1 | import QMLTermWidget 1.0 | ||||||
|  |  | ||||||
| Item{ | Item{ | ||||||
|     id: terminalContainer |     id: terminalContainer | ||||||
| @@ -52,8 +52,6 @@ Item{ | |||||||
|     onHeightChanged: sizeChanged() |     onHeightChanged: sizeChanged() | ||||||
|  |  | ||||||
|     //The blur effect has to take into account the framerate |     //The blur effect has to take into account the framerate | ||||||
|     property int fps: shadersettings.fps !== 0 ? shadersettings.fps : 60 |  | ||||||
|     property real fpsAttenuation: Math.sqrt(60 / fps) |  | ||||||
|     property real mBlur: shadersettings.motion_blur |     property real mBlur: shadersettings.motion_blur | ||||||
|     property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur)) |     property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur)) | ||||||
|     property real _minBlurCoefficient: 0.70 |     property real _minBlurCoefficient: 0.70 | ||||||
| @@ -96,11 +94,9 @@ Item{ | |||||||
|     } |     } | ||||||
|     function updateSources() { |     function updateSources() { | ||||||
|         kterminal.update(); |         kterminal.update(); | ||||||
|         kterminal.updateImage(); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     QMLTermWidget { | ||||||
|     KTerminal { |  | ||||||
|         id: kterminal |         id: kterminal | ||||||
|         width: parent.width |         width: parent.width | ||||||
|         height: parent.height |         height: parent.height | ||||||
| @@ -109,9 +105,8 @@ Item{ | |||||||
|  |  | ||||||
|         smooth: false |         smooth: false | ||||||
|  |  | ||||||
|         session: KSession { |         session: QMLTermSession { | ||||||
|             id: ksession |             id: ksession | ||||||
|             kbScheme: "xterm" |  | ||||||
|  |  | ||||||
|             onFinished: { |             onFinished: { | ||||||
|                 Qt.quit() |                 Qt.quit() | ||||||
| @@ -137,8 +132,8 @@ Item{ | |||||||
|                 return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture); |                 return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture); | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
|             setLineSpacing(lineSpacing); |             kterminal.lineSpacing = lineSpacing; | ||||||
|             update(); |             //update(); | ||||||
|             restartBlurredSource(); |             restartBlurredSource(); | ||||||
|         } |         } | ||||||
|         Component.onCompleted: { |         Component.onCompleted: { | ||||||
| @@ -174,29 +169,28 @@ Item{ | |||||||
|                wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger(); |                wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger(); | ||||||
|             } else { |             } else { | ||||||
|                 var coord = correctDistortion(wheel.x, wheel.y); |                 var coord = correctDistortion(wheel.x, wheel.y); | ||||||
|                 var lines = wheel.angleDelta.y > 0 ? -1 : 1; |                 kterminal.simulateWheel(coord.x, coord.y, wheel.buttons, wheel.modifiers, wheel.angleDelta); | ||||||
|                 kterminal.scrollWheelEvent(coord, lines); |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         onDoubleClicked: { |         onDoubleClicked: { | ||||||
|             var coord = correctDistortion(mouse.x, mouse.y); |             var coord = correctDistortion(mouse.x, mouse.y); | ||||||
|             kterminal.mouseDoubleClickEvent(coord, mouse.button, mouse.modifiers); |             kterminal.simulateMouseDoubleClick(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers); | ||||||
|         } |         } | ||||||
|         onPressed: { |         onPressed: { | ||||||
| 	    if((!kterminal.usesMouse || mouse.modifiers & Qt.ShiftModifier) && mouse.button == Qt.RightButton) { |             if((!kterminal.terminalUsesMouse || mouse.modifiers & Qt.ShiftModifier) && mouse.button == Qt.RightButton) { | ||||||
|                 contextmenu.popup(); |                 contextmenu.popup(); | ||||||
|             } else { |             } else { | ||||||
|                 var coord = correctDistortion(mouse.x, mouse.y); |                 var coord = correctDistortion(mouse.x, mouse.y); | ||||||
|                 kterminal.mousePressEvent(coord, mouse.button, mouse.modifiers) |                 kterminal.simulateMousePress(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         onReleased: { |         onReleased: { | ||||||
|             var coord = correctDistortion(mouse.x, mouse.y); |             var coord = correctDistortion(mouse.x, mouse.y); | ||||||
|             kterminal.mouseReleaseEvent(coord, mouse.button, mouse.modifiers); |             kterminal.simulateMouseRelease(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers); | ||||||
|         } |         } | ||||||
|         onPositionChanged: { |         onPositionChanged: { | ||||||
|             var coord = correctDistortion(mouse.x, mouse.y); |             var coord = correctDistortion(mouse.x, mouse.y); | ||||||
|             kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers); |             kterminal.simulateMouseMove(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         function correctDistortion(x, y){ |         function correctDistortion(x, y){ | ||||||
| @@ -215,17 +209,6 @@ Item{ | |||||||
|         sourceItem: kterminal |         sourceItem: kterminal | ||||||
|         hideSource: true |         hideSource: true | ||||||
|         wrapMode: ShaderEffectSource.ClampToEdge |         wrapMode: ShaderEffectSource.ClampToEdge | ||||||
|         live: false |  | ||||||
|  |  | ||||||
|         signal sourceUpdate |  | ||||||
|  |  | ||||||
|         Connections{ |  | ||||||
|             target: kterminal |  | ||||||
|             onUpdatedImage:{ |  | ||||||
|                 kterminalSource.scheduleUpdate(); |  | ||||||
|                 kterminalSource.sourceUpdate(); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|     Loader{ |     Loader{ | ||||||
|         id: blurredSourceLoader |         id: blurredSourceLoader | ||||||
| @@ -236,7 +219,7 @@ Item{ | |||||||
|             id: _blurredSourceEffect |             id: _blurredSourceEffect | ||||||
|             sourceItem: blurredTerminalLoader.item |             sourceItem: blurredTerminalLoader.item | ||||||
|             recursive: true |             recursive: true | ||||||
|             live: false |             live: true | ||||||
|             hideSource: true |             hideSource: true | ||||||
|             wrapMode: kterminalSource.wrapMode |             wrapMode: kterminalSource.wrapMode | ||||||
|  |  | ||||||
| @@ -249,20 +232,13 @@ Item{ | |||||||
|                 running: true |                 running: true | ||||||
|                 onRunningChanged: { |                 onRunningChanged: { | ||||||
|                     running ? |                     running ? | ||||||
|                         timeBinding.target = timeManager : |                         _blurredSourceEffect.live = true : | ||||||
|                         timeBinding.target = null |                         _blurredSourceEffect.live = false | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             Connections{ |             Connections{ | ||||||
|                 id: timeBinding |                 target: kterminal | ||||||
|                 target: timeManager |                 onImagePainted:{ | ||||||
|                 onTimeChanged: { |  | ||||||
|                     _blurredSourceEffect.scheduleUpdate(); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             Connections{ |  | ||||||
|                 target: kterminalSource |  | ||||||
|                 onSourceUpdate:{ |  | ||||||
|                     livetimer.restart(); |                     livetimer.restart(); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -275,6 +251,7 @@ Item{ | |||||||
|  |  | ||||||
|     Loader{ |     Loader{ | ||||||
|         id: blurredTerminalLoader |         id: blurredTerminalLoader | ||||||
|  |  | ||||||
|         width: kterminalSource.textureSize.width |         width: kterminalSource.textureSize.width | ||||||
|         height: kterminalSource.textureSize.height |         height: kterminalSource.textureSize.height | ||||||
|         active: mBlur !== 0 |         active: mBlur !== 0 | ||||||
| @@ -283,7 +260,7 @@ Item{ | |||||||
|         sourceComponent: ShaderEffect { |         sourceComponent: ShaderEffect { | ||||||
|             property variant txt_source: kterminalSource |             property variant txt_source: kterminalSource | ||||||
|             property variant blurredSource: blurredSourceLoader.item |             property variant blurredSource: blurredSourceLoader.item | ||||||
|             property real blurCoefficient: (1.0 - motionBlurCoefficient) * fpsAttenuation |             property real blurCoefficient: (1.0 - motionBlurCoefficient) | ||||||
|  |  | ||||||
|             blending: false |             blending: false | ||||||
|  |  | ||||||
| @@ -341,12 +318,7 @@ Item{ | |||||||
|             id: _bloomEffectSource |             id: _bloomEffectSource | ||||||
|             sourceItem: bloomEffectLoader.item |             sourceItem: bloomEffectLoader.item | ||||||
|             hideSource: true |             hideSource: true | ||||||
|             live: false |  | ||||||
|             smooth: true |             smooth: true | ||||||
|             Connections{ |  | ||||||
|                 target: kterminalSource |  | ||||||
|                 onSourceUpdate: _bloomEffectSource.scheduleUpdate(); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| TEMPLATE = subdirs | TEMPLATE = subdirs | ||||||
|  |  | ||||||
|  | CONFIG += ordered | ||||||
|  |  | ||||||
|  | SUBDIRS += qmltermwidget | ||||||
| SUBDIRS += app | SUBDIRS += app | ||||||
| SUBDIRS += konsole-qml-plugin |  | ||||||
|  |  | ||||||
| desktop.files += cool-retro-term.desktop | desktop.files += cool-retro-term.desktop | ||||||
| desktop.path += /usr/share/applications | desktop.path += /usr/share/applications | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								qmltermwidget
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								qmltermwidget
									
									
									
									
									
										Submodule
									
								
							 Submodule qmltermwidget added at 2834481395
									
								
							
		Reference in New Issue
	
	Block a user