VirtualBox

Changeset 104928 in vbox


Ignore:
Timestamp:
Jun 14, 2024 3:51:01 PM (10 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163530
Message:

FE/Qt: bugref:10666, bugref:10669: Moving UIMediumSizeSlider out of UIMediumSizeEditor; This is necessary to write own accessibility interface for our custom slider.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediumSizeEditor.cpp

    r104926 r104928  
    3030#include <QLabel>
    3131#include <QRegularExpressionValidator>
    32 #include <QSlider>
    3332
    3433/* GUI includes: */
     
    4443
    4544
    46 /* static */
    47 const qulonglong UIMediumSizeEditor::s_uSectorSize = 512;
    48 
    49 UIMediumSizeEditor::UIMediumSizeEditor(QWidget *pParent, qulonglong uMinimumSize /* = _4M */)
    50     : QWidget(pParent)
    51     , m_uSizeMin(uMinimumSize)
    52     , m_uSizeMax(gpGlobalSession->virtualBox().GetSystemProperties().GetInfoVDSize())
    53     , m_iSliderScale(calculateSliderScale(m_uSizeMax))
    54     , m_uSize(0)
    55     , m_pSlider(0)
    56     , m_pLabelMinSize(0)
    57     , m_pLabelMaxSize(0)
    58     , m_pEditor(0)
    59 {
    60     prepare();
    61 }
    62 
    63 void UIMediumSizeEditor::setMediumSize(qulonglong uSize)
    64 {
    65     /* Remember the new size: */
    66     m_uSize = uSize;
    67 
    68     /* And assign it to the slider & editor: */
    69     m_pSlider->blockSignals(true);
    70     m_pSlider->setValue(sizeMBToSlider(m_uSize, m_iSliderScale));
    71     m_pSlider->blockSignals(false);
    72     m_pEditor->blockSignals(true);
    73     m_pEditor->setText(UITranslator::formatSize(m_uSize));
    74     m_strSizeSuffix = gpConverter->toString(UITranslator::parseSizeSuffix(m_pEditor->text()));
    75     m_pEditor->blockSignals(false);
    76     updateSizeToolTips(m_uSize);
    77 }
    78 
    79 void UIMediumSizeEditor::sltRetranslateUI()
    80 {
    81     /* Translate labels: */
    82     m_pLabelMinSize->setText(UITranslator::formatSize(m_uSizeMin));
    83     m_pLabelMaxSize->setText(UITranslator::formatSize(m_uSizeMax));
    84 
    85     /* Translate fields: */
    86     m_pSlider->setToolTip(tr("Holds the size of this medium."));
    87     m_pEditor->setToolTip(tr("Holds the size of this medium."));
    88     m_pLabelMinSize->setToolTip(tr("Minimum size for this medium."));
    89     m_pLabelMaxSize->setToolTip(tr("Maximum size for this medium."));
    90 }
    91 
    92 void UIMediumSizeEditor::sltSizeSliderChanged(int iValue)
    93 {
    94     /* Update the current size: */
    95     m_uSize = sliderToSizeMB(iValue, m_iSliderScale);
    96     /* Update the other widget: */
    97     m_pEditor->blockSignals(true);
    98     m_pEditor->setText(UITranslator::formatSize(m_uSize));
    99     m_strSizeSuffix = gpConverter->toString(UITranslator::parseSizeSuffix(m_pEditor->text()));
    100     m_pEditor->blockSignals(false);
    101     updateSizeToolTips(m_uSize);
    102     /* Notify the listeners: */
    103     emit sigSizeChanged(m_uSize);
    104 }
    105 
    106 void UIMediumSizeEditor::sltSizeEditorTextChanged()
    107 {
    108     QString strSizeString = ensureSizeSuffix(m_pEditor->text());
    109 
    110     m_pEditor->blockSignals(true);
    111     int iCursorPosition = m_pEditor->cursorPosition();
    112     m_pEditor->setText(strSizeString);
    113     m_pEditor->setCursorPosition(iCursorPosition);
    114     m_pEditor->blockSignals(false);
    115 
    116     /* Update the current size: */
    117     m_uSize = checkSectorSizeAlignment(UITranslator::parseSize(strSizeString));
    118 
    119     /* Update the other widget: */
    120     m_pSlider->blockSignals(true);
    121     m_pSlider->setValue(sizeMBToSlider(m_uSize, m_iSliderScale));
    122     m_pSlider->blockSignals(false);
    123     updateSizeToolTips(m_uSize);
    124     /* Notify the listeners: */
    125     emit sigSizeChanged(m_uSize);
    126 }
    127 
    128 void UIMediumSizeEditor::prepare()
    129 {
    130     /* Configure reg-exp: */
    131     m_regExNonDigitOrSeparator = QRegularExpression(QString("[^\\d%1]").arg(UITranslator::decimalSep()));
    132 
    133     /* Create layout: */
    134     QGridLayout *pLayout = new QGridLayout(this);
    135     if (pLayout)
    136     {
    137         /* Configure layout: */
    138         pLayout->setContentsMargins(0, 0, 0, 0);
    139         pLayout->setColumnStretch(0, 1);
    140         pLayout->setColumnStretch(1, 1);
    141         pLayout->setColumnStretch(2, 0);
    142 
    143         /* Create size slider: */
    144         m_pSlider = new QSlider(this);
    145         if (m_pSlider)
    146         {
    147             /* Configure slider: */
    148             m_pSlider->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    149             m_pSlider->setOrientation(Qt::Horizontal);
    150             m_pSlider->setTickPosition(QSlider::TicksBelow);
    151             m_pSlider->setFocusPolicy(Qt::StrongFocus);
    152             m_pSlider->setPageStep(m_iSliderScale);
    153             m_pSlider->setSingleStep(m_iSliderScale / 8);
    154             m_pSlider->setTickInterval(0);
    155             m_pSlider->setMinimum(sizeMBToSlider(m_uSizeMin, m_iSliderScale));
    156             m_pSlider->setMaximum(sizeMBToSlider(m_uSizeMax, m_iSliderScale));
    157             connect(m_pSlider, &QSlider::valueChanged,
    158                     this, &UIMediumSizeEditor::sltSizeSliderChanged);
    159 
    160             /* Add into layout: */
    161             pLayout->addWidget(m_pSlider, 0, 0, 1, 2, Qt::AlignTop);
    162         }
    163 
    164         /* Create minimum size label: */
    165         m_pLabelMinSize = new QLabel;
    166         if (m_pLabelMinSize)
    167         {
    168             /* Configure label: */
    169             m_pLabelMinSize->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    170 
    171             /* Add into layout: */
    172             pLayout->addWidget(m_pLabelMinSize, 1, 0);
    173         }
    174 
    175         /* Create maximum size label: */
    176         m_pLabelMaxSize = new QLabel;
    177         if (m_pLabelMaxSize)
    178         {
    179             /* Configure label: */
    180             m_pLabelMaxSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    181 
    182             /* Add into layout: */
    183             pLayout->addWidget(m_pLabelMaxSize, 1, 1);
    184         }
    185 
    186         /* Create size editor: */
    187         m_pEditor = new QILineEdit;
    188         if (m_pEditor)
    189         {
    190             /* Configure editor: */
    191             m_pEditor->installEventFilter(this);
    192             m_pEditor->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    193             m_pEditor->setFixedWidthByText("88888.88 MB");
    194             m_pEditor->setAlignment(Qt::AlignRight);
    195             m_pEditor->setValidator(new QRegularExpressionValidator(QRegularExpression(UITranslator::sizeRegexp()), this));
    196             connect(m_pEditor, &QILineEdit::textChanged,
    197                     this, &UIMediumSizeEditor::sltSizeEditorTextChanged);
    198 
    199             /* Add into layout: */
    200             pLayout->addWidget(m_pEditor, 0, 2, Qt::AlignTop);
    201         }
    202     }
    203 
    204     /* Apply language settings: */
    205     sltRetranslateUI();
    206     connect(&translationEventListener(), &UITranslationEventListener::sigRetranslateUI,
    207             this, &UIMediumSizeEditor::sltRetranslateUI);
    208 }
    209 
    210 /* static */
    211 int UIMediumSizeEditor::calculateSliderScale(qulonglong uMaximumMediumSize)
     45/*********************************************************************************************************************************
     46*   Class UIMediumSizeSlider implementation.                                                                                     *
     47*********************************************************************************************************************************/
     48
     49UIMediumSizeSlider::UIMediumSizeSlider(qulonglong uSizeMax, QWidget *pParent /* = 0 */)
     50    : QSlider(pParent)
     51    , m_iSliderScale(calculateSliderScale(uSizeMax))
     52    , m_uScaledMinimum(0)
     53    , m_uScaledMaximum(100)
     54    , m_uScaledValue(0)
     55{
     56    /* Configure basic properties: */
     57    setFocusPolicy(Qt::StrongFocus);
     58    setOrientation(Qt::Horizontal);
     59    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     60
     61    /* Configure tick look&feel: */
     62    setTickPosition(QSlider::TicksBelow);
     63    setTickInterval(0);
     64
     65    /* Configure scaling: */
     66    setPageStep(m_iSliderScale);
     67    setSingleStep(m_iSliderScale / 8);
     68
     69    /* Connection converting usual value into scaled one: */
     70    connect(this, &UIMediumSizeSlider::valueChanged,
     71            this, &UIMediumSizeSlider::sltValueChanged);
     72}
     73
     74void UIMediumSizeSlider::setScaledMinimum(qulonglong uMinimum)
     75{
     76    /* Make sure something got changed and save the change: */
     77    if (m_uScaledMinimum == uMinimum)
     78        return;
     79    m_uScaledMinimum = uMinimum;
     80    /* Call to base-class: */
     81    QSlider::setMinimum(sizeMBToSlider(m_uScaledMinimum, m_iSliderScale));
     82}
     83
     84void UIMediumSizeSlider::setScaledMaximum(qulonglong uMaximum)
     85{
     86    /* Make sure something got changed and save the change: */
     87    if (m_uScaledMaximum == uMaximum)
     88        return;
     89    m_uScaledMaximum = uMaximum;
     90    /* Call to base-class: */
     91    QSlider::setMaximum(sizeMBToSlider(m_uScaledMaximum, m_iSliderScale));
     92}
     93
     94void UIMediumSizeSlider::setScaledValue(qulonglong uValue)
     95{
     96    /* Make sure something got changed and save the change: */
     97    if (m_uScaledValue == uValue)
     98        return;
     99    m_uScaledValue = uValue;
     100    /* Call to base-class: */
     101    QSlider::setValue(sizeMBToSlider(m_uScaledValue, m_iSliderScale));
     102}
     103
     104void UIMediumSizeSlider::sltValueChanged(int iValue)
     105{
     106    /* Convert from usual to scaled value: */
     107    emit sigScaledValueChanged(sliderToSizeMB(iValue, m_iSliderScale));
     108}
     109
     110/* static */
     111int UIMediumSizeSlider::calculateSliderScale(qulonglong uMaximumMediumSize)
    212112{
    213113    /* Detect how many steps to recognize between adjacent powers of 2
    214114     * to ensure that the last slider step is exactly that we need: */
    215115    int iSliderScale = 0;
    216     int iPower = log2i(uMaximumMediumSize);
     116    const int iPower = log2i(uMaximumMediumSize);
    217117    qulonglong uTickMB = (qulonglong)1 << iPower;
    218118    if (uTickMB < uMaximumMediumSize)
     
    235135
    236136/* static */
    237 int UIMediumSizeEditor::log2i(qulonglong uValue)
     137int UIMediumSizeSlider::log2i(qulonglong uValue)
    238138{
    239139    if (!uValue)
     
    249149
    250150/* static */
    251 int UIMediumSizeEditor::sizeMBToSlider(qulonglong uValue, int iSliderScale)
     151int UIMediumSizeSlider::sizeMBToSlider(qulonglong uValue, int iSliderScale)
    252152{
    253153    /* Make sure *any* slider value is multiple of s_uSectorSize: */
    254     uValue /= s_uSectorSize;
     154    uValue /= UIMediumSizeEditor::s_uSectorSize;
    255155
    256156    /* Calculate result: */
    257     int iPower = log2i(uValue);
    258     qulonglong uTickMB = qulonglong (1) << iPower;
    259     qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
    260     int iStep = (uValue - uTickMB) * iSliderScale / (uTickMBNext - uTickMB);
    261     int iResult = iPower * iSliderScale + iStep;
     157    const int iPower = log2i(uValue);
     158    const qulonglong uTickMB = qulonglong (1) << iPower;
     159    const qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
     160    const int iStep = (uValue - uTickMB) * iSliderScale / (uTickMBNext - uTickMB);
     161    const int iResult = iPower * iSliderScale + iStep;
    262162
    263163    /* Return result: */
     
    266166
    267167/* static */
    268 qulonglong UIMediumSizeEditor::sliderToSizeMB(int uValue, int iSliderScale)
     168qulonglong UIMediumSizeSlider::sliderToSizeMB(int uValue, int iSliderScale)
    269169{
    270170    /* Calculate result: */
    271     int iPower = uValue / iSliderScale;
    272     int iStep = uValue % iSliderScale;
    273     qulonglong uTickMB = qulonglong (1) << iPower;
    274     qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
     171    const int iPower = uValue / iSliderScale;
     172    const int iStep = uValue % iSliderScale;
     173    const qulonglong uTickMB = qulonglong (1) << iPower;
     174    const qulonglong uTickMBNext = qulonglong (1) << (iPower + 1);
    275175    qulonglong uResult = uTickMB + (uTickMBNext - uTickMB) * iStep / iSliderScale;
    276176
    277177    /* Make sure *any* slider value is multiple of s_uSectorSize: */
    278     uResult *= s_uSectorSize;
     178    uResult *= UIMediumSizeEditor::s_uSectorSize;
    279179
    280180    /* Return result: */
    281181    return uResult;
     182}
     183
     184
     185/*********************************************************************************************************************************
     186*   Class UIMediumSizeEditor implementation.                                                                                     *
     187*********************************************************************************************************************************/
     188
     189/* static */
     190const qulonglong UIMediumSizeEditor::s_uSectorSize = 512;
     191
     192UIMediumSizeEditor::UIMediumSizeEditor(QWidget *pParent, qulonglong uMinimumSize /* = _4M */)
     193    : QWidget(pParent)
     194    , m_uSizeMin(uMinimumSize)
     195    , m_uSizeMax(gpGlobalSession->virtualBox().GetSystemProperties().GetInfoVDSize())
     196    , m_uSize(0)
     197    , m_pSlider(0)
     198    , m_pLabelMinSize(0)
     199    , m_pLabelMaxSize(0)
     200    , m_pEditor(0)
     201{
     202    prepare();
     203}
     204
     205void UIMediumSizeEditor::setMediumSize(qulonglong uSize)
     206{
     207    /* Remember the new size: */
     208    m_uSize = uSize;
     209
     210    /* And assign it to the slider & editor: */
     211    m_pSlider->blockSignals(true);
     212    m_pSlider->setScaledValue(m_uSize);
     213    m_pSlider->blockSignals(false);
     214    m_pEditor->blockSignals(true);
     215    m_pEditor->setText(UITranslator::formatSize(m_uSize));
     216    m_strSizeSuffix = gpConverter->toString(UITranslator::parseSizeSuffix(m_pEditor->text()));
     217    m_pEditor->blockSignals(false);
     218    updateSizeToolTips(m_uSize);
     219}
     220
     221void UIMediumSizeEditor::sltRetranslateUI()
     222{
     223    /* Translate labels: */
     224    m_pLabelMinSize->setText(UITranslator::formatSize(m_uSizeMin));
     225    m_pLabelMaxSize->setText(UITranslator::formatSize(m_uSizeMax));
     226
     227    /* Translate fields: */
     228    m_pSlider->setToolTip(tr("Holds the size of this medium."));
     229    m_pEditor->setToolTip(tr("Holds the size of this medium."));
     230    m_pLabelMinSize->setToolTip(tr("Minimum size for this medium."));
     231    m_pLabelMaxSize->setToolTip(tr("Maximum size for this medium."));
     232}
     233
     234void UIMediumSizeEditor::sltSizeSliderChanged(qulonglong uValue)
     235{
     236    /* Update the current size: */
     237    m_uSize = uValue;
     238    /* Update the other widget: */
     239    m_pEditor->blockSignals(true);
     240    m_pEditor->setText(UITranslator::formatSize(m_uSize));
     241    m_strSizeSuffix = gpConverter->toString(UITranslator::parseSizeSuffix(m_pEditor->text()));
     242    m_pEditor->blockSignals(false);
     243    updateSizeToolTips(m_uSize);
     244    /* Notify the listeners: */
     245    emit sigSizeChanged(m_uSize);
     246}
     247
     248void UIMediumSizeEditor::sltSizeEditorTextChanged()
     249{
     250    QString strSizeString = ensureSizeSuffix(m_pEditor->text());
     251
     252    m_pEditor->blockSignals(true);
     253    int iCursorPosition = m_pEditor->cursorPosition();
     254    m_pEditor->setText(strSizeString);
     255    m_pEditor->setCursorPosition(iCursorPosition);
     256    m_pEditor->blockSignals(false);
     257
     258    /* Update the current size: */
     259    m_uSize = checkSectorSizeAlignment(UITranslator::parseSize(strSizeString));
     260
     261    /* Update the other widget: */
     262    m_pSlider->blockSignals(true);
     263    m_pSlider->setScaledValue(m_uSize);
     264    m_pSlider->blockSignals(false);
     265    updateSizeToolTips(m_uSize);
     266    /* Notify the listeners: */
     267    emit sigSizeChanged(m_uSize);
     268}
     269
     270void UIMediumSizeEditor::prepare()
     271{
     272    /* Configure reg-exp: */
     273    m_regExNonDigitOrSeparator = QRegularExpression(QString("[^\\d%1]").arg(UITranslator::decimalSep()));
     274
     275    /* Create layout: */
     276    QGridLayout *pLayout = new QGridLayout(this);
     277    if (pLayout)
     278    {
     279        /* Configure layout: */
     280        pLayout->setContentsMargins(0, 0, 0, 0);
     281        pLayout->setColumnStretch(0, 1);
     282        pLayout->setColumnStretch(1, 1);
     283        pLayout->setColumnStretch(2, 0);
     284
     285        /* Create size slider: */
     286        m_pSlider = new UIMediumSizeSlider(m_uSizeMax, this);
     287        if (m_pSlider)
     288        {
     289            /* Configure slider: */
     290            m_pSlider->setScaledMinimum(m_uSizeMin);
     291            m_pSlider->setScaledMaximum(m_uSizeMax);
     292            connect(m_pSlider, &UIMediumSizeSlider::sigScaledValueChanged,
     293                    this, &UIMediumSizeEditor::sltSizeSliderChanged);
     294
     295            /* Add into layout: */
     296            pLayout->addWidget(m_pSlider, 0, 0, 1, 2, Qt::AlignTop);
     297        }
     298
     299        /* Create minimum size label: */
     300        m_pLabelMinSize = new QLabel;
     301        if (m_pLabelMinSize)
     302        {
     303            /* Configure label: */
     304            m_pLabelMinSize->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
     305
     306            /* Add into layout: */
     307            pLayout->addWidget(m_pLabelMinSize, 1, 0);
     308        }
     309
     310        /* Create maximum size label: */
     311        m_pLabelMaxSize = new QLabel;
     312        if (m_pLabelMaxSize)
     313        {
     314            /* Configure label: */
     315            m_pLabelMaxSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     316
     317            /* Add into layout: */
     318            pLayout->addWidget(m_pLabelMaxSize, 1, 1);
     319        }
     320
     321        /* Create size editor: */
     322        m_pEditor = new QILineEdit;
     323        if (m_pEditor)
     324        {
     325            /* Configure editor: */
     326            m_pEditor->installEventFilter(this);
     327            m_pEditor->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
     328            m_pEditor->setFixedWidthByText("88888.88 MB");
     329            m_pEditor->setAlignment(Qt::AlignRight);
     330            m_pEditor->setValidator(new QRegularExpressionValidator(QRegularExpression(UITranslator::sizeRegexp()), this));
     331            connect(m_pEditor, &QILineEdit::textChanged,
     332                    this, &UIMediumSizeEditor::sltSizeEditorTextChanged);
     333
     334            /* Add into layout: */
     335            pLayout->addWidget(m_pEditor, 0, 2, Qt::AlignTop);
     336        }
     337    }
     338
     339    /* Apply language settings: */
     340    sltRetranslateUI();
     341    connect(&translationEventListener(), &UITranslationEventListener::sigRetranslateUI,
     342            this, &UIMediumSizeEditor::sltRetranslateUI);
    282343}
    283344
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediumSizeEditor.h

    r104926 r104928  
    3434/* Qt includes: */
    3535#include <QRegularExpression>
     36#include <QSlider>
    3637#include <QWidget>
    3738
     
    4142/* Forward declarations: */
    4243class QLabel;
    43 class QSlider;
    4444class QString;
    4545class QWidget;
    4646class QILineEdit;
     47
     48/** QSlider sub-class used as logarithmic-scaled medium size editor. */
     49class UIMediumSizeSlider : public QSlider
     50{
     51    Q_OBJECT;
     52
     53signals:
     54
     55    /** Notifies about scaled @a uValue change. */
     56    void sigScaledValueChanged(qulonglong uValue);
     57
     58public:
     59
     60    /** Constructs medium size slider passing @a pParent to the base-class.
     61      * @param  uSizeMax  Brings the maximum value to adjust slider scaling accordingly. */
     62    UIMediumSizeSlider(qulonglong uSizeMax, QWidget *pParent = 0);
     63
     64    /** Defines scaled @a uMinimum. */
     65    void setScaledMinimum(qulonglong uMinimum);
     66    /** Defines scaled @a uMaximum. */
     67    void setScaledMaximum(qulonglong uMaximum);
     68    /** Defines scaled @a uValue. */
     69    void setScaledValue(qulonglong uValue);
     70
     71private slots:
     72
     73    /** Handles the signal about @a iValue change. */
     74    void sltValueChanged(int iValue);
     75
     76private:
     77
     78    /** Calculates slider scale according to passed @a uMaximumMediumSize. */
     79    static int calculateSliderScale(qulonglong uMaximumMediumSize);
     80    /** Returns log2 for passed @a uValue. */
     81    static int log2i(qulonglong uValue);
     82
     83    /** Converts passed bytes @a uValue to slides scaled value using @a iSliderScale. */
     84    static int sizeMBToSlider(qulonglong uValue, int iSliderScale);
     85    /** Converts passed slider @a uValue to bytes unscaled value using @a iSliderScale. */
     86    static qulonglong sliderToSizeMB(int uValue, int iSliderScale);
     87
     88    /** Holds the slider scale. */
     89    const int  m_iSliderScale;
     90
     91    /** Holds the scaled minimum. */
     92    qulonglong  m_uScaledMinimum;
     93    /** Holds the scaled maximum. */
     94    qulonglong  m_uScaledMaximum;
     95    /** Holds the scaled value. */
     96    qulonglong  m_uScaledValue;
     97};
    4798
    4899/** Medium size editor widget. */
     
    57108
    58109public:
     110
     111    /* Holds the block size. We force m_uSize to be multiple of this number. */
     112    static const qulonglong  s_uSectorSize;
    59113
    60114    /** Constructs medium size editor passing @a pParent to the base-class. */
     
    72126
    73127    /** Handles size slider change. */
    74     void sltSizeSliderChanged(int iValue);
     128    void sltSizeSliderChanged(qulonglong uValue);
    75129    /** Handles size editor text edit finished signal. */
    76130    void sltSizeEditorTextChanged();
     
    81135    void prepare();
    82136
    83     /** Calculates slider scale according to passed @a uMaximumMediumSize. */
    84     static int calculateSliderScale(qulonglong uMaximumMediumSize);
    85     /** Returns log2 for passed @a uValue. */
    86     static int log2i(qulonglong uValue);
    87     /** Converts passed bytes @a uValue to slides scaled value using @a iSliderScale. */
    88     static int sizeMBToSlider(qulonglong uValue, int iSliderScale);
    89     /** Converts passed slider @a uValue to bytes unscaled value using @a iSliderScale. */
    90     static qulonglong sliderToSizeMB(int uValue, int iSliderScale);
    91137    /** Updates slider/editor tool-tips. */
    92138    void updateSizeToolTips(qulonglong uSize);
     
    96142    QString ensureSizeSuffix(const QString &strSizeString);
    97143
    98     /* Holds the block size. We force m_uSize to be multiple of this number. */
    99     static const qulonglong  s_uSectorSize;
    100144    /** Holds the minimum medium size. */
    101145    const qulonglong  m_uSizeMin;
    102146    /** Holds the maximum medium size. */
    103147    const qulonglong  m_uSizeMax;
    104     /** Holds the slider scale. */
    105     const int         m_iSliderScale;
    106148    /** Holds the current medium size. */
    107149    qulonglong        m_uSize;
     
    110152
    111153    /** Holds the size slider. */
    112     QSlider    *m_pSlider;
     154    UIMediumSizeSlider *m_pSlider;
    113155    /** Holds the minimum size label. */
    114     QLabel     *m_pLabelMinSize;
     156    QLabel             *m_pLabelMinSize;
    115157    /** Holds the maximum size label. */
    116     QLabel     *m_pLabelMaxSize;
     158    QLabel             *m_pLabelMaxSize;
    117159    /** Holds the size editor. */
    118     QILineEdit *m_pEditor;
     160    QILineEdit         *m_pEditor;
    119161
    120162    /* A regular expression used to remove any character from a QString which is neither a digit nor decimal separator. */
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