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
f4bf8a42
Commit
f4bf8a42
authored
Aug 09, 2020
by
Tomaz Canabrava
Browse files
Revert "Movo Session to a independent static library"
This reverts commit
4a0f1195
.
parent
6185572c
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
f4bf8a42
...
...
@@ -37,8 +37,13 @@ option(KONSOLE_BUILD_UNI2CHARACTERWIDTH "Konsole: build uni2characterwidth execu
# qdbuscpp2xml -M -s ViewManager.h -o org.kde.konsole.Konsole.xml
# Generate dbus .xml files; do not store .xml in source folder
qt5_generate_dbus_interface
(
session/Session.h org.kde.konsole.Session.xml OPTIONS -m
)
qt5_generate_dbus_interface
(
ViewManager.h org.kde.konsole.Window.xml OPTIONS -m
)
qt5_add_dbus_adaptor
(
sessionadaptors_SRCS
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.Session.xml
session/Session.h
Konsole::Session
)
qt5_add_dbus_adaptor
(
windowadaptors_SRCS
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.Window.xml
ViewManager.h
...
...
@@ -101,9 +106,9 @@ target_link_libraries(konsolehelpers
add_subdirectory
(
colorscheme
)
add_subdirectory
(
keyboardtranslator
)
add_subdirectory
(
profile
)
add_subdirectory
(
session
)
set
(
konsoleprivate_SRCS
${
windowadaptors_SRCS
}
set
(
konsoleprivate_SRCS
${
sessionadaptors_SRCS
}
${
windowadaptors_SRCS
}
AutoScrollHandler.cpp
BookmarkHandler.cpp
BookmarkMenu.cpp
...
...
@@ -161,6 +166,13 @@ set(konsoleprivate_SRCS ${windowadaptors_SRCS}
history/compact/CompactHistoryLine.cpp
history/compact/CompactHistoryScroll.cpp
history/compact/CompactHistoryType.cpp
session/Session.cpp
session/SessionController.cpp
session/SessionDisplayConnection.cpp
session/SessionGroup.cpp
session/SessionListModel.cpp
session/SessionManager.cpp
session/SessionTask.cpp
widgets/DetachableTabBar.cpp
widgets/EditProfileDialog.cpp
widgets/HistorySizeWidget.cpp
...
...
@@ -172,8 +184,8 @@ set(konsoleprivate_SRCS ${windowadaptors_SRCS}
widgets/TerminalHeaderBar.cpp
widgets/ViewContainer.cpp
widgets/ViewSplitter.cpp
widgets/KonsolePrintManager.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.
Window
.xml
)
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.Window.xml
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.
Session
.xml
)
kconfig_add_kcfg_files
(
konsoleprivate_SRCS settings/KonsoleSettings.kcfgc
)
...
...
@@ -183,7 +195,7 @@ ki18n_wrap_ui(konsoleprivate_SRCS
CopyInputDialog.ui
HistorySizeDialog.ui
KeyBindingEditor.ui
PrintOptions.ui
# Temporary to build session static library
PrintOptions.ui
RenameTabDialog.ui
settings/GeneralSettings.ui
settings/PartInfo.ui
...
...
@@ -215,7 +227,6 @@ target_link_libraries(konsoleprivate
keyboardtranslator
konsolehelpers
konsoleprofile
konsolesession
${
konsole_LIBS
}
)
...
...
src/session/CMakeLists.txt
deleted
100644 → 0
View file @
6185572c
# qdbuscpp2xml -m Session.h -o org.kde.konsole.Session.xml
# Generate dbus .xml files; do not store .xml in source folder
qt5_generate_dbus_interface
(
Session.h org.kde.konsole.Session.xml OPTIONS -m
)
qt5_add_dbus_adaptor
(
sessionadaptors_SRCS
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.Session.xml
Session.h
Konsole::Session
)
set
(
konsole_session_SRCS
${
sessionadaptors_SRCS
}
Session.cpp
SessionController.cpp
SessionDisplayConnection.cpp
SessionGroup.cpp
SessionListModel.cpp
SessionManager.cpp
SessionTask.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.Session.xml
)
add_library
(
konsolesession
STATIC
${
konsole_session_SRCS
}
)
target_link_libraries
(
konsolesession
${
konsole_LIBS
}
konsoleprofile
# TODO: Must be removed from here, Used only for ProfileCommandParser::parse in SessionManager::sessionProfileCommandReceived
)
src/session/SessionController.cpp
View file @
f4bf8a42
...
...
@@ -30,6 +30,8 @@
#include
<QList>
#include
<QMenu>
#include
<QKeyEvent>
#include
<QPrinter>
#include
<QPrintDialog>
#include
<QFileDialog>
#include
<QPainter>
#include
<QStandardPaths>
...
...
@@ -61,6 +63,7 @@
#include
"Emulation.h"
#include
"Enumeration.h"
#include
"HistorySizeDialog.h"
#include
"PrintOptions.h"
#include
"RenameTabDialog.h"
#include
"SaveHistoryTask.h"
#include
"ScreenWindow.h"
...
...
@@ -139,8 +142,6 @@ SessionController::SessionController(Session* session, TerminalDisplay* view, QO
setupExtraActions
();
}
connect
(
this
,
&
SessionController
::
requestPrint
,
_sessionDisplayConnection
->
view
(),
&
TerminalDisplay
::
printScreen
);
actionCollection
()
->
addAssociatedWidget
(
view
);
const
QList
<
QAction
*>
actionsList
=
actionCollection
()
->
actions
();
...
...
@@ -666,7 +667,7 @@ void SessionController::setupCommonActions()
action
->
setShortcut
(
QKeySequence
(
Qt
::
META
+
Qt
::
Key_S
));
#endif
action
=
KStandardAction
::
print
(
this
,
&
SessionController
::
requestPrint
,
collection
);
action
=
KStandardAction
::
print
(
this
,
&
SessionController
::
print_screen
,
collection
);
action
->
setText
(
i18n
(
"&Print Screen..."
));
collection
->
setDefaultShortcut
(
action
,
Konsole
::
ACCEL
+
Qt
::
SHIFT
+
Qt
::
Key_P
);
...
...
@@ -1567,6 +1568,37 @@ void SessionController::scrollBackOptionsChanged(int mode, int lines)
}
}
void
SessionController
::
print_screen
()
{
QPrinter
printer
;
QPointer
<
QPrintDialog
>
dialog
=
new
QPrintDialog
(
&
printer
,
_sessionDisplayConnection
->
view
());
auto
options
=
new
PrintOptions
();
dialog
->
setOptionTabs
({
options
});
dialog
->
setWindowTitle
(
i18n
(
"Print Shell"
));
connect
(
dialog
,
QOverload
<>::
of
(
&
QPrintDialog
::
accepted
),
options
,
&
Konsole
::
PrintOptions
::
saveSettings
);
if
(
dialog
->
exec
()
!=
QDialog
::
Accepted
)
{
return
;
}
QPainter
painter
;
painter
.
begin
(
&
printer
);
KConfigGroup
configGroup
(
KSharedConfig
::
openConfig
(),
"PrintOptions"
);
if
(
configGroup
.
readEntry
(
"ScaleOutput"
,
true
))
{
double
scale
=
qMin
(
printer
.
pageRect
().
width
()
/
static_cast
<
double
>
(
_sessionDisplayConnection
->
view
()
->
width
()),
printer
.
pageRect
().
height
()
/
static_cast
<
double
>
(
_sessionDisplayConnection
->
view
()
->
height
()));
painter
.
scale
(
scale
,
scale
);
}
_sessionDisplayConnection
->
view
()
->
printContent
(
painter
,
configGroup
.
readEntry
(
"PrinterFriendly"
,
true
));
}
void
SessionController
::
saveHistory
()
{
SessionTask
*
task
=
new
SaveHistoryTask
(
this
);
...
...
src/session/SessionController.h
View file @
f4bf8a42
...
...
@@ -178,11 +178,6 @@ Q_SIGNALS:
*/
void
tabColoredByUser
(
bool
set
)
const
;
/**
* Emmited when the user request print screen.
*/
void
requestPrint
();
public
Q_SLOTS
:
/**
* Issues a command to the session to navigate to the specified URL.
...
...
@@ -244,6 +239,7 @@ private Q_SLOTS:
void
findNextInHistory
();
void
findPreviousInHistory
();
void
changeSearchMatch
();
void
print_screen
();
void
saveHistory
();
void
showHistoryOptions
();
void
clearHistory
();
...
...
src/widgets/KonsolePrintManager.cpp
deleted
100644 → 0
View file @
6185572c
/*
Copyright 2020-2020 by Gustavo Carneiro <gcarneiroa@hotmail.com>
Copyright 2012-2020 by Kurt Hindenburg <kurt.hindenburg@gmail.com>
Copyright 2020-2020 by Tomaz Canabrava <tcanabrava@kde.org>
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.
*/
// Own
#include
"KonsolePrintManager.h"
// Konsole
#include
"PrintOptions.h"
// Qt
#include
<QWidget>
#include
<QPrinter>
#include
<QPainter>
#include
<QPointer>
#include
<QPrintDialog>
// KDE
#include
<KConfigGroup>
#include
<KSharedConfig>
using
namespace
Konsole
;
void
KonsolePrintManager
::
printRequest
(
pPrintContent
pContent
,
QWidget
*
parent
)
{
QPrinter
printer
;
QPointer
<
QPrintDialog
>
dialog
=
new
QPrintDialog
(
&
printer
,
parent
);
auto
options
=
new
PrintOptions
();
dialog
->
setOptionTabs
({
options
});
dialog
->
setWindowTitle
(
i18n
(
"Print Shell"
));
QObject
::
connect
(
dialog
,
QOverload
<>::
of
(
&
QPrintDialog
::
accepted
),
options
,
&
Konsole
::
PrintOptions
::
saveSettings
);
if
(
dialog
->
exec
()
!=
QDialog
::
Accepted
)
{
return
;
}
QPainter
painter
;
painter
.
begin
(
&
printer
);
KConfigGroup
configGroup
(
KSharedConfig
::
openConfig
(),
"PrintOptions"
);
if
(
configGroup
.
readEntry
(
"ScaleOutput"
,
true
))
{
double
scale
=
qMin
(
printer
.
pageRect
().
width
()
/
static_cast
<
double
>
(
parent
->
width
()),
printer
.
pageRect
().
height
()
/
static_cast
<
double
>
(
parent
->
height
()));
painter
.
scale
(
scale
,
scale
);
}
pContent
(
painter
,
configGroup
.
readEntry
(
"PrinterFriendly"
,
true
));
}
src/widgets/KonsolePrintManager.h
deleted
100644 → 0
View file @
6185572c
/*
Copyright 2020-2020 by Gustavo Carneiro <gcarneiroa@hotmail.com>
Copyright 2012-2020 by Kurt Hindenburg <kurt.hindenburg@gmail.com>
Copyright 2020-2020 by Tomaz Canabrava <tcanabrava@kde.org>
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 KONSOLEPRINTMANAGER_H
#define KONSOLEPRINTMANAGER_H
#include
<functional>
class
QWidget
;
class
QPainter
;
namespace
Konsole
{
class
KonsolePrintManager
{
public:
typedef
std
::
function
<
void
(
QPainter
&
,
bool
)
>
pPrintContent
;
static
void
printRequest
(
pPrintContent
pContent
,
QWidget
*
parent
);
};
}
#endif
src/widgets/TerminalDisplay.cpp
View file @
f4bf8a42
...
...
@@ -80,8 +80,6 @@
#include
"profile/Profile.h"
#include
"ViewManager.h"
// for colorSchemeForProfile. // TODO: Rewrite this.
#include
"LineBlockCharacters.h"
#include
"PrintOptions.h"
#include
"KonsolePrintManager.h"
using
namespace
Konsole
;
...
...
@@ -1375,7 +1373,6 @@ void TerminalDisplay::paintEvent(QPaintEvent* pe)
void
TerminalDisplay
::
printContent
(
QPainter
&
painter
,
bool
friendly
)
{
// TODO: Move this code to KonsolePrintManager
// Reinitialize the font with the printers paint device so the font
// measurement calculations will be done correctly
QFont
savedFont
=
getVTFont
();
...
...
@@ -4131,11 +4128,3 @@ void TerminalDisplay::applyProfile(const Profile::Ptr &profile)
setAlternateScrolling
(
profile
->
property
<
bool
>
(
Profile
::
AlternateScrolling
));
_dimValue
=
profile
->
dimValue
();
}
void
TerminalDisplay
::
printScreen
()
{
auto
lambda
=
[
this
](
QPainter
&
painter
,
bool
friendly
)
{
printContent
(
painter
,
friendly
);
};
KonsolePrintManager
::
printRequest
(
lambda
,
this
);
}
src/widgets/TerminalDisplay.h
View file @
f4bf8a42
...
...
@@ -341,8 +341,7 @@ public:
* Selects everything in the terminal
*/
void
selectAll
();
// TODO: Move this code to KonsolePrintManager
void
printContent
(
QPainter
&
painter
,
bool
friendly
);
/**
...
...
@@ -515,10 +514,6 @@ public Q_SLOTS:
// Used to show/hide the message widget
void
updateReadOnlyState
(
bool
readonly
);
IncrementalSearchBar
*
searchBar
()
const
;
// Used for requestPrint
void
printScreen
();
Q_SIGNALS:
void
requestToggleExpansion
();
/**
...
...
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