Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
68ab8f55
Commit
68ab8f55
authored
Oct 02, 2020
by
Gustavo Carneiro
Committed by
Kurt Hindenburg
Oct 07, 2020
Browse files
Move Painter Methods to a new class TerminalPainter
parent
5c9c22fa
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
68ab8f55
...
...
@@ -179,6 +179,7 @@ set(konsoleprivate_SRCS ${windowadaptors_SRCS}
widgets/RenameTabWidget.cpp
widgets/TabTitleFormatButton.cpp
terminalDisplay/TerminalDisplay.cpp
terminalDisplay/TerminalPainter.cpp
widgets/TerminalDisplayAccessible.cpp
widgets/TerminalHeaderBar.cpp
widgets/ViewContainer.cpp
...
...
src/ExtendedCharTable.cpp
View file @
68ab8f55
...
...
@@ -77,7 +77,7 @@ uint ExtendedCharTable::createExtendedChar(const uint *unicodePoints, ushort len
const
QList
<
Session
*>
sessionsList
=
SessionManager
::
instance
()
->
sessions
();
for
(
const
Session
*
s
:
sessionsList
)
{
const
QList
<
TerminalDisplay
*>
displayList
=
s
->
views
();
for
(
const
TerminalDisplay
*
display
:
displayList
)
{
for
(
const
QPointer
<
TerminalDisplay
>
display
:
displayList
)
{
usedExtendedChars
+=
display
->
screenWindow
()
->
screen
()
->
usedExtendedChars
();
}
}
...
...
src/filterHotSpots/EscapeSequenceUrlFilter.cpp
View file @
68ab8f55
...
...
@@ -38,7 +38,7 @@ void EscapeSequenceUrlFilter::process()
if
(
!
_window
->
screenWindow
()
&&
_window
->
screenWindow
()
->
screen
())
{
return
;
}
auto
*
sWindow
=
_window
->
screenWindow
();
auto
sWindow
=
_window
->
screenWindow
();
const
auto
urls
=
sWindow
->
screen
()
->
urlExtractor
()
->
history
();
for
(
const
auto
&
escapedUrl
:
urls
)
{
...
...
src/terminalDisplay/TerminalDisplay.cpp
View file @
68ab8f55
This diff is collapsed.
Click to expand it.
src/terminalDisplay/TerminalDisplay.h
View file @
68ab8f55
...
...
@@ -50,6 +50,7 @@ class QTimerEvent;
class
KMessageWidget
;
namespace
Konsole
{
class
TerminalPainter
;
class
FilterChain
;
class
TerminalImageFilterChain
;
class
SessionController
;
...
...
@@ -337,7 +338,10 @@ public:
*/
void
setScreenWindow
(
ScreenWindow
*
window
);
/** Returns the terminal screen section which is displayed in this widget. See setScreenWindow() */
ScreenWindow
*
screenWindow
()
const
;
QPointer
<
ScreenWindow
>
screenWindow
()
const
{
return
_screenWindow
;
}
// Select the current line.
void
selectCurrentLine
();
...
...
@@ -393,6 +397,8 @@ public:
// a character which left edge is closest to the point.
void
getCharacterPosition
(
const
QPoint
&
widgetPoint
,
int
&
line
,
int
&
column
,
bool
edge
)
const
;
friend
class
TerminalPainter
;
public
Q_SLOTS
:
/**
* Scrolls current ScreenWindow
...
...
@@ -921,6 +927,7 @@ private:
int
_displayVerticalLineAtChar
;
QKeySequence
_peekPrimaryShortcut
;
TerminalPainter
*
_terminalPainter
;
};
}
...
...
src/terminalDisplay/TerminalPainter.cpp
0 → 100644
View file @
68ab8f55
This diff is collapsed.
Click to expand it.
src/terminalDisplay/TerminalPainter.hpp
0 → 100644
View file @
68ab8f55
/*
Copyright 2020-2020 by Gustavo Carneiro <gcarneiroa@hotmail.com>
Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#ifndef TERMINALPAINTER_HPP
#define TERMINALPAINTER_HPP
// Qt
#include
<QVector>
#include
<QWidget>
#include
<QPointer>
#include
<QScrollBar>
// Konsole
#include
"Character.h"
#include
"ScreenWindow.h"
#include
"Enumeration.h"
#include
"colorscheme/ColorSchemeWallpaper.h"
class
QRect
;
class
QColor
;
class
QRegion
;
class
QPainter
;
class
QString
;
class
QTimer
;
namespace
Konsole
{
class
Character
;
class
TerminalDisplay
;
class
TerminalPainter
{
public:
explicit
TerminalPainter
(
TerminalDisplay
*
display
);
~
TerminalPainter
()
=
default
;
// -- Drawing helpers --
// divides the part of the display specified by 'rect' into
// fragments according to their colors and styles and calls
// drawTextFragment() or drawPrinterFriendlyTextFragment()
// to draw the fragments
void
drawContents
(
QPainter
&
paint
,
const
QRect
&
rect
);
// draw a transparent rectangle over the line of the current match
void
drawCurrentResultRect
(
QPainter
&
painter
);
// draw a thin highlight on the left of the screen for lines that have been scrolled into view
void
highlightScrolledLines
(
QPainter
&
painter
);
// compute which region need to be repainted for scrolled lines highlight
QRegion
highlightScrolledLinesRegion
(
bool
nothingChanged
);
// draws a section of text, all the text in this section
// has a common color and style
void
drawTextFragment
(
QPainter
&
painter
,
const
QRect
&
rect
,
const
QString
&
text
,
const
Character
*
style
);
void
drawPrinterFriendlyTextFragment
(
QPainter
&
painter
,
const
QRect
&
rect
,
const
QString
&
text
,
const
Character
*
style
);
// draws the background for a text fragment
// if useOpacitySetting is true then the color's alpha value will be set to
// the display's transparency (set with setOpacity()), otherwise the background
// will be drawn fully opaque
void
drawBackground
(
QPainter
&
painter
,
const
QRect
&
rect
,
const
QColor
&
backgroundColor
,
bool
useOpacitySetting
);
// draws the cursor character
void
drawCursor
(
QPainter
&
painter
,
const
QRect
&
rect
,
const
QColor
&
foregroundColor
,
const
QColor
&
backgroundColor
,
QColor
&
characterColor
);
// draws the characters or line graphics in a text fragment
void
drawCharacters
(
QPainter
&
painter
,
const
QRect
&
rect
,
const
QString
&
text
,
const
Character
*
style
,
const
QColor
&
characterColor
);
// draws a string of line graphics
void
drawLineCharString
(
QPainter
&
painter
,
int
x
,
int
y
,
const
QString
&
str
,
const
Character
*
attributes
);
// draws the preedit string for input methods
void
drawInputMethodPreeditString
(
QPainter
&
painter
,
const
QRect
&
rect
);
private:
int
loc
(
int
x
,
int
y
)
const
;
QPoint
cursorPosition
()
const
;
bool
isCursorOnDisplay
()
const
;
TerminalDisplay
*
_display
;
};
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment