Skip to content

Commit 65fc82a

Browse files
committed
FE/Qt: bugref:10067: Message-center: Wiping out more obsolete stuff.
svn:sync-xref-src-repo-rev: r173716
1 parent b2439ea commit 65fc82a

6 files changed

Lines changed: 6 additions & 316 deletions

File tree

Lines changed: 1 addition & 199 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: UIMessageCenter.cpp 113937 2026-04-17 09:26:37Z sergey.dubov@oracle.com $ */
1+
/* $Id: UIMessageCenter.cpp 113938 2026-04-17 09:37:43Z sergey.dubov@oracle.com $ */
22
/** @file
33
* VBox Qt GUI - UIMessageCenter class implementation.
44
*/
@@ -25,11 +25,7 @@
2525
* SPDX-License-Identifier: GPL-3.0-only
2626
*/
2727

28-
/* Qt includes: */
29-
#include <QThread>
30-
3128
/* GUI includes: */
32-
#include "QIMessageBox.h"
3329
#include "UICommon.h"
3430
#include "UIExtraDataManager.h"
3531
#include "UIGlobalSession.h"
@@ -79,60 +75,6 @@ void UIMessageCenter::destroy()
7975
delete s_pInstance;
8076
}
8177

82-
int UIMessageCenter::message(QWidget *pParent, MessageType enmType,
83-
const QString &strMessage,
84-
const QString &strDetails,
85-
const char *pcszAutoConfirmId /* = 0 */,
86-
int iButton1 /* = 0 */,
87-
int iButton2 /* = 0 */,
88-
int iButton3 /* = 0 */,
89-
const QString &strButtonText1 /* = QString() */,
90-
const QString &strButtonText2 /* = QString() */,
91-
const QString &strButtonText3 /* = QString() */,
92-
const QString &strHelpKeyword /* = QString() */) const
93-
{
94-
/* If this is NOT a GUI thread: */
95-
if (thread() != QThread::currentThread())
96-
{
97-
/* We have to throw a blocking signal
98-
* to show a message-box in the GUI thread: */
99-
emit sigToShowMessageBox(pParent, enmType,
100-
strMessage, strDetails,
101-
iButton1, iButton2, iButton3,
102-
strButtonText1, strButtonText2, strButtonText3,
103-
QString(pcszAutoConfirmId), strHelpKeyword);
104-
// Inter-thread communications are not yet implemented, so
105-
// we are not returning effective value, but zero otherwise.
106-
return 0;
107-
}
108-
109-
/* In usual case we can chow a message-box directly: */
110-
return showMessageBox(pParent, enmType,
111-
strMessage, strDetails,
112-
iButton1, iButton2, iButton3,
113-
strButtonText1, strButtonText2, strButtonText3,
114-
QString(pcszAutoConfirmId), strHelpKeyword);
115-
}
116-
117-
void UIMessageCenter::error(QWidget *pParent, MessageType enmType,
118-
const QString &strMessage,
119-
const QString &strDetails,
120-
const char *pcszAutoConfirmId /* = 0 */,
121-
const QString &strHelpKeyword /* = QString() */) const
122-
{
123-
message(pParent, enmType, strMessage, strDetails, pcszAutoConfirmId,
124-
AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape, 0 /* Button 2 */, 0 /* Button 3 */,
125-
QString() /* strButtonText1 */, QString() /* strButtonText2 */, QString() /* strButtonText3 */, strHelpKeyword);
126-
}
127-
128-
void UIMessageCenter::alert(QWidget *pParent, MessageType enmType,
129-
const QString &strMessage,
130-
const char *pcszAutoConfirmId /* = 0 */,
131-
const QString &strHelpKeyword /* = QString() */) const
132-
{
133-
error(pParent, enmType, strMessage, QString(), pcszAutoConfirmId, strHelpKeyword);
134-
}
135-
13678
void UIMessageCenter::sltShowHelpWebDialog()
13779
{
13880
uiCommon().openURL("https://www.virtualbox.org");
@@ -178,27 +120,6 @@ void UIMessageCenter::sltResetSuppressedMessages()
178120
gEDataManager->setSuppressedMessages(QStringList());
179121
}
180122

181-
void UIMessageCenter::sltShowMessageBox(QWidget *pParent,
182-
MessageType enmType,
183-
const QString &strMessage,
184-
const QString &strDetails,
185-
int iButton1,
186-
int iButton2,
187-
int iButton3,
188-
const QString &strButtonText1,
189-
const QString &strButtonText2,
190-
const QString &strButtonText3,
191-
const QString &strAutoConfirmId,
192-
const QString &strHelpKeyword) const
193-
{
194-
/* Now we can show a message-box directly: */
195-
showMessageBox(pParent, enmType,
196-
strMessage, strDetails,
197-
iButton1, iButton2, iButton3,
198-
strButtonText1, strButtonText2, strButtonText3,
199-
strAutoConfirmId, strHelpKeyword);
200-
}
201-
202123
UIMessageCenter::UIMessageCenter()
203124
{
204125
/* Assign instance: */
@@ -215,9 +136,6 @@ void UIMessageCenter::prepare()
215136
{
216137
/* Prepare interthread connection: */
217138
qRegisterMetaType<MessageType>();
218-
connect(this, &UIMessageCenter::sigToShowMessageBox,
219-
this, &UIMessageCenter::sltShowMessageBox,
220-
Qt::BlockingQueuedConnection);
221139

222140
/* Translations for Main.
223141
* Please make sure they corresponds to the strings coming from Main one-by-one symbol! */
@@ -232,119 +150,3 @@ void UIMessageCenter::prepare()
232150
tr("The USB Proxy Service has not yet been ported to this host");
233151
tr("Could not load the Host USB Proxy service");
234152
}
235-
236-
int UIMessageCenter::showMessageBox(QWidget *pParent,
237-
MessageType enmType,
238-
const QString &strMessage,
239-
const QString &strDetails,
240-
int iButton1,
241-
int iButton2,
242-
int iButton3,
243-
const QString &strButtonText1,
244-
const QString &strButtonText2,
245-
const QString &strButtonText3,
246-
const QString &strAutoConfirmId,
247-
const QString &strHelpKeyword) const
248-
{
249-
/* Choose the 'default' button: */
250-
if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
251-
iButton1 = AlertButton_Ok | AlertButtonOption_Default;
252-
253-
/* Check if message-box was auto-confirmed before: */
254-
QStringList confirmedMessageList;
255-
if (!strAutoConfirmId.isEmpty())
256-
{
257-
const QUuid uID = uiCommon().uiType() == UIType_RuntimeUI
258-
? uiCommon().managedVMUuid()
259-
: UIExtraDataManager::GlobalID;
260-
confirmedMessageList = gEDataManager->suppressedMessages(uID);
261-
if ( confirmedMessageList.contains(strAutoConfirmId)
262-
|| confirmedMessageList.contains("allMessageBoxes")
263-
|| confirmedMessageList.contains("all") )
264-
{
265-
int iResultCode = AlertOption_AutoConfirmed;
266-
if (iButton1 & AlertButtonOption_Default)
267-
iResultCode |= (iButton1 & AlertButtonMask);
268-
if (iButton2 & AlertButtonOption_Default)
269-
iResultCode |= (iButton2 & AlertButtonMask);
270-
if (iButton3 & AlertButtonOption_Default)
271-
iResultCode |= (iButton3 & AlertButtonMask);
272-
return iResultCode;
273-
}
274-
}
275-
276-
/* Choose title and icon: */
277-
QString title;
278-
AlertIconType icon;
279-
switch (enmType)
280-
{
281-
default:
282-
case MessageType_Question:
283-
title = tr("VirtualBox - Question", "msg box title");
284-
icon = AlertIconType_Question;
285-
break;
286-
case MessageType_Warning:
287-
title = tr("VirtualBox - Warning", "msg box title");
288-
icon = AlertIconType_Warning;
289-
break;
290-
case MessageType_Error:
291-
title = tr("VirtualBox - Error", "msg box title");
292-
icon = AlertIconType_Critical;
293-
break;
294-
case MessageType_Critical:
295-
title = tr("VirtualBox - Critical Error", "msg box title");
296-
icon = AlertIconType_Critical;
297-
break;
298-
}
299-
300-
/* Create message-box: */
301-
QWidget *pMessageBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
302-
const QString strHackValue = gEDataManager->extraDataString("GUI/Hack/MakeMessageBoxParentless");
303-
QPointer<QIMessageBox> pMessageBox = new QIMessageBox(title, strMessage, icon,
304-
iButton1, iButton2, iButton3,
305-
strHackValue == "true" ? 0 : pMessageBoxParent,
306-
strHelpKeyword);
307-
windowManager().registerNewParent(pMessageBox, pMessageBoxParent);
308-
309-
/* Prepare auto-confirmation check-box: */
310-
if (!strAutoConfirmId.isEmpty())
311-
{
312-
pMessageBox->setFlagText(tr("Do not show this message again", "msg box flag"));
313-
pMessageBox->setFlagChecked(false);
314-
}
315-
316-
/* Configure details: */
317-
if (!strDetails.isEmpty())
318-
pMessageBox->setDetailsText(strDetails);
319-
320-
/* Configure button-text: */
321-
if (!strButtonText1.isNull())
322-
pMessageBox->setButtonText(0, strButtonText1);
323-
if (!strButtonText2.isNull())
324-
pMessageBox->setButtonText(1, strButtonText2);
325-
if (!strButtonText3.isNull())
326-
pMessageBox->setButtonText(2, strButtonText3);
327-
328-
/* Show message-box: */
329-
int iResultCode = pMessageBox->exec();
330-
331-
/* Make sure message-box still valid: */
332-
if (!pMessageBox)
333-
return iResultCode;
334-
335-
/* Remember auto-confirmation check-box value: */
336-
if (!strAutoConfirmId.isEmpty())
337-
{
338-
if (pMessageBox->flagChecked())
339-
{
340-
confirmedMessageList << strAutoConfirmId;
341-
gEDataManager->setSuppressedMessages(confirmedMessageList);
342-
}
343-
}
344-
345-
/* Delete message-box: */
346-
delete pMessageBox;
347-
348-
/* Return result-code: */
349-
return iResultCode;
350-
}

src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

Lines changed: 1 addition & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: UIMessageCenter.h 113937 2026-04-17 09:26:37Z sergey.dubov@oracle.com $ */
1+
/* $Id: UIMessageCenter.h 113938 2026-04-17 09:37:43Z sergey.dubov@oracle.com $ */
22
/** @file
33
* VBox Qt GUI - UIMessageCenter class declaration.
44
*/
@@ -53,81 +53,13 @@ class SHARED_LIBRARY_STUFF UIMessageCenter : public QObject
5353
{
5454
Q_OBJECT;
5555

56-
signals:
57-
58-
/** Asks to show message-box.
59-
* @param pParent Brings the message-box parent.
60-
* @param enmType Brings the message-box type.
61-
* @param strMessage Brings the message.
62-
* @param strDetails Brings the details.
63-
* @param iButton1 Brings the button 1 type.
64-
* @param iButton2 Brings the button 2 type.
65-
* @param iButton3 Brings the button 3 type.
66-
* @param strButtonText1 Brings the button 1 text.
67-
* @param strButtonText2 Brings the button 2 text.
68-
* @param strButtonText3 Brings the button 3 text.
69-
* @param strAutoConfirmId Brings whether this message can be auto-confirmed. */
70-
void sigToShowMessageBox(QWidget *pParent, MessageType enmType,
71-
const QString &strMessage, const QString &strDetails,
72-
int iButton1, int iButton2, int iButton3,
73-
const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
74-
const QString &strAutoConfirmId, const QString &strHelpKeyword) const;
75-
7656
public:
7757

7858
/** Creates message-center singleton. */
7959
static void create();
8060
/** Destroys message-center singleton. */
8161
static void destroy();
8262

83-
/** Shows a general type of 'Message'.
84-
* @param pParent Brings the message-box parent.
85-
* @param enmType Brings the message-box type.
86-
* @param strMessage Brings the message.
87-
* @param strDetails Brings the details.
88-
* @param pcszAutoConfirmId Brings the auto-confirm ID.
89-
* @param iButton1 Brings the button 1 type.
90-
* @param iButton2 Brings the button 2 type.
91-
* @param iButton3 Brings the button 3 type.
92-
* @param strButtonText1 Brings the button 1 text.
93-
* @param strButtonText2 Brings the button 2 text.
94-
* @param strButtonText3 Brings the button 3 text.
95-
* @param strHelpKeyword Brings the help keyword string. */
96-
int message(QWidget *pParent, MessageType enmType,
97-
const QString &strMessage, const QString &strDetails,
98-
const char *pcszAutoConfirmId = 0,
99-
int iButton1 = 0, int iButton2 = 0, int iButton3 = 0,
100-
const QString &strButtonText1 = QString(),
101-
const QString &strButtonText2 = QString(),
102-
const QString &strButtonText3 = QString(),
103-
const QString &strHelpKeyword = QString()) const;
104-
105-
/** Shows an 'Error' type of 'Message'.
106-
* Provides single Ok button.
107-
* @param pParent Brings the message-box parent.
108-
* @param enmType Brings the message-box type.
109-
* @param strMessage Brings the message.
110-
* @param strDetails Brings the details.
111-
* @param pcszAutoConfirmId Brings the auto-confirm ID.
112-
* @param strHelpKeyword Brings the help keyword string. */
113-
void error(QWidget *pParent, MessageType enmType,
114-
const QString &strMessage,
115-
const QString &strDetails,
116-
const char *pcszAutoConfirmId = 0,
117-
const QString &strHelpKeyword = QString()) const;
118-
119-
/** Shows an 'Alert' type of 'Error'.
120-
* Omit details.
121-
* @param pParent Brings the message-box parent.
122-
* @param enmType Brings the message-box type.
123-
* @param strMessage Brings the message.
124-
* @param pcszAutoConfirmId Brings the auto-confirm ID.
125-
* @param strHelpKeyword Brings the help keyword string. */
126-
void alert(QWidget *pParent, MessageType enmType,
127-
const QString &strMessage,
128-
const char *pcszAutoConfirmId = 0,
129-
const QString &strHelpKeyword = QString()) const;
130-
13163
public slots:
13264

13365
/* Handlers: Help menu stuff: */
@@ -139,27 +71,6 @@ public slots:
13971
void sltShowHelpAboutDialog();
14072
void sltResetSuppressedMessages();
14173

142-
private slots:
143-
144-
/** Shows message-box.
145-
* @param pParent Brings the message-box parent.
146-
* @param enmType Brings the message-box type.
147-
* @param strMessage Brings the message.
148-
* @param strDetails Brings the details.
149-
* @param iButton1 Brings the button 1 type.
150-
* @param iButton2 Brings the button 2 type.
151-
* @param iButton3 Brings the button 3 type.
152-
* @param strButtonText1 Brings the button 1 text.
153-
* @param strButtonText2 Brings the button 2 text.
154-
* @param strButtonText3 Brings the button 3 text.
155-
* @param strAutoConfirmId Brings whether this message can be auto-confirmed.
156-
* @param strHelpKeyword Brings the help keyword string. */
157-
void sltShowMessageBox(QWidget *pParent, MessageType enmType,
158-
const QString &strMessage, const QString &strDetails,
159-
int iButton1, int iButton2, int iButton3,
160-
const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
161-
const QString &strAutoConfirmId, const QString &strHelpKeyword) const;
162-
16374
private:
16475

16576
/** Constructs message-center. */
@@ -170,25 +81,6 @@ private slots:
17081
/** Prepares all. */
17182
void prepare();
17283

173-
/** Shows message-box.
174-
* @param pParent Brings the message-box parent.
175-
* @param enmType Brings the message-box type.
176-
* @param strMessage Brings the message.
177-
* @param strDetails Brings the details.
178-
* @param iButton1 Brings the button 1 type.
179-
* @param iButton2 Brings the button 2 type.
180-
* @param iButton3 Brings the button 3 type.
181-
* @param strButtonText1 Brings the button 1 text.
182-
* @param strButtonText2 Brings the button 2 text.
183-
* @param strButtonText3 Brings the button 3 text.
184-
* @param strAutoConfirmId Brings whether this message can be auto-confirmed.
185-
* @param strHelpKeyword Brings the help keyowrd. */
186-
int showMessageBox(QWidget *pParent, MessageType type,
187-
const QString &strMessage, const QString &strDetails,
188-
int iButton1, int iButton2, int iButton3,
189-
const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
190-
const QString &strAutoConfirmId, const QString &strHelpKeyword) const;
191-
19284
/** Holds the singleton message-center instance. */
19385
static UIMessageCenter *s_pInstance;
19486
/** Returns the singleton message-center instance. */

src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: UIDnDHandler.cpp 113907 2026-04-16 14:33:46Z sergey.dubov@oracle.com $ */
1+
/* $Id: UIDnDHandler.cpp 113938 2026-04-17 09:37:43Z sergey.dubov@oracle.com $ */
22
/** @file
33
* VBox Qt GUI - UIDnDHandler class implementation.
44
*/
@@ -48,7 +48,6 @@
4848
#include "UIDnDMIMEData.h"
4949
#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
5050
#include "UIMachine.h"
51-
#include "UIMessageCenter.h"
5251
#include "UINotificationCenter.h"
5352
#include "UISession.h"
5453

0 commit comments

Comments
 (0)