diff --git a/CMakeLists.txt b/CMakeLists.txt index b6d66b9..1a325da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,149 +1,155 @@ cmake_minimum_required(VERSION 2.8.12) project(krdc) set (KDE_APPLICATIONS_VERSION_MAJOR "18") set (KDE_APPLICATIONS_VERSION_MINOR "07") set (KDE_APPLICATIONS_VERSION_MICRO "70") set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") find_package(ECM REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) find_package(KF5 REQUIRED COMPONENTS Config KCMUtils DNSSD NotifyConfig Notifications Bookmarks IconThemes XmlGui Completion Wallet WidgetsAddons NotifyConfig I18n ) +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" ) + endif() +endif() + find_package(KF5DocTools) include(ECMSetupVersion) include(ECMQtDeclareLoggingCategory) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(FeatureSummary) # use sane compile flags add_definitions( -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_FAST_OPERATOR_PLUS ) ecm_setup_version(${KDE_APPLICATIONS_VERSION} VARIABLE_PREFIX KRDC SOVERSION 5 VERSION_HEADER krdc_version.h ) if(WIN32) set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES}) set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES}) endif(WIN32) add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) find_package(LibVNCServer) set_package_properties("libvncserver" PROPERTIES DESCRIPTION "VNC server / client library" URL "http://libvncserver.sourceforge.net/" PURPOSE "Needed to build VNC client support in KRDC" ) # Needs porting FIND_PROGRAM(FREERDP_EXECUTABLE xfreerdp) if(FREERDP_EXECUTABLE) set(FREERDP_EXECUTABLE_FOUND true) endif(FREERDP_EXECUTABLE) set_package_properties("freerdp" PROPERTIES DESCRIPTION "A free Remote Desktop Protocol (RDP) Implementation" URL "http://www.freerdp.com" PURPOSE "Needed for RDP support in KRDC (at runtime)" ) # NX support is not ready for KDE 4.2; disabled (uwolfer) # macro_optional_find_package(LibNXCL) # macro_log_feature(LIBNXCL_FOUND "libnxcl" "NX X compression client library" "http://svn.berlios.de/svnroot/repos/freenx/trunk/freenx-client/nxcl/" FALSE "1.0" "Needed to build Krdc with NX support") include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/core/ ${CMAKE_CURRENT_BINARY_DIR}/core/ ${CMAKE_CURRENT_BINARY_DIR} ) add_subdirectory(core) add_subdirectory(vnc) add_subdirectory(nx) add_subdirectory(rdp) add_subdirectory(test) if(KF5DocTools_FOUND) add_subdirectory(doc) else() message("KF5DocTools not found. Not building documentation.") endif() add_definitions(-DBUILD_ZEROCONF) set(krdc_SRCS config/hostpreferenceslist.cpp config/preferencesdialog.cpp floatingtoolbar.cpp bookmarkmanager.cpp connectiondelegate.cpp remotedesktopsmodel.cpp systemtrayicon.cpp tabbedviewwidget.cpp mainwindow.cpp main.cpp ) ki18n_wrap_ui(krdc_SRCS config/general.ui ) ecm_qt_declare_logging_category(krdc_SRCS HEADER krdc_debug.h IDENTIFIER KRDC CATEGORY_NAME KRDC) add_executable(krdc ${krdc_SRCS}) target_link_libraries(krdc KF5::ConfigCore KF5::KCMUtils KF5::DNSSD KF5::NotifyConfig KF5::Bookmarks KF5::IconThemes KF5::XmlGui KF5::Completion KF5::WidgetsAddons KF5::NotifyConfig KF5::Notifications krdccore ) install(TARGETS krdc ${INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES krdcui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/krdc) install(PROGRAMS org.kde.krdc.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES pointcursor.png pointcursormask.png DESTINATION ${DATA_INSTALL_DIR}/krdc/pics) install(FILES org.kde.krdc.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/vnc/vncclientthread.h b/vnc/vncclientthread.h index ff7b4bd..aa51688 100644 --- a/vnc/vncclientthread.h +++ b/vnc/vncclientthread.h @@ -1,232 +1,232 @@ /**************************************************************************** ** ** Copyright (C) 2007 - 2013 Urs Wolfer ** ** This file is part of KDE. ** ** 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; see the file COPYING. If not, write to ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ** Boston, MA 02110-1301, USA. ** ****************************************************************************/ #ifndef VNCCLIENTTHREAD_H #define VNCCLIENTTHREAD_H #ifdef QTONLY #define i18n tr #else #include #endif #include "remoteview.h" #include #include #include #include extern "C" { #include } class ClientEvent { public: virtual ~ClientEvent(); virtual void fire(rfbClient*) = 0; }; class KeyClientEvent : public ClientEvent { public: KeyClientEvent(int key, int pressed) : m_key(key), m_pressed(pressed) {} - void fire(rfbClient*); + void fire(rfbClient*) override; private: int m_key; int m_pressed; }; class PointerClientEvent : public ClientEvent { public: PointerClientEvent(int x, int y, int buttonMask) : m_x(x), m_y(y), m_buttonMask(buttonMask) {} - void fire(rfbClient*); + void fire(rfbClient*) override; private: int m_x; int m_y; int m_buttonMask; }; class ClientCutEvent : public ClientEvent { public: explicit ClientCutEvent(const QString &text) : text(text) {} - void fire(rfbClient*); + void fire(rfbClient*) override; private: QString text; }; class VncClientThread: public QThread { Q_OBJECT public: Q_ENUMS(ColorDepth) enum ColorDepth { bpp32, bpp16, bpp8 }; explicit VncClientThread(QObject *parent = 0); ~VncClientThread(); const QImage image(int x = 0, int y = 0, int w = 0, int h = 0); void setImage(const QImage &img); void emitUpdated(int x, int y, int w, int h); void emitGotCut(const QString &text); void stop(); void setHost(const QString &host); void setPort(int port); void setQuality(RemoteView::Quality quality); void setPassword(const QString &password) { m_password = password; } const QString password() const { return m_password; } void setUsername(const QString &username) { m_username = username; } const QString username() const { return m_username; } RemoteView::Quality quality() const; ColorDepth colorDepth() const; uint8_t *frameBuffer; Q_SIGNALS: void imageUpdated(int x, int y, int w, int h); void gotCut(const QString &text); void passwordRequest(bool includingUsername = false); void outputErrorMessage(const QString &message); /** * When we connect/disconnect/reconnect/etc., this signal will be emitted. * * @param status Is the client connected? * @param details A sentence describing what happened. */ void clientStateChanged(RemoteView::RemoteStatus status, const QString &details); public Q_SLOTS: void mouseEvent(int x, int y, int buttonMask); void keyEvent(int key, bool pressed); void clientCut(const QString &text); protected: - void run(); + void run() override; private: void setClientColorDepth(rfbClient *cl, ColorDepth cd); void setColorDepth(ColorDepth colorDepth); // These static methods are callback functions for libvncclient. Each // of them calls back into the corresponding member function via some // TLS-based logic. static rfbBool newclientStatic(rfbClient *cl); static void updatefbStatic(rfbClient *cl, int x, int y, int w, int h); static void cuttextStatic(rfbClient *cl, const char *text, int textlen); static char *passwdHandlerStatic(rfbClient *cl); static rfbCredential *credentialHandlerStatic(rfbClient *cl, int credentialType); static void outputHandlerStatic(const char *format, ...); // Member functions corresponding to the above static methods. rfbBool newclient(); void updatefb(int x, int y, int w, int h); void cuttext(const char *text, int textlen); char *passwdHandler(); rfbCredential *credentialHandler(int credentialType); void outputHandler(const char *format, ...); QImage m_image; rfbClient *cl; QString m_host; QString m_password; QString m_username; int m_port; QMutex mutex; RemoteView::Quality m_quality; ColorDepth m_colorDepth; QQueue m_eventQueue; //color table for 8bit indexed colors QVector m_colorTable; QString outputErrorMessageString; volatile bool m_stopped; volatile bool m_passwordError; /** * Connection keepalive/reconnection support. */ struct { /** * Number of seconds between probes. If zero, we will not attempt * to enable it. */ int intervalSeconds; /** * Number of failed probes required to recognise a disconnect. */ int failedProbes; /** * Was keepalive successfully set? */ bool set; /** * Did keepalive detect a disconnect? */ volatile bool failed; } m_keepalive; // Initialise the VNC client library object. bool clientCreate(bool reinitialising); // Uninitialise the VNC client library object. void clientDestroy(); // Turn on keepalive support. void clientSetKeepalive(); // Record a state change. void clientStateChange(RemoteView::RemoteStatus status, const QString &details); QString m_previousDetails; private Q_SLOTS: void checkOutputErrorMessage(); }; #endif diff --git a/vnc/vnchostpreferences.h b/vnc/vnchostpreferences.h index bca7b3a..f68ae5c 100644 --- a/vnc/vnchostpreferences.h +++ b/vnc/vnchostpreferences.h @@ -1,55 +1,55 @@ /**************************************************************************** ** ** Copyright (C) 2007 Urs Wolfer ** ** This file is part of KDE. ** ** 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; see the file COPYING. If not, write to ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ** Boston, MA 02110-1301, USA. ** ****************************************************************************/ #ifndef VNCHOSTPREFERENCES_H #define VNCHOSTPREFERENCES_H #include "hostpreferences.h" #include "ui_vncpreferences.h" class VncHostPreferences : public HostPreferences { Q_OBJECT public: explicit VncHostPreferences(KConfigGroup configGroup, QObject *parent = 0); ~VncHostPreferences(); void setQuality(RemoteView::Quality quality); RemoteView::Quality quality(); protected: - void acceptConfig(); + void acceptConfig() override; - virtual QWidget* createProtocolSpecificConfigPage(); + QWidget* createProtocolSpecificConfigPage() override; private: Ui::VncPreferences vncUi; void checkEnableCustomSize(int index); private Q_SLOTS: void updateScalingWidthHeight(int index); void updateScaling(bool enabled); }; #endif diff --git a/vnc/vncpreferences.h b/vnc/vncpreferences.h index 54923f8..58a3936 100644 --- a/vnc/vncpreferences.h +++ b/vnc/vncpreferences.h @@ -1,44 +1,44 @@ /**************************************************************************** ** ** Copyright (C) 2008 Urs Wolfer ** ** This file is part of KDE. ** ** 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; see the file COPYING. If not, write to ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ** Boston, MA 02110-1301, USA. ** ****************************************************************************/ #ifndef VNCPREFERENCES_H #define VNCPREFERENCES_H #include "vnchostpreferences.h" #include class VncPreferences : public KCModule { Q_OBJECT public: explicit VncPreferences(QWidget *parent = 0, const QVariantList &args = QVariantList()); ~VncPreferences(); - virtual void save(); - virtual void load(); + void save() override; + void load() override; }; #endif // VNCPREFERENCES_H diff --git a/vnc/vncview.h b/vnc/vncview.h index db84fe8..4c46cf5 100644 --- a/vnc/vncview.h +++ b/vnc/vncview.h @@ -1,112 +1,112 @@ /**************************************************************************** ** ** Copyright (C) 2007 - 2013 Urs Wolfer ** ** This file is part of KDE. ** ** 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; see the file COPYING. If not, write to ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ** Boston, MA 02110-1301, USA. ** ****************************************************************************/ #ifndef VNCVIEW_H #define VNCVIEW_H #include "remoteview.h" #include "vncclientthread.h" #ifdef QTONLY class KConfigGroup{}; #else #include "vnchostpreferences.h" #endif #include #include extern "C" { #include } class VncView: public RemoteView { Q_OBJECT public: explicit VncView(QWidget *parent = 0, const QUrl &url = QUrl(), KConfigGroup configGroup = KConfigGroup()); ~VncView(); - QSize framebufferSize(); - QSize sizeHint() const; - QSize minimumSizeHint() const; - void startQuitting(); - bool isQuitting(); - bool start(); - bool supportsScaling() const; - bool supportsLocalCursor() const; - bool supportsViewOnly() const; + QSize framebufferSize() override; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; + void startQuitting() override; + bool isQuitting() override; + bool start() override; + bool supportsScaling() const override; + bool supportsLocalCursor() const override; + bool supportsViewOnly() const override; #ifndef QTONLY - HostPreferences* hostPreferences(); + HostPreferences* hostPreferences() override; #endif - void setViewOnly(bool viewOnly); - void showDotCursor(DotCursorState state); - void enableScaling(bool scale); + void setViewOnly(bool viewOnly) override; + void showDotCursor(DotCursorState state) override; + void enableScaling(bool scale) override; - virtual void updateConfiguration(); + void updateConfiguration() override; public Q_SLOTS: - void scaleResize(int w, int h); + void scaleResize(int w, int h) override; protected: - void paintEvent(QPaintEvent *event); - bool event(QEvent *event); - void resizeEvent(QResizeEvent *event); - bool eventFilter(QObject *obj, QEvent *event); + void paintEvent(QPaintEvent *event) override; + bool event(QEvent *event) override; + void resizeEvent(QResizeEvent *event) override; + bool eventFilter(QObject *obj, QEvent *event) override; private: VncClientThread vncThread; QClipboard *m_clipboard; bool m_initDone; int m_buttonMask; QMap m_mods; int m_x, m_y, m_w, m_h; bool m_repaint; bool m_quitFlag; bool m_firstPasswordTry; bool m_dontSendClipboard; qreal m_horizontalFactor; qreal m_verticalFactor; #ifndef QTONLY VncHostPreferences *m_hostPreferences; #endif QImage m_frame; bool m_forceLocalCursor; void keyEventHandler(QKeyEvent *e); void unpressModifiers(); void wheelEventHandler(QWheelEvent *event); void mouseEventHandler(QMouseEvent *event); private Q_SLOTS: void updateImage(int x, int y, int w, int h); void setCut(const QString &text); void requestPassword(bool includingUsername); void outputErrorMessage(const QString &message); void clipboardDataChanged(); }; #endif diff --git a/vnc/vncviewfactory.h b/vnc/vncviewfactory.h index 1fdaade..7943a0f 100644 --- a/vnc/vncviewfactory.h +++ b/vnc/vncviewfactory.h @@ -1,55 +1,55 @@ /**************************************************************************** ** ** Copyright (C) 2008 Urs Wolfer ** ** This file is part of KDE. ** ** 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; see the file COPYING. If not, write to ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ** Boston, MA 02110-1301, USA. ** ****************************************************************************/ #ifndef VNCVIEWFACTORY_H #define VNCVIEWFACTORY_H #include "remoteviewfactory.h" #include "vncview.h" #include "vncpreferences.h" class VncViewFactory : public RemoteViewFactory { Q_OBJECT public: explicit VncViewFactory(QObject *parent, const QVariantList &args); virtual ~VncViewFactory(); - virtual bool supportsUrl(const QUrl &url) const; + bool supportsUrl(const QUrl &url) const override; - virtual RemoteView *createView(QWidget *parent, const QUrl &url, KConfigGroup configGroup); + RemoteView *createView(QWidget *parent, const QUrl &url, KConfigGroup configGroup) override; - virtual HostPreferences *createHostPreferences(KConfigGroup configGroup, QWidget *parent); + HostPreferences *createHostPreferences(KConfigGroup configGroup, QWidget *parent) override; - virtual QString scheme() const; + QString scheme() const override; - virtual QString connectActionText() const; + QString connectActionText() const override; - virtual QString connectButtonText() const; + QString connectButtonText() const override; - virtual QString connectToolTipText() const; + QString connectToolTipText() const override; }; #endif // VNCVIEWFACTORY_H