VirtualBox

Changeset 72347 in vbox


Ignore:
Timestamp:
May 25, 2018 4:38:31 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Do not just hang around or return late Main error about missed VM name/id for Runtime UI since we know that prematurely; show message-box with proper usage instead.

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

Legend:

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

    r71644 r72347  
    400400          tr("<p>Cannot start the VirtualBox Manager due to local restrictions.</p>"
    401401             "<p>The application will now terminate.</p>"));
     402}
     403
     404void UIMessageCenter::cannotStartRuntime() const
     405{
     406    /* Prepare error string: */
     407    const QString strError = tr("<p>You must specify a machine to start, using the command line.</p><p>%1</p>",
     408                                "There will be a usage text passed as argument.");
     409
     410    /* Prepare Usage, it can change in future: */
     411    const QString strTable = QString("<table cellspacing=0 style='white-space:pre'>%1</table>");
     412    const QString strUsage = tr("<tr>"
     413                                "<td>Usage: VirtualBoxVM --startvm &lt;name|UUID&gt;</td>"
     414                                "</tr>"
     415                                "<tr>"
     416                                "<td>Starts the VirtualBox virtual machine with the given "
     417                                "name or unique identifier (UUID).</td>"
     418                                "</tr>");
     419
     420    /* Show error: */
     421    alert(0, MessageType_Error, strError.arg(strTable.arg(strUsage)));
    402422}
    403423
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r71644 r72347  
    235235#endif /* RT_OS_LINUX */
    236236    void cannotStartSelector() const;
     237    void cannotStartRuntime() const;
    237238    void showBetaBuildWarning() const;
    238239    void showExperimentalBuildWarning() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIStarter.cpp

    r72189 r72347  
    152152            return QApplication::quit();
    153153    }
     154# if defined(VBOX_GUI_WITH_SHARED_LIBRARY) && defined(VBOX_RUNTIME_UI)
     155    else
     156    {
     157        /* Show the error message otherwise: */
     158        msgCenter().cannotStartRuntime();
     159        return QApplication::quit();
     160    }
     161# endif /* VBOX_GUI_WITH_SHARED_LIBRARY && VBOX_RUNTIME_UI */
    154162#endif /* !VBOX_GUI_WITH_SHARED_LIBRARY || VBOX_RUNTIME_UI */
    155163}
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