parent
6185572c54
commit
f4bf8a426b
8 changed files with 54 additions and 176 deletions
@ -1,35 +0,0 @@ |
|||||||
|
|
||||||
|
|
||||||
# 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 |
|
||||||
) |
|
||||||
@ -1,70 +0,0 @@ |
|||||||
/*
|
|
||||||
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)); |
|
||||||
} |
|
||||||
@ -1,40 +0,0 @@ |
|||||||
/*
|
|
||||||
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 |
|
||||||
Loading…
Reference in new issue