diff --git a/bookmarkmanager.h b/bookmarkmanager.h index 92c6892..53c7583 100644 --- a/bookmarkmanager.h +++ b/bookmarkmanager.h @@ -1,78 +1,78 @@ /**************************************************************************** ** ** 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 BOOKMARKMANAGER_H #define BOOKMARKMANAGER_H #include "core/remoteview.h" #include #include #include #include class MainWindow; class BookmarkManager : public QObject, public KBookmarkOwner { Q_OBJECT public: BookmarkManager(KActionCollection *collection, QMenu *menu, MainWindow *parent); ~BookmarkManager() override; - QUrl currentUrl() const Q_DECL_OVERRIDE; - QString currentTitle() const Q_DECL_OVERRIDE; + QUrl currentUrl() const override; + QString currentTitle() const override; virtual bool addBookmarkEntry() const; virtual bool editBookmarkEntry() const; - bool supportsTabs() const Q_DECL_OVERRIDE; - QList currentBookmarkList() const Q_DECL_OVERRIDE; + bool supportsTabs() const override; + QList currentBookmarkList() const override; void addHistoryBookmark(RemoteView *view); void addManualBookmark(const QUrl &url, const QString &text); KBookmarkManager* getManager(); // removes all bookmarks with url, possibly ignore the history folder and update it's title there if it's set static void removeByUrl(KBookmarkManager *manager, const QString &url, bool ignoreHistory = false, const QString updateTitle = QString()); static void updateTitle(KBookmarkManager *manager, const QString &url, const QString &title); // returns a QStringList for all bookmarks that point to this url using KBookmark::address() static const QStringList findBookmarkAddresses(const KBookmarkGroup &group, const QString &url); Q_SIGNALS: void openUrl(const QUrl &url); private Q_SLOTS: void openBookmark(const KBookmark &bm, Qt::MouseButtons, Qt::KeyboardModifiers) override; void openFolderinTabs(const KBookmarkGroup &bookmarkGroup) override; private: QString urlForView(RemoteView *view) const; QString titleForUrl(const QUrl &url) const; KBookmarkMenu *m_bookmarkMenu; KBookmarkManager *m_manager; KBookmarkGroup m_historyGroup; MainWindow *m_mainWindow; }; #endif diff --git a/tabbedviewwidget.h b/tabbedviewwidget.h index b3cab71..f153630 100644 --- a/tabbedviewwidget.h +++ b/tabbedviewwidget.h @@ -1,82 +1,82 @@ /**************************************************************************** ** ** Copyright (C) 2009 Tony Murray ** ** 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 TABBEDVIEWWIDGET_H #define TABBEDVIEWWIDGET_H #include #include #include class TabbedViewWidgetModel : public QAbstractItemModel { friend class TabbedViewWidget; Q_OBJECT public: explicit TabbedViewWidgetModel(QTabWidget *modelTarget); QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &index) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; Qt::ItemFlags flags(const QModelIndex &index) const override; bool setData(const QModelIndex &index, const QVariant &value, int role) override; QVariant data(const QModelIndex &index, int role) const override; protected: void emitLayoutAboutToBeChanged(); void emitLayoutChanged(); void emitDataChanged(int index); private: QTabWidget *m_tabWidget; }; class TabbedViewWidget : public QTabWidget { Q_OBJECT public: explicit TabbedViewWidget(QWidget *parent = nullptr); ~TabbedViewWidget() override; TabbedViewWidgetModel* getModel(); int addTab(QWidget *page, const QString &label); int addTab(QWidget *page, const QIcon &icon, const QString &label); int insertTab(int index, QWidget *page, const QString &label); int insertTab(int index, QWidget *page, const QIcon &icon, const QString &label); void removeTab(int index); void removePage(QWidget *page); void moveTab(int from, int to); void setTabText(int index, const QString &label); Q_SIGNALS: void mouseMiddleClick(int index); protected: - void mouseDoubleClickEvent(QMouseEvent * event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseDoubleClickEvent(QMouseEvent * event) override; + void mouseReleaseEvent(QMouseEvent *) override; private: TabbedViewWidgetModel *m_model; bool isEmptyTabbarSpace(const QPoint &point) const; }; #endif // FULLSCREENWINDOW_H diff --git a/vnc/vncclientthread.h b/vnc/vncclientthread.h index aa51688..9b31aa1 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*) 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*) 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*) 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(); + ~VncClientThread() override; 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() 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 5bb22af..2b8fd77 100644 --- a/vnc/vnchostpreferences.h +++ b/vnc/vnchostpreferences.h @@ -1,65 +1,65 @@ /**************************************************************************** ** ** 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(); + ~VncHostPreferences() override; void setQuality(RemoteView::Quality quality); RemoteView::Quality quality(); bool useSshTunnel() const; bool useSshTunnelLoopback() const; int sshTunnelPort() const; QString sshTunnelUserName() const; protected: void acceptConfig() override; QWidget* createProtocolSpecificConfigPage() override; private: void setUseSshTunnel(bool useSshTunnel); void setUseSshTunnelLoopback(bool useSshTunnelLoopback); void setSshTunnelPort(int port); void setSshTunnelUserName(const QString &userName); 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 58a3936..1fd438f 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(); + ~VncPreferences() override; void save() override; void load() override; }; #endif // VNCPREFERENCES_H diff --git a/vnc/vncsshtunnelthread.h b/vnc/vncsshtunnelthread.h index a3df682..ce694ef 100644 --- a/vnc/vncsshtunnelthread.h +++ b/vnc/vncsshtunnelthread.h @@ -1,80 +1,80 @@ /**************************************************************************** ** ** Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group ** company, info@kdab.com. Work sponsored by the ** LiMux project of the city of Munich ** ** This file is part of KRDC. ** ** 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 VNCSSHTUNNELTHREAD_H #define VNCSSHTUNNELTHREAD_H #include #include #include #include #include class VncSshTunnelThread : public QThread { Q_OBJECT public: VncSshTunnelThread(const QByteArray &host, int vncPort, int tunnelPort, int sshPort, const QByteArray &sshUserName, bool loopback); - ~VncSshTunnelThread(); + ~VncSshTunnelThread() override; enum PasswordOrigin { PasswordFromWallet, PasswordFromDialog }; enum PasswordRequestFlags { NoFlags, IgnoreWallet }; QString password() const; void setPassword(const QString &password, PasswordOrigin origin); void userCanceledPasswordRequest(); void run() override; Q_SIGNALS: void passwordRequest(PasswordRequestFlags flags); void listenReady(); void errorMessage(const QString &message); private: QByteArray m_host; int m_vncPort; int m_tunnelPort; int m_sshPort; QByteArray m_sshUserName; bool m_loopback; QString m_password; PasswordOrigin m_passwordOrigin; bool m_passwordRequestCanceledByUser; std::atomic_bool m_stop_thread; }; #endif diff --git a/vnc/vncview.h b/vnc/vncview.h index 36e443a..2e7850f 100644 --- a/vnc/vncview.h +++ b/vnc/vncview.h @@ -1,127 +1,127 @@ /**************************************************************************** ** ** 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 #ifdef LIBSSH_FOUND #include "vncsshtunnelthread.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(); + ~VncView() override; 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() override; #endif void setViewOnly(bool viewOnly) override; void showDotCursor(DotCursorState state) override; void enableScaling(bool scale) override; void updateConfiguration() override; public Q_SLOTS: void scaleResize(int w, int h) override; protected: 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; #ifdef LIBSSH_FOUND VncSshTunnelThread *m_sshTunnelThread; QString readWalletSshPassword(); void saveWalletSshPassword(); #endif 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); #ifdef LIBSSH_FOUND void sshRequestPassword(VncSshTunnelThread::PasswordRequestFlags flags); #endif void outputErrorMessage(const QString &message); void sshErrorMessage(const QString &message); void clipboardDataChanged(); }; #endif diff --git a/vnc/vncviewfactory.h b/vnc/vncviewfactory.h index 7943a0f..f0ddafa 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(); + ~VncViewFactory() override; bool supportsUrl(const QUrl &url) const override; RemoteView *createView(QWidget *parent, const QUrl &url, KConfigGroup configGroup) override; HostPreferences *createHostPreferences(KConfigGroup configGroup, QWidget *parent) override; QString scheme() const override; QString connectActionText() const override; QString connectButtonText() const override; QString connectToolTipText() const override; }; #endif // VNCVIEWFACTORY_H