VirtualBox

Changeset 169 in vbox for trunk


Ignore:
Timestamp:
Jan 18, 2007 6:56:16 PM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Fixed VBoxNewHD wizard:

  • Corrected minimum size hinting;
  • Improved logarithmic slider to allow to select the full range of valid values (including minimum and maximum, even if they are not powers of 2).
Location:
trunk/src/VBox/Frontends/VirtualBox/ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewHDWzd.ui

    r132 r169  
    2828            <x>0</x>
    2929            <y>0</y>
    30             <width>520</width>
    31             <height>400</height>
     30            <width>542</width>
     31            <height>499</height>
    3232        </rect>
    3333    </property>
     
    7878                </property>
    7979            </widget>
    80             <widget class="QLabel">
     80            <widget class="QLayoutWidget">
    8181                <property name="name">
    82                     <cstring>txWelcome</cstring>
    83                 </property>
    84                 <property name="text">
    85                     <string>&lt;p&gt;This wizard will help you to create a new virtual hard disk image for your virtual machine.&lt;/p&gt;
     82                    <cstring>layout33</cstring>
     83                </property>
     84                <vbox>
     85                    <property name="name">
     86                        <cstring>unnamed</cstring>
     87                    </property>
     88                    <widget class="QLabel">
     89                        <property name="name">
     90                            <cstring>txWelcome</cstring>
     91                        </property>
     92                        <property name="sizePolicy">
     93                            <sizepolicy>
     94                                <hsizetype>1</hsizetype>
     95                                <vsizetype>0</vsizetype>
     96                                <horstretch>0</horstretch>
     97                                <verstretch>0</verstretch>
     98                            </sizepolicy>
     99                        </property>
     100                        <property name="text">
     101                            <string>&lt;p&gt;This wizard will help you to create a new virtual hard disk image for your virtual machine.&lt;/p&gt;
    86102&lt;p&gt;Use the &lt;b&gt;Next&lt;/b&gt; button to go to the next page of the wizard
    87103and the &lt;b&gt;Back&lt;/b&gt; button to return to the previous page.&lt;/p&gt;</string>
    88                 </property>
    89                 <property name="alignment">
    90                     <set>WordBreak|AlignTop</set>
    91                 </property>
     104                        </property>
     105                        <property name="alignment">
     106                            <set>WordBreak|AlignTop</set>
     107                        </property>
     108                    </widget>
     109                    <spacer>
     110                        <property name="name">
     111                            <cstring>spacer30</cstring>
     112                        </property>
     113                        <property name="orientation">
     114                            <enum>Vertical</enum>
     115                        </property>
     116                        <property name="sizeType">
     117                            <enum>Expanding</enum>
     118                        </property>
     119                        <property name="sizeHint">
     120                            <size>
     121                                <width>0</width>
     122                                <height>0</height>
     123                            </size>
     124                        </property>
     125                    </spacer>
     126                </vbox>
    92127            </widget>
    93128        </hbox>
     
    107142                <number>20</number>
    108143            </property>
     144            <property name="resizeMode">
     145                <enum>Minimum</enum>
     146            </property>
    109147            <widget class="QLabel">
    110148                <property name="name">
     
    141179                            <cstring>textLabel1_2</cstring>
    142180                        </property>
     181                        <property name="sizePolicy">
     182                            <sizepolicy>
     183                                <hsizetype>1</hsizetype>
     184                                <vsizetype>0</vsizetype>
     185                                <horstretch>0</horstretch>
     186                                <verstretch>0</verstretch>
     187                            </sizepolicy>
     188                        </property>
    143189                        <property name="text">
    144190                            <string>&lt;p&gt;Select the type of virtual hard disk image you want to create.&lt;/p&gt;
     
    150196                        </property>
    151197                        <property name="alignment">
    152                             <set>WordBreak|AlignVCenter</set>
     198                            <set>WordBreak|AlignTop</set>
    153199                        </property>
    154200                    </widget>
     
    206252                        <property name="sizeHint">
    207253                            <size>
    208                                 <width>20</width>
    209                                 <height>90</height>
     254                                <width>0</width>
     255                                <height>0</height>
    210256                            </size>
    211257                        </property>
     
    263309                            <cstring>txNameComment</cstring>
    264310                        </property>
     311                        <property name="sizePolicy">
     312                            <sizepolicy>
     313                                <hsizetype>1</hsizetype>
     314                                <vsizetype>0</vsizetype>
     315                                <horstretch>0</horstretch>
     316                                <verstretch>0</verstretch>
     317                            </sizepolicy>
     318                        </property>
    265319                        <property name="text">
    266320                            <string>&lt;p&gt;Press the &lt;b&gt;Select&lt;/b&gt; button to select the location and name of the file
     
    268322                        </property>
    269323                        <property name="alignment">
    270                             <set>WordBreak|AlignVCenter</set>
     324                            <set>WordBreak|AlignTop</set>
    271325                        </property>
    272326                    </widget>
     
    319373                            <cstring>txSizeComment</cstring>
    320374                        </property>
     375                        <property name="sizePolicy">
     376                            <sizepolicy>
     377                                <hsizetype>1</hsizetype>
     378                                <vsizetype>0</vsizetype>
     379                                <horstretch>0</horstretch>
     380                                <verstretch>0</verstretch>
     381                            </sizepolicy>
     382                        </property>
    321383                        <property name="text">
    322384                            <string>&lt;p&gt;Select the size of the virtual hard disk image in megabytes. This size will be reported to the Guest OS
     
    324386                        </property>
    325387                        <property name="alignment">
    326                             <set>WordBreak|AlignVCenter</set>
     388                            <set>WordBreak|AlignTop</set>
    327389                        </property>
    328390                    </widget>
     
    482544                        <property name="sizeHint">
    483545                            <size>
    484                                 <width>20</width>
    485                                 <height>20</height>
     546                                <width>0</width>
     547                                <height>0</height>
    486548                            </size>
    487549                        </property>
     
    505567                <number>20</number>
    506568            </property>
     569            <property name="resizeMode">
     570                <enum>Minimum</enum>
     571            </property>
    507572            <widget class="QLabel">
    508573                <property name="name">
     
    532597                        <cstring>unnamed</cstring>
    533598                    </property>
     599                    <property name="spacing">
     600                        <number>15</number>
     601                    </property>
    534602                    <widget class="QLabel">
    535603                        <property name="name">
    536604                            <cstring>txSummaryHdr</cstring>
     605                        </property>
     606                        <property name="sizePolicy">
     607                            <sizepolicy>
     608                                <hsizetype>1</hsizetype>
     609                                <vsizetype>0</vsizetype>
     610                                <horstretch>0</horstretch>
     611                                <verstretch>0</verstretch>
     612                            </sizepolicy>
    537613                        </property>
    538614                        <property name="text">
     
    540616                        </property>
    541617                        <property name="alignment">
    542                             <set>WordBreak|AlignVCenter</set>
     618                            <set>WordBreak|AlignTop</set>
    543619                        </property>
    544620                    </widget>
     
    552628                                <vsizetype>5</vsizetype>
    553629                                <horstretch>0</horstretch>
    554                                 <verstretch>1</verstretch>
     630                                <verstretch>0</verstretch>
    555631                            </sizepolicy>
    556632                        </property>
     
    568644                        <property name="name">
    569645                            <cstring>txSummaryFtr</cstring>
     646                        </property>
     647                        <property name="sizePolicy">
     648                            <sizepolicy>
     649                                <hsizetype>1</hsizetype>
     650                                <vsizetype>0</vsizetype>
     651                                <horstretch>0</horstretch>
     652                                <verstretch>0</verstretch>
     653                            </sizepolicy>
    570654                        </property>
    571655                        <property name="text">
     
    574658                            </string>
    575659                        </property>
     660                        <property name="alignment">
     661                            <set>WordBreak|AlignTop</set>
     662                        </property>
    576663                    </widget>
    577664                    <spacer>
     
    587674                        <property name="sizeHint">
    588675                            <size>
    589                                 <width>20</width>
    590                                 <height>20</height>
     676                                <width>0</width>
     677                                <height>0</height>
    591678                            </size>
    592679                        </property>
     
    631718    <include location="global" impldecl="in implementation">qvalidator.h</include>
    632719    <include location="global" impldecl="in implementation">qlocale.h</include>
    633     <include location="local" impldecl="in implementation">math.h</include>
    634720</includes>
    635721<variables>
    636722    <variable access="private">QIWidgetValidator *wvalNameAndSize;</variable>
    637723    <variable access="private">CHardDisk chd;</variable>
    638     <variable access="private">int sliderStep;</variable>
    639     <variable access="private">Q_UINT64 MaxVDISize;</variable>
     724    <variable access="private">int sliderScale;</variable>
     725    <variable access="private">Q_UINT64 maxVDISize;</variable>
    640726    <variable access="private">Q_UINT64 currentSize;</variable>
    641727</variables>
     
    650736    <function access="private">init()</function>
    651737    <function>setRecommendedFileName( const QString &amp; aName )</function>
    652     <function>setRecommendedSize( ulong aSize )</function>
     738    <function>setRecommendedSize( Q_UINT64 aSize )</function>
    653739    <function returnType="QString">imageFileName()</function>
    654740    <function returnType="Q_UINT64">imageSize()</function>
    655741    <function returnType="bool">isDynamicImage()</function>
    656742    <function returnType="CHardDisk">hardDisk() { return chd; }</function>
     743    <function>showPage( QWidget * page )</function>
     744    <function>updateSizeToolTip (Q_UINT64)</function>
    657745    <function>accept()</function>
    658746    <function access="private" returnType="bool">createHardDisk()</function>
    659     <function>showPage( QWidget * page )</function>
    660747</functions>
    661748<pixmapinproject/>
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewHDWzd.ui.h

    r132 r169  
    3333*****************************************************************************/
    3434
    35 static const int MinVDISize = 4;
     35/** Minimum VDI size in MB */
     36static const Q_UINT64 MinVDISize = 4;
     37
     38/** Initial VDI size in MB */
     39static const Q_UINT64 InitialVDISize = 2 * _1K;
    3640
    3741/**
     
    4852    if (fi.fileName() == file)
    4953    {
    50         // no path info at all, use defaultFolder
     54        /* no path info at all, use defaultFolder */
    5155        fi = QFileInfo (defaultFolder, file);
    5256    }
    5357    else if (fi.isRelative())
    5458    {
    55         // resolve relatively to homeFolder
     59        /* resolve relatively to homeFolder */
    5660        fi = QFileInfo (homeFolder, file);
    5761    }
     
    6064}
    6165
    62 
     66/// @todo (r=dmik) not currently used
     67#if 0
    6368class QISizeValidator : public QValidator
    6469{
    6570public:
    66     QISizeValidator (QObject * aParent, ULONG64 aMinSize, ULONG64 aMaxSize,
     71
     72    QISizeValidator (QObject * aParent,
     73                     Q_UINT64 aMinSize, Q_UINT64 aMaxSize,
    6774                     const char * aName = 0) :
    68         QValidator (aParent, aName), mMinSize(aMinSize), mMaxSize(aMaxSize) {}
     75        QValidator (aParent, aName), mMinSize (aMinSize), mMaxSize (aMaxSize) {}
    6976
    7077    ~QISizeValidator() {}
     
    100107            QLocale::system().toDouble (size, &result);
    101108
    102             ULONG64 sizeMB = vboxGlobal().parseSize (input) / _1M;
    103             if (sizeMB > mMaxSize || sizeMB < mMinSize)
     109            Q_UINT64 sizeB = vboxGlobal().parseSize (input);
     110            if (sizeB > mMaxSize || sizeB < mMinSize)
    104111                warning = true;
    105112
     
    112119
    113120protected:
    114     ULONG64 mMinSize;
    115     ULONG64 mMaxSize;
     121
     122    Q_UINT64 mMinSize;
     123    Q_UINT64 mMaxSize;
    116124};
    117 
     125#endif
     126
     127static inline int log2i (Q_UINT64 val)
     128{
     129    Q_UINT64 n = val;
     130    int pow = -1;
     131    while (n)
     132    {
     133        ++ pow;
     134        n >>= 1;
     135    }
     136    return pow;
     137}
     138
     139static inline int sizeMBToSlider (Q_UINT64 val, int sliderScale)
     140{
     141    int pow = log2i (val);
     142    Q_UINT64 tickMB = Q_UINT64 (1) << pow;
     143    Q_UINT64 tickMBNext = Q_UINT64 (1) << (pow + 1);
     144    int step = (val - tickMB) * sliderScale / (tickMBNext - tickMB);
     145    return pow * sliderScale + step;
     146}
     147
     148static inline Q_UINT64 sliderToSizeMB (int val, int sliderScale)
     149{
     150    int pow = val / sliderScale;
     151    int step = val % sliderScale;
     152    Q_UINT64 tickMB = Q_UINT64 (1) << pow;
     153    Q_UINT64 tickMBNext = Q_UINT64 (1) << (pow + 1);
     154    return tickMB + (tickMBNext - tickMB) * step / sliderScale;
     155}
    118156
    119157void VBoxNewHDWzd::init()
    120158{
    121     // disable help buttons
    122     helpButton()->setShown( false );
    123 
    124     // fix tab order to get the proper direction
    125     // (originally the focus goes Next/Finish -> Back -> Cancel -> page)
    126     QWidget::setTabOrder( backButton(), nextButton() );
    127     QWidget::setTabOrder( nextButton(), finishButton() );
    128     QWidget::setTabOrder( finishButton(), cancelButton() );
    129 
    130     // setup connections and set validation for pages
    131     // ----------------------------------------------------------------------
    132 
    133     // Image type page
    134 
    135     // Name and Size page
     159    /* disable help buttons */
     160    helpButton()->setShown (false);
     161
     162    /* fix tab order to get the proper direction
     163     * (originally the focus goes Next/Finish -> Back -> Cancel -> page) */
     164    QWidget::setTabOrder (backButton(), nextButton());
     165    QWidget::setTabOrder (nextButton(), finishButton());
     166    QWidget::setTabOrder (finishButton(), cancelButton());
     167
     168    /* setup connections and set validation for pages
     169     * ---------------------------------------------------------------------- */
     170
     171    /* Image type page */
     172
     173    /* Name and Size page */
    136174
    137175    CSystemProperties sysProps = vboxGlobal().virtualBox().GetSystemProperties();
    138176
    139     MaxVDISize = sysProps.GetMaxVDISize();
     177    maxVDISize = sysProps.GetMaxVDISize();
     178
     179    /* Detect how many steps to recognize between adjacent powers of 2
     180     * to ensure that the last slider step is exactly maxVDISize */
     181    sliderScale = 0;
     182    {
     183        int pow = log2i (maxVDISize);
     184        Q_UINT64 tickMB = Q_UINT64 (1) << pow;
     185        if (tickMB < maxVDISize)
     186        {
     187            Q_UINT64 tickMBNext = Q_UINT64 (1) << (pow + 1);
     188            Q_UINT64 gap = tickMBNext - maxVDISize;
     189            /// @todo (r=dmik) overflow may happen if maxVDISize is TOO big
     190            sliderScale = (int) ((tickMBNext - tickMB) / gap);
     191        }
     192    }
     193    sliderScale = QMAX (sliderScale, 8);
    140194
    141195    leName->setValidator (new QRegExpValidator (QRegExp( ".+" ), this));
    142196
    143     leSize->setValidator (new QISizeValidator (this, MinVDISize, MaxVDISize));
     197    leSize->setValidator (new QRegExpValidator (vboxGlobal().sizeRegexp(), this));
    144198    leSize->setAlignment (Qt::AlignRight);
    145199
    146     wvalNameAndSize = new QIWidgetValidator (pageNameAndSize, this );
    147     connect(
    148         wvalNameAndSize, SIGNAL( validityChanged (const QIWidgetValidator *) ),
    149         this, SLOT( enableNext (const QIWidgetValidator *) )
    150     );
    151 
    152     // Summary page
    153 
    154     // filter out Enter keys in order to direct them to the default dlg button
     200    wvalNameAndSize = new QIWidgetValidator (pageNameAndSize, this);
     201    connect (wvalNameAndSize, SIGNAL (validityChanged (const QIWidgetValidator *)),
     202             this, SLOT (enableNext (const QIWidgetValidator *)));
     203    connect (wvalNameAndSize, SIGNAL (isValidRequested (QIWidgetValidator *)),
     204             this, SLOT (revalidate (QIWidgetValidator *)));
     205    /* we ask revalidate only when currentSize is changed after manually
     206     * editing the line edit field; the slider cannot produce invalid values */
     207    connect (leSize, SIGNAL (textChanged (const QString &)),
     208             wvalNameAndSize, SLOT (revalidate()));
     209
     210    /* Summary page */
     211
     212    /* filter out Enter keys in order to direct them to the default dlg button */
    155213    QIKeyFilter *ef = new QIKeyFilter (this, Key_Enter);
    156     ef->watchOn (teSummary) ;
    157 
    158     // set initial values
    159     // ----------------------------------------------------------------------
    160 
    161     // Image type page
    162 
    163     // Name and Size page
     214    ef->watchOn (teSummary);
     215
     216    /* set initial values
     217     * ---------------------------------------------------------------------- */
     218
     219    /* Image type page */
     220
     221    /* Name and Size page */
    164222
    165223    static ulong HDNumber = 0;
    166224    leName->setText (QString ("NewHardDisk%1.vdi").arg (++ HDNumber));
    167225
    168     sliderStep = 50;
    169226    slSize->setFocusPolicy (QWidget::StrongFocus);
    170     slSize->setPageStep (sliderStep);
    171     slSize->setLineStep (sliderStep);
     227    slSize->setPageStep (sliderScale);
     228    slSize->setLineStep (sliderScale / 8);
    172229    slSize->setTickInterval (0);
    173     slSize->setMinValue ((int)(log10 ((double)MinVDISize)       / log10 (2.0) * sliderStep));
    174     slSize->setMaxValue ((int)(log10 ((double)(MaxVDISize + 1)) / log10 (2.0) * sliderStep));
     230    slSize->setMinValue (sizeMBToSlider (MinVDISize, sliderScale));
     231    slSize->setMaxValue (sizeMBToSlider (maxVDISize, sliderScale));
     232
    175233    txSizeMin->setText (vboxGlobal().formatSize (MinVDISize * _1M));
    176     txSizeMax->setText (vboxGlobal().formatSize (MaxVDISize * _1M));
    177     // initial HD size value = pow(2.0, 11) = 2048 MB
    178     currentSize = 2 * _1K;
     234    txSizeMax->setText (vboxGlobal().formatSize (maxVDISize * _1M));
     235
     236    /* limit the max. size of QLineEdit (STUPID Qt has NO correct means for that) */
     237    leSize->setMaximumSize (
     238        leSize->fontMetrics().width ("88888.88 MB") + leSize->frameWidth() * 2,
     239        leSize->height());
     240
     241    setRecommendedSize (InitialVDISize);
     242
     243    /* Summary page */
     244
     245    teSummary->setPaper (pageSummary->backgroundBrush());
     246
     247    /* update the next button state for pages with validation
     248     * (validityChanged() connected to enableNext() will do the job) */
     249    wvalNameAndSize->revalidate();
     250
     251    /* the finish button on the Summary page is always enabled */
     252    setFinishEnabled (pageSummary, true);
     253}
     254
     255
     256void VBoxNewHDWzd::setRecommendedFileName (const QString &aName)
     257{
     258    leName->setText (aName);
     259}
     260
     261
     262void VBoxNewHDWzd::setRecommendedSize (Q_UINT64 aSize)
     263{
     264    AssertReturnVoid (aSize >= MinVDISize && aSize <= maxVDISize);
     265    currentSize = aSize;
     266    slSize->setValue (sizeMBToSlider (currentSize, sliderScale));
    179267    leSize->setText (vboxGlobal().formatSize (currentSize * _1M));
    180     slSize->setValue ((int)(log10 ((double)currentSize) / log10 (2.0) * sliderStep));
    181     // limit the max. size of QLineEdit (STUPID Qt has NO correct means for that)
    182     leSize->setMaximumSize(
    183         leSize->fontMetrics().width ("88888.88 MB") + leSize->frameWidth() * 2,
    184         leSize->height()
    185     );
    186 
    187     // Summary page
    188 
    189     teSummary->setPaper (pageSummary->backgroundBrush());
    190 
    191     // update the next button state for pages with validation
    192     // (validityChanged() connected to enableNext() will do the job)
    193     wvalNameAndSize->revalidate();
    194 
    195     // the finish button on the Summary page is always enabled
    196     setFinishEnabled (pageSummary, true);
    197 }
    198 
    199 
    200 void VBoxNewHDWzd::setRecommendedFileName (const QString &aName)
    201 {
    202     leName->setText (aName);
    203 }
    204 
    205 
    206 void VBoxNewHDWzd::setRecommendedSize (ulong aSize)
    207 {
    208     AssertReturn (aSize >= (ulong) MinVDISize &&
    209                   aSize <= (ulong) MaxVDISize, (void) 0);
    210     currentSize = aSize;
    211     slSize->setValue ((int)(log10 ((double)currentSize) / log10 (2.0) * sliderStep));
    212     leSize->setText (vboxGlobal().formatSize(aSize * _1M));
     268    updateSizeToolTip (currentSize * _1M);
    213269}
    214270
     
    223279
    224280
    225 Q_UINT64 VBoxNewHDWzd::imageSize()
     281ULONG64 VBoxNewHDWzd::imageSize()
    226282{
    227283    return currentSize;
     
    235291
    236292
    237 void VBoxNewHDWzd::enableNext( const QIWidgetValidator *wval )
     293void VBoxNewHDWzd::enableNext (const QIWidgetValidator *wval)
    238294{
    239295    setNextEnabled (wval->widget(), wval->isValid());
     
    241297
    242298
    243 void VBoxNewHDWzd::revalidate( QIWidgetValidator * /*wval*/ )
    244 {
    245     // do individual validations for pages
    246 
    247 // template:
    248 //    QWidget *pg = wval->widget();
    249 //    bool valid = wval->isOtherValid();
    250 //
    251 //    if ( pg == pageXXX ) {
    252 //        valid = XXX;
    253 //    }
    254 //
    255 //    wval->setOtherValid( valid );
    256 }
    257 
     299void VBoxNewHDWzd::revalidate (QIWidgetValidator *wval)
     300{
     301    /* do individual validations for pages */
     302
     303    QWidget *pg = wval->widget();
     304    bool valid = wval->isOtherValid();
     305
     306    if (pg == pageNameAndSize)
     307    {
     308        valid = currentSize >= MinVDISize && currentSize <= maxVDISize;
     309    }
     310
     311    wval->setOtherValid (valid);
     312}
     313
     314
     315void VBoxNewHDWzd::updateSizeToolTip (Q_UINT64 sizeB)
     316{
     317    QString tip = tr ("<nobr>%1 Bytes</nobr>").arg (sizeB);
     318    QToolTip::add (slSize, tip);
     319    QToolTip::add (leSize, tip);
     320}
    258321
    259322void VBoxNewHDWzd::showPage( QWidget *page )
     
    274337        type.remove ('&');
    275338
     339        Q_UINT64 sizeB = imageSize() * _1M;
     340
    276341        // compose summary
    277342        QString summary = QString (tr(
     
    279344            "<tr><td>Type:</td><td>%1</td></tr>"
    280345            "<tr><td>Location:</td><td>%2</td></tr>"
    281             "<tr><td>Size:</td><td>%3&nbsp;MB</td></tr>"
     346            "<tr><td>Size:</td><td>%3&nbsp;(%4&nbsp;Bytes)</td></tr>"
    282347            "</table>"
    283348        ))
    284349            .arg (type)
    285350            .arg (composeFullFileName (imageFileName()))
    286             .arg (imageSize());
     351            .arg (VBoxGlobal::formatSize (sizeB))
     352            .arg (sizeB);
    287353        teSummary->setText (summary);
    288         // set Finish to default
     354        /* set Finish to default */
    289355        finishButton()->setDefault (true);
    290356    }
    291357    else
    292358    {
    293         // always set Next to default
     359        /* always set Next to default */
    294360        nextButton()->setDefault (true);
    295361    }
     
    297363    QWizard::showPage (page);
    298364
    299     // fix focus on the last page. when we go to the last page
    300     // having the Next in focus the focus goes to the Cancel
    301     // button because when the Next hides Finish is not yet shown.
     365    /* fix focus on the last page. when we go to the last page
     366     * having the Next in focus the focus goes to the Cancel
     367     * button because when the Next hides Finish is not yet shown. */
    302368    if (page == pageSummary && focusWidget() == cancelButton())
    303369        finishButton()->setFocus();
    304370
    305     // setup focus for individual pages
    306     if (page == pageType) {
     371    /* setup focus for individual pages */
     372    if (page == pageType)
     373    {
    307374        bgType->setFocus();
    308     } else if (page == pageNameAndSize) {
     375    }
     376    else if (page == pageNameAndSize)
     377    {
    309378        leName->setFocus();
    310     } else if (page == pageSummary) {
     379    }
     380    else if (page == pageSummary)
     381    {
    311382        teSummary->setFocus();
    312383    }
    313384}
     385
    314386
    315387void VBoxNewHDWzd::accept()
     
    395467    if (focusWidget() == slSize)
    396468    {
    397         currentSize = (ULONG64)(pow (2.0, ((double)val / sliderStep)));
     469        currentSize = sliderToSizeMB (val, sliderScale);
    398470        leSize->setText (vboxGlobal().formatSize (currentSize * _1M));
     471        updateSizeToolTip (currentSize * _1M);
    399472    }
    400473}
     
    405478    if (focusWidget() == leSize)
    406479    {
    407         currentSize = vboxGlobal().parseSize (text) / _1M;
    408         slSize->setValue ((int)(log10 ((double)currentSize) / log10 (2.0) * sliderStep));
     480        currentSize = vboxGlobal().parseSize (text);
     481        updateSizeToolTip (currentSize);
     482        currentSize /= _1M;
     483        slSize->setValue (sizeMBToSlider (currentSize, sliderScale));
    409484    }
    410485}
     
    413488void VBoxNewHDWzd::tbNameSelect_clicked()
    414489{
    415     // set the first parent directory that exists as the current
     490    /* set the first parent directory that exists as the current */
    416491    QFileInfo fld (composeFullFileName (leName->text()));
    417492    do
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