VirtualBox

Changeset 76739 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 9, 2019 1:49:29 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9080: Some cleanup

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r76737 r76739  
    26402640}
    26412641
    2642 QUuid VBoxGlobal::createVisoMediumWithFileOpenDialog(QWidget *pParent, const QString &strFolder)
    2643 {
    2644     AssertReturn(!strFolder.isEmpty(), QString());
    2645 
    2646     /* Figure out where to start browsing for content. */
    2647     QString strDirectory = gEDataManager->recentFolderForVISOContent();
    2648     if (strDirectory.isEmpty())
    2649         strDirectory = QDir::homePath();
    2650     if (strDirectory.isEmpty())
    2651         strDirectory = homeFolder();
    2652 
    2653     /* Execute the open file dialog, getting a list of files & dirs back. */
    2654     /** @todo make it possible to select directories... */
    2655     QStringList files = QIFileDialog::getOpenFileNames(strDirectory, tr("All files (*)"), pParent,
    2656                                                        /// @todo tr("Please select files and directories to be on the VISO"),
    2657                                                        tr("Please select files to be on the VISO"),
    2658                                                        0, true /* resolve symlinks? */, false /* single file? */);
    2659 
    2660     /* Return if no result. */
    2661     if (files.empty() || files[0].isEmpty())
    2662         return QUuid();
    2663 
    2664     /* Remember folder for the next time. */
    2665     gEDataManager->setRecentFolderForVISOContent(QFileInfo(files[0]).absolutePath());
    2666 
    2667     /* Produce the VISO. */
    2668     char szVisoPath[RTPATH_MAX];
    2669     int vrc = RTPathJoin(szVisoPath, sizeof(szVisoPath), strFolder.toUtf8().constData(), "ad-hoc.viso");
    2670     if (RT_SUCCESS(vrc))
    2671     {
    2672         PRTSTREAM pStrmViso;
    2673         vrc = RTStrmOpen(szVisoPath, "w", &pStrmViso);
    2674         if (RT_SUCCESS(vrc))
    2675         {
    2676             RTUUID Uuid;
    2677             vrc = RTUuidCreate(&Uuid);
    2678             if (RT_SUCCESS(vrc))
    2679             {
    2680                 RTStrmPrintf(pStrmViso, "--iprt-iso-maker-file-marker-bourne-sh %RTuuid\n", &Uuid);
    2681 
    2682                 for (int iFile = 0; iFile < files.size(); iFile++)
    2683                 {
    2684                     QByteArray const utf8Name = files[iFile].toUtf8();
    2685                     const char *apszArgv[2] = { utf8Name.constData(), NULL };
    2686                     char *pszQuoted;
    2687                     vrc = RTGetOptArgvToString(&pszQuoted, apszArgv, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH);
    2688                     if (RT_SUCCESS(vrc))
    2689                     {
    2690                         RTStrmPrintf(pStrmViso, "%s\n", pszQuoted);
    2691                         RTStrFree(pszQuoted);
    2692                     }
    2693                     else
    2694                         break;
    2695                 }
    2696 
    2697                 RTStrmFlush(pStrmViso);
    2698                 if (RT_SUCCESS(vrc))
    2699                     vrc = RTStrmError(pStrmViso);
    2700             }
    2701 
    2702             RTStrmClose(pStrmViso);
    2703         }
    2704     }
    2705 
    2706     /* Done. */
    2707     if (RT_SUCCESS(vrc))
    2708         return openMedium(UIMediumDeviceType_DVD, QString(szVisoPath), pParent);
    2709 
    2710     /** @todo error message. */
    2711     return QUuid();
    2712 }
    2713 
    27142642QUuid VBoxGlobal::createVisoMediumWithVisoCreator(QWidget *pParent, const QString &strFolder)
    27152643{
     
    27752703            delete pVisoCreator;
    27762704            return openMedium(UIMediumDeviceType_DVD, QString(szVisoPath), pParent);
     2705        }
     2706        /** @todo error message. */
     2707        else
     2708        {
     2709            delete pVisoCreator;
     2710            return QUuid();
    27772711        }
    27782712    }
     
    30292963                    uMediumID = openMediumWithFileOpenDialog(target.mediumType, windowManager().mainWindowShown(), strMachineFolder);
    30302964                else if(target.type == UIMediumTarget::UIMediumTargetType_CreateAdHocVISO)
    3031                 {
    3032                     //uMediumID = createVisoMediumWithFileOpenDialog(windowManager().mainWindowShown(), strMachineFolder);
    30332965                    uMediumID = createVisoMediumWithVisoCreator(windowManager().mainWindowShown(), strMachineFolder);
    3034                 }
     2966
    30352967                else if(target.type == UIMediumTarget::UIMediumTargetType_CreateFloppyDisk)
    30362968                    uMediumID = showCreateFloppyDiskDialog(windowManager().mainWindowShown(), comConstMachine.GetName(), strMachineFolder);
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r76671 r76739  
    514514                                             const QString &strDefaultFolder = QString(), bool fUseLastFolder = true);
    515515
    516         /** Creates a VISO using the file-open dialog.
    517           * @param  pParent    Brings the dialog parent.
    518           * @param  strFolder  Brings the folder to browse for VISO file contents. */
    519         QUuid createVisoMediumWithFileOpenDialog(QWidget *pParent, const QString &strFolder);
    520 
    521516        /** Creates a VISO by using the VISO creator dialog.
    522517          * @param  pParent    Brings the dialog parent.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette