Changeset 71551 in vbox
- Timestamp:
- Mar 28, 2018 4:24:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h
r69500 r71551 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 #define ___VBoxUtils_h___ 20 20 21 #include <iprt/types.h> 22 23 /* Qt includes */ 21 /* Qt includes: */ 24 22 #include <QMouseEvent> 25 23 #include <QWidget> 26 24 #include <QTextBrowser> 27 25 28 /** QObject reimplementation, 29 * providing passed QObject with property assignation routine. */ 26 /* GUI includes: */ 27 #ifdef VBOX_WS_MAC 28 # include "VBoxUtils-darwin.h" 29 #endif 30 31 /* Other VBox includes: */ 32 #include <iprt/types.h> 33 34 35 /** QObject subclass, 36 * allowing to apply string-property value for a certain QObject. */ 30 37 class QObjectPropertySetter : public QObject 31 38 { … … 34 41 public: 35 42 36 /** Construct or. */43 /** Constructs setter for a property with certain @a strName, passing @a pParent to the base-class. */ 37 44 QObjectPropertySetter(QObject *pParent, const QString &strName) 38 : QObject(pParent), m_strName(strName) {} 45 : QObject(pParent), m_strName(strName) 46 {} 39 47 40 48 public slots: 41 49 42 /** Assigns property value. */50 /** Assigns string property @a strValue. */ 43 51 void sltAssignProperty(const QString &strValue) 44 { parent()->setProperty(m_strName.toLatin1().constData(), strValue); } 52 { 53 parent()->setProperty(m_strName.toLatin1().constData(), strValue); 54 } 45 55 46 56 private: 47 57 48 /** Holds property name. */58 /** Holds the property name. */ 49 59 const QString m_strName; 50 60 }; 51 61 52 /**53 * Simple class which simulates focus-proxy rule redirecting widget54 * assigned shortcut to desired widget.55 */56 class QIFocusProxy : protected QObject57 {58 Q_OBJECT;59 62 60 public: 61 62 QIFocusProxy (QWidget *aFrom, QWidget *aTo) 63 : QObject (aFrom), mFrom (aFrom), mTo (aTo) 64 { 65 mFrom->installEventFilter (this); 66 } 67 68 protected: 69 70 bool eventFilter (QObject *aObject, QEvent *aEvent) 71 { 72 if (aObject == mFrom && aEvent->type() == QEvent::Shortcut) 73 { 74 mTo->setFocus(); 75 return true; 76 } 77 return QObject::eventFilter (aObject, aEvent); 78 } 79 80 QWidget *mFrom; 81 QWidget *mTo; 82 }; 83 84 /** 85 * QTextEdit reimplementation to feat some extended requirements. 86 */ 87 class QRichTextEdit : public QTextEdit 88 { 89 Q_OBJECT; 90 91 public: 92 93 QRichTextEdit (QWidget *aParent = 0) : QTextEdit (aParent) {} 94 95 void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom) 96 { 97 QTextEdit::setViewportMargins (aLeft, aTop, aRight, aBottom); 98 } 99 }; 100 101 /** 102 * QTextBrowser reimplementation to feat some extended requirements. 103 */ 104 class QRichTextBrowser : public QTextBrowser 105 { 106 Q_OBJECT; 107 108 public: 109 110 QRichTextBrowser (QWidget *aParent) : QTextBrowser (aParent) {} 111 112 void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom) 113 { 114 QTextBrowser::setViewportMargins (aLeft, aTop, aRight, aBottom); 115 } 116 }; 117 118 /** Object containing functionality 119 * to (de)serialize proxy settings. */ 63 /** Simple class, 64 * containing functionality to (de)serialize proxy settings. */ 120 65 class UIProxyManager 121 66 { … … 130 75 }; 131 76 132 /** Constructs object which parses passed@a strProxySettings. */77 /** Constructs proxy-manager which parses @a strProxySettings. */ 133 78 UIProxyManager(const QString &strProxySettings = QString()) 134 79 : m_enmProxyState(ProxyState_Auto) … … 180 125 ProxyState proxyState() const { return m_enmProxyState; } 181 126 /** Returns the proxy host. */ 182 const QString &proxyHost() const { return m_strProxyHost; }127 const QString &proxyHost() const { return m_strProxyHost; } 183 128 /** Returns the proxy port. */ 184 const QString &proxyPort() const { return m_strProxyPort; }129 const QString &proxyPort() const { return m_strProxyPort; } 185 130 186 131 /** Returns whether the proxy auth is enabled. */ 187 132 bool authEnabled() const { return m_fAuthEnabled; } 188 133 /** Returns the proxy auth login. */ 189 const QString &authLogin() const { return m_strAuthLogin; }134 const QString &authLogin() const { return m_strAuthLogin; } 190 135 /** Returns the proxy auth password. */ 191 const QString &authPassword() const { return m_strAuthPassword; }136 const QString &authPassword() const { return m_strAuthPassword; } 192 137 193 138 /** Defines the proxy @a enmState. */ … … 207 152 private: 208 153 209 /** Converts passed @a state to corresponding #QString. */210 static QString proxyStateToString(ProxyState state)154 /** Converts passed @a enmState to corresponding #QString. */ 155 static QString proxyStateToString(ProxyState enmState) 211 156 { 212 switch ( state)157 switch (enmState) 213 158 { 214 159 case ProxyState_Disabled: return QString("ProxyDisabled"); … … 232 177 233 178 /** Holds the proxy state. */ 234 ProxyState m_enmProxyState;179 ProxyState m_enmProxyState; 235 180 /** Holds the proxy host. */ 236 QString m_strProxyHost;181 QString m_strProxyHost; 237 182 /** Holds the proxy port. */ 238 QString m_strProxyPort;183 QString m_strProxyPort; 239 184 240 185 /** Holds whether the proxy auth is enabled. */ 241 bool m_fAuthEnabled;186 bool m_fAuthEnabled; 242 187 /** Holds the proxy auth login. */ 243 QString m_strAuthLogin;188 QString m_strAuthLogin; 244 189 /** Holds the proxy auth password. */ 245 QString m_strAuthPassword;190 QString m_strAuthPassword; 246 191 }; 247 192 248 #ifdef VBOX_WS_MAC249 # include "VBoxUtils-darwin.h"250 #endif /* VBOX_WS_MAC */251 193 252 #endif / / !___VBoxUtils_h___194 #endif /* !___VBoxUtils_h___ */ 253 195
Note:
See TracChangeset
for help on using the changeset viewer.

