Commit cc2f552d authored by Tomaz  Canabrava's avatar Tomaz Canabrava

Add a new option in the profile: Vertical line at Column

This patch introduces a new profile option, a vertical
line at a specific column, to help writting emails, and
git commits in editors that doesn't support line columns
such as nano
parent faceafcc
...@@ -105,7 +105,8 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = { ...@@ -105,7 +105,8 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { BidiRenderingEnabled , "BidiRenderingEnabled" , TERMINAL_GROUP , QVariant::Bool } , { BidiRenderingEnabled , "BidiRenderingEnabled" , TERMINAL_GROUP , QVariant::Bool }
, { BlinkingCursorEnabled , "BlinkingCursorEnabled" , TERMINAL_GROUP , QVariant::Bool } , { BlinkingCursorEnabled , "BlinkingCursorEnabled" , TERMINAL_GROUP , QVariant::Bool }
, { BellMode , "BellMode" , TERMINAL_GROUP , QVariant::Int } , { BellMode , "BellMode" , TERMINAL_GROUP , QVariant::Int }
, { VerticalLine, "VerticalLine", TERMINAL_GROUP, QVariant::Bool }
, { VerticalLineAtChar, "VerticalLineAtChar", TERMINAL_GROUP, QVariant::Int }
// Cursor // Cursor
, { UseCustomCursorColor , "UseCustomCursorColor" , CURSOR_GROUP , QVariant::Bool} , { UseCustomCursorColor , "UseCustomCursorColor" , CURSOR_GROUP , QVariant::Bool}
, { CursorShape , "CursorShape" , CURSOR_GROUP , QVariant::Int} , { CursorShape , "CursorShape" , CURSOR_GROUP , QVariant::Int}
...@@ -233,6 +234,8 @@ void Profile::useFallback() ...@@ -233,6 +234,8 @@ void Profile::useFallback()
setProperty(TabColor, QColor(QColor::Invalid)); setProperty(TabColor, QColor(QColor::Invalid));
setProperty(AllowEscapedLinks, true); setProperty(AllowEscapedLinks, true);
setProperty(EscapedLinksSchema, QStringLiteral("http://;https://;file://")); setProperty(EscapedLinksSchema, QStringLiteral("http://;https://;file://"));
setProperty(VerticalLine, false);
setProperty(VerticalLineAtChar, 80);
// Fallback should not be shown in menus // Fallback should not be shown in menus
setHidden(true); setHidden(true);
} }
......
...@@ -319,6 +319,10 @@ public: ...@@ -319,6 +319,10 @@ public:
* some weird ones like git:// and ssh:// but if the user wants he can enable. * some weird ones like git:// and ssh:// but if the user wants he can enable.
*/ */
EscapedLinksSchema, EscapedLinksSchema,
/** Use Vertical Line At */
VerticalLine,
/** Vertical Line Pixel at */
VerticalLineAtChar
}; };
Q_ENUM(Property) Q_ENUM(Property)
...@@ -669,6 +673,16 @@ public: ...@@ -669,6 +673,16 @@ public:
return property<QString>(Profile::MenuIndex); return property<QString>(Profile::MenuIndex);
} }
bool verticalLine() const
{
return property<bool>(Profile::VerticalLine);
}
int verticalLineAtChar() const
{
return property<int>(Profile::VerticalLineAtChar);
}
int menuIndexAsInt() const; int menuIndexAsInt() const;
/** Return a list of all properties names and their type /** Return a list of all properties names and their type
......
...@@ -471,47 +471,55 @@ ...@@ -471,47 +471,55 @@
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QGridLayout" name="miscTabLayout" columnstretch="0,0"> <layout class="QGridLayout" name="miscTabLayout" columnstretch="0,0,0">
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter"> <item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Window:</string> <string>Window:</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="dimWhenInactiveCheckbox"> <widget class="QCheckBox" name="showTerminalSizeHintButton">
<property name="toolTip"> <property name="toolTip">
<string>Indicate whether the window is active by dimming the colors</string> <string>Show terminal size in columns and lines in the center of window after resizing</string>
</property> </property>
<property name="text"> <property name="text">
<string>Darken</string> <string>Show hint for terminal size after resizing</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="5" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="dimLabel">
<property name="text">
<string>Darkening strength:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="dimValue">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
<string>Inactive Terminals:</string> <string>Inactive Terminals:</string>
...@@ -521,7 +529,7 @@ ...@@ -521,7 +529,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="3">
<widget class="QGroupBox" name="contentsGroup"> <widget class="QGroupBox" name="contentsGroup">
<property name="title"> <property name="title">
<string comment="@title:group">Terminal contents</string> <string comment="@title:group">Terminal contents</string>
...@@ -663,7 +671,17 @@ ...@@ -663,7 +671,17 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="dimWhenInactiveCheckbox">
<property name="toolTip">
<string>Indicate whether the window is active by dimming the colors</string>
</property>
<property name="text">
<string>Darken</string>
</property>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
...@@ -680,40 +698,46 @@ ...@@ -680,40 +698,46 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="1"> <item row="1" column="1">
<widget class="QCheckBox" name="showTerminalSizeHintButton"> <spacer>
<property name="toolTip"> <property name="orientation">
<string>Show terminal size in columns and lines in the center of window after resizing</string> <enum>Qt::Vertical</enum>
</property> </property>
<property name="text"> <property name="sizeType">
<string>Show hint for terminal size after resizing</string> <enum>QSizePolicy::Fixed</enum>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item> </item>
<item row="4" column="1"> <item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="dimLabel"> <widget class="QCheckBox" name="displayVerticalLine">
<property name="text"> <property name="text">
<string>Darkening strength:</string> <string>Display Vertical line at column:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSlider" name="dimValue"> <widget class="QSpinBox" name="displayVerticalLineAtColumn"/>
<property name="maximum"> </item>
<number>255</number> <item>
</property> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="tickPosition"> <property name="sizeHint" stdset="0">
<enum>QSlider::NoTicks</enum> <size>
<width>40</width>
<height>20</height>
</size>
</property> </property>
</widget> </spacer>
</item> </item>
</layout> </layout>
</item> </item>
......
...@@ -784,6 +784,14 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile) ...@@ -784,6 +784,14 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile)
_appearanceUi->dimLabel->setEnabled(profile->dimWhenInactive()); _appearanceUi->dimLabel->setEnabled(profile->dimWhenInactive());
connect(_appearanceUi->dimValue, &QSlider::valueChanged, connect(_appearanceUi->dimValue, &QSlider::valueChanged,
this, &Konsole::EditProfileDialog::setDimValue); this, &Konsole::EditProfileDialog::setDimValue);
_appearanceUi->displayVerticalLine->setChecked(profile->verticalLine());
connect(_appearanceUi->displayVerticalLine, &QCheckBox::toggled,
this, &EditProfileDialog::setVerticalLine);
_appearanceUi->displayVerticalLineAtColumn->setValue(profile->verticalLineAtChar());
connect(_appearanceUi->displayVerticalLineAtColumn, QOverload<int>::of(&QSpinBox::valueChanged),
this, &EditProfileDialog::setVerticalLineColumn);
} }
void EditProfileDialog::setAntialiasText(bool enable) void EditProfileDialog::setAntialiasText(bool enable)
...@@ -804,6 +812,15 @@ void EditProfileDialog::linkEscapeSequenceTextsChanged() ...@@ -804,6 +812,15 @@ void EditProfileDialog::linkEscapeSequenceTextsChanged()
{ {
updateTempProfileProperty(Profile::EscapedLinksSchema, _mouseUi->linkEscapeSequenceTexts->text()); updateTempProfileProperty(Profile::EscapedLinksSchema, _mouseUi->linkEscapeSequenceTexts->text());
} }
void EditProfileDialog::setVerticalLine(bool value)
{
updateTempProfileProperty(Profile::VerticalLine, value);
}
void EditProfileDialog::setVerticalLineColumn(int value)
{
updateTempProfileProperty(Profile::VerticalLineAtChar, value);
}
void EditProfileDialog::setBoldIntense(bool enable) void EditProfileDialog::setBoldIntense(bool enable)
{ {
......
...@@ -144,7 +144,8 @@ private Q_SLOTS: ...@@ -144,7 +144,8 @@ private Q_SLOTS:
void saveColorScheme(const ColorScheme &scheme, bool isNewScheme); void saveColorScheme(const ColorScheme &scheme, bool isNewScheme);
void removeColorScheme(); void removeColorScheme();
void gotNewColorSchemes(const KNS3::Entry::List &changedEntries); void gotNewColorSchemes(const KNS3::Entry::List &changedEntries);
void setVerticalLine(bool);
void setVerticalLineColumn(int);
void toggleBlinkingCursor(bool); void toggleBlinkingCursor(bool);
void setCursorShape(int); void setCursorShape(int);
void autoCursorColor(); void autoCursorColor();
......
...@@ -1345,6 +1345,14 @@ void TerminalDisplay::paintEvent(QPaintEvent* pe) ...@@ -1345,6 +1345,14 @@ void TerminalDisplay::paintEvent(QPaintEvent* pe)
drawBackground(paint, rect, getBackgroundColor(), true /* use opacity setting */); drawBackground(paint, rect, getBackgroundColor(), true /* use opacity setting */);
} }
if (_displayVerticalLine) {
const int x = (_fontWidth/2) + (_fontWidth * _displayVerticalLineAtChar);
const QColor lineColor = getForegroundColor();
paint.setPen(lineColor);
paint.drawLine(QPoint(x, 0), QPoint(x, height()));
}
// only turn on text anti-aliasing, never turn on normal antialiasing // only turn on text anti-aliasing, never turn on normal antialiasing
// set https://bugreports.qt.io/browse/QTBUG-66036 // set https://bugreports.qt.io/browse/QTBUG-66036
paint.setRenderHint(QPainter::TextAntialiasing, _antialiasText); paint.setRenderHint(QPainter::TextAntialiasing, _antialiasText);
...@@ -4147,6 +4155,9 @@ void TerminalDisplay::applyProfile(const Profile::Ptr &profile) ...@@ -4147,6 +4155,9 @@ void TerminalDisplay::applyProfile(const Profile::Ptr &profile)
// mouse wheel zoom // mouse wheel zoom
_mouseWheelZoom = profile->mouseWheelZoomEnabled(); _mouseWheelZoom = profile->mouseWheelZoomEnabled();
_displayVerticalLine = profile->verticalLine();
_displayVerticalLineAtChar = profile->verticalLineAtChar();
setAlternateScrolling(profile->property<bool>(Profile::AlternateScrolling)); setAlternateScrolling(profile->property<bool>(Profile::AlternateScrolling));
_dimValue = profile->dimValue(); _dimValue = profile->dimValue();
} }
......
...@@ -915,6 +915,8 @@ private: ...@@ -915,6 +915,8 @@ private:
static const int HIGHLIGHT_SCROLLED_LINES_WIDTH = 3; static const int HIGHLIGHT_SCROLLED_LINES_WIDTH = 3;
bool _hasCompositeFocus; bool _hasCompositeFocus;
bool _displayVerticalLine;
int _displayVerticalLineAtChar;
QSharedPointer<HotSpot> _currentlyHoveredHotspot; QSharedPointer<HotSpot> _currentlyHoveredHotspot;
}; };
......
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