Changeset 45247 in vbox
- Timestamp:
- Mar 29, 2013 9:37:50 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45246 r45247 2577 2577 void UIMessageCenter::cannotCreateHostInterface(const CHost &host, QWidget *pParent /* = 0 */) 2578 2578 { 2579 if (thread() == QThread::currentThread())2580 sltCannotCreateHostInterface(host, pParent);2581 else2582 emit sigCannotCreateHostInterface(host, pParent);2583 }2584 2585 void UIMessageCenter::cannotCreateHostInterface(const CProgress &progress, QWidget *pParent /* = 0 */)2586 {2587 if (thread() == QThread::currentThread())2588 sltCannotCreateHostInterface(progress, pParent);2589 else2590 emit sigCannotCreateHostInterface(progress, pParent);2591 }2592 2593 void UIMessageCenter::cannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface,2594 QWidget *pParent /* = 0 */)2595 {2596 if (thread() == QThread::currentThread())2597 sltCannotRemoveHostInterface(host, iface ,pParent);2598 else2599 emit sigCannotRemoveHostInterface(host, iface, pParent);2600 }2601 2602 void UIMessageCenter::cannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface,2603 QWidget *pParent /* = 0 */)2604 {2605 if (thread() == QThread::currentThread())2606 sltCannotRemoveHostInterface(progress, iface, pParent);2607 else2608 emit sigCannotRemoveHostInterface(progress, iface, pParent);2609 }2610 2611 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType type,2612 const QString &strLocation, const StorageSlot &storageSlot,2613 QWidget *pParent /* = 0 */)2614 {2615 if (thread() == QThread::currentThread())2616 sltCannotAttachDevice(machine, type, strLocation, storageSlot, pParent);2617 else2618 emit sigCannotAttachDevice(machine, type, strLocation, storageSlot, pParent);2619 }2620 2621 void UIMessageCenter::cannotCreateSharedFolder(const CMachine &machine, const QString &strName,2622 const QString &strPath, QWidget *pParent /* = 0 */)2623 {2624 if (thread() == QThread::currentThread())2625 sltCannotCreateSharedFolder(machine, strName, strPath, pParent);2626 else2627 emit sigCannotCreateSharedFolder(machine, strName, strPath, pParent);2628 }2629 2630 void UIMessageCenter::cannotRemoveSharedFolder(const CMachine &machine, const QString &strName,2631 const QString &strPath, QWidget *pParent /* = 0 */)2632 {2633 if (thread() == QThread::currentThread())2634 sltCannotRemoveSharedFolder(machine, strName, strPath, pParent);2635 else2636 emit sigCannotRemoveSharedFolder(machine, strName, strPath, pParent);2637 }2638 2639 void UIMessageCenter::cannotCreateSharedFolder(const CConsole &console, const QString &strName,2640 const QString &strPath, QWidget *pParent /* = 0 */)2641 {2642 if (thread() == QThread::currentThread())2643 sltCannotCreateSharedFolder(console, strName, strPath, pParent);2644 else2645 emit sigCannotCreateSharedFolder(console, strName, strPath, pParent);2646 }2647 2648 void UIMessageCenter::cannotRemoveSharedFolder(const CConsole &console, const QString &strName,2649 const QString &strPath, QWidget *pParent /* = 0 */)2650 {2651 if (thread() == QThread::currentThread())2652 sltCannotRemoveSharedFolder(console, strName, strPath, pParent);2653 else2654 emit sigCannotRemoveSharedFolder(console, strName, strPath, pParent);2655 }2656 2657 #ifdef VBOX_WITH_DRAG_AND_DROP2658 void UIMessageCenter::cannotDropData(const CGuest &guest,2659 QWidget *pParent /* = 0 */) const2660 {2661 message(pParent ? pParent : mainWindowShown(),2662 MessageType_Error,2663 tr("Failed to drop data."),2664 formatErrorInfo(guest));2665 }2666 2667 void UIMessageCenter::cannotDropData(const CProgress &progress,2668 QWidget *pParent /* = 0 */) const2669 {2670 AssertWrapperOk(progress);2671 2672 message(pParent ? pParent : mainWindowShown(),2673 MessageType_Error,2674 tr("Failed to drop data."),2675 formatErrorInfo(progress.GetErrorInfo()));2676 }2677 #endif /* VBOX_WITH_DRAG_AND_DROP */2678 2679 void UIMessageCenter::remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP)2680 {2681 emit sigRemindAboutWrongColorDepth(uRealBPP, uWantedBPP);2682 }2683 2684 void UIMessageCenter::remindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent)2685 {2686 emit sigRemindAboutUnsupportedUSB2(strExtPackName, pParent);2687 }2688 2689 void UIMessageCenter::sltShowHelpWebDialog()2690 {2691 vboxGlobal().openURL("http://www.virtualbox.org");2692 }2693 2694 void UIMessageCenter::sltShowHelpAboutDialog()2695 {2696 CVirtualBox vbox = vboxGlobal().virtualBox();2697 QString strFullVersion;2698 if (vboxGlobal().brandingIsActive())2699 {2700 strFullVersion = QString("%1 r%2 - %3").arg(vbox.GetVersion())2701 .arg(vbox.GetRevision())2702 .arg(vboxGlobal().brandingGetKey("Name"));2703 }2704 else2705 {2706 strFullVersion = QString("%1 r%2").arg(vbox.GetVersion())2707 .arg(vbox.GetRevision());2708 }2709 AssertWrapperOk(vbox);2710 2711 (new VBoxAboutDlg(mainWindowShown(), strFullVersion))->show();2712 }2713 2714 void UIMessageCenter::sltShowHelpHelpDialog()2715 {2716 #ifndef VBOX_OSE2717 /* For non-OSE version we just open it: */2718 sltShowUserManual(vboxGlobal().helpFile());2719 #else /* #ifndef VBOX_OSE */2720 /* For OSE version we have to check if it present first: */2721 QString strUserManualFileName1 = vboxGlobal().helpFile();2722 QString strShortFileName = QFileInfo(strUserManualFileName1).fileName();2723 QString strUserManualFileName2 = QDir(vboxGlobal().virtualBox().GetHomeFolder()).absoluteFilePath(strShortFileName);2724 /* Show if user manual already present: */2725 if (QFile::exists(strUserManualFileName1))2726 sltShowUserManual(strUserManualFileName1);2727 else if (QFile::exists(strUserManualFileName2))2728 sltShowUserManual(strUserManualFileName2);2729 /* If downloader is running already: */2730 else if (UIDownloaderUserManual::current())2731 {2732 /* Just show network access manager: */2733 gNetworkManager->show();2734 }2735 /* Else propose to download user manual: */2736 else if (askAboutUserManualDownload(strUserManualFileName1))2737 {2738 /* Create User Manual downloader: */2739 UIDownloaderUserManual *pDl = UIDownloaderUserManual::create();2740 /* After downloading finished => show User Manual: */2741 connect(pDl, SIGNAL(sigDownloadFinished(const QString&)), this, SLOT(sltShowUserManual(const QString&)));2742 /* Start downloading: */2743 pDl->start();2744 }2745 #endif /* #ifdef VBOX_OSE */2746 }2747 2748 void UIMessageCenter::sltResetSuppressedMessages()2749 {2750 CVirtualBox vbox = vboxGlobal().virtualBox();2751 vbox.SetExtraData(GUI_SuppressMessages, QString());2752 }2753 2754 void UIMessageCenter::sltShowUserManual(const QString &strLocation)2755 {2756 #if defined (Q_WS_WIN32)2757 HtmlHelp(GetDesktopWindow(), strLocation.utf16(), HH_DISPLAY_TOPIC, NULL);2758 #elif defined (Q_WS_X11)2759 # ifndef VBOX_OSE2760 char szViewerPath[RTPATH_MAX];2761 int rc;2762 rc = RTPathAppPrivateArch(szViewerPath, sizeof(szViewerPath));2763 AssertRC(rc);2764 QProcess::startDetached(QString(szViewerPath) + "/kchmviewer", QStringList(strLocation));2765 # else /* #ifndef VBOX_OSE */2766 vboxGlobal().openURL("file://" + strLocation);2767 # endif /* #ifdef VBOX_OSE */2768 #elif defined (Q_WS_MAC)2769 vboxGlobal().openURL("file://" + strLocation);2770 #endif2771 }2772 2773 void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType type,2774 const QString &strMessage, const QString &strDetails,2775 int iButton1, int iButton2, int iButton3,2776 const QString &strButton1, const QString &strButton2, const QString &strButton3,2777 const QString &strAutoConfirmId) const2778 {2779 /* Now we can show a message-box directly: */2780 showMessageBox(pParent, type,2781 strMessage, strDetails,2782 iButton1, iButton2, iButton3,2783 strButton1, strButton2, strButton3,2784 strAutoConfirmId);2785 }2786 2787 void UIMessageCenter::sltCannotCreateHostInterface(const CHost &host, QWidget *pParent)2788 {2789 2579 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 2790 2580 tr("Failed to create the host-only network interface."), … … 2792 2582 } 2793 2583 2794 void UIMessageCenter:: sltCannotCreateHostInterface(const CProgress &progress, QWidget *pParent)2584 void UIMessageCenter::cannotCreateHostInterface(const CProgress &progress, QWidget *pParent /* = 0 */) 2795 2585 { 2796 2586 message(pParent ? pParent : mainWindowShown(), MessageType_Error, … … 2799 2589 } 2800 2590 2801 void UIMessageCenter:: sltCannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent)2591 void UIMessageCenter::cannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent /* = 0 */) 2802 2592 { 2803 2593 message(pParent ? pParent : mainWindowShown(), MessageType_Error, … … 2807 2597 } 2808 2598 2809 void UIMessageCenter:: sltCannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent)2599 void UIMessageCenter::cannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent /* = 0 */) 2810 2600 { 2811 2601 message(pParent ? pParent : mainWindowShown(), MessageType_Error, … … 2815 2605 } 2816 2606 2817 void UIMessageCenter:: sltCannotAttachDevice(const CMachine &machine, UIMediumType type,2818 2819 QWidget *pParent)2607 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType type, 2608 const QString &strLocation, const StorageSlot &storageSlot, 2609 QWidget *pParent /* = 0 */) 2820 2610 { 2821 2611 QString strMessage; … … 2846 2636 } 2847 2637 2848 void UIMessageCenter:: sltCannotCreateSharedFolder(const CMachine &machine, const QString &strName,2849 const QString &strPath, QWidget *pParent)2638 void UIMessageCenter::cannotCreateSharedFolder(const CMachine &machine, const QString &strName, 2639 const QString &strPath, QWidget *pParent /* = 0 */) 2850 2640 { 2851 2641 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error, … … 2859 2649 } 2860 2650 2861 void UIMessageCenter:: sltCannotRemoveSharedFolder(const CMachine &machine, const QString &strName,2862 const QString &strPath, QWidget *pParent)2651 void UIMessageCenter::cannotRemoveSharedFolder(const CMachine &machine, const QString &strName, 2652 const QString &strPath, QWidget *pParent /* = 0 */) 2863 2653 { 2864 2654 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error, … … 2872 2662 } 2873 2663 2874 void UIMessageCenter:: sltCannotCreateSharedFolder(const CConsole &console, const QString &strName,2875 const QString &strPath, QWidget *pParent)2664 void UIMessageCenter::cannotCreateSharedFolder(const CConsole &console, const QString &strName, 2665 const QString &strPath, QWidget *pParent /* = 0 */) 2876 2666 { 2877 2667 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error, … … 2885 2675 } 2886 2676 2887 void UIMessageCenter:: sltCannotRemoveSharedFolder(const CConsole &console, const QString &strName,2888 const QString &strPath, QWidget *pParent)2677 void UIMessageCenter::cannotRemoveSharedFolder(const CConsole &console, const QString &strName, 2678 const QString &strPath, QWidget *pParent /* = 0 */) 2889 2679 { 2890 2680 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error, … … 2898 2688 .arg(CConsole(console).GetMachine().GetName()), 2899 2689 formatErrorInfo(console)); 2690 } 2691 2692 #ifdef VBOX_WITH_DRAG_AND_DROP 2693 void UIMessageCenter::cannotDropData(const CGuest &guest, 2694 QWidget *pParent /* = 0 */) const 2695 { 2696 message(pParent ? pParent : mainWindowShown(), 2697 MessageType_Error, 2698 tr("Failed to drop data."), 2699 formatErrorInfo(guest)); 2700 } 2701 2702 void UIMessageCenter::cannotDropData(const CProgress &progress, 2703 QWidget *pParent /* = 0 */) const 2704 { 2705 AssertWrapperOk(progress); 2706 2707 message(pParent ? pParent : mainWindowShown(), 2708 MessageType_Error, 2709 tr("Failed to drop data."), 2710 formatErrorInfo(progress.GetErrorInfo())); 2711 } 2712 #endif /* VBOX_WITH_DRAG_AND_DROP */ 2713 2714 void UIMessageCenter::remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP) 2715 { 2716 emit sigRemindAboutWrongColorDepth(uRealBPP, uWantedBPP); 2717 } 2718 2719 void UIMessageCenter::remindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent) 2720 { 2721 emit sigRemindAboutUnsupportedUSB2(strExtPackName, pParent); 2722 } 2723 2724 void UIMessageCenter::sltShowHelpWebDialog() 2725 { 2726 vboxGlobal().openURL("http://www.virtualbox.org"); 2727 } 2728 2729 void UIMessageCenter::sltShowHelpAboutDialog() 2730 { 2731 CVirtualBox vbox = vboxGlobal().virtualBox(); 2732 QString strFullVersion; 2733 if (vboxGlobal().brandingIsActive()) 2734 { 2735 strFullVersion = QString("%1 r%2 - %3").arg(vbox.GetVersion()) 2736 .arg(vbox.GetRevision()) 2737 .arg(vboxGlobal().brandingGetKey("Name")); 2738 } 2739 else 2740 { 2741 strFullVersion = QString("%1 r%2").arg(vbox.GetVersion()) 2742 .arg(vbox.GetRevision()); 2743 } 2744 AssertWrapperOk(vbox); 2745 2746 (new VBoxAboutDlg(mainWindowShown(), strFullVersion))->show(); 2747 } 2748 2749 void UIMessageCenter::sltShowHelpHelpDialog() 2750 { 2751 #ifndef VBOX_OSE 2752 /* For non-OSE version we just open it: */ 2753 sltShowUserManual(vboxGlobal().helpFile()); 2754 #else /* #ifndef VBOX_OSE */ 2755 /* For OSE version we have to check if it present first: */ 2756 QString strUserManualFileName1 = vboxGlobal().helpFile(); 2757 QString strShortFileName = QFileInfo(strUserManualFileName1).fileName(); 2758 QString strUserManualFileName2 = QDir(vboxGlobal().virtualBox().GetHomeFolder()).absoluteFilePath(strShortFileName); 2759 /* Show if user manual already present: */ 2760 if (QFile::exists(strUserManualFileName1)) 2761 sltShowUserManual(strUserManualFileName1); 2762 else if (QFile::exists(strUserManualFileName2)) 2763 sltShowUserManual(strUserManualFileName2); 2764 /* If downloader is running already: */ 2765 else if (UIDownloaderUserManual::current()) 2766 { 2767 /* Just show network access manager: */ 2768 gNetworkManager->show(); 2769 } 2770 /* Else propose to download user manual: */ 2771 else if (askAboutUserManualDownload(strUserManualFileName1)) 2772 { 2773 /* Create User Manual downloader: */ 2774 UIDownloaderUserManual *pDl = UIDownloaderUserManual::create(); 2775 /* After downloading finished => show User Manual: */ 2776 connect(pDl, SIGNAL(sigDownloadFinished(const QString&)), this, SLOT(sltShowUserManual(const QString&))); 2777 /* Start downloading: */ 2778 pDl->start(); 2779 } 2780 #endif /* #ifdef VBOX_OSE */ 2781 } 2782 2783 void UIMessageCenter::sltResetSuppressedMessages() 2784 { 2785 CVirtualBox vbox = vboxGlobal().virtualBox(); 2786 vbox.SetExtraData(GUI_SuppressMessages, QString()); 2787 } 2788 2789 void UIMessageCenter::sltShowUserManual(const QString &strLocation) 2790 { 2791 #if defined (Q_WS_WIN32) 2792 HtmlHelp(GetDesktopWindow(), strLocation.utf16(), HH_DISPLAY_TOPIC, NULL); 2793 #elif defined (Q_WS_X11) 2794 # ifndef VBOX_OSE 2795 char szViewerPath[RTPATH_MAX]; 2796 int rc; 2797 rc = RTPathAppPrivateArch(szViewerPath, sizeof(szViewerPath)); 2798 AssertRC(rc); 2799 QProcess::startDetached(QString(szViewerPath) + "/kchmviewer", QStringList(strLocation)); 2800 # else /* #ifndef VBOX_OSE */ 2801 vboxGlobal().openURL("file://" + strLocation); 2802 # endif /* #ifdef VBOX_OSE */ 2803 #elif defined (Q_WS_MAC) 2804 vboxGlobal().openURL("file://" + strLocation); 2805 #endif 2806 } 2807 2808 void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType type, 2809 const QString &strMessage, const QString &strDetails, 2810 int iButton1, int iButton2, int iButton3, 2811 const QString &strButton1, const QString &strButton2, const QString &strButton3, 2812 const QString &strAutoConfirmId) const 2813 { 2814 /* Now we can show a message-box directly: */ 2815 showMessageBox(pParent, type, 2816 strMessage, strDetails, 2817 iButton1, iButton2, iButton3, 2818 strButton1, strButton2, strButton3, 2819 strAutoConfirmId); 2900 2820 } 2901 2821 … … 2971 2891 Qt::BlockingQueuedConnection); 2972 2892 2973 /* Prepare required connections: */ 2974 connect(this, SIGNAL(sigCannotAttachDevice(const CMachine&, UIMediumType, const QString&, const StorageSlot&, QWidget*)), 2975 this, SLOT(sltCannotAttachDevice(const CMachine&, UIMediumType, const QString&, const StorageSlot&, QWidget*)), 2976 Qt::BlockingQueuedConnection); 2977 connect(this, SIGNAL(sigCannotCreateSharedFolder(const CMachine&, const QString&, const QString&, QWidget*)), 2978 this, SLOT(sltCannotCreateSharedFolder(const CMachine&, const QString&, const QString&, QWidget*)), 2979 Qt::BlockingQueuedConnection); 2980 connect(this, SIGNAL(sigCannotRemoveSharedFolder(const CMachine&, const QString&, const QString&, QWidget*)), 2981 this, SLOT(sltCannotRemoveSharedFolder(const CMachine&, const QString&, const QString&, QWidget*)), 2982 Qt::BlockingQueuedConnection); 2983 connect(this, SIGNAL(sigCannotCreateSharedFolder(const CConsole&, const QString&, const QString&, QWidget*)), 2984 this, SLOT(sltCannotCreateSharedFolder(const CConsole&, const QString&, const QString&, QWidget*)), 2985 Qt::BlockingQueuedConnection); 2986 connect(this, SIGNAL(sigCannotRemoveSharedFolder(const CConsole&, const QString&, const QString&, QWidget*)), 2987 this, SLOT(sltCannotRemoveSharedFolder(const CConsole&, const QString&, const QString&, QWidget*)), 2988 Qt::BlockingQueuedConnection); 2893 /* Prepare synchronization connection: */ 2989 2894 connect(this, SIGNAL(sigRemindAboutWrongColorDepth(ulong, ulong)), 2990 2895 this, SLOT(sltRemindAboutWrongColorDepth(ulong, ulong)), Qt::QueuedConnection); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45246 r45247 65 65 const QString &strAutoConfirmId) const; 66 66 67 /* Stuff supporting interthreading: */ 68 void sigCannotCreateHostInterface(const CHost &host, QWidget *pParent); 69 void sigCannotCreateHostInterface(const CProgress &progress, QWidget *pParent); 70 void sigCannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent); 71 void sigCannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent); 72 void sigCannotAttachDevice(const CMachine &machine, UIMediumType type, 73 const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent); 74 void sigCannotCreateSharedFolder(const CMachine &machine, const QString &strName, 75 const QString &strPath, QWidget *pParent); 76 void sigCannotRemoveSharedFolder(const CMachine &machine, const QString &strName, 77 const QString &strPath, QWidget *pParent); 78 void sigCannotCreateSharedFolder(const CConsole &console, const QString &strName, 79 const QString &strPath, QWidget *pParent); 80 void sigCannotRemoveSharedFolder(const CConsole &console, const QString &strName, 81 const QString &strPath, QWidget *pParent); 67 /* Notifiers: Synchronization stuff: */ 82 68 void sigRemindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP); 83 69 void sigRemindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent); … … 436 422 const QString &strAutoConfirmId) const; 437 423 438 /* Stuff supporting interthreading: */ 439 void sltCannotCreateHostInterface(const CHost &host, QWidget *pParent); 440 void sltCannotCreateHostInterface(const CProgress &progress, QWidget *pParent); 441 void sltCannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent); 442 void sltCannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent); 443 void sltCannotAttachDevice(const CMachine &machine, UIMediumType type, 444 const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent); 445 void sltCannotCreateSharedFolder(const CMachine &machine, const QString &strName, 446 const QString &strPath, QWidget *pParent); 447 void sltCannotRemoveSharedFolder(const CMachine &machine, const QString &strName, 448 const QString &strPath, QWidget *pParent); 449 void sltCannotCreateSharedFolder(const CConsole &console, const QString &strName, 450 const QString &strPath, QWidget *pParent); 451 void sltCannotRemoveSharedFolder(const CConsole &console, const QString &strName, 452 const QString &strPath, QWidget *pParent); 424 /* Handlers: Synchronization stuff: */ 453 425 void sltRemindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP); 454 426 void sltRemindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent);
Note:
See TracChangeset
for help on using the changeset viewer.