VirtualBox

Changeset 1435 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 13, 2007 9:35:26 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
19468
Message:

1827: Lock down Qt GUI implemented.

These options are now supported as “GUI/Customizations” extra data features:
noMenuBar | the menu bar is not shown.
noStatusBar | the status bar is not shown.
noSelector | prevents VirtualBox from running in the Selector mode (Problem Reporter error MessageBox about running VirtualBox in “noSelector” mode).

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h

    r993 r1435  
    109109    void finalizeOpenView();
    110110
     111    void loadGuiCustomizations();
     112
    111113    void vmFullscreen (bool on);
    112114    void vmAutoresizeGuest (bool on);
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r1370 r1435  
    207207                                     const QString &hostKey);
    208208
     209    void cannotRunInSelectorMode();
     210
    209211    void showRuntimeError (const CConsole &console, bool fatal,
    210212                           const QString &errorID,
  • trunk/src/VBox/Frontends/VirtualBox/include/VMGlobalSettings.h

    r382 r1435  
    4343    int hostkey;
    4444    bool autoCapture;
     45    QString guiFeatures;
    4546
    4647    friend class VMGlobalSettings;
     
    5455    Q_PROPERTY (int hostKey READ hostKey WRITE setHostKey)
    5556    Q_PROPERTY (bool autoCapture READ autoCapture WRITE setAutoCapture)
     57    Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures)
    5658
    5759public:
     
    7678        resetError();
    7779    }
     80
     81    QString guiFeatures() const { return data()->guiFeatures; }
     82    void setGuiFeatures (const QString &aFeatures)
     83    {
     84        mData()->guiFeatures = aFeatures;
     85    }
     86    bool isFeatureActivated (const char*) const;
    7887
    7988    //
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r1285 r1435  
    562562                                   centralWidget(), "console");
    563563
     564    loadGuiCustomizations();
     565
    564566    ((QBoxLayout*) centralWidget()->layout())->addWidget (
    565567        console, 0, AlignVCenter | AlignHCenter);
     
    700702    LogFlowFuncLeave();
    701703    return true;
     704}
     705
     706void VBoxConsoleWnd::loadGuiCustomizations()
     707{
     708    VMGlobalSettings settings = vboxGlobal().settings();
     709    /* Searching for known keys */
     710    const char *noMenuBar = "noMenuBar";
     711    const char *noStatusBar = "noStatusBar";
     712    menuBar()->setHidden (settings.isFeatureActivated (noMenuBar));
     713    statusBar()->setHidden (settings.isFeatureActivated (noStatusBar));
    702714}
    703715
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r1370 r1435  
    13611361}
    13621362
     1363void VBoxProblemReporter::cannotRunInSelectorMode()
     1364{
     1365    message (mainWindowShown(), Critical,
     1366             tr ("<p>VirtualBox is running in forced <b>noSelector</b> "
     1367                 "mode.</p><p>Please run VirtualBox with -startvm parameter "
     1368                 "specifying required VM to start.</p>"
     1369                 "<p>The application will now terminate.</p>"));
     1370}
     1371
    13631372void VBoxProblemReporter::showRuntimeError (const CConsole &aConsole, bool fatal,
    13641373                                            const QString &errorID,
  • trunk/src/VBox/Frontends/VirtualBox/src/VMGlobalSettings.cpp

    r1285 r1435  
    5555#endif
    5656    autoCapture = true;
     57    guiFeatures = QString::null;
    5758}
    5859
     
    6061    hostkey = that.hostkey;
    6162    autoCapture = that.autoCapture;
     63    guiFeatures = that.guiFeatures;
    6264}
    6365
     
    7072    return this == &that || (
    7173        hostkey == that.hostkey &&
    72         autoCapture == that.autoCapture
     74        autoCapture == that.autoCapture &&
     75        guiFeatures == that.guiFeatures
    7376    );
    7477}
     
    9093    { "GUI/Input/HostKey",      "hostKey",      "\\d*[1-9]\\d*" },
    9194    { "GUI/Input/AutoCapture",  "autoCapture",  "true|false" },
     95    { "GUI/Customizations",     "guiFeatures",  "\\S+" },
    9296};
    9397
     
    103107    mData()->hostkey = key;
    104108    resetError();
     109}
     110
     111bool VMGlobalSettings::isFeatureActivated (const char *aFeature) const
     112{
     113    QStringList featureList = QStringList::split (',', data()->guiFeatures);
     114    return featureList.contains (aFeature);
    105115}
    106116
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r1343 r1435  
    2222
    2323#include "VBoxGlobal.h"
     24#include "VBoxProblemReporter.h"
    2425#include "VBoxSelectorWnd.h"
    2526#include "VBoxConsoleWnd.h"
     
    215216    if (vboxGlobal().isValid())
    216217    {
     218        VMGlobalSettings settings = vboxGlobal().settings();
     219        /* Searching for known keys */
     220        const char *noSelector = "noSelector";
     221        bool forcedConsole = settings.isFeatureActivated (noSelector);
     222
    217223        if (vboxGlobal().isVMConsoleProcess())
    218224        {
     
    220226            if (vboxGlobal().startMachine (vboxGlobal().managedVMUuid()))
    221227                rc = a.exec();
     228        }
     229        else if (forcedConsole)
     230        {
     231            vboxProblem().cannotRunInSelectorMode();
    222232        }
    223233        else
Note: See TracChangeset for help on using the changeset viewer.

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