Changeset 104630 in vbox
- Timestamp:
- May 14, 2024 2:00:10 PM (7 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r104393 r104630 28 28 /* Qt includes: */ 29 29 #include <QAbstractNativeEventFilter> 30 #include <QAccessibleWidget> 30 31 #include <QApplication> 31 32 #include <QBitmap> … … 42 43 #include "UIDesktopWidgetWatchdog.h" 43 44 #include "UIExtraDataManager.h" 45 #include "UIFrameBuffer.h" 46 #include "UIKeyboardHandler.h" 44 47 #include "UILoggingDefs.h" 45 48 #include "UIMachine.h" … … 51 54 #include "UIMachineViewSeamless.h" 52 55 #include "UIMachineViewScale.h" 56 #include "UIMouseHandler.h" 53 57 #include "UINotificationCenter.h" 54 #include "UIKeyboardHandler.h" 55 #include "UIMouseHandler.h" 56 #include "UIFrameBuffer.h" 58 #include "UITranslationEventListener.h" 57 59 #ifdef VBOX_WS_MAC 58 60 # include "UICocoaApplication.h" … … 102 104 # define DNDDEBUG(x) 103 105 #endif 106 107 108 /** QAccessibleWidget extension used as an accessibility interface for Machine-view. */ 109 class UIAccessibilityInterfaceForUIMachineView : public QAccessibleWidget 110 { 111 public: 112 113 /** Returns an accessibility interface for passed @a strClassname and @a pObject. */ 114 static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject) 115 { 116 /* Creating Machine-view accessibility interface: */ 117 if (pObject && strClassname == QLatin1String("UIMachineView")) 118 return new UIAccessibilityInterfaceForUIMachineView(qobject_cast<QWidget*>(pObject)); 119 120 /* Null by default: */ 121 return 0; 122 } 123 124 /** Constructs an accessibility interface passing @a pWidget to the base-class. */ 125 UIAccessibilityInterfaceForUIMachineView(QWidget *pWidget) 126 : QAccessibleWidget(pWidget, QAccessible::Canvas) 127 {} 128 129 /** Returns the number of children. */ 130 virtual int childCount() const RT_OVERRIDE 131 { 132 /* Make sure view still alive: */ 133 AssertPtrReturn(view(), 0); 134 135 /* Zero by default: */ 136 return 0; 137 } 138 139 /** Returns the child with the passed @a iIndex. */ 140 virtual QAccessibleInterface *child(int iIndex) const RT_OVERRIDE 141 { 142 /* Make sure view still alive: */ 143 AssertPtrReturn(view(), 0); 144 /* Make sure index is valid: */ 145 AssertReturn(iIndex >= 0 && iIndex < childCount(), 0); 146 147 /* Null by default: */ 148 return 0; 149 } 150 151 /** Returns the index of passed @a pChild. */ 152 virtual int indexOfChild(const QAccessibleInterface *pChild) const RT_OVERRIDE 153 { 154 /* Make sure view still alive: */ 155 AssertPtrReturn(view(), -1); 156 /* Make sure child is valid: */ 157 AssertReturn(pChild, -1); 158 159 /* -1 by default: */ 160 return -1;; 161 } 162 163 /** Returns a text for the passed @a enmTextRole. */ 164 virtual QString text(QAccessible::Text enmTextRole) const RT_OVERRIDE 165 { 166 /* Make sure view still alive: */ 167 AssertPtrReturn(view(), QString()); 168 169 /* Gather suitable text: */ 170 Q_UNUSED(enmTextRole); 171 QString strText = view()->toolTip(); 172 if (strText.isEmpty()) 173 strText = view()->whatsThis(); 174 return strText; 175 } 176 177 private: 178 179 /** Returns corresponding Machine-view. */ 180 UIMachineView *view() const { return qobject_cast<UIMachineView*>(widget()); } 181 }; 104 182 105 183 … … 1145 1223 } 1146 1224 1225 void UIMachineView::sltRetranslateUI() 1226 { 1227 setWhatsThis(tr("Holds the graphical canvas containing guest screen contents.")); 1228 } 1229 1147 1230 UIMachineView::UIMachineView(UIMachineWindow *pMachineWindow, ulong uScreenId) 1148 1231 : QAbstractScrollArea(pMachineWindow->centralWidget()) … … 1158 1241 , m_pNativeEventFilter(0) 1159 1242 { 1243 /* Install Machine-view accessibility interface factory: */ 1244 QAccessible::installFactory(UIAccessibilityInterfaceForUIMachineView::pFactory); 1160 1245 } 1161 1246 … … 1321 1406 /* UICommon connections: */ 1322 1407 connect(&uiCommon(), &UICommon::sigAskToDetachCOM, this, &UIMachineView::sltDetachCOM); 1408 1323 1409 /* Desktop resolution change (e.g. monitor hotplug): */ 1324 1410 connect(gpDesktop, &UIDesktopWidgetWatchdog::sigHostScreenResized, 1325 1411 this, &UIMachineView::sltDesktopResized); 1412 1326 1413 /* Scale-factor change: */ 1327 1414 connect(gEDataManager, &UIExtraDataManager::sigScaleFactorChange, … … 1330 1417 connect(gEDataManager, &UIExtraDataManager::sigScalingOptimizationTypeChange, 1331 1418 this, &UIMachineView::sltHandleScalingOptimizationChange); 1419 1332 1420 /* Action-pool connections: */ 1333 1421 UIActionPoolRuntime *pActionPoolRuntime = qobject_cast<UIActionPoolRuntime*>(actionPool()); … … 1339 1427 this, &UIMachineView::sltHandleActionTriggerViewScreenResize); 1340 1428 } 1429 1430 /* Translate initially: */ 1431 connect(&translationEventListener(), &UITranslationEventListener::sigRetranslateUI, 1432 this, &UIMachineView::sltRetranslateUI); 1433 sltRetranslateUI(); 1341 1434 } 1342 1435 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r103988 r104630 234 234 void sltDetachCOM(); 235 235 236 /** Handles translation event. */ 237 void sltRetranslateUI(); 238 236 239 protected: 237 240
Note:
See TracChangeset
for help on using the changeset viewer.