[prev in list] [next in list] [prev in thread] [next in thread] 

List:       konsole-devel
Subject:    Re: [Konsole-devel] [PATCH] Windows port
From:       Patrick Spendrin <ps_ml () gmx ! de>
Date:       2009-02-01 4:24:08
Message-ID: 498523E8.5040004 () gmx ! de
[Download RAW message or body]

Robert Knight schrieb:
> Hi,
> 
> Thank-you for the patch.  I prefer platform specific #if-defs to be
> kept to a minimum.  If you are writing code which would compile on all
> platforms but should only be executed on some of them, eg:
> 
> +#ifndef Q_WS_WIN
>    setPtyChannels(KPtyProcess::AllChannels);
> +#else
> +  setOutputChannelMode(SeparateChannels);
> +#endif
Especially this code doesn't compile here ;-) (due to missing 
KPtyProcess) and most of the code used for real terminal interaction 
doesn't compile here, so it surely won't work without ifdefs (but you're 
right, we can minimize them).
A patch for that needs me some more time though.
> 
> Then it would be better to put the platform specific code in a
> sub-class and call it via a virtual function.  This is easier to read
> and compile-time breakages in code for other platforms are detected
> sooner - see the ProcessInfo class implementations for Linux and
> Solaris.  Things are slightly more complex here since you want to use
> KProcess as the base class on Windows and KPtyProcess on Unix.  That
> could be fixed by making Konsole::Pty not inherit directly from
> KProcess but have a KProcess as a field internally and provide a
> virtual process() accessor.
> 
> +#ifndef Q_WS_WIN
>  class KDE_EXPORT Profile : public QSharedData
> +#else
> +class Profile : public QSharedData
> +#endif
> 
> Why is KDE_EXPORT being removed here on Windows?  If it is required,
> the KDE_EXPORT macro should be replaced with something else (eg.
> KONSOLE_TEST_EXPORT) which is #defined appropriately depending on the
> platform.
I am currently trying to find a way through this.
The small problem is that there is a difference between a kdeinit 
executable under Windows and under Linux. the first is a normal 
application, whereas the second is more of the library kind. This also 
makes linking to the kdeinit executable possible under Linux (and that 
way also exporting from it) whereas this doesn't work under windows.

Edit: I decided to make up a libkonsoleprivate instead which is linked 
by the tests, the kdeinit executable and the kpart plugin.
This way the amount of compiled files should be reduced as well.
I attached the patch for that, can you please look at it?
> 
>> I would prefer to backport the patch too, since it is rather valuable for us.
> 
> Generally speaking, only small bug-fixing patches should be
> backported.  Plus as you mentioned yourself, there are still some
> problems to iron out on Windows.
If I make more indepth changes this would be of course stupid (the other 
changes wouldn't have changed anything for Linux). That's why I would 
apply all changes only to trunk.

> 
> Regards,
> Robert.
Thanks so far,
Patrick
> 


Ok, just to give you an impression, here is a screenshot of konsole:
http://imagebin.ca/view/LoZdwOM.html


-- 
web:                 http://windows.kde.org
mailing list:        kde-windows@kde.org
irc:                 #kde-windows (irc.freenode.net)

["0140-libkonsoleprivate-without-ifdefs.diff" (text/x-patch)]

Index: src/BookmarkHandler.h
===================================================================
--- src/BookmarkHandler.h	(revision 919434)
+++ src/BookmarkHandler.h	(working copy)
@@ -30,6 +30,9 @@
 // KDE
 #include <KBookmarkManager>
 
+// Konsole
+#include "konsole_export.h"
+
 class KMenu;
 class KBookmarkMenu;
 class KBookmarkManager;
@@ -51,7 +54,7 @@
  *
  * When the user selects a bookmark, the openUrl() signal is emitted.
  */
-class BookmarkHandler : public QObject, public KBookmarkOwner
+class KONSOLEPRIVATE_EXPORT BookmarkHandler : public QObject, public KBookmarkOwner
 {
     Q_OBJECT
 
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt	(revision 919434)
+++ src/CMakeLists.txt	(working copy)
@@ -33,7 +33,7 @@
                           Session.h
                           Konsole::Session )
 
-    set(konsole_COMMON_SRCS
+    set(konsoleprivate_SRCS
         ${sessionadaptors_SRCS}
         BlockArray.cpp
         BookmarkHandler.cpp
@@ -95,14 +95,7 @@
 
 ### Konsole Application
 
-    set(konsole_KDEINIT_SRCS
-        ${konsole_COMMON_SRCS}
-        Application.cpp
-        MainWindow.cpp
-        main.cpp
-    )
-
-    kde4_add_ui_files(konsole_KDEINIT_SRCS
+    kde4_add_ui_files(konsoleprivate_SRCS
                   ColorSchemeEditor.ui
                   CopyInputDialog.ui
                   EditProfileDialog.ui
@@ -111,11 +104,22 @@
                   RemoteConnectionDialog.ui
                  )
 
+    kde4_add_library(konsoleprivate SHARED ${konsoleprivate_SRCS})
+    target_link_libraries(konsoleprivate ${konsole_LIBS})
+    target_link_libraries(konsoleprivate LINK_INTERFACE_LIBRARIES ${konsole_LIBS})
+
+    set(konsole_KDEINIT_SRCS
+        Application.cpp
+        MainWindow.cpp
+        main.cpp
+    )
+
+    kde4_add_app_icon(konsole_KDEINIT_SRCS \
"${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/utilities-terminal.png") +
     kde4_add_kdeinit_executable( konsole ${konsole_KDEINIT_SRCS})
-    target_link_libraries(kdeinit_konsole ${konsole_LIBS})
+    target_link_libraries(kdeinit_konsole konsoleprivate)
 
-    install(TARGETS kdeinit_konsole  ${INSTALL_TARGETS_DEFAULT_ARGS} )
-    install(TARGETS konsole          ${INSTALL_TARGETS_DEFAULT_ARGS})
+    install(TARGETS kdeinit_konsole konsole konsoleprivate \
${INSTALL_TARGETS_DEFAULT_ARGS})  
 ### Embedded Konsole KPart
 
@@ -126,7 +130,7 @@
 
     kde4_add_plugin(konsolepart WITH_PREFIX ${konsolepart_PART_SRCS})
     set_target_properties(konsolepart PROPERTIES DEFINE_SYMBOL KONSOLE_PART)
-    target_link_libraries(konsolepart ${KDE4_KPARTS_LIBS} ${konsole_LIBS})
+    target_link_libraries(konsolepart ${KDE4_KPARTS_LIBS} konsoleprivate)
     install(TARGETS konsolepart  DESTINATION ${PLUGIN_INSTALL_DIR} )
 
 ### konsoleprofile command-line tool
Index: src/EditProfileDialog.h
===================================================================
--- src/EditProfileDialog.h	(revision 919434)
+++ src/EditProfileDialog.h	(working copy)
@@ -61,7 +61,7 @@
  * the persistant argument set to false.  These changes are then
  * un-done when the dialog is closed.
  */
-class EditProfileDialog : public KDialog
+class KONSOLEPRIVATE_EXPORT EditProfileDialog : public KDialog
 {
 Q_OBJECT
 
Index: src/Emulation.h
===================================================================
--- src/Emulation.h	(revision 919434)
+++ src/Emulation.h	(working copy)
@@ -33,6 +33,8 @@
 #include <QtCore/QTextStream>
 #include <QtCore/QTimer>
 
+// Konsole
+#include "konsole_export.h"
 
 namespace Konsole
 {
@@ -117,7 +119,7 @@
  * how long the emulation has been active/idle for and also respond to
  * a 'bell' event in different ways.
  */
-class Emulation : public QObject
+class KONSOLEPRIVATE_EXPORT Emulation : public QObject
 { 
 Q_OBJECT
 
Index: src/KeyboardTranslator.h
===================================================================
--- src/KeyboardTranslator.h	(revision 919434)
+++ src/KeyboardTranslator.h	(working copy)
@@ -29,8 +29,8 @@
 #include <QtCore/QMetaType>
 #include <QtCore/QVarLengthArray>
 
-// KDE
-#include <kdemacros.h>
+// Konsole
+#include "konsole_export.h"
 
 class QIODevice;
 class QTextStream;
@@ -442,7 +442,7 @@
  * Manages the keyboard translations available for use by terminal sessions,
  * see KeyboardTranslator.
  */
-class KDE_EXPORT KeyboardTranslatorManager
+class KONSOLEPRIVATE_EXPORT KeyboardTranslatorManager
 {
 public:
     /** 
Index: src/konsole_export.h
===================================================================
--- src/konsole_export.h	(revision 0)
+++ src/konsole_export.h	(revision 0)
@@ -0,0 +1,36 @@
+/*
+   This file is part of the KDE project
+   Copyright (C) 2009 Patrick Spendrin <ps_ml@gmx.de>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License version 2 as published by the Free Software Foundation.
+
+   This library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KONSOLE_EXPORT_H
+#define KONSOLE_EXPORT_H
+
+/* needed for KDE_EXPORT macros */
+#include <kdemacros.h>
+
+#ifndef KONSOLEPRIVATE_EXPORT
+# if defined(MAKE_KONSOLEPRIVATE_LIB)
+   /* We are building this library */
+#  define KONSOLEPRIVATE_EXPORT KDE_EXPORT
+# else
+   /* We are using this library */
+#  define KONSOLEPRIVATE_EXPORT KDE_IMPORT
+# endif
+#endif
+
+#endif
Index: src/ManageProfilesDialog.h
===================================================================
--- src/ManageProfilesDialog.h	(revision 919434)
+++ src/ManageProfilesDialog.h	(working copy)
@@ -48,7 +48,7 @@
  * the user to add new profiles, and remove or edit existing
  * profile types.
  */
-class ManageProfilesDialog : public KDialog
+class KONSOLEPRIVATE_EXPORT ManageProfilesDialog : public KDialog
 {
 Q_OBJECT
 
Index: src/Profile.h
===================================================================
--- src/Profile.h	(revision 919434)
+++ src/Profile.h	(working copy)
@@ -34,8 +34,10 @@
 // KDE
 #include <KSharedPtr>
 #include <KDebug>
-#include <kdemacros.h>
 
+// Konsole
+#include "konsole_export.h"
+
 class KConfig;
 class KConfigGroup;
 
@@ -61,7 +63,7 @@
  * Profiles can be loaded from disk using ProfileReader instances
  * and saved to disk using ProfileWriter instances.
  */
-class KDE_EXPORT Profile : public QSharedData 
+class KONSOLEPRIVATE_EXPORT Profile : public QSharedData 
 {
 
 friend class KDE4ProfileReader;
@@ -439,7 +441,7 @@
  * This can be used as a parent for other profiles or a fallback in case
  * a profile cannot be loaded from disk.
  */
-class FallbackProfile : public Profile
+class KONSOLEPRIVATE_EXPORT FallbackProfile : public Profile
 {
 public:
     FallbackProfile();
@@ -458,7 +460,7 @@
  * The Profile::Name and Profile::Path properties are unique to individual profiles,
  * setting these properties on a ProfileGroup has no effect.
  */
-class KDE_EXPORT ProfileGroup : public Profile
+class KONSOLEPRIVATE_EXPORT ProfileGroup : public Profile
 {
 public:
     typedef KSharedPtr<ProfileGroup> Ptr;
@@ -598,7 +600,7 @@
  *   Icon=konsole;Directory=/home/bob
  * @endcode
  */
-class ProfileCommandParser
+class KONSOLEPRIVATE_EXPORT ProfileCommandParser
 {
 public:
     /**
Index: src/ProfileList.h
===================================================================
--- src/ProfileList.h	(revision 919434)
+++ src/ProfileList.h	(working copy)
@@ -25,6 +25,7 @@
 #include <QtCore/QObject>
 
 #include "Profile.h"
+#include "konsole_export.h"
 
 class QAction;
 class QActionGroup;
@@ -46,7 +47,7 @@
  * The user-data associated with each session can be passed to the createProfile() \
                method of the 
  * SessionManager to create a new terminal session. 
  */
-class ProfileList : public QObject
+class KONSOLEPRIVATE_EXPORT ProfileList : public QObject
 {
 Q_OBJECT
 
Index: src/Pty.h
===================================================================
--- src/Pty.h	(revision 919434)
+++ src/Pty.h	(working copy)
@@ -31,8 +31,10 @@
 
 // KDE
 #include <KPtyProcess>
-#include <kdemacros.h>
 
+// Konsole
+#include "konsole_export.h"
+
 namespace Konsole
 {
 
@@ -49,7 +51,7 @@
  * To start the terminal process, call the start() method
  * with the program name and appropriate arguments. 
  */
-class KDE_EXPORT Pty: public KPtyProcess
+class KONSOLEPRIVATE_EXPORT Pty: public KPtyProcess
 {
 Q_OBJECT
 
Index: src/Session.h
===================================================================
--- src/Session.h	(revision 919434)
+++ src/Session.h	(working copy)
@@ -30,7 +30,7 @@
 // KDE
 #include <KApplication>
 #include <KMainWindow>
-#include <kdemacros.h>
+#include "konsole_export.h"
 
 // Konsole
 #include "History.h"
@@ -58,7 +58,7 @@
  * or send input to the program in the terminal in the form of keypresses and mouse
  * activity.
  */
-class KDE_EXPORT Session : public QObject
+class KONSOLEPRIVATE_EXPORT Session : public QObject
 {
 Q_OBJECT
 
Index: src/SessionController.h
===================================================================
--- src/SessionController.h	(revision 919434)
+++ src/SessionController.h	(working copy)
@@ -81,7 +81,7 @@
  * which contains the view to plug the controller's actions into the menu when
  * the view is focused.
  */
-class SessionController : public ViewProperties , public KXMLGUIClient
+class KONSOLEPRIVATE_EXPORT SessionController : public ViewProperties , public \
KXMLGUIClient  {
 Q_OBJECT
     
Index: src/SessionManager.h
===================================================================
--- src/SessionManager.h	(revision 919434)
+++ src/SessionManager.h	(working copy)
@@ -56,7 +56,7 @@
  * how to display them.  The favorite status of a profile can be altered using
  * setFavorite() and retrieved using isFavorite() 
  */
-class KDE_EXPORT SessionManager : public QObject
+class KONSOLEPRIVATE_EXPORT SessionManager : public QObject
 {
 Q_OBJECT
 
Index: src/TerminalDisplay.h
===================================================================
--- src/TerminalDisplay.h	(revision 919434)
+++ src/TerminalDisplay.h	(working copy)
@@ -29,6 +29,7 @@
 // Konsole
 #include "Filter.h"
 #include "Character.h"
+#include "konsole_export.h"
 
 class QDrag;
 class QDragEnterEvent;
@@ -63,7 +64,7 @@
  *
  * TODO More documentation
  */
-class TerminalDisplay : public QWidget
+class KONSOLEPRIVATE_EXPORT TerminalDisplay : public QWidget
 {
    Q_OBJECT
 
Index: src/tests/CMakeLists.txt
===================================================================
--- src/tests/CMakeLists.txt	(revision 919434)
+++ src/tests/CMakeLists.txt	(working copy)
@@ -1,7 +1,7 @@
 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
 include_directories( ${KDE4_KPTY_INCLUDES} ${KDE4_KPARTS_INCLUDES} \
${QT_QTTEST_INCLUDES})  
-set(KONSOLE_TEST_LIBS ${QT_QTTEST_LIBRARY} kdeinit_konsole)
+set(KONSOLE_TEST_LIBS ${QT_QTTEST_LIBRARY} konsoleprivate)
 
 kde4_add_executable(PartTest TEST PartTest.cpp)
 target_link_libraries(PartTest ${KDE4_KPARTS_LIBS} ${KDE4_KPTY_LIBS} \
                ${KONSOLE_TEST_LIBS})
Index: src/ViewManager.h
===================================================================
--- src/ViewManager.h	(revision 919434)
+++ src/ViewManager.h	(working copy)
@@ -65,7 +65,7 @@
  * user interface elements specific to each display/session pair.
  *
  */
-class ViewManager : public QObject
+class KONSOLEPRIVATE_EXPORT ViewManager : public QObject
 {
 Q_OBJECT
 
Index: src/ViewProperties.h
===================================================================
--- src/ViewProperties.h	(revision 919434)
+++ src/ViewProperties.h	(working copy)
@@ -29,6 +29,9 @@
 // KDE
 #include <KUrl>
 
+// Konsole
+#include "konsole_export.h"
+
 namespace Konsole
 {
 
@@ -39,7 +42,7 @@
  * This can be used by navigation widgets in a ViewContainer sub-class to provide a \
                tab, label or other
  * item for switching between views.
  */
-class ViewProperties : public QObject 
+class KONSOLEPRIVATE_EXPORT ViewProperties : public QObject 
 {
 Q_OBJECT
 



_______________________________________________
konsole-devel mailing list
konsole-devel@kde.org
https://mail.kde.org/mailman/listinfo/konsole-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic