mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-22 12:58:39 +00:00
Added selections copy and paste!
This commit is contained in:
parent
883520a9c6
commit
5d6040e45d
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
import QtQuick.Controls 1.0
|
||||||
|
|
||||||
import org.kde.konsole 0.1
|
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{
|
MouseArea{
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onWheel:
|
onWheel:
|
||||||
wheel.angleDelta.y > 0 ? kterminal.item.scrollUp() : kterminal.item.scrollDown()
|
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{
|
ShaderEffectSource{
|
||||||
id: source
|
id: source
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!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>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
@ -73,40 +73,6 @@
|
|||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
<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>
|
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
|
||||||
|
@ -106,8 +106,11 @@ ApplicationWindow{
|
|||||||
}
|
}
|
||||||
Terminal{
|
Terminal{
|
||||||
id: terminal
|
id: terminal
|
||||||
width: parent.width * shadersettings.terminal_scaling
|
anchors.centerIn: parent
|
||||||
height: parent.height * shadersettings.terminal_scaling
|
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{
|
ShaderEffectSource{
|
||||||
id: theSource
|
id: theSource
|
||||||
|
@ -5484,35 +5484,35 @@ compiler_clean: compiler_moc_header_clean
|
|||||||
####### Install
|
####### Install
|
||||||
|
|
||||||
install_target: first FORCE
|
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
|
@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)/tmp/cool/imports/org/kde/konsole/$(TARGET)"
|
-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/imports/org/kde/konsole/$(TARGET)"
|
||||||
-$(STRIP) --strip-unneeded "$(INSTALL_ROOT)/tmp/cool/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
|
uninstall_target: FORCE
|
||||||
-$(DEL_FILE) "$(INSTALL_ROOT)/tmp/cool/imports/org/kde/konsole/$(TARGET)"
|
-$(DEL_FILE) "$(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/imports/org/kde/konsole/$(TARGET)"
|
||||||
-$(DEL_DIR) $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
|
-$(DEL_DIR) $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
|
||||||
|
|
||||||
|
|
||||||
install_qmldir: first FORCE
|
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
|
@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) /tmp/cool/konsole-qml-plugin/src/qmldir $(INSTALL_ROOT)/tmp/cool/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) /tmp/cool/konsole-qml-plugin/src/plugins.qmltypes $(INSTALL_ROOT)/tmp/cool/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
|
uninstall_qmldir: FORCE
|
||||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/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/plugins.qmltypes
|
||||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/qmldir
|
-$(DEL_FILE) -r $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/qmldir
|
||||||
-$(DEL_DIR) $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
|
-$(DEL_DIR) $(INSTALL_ROOT)/home/swordfish/workspaces/qt5/cool-old-term/konsole-qml-plugin/../imports/org/kde/konsole/
|
||||||
|
|
||||||
|
|
||||||
install_assets: first FORCE
|
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
|
@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) /tmp/cool/konsole-qml-plugin/assets/color-schemes $(INSTALL_ROOT)/tmp/cool/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) /tmp/cool/konsole-qml-plugin/assets/kb-layouts $(INSTALL_ROOT)/tmp/cool/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
|
uninstall_assets: FORCE
|
||||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/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/kb-layouts
|
||||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/color-schemes
|
-$(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)/tmp/cool/konsole-qml-plugin/../imports/org/kde/konsole/
|
-$(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
|
install: install_target install_qmldir install_assets FORCE
|
||||||
|
@ -65,9 +65,9 @@
|
|||||||
"0123456789./+@"
|
"0123456789./+@"
|
||||||
|
|
||||||
const ColorEntry base_color_table[TABLE_COLORS] =
|
const ColorEntry base_color_table[TABLE_COLORS] =
|
||||||
// The following are almost IBM standard color codes, with some slight
|
// The following are almost IBM standard color codes, with some slight
|
||||||
// gamma correction for the dim colors to compensate for bright X screens.
|
// gamma correction for the dim colors to compensate for bright X screens.
|
||||||
// It contains the 8 ansiterm/xterm colors in 2 intensities.
|
// It contains the 8 ansiterm/xterm colors in 2 intensities.
|
||||||
{
|
{
|
||||||
// Fixme: could add faint colors here, also.
|
// Fixme: could add faint colors here, also.
|
||||||
// normal
|
// normal
|
||||||
@ -82,7 +82,7 @@ const ColorEntry base_color_table[TABLE_COLORS] =
|
|||||||
ColorEntry(QColor(0x54,0xFF,0x54), 0), ColorEntry( QColor(0xFF,0xFF,0x54), 0),
|
ColorEntry(QColor(0x54,0xFF,0x54), 0), ColorEntry( QColor(0xFF,0xFF,0x54), 0),
|
||||||
ColorEntry(QColor(0x54,0x54,0xFF), 0), ColorEntry( QColor(0xFF,0x54,0xFF), 0),
|
ColorEntry(QColor(0x54,0x54,0xFF), 0), ColorEntry( QColor(0xFF,0x54,0xFF), 0),
|
||||||
ColorEntry(QColor(0x54,0xFF,0xFF), 0), ColorEntry( QColor(0xFF,0xFF,0xFF), 0)
|
ColorEntry(QColor(0x54,0xFF,0xFF), 0), ColorEntry( QColor(0xFF,0xFF,0xFF), 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
// scroll increment used when dragging selection at top/bottom of window.
|
// scroll increment used when dragging selection at top/bottom of window.
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ KTerminalDisplay::KTerminalDisplay(QQuickItem *parent) :
|
|||||||
|
|
||||||
setColorTable(base_color_table);
|
setColorTable(base_color_table);
|
||||||
|
|
||||||
new AutoScrollHandler(this);
|
//new AutoScrollHandler(this);
|
||||||
|
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
setFlags(ItemHasContents | ItemAcceptsInputMethod);
|
setFlags(ItemHasContents | ItemAcceptsInputMethod);
|
||||||
@ -280,8 +280,8 @@ void KTerminalDisplay::setScreenWindow(ScreenWindow* window)
|
|||||||
if ( window )
|
if ( window )
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO: Determine if this is an issue.
|
// TODO: Determine if this is an issue.
|
||||||
//#warning "The order here is not specified - does it matter whether updateImage or updateLineProperties comes first?"
|
//#warning "The order here is not specified - does it matter whether updateImage or updateLineProperties comes first?"
|
||||||
connect( _screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateLineProperties()) );
|
connect( _screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateLineProperties()) );
|
||||||
connect( _screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateImage()) );
|
connect( _screenWindow , SIGNAL(outputChanged()) , this , SLOT(updateImage()) );
|
||||||
window->setWindowLines(_lines);
|
window->setWindowLines(_lines);
|
||||||
@ -295,9 +295,9 @@ const ColorEntry* KTerminalDisplay::colorTable() const
|
|||||||
void KTerminalDisplay::setBackgroundColor(const QColor& color)
|
void KTerminalDisplay::setBackgroundColor(const QColor& color)
|
||||||
{
|
{
|
||||||
_colorTable[DEFAULT_BACK_COLOR].color = color;
|
_colorTable[DEFAULT_BACK_COLOR].color = color;
|
||||||
// QPalette p = m_palette;
|
// QPalette p = m_palette;
|
||||||
// p.setColor( backgroundRole(), color );
|
// p.setColor( backgroundRole(), color );
|
||||||
// setPalette( p );
|
// setPalette( p );
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -452,10 +452,41 @@ QStringList KTerminalDisplay::availableColorSchemes()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KTerminalDisplay::click(qreal x, qreal y)
|
void KTerminalDisplay::mousePress(qreal x, qreal y){
|
||||||
{
|
if (m_focusOnClick) forcedFocus();
|
||||||
QMouseEvent me(QEvent::MouseButtonPress, QPointF(x,y), Qt::RightButton, Qt::RightButton, Qt::NoModifier);
|
if (m_showVKBonClick) ShowVKB(true);
|
||||||
mousePressEvent(&me);
|
|
||||||
|
emit clicked();
|
||||||
|
|
||||||
|
int charLine;
|
||||||
|
int charColumn;
|
||||||
|
getCharacterPosition(QPoint(x,y), charLine, charColumn);
|
||||||
|
|
||||||
|
QPoint pos = QPoint(charColumn, charLine);
|
||||||
|
|
||||||
|
_wordSelectionMode = false;
|
||||||
|
_lineSelectionMode = false;
|
||||||
|
|
||||||
|
_screenWindow->clearSelection();
|
||||||
|
_iPntSel = _pntSel = pos;
|
||||||
|
_actSel = 1; // left mouse button pressed but nothing selected yet.
|
||||||
|
}
|
||||||
|
|
||||||
|
void KTerminalDisplay::mouseMove(qreal x, qreal y){
|
||||||
|
QPoint pos(x, y);
|
||||||
|
extendSelection(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KTerminalDisplay::mouseDoubleClick(qreal x, qreal y){
|
||||||
|
_wordSelectionMode = true;
|
||||||
|
QPoint pos(x, y);
|
||||||
|
extendSelection(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KTerminalDisplay::mouseRelease(qreal x, qreal y){
|
||||||
|
Q_UNUSED(x);
|
||||||
|
Q_UNUSED(y);
|
||||||
|
_actSel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KTerminalDisplay::setAutoFocus(bool au)
|
void KTerminalDisplay::setAutoFocus(bool au)
|
||||||
@ -1333,7 +1364,16 @@ void KTerminalDisplay::pasteClipboard()
|
|||||||
|
|
||||||
void KTerminalDisplay::pasteSelection()
|
void KTerminalDisplay::pasteSelection()
|
||||||
{
|
{
|
||||||
emitSelection(true,false);
|
if (!_screenWindow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString text = _screenWindow->selectedText(_preserveLineBreaks);
|
||||||
|
if (text.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
text.replace('\n', '\r');
|
||||||
|
QKeyEvent e(QEvent::KeyPress, 0, Qt::NoModifier, text);
|
||||||
|
emit keyPressedSignal(&e); // expose as a big fat keypress event
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@ -1348,8 +1388,8 @@ void KTerminalDisplay::setFlowControlWarningEnabled( bool enable )
|
|||||||
|
|
||||||
// if the dialog is currently visible and the flow control warning has
|
// if the dialog is currently visible and the flow control warning has
|
||||||
// been disabled then hide the dialog
|
// been disabled then hide the dialog
|
||||||
// if (!enable)
|
// if (!enable)
|
||||||
// outputSuspended(false);
|
// outputSuspended(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KTerminalDisplay::inputMethodEvent( QInputMethodEvent* event )
|
void KTerminalDisplay::inputMethodEvent( QInputMethodEvent* event )
|
||||||
@ -1506,15 +1546,6 @@ QRect KTerminalDisplay::geometryRound(const QRectF &r) const
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KTerminalDisplay::mousePressEvent(QMouseEvent *ev)
|
|
||||||
{
|
|
||||||
if (m_focusOnClick) forcedFocus();
|
|
||||||
if (m_showVKBonClick) ShowVKB(true);
|
|
||||||
|
|
||||||
emit clicked();
|
|
||||||
QQuickPaintedItem::mouseMoveEvent(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KTerminalDisplay::setBellMode(int mode)
|
void KTerminalDisplay::setBellMode(int mode)
|
||||||
{
|
{
|
||||||
_bellMode=mode;
|
_bellMode=mode;
|
||||||
@ -2004,8 +2035,8 @@ void KTerminalDisplay::getCharacterPosition(const QPointF &widgetPoint, int& lin
|
|||||||
//contentsBoundingRect()
|
//contentsBoundingRect()
|
||||||
QRectF rect = m_widgetRect;
|
QRectF rect = m_widgetRect;
|
||||||
|
|
||||||
column = qRound((widgetPoint.x() + _fontWidth/2 - rect.left()-_leftMargin) / _fontWidth);
|
column = qFloor((widgetPoint.x() + _fontWidth/2 - rect.left()-_leftMargin) / _fontWidth);
|
||||||
line = qRound((widgetPoint.y() - rect.top()-_topMargin) / _fontHeight);
|
line = qFloor((widgetPoint.y() - rect.top()-_topMargin) / _fontHeight);
|
||||||
|
|
||||||
if ( line < 0 )
|
if ( line < 0 )
|
||||||
line = 0;
|
line = 0;
|
||||||
@ -2123,62 +2154,62 @@ void KTerminalDisplay::keyPressEvent(QKeyEvent *event)
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
AutoScrollHandler::AutoScrollHandler(QQuickItem* parent)
|
//AutoScrollHandler::AutoScrollHandler(QQuickItem* parent)
|
||||||
: QObject(parent)
|
//: QObject(parent)
|
||||||
, _timerId(0)
|
//, _timerId(0)
|
||||||
{
|
//{
|
||||||
parent->installEventFilter(this);
|
// parent->installEventFilter(this);
|
||||||
}
|
//}
|
||||||
void AutoScrollHandler::timerEvent(QTimerEvent* event)
|
//void AutoScrollHandler::timerEvent(QTimerEvent* event)
|
||||||
{
|
//{
|
||||||
if (event->timerId() != _timerId)
|
// if (event->timerId() != _timerId)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
QMouseEvent mouseEvent( QEvent::MouseMove,
|
// QMouseEvent mouseEvent( QEvent::MouseMove,
|
||||||
widget()->mapFromScene(QCursor::pos()),
|
// widget()->mapFromScene(QCursor::pos()),
|
||||||
Qt::NoButton,
|
// Qt::NoButton,
|
||||||
Qt::LeftButton,
|
// Qt::LeftButton,
|
||||||
Qt::NoModifier);
|
// Qt::NoModifier);
|
||||||
|
|
||||||
QGuiApplication::sendEvent(widget(),&mouseEvent);
|
// QGuiApplication::sendEvent(widget(),&mouseEvent);
|
||||||
}
|
//}
|
||||||
bool AutoScrollHandler::eventFilter(QObject* watched,QEvent* event)
|
//bool AutoScrollHandler::eventFilter(QObject* watched,QEvent* event)
|
||||||
{
|
//{
|
||||||
Q_ASSERT( watched == parent() );
|
// Q_ASSERT( watched == parent() );
|
||||||
Q_UNUSED( watched );
|
// Q_UNUSED( watched );
|
||||||
|
|
||||||
QMouseEvent* mouseEvent = (QMouseEvent*)event;
|
// QMouseEvent* mouseEvent = (QMouseEvent*)event;
|
||||||
switch (event->type())
|
// switch (event->type())
|
||||||
{
|
// {
|
||||||
case QEvent::MouseMove:
|
// case QEvent::MouseMove:
|
||||||
{
|
// {
|
||||||
bool mouseInWidget = false; //widget()->rect().contains(mouseEvent->pos());
|
// bool mouseInWidget = false; //widget()->rect().contains(mouseEvent->pos());
|
||||||
|
|
||||||
if (mouseInWidget)
|
// if (mouseInWidget)
|
||||||
{
|
// {
|
||||||
if (_timerId)
|
// if (_timerId)
|
||||||
killTimer(_timerId);
|
// killTimer(_timerId);
|
||||||
_timerId = 0;
|
// _timerId = 0;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
if (!_timerId && (mouseEvent->buttons() & Qt::LeftButton))
|
// if (!_timerId && (mouseEvent->buttons() & Qt::LeftButton))
|
||||||
_timerId = startTimer(100);
|
// _timerId = startTimer(100);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case QEvent::MouseButtonRelease:
|
// case QEvent::MouseButtonRelease:
|
||||||
if (_timerId && (mouseEvent->buttons() & ~Qt::LeftButton))
|
// if (_timerId && (mouseEvent->buttons() & ~Qt::LeftButton))
|
||||||
{
|
// {
|
||||||
killTimer(_timerId);
|
// killTimer(_timerId);
|
||||||
_timerId = 0;
|
// _timerId = 0;
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
break;
|
// break;
|
||||||
};
|
// };
|
||||||
|
|
||||||
return false;
|
// return false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
//#include "TerminalDisplay.moc"
|
//#include "TerminalDisplay.moc"
|
||||||
|
@ -304,7 +304,10 @@ public slots:
|
|||||||
void setColorScheme(const QString &name);
|
void setColorScheme(const QString &name);
|
||||||
QStringList availableColorSchemes();
|
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; }
|
bool autoFocus() { return m_focusOnClick; }
|
||||||
void setAutoFocus(bool au);
|
void setAutoFocus(bool au);
|
||||||
@ -456,9 +459,9 @@ protected:
|
|||||||
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
|
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
|
||||||
QRect geometryRound(const QRectF &r) const;
|
QRect geometryRound(const QRectF &r) const;
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent*ev);
|
//void mousePressEvent(QMouseEvent*ev);
|
||||||
// void mouseReleaseEvent( QMouseEvent* );
|
//void mouseReleaseEvent( QMouseEvent* );
|
||||||
// void mouseMoveEvent( QMouseEvent* );
|
//void mouseMoveEvent( QMouseEvent* );
|
||||||
|
|
||||||
void focusInEvent(QFocusEvent* event);
|
void focusInEvent(QFocusEvent* event);
|
||||||
void focusOutEvent(QFocusEvent* event);
|
void focusOutEvent(QFocusEvent* event);
|
||||||
@ -677,7 +680,6 @@ private:
|
|||||||
// color of the character under the cursor is used
|
// color of the character under the cursor is used
|
||||||
QColor _cursorColor;
|
QColor _cursorColor;
|
||||||
|
|
||||||
|
|
||||||
struct InputMethodData
|
struct InputMethodData
|
||||||
{
|
{
|
||||||
QString preeditString;
|
QString preeditString;
|
||||||
@ -701,20 +703,20 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutoScrollHandler : public QObject
|
//class AutoScrollHandler : public QObject
|
||||||
{
|
//{
|
||||||
Q_OBJECT
|
// Q_OBJECT
|
||||||
|
|
||||||
public:
|
//public:
|
||||||
AutoScrollHandler(QQuickItem* parent);
|
// AutoScrollHandler(QQuickItem* parent);
|
||||||
|
|
||||||
protected:
|
//protected:
|
||||||
virtual void timerEvent(QTimerEvent* event);
|
// virtual void timerEvent(QTimerEvent* event);
|
||||||
virtual bool eventFilter(QObject* watched,QEvent* event);
|
// virtual bool eventFilter(QObject* watched,QEvent* event);
|
||||||
|
|
||||||
private:
|
//private:
|
||||||
QQuickItem* widget() const { return static_cast<QQuickItem*>(parent()); }
|
// QQuickItem* widget() const { return static_cast<QQuickItem*>(parent()); }
|
||||||
int _timerId;
|
// int _timerId;
|
||||||
};
|
//};
|
||||||
|
|
||||||
#endif // TERMINALDISPLAY_H
|
#endif // TERMINALDISPLAY_H
|
||||||
|
@ -118,7 +118,22 @@ Module {
|
|||||||
}
|
}
|
||||||
Method { name: "availableColorSchemes"; type: "QStringList" }
|
Method { name: "availableColorSchemes"; type: "QStringList" }
|
||||||
Method {
|
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: "x"; type: "double" }
|
||||||
Parameter { name: "y"; type: "double" }
|
Parameter { name: "y"; type: "double" }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user