Changeset 27756 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 26, 2010 5:13:33 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r27743 r27756 3380 3380 QString VBoxGlobal::helpFile() const 3381 3381 { 3382 #if defined (Q_WS_WIN32) || defined (Q_WS_X11)3382 #if defined (Q_WS_WIN32) 3383 3383 const QString name = "VirtualBox"; 3384 3384 const QString suffix = "chm"; … … 3386 3386 const QString name = "UserManual"; 3387 3387 const QString suffix = "pdf"; 3388 #elif defined (Q_WS_X11) 3389 # if defined VBOX_OSE 3390 const QString name = "UserManual"; 3391 const QString suffix = "pdf"; 3392 # else 3393 const QString name = "VirtualBox"; 3394 const QString suffix = "chm"; 3395 # endif 3388 3396 #endif 3389 3397 /* Where are the docs located? */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
r27732 r27756 2566 2566 /* For non-OSE version we just open it: */ 2567 2567 sltShowUserManual(vboxGlobal().helpFile()); 2568 #else /* # endif for #ifndef VBOX_OSE */2568 #else /* #ifndef VBOX_OSE */ 2569 2569 /* For OSE version we have to check if it present first: */ 2570 2570 QString strUserManualFileName1 = vboxGlobal().helpFile(); … … 2581 2581 else if (!UIDownloaderUserManual::current() && askAboutUserManualDownload(strUserManualFileName1)) 2582 2582 { 2583 /* Initialize variables: */2584 CVirtualBox vbox = vboxGlobal().virtualBox();2585 // TODO: QString source = QString("http://download.virtualbox.org/virtualbox/%1/").arg(vbox.GetVersion().remove("_OSE")) + strName;2586 QString source = QString("http://download.virtualbox.org/virtualbox/") + strShortFileName;2587 2588 2583 /* Create User Manual downloader: */ 2589 2584 UIDownloaderUserManual *pDl = UIDownloaderUserManual::create(); 2590 2585 /* Configure User Manual downloader: */ 2591 pDl->setSource(source); 2586 CVirtualBox vbox = vboxGlobal().virtualBox(); 2587 pDl->addSource(QString("http://download.virtualbox.org/virtualbox/%1/").arg(vbox.GetVersion().remove("_OSE")) + strShortFileName); 2588 pDl->addSource(QString("http://download.virtualbox.org/virtualbox/") + strShortFileName); 2592 2589 pDl->setTarget(strUserManualFileName2); 2593 2590 pDl->setParentWidget(mainWindowShown()); 2594 2591 /* After the download is finished => show the document: */ 2595 connect(pDl, SIGNAL( downloadFinished(const QString&)), this, SLOT(sltShowUserManual(const QString&)));2592 connect(pDl, SIGNAL(sigDownloadFinished(const QString&)), this, SLOT(sltShowUserManual(const QString&))); 2596 2593 /* Notify listeners: */ 2597 2594 emit sigDownloaderUserManualCreated(); … … 2599 2596 pDl->startDownload(); 2600 2597 } 2601 #endif /* # endif for #ifdef VBOX_OSE */2598 #endif /* #ifdef VBOX_OSE */ 2602 2599 } 2603 2600 … … 2611 2608 { 2612 2609 #if defined (Q_WS_WIN32) 2613 HtmlHelp 2610 HtmlHelp(GetDesktopWindow(), strLocation.utf16(), HH_DISPLAY_TOPIC, NULL); 2614 2611 #elif defined (Q_WS_X11) 2612 # ifndef VBOX_OSE 2615 2613 char szViewerPath[RTPATH_MAX]; 2616 2614 int rc; … … 2618 2616 AssertRC(rc); 2619 2617 QProcess::startDetached(QString(szViewerPath) + "/kchmviewer", QStringList(strLocation)); 2618 # else /* #ifndef VBOX_OSE */ 2619 /* In OSE case we do NOT know which of PDF viewers are installed, 2620 * so we will just try few of them: */ 2621 QStringList viewers; 2622 viewers << "evince" << "okular"; 2623 foreach (const QString &viewer, viewers) 2624 if (QProcess::startDetached(viewer, QStringList(strLocation))) 2625 break; 2626 # endif /* #ifdef VBOX_OSE */ 2620 2627 #elif defined (Q_WS_MAC) 2621 vboxGlobal().openURL 2628 vboxGlobal().openURL("file://" + strLocation); 2622 2629 #endif 2623 2630 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIDownloaderUserManual.cpp
r27695 r27756 54 54 } 55 55 56 void UIDownloaderUserManual::setSource(const QString &strSource) 57 { 58 /* Erase the list first: */ 59 m_sourcesList.clear(); 60 /* And add there passed value: */ 61 addSource(strSource); 62 } 63 64 void UIDownloaderUserManual::addSource(const QString &strSource) 65 { 66 /* Append passed value: */ 67 m_sourcesList << strSource; 68 } 69 56 70 void UIDownloaderUserManual::setParentWidget(QWidget *pParent) 57 71 { … … 66 80 UIMiniProcessWidgetUserManual* UIDownloaderUserManual::processWidget(QWidget *pParent /* = 0 */) const 67 81 { 68 UIMiniProcessWidgetUserManual *pWidget = new UIMiniProcessWidgetUserManual( m_source.toString(),pParent);82 UIMiniProcessWidgetUserManual *pWidget = new UIMiniProcessWidgetUserManual(pParent); 69 83 70 84 /* Connect the cancel signal: */ 71 85 connect(pWidget, SIGNAL(sigCancel()), this, SLOT(cancelDownloading())); 86 /* Connect the signal to notify about source changed: */ 87 connect(this, SIGNAL(sigSourceChanged(const QString&)), pWidget, SLOT(sltSetSource(const QString&))); 72 88 /* Connect the signal to notify about the download process: */ 73 89 connect(this, SIGNAL(sigDownloadProcess(int, int)), pWidget, SLOT(sltProcess(int, int))); … … 80 96 void UIDownloaderUserManual::startDownload() 81 97 { 82 acknowledgeStart(); 98 /* If at least one source to try left: */ 99 if (!m_sourcesList.isEmpty()) 100 { 101 /* Set the first of left sources as current one: */ 102 UIDownloader::setSource(m_sourcesList.takeFirst()); 103 /* Warn process-bar(s) about source was changed: */ 104 emit sigSourceChanged(source()); 105 /* Try to download: */ 106 acknowledgeStart(); 107 } 108 } 109 110 void UIDownloaderUserManual::acknowledgeFinished(bool fError) 111 { 112 /* If current source was wrong but other is present 113 * we will try other source else we should finish: */ 114 if (fError && !m_sourcesList.isEmpty()) 115 startDownload(); 116 else 117 UIDownloader::acknowledgeFinished(fError); 83 118 } 84 119 … … 105 140 vboxProblem().warnAboutUserManualDownloaded(m_source.toString(), QDir::toNativeSeparators(m_strTarget)); 106 141 /* Warn listener about User Manual was downloaded: */ 107 emit downloadFinished(m_strTarget);142 emit sigDownloadFinished(m_strTarget); 108 143 /* Close the downloader: */ 109 144 QTimer::singleShot(0, this, SLOT(suicide())); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIDownloaderUserManual.h
r27695 r27756 37 37 public: 38 38 39 UIMiniProcessWidgetUserManual( const QString &strSource,QWidget *pParent = 0)39 UIMiniProcessWidgetUserManual(QWidget *pParent = 0) 40 40 : QIWithRetranslateUI<UIMiniProcessWidget>(pParent) 41 { 42 retranslateUi(); 43 } 44 45 protected slots: 46 47 void sltSetSource(const QString &strSource) 41 48 { 42 49 setSource(strSource); … … 50 57 setCancelButtonText(tr("Cancel")); 51 58 setCancelButtonToolTip(tr("Cancel the VirtualBox User Manual download")); 52 setProgressBarToolTip((tr("Downloading the VirtualBox User Manual "53 "<nobr><b>%1</b>...</nobr>")54 .arg(source())));59 QString strProgressBarTip = source().isEmpty() ? tr("Downloading the VirtualBox User Manual") : 60 tr("Downloading the VirtualBox User Manual <nobr><b>%1</b>...</nobr>").arg(source()); 61 setProgressBarToolTip(strProgressBarTip); 55 62 } 56 63 }; … … 66 73 static void destroy(); 67 74 75 void setSource(const QString &strSource); 76 void addSource(const QString &strSource); 77 68 78 void setParentWidget(QWidget *pParent); 69 79 QWidget *parentWidget() const; … … 74 84 signals: 75 85 76 void downloadFinished(const QString &strFile); 86 void sigSourceChanged(const QString &strSource); 87 void sigDownloadFinished(const QString &strFile); 77 88 78 89 private slots: 79 90 91 void acknowledgeFinished(bool fError); 80 92 void downloadFinished(bool fError); 81 93 void suicide(); … … 94 106 * QPointer guarantees that the ptr itself is zero in that case. */ 95 107 QPointer<QWidget> m_pParent; 108 109 /* List of sources to try to download from: */ 110 QList<QString> m_sourcesList; 96 111 }; 97 112
Note:
See TracChangeset
for help on using the changeset viewer.