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

View File

@ -5484,35 +5484,35 @@ compiler_clean: compiler_moc_header_clean
####### Install
install_target: first FORCE
@test -d $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole
-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/tmp/cool/imports/org/kde/konsole/$(TARGET)"
-$(STRIP) --strip-unneeded "$(INSTALL_ROOT)/tmp/cool/imports/org/kde/konsole/$(TARGET)"
@test -d $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole
-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/imports/org/kde/konsole/$(TARGET)"
-$(STRIP) --strip-unneeded "$(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/imports/org/kde/konsole/$(TARGET)"
uninstall_target: FORCE
-$(DEL_FILE) "$(INSTALL_ROOT)/tmp/cool/imports/org/kde/konsole/$(TARGET)"
-$(DEL_DIR) $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
-$(DEL_FILE) "$(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/imports/org/kde/konsole/$(TARGET)"
-$(DEL_DIR) $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
install_qmldir: first FORCE
@test -d $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole
-$(INSTALL_FILE) /tmp/cool/konsole-qml-plugin/src/qmldir $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
-$(INSTALL_FILE) /tmp/cool/konsole-qml-plugin/src/plugins.qmltypes $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
@test -d $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole
-$(INSTALL_FILE) /home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/src/qmldir $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
-$(INSTALL_FILE) /home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/src/plugins.qmltypes $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
uninstall_qmldir: FORCE
-$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/plugins.qmltypes
-$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/qmldir
-$(DEL_DIR) $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
-$(DEL_FILE) -r $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/plugins.qmltypes
-$(DEL_FILE) -r $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/qmldir
-$(DEL_DIR) $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
install_assets: first FORCE
@test -d $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole
-$(INSTALL_DIR) /tmp/cool/konsole-qml-plugin/assets/color-schemes $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
-$(INSTALL_DIR) /tmp/cool/konsole-qml-plugin/assets/kb-layouts $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
@test -d $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole || mkdir -p $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole
-$(INSTALL_DIR) /home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/assets/color-schemes $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
-$(INSTALL_DIR) /home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/assets/kb-layouts $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
uninstall_assets: FORCE
-$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/kb-layouts
-$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/color-schemes
-$(DEL_DIR) $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
-$(DEL_FILE) -r $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/kb-layouts
-$(DEL_FILE) -r $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/color-schemes
-$(DEL_DIR) $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
install: install_target install_qmldir install_assets FORCE

File diff suppressed because it is too large Load Diff

View File

@ -304,7 +304,10 @@ public slots:
void setColorScheme(const QString &name);
QStringList availableColorSchemes();
void click(qreal x, qreal y);
void mousePress(qreal x, qreal y);
void mouseMove(qreal x, qreal y);
void mouseDoubleClick(qreal x, qreal y);
void mouseRelease(qreal x, qreal y);
bool autoFocus() { return m_focusOnClick; }
void setAutoFocus(bool au);
@ -456,9 +459,9 @@ protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
QRect geometryRound(const QRectF &r) const;
void mousePressEvent(QMouseEvent*ev);
// void mouseReleaseEvent( QMouseEvent* );
// void mouseMoveEvent( QMouseEvent* );
//void mousePressEvent(QMouseEvent*ev);
//void mouseReleaseEvent( QMouseEvent* );
//void mouseMoveEvent( QMouseEvent* );
void focusInEvent(QFocusEvent* event);
void focusOutEvent(QFocusEvent* event);
@ -677,7 +680,6 @@ private:
// color of the character under the cursor is used
QColor _cursorColor;
struct InputMethodData
{
QString preeditString;
@ -701,20 +703,20 @@ public:
}
};
class AutoScrollHandler : public QObject
{
Q_OBJECT
//class AutoScrollHandler : public QObject
//{
// Q_OBJECT
public:
AutoScrollHandler(QQuickItem* parent);
//public:
// AutoScrollHandler(QQuickItem* parent);
protected:
virtual void timerEvent(QTimerEvent* event);
virtual bool eventFilter(QObject* watched,QEvent* event);
//protected:
// virtual void timerEvent(QTimerEvent* event);
// virtual bool eventFilter(QObject* watched,QEvent* event);
private:
QQuickItem* widget() const { return static_cast<QQuickItem*>(parent()); }
int _timerId;
};
//private:
// QQuickItem* widget() const { return static_cast<QQuickItem*>(parent()); }
// int _timerId;
//};
#endif // TERMINALDISPLAY_H

View File

@ -118,7 +118,22 @@ Module {
}
Method { name: "availableColorSchemes"; type: "QStringList" }
Method {
name: "click"
name: "mousePress"
Parameter { name: "x"; type: "double" }
Parameter { name: "y"; type: "double" }
}
Method {
name: "mouseMove"
Parameter { name: "x"; type: "double" }
Parameter { name: "y"; type: "double" }
}
Method {
name: "mouseRelease"
Parameter { name: "x"; type: "double" }
Parameter { name: "y"; type: "double" }
}
Method {
name: "mouseDoubleClick"
Parameter { name: "x"; type: "double" }
Parameter { name: "y"; type: "double" }
}