Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 60f0a0a5 authored by Diego Iastrubni's avatar Diego Iastrubni

New backport (??) from KDE3: now each profile can enable/disable BiDi...

New backport (??) from KDE3: now each profile can enable/disable BiDi rendering in the display. We need this since many console based application (vim, emacs, fribidi etc)
implement their own BiDi algorithm. There is also another reason: comatibility. All terminals are *not* aware of the BiDi issue and do not re-order the chars
(gnome-terminal, xterm, konsole, etc). It is possible to enable the BiDi rendering on each profile, so this is not a huge lost. I am still missing the keyboard shortcut to
quickly enable/disable it (alt+control+b in konsole3), but I am not sure what is the best way for doing it.

A quick note about the implementation:
In QPainter3, there was an option to draw a text and tell the painter "please do not implement BiDi". In QPainter4 (up to 4.4) there is no such option. I am forcing it by
drawing  "painter.drawText(rect,0,QChar(0x202D)+text)" (that is &LRO;), and it does seem to work, but I find it kinda "hackish". I will open a task in Trolltech and
request that new feature. Hopefully by Qt4.5/KDE4.2 I will be able to change the implementation.


svn path=/trunk/KDE/kdebase/apps/konsole/; revision=791374
parent f73cc9c7
......@@ -924,6 +924,8 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
SLOT(toggleResizeWindow(bool)) },
{ _ui->enableBlinkingCursorButton , Profile::BlinkingCursorEnabled ,
SLOT(toggleBlinkingCursor(bool)) },
{ _ui->enableBidiRenderingButton , Profile::BidiRenderingEnabled ,
SLOT(togglebidiRendering(bool)) },
{ 0 , 0 , 0 }
};
setupCombo( options , profile );
......@@ -990,6 +992,10 @@ void EditProfileDialog::setCursorShape(int index)
{
_tempProfile->setProperty(Profile::CursorShape,index);
}
void EditProfileDialog::togglebidiRendering(bool enable)
{
_tempProfile->setProperty(Profile::BidiRenderingEnabled,enable);
}
void EditProfileDialog::toggleBlinkingCursor(bool enable)
{
_tempProfile->setProperty(Profile::BlinkingCursorEnabled,enable);
......
......@@ -158,6 +158,7 @@ private slots:
void toggleBlinkingText(bool);
void toggleFlowControl(bool);
void toggleResizeWindow(bool);
void togglebidiRendering(bool);
void toggleBlinkingCursor(bool);
void setCursorShape(int);
......
......@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>441</width>
<height>499</height>
<height>529</height>
</rect>
</property>
<layout class="QHBoxLayout" >
......@@ -33,7 +33,7 @@
<x>0</x>
<y>0</y>
<width>429</width>
<height>461</height>
<height>489</height>
</rect>
</property>
<attribute name="title" >
......@@ -246,7 +246,7 @@
<x>0</x>
<y>0</y>
<width>429</width>
<height>461</height>
<height>489</height>
</rect>
</property>
<attribute name="title" >
......@@ -389,7 +389,7 @@
<x>0</x>
<y>0</y>
<width>429</width>
<height>461</height>
<height>489</height>
</rect>
</property>
<attribute name="title" >
......@@ -607,7 +607,7 @@
<x>0</x>
<y>0</y>
<width>429</width>
<height>461</height>
<height>489</height>
</rect>
</property>
<attribute name="title" >
......@@ -785,7 +785,7 @@
<x>0</x>
<y>0</y>
<width>429</width>
<height>461</height>
<height>489</height>
</rect>
</property>
<attribute name="title" >
......@@ -875,7 +875,7 @@
<x>0</x>
<y>0</y>
<width>429</width>
<height>461</height>
<height>489</height>
</rect>
</property>
<attribute name="title" >
......@@ -939,6 +939,22 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableBidiRenderingButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Enable BiDirectional display on terminals (valid for Arabic, Farsi or Hebrew only)</string>
</property>
<property name="text" >
<string>Enable BiDi rendering </string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -98,6 +98,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] =
, { BlinkingTextEnabled , "BlinkingTextEnabled" , TERMINAL_GROUP , QVariant::Bool }
, { FlowControlEnabled , "FlowControlEnabled" , TERMINAL_GROUP , QVariant::Bool }
, { AllowProgramsToResizeWindow , "AllowProgramsToResizeWindow" , TERMINAL_GROUP , QVariant::Bool }
, { BidiRenderingEnabled , "BidiRenderingEnabled" , TERMINAL_GROUP , QVariant::Bool }
, { BlinkingCursorEnabled , "BlinkingCursorEnabled" , TERMINAL_GROUP , QVariant::Bool }
// Cursor
......
......@@ -147,7 +147,8 @@ public:
* terminal displays using this profile.
*/
ScrollBarPosition,
/** (bool) Specifies whether the terminal will enable Bidirectional text display */
BidiRenderingEnabled,
/** (bool) Specifies whether text in terminal displays is allowed to blink. */
BlinkingTextEnabled,
/** (bool) Specifies whether the flow control keys ( typically Ctrl+S , Ctrl+Q )
......
......@@ -668,16 +668,19 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
// draw text
if ( isLineCharString(text) )
drawLineCharString(painter,rect.x(),rect.y(),text,style);
drawLineCharString(painter,rect.x(),rect.y(),text,style);
else
{
// the drawText(rect,flags,string) overload is used here with null flags
// instead of drawText(rect,string) because the (rect,string) overload causes
// the application's default layout direction to be used instead of
// the widget-specific layout direction, which should always be
// Qt::LeftToRight for this widget
painter.drawText(rect,0,text);
}
{
// the drawText(rect,flags,string) overload is used here with null flags
// instead of drawText(rect,string) because the (rect,string) overload causes
// the application's default layout direction to be used instead of
// the widget-specific layout direction, which should always be
// Qt::LeftToRight for this widget
if (_bidiEnabled)
painter.drawText(rect,0,text);
else
painter.drawText(rect,0,QChar(0x202D)+text);
}
}
void TerminalDisplay::drawTextFragment(QPainter& painter ,
......
......@@ -372,7 +372,14 @@ public:
*/
void setTerminalSizeStartup(bool on) { _terminalSizeStartup=on; }
/**
* Sets the status of the BiDi rendering inside the terminal display.
* Defaults to disabled.
*/
void setBidiEnabled(bool set) { _bidiEnabled=set; }
/**
* Returns the status of the BiDi rendering in this widget.
*/
bool isBidiEnabled() { return _bidiEnabled; }
/**
......
......@@ -721,6 +721,9 @@ void ViewManager::applyProfile(TerminalDisplay* view , const Profile::Ptr info )
bool blinkingCursor = info->property<bool>(Profile::BlinkingCursorEnabled);
view->setBlinkingCursor(blinkingCursor);
bool bidiEnabled = info->property<bool>(Profile::BidiRenderingEnabled);
view->setBidiEnabled(bidiEnabled);
// cursor shape
int cursorShape = info->property<int>(Profile::CursorShape);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment