File indexing completed on 2024-03-24 05:01:33
0001 /* 0002 SPDX-FileCopyrightText: 2007 Urs Wolfer <uwolfer@kde.org> 0003 SPDX-FileCopyrightText: 2021 RafaĆ Lalik <rafallalik@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef HOSTPREFERENCES_H 0009 #define HOSTPREFERENCES_H 0010 0011 #include "krdccore_export.h" 0012 #include "remoteview.h" 0013 0014 #include <KConfigGroup> 0015 0016 class QCheckBox; 0017 class QWidget; 0018 0019 class KRDCCORE_EXPORT HostPreferences : public QObject 0020 { 0021 Q_OBJECT 0022 0023 public: 0024 ~HostPreferences() override; 0025 0026 KConfigGroup configGroup(); 0027 0028 bool walletSupport(); 0029 0030 /** Whether scaling is enabled when session is full screen. Note: only windowedScale seems to be used. */ 0031 bool fullscreenScale(); 0032 void setFullscreenScale(bool scale); 0033 0034 /** Whether scaling is enabled when session is not full screen */ 0035 bool windowedScale(); 0036 void setWindowedScale(bool scale); 0037 0038 /** Whether scaling is enabled when session is full screen. Note: only windowedScale seems to be used. */ 0039 int scaleFactor(); 0040 void setScaleFactor(int factor); 0041 0042 bool grabAllKeys(); 0043 void setGrabAllKeys(bool grab); 0044 0045 bool showLocalCursor(); 0046 void setShowLocalCursor(bool show); 0047 0048 bool viewOnly(); 0049 void setViewOnly(bool view); 0050 0051 /** Saved height. Generally used for the viewsize. */ 0052 int height(); 0053 void setHeight(int height); 0054 /** Saved width. Generally used for the viewsize. */ 0055 int width(); 0056 void setWidth(int width); 0057 0058 /** 0059 * Show the configuration dialog if needed, ie. if the user did 0060 * check "show this dialog again for this host". 0061 * Returns true if user pressed ok. 0062 */ 0063 bool showDialogIfNeeded(QWidget *parent); 0064 0065 /** Show the configuration dialog */ 0066 bool showDialog(QWidget *parent); 0067 0068 /** If @p connected is true, a message is shown that settings might only apply after a reconnect. */ 0069 void setShownWhileConnected(bool connected); 0070 0071 protected: 0072 HostPreferences(KConfigGroup configGroup, QObject *parent); 0073 0074 virtual QWidget *createProtocolSpecificConfigPage() = 0; 0075 0076 /** Called when the user validates the config dialog. */ 0077 virtual void acceptConfig(); 0078 0079 bool hostConfigured(); 0080 bool showConfigAgain(); 0081 0082 KConfigGroup m_configGroup; 0083 0084 private: 0085 void setShowConfigAgain(bool show); 0086 void setWalletSupport(bool walletSupport); 0087 0088 bool m_hostConfigured; 0089 bool m_connected; 0090 0091 QCheckBox *showAgainCheckBox; 0092 QCheckBox *walletSupportCheckBox; 0093 }; 0094 0095 #endif