summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2021-09-10 19:18:04 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2021-09-10 19:18:04 +0000
commite9f46655d0ab64e0036c8ecf332d03089c37ca78 (patch)
tree67c76906e4995c65b674c8f85cecaff1f990cff1 /src
parent49e8ff0c0d4bd08d31b60d0705cea8252cc9fc21 (diff)
downloadVirtualBox-svn-e9f46655d0ab64e0036c8ecf332d03089c37ca78.tar.gz
FE/Qt: bugref:10067: Moving License Viewer messages from UIMessageCenter to UINotificationCenter; A bit of refactoring for UIMessageCenter DnD stuff as well.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@91216 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src')
-rw-r--r--src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp3
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp1
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp74
-rw-r--r--src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h20
-rw-r--r--src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp9
-rw-r--r--src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h4
6 files changed, 53 insertions, 58 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
index 97316373e0d..2891b94319f 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
@@ -26,6 +26,7 @@
#include "QIDialogButtonBox.h"
#include "VBoxLicenseViewer.h"
#include "UIMessageCenter.h"
+#include "UINotificationCenter.h"
VBoxLicenseViewer::VBoxLicenseViewer(QWidget *pParent /* = 0 */)
@@ -110,7 +111,7 @@ int VBoxLicenseViewer::showLicenseFromFile(const QString &strLicenseFileName)
return showLicenseFromString(file.readAll());
else
{
- msgCenter().cannotOpenLicenseFile(strLicenseFileName, this);
+ UINotificationMessage::cannotOpenLicenseFile(strLicenseFileName);
return QDialog::Rejected;
}
}
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
index 16592b17be8..0933813fce3 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
@@ -68,7 +68,6 @@
#include "UIVirtualBoxEventHandler.h"
#include "UIVisoCreator.h"
#include "UIWizardNewVD.h"
-#include "VBoxLicenseViewer.h"
#ifdef VBOX_WS_MAC
# include "UIMachineWindowFullscreen.h"
# include "UIMachineWindowSeamless.h"
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
index f9a0bf57c49..d26df211b76 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
@@ -2008,6 +2008,36 @@ void UIMessageCenter::cannotSwitchScreenInSeamless(quint64 uMinVRAM) const
.arg(UITranslator::formatSize(uMinVRAM)));
}
+#ifdef VBOX_WITH_DRAG_AND_DROP
+void UIMessageCenter::cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
+{
+ error(pParent, MessageType_Error,
+ tr("Drag and drop operation from host to guest failed."),
+ UIErrorString::formatErrorInfo(dndTarget));
+}
+
+void UIMessageCenter::cannotDropDataToGuest(const CProgress &progress, QWidget *pParent /* = 0 */) const
+{
+ error(pParent, MessageType_Error,
+ tr("Drag and drop operation from host to guest failed."),
+ UIErrorString::formatErrorInfo(progress));
+}
+
+void UIMessageCenter::cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent /* = 0 */) const
+{
+ error(pParent, MessageType_Error,
+ tr("Drag and drop operation from guest to host failed."),
+ UIErrorString::formatErrorInfo(dndSource));
+}
+
+void UIMessageCenter::cannotDropDataToHost(const CProgress &progress, QWidget *pParent /* = 0 */) const
+{
+ error(pParent, MessageType_Error,
+ tr("Drag and drop operation from guest to host failed."),
+ UIErrorString::formatErrorInfo(progress));
+}
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+
bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Warning,
@@ -2279,50 +2309,6 @@ void UIMessageCenter::cannotRunUnattendedGuestInstall(const CUnattended &comUnat
UIErrorString::formatErrorInfo(comErrorInfo));
}
-#ifdef VBOX_WITH_DRAG_AND_DROP
-void UIMessageCenter::cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
-{
- error(pParent, MessageType_Error,
- tr("Drag and drop operation from host to guest failed."),
- UIErrorString::formatErrorInfo(dndTarget));
-}
-
-void UIMessageCenter::cannotDropDataToGuest(const CProgress &progress, QWidget *pParent /* = 0 */) const
-{
- error(pParent, MessageType_Error,
- tr("Drag and drop operation from host to guest failed."),
- UIErrorString::formatErrorInfo(progress));
-}
-
-void UIMessageCenter::cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
-{
- error(pParent, MessageType_Error,
- tr("Unable to cancel host to guest drag and drop operation."),
- UIErrorString::formatErrorInfo(dndTarget));
-}
-
-void UIMessageCenter::cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent /* = 0 */) const
-{
- error(pParent, MessageType_Error,
- tr("Drag and drop operation from guest to host failed."),
- UIErrorString::formatErrorInfo(dndSource));
-}
-
-void UIMessageCenter::cannotDropDataToHost(const CProgress &progress, QWidget *pParent /* = 0 */) const
-{
- error(pParent, MessageType_Error,
- tr("Drag and drop operation from guest to host failed."),
- UIErrorString::formatErrorInfo(progress));
-}
-#endif /* VBOX_WITH_DRAG_AND_DROP */
-
-void UIMessageCenter::cannotOpenLicenseFile(const QString &strPath, QWidget *pParent /* = 0*/) const
-{
- alert(pParent, MessageType_Error,
- tr("Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.")
- .arg(strPath));
-}
-
bool UIMessageCenter::confirmOverridingFile(const QString &strPath, QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Question,
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h b/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
index 4efbd7382a0..20220041c46 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
@@ -453,6 +453,14 @@ public:
void cannotEnterSeamlessMode(ULONG uWidth, ULONG uHeight, ULONG uBpp, ULONG64 uMinVRAM) const;
bool cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const;
void cannotSwitchScreenInSeamless(quint64 uMinVRAM) const;
+
+#ifdef VBOX_WITH_DRAG_AND_DROP
+ /// @todo move to notification-center as progress notification .. one day :)
+ void cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const;
+ void cannotDropDataToGuest(const CProgress &progress, QWidget *pParent = 0) const;
+ void cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent = 0) const;
+ void cannotDropDataToHost(const CProgress &progress, QWidget *pParent = 0) const;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
/** @} */
/* API: Wizards warnings: */
@@ -489,18 +497,6 @@ public:
bool cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent = 0);
void cannotRunUnattendedGuestInstall(const CUnattended &comUnattendedInstall, QWidget *pParent = 0);
-#ifdef VBOX_WITH_DRAG_AND_DROP
- /* API: Drag and drop warnings: */
- void cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const;
- void cannotDropDataToGuest(const CProgress &progress, QWidget *pParent = 0) const;
- void cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const;
- void cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent = 0) const;
- void cannotDropDataToHost(const CProgress &progress, QWidget *pParent = 0) const;
-#endif /* VBOX_WITH_DRAG_AND_DROP */
-
- /* API: License-viewer warnings: */
- void cannotOpenLicenseFile(const QString &strPath, QWidget *pParent = 0) const;
-
/* API: File-dialog warnings: */
bool confirmOverridingFile(const QString &strPath, QWidget *pParent = 0) const;
bool confirmOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent = 0) const;
diff --git a/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp b/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
index f741290e2a5..b7f81dfa531 100644
--- a/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
@@ -212,6 +212,15 @@ void UINotificationMessage::cannotAcquireCloudMachineSettings(const QString &str
}
/* static */
+void UINotificationMessage::cannotOpenLicenseFile(const QString &strPath)
+{
+ createMessage(
+ QApplication::translate("UIMessageCenter", "Can't open license file ..."),
+ QApplication::translate("UIMessageCenter", "Failed to open the license file <nobr><b>%1</b></nobr>. Check file "
+ "permissions.").arg(strPath));
+}
+
+/* static */
void UINotificationMessage::warnAboutPublicKeyFilePathIsEmpty()
{
createMessage(
diff --git a/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h b/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
index 33cbe30e4d5..125aa380d02 100644
--- a/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
+++ b/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
@@ -128,6 +128,10 @@ public:
* @param strErrorDetails Brings the error details. */
static void cannotAcquireCloudMachineSettings(const QString &strErrorDetails);
+ /** Notifies about inability to open license file.
+ * @param strPath Brings the license file path. */
+ static void cannotOpenLicenseFile(const QString &strPath);
+
/** Notifies about public key path is empty. */
static void warnAboutPublicKeyFilePathIsEmpty();
/** Notifies about public key file doesn't exist.