Changeset 105329 in vbox
- Timestamp:
- Jul 15, 2024 3:00:45 PM (5 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r105326 r105329 1107 1107 Q_OBJECT; 1108 1108 1109 /** Possible indicator states. */ 1110 enum 1111 { 1112 State_NotCaptured = 0, // 000 == !MouseCaptured 1113 State_Captured = 1, // 001 == MouseCaptured 1114 State_AbsoluteNotCaptured = 2, // 010 == !MouseCaptured & MouseSupportsAbsolute 1115 State_AbsoluteCaptured = 3, // 011 == MouseCaptured & MouseSupportsAbsolute 1116 State_Integrated = 6, // 110 == MouseSupportsAbsolute & MouseIntegrated 1117 }; 1118 1109 1119 public: 1110 1120 … … 1114 1124 { 1115 1125 /* Assign state-icons: */ 1116 setStateIcon(0, UIIconPool::iconSet(":/mouse_disabled_16px.png")); 1117 setStateIcon(1, UIIconPool::iconSet(":/mouse_16px.png")); 1118 setStateIcon(2, UIIconPool::iconSet(":/mouse_seamless_16px.png")); 1119 setStateIcon(3, UIIconPool::iconSet(":/mouse_can_seamless_16px.png")); 1120 setStateIcon(4, UIIconPool::iconSet(":/mouse_can_seamless_uncaptured_16px.png")); 1121 /* Configure connection: */ 1122 connect(m_pMachine, &UIMachine::sigMouseStateChange, 1123 this, static_cast<void(UIIndicatorMouse::*)(int)>(&UIIndicatorMouse::setState)); // us to blame .. 1126 setStateIcon(State_NotCaptured, UIIconPool::iconSet(":/mouse_disabled_16px.png")); // 000 1127 setStateIcon(State_Captured, UIIconPool::iconSet(":/mouse_16px.png")); // 001 1128 setStateIcon(State_AbsoluteNotCaptured, UIIconPool::iconSet(":/mouse_can_seamless_uncaptured_16px.png")); // 010 1129 setStateIcon(State_AbsoluteCaptured, UIIconPool::iconSet(":/mouse_can_seamless_16px.png")); // 011 1130 setStateIcon(State_Integrated, UIIconPool::iconSet(":/mouse_seamless_16px.png")); // 110 1131 1132 /* Configure machine connection: */ 1133 connect(m_pMachine, &UIMachine::sigMouseStateChange, this, &UIIndicatorMouse::setState); 1134 1124 1135 /* Update & translate finally: */ 1125 1136 updateAppearance(); … … 1131 1142 virtual void updateAppearance() RT_OVERRIDE 1132 1143 { 1144 /* Retranslate finally: */ 1145 sltRetranslateUI(); 1146 } 1147 1148 /** Handles translation event. */ 1149 virtual void sltRetranslateUI() RT_OVERRIDE 1150 { 1151 /* Call to base-class: */ 1152 UISessionStateStatusBarIndicator::sltRetranslateUI(); 1153 1154 /* Update tool-tip: */ 1133 1155 const QString strToolTip = tr("Indicates whether the host mouse pointer is " 1134 1156 "captured by the guest OS:%1", "Mouse tooltip"); … … 1136 1158 strFullData += s_strTableRow3 1137 1159 .arg(QString("<img src=:/mouse_disabled_16px.png/>")) 1138 .arg(tr(" pointer is not captured", "Mouse tooltip"));1160 .arg(tr("Pointer is not captured", "Mouse tooltip")); 1139 1161 strFullData += s_strTableRow3 1140 1162 .arg(QString("<img src=:/mouse_16px.png/>")) 1141 .arg(tr("pointer is captured", "Mouse tooltip")); 1163 .arg(tr("Pointer is captured", "Mouse tooltip")); 1164 strFullData += s_strTableRow3 1165 .arg(QString("<img src=:/mouse_can_seamless_uncaptured_16px.png/>")) 1166 .arg(tr("Mouse integration is Off, pointer is not captured", "Mouse tooltip")); 1167 strFullData += s_strTableRow3 1168 .arg(QString("<img src=:/mouse_can_seamless_16px.png/>")) 1169 .arg(tr("Mouse integration is Off, pointer is captured", "Mouse tooltip")); 1142 1170 strFullData += s_strTableRow3 1143 1171 .arg(QString("<img src=:/mouse_seamless_16px.png/>")) 1144 .arg(tr("mouse integration (MI) is On", "Mouse tooltip")); 1145 strFullData += s_strTableRow3 1146 .arg(QString("<img src=:/mouse_can_seamless_16px.png/>")) 1147 .arg(tr("MI is Off, pointer is captured", "Mouse tooltip")); 1148 strFullData += s_strTableRow3 1149 .arg(QString("<img src=:/mouse_can_seamless_uncaptured_16px.png/>")) 1150 .arg(tr("MI is Off, pointer is not captured", "Mouse tooltip")); 1172 .arg(tr("Mouse integration is On", "Mouse tooltip")); 1151 1173 strFullData = s_strTable.arg(strFullData); 1152 1174 strFullData += tr("Note that the mouse integration feature requires Guest " 1153 1175 "Additions to be installed in the guest OS.", "Mouse tooltip"); 1154 1155 /* Update tool-tip: */1156 1176 setToolTip(strToolTip.arg(strFullData)); 1157 1158 /* Retranslate finally: */1159 sltRetranslateUI();1160 }1161 1162 /** Handles translation event. */1163 virtual void sltRetranslateUI() RT_OVERRIDE1164 {1165 /* Call to base-class: */1166 UISessionStateStatusBarIndicator::sltRetranslateUI();1167 1177 1168 1178 /* Append description with more info: */ … … 1170 1180 switch (state()) 1171 1181 { 1172 case 0: strState = tr("pointer is not captured", "Mouse tooltip"); break; 1173 case 1: strState = tr("pointer is captured", "Mouse tooltip"); break; 1174 case 2: strState = tr("mouse integration (MI) is On", "Mouse tooltip"); break; 1175 case 3: strState = tr("MI is Off, pointer is captured", "Mouse tooltip"); break; 1176 case 4: strState = tr("MI is Off, pointer is not captured", "Mouse tooltip"); break; 1177 default: break; 1182 case State_NotCaptured: 1183 strState = tr("Pointer is not captured", "Mouse tooltip"); break; 1184 case State_Captured: 1185 strState = tr("Pointer is captured", "Mouse tooltip"); break; 1186 case State_AbsoluteNotCaptured: 1187 strState = tr("Mouse integration is Off, pointer is not captured", "Mouse tooltip"); break; 1188 case State_AbsoluteCaptured: 1189 strState = tr("Mouse integration is Off, pointer is captured", "Mouse tooltip"); break; 1190 case State_Integrated: 1191 strState = tr("Mouse integration is On", "Mouse tooltip"); break; 1192 default: 1193 break; 1178 1194 } 1179 1195 if (!strState.isNull()) … … 1186 1202 void setState(int iState) RT_OVERRIDE 1187 1203 { 1188 if ((iState & UIMouseStateType_MouseAbsoluteDisabled) && 1189 (iState & UIMouseStateType_MouseAbsolute) && 1190 !(iState & UIMouseStateType_MouseCaptured)) 1191 QIStateStatusBarIndicator::setState(4); 1192 else 1193 QIStateStatusBarIndicator::setState(iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured)); 1194 sltRetranslateUI(); 1204 /* Call to base-class: */ 1205 QIStateStatusBarIndicator::setState(iState); 1206 1207 /* Update everything: */ 1208 updateAppearance(); 1195 1209 } 1196 1210 }; 1211 1197 1212 1198 1213 /** UISessionStateStatusBarIndicator extension for Runtime UI: Keyboard indicator. */ … … 1247 1262 } 1248 1263 }; 1264 1249 1265 1250 1266 /** QITextStatusBarIndicator extension for Runtime UI: Keyboard-extension indicator. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h
r103339 r105329 58 58 { 59 59 UIMouseStateType_MouseCaptured = RT_BIT(0), 60 UIMouseStateType_MouseAbsolute = RT_BIT(1), 61 UIMouseStateType_MouseAbsoluteDisabled = RT_BIT(2), 62 UIMouseStateType_MouseNeedsHostCursor = RT_BIT(3) 60 UIMouseStateType_MouseSupportsAbsolute = RT_BIT(1), 61 UIMouseStateType_MouseIntegrated = RT_BIT(2) 63 62 }; 64 63 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r104598 r105329 258 258 int UIMouseHandler::state() const 259 259 { 260 return uimachine()->machineState() == KMachineState_Null ? 0 : 261 (uimachine()->isMouseCaptured() ? UIMouseStateType_MouseCaptured : 0) | 262 (uimachine()->isMouseSupportsAbsolute() ? UIMouseStateType_MouseAbsolute : 0) | 263 (uimachine()->isMouseIntegrated() ? 0 : UIMouseStateType_MouseAbsoluteDisabled); 260 int iResult = 0; 261 if (uimachine()->isMouseCaptured()) 262 iResult |= UIMouseStateType_MouseCaptured; 263 if (uimachine()->isMouseSupportsAbsolute()) 264 { 265 iResult |= UIMouseStateType_MouseSupportsAbsolute; 266 if (uimachine()->isMouseIntegrated()) 267 iResult |= UIMouseStateType_MouseIntegrated; 268 } 269 return iResult; 264 270 } 265 271
Note:
See TracChangeset
for help on using the changeset viewer.