VirtualBox

Changeset 37544 in vbox


Ignore:
Timestamp:
Jun 17, 2011 1:54:47 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: 4029: Allow to set http proxy information, initial commit.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
10 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r37494 r37544  
    312312        src/settings/global/UIGlobalSettingsNetworkDetails.h \
    313313        src/settings/global/UIGlobalSettingsExtension.h \
     314        src/settings/global/UIGlobalSettingsProxy.h \
    314315        src/settings/machine/UIMachineSettingsGeneral.h \
    315316        src/settings/machine/UIMachineSettingsSystem.h \
     
    479480        src/settings/global/UIGlobalSettingsNetworkDetails.cpp \
    480481        src/settings/global/UIGlobalSettingsExtension.cpp \
     482        src/settings/global/UIGlobalSettingsProxy.cpp \
    481483        src/settings/machine/UIMachineSettingsGeneral.cpp \
    482484        src/settings/machine/UIMachineSettingsSystem.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r37468 r37544  
    77
    88#
    9 # Copyright (C) 2006-2010 Oracle Corporation
     9# Copyright (C) 2006-2011 Oracle Corporation
    1010#
    1111# This file is part of VirtualBox Open Source Edition (OSE), as
     
    3636    src/settings/global/UIGlobalSettingsNetworkDetails.ui \
    3737    src/settings/global/UIGlobalSettingsExtension.ui \
     38    src/settings/global/UIGlobalSettingsProxy.ui \
    3839    src/settings/machine/UIMachineSettingsGeneral.ui \
    3940    src/settings/machine/UIMachineSettingsSystem.ui \
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.cpp

    r35880 r37544  
    5454    maxGuestRes = "auto";
    5555    remapScancodes = QString::null;
     56    proxySettings = QString::null;
    5657    trayIconEnabled = false;
    5758    presentationModeEnabled = false;
     
    6768    maxGuestRes = that.maxGuestRes;
    6869    remapScancodes = that.remapScancodes;
     70    proxySettings = that.proxySettings;
    6971    trayIconEnabled = that.trayIconEnabled;
    7072    presentationModeEnabled = that.presentationModeEnabled;
     
    8587         maxGuestRes == that.maxGuestRes &&
    8688         remapScancodes == that.remapScancodes &&
     89         proxySettings == that.proxySettings &&
    8790         trayIconEnabled == that.trayIconEnabled &&
    8891         presentationModeEnabled == that.presentationModeEnabled &&
     
    115118    { "GUI/MaxGuestResolution",                    "maxGuestRes",             "\\d*[1-9]\\d*,\\d*[1-9]\\d*|any|auto", true },
    116119    { "GUI/RemapScancodes",                        "remapScancodes",          "(\\d+=\\d+,)*\\d+=\\d+", true },
     120    { "GUI/ProxySettings",                         "proxySettings",           "[\\s\\S]*", true },
    117121    { "GUI/TrayIcon/Enabled",                      "trayIconEnabled",         "true|false", true },
    118122#ifdef Q_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h

    r35730 r37544  
    4444    QString maxGuestRes;
    4545    QString remapScancodes;
     46    QString proxySettings;
    4647    bool trayIconEnabled;
    4748    bool presentationModeEnabled;
     
    6263    Q_PROPERTY (QString maxGuestRes READ maxGuestRes WRITE setMaxGuestRes)
    6364    Q_PROPERTY (QString remapScancodes READ remapScancodes WRITE setRemapScancodes)
     65    Q_PROPERTY (QString proxySettings READ proxySettings WRITE setProxySettings)
    6466    Q_PROPERTY (bool trayIconEnabled READ trayIconEnabled WRITE setTrayIconEnabled)
    6567    Q_PROPERTY (bool presentationModeEnabled READ presentationModeEnabled WRITE setPresentationModeEnabled)
     
    114116    }
    115117
     118    QString proxySettings() const { return data()->proxySettings; }
     119    void setProxySettings (const QString &aProxySettings)
     120    {
     121        mData()->proxySettings = aProxySettings;
     122    }
    116123
    117124    bool trayIconEnabled() const { return data()->trayIconEnabled; }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxUpdateDlg.cpp

    r30192 r37544  
    66
    77/*
    8  * Copyright (C) 2006-2010 Oracle Corporation
     8 * Copyright (C) 2006-2011 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2828#include "VBoxUpdateDlg.h"
    2929#include "UIIconPool.h"
     30#include "VBoxUtils.h"
    3031#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3132
     
    244245    , mSelf (aSelf)
    245246    , mUrl ("http://update.virtualbox.org/query.php")
    246     , mHttp (new QIHttp (this, mUrl.host()))
     247    , mHttp (new QIHttp (this))
    247248    , mForceRun (aForceRun)
    248249{
     
    256257    setWindowIcon(UIIconPool::iconSetFull(QSize (32, 32), QSize (16, 16),
    257258                                          ":/refresh_32px.png", ":/refresh_16px.png"));
     259
     260    /* Setup HTTP proxy: */
     261    UIProxyManager proxyManager(vboxGlobal().settings().proxySettings());
     262    if (proxyManager.proxyEnabled())
     263    {
     264        mHttp->setProxy(proxyManager.proxyHost(), proxyManager.proxyPort().toInt(),
     265                        proxyManager.authEnabled() ? proxyManager.authLogin() : QString(),
     266                        proxyManager.authEnabled() ? proxyManager.authPassword() : QString());
     267    }
     268    /* Set HTTP host: */
     269    mHttp->setHost(mUrl.host());
    258270
    259271    /* Setup other connections */
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIHttp.h

    r33540 r37544  
    66
    77/*
    8  * Copyright (C) 2006-2010 Oracle Corporation
     8 * Copyright (C) 2006-2011 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5757    };
    5858
    59     QIHttp (QObject *aParent, const QString &aHostName, quint16 aPort = 80)
    60         : QHttp (aHostName, aPort, aParent)
     59    QIHttp (QObject *aParent)
     60        : QHttp (aParent)
    6161        , mStatusCode (0)
    6262        , mErrorCode (NoError)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h

    r28800 r37544  
    66
    77/*
    8  * Copyright (C) 2006-2008 Oracle Corporation
     8 * Copyright (C) 2006-2011 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    123123};
    124124
     125class UIProxyManager
     126{
     127public:
     128
     129    UIProxyManager(const QString &strProxySettings = QString())
     130    {
     131        /* Parse settings: */
     132        if (!strProxySettings.isEmpty())
     133        {
     134            QStringList proxySettings = strProxySettings.split(",");
     135            if (proxySettings.size() > 0)
     136                m_fProxyEnabled = proxySettings[0] == "proxyEnabled";
     137            if (proxySettings.size() > 1)
     138                m_strProxyHost = proxySettings[1];
     139            if (proxySettings.size() > 2)
     140                m_strProxyPort = proxySettings[2];
     141            if (proxySettings.size() > 3)
     142                m_fAuthEnabled = proxySettings[3] == "authEnabled";
     143            if (proxySettings.size() > 4)
     144                m_strAuthLogin = proxySettings[4];
     145            if (proxySettings.size() > 5)
     146                m_strAuthPassword = proxySettings[5];
     147        }
     148    }
     149
     150    QString toString() const
     151    {
     152        /* Serialize settings: */
     153        QString strResult;
     154        if (m_fProxyEnabled || !m_strProxyHost.isEmpty() || !m_strProxyPort.isEmpty() ||
     155            m_fAuthEnabled || !m_strAuthLogin.isEmpty() || !m_strAuthPassword.isEmpty())
     156        {
     157            QStringList proxySettings;
     158            proxySettings << QString(m_fProxyEnabled ? "proxyEnabled" : "proxyDisabled");
     159            proxySettings << m_strProxyHost;
     160            proxySettings << m_strProxyPort;
     161            proxySettings << QString(m_fAuthEnabled ? "authEnabled" : "authDisabled");
     162            proxySettings << m_strAuthLogin;
     163            proxySettings << m_strAuthPassword;
     164            strResult = proxySettings.join(",");
     165        }
     166        return strResult;
     167    }
     168
     169    /* Proxy attribute getters: */
     170    bool proxyEnabled() const { return m_fProxyEnabled; }
     171    const QString& proxyHost() const { return m_strProxyHost; }
     172    const QString& proxyPort() const { return m_strProxyPort; }
     173    bool authEnabled() const { return m_fAuthEnabled; }
     174    const QString& authLogin() const { return m_strAuthLogin; }
     175    const QString& authPassword() const { return m_strAuthPassword; }
     176
     177    /* Proxy attribute setters: */
     178    void setProxyEnabled(bool fProxyEnabled) { m_fProxyEnabled = fProxyEnabled; }
     179    void setProxyHost(const QString &strProxyHost) { m_strProxyHost = strProxyHost; }
     180    void setProxyPort(const QString &strProxyPort) { m_strProxyPort = strProxyPort; }
     181    void setAuthEnabled(bool fAuthEnabled) { m_fAuthEnabled = fAuthEnabled; }
     182    void setAuthLogin(const QString &strAuthLogin) { m_strAuthLogin = strAuthLogin; }
     183    void setAuthPassword(const QString &strAuthPassword) { m_strAuthPassword = strAuthPassword; }
     184
     185private:
     186
     187    /* Proxy attribute variables: */
     188    bool m_fProxyEnabled;
     189    QString m_strProxyHost;
     190    QString m_strProxyPort;
     191    bool m_fAuthEnabled;
     192    QString m_strAuthLogin;
     193    QString m_strAuthPassword;
     194};
     195
    125196#ifdef Q_WS_MAC
    126197# include "VBoxUtils-darwin.h"
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r37169 r37544  
    4040#include "UIGlobalSettingsNetwork.h"
    4141#include "UIGlobalSettingsExtension.h"
     42#include "UIGlobalSettingsProxy.h"
    4243
    4344#include "UIMachineSettingsGeneral.h"
     
    385386                    break;
    386387                }
     388                /* Proxy page: */
     389                case GLSettingsPage_Proxy:
     390                {
     391                    pSettingsPage = new UIGlobalSettingsProxy;
     392                    addItem(":/extension_pack_32px.png", ":/extension_pack_disabled_32px.png",
     393                            ":/extension_pack_16px.png", ":/extension_pack_disabled_16px.png",
     394                            iPageIndex, "#proxy", pSettingsPage);
     395                    break;
     396                }
    387397                default:
    388398                    break;
     
    483493    /* Extension page: */
    484494    m_pSelector->setItemText(GLSettingsPage_Extension, tr("Extensions"));
     495
     496    /* Proxy page: */
     497    m_pSelector->setItemText(GLSettingsPage_Proxy, tr("Proxy"));
    485498
    486499    /* Translate the selector: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h

    r37168 r37544  
    4040        GLSettingsPage_Network,
    4141        GLSettingsPage_Extension,
     42        GLSettingsPage_Proxy,
    4243        GLSettingsPage_MAX
    4344    };
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp

    r37470 r37544  
    33 *
    44 * VBox frontends: Qt4 GUI ("VirtualBox"):
    5  * UIGlobalSettingsGeneral class implementation
     5 * UIGlobalSettingsProxy class implementation
    66 */
    77
    88/*
    9  * Copyright (C) 2006-2010 Oracle Corporation
     9 * Copyright (C) 2011 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818 */
    1919
    20 /* Global includes */
    21 #include <QDir>
    22 
    2320/* Local includes */
    24 #include "UIGlobalSettingsGeneral.h"
    25 #include "VBoxGlobal.h"
     21#include "UIGlobalSettingsProxy.h"
     22#include "VBoxUtils.h"
    2623
    2724/* General page constructor: */
    28 UIGlobalSettingsGeneral::UIGlobalSettingsGeneral()
     25UIGlobalSettingsProxy::UIGlobalSettingsProxy()
    2926{
    3027    /* Apply UI decorations: */
    31     Ui::UIGlobalSettingsGeneral::setupUi(this);
    32 
    33 #ifndef VBOX_GUI_WITH_SYSTRAY
    34     m_pEnableTrayIconCheckbox->hide();
    35     m_pSpacerWidget1->hide();
    36 #endif /* !VBOX_GUI_WITH_SYSTRAY */
    37 #ifndef Q_WS_MAC
    38     m_pEnablePresentationModeCheckbox->hide();
    39     m_pSpacerWidget2->hide();
    40 #endif /* !Q_WS_MAC */
    41 //#ifndef Q_WS_WIN /* Checkbox hidden for now! */
    42     m_pDisableHostScreenSaverCheckbox->hide();
    43     m_pSpacerWidget3->hide();
    44 //#endif /* !Q_WS_WIN */
    45 
    46     /* If all checkboxes hidden, hide separator too: */
    47     if (m_pEnableTrayIconCheckbox->isHidden() &&
    48         m_pEnablePresentationModeCheckbox->isHidden() &&
    49         m_pDisableHostScreenSaverCheckbox->isHidden())
    50         m_pLineSeparator2->hide();
     28    Ui::UIGlobalSettingsProxy::setupUi(this);
    5129
    5230    /* Setup widgets: */
    53     m_pMachineFolderSelector->setHomeDir(vboxGlobal().virtualBox().GetHomeFolder());
    54     m_pVRDPLibNameSelector->setHomeDir(vboxGlobal().virtualBox().GetHomeFolder());
    55     m_pVRDPLibNameSelector->setMode(VBoxFilePathSelectorWidget::Mode_File_Open);
     31    m_pPortEditor->setFixedWidthByText(QString().fill('0', 6));
     32    m_pHostEditor->setValidator(new QRegExpValidator(QRegExp("\\S*"), m_pPortEditor));
     33    m_pPortEditor->setValidator(new QRegExpValidator(QRegExp("\\d*"), m_pPortEditor));
     34    m_pLoginEditor->setValidator(new QRegExpValidator(QRegExp("\\S*"), m_pPortEditor));
     35    m_pPasswordEditor->setValidator(new QRegExpValidator(QRegExp("\\S*"), m_pPortEditor));
     36
     37    /* Setup connections: */
     38    connect(m_pProxyCheckbox, SIGNAL(stateChanged(int)), this, SLOT(sltProxyToggled()));
     39    connect(m_pAuthCheckbox, SIGNAL(stateChanged(int)), this, SLOT(sltAuthToggled()));
    5640
    5741    /* Apply language settings: */
     
    6145/* Load data to cashe from corresponding external object(s),
    6246 * this task COULD be performed in other than GUI thread: */
    63 void UIGlobalSettingsGeneral::loadToCacheFrom(QVariant &data)
     47void UIGlobalSettingsProxy::loadToCacheFrom(QVariant &data)
    6448{
    6549    /* Fetch data to properties & settings: */
     
    6751
    6852    /* Load to cache: */
    69     m_cache.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder();
    70     m_cache.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary();
    71     m_cache.m_fTrayIconEnabled = m_settings.trayIconEnabled();
    72 #ifdef Q_WS_MAC
    73     m_cache.m_fPresentationModeEnabled = m_settings.presentationModeEnabled();
    74 #endif /* Q_WS_MAC */
    75     m_cache.m_fHostScreenSaverDisables = m_settings.hostScreenSaverDisabled();
     53    UIProxyManager proxyManager(m_settings.proxySettings());
     54    m_cache.m_fProxyEnabled = proxyManager.proxyEnabled();
     55    m_cache.m_strProxyHost = proxyManager.proxyHost();
     56    m_cache.m_strProxyPort = proxyManager.proxyPort();
     57    m_cache.m_fAuthEnabled = proxyManager.authEnabled();
     58    m_cache.m_strAuthLogin = proxyManager.authLogin();
     59    m_cache.m_strAuthPassword = proxyManager.authPassword();
    7660
    7761    /* Upload properties & settings to data: */
     
    8165/* Load data to corresponding widgets from cache,
    8266 * this task SHOULD be performed in GUI thread only: */
    83 void UIGlobalSettingsGeneral::getFromCache()
     67void UIGlobalSettingsProxy::getFromCache()
    8468{
    8569    /* Fetch from cache: */
    86     m_pMachineFolderSelector->setPath(m_cache.m_strDefaultMachineFolder);
    87     m_pVRDPLibNameSelector->setPath(m_cache.m_strVRDEAuthLibrary);
    88     m_pEnableTrayIconCheckbox->setChecked(m_cache.m_fTrayIconEnabled);
    89 #ifdef Q_WS_MAC
    90     m_pEnablePresentationModeCheckbox->setChecked(m_cache.m_fPresentationModeEnabled);
    91 #endif /* Q_WS_MAC */
    92     m_pDisableHostScreenSaverCheckbox->setChecked(m_cache.m_fHostScreenSaverDisables);
     70    m_pProxyCheckbox->setChecked(m_cache.m_fProxyEnabled);
     71    m_pHostEditor->setText(m_cache.m_strProxyHost);
     72    m_pPortEditor->setText(m_cache.m_strProxyPort);
     73    m_pAuthCheckbox->setChecked(m_cache.m_fAuthEnabled);
     74    m_pLoginEditor->setText(m_cache.m_strAuthLogin);
     75    m_pPasswordEditor->setText(m_cache.m_strAuthPassword);
     76    sltProxyToggled();
    9377}
    9478
    9579/* Save data from corresponding widgets to cache,
    9680 * this task SHOULD be performed in GUI thread only: */
    97 void UIGlobalSettingsGeneral::putToCache()
     81void UIGlobalSettingsProxy::putToCache()
    9882{
    9983    /* Upload to cache: */
    100     m_cache.m_strDefaultMachineFolder = m_pMachineFolderSelector->path();
    101     m_cache.m_strVRDEAuthLibrary = m_pVRDPLibNameSelector->path();
    102     m_cache.m_fTrayIconEnabled = m_pEnableTrayIconCheckbox->isChecked();
    103 #ifdef Q_WS_MAC
    104     m_cache.m_fPresentationModeEnabled = m_pEnablePresentationModeCheckbox->isChecked();
    105 #endif /* Q_WS_MAC */
    106     m_cache.m_fHostScreenSaverDisables = m_pDisableHostScreenSaverCheckbox->isChecked();
     84    m_cache.m_fProxyEnabled = m_pProxyCheckbox->isChecked();
     85    m_cache.m_strProxyHost = m_pHostEditor->text();
     86    m_cache.m_strProxyPort = m_pPortEditor->text();
     87    m_cache.m_fAuthEnabled = m_pAuthCheckbox->isChecked();
     88    m_cache.m_strAuthLogin = m_pLoginEditor->text();
     89    m_cache.m_strAuthPassword = m_pPasswordEditor->text();
    10790}
    10891
    10992/* Save data from cache to corresponding external object(s),
    11093 * this task COULD be performed in other than GUI thread: */
    111 void UIGlobalSettingsGeneral::saveFromCacheTo(QVariant &data)
     94void UIGlobalSettingsProxy::saveFromCacheTo(QVariant &data)
    11295{
    11396    /* Fetch data to properties & settings: */
    11497    UISettingsPageGlobal::fetchData(data);
    11598
    116     /* Save from cache: */
    117     if (m_properties.isOk() && m_pMachineFolderSelector->isModified())
    118         m_properties.SetDefaultMachineFolder(m_cache.m_strDefaultMachineFolder);
    119     if (m_properties.isOk() && m_pVRDPLibNameSelector->isModified())
    120         m_properties.SetVRDEAuthLibrary(m_cache.m_strVRDEAuthLibrary);
    121     m_settings.setTrayIconEnabled(m_cache.m_fTrayIconEnabled);
    122 #ifdef Q_WS_MAC
    123     m_settings.setPresentationModeEnabled(m_cache.m_fPresentationModeEnabled);
    124 #endif /* Q_WS_MAC */
    125     m_settings.setHostScreenSaverDisabled(m_cache.m_fHostScreenSaverDisables);
     99    UIProxyManager proxyManager;
     100    proxyManager.setProxyEnabled(m_cache.m_fProxyEnabled);
     101    proxyManager.setProxyHost(m_cache.m_strProxyHost);
     102    proxyManager.setProxyPort(m_cache.m_strProxyPort);
     103    proxyManager.setAuthEnabled(m_cache.m_fAuthEnabled);
     104    proxyManager.setAuthLogin(m_cache.m_strAuthLogin);
     105    proxyManager.setAuthPassword(m_cache.m_strAuthPassword);
     106    m_settings.setProxySettings(proxyManager.toString());
    126107
    127108    /* Upload properties & settings to data: */
     
    130111
    131112/* Navigation stuff: */
    132 void UIGlobalSettingsGeneral::setOrderAfter(QWidget *pWidget)
     113void UIGlobalSettingsProxy::setOrderAfter(QWidget *pWidget)
    133114{
    134     setTabOrder(pWidget, m_pMachineFolderSelector);
    135     setTabOrder(m_pMachineFolderSelector, m_pVRDPLibNameSelector);
    136     setTabOrder(m_pVRDPLibNameSelector, m_pEnableTrayIconCheckbox);
    137     setTabOrder(m_pEnableTrayIconCheckbox, m_pEnablePresentationModeCheckbox);
    138     setTabOrder(m_pEnablePresentationModeCheckbox, m_pDisableHostScreenSaverCheckbox);
     115    setTabOrder(pWidget, m_pProxyCheckbox);
     116    setTabOrder(m_pProxyCheckbox, m_pHostEditor);
     117    setTabOrder(m_pHostEditor, m_pPortEditor);
     118    setTabOrder(m_pPortEditor, m_pAuthCheckbox);
     119    setTabOrder(m_pAuthCheckbox, m_pLoginEditor);
     120    setTabOrder(m_pLoginEditor, m_pPasswordEditor);
    139121}
    140122
    141123/* Translation stuff: */
    142 void UIGlobalSettingsGeneral::retranslateUi()
     124void UIGlobalSettingsProxy::retranslateUi()
    143125{
    144126    /* Translate uic generated strings: */
    145     Ui::UIGlobalSettingsGeneral::retranslateUi(this);
    146 
    147     m_pMachineFolderSelector->setWhatsThis(tr("Displays the path to the default virtual "
    148                                               "machine folder. This folder is used, if not "
    149                                               "explicitly specified otherwise, when creating "
    150                                               "new virtual machines."));
    151     m_pVRDPLibNameSelector->setWhatsThis(tr("Displays the path to the library that "
    152                                             "provides authentication for Remote Display "
    153                                             "(VRDP) clients."));
     127    Ui::UIGlobalSettingsProxy::retranslateUi(this);
    154128}
    155129
     130void UIGlobalSettingsProxy::sltProxyToggled()
     131{
     132    m_pHostLabel->setEnabled(m_pProxyCheckbox->isChecked());
     133    m_pHostEditor->setEnabled(m_pProxyCheckbox->isChecked());
     134    m_pPortLabel->setEnabled(m_pProxyCheckbox->isChecked());
     135    m_pPortEditor->setEnabled(m_pProxyCheckbox->isChecked());
     136    m_pAuthCheckbox->setEnabled(m_pProxyCheckbox->isChecked());
     137    sltAuthToggled();
     138}
     139
     140void UIGlobalSettingsProxy::sltAuthToggled()
     141{
     142    m_pLoginLabel->setEnabled(m_pProxyCheckbox->isChecked() && m_pAuthCheckbox->isChecked());
     143    m_pLoginEditor->setEnabled(m_pProxyCheckbox->isChecked() && m_pAuthCheckbox->isChecked());
     144    m_pPasswordLabel->setEnabled(m_pProxyCheckbox->isChecked() && m_pAuthCheckbox->isChecked());
     145    m_pPasswordEditor->setEnabled(m_pProxyCheckbox->isChecked() && m_pAuthCheckbox->isChecked());
     146}
     147
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h

    r37470 r37544  
    22 *
    33 * VBox frontends: Qt4 GUI ("VirtualBox"):
    4  * UIGlobalSettingsGeneral class declaration
     4 * UIGlobalSettingsProxy class declaration
    55 */
    66
    77/*
    8  * Copyright (C) 2006-2010 Oracle Corporation
     8 * Copyright (C) 2011 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1717 */
    1818
    19 #ifndef __UIGlobalSettingsGeneral_h__
    20 #define __UIGlobalSettingsGeneral_h__
     19#ifndef __UIGlobalSettingsProxy_h__
     20#define __UIGlobalSettingsProxy_h__
    2121
    2222/* Local includes */
    2323#include "UISettingsPage.h"
    24 #include "UIGlobalSettingsGeneral.gen.h"
     24#include "UIGlobalSettingsProxy.gen.h"
    2525
    26 /* Global settings / General page / Cache: */
    27 struct UISettingsCacheGlobalGeneral
     26/* Global settings / Proxy page / Cache: */
     27struct UISettingsCacheGlobalProxy
    2828{
    29     QString m_strDefaultMachineFolder;
    30     QString m_strVRDEAuthLibrary;
    31     bool m_fTrayIconEnabled;
    32 #ifdef Q_WS_MAC
    33     bool m_fPresentationModeEnabled;
    34 #endif /* Q_WS_MAC */
    35     bool m_fHostScreenSaverDisables;
     29    UISettingsCacheGlobalProxy() : m_fProxyEnabled(false), m_fAuthEnabled(false) {}
     30    bool m_fProxyEnabled;
     31    QString m_strProxyHost;
     32    QString m_strProxyPort;
     33    bool m_fAuthEnabled;
     34    QString m_strAuthLogin;
     35    QString m_strAuthPassword;
    3636};
    3737
    38 /* Global settings / General page: */
    39 class UIGlobalSettingsGeneral : public UISettingsPageGlobal, public Ui::UIGlobalSettingsGeneral
     38/* Global settings / Proxy page: */
     39class UIGlobalSettingsProxy : public UISettingsPageGlobal, public Ui::UIGlobalSettingsProxy
    4040{
    4141    Q_OBJECT;
     
    4444
    4545    /* Constructor: */
    46     UIGlobalSettingsGeneral();
     46    UIGlobalSettingsProxy();
    4747
    4848protected:
     
    6868    void retranslateUi();
    6969
     70private slots:
     71
     72    void sltProxyToggled();
     73    void sltAuthToggled();
     74
    7075private:
    7176
    7277    /* Cache: */
    73     UISettingsCacheGlobalGeneral m_cache;
     78    UISettingsCacheGlobalProxy m_cache;
    7479};
    7580
    76 #endif // __UIGlobalSettingsGeneral_h__
     81#endif // __UIGlobalSettingsProxy_h__
    7782
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.ui

    r37470 r37544  
    33 VBox frontends: Qt4 GUI ("VirtualBox"):
    44
    5      Copyright (C) 2008-2010 Oracle Corporation
     5     Copyright (C) 2011 Oracle Corporation
    66
    77     This file is part of VirtualBox Open Source Edition (OSE), as
     
    1313     hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1414 </comment>
    15  <class>UIGlobalSettingsGeneral</class>
    16  <widget class="QWidget" name="UIGlobalSettingsGeneral">
     15 <class>UIGlobalSettingsProxy</class>
     16 <widget class="QWidget" name="UIGlobalSettingsProxy">
    1717  <property name="geometry">
    1818   <rect>
    1919    <x>0</x>
    2020    <y>0</y>
    21     <width>400</width>
    22     <height>200</height>
     21    <width>300</width>
     22    <height>150</height>
    2323   </rect>
    2424  </property>
     
    2727    <number>0</number>
    2828   </property>
    29    <item row="0" column="0" colspan="2">
    30     <widget class="QLabel" name="m_pMachineFolderLabel">
    31      <property name="text">
    32       <string>Default &amp;Machine Folder:</string>
     29   <item row="0" column="0">
     30    <spacer>
     31     <property name="orientation">
     32      <enum>Qt::Horizontal</enum>
     33     </property>
     34     <property name="sizeType">
     35      <enum>QSizePolicy::Fixed</enum>
     36     </property>
     37     <property name="sizeHint">
     38      <size>
     39       <width>40</width>
     40       <height>20</height>
     41      </size>
     42     </property>
     43    </spacer>
     44   </item>
     45   <item row="0" column="1" colspan="4">
     46    <widget class="QCheckBox" name="m_pProxyCheckbox">
     47     <property name="whatsThis">
     48      <string>When checked, VirtualBox will use the proxy settings supplied for tasks like downloading Guest Additions from the network or checking for updates.</string>
     49     </property>
     50     <property name="text">
     51      <string>&amp;Enable proxy</string>
     52     </property>
     53     <property name="checked">
     54      <bool>false</bool>
     55     </property>
     56    </widget>
     57   </item>
     58   <item row="1" column="1">
     59    <spacer>
     60     <property name="orientation">
     61      <enum>Qt::Horizontal</enum>
     62     </property>
     63     <property name="sizeType">
     64      <enum>QSizePolicy::Fixed</enum>
     65     </property>
     66     <property name="sizeHint">
     67      <size>
     68       <width>16</width>
     69       <height>0</height>
     70      </size>
     71     </property>
     72    </spacer>
     73   </item>
     74   <item row="1" column="2" colspan="3">
     75    <layout class="QHBoxLayout">
     76     <property name="margin">
     77      <number>0</number>
     78     </property>
     79     <item>
     80      <widget class="QLabel" name="m_pHostLabel">
     81       <property name="text">
     82        <string>Ho&amp;st:</string>
     83       </property>
     84       <property name="alignment">
     85        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     86       </property>
     87       <property name="buddy">
     88        <cstring>m_pHostEditor</cstring>
     89       </property>
     90      </widget>
     91     </item>
     92     <item>
     93      <widget class="QILineEdit" name="m_pHostEditor">
     94       <property name="whatsThis">
     95        <string>Changes the proxy host.</string>
     96       </property>
     97      </widget>
     98     </item>
     99     <item>
     100      <widget class="QLabel" name="m_pPortLabel">
     101       <property name="text">
     102        <string>&amp;Port:</string>
     103       </property>
     104       <property name="alignment">
     105        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     106       </property>
     107       <property name="buddy">
     108        <cstring>m_pPortEditor</cstring>
     109       </property>
     110      </widget>
     111     </item>
     112     <item>
     113      <widget class="QILineEdit" name="m_pPortEditor">
     114       <property name="whatsThis">
     115        <string>Changes the proxy port.</string>
     116       </property>
     117      </widget>
     118     </item>
     119    </layout>
     120   </item>
     121   <item row="2" column="2" colspan="3">
     122    <widget class="QCheckBox" name="m_pAuthCheckbox">
     123     <property name="whatsThis">
     124      <string>When checked the authentication supplied will be used with the proxy server.</string>
     125     </property>
     126     <property name="text">
     127      <string>&amp;Use authentication</string>
     128     </property>
     129     <property name="checked">
     130      <bool>false</bool>
     131     </property>
     132    </widget>
     133   </item>
     134   <item row="3" column="2" rowspan="2">
     135    <spacer>
     136     <property name="orientation">
     137      <enum>Qt::Horizontal</enum>
     138     </property>
     139     <property name="sizeType">
     140      <enum>QSizePolicy::Fixed</enum>
     141     </property>
     142     <property name="sizeHint">
     143      <size>
     144       <width>16</width>
     145       <height>0</height>
     146      </size>
     147     </property>
     148    </spacer>
     149   </item>
     150   <item row="3" column="3">
     151    <widget class="QLabel" name="m_pLoginLabel">
     152     <property name="text">
     153      <string>User &amp;name:</string>
    33154     </property>
    34155     <property name="alignment">
     
    36157     </property>
    37158     <property name="buddy">
    38       <cstring>m_pMachineFolderSelector</cstring>
    39      </property>
    40     </widget>
    41    </item>
    42    <item row="0" column="2">
    43     <widget class="VBoxFilePathSelectorWidget" name="m_pMachineFolderSelector">
    44      <property name="sizePolicy">
    45       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
    46        <horstretch>0</horstretch>
    47        <verstretch>0</verstretch>
    48       </sizepolicy>
    49      </property>
    50     </widget>
    51    </item>
    52    <item row="1" column="0" colspan="3">
    53     <widget class="Line" name="m_pLineSeparator1">
    54      <property name="orientation">
    55       <enum>Qt::Horizontal</enum>
    56      </property>
    57     </widget>
    58    </item>
    59    <item row="2" column="0" colspan="2">
    60     <widget class="QLabel" name="m_pVRDPLibLabel">
    61      <property name="text">
    62       <string>V&amp;RDP Authentication Library:</string>
     159      <cstring>m_pLoginEditor</cstring>
     160     </property>
     161    </widget>
     162   </item>
     163   <item row="3" column="4">
     164    <widget class="QILineEdit" name="m_pLoginEditor">
     165     <property name="whatsThis">
     166      <string>Changes the user name used for authentication.</string>
     167     </property>
     168    </widget>
     169   </item>
     170   <item row="4" column="3">
     171    <widget class="QLabel" name="m_pPasswordLabel">
     172     <property name="text">
     173      <string>Pass&amp;word:</string>
    63174     </property>
    64175     <property name="alignment">
     
    66177     </property>
    67178     <property name="buddy">
    68       <cstring>m_pVRDPLibNameSelector</cstring>
    69      </property>
    70     </widget>
    71    </item>
    72    <item row="2" column="2">
    73     <widget class="VBoxFilePathSelectorWidget" name="m_pVRDPLibNameSelector">
    74      <property name="sizePolicy">
    75       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
    76        <horstretch>0</horstretch>
    77        <verstretch>0</verstretch>
    78       </sizepolicy>
    79      </property>
    80     </widget>
    81    </item>
    82    <item row="3" column="0" colspan="3">
    83     <widget class="Line" name="m_pLineSeparator2">
    84      <property name="orientation">
    85       <enum>Qt::Horizontal</enum>
    86      </property>
    87     </widget>
    88    </item>
    89    <item row="4" column="0">
    90     <widget class="QWidget" name="m_pSpacerWidget1">
    91      <property name="sizePolicy">
    92       <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
    93        <horstretch>0</horstretch>
    94        <verstretch>0</verstretch>
    95       </sizepolicy>
    96      </property>
    97      <property name="minimumWidth">
    98       <number>34</number>
    99      </property>
    100     </widget>
    101    </item>
    102    <item row="4" column="1" colspan="2">
    103     <widget class="QCheckBox" name="m_pEnableTrayIconCheckbox">
    104      <property name="whatsThis">
    105       <string>When checked, the application will provide an icon with the context menu in the system tray.</string>
    106      </property>
    107      <property name="text">
    108       <string>&amp;Show System Tray Icon</string>
    109      </property>
    110     </widget>
    111    </item>
    112    <item row="5" column="0">
    113     <widget class="QWidget" name="m_pSpacerWidget2">
    114      <property name="sizePolicy">
    115       <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
    116        <horstretch>0</horstretch>
    117        <verstretch>0</verstretch>
    118       </sizepolicy>
    119      </property>
    120      <property name="minimumWidth">
    121       <number>34</number>
    122      </property>
    123     </widget>
    124    </item>
    125    <item row="5" column="1" colspan="2">
    126     <widget class="QCheckBox" name="m_pEnablePresentationModeCheckbox">
    127      <property name="text">
    128       <string>&amp;Auto show Dock and Menubar in fullscreen</string>
    129      </property>
    130     </widget>
    131    </item>
    132    <item row="6" column="0">
    133     <widget class="QWidget" name="m_pSpacerWidget3">
    134      <property name="sizePolicy">
    135       <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
    136        <horstretch>0</horstretch>
    137        <verstretch>0</verstretch>
    138       </sizepolicy>
    139      </property>
    140      <property name="minimumWidth">
    141       <number>34</number>
    142      </property>
    143     </widget>
    144    </item>
    145    <item row="6" column="1" colspan="2">
    146     <widget class="QCheckBox" name="m_pDisableHostScreenSaverCheckbox">
    147      <property name="whatsThis">
    148       <string>When checked, the host screen saver will be disabled whenever a virtual machine is running.</string>
    149      </property>
    150      <property name="text">
    151       <string>Disable Host &amp;ScreenSaver</string>
    152      </property>
    153     </widget>
    154    </item>
    155    <item row="7" column="0" colspan="3">
     179      <cstring>m_pPasswordEditor</cstring>
     180     </property>
     181    </widget>
     182   </item>
     183   <item row="4" column="4">
     184    <widget class="QILineEdit" name="m_pPasswordEditor">
     185     <property name="whatsThis">
     186      <string>Changes the password used for authentication.</string>
     187     </property>
     188    </widget>
     189   </item>
     190   <item row="5" column="1" colspan="4">
    156191    <spacer>
    157192     <property name="orientation">
     
    170205 <customwidgets>
    171206  <customwidget>
    172    <class>VBoxFilePathSelectorWidget</class>
    173    <extends>QComboBox</extends>
    174    <header>VBoxFilePathSelectorWidget.h</header>
    175    <container>1</container>
     207   <class>QILineEdit</class>
     208   <extends>QLineEdit</extends>
     209   <header>QILineEdit.h</header>
    176210  </customwidget>
    177211 </customwidgets>
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIDownloader.cpp

    r30356 r37544  
    77
    88/*
    9  * Copyright (C) 2006-2010 Oracle Corporation
     9 * Copyright (C) 2006-2011 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2424#include "VBoxProblemReporter.h"
    2525#include "UISpecialControls.h"
     26#include "VBoxUtils.h"
    2627
    2728/* Global includes */
     
    150151void UIDownloader::acknowledgeStart()
    151152{
     153    /* Recreate HTTP: */
    152154    delete m_pHttp;
    153     m_pHttp = new QIHttp(this, m_source.host());
     155    m_pHttp = new QIHttp(this);
     156    /* Setup HTTP proxy: */
     157    UIProxyManager proxyManager(vboxGlobal().settings().proxySettings());
     158    if (proxyManager.proxyEnabled())
     159    {
     160        m_pHttp->setProxy(proxyManager.proxyHost(), proxyManager.proxyPort().toInt(),
     161                          proxyManager.authEnabled() ? proxyManager.authLogin() : QString(),
     162                          proxyManager.authEnabled() ? proxyManager.authPassword() : QString());
     163    }
     164    /* Set HTTP host: */
     165    m_pHttp->setHost(m_source.host());
     166    /* Setup connections: */
    154167    connect(m_pHttp, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
    155168            this, SLOT(acknowledgeProcess(const QHttpResponseHeader &)));
    156169    connect(m_pHttp, SIGNAL(allIsDone(bool)),
    157170            this, SLOT(acknowledgeFinished(bool)));
     171    /* Make a request: */
    158172    m_pHttp->get(m_source.toEncoded());
    159173}
     
    206220void UIDownloader::downloadStart()
    207221{
     222    /* Recreate HTTP: */
    208223    delete m_pHttp;
    209     m_pHttp = new QIHttp(this, m_source.host());
     224    m_pHttp = new QIHttp(this);
     225    /* Setup HTTP proxy: */
     226    UIProxyManager proxyManager(vboxGlobal().settings().proxySettings());
     227    if (proxyManager.proxyEnabled())
     228    {
     229        m_pHttp->setProxy(proxyManager.proxyHost(), proxyManager.proxyPort().toInt(),
     230                          proxyManager.authEnabled() ? proxyManager.authLogin() : QString(),
     231                          proxyManager.authEnabled() ? proxyManager.authPassword() : QString());
     232    }
     233    /* Set HTTP host: */
     234    m_pHttp->setHost(m_source.host());
     235    /* Setup connections: */
    210236    connect(m_pHttp, SIGNAL(dataReadProgress (int, int)),
    211237            this, SLOT (downloadProcess(int, int)));
    212238    connect(m_pHttp, SIGNAL(allIsDone(bool)),
    213239            this, SLOT(downloadFinished(bool)));
     240    /* Make a request: */
    214241    m_pHttp->get(m_source.toEncoded());
    215242}
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