Changeset 89910 in vbox
- Timestamp:
- Jun 25, 2021 10:18:08 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145368
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.cpp
r89908 r89910 163 163 } 164 164 165 QStringList X11FindDBusScreenSaverServices(const QDBusConnection &connection) 165 static bool X11CheckDBusConnection(const QDBusConnection &connection) 166 { 167 if (!connection.isConnected()) { 168 const QDBusError lastError = connection.lastError(); 169 if (lastError.isValid()) 170 { 171 LogRel(("QDBus error. Could not connect to D-Bus server: %s: %s\n", 172 lastError.name().toUtf8().constData(), 173 lastError.message().toUtf8().constData())); 174 } 175 else 176 LogRel(("QDBus error. Could not connect to D-Bus server: Unable to load dbus libraries\n")); 177 return false; 178 } 179 return true; 180 } 181 182 static QStringList X11FindDBusScreenSaverServices(const QDBusConnection &connection) 166 183 { 167 184 QStringList serviceNames; … … 187 204 return serviceNames; 188 205 } 206 207 bool X11CheckDBusScreenSaverServices() 208 { 209 QDBusConnection connection = QDBusConnection::sessionBus(); 210 if (!X11CheckDBusConnection(connection)) 211 return false; 212 213 QDBusReply<QStringList> replyr = connection.interface()->registeredServiceNames(); 214 if (!replyr.isValid()) 215 { 216 const QDBusError replyError = replyr.error(); 217 LogRel(("QDBus error. Could not query registered service names %s %s", 218 replyError.name().toUtf8().constData(), replyError.message().toUtf8().constData())); 219 return false; 220 } 221 for (int i = 0; i < replyr.value().size(); ++i) 222 { 223 const QString strServiceName = replyr.value()[i]; 224 if (strServiceName.contains("screensaver", Qt::CaseInsensitive)) 225 return true; 226 } 227 LogRel(("QDBus error. No screen saver service found among registered DBus services.")); 228 return false; 229 } 230 189 231 190 232 static void X11IntrospectInterfaceNode(const QDomElement &interface, … … 237 279 } 238 280 239 static bool X11CheckDBusConnection(const QDBusConnection &connection)240 {241 if (!connection.isConnected()) {242 const QDBusError lastError = connection.lastError();243 if (lastError.isValid())244 {245 LogRel(("QDBus error. Could not connect to D-Bus server: %s: %s\n",246 lastError.name().toUtf8().constData(),247 lastError.message().toUtf8().constData()));248 }249 else250 LogRel(("QDBus error. Could not connect to D-Bus server: Unable to load dbus libraries\n"));251 return false;252 }253 return true;254 }255 256 281 QVector<X11ScreenSaverInhibitMethod*> X11FindDBusScrenSaverInhibitMethods() 257 282 { -
trunk/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.h
r89908 r89910 67 67 SHARED_LIBRARY_STUFF bool X11CheckExtension(const char *extensionName); 68 68 69 /** Returns t he list ofDBus services whose name contains the substring 'screensaver'. */70 QStringList X11FindDBusScreenSaverServices(const QDBusConnection &connection);69 /** Returns true if there are any DBus services whose name contains the substring 'screensaver'. */ 70 bool X11CheckDBusScreenSaverServices(); 71 71 72 72 /** Returns the list of Inhibit methods found by introspecting DBus services. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
r89909 r89910 28 28 #include "UIMessageCenter.h" 29 29 #include "UIScaleFactorEditor.h" 30 #ifdef VBOX_WS_X11 31 # include "VBoxX11Helper.h" 32 #endif 30 33 31 34 … … 81 84 , m_pLabelMachineWindows(0) 82 85 , m_pCheckBoxActivateOnMouseHover(0) 83 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)84 86 , m_pCheckBoxDisableHostScreenSaver(0) 85 #endif86 87 { 87 88 prepare(); … … 122 123 m_pEditorMaximumGuestScreenSize->setValue(oldData.m_guiMaximumGuestScreenSizeValue); 123 124 m_pCheckBoxActivateOnMouseHover->setChecked(oldData.m_fActivateHoveredMachineWindow); 124 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) 125 m_pCheckBoxDisableHostScreenSaver->setChecked(oldData.m_fDisableHostScreenSaver); 126 #endif 125 if (m_pCheckBoxDisableHostScreenSaver) 126 m_pCheckBoxDisableHostScreenSaver->setChecked(oldData.m_fDisableHostScreenSaver); 127 127 m_pEditorScaleFactor->setScaleFactors(oldData.m_scaleFactors); 128 128 m_pEditorScaleFactor->setMonitorCount(gpDesktop->screenCount()); … … 137 137 newData.m_guiMaximumGuestScreenSizeValue = m_pEditorMaximumGuestScreenSize->value(); 138 138 newData.m_fActivateHoveredMachineWindow = m_pCheckBoxActivateOnMouseHover->isChecked(); 139 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) 140 newData.m_fDisableHostScreenSaver = m_pCheckBoxDisableHostScreenSaver->isChecked(); 141 #endif 139 if (m_pCheckBoxDisableHostScreenSaver) 140 newData.m_fDisableHostScreenSaver = m_pCheckBoxDisableHostScreenSaver->isChecked(); 142 141 newData.m_scaleFactors = m_pEditorScaleFactor->scaleFactors(); 143 142 m_pCache->cacheCurrentData(newData); … … 166 165 m_pCheckBoxActivateOnMouseHover->setWhatsThis(tr("When checked, machine windows will be raised when the mouse pointer moves over them.")); 167 166 m_pCheckBoxActivateOnMouseHover->setText(tr("&Raise Window Under Mouse")); 168 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) 169 m_pCheckBoxDisableHostScreenSaver->setWhatsThis(tr("When checked, screen saver of the host OS is disabled.")); 170 m_pCheckBoxDisableHostScreenSaver->setText(tr("&Disable Host Screen Saver")); 171 #endif 167 if (m_pCheckBoxDisableHostScreenSaver) 168 { 169 m_pCheckBoxDisableHostScreenSaver->setWhatsThis(tr("When checked, screen saver of the host OS is disabled.")); 170 m_pCheckBoxDisableHostScreenSaver->setText(tr("&Disable Host Screen Saver")); 171 } 172 172 } 173 173 … … 256 256 pLayoutMain->addWidget(m_pCheckBoxActivateOnMouseHover, 5, 1); 257 257 258 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)259 258 /* Prepare 'disable host screen saver' check-box: */ 259 #if defined(VBOX_WS_WIN) 260 260 m_pCheckBoxDisableHostScreenSaver = new QCheckBox(this); 261 #elif defined(VBOX_WS_X11) 262 if (X11CheckDBusScreenSaverServices()) 263 m_pCheckBoxDisableHostScreenSaver = new QCheckBox(this); 264 #endif 261 265 if (m_pCheckBoxDisableHostScreenSaver) 262 266 pLayoutMain->addWidget(m_pCheckBoxDisableHostScreenSaver, 6, 1); 263 #endif 267 264 268 } 265 269 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h
r89908 r89910 97 97 /** Holds the 'activate on mouse hover' check-box instance. */ 98 98 QCheckBox *m_pCheckBoxActivateOnMouseHover; 99 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)100 99 /** Holds the 'disable host screen saver' check-box instance. */ 101 100 QCheckBox *m_pCheckBoxDisableHostScreenSaver; 102 #endif103 101 /** @} */ 104 102 };
Note:
See TracChangeset
for help on using the changeset viewer.