Add zoom. Add choice action after paste clipboard

This commit is contained in:
Francisco Ballina
2012-11-19 23:10:35 -06:00
parent ba19af937d
commit b398acfbd4
6 changed files with 206 additions and 5 deletions
+146
View File
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.5.2, 2012-11-19T23:08:55. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QString" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">1</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">2</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">false</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">false</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.DefaultCMakeTarget</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory">/home/francisco/Documentos/Desarrollo/git/qtermwidget-build</value>
<value type="QString" key="CMakeProjectManager.CMakeBuildConfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:{84586ad0-f048-47e8-813a-5e9c5be87284}</value>
<value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:{84586ad0-f048-47e8-813a-5e9c5be87284}</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="CMakeProjectManager.MakeStep.Clean">false</value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments">clean</value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="CMakeProjectManager.MakeStep.Clean">true</value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">all</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
<value type="int" key="CMakeProjectManager.BaseEnvironmentBase">2</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">test</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="bool" key="CMakeProjectManager.CMakeRunConfiguration.UseTerminal">false</value>
<valuelist type="QVariantList" key="CMakeProjectManager.CMakeRunConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">test</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QString">{4024c359-f0e5-499d-b6dc-dd7c55d4c58c}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">11</value>
</data>
</qtcreator>
+22 -1
View File
@@ -337,6 +337,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_blendColor(qRgba(0,0,0,0xff))
,_filterChain(new TerminalImageFilterChain())
,_cursorShape(BlockCursor)
,mMotionAfterPasting(NoMoveScreenWindow)
{
// terminal applications are not designed with Right-To-Left in mind,
// so the layout is forced to Left-To-Right
@@ -2512,6 +2513,16 @@ void TerminalDisplay::setFlowControlWarningEnabled( bool enable )
outputSuspended(false);
}
void TerminalDisplay::setMotionAfterPasting(MotionAfterPasting action)
{
mMotionAfterPasting = action;
}
int TerminalDisplay::motionAfterPasting()
{
return mMotionAfterPasting;
}
void TerminalDisplay::keyPressEvent( QKeyEvent* event )
{
bool emitKeyPressSignal = true;
@@ -2580,7 +2591,17 @@ void TerminalDisplay::keyPressEvent( QKeyEvent* event )
|| event->modifiers().testFlag(Qt::ControlModifier)
|| event->modifiers().testFlag(Qt::AltModifier)))
{
scrollToEnd();
switch(mMotionAfterPasting)
{
case MoveStartScreenWindow:
_screenWindow->scrollTo(0);
break;
case MoveEndScreenWindow:
scrollToEnd();
break;
case NoMoveScreenWindow:
break;
}
}
}
+17 -1
View File
@@ -51,6 +51,17 @@ class QWidget;
namespace Konsole
{
enum MotionAfterPasting
{
// No move screenwindow after pasting
NoMoveScreenWindow = 0,
// Move start of screenwindow after pasting
MoveStartScreenWindow = 1,
// Move end of screenwindow after pasting
MoveEndScreenWindow = 2
};
extern unsigned short vt100_graphics[32];
class ScreenWindow;
@@ -414,7 +425,10 @@ public:
ScreenWindow* screenWindow() const;
static bool HAVE_TRANSPARENCY;
void setMotionAfterPasting(MotionAfterPasting action);
int motionAfterPasting();
public slots:
/**
@@ -794,6 +808,8 @@ private:
QColor _cursorColor;
MotionAfterPasting mMotionAfterPasting;
struct InputMethodData
{
QString preeditString;
+12
View File
@@ -329,6 +329,13 @@ void QTermWidget::pasteClipboard()
m_impl->m_terminalDisplay->pasteClipboard();
}
void QTermWidget::setZoom(uint step)
{
QFont font = m_impl->m_terminalDisplay->getVTFont();
font.setPixelSize(font.pointSize() + step > 5 ? font.pointSize() + step: font.pointSize());
m_impl->m_terminalDisplay->setVTFont(font);
}
void QTermWidget::setKeyBindings(const QString & kb)
{
m_impl->m_session->setKeyBindings(kb);
@@ -373,3 +380,8 @@ void QTermWidget::setEnvironment(const QStringList& environment)
{
m_impl->m_session->setEnvironment(environment);
}
void QTermWidget::setMotionAfterPasting(int action)
{
m_impl->m_terminalDisplay->setMotionAfterPasting((Konsole::MotionAfterPasting) action);
}
+5 -1
View File
@@ -38,7 +38,6 @@ public:
ScrollBarRight=2
};
//Creation of widget
QTermWidget(int startnow, // 1 = start shell programm immediatelly
QWidget * parent = 0);
@@ -119,6 +118,8 @@ public:
//! Return current key bindings
QString keyBindings();
void setMotionAfterPasting(int);
signals:
void finished();
@@ -136,6 +137,9 @@ public slots:
// Copies selection to clipboard
void pasteClipboard();
// Set zoom
void setZoom(uint step);
/*! Set named key binding for given widget
*/
void setKeyBindings(const QString & kb);
+4 -2
View File
@@ -21,12 +21,14 @@
#include <QtGui>
#include <QApplication>
#include <QtDebug>
#include <cstdlib>
#include "qtermwidget.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
setenv("TERM", "xterm", 1);
QApplication app(argc, argv);
QMainWindow *mainWindow = new QMainWindow();
QTermWidget *console = new QTermWidget();
@@ -41,7 +43,7 @@ int main(int argc, char *argv[])
console->setTerminalFont(font);
//console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW);
// console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW);
console->setScrollBarPosition(QTermWidget::ScrollBarRight);
foreach (QString arg, QApplication::arguments())