Added selections copy and paste!

This commit is contained in:
Filippo Scognamiglio
2014-04-16 19:18:14 +02:00
parent 883520a9c6
commit 5d6040e45d
7 changed files with 973 additions and 903 deletions

View File

@@ -20,6 +20,7 @@
import QtQuick 2.0
import QtGraphicalEffects 1.0
import QtQuick.Controls 1.0
import org.kde.konsole 0.1
@@ -82,11 +83,63 @@ Item{
}
}
}
Menu{
id: contextmenu
MenuItem{
text: qsTr("Copy")
onTriggered: kterminal.item.copyClipboard()
}
MenuItem{
text: qsTr("Paste")
onTriggered: kterminal.item.pasteClipboard()
}
}
MouseArea{
acceptedButtons: Qt.NoButton
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
anchors.fill: parent
onWheel:
wheel.angleDelta.y > 0 ? kterminal.item.scrollUp() : kterminal.item.scrollDown()
onClicked: {
console.log(correctDistortion(0,0))
if (mouse.button == Qt.RightButton){
contextmenu.popup();
} else if (mouse.button == Qt.MiddleButton){
kterminal.item.pasteSelection();
}
}
onDoubleClicked: {
if (mouse.button == Qt.LeftButton){
var coord = correctDistortion(mouse.x, mouse.y);
kterminal.item.mouseDoubleClick(coord.width, coord.height);
}
}
onPositionChanged: {
var coord = correctDistortion(mouse.x, mouse.y);
kterminal.item.mouseMove(coord.width, coord.height);
}
onPressed: {
if (mouse.button == Qt.LeftButton){
var coord = correctDistortion(mouse.x, mouse.y);
kterminal.item.mousePress(coord.width, coord.height);
}
}
onReleased: {
if (mouse.button == Qt.LeftButton){
kterminal.item.mouseRelease(mouse.x, mouse.y);
}
}
function correctDistortion(x, y){
x = x / width;
y = y / height;
var cc = Qt.size(0.5 - x, 0.5 - y);
var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion;
return Qt.size((x - cc.width * (1+distortion) * distortion) * width,
(y - cc.height * (1+distortion) * distortion) * height)
}
}
ShaderEffectSource{
id: source

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-04-06T17:39:45. -->
<!-- Written by QtCreator 3.0.1, 2014-04-16T10:55:04. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -73,40 +73,6 @@
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>

View File

@@ -106,8 +106,11 @@ ApplicationWindow{
}
Terminal{
id: terminal
width: parent.width * shadersettings.terminal_scaling
height: parent.height * shadersettings.terminal_scaling
anchors.centerIn: parent
property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight
property int frameOffsetY: frame.item.addedHeight -frame.item.borderTop - frame.item.borderBottom
width: (parent.width + frameOffsetX) * shadersettings.terminal_scaling
height: (parent.height + frameOffsetY) * shadersettings.terminal_scaling
}
ShaderEffectSource{
id: theSource