VirtualBox

Changeset 71528 in vbox


Ignore:
Timestamp:
Mar 27, 2018 4:30:31 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Heavy cleanup for UIUpdateDefs.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.cpp

    r70824 r71528  
    55
    66/*
    7  * Copyright (C) 2006-2017 Oracle Corporation
     7 * Copyright (C) 2006-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
    2121
    22 /* Global includes: */
     22/* Qt includes: */
    2323# include <QCoreApplication>
    2424# include <QStringList>
    2525
    26 /* Local includes: */
     26/* GUI includes: */
     27# include "VBoxGlobal.h"
    2728# include "UIUpdateDefs.h"
    28 # include "VBoxGlobal.h"
    2929
    3030#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    4040    m_dayList.clear();
    4141
    42     /* To avoid re-translation complexity
    43      * all values will be retranslated separately: */
     42    // WORKAROUND:
     43    // To avoid re-translation complexity
     44    // all values will be retranslated separately.
    4445
    4546    /* Separately retranslate each day: */
     
    6566    QStringList result;
    6667    for (int i = 0; i < m_dayList.size(); ++i)
    67         result << m_dayList[i].val;
     68        result << m_dayList.at(i).val;
    6869    return result;
    6970}
     
    7172VBoxUpdateData::VBoxUpdateData(const QString &strData)
    7273    : m_strData(strData)
    73     , m_periodIndex(Period1Day)
    74     , m_branchIndex(BranchStable)
     74    , m_enmPeriodIndex(Period1Day)
     75    , m_enmBranchIndex(BranchStable)
    7576{
    7677    decode();
    7778}
    7879
    79 VBoxUpdateData::VBoxUpdateData(PeriodType periodIndex, BranchType branchIndex)
     80VBoxUpdateData::VBoxUpdateData(PeriodType enmPeriodIndex, BranchType enmBranchIndex)
    8081    : m_strData(QString())
    81     , m_periodIndex(periodIndex)
    82     , m_branchIndex(branchIndex)
     82    , m_enmPeriodIndex(enmPeriodIndex)
     83    , m_enmBranchIndex(enmBranchIndex)
    8384{
    8485    encode();
     
    8889{
    8990    /* Return 'false' if Period == Never: */
    90     return m_periodIndex == PeriodNever;
     91    return m_enmPeriodIndex == PeriodNever;
    9192}
    9293
     
    116117VBoxUpdateData::PeriodType VBoxUpdateData::periodIndex() const
    117118{
    118     return m_periodIndex;
     119    return m_enmPeriodIndex;
    119120}
    120121
     
    126127VBoxUpdateData::BranchType VBoxUpdateData::branchIndex() const
    127128{
    128     return m_branchIndex;
     129    return m_enmBranchIndex;
    129130}
    130131
    131132QString VBoxUpdateData::branchName() const
    132133{
    133     switch (m_branchIndex)
     134    switch (m_enmBranchIndex)
    134135    {
    135136        case BranchStable:
     
    152153    /* Parse standard values: */
    153154    if (m_strData == "never")
    154         m_periodIndex = PeriodNever;
     155        m_enmPeriodIndex = PeriodNever;
    155156    /* Parse other values: */
    156157    else
     
    164165                populate();
    165166            PeriodType index = (PeriodType)m_dayList.indexOf(VBoxUpdateDay(QString(), parser[0]));
    166             m_periodIndex = index == PeriodUndefined ? Period1Day : index;
     167            m_enmPeriodIndex = index == PeriodUndefined ? Period1Day : index;
    167168        }
    168169
     
    178179        {
    179180            QString branch(parser[2]);
    180             m_branchIndex = branch == "withbetas" ? BranchWithBetas :
     181            m_enmBranchIndex = branch == "withbetas" ? BranchWithBetas :
    181182                            branch == "allrelease" ? BranchAllRelease : BranchStable;
    182183        }
     
    193194{
    194195    /* Encode standard values: */
    195     if (m_periodIndex == PeriodNever)
     196    if (m_enmPeriodIndex == PeriodNever)
    196197        m_strData = "never";
    197198    /* Encode other values: */
     
    201202        if (m_dayList.isEmpty())
    202203            populate();
    203         QString remindPeriod = m_dayList[m_periodIndex].key;
     204        QString remindPeriod = m_dayList[m_enmPeriodIndex].key;
    204205
    205206        /* Encode 'date' value: */
     
    215216
    216217        /* Encode 'branch' value: */
    217         QString branchValue = m_branchIndex == BranchWithBetas ? "withbetas" :
    218                               m_branchIndex == BranchAllRelease ? "allrelease" : "stable";
     218        QString branchValue = m_enmBranchIndex == BranchWithBetas ? "withbetas" :
     219                              m_enmBranchIndex == BranchAllRelease ? "allrelease" : "stable";
    219220
    220221        /* Encode 'version' value: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.h

    r70824 r71528  
    55
    66/*
    7  * Copyright (C) 2006-2017 Oracle Corporation
     7 * Copyright (C) 2006-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2626
    2727
    28 /* This structure is used to store retranslated reminder values. */
     28/** Structure to store retranslated reminder values. */
    2929struct VBoxUpdateDay
    3030{
     
    4040
    4141
    42 /* This class is used to encode/decode update data. */
     42/** Class used to encode/decode update data. */
    4343class VBoxUpdateData
    4444{
    4545public:
    4646
    47     /* Period types: */
     47    /** Period types. */
    4848    enum PeriodType
    4949    {
     
    6262    };
    6363
    64     /* Branch types: */
     64    /** Branch types. */
    6565    enum BranchType
    6666    {
     
    7070    };
    7171
    72     /* Public static helpers: */
     72    /** Populates a set of update options. */
    7373    static void populate();
     74    /** Returns a list of update options. */
    7475    static QStringList list();
    7576
    76     /* Constructors: */
     77    /** Constructs update description on the basis of passed @a strData. */
    7778    VBoxUpdateData(const QString &strData);
    78     VBoxUpdateData(PeriodType periodIndex, BranchType branchIndex);
     79    /** Constructs update description on the basis of passed @a enmPeriodIndex and @a enmBranchIndex. */
     80    VBoxUpdateData(PeriodType enmPeriodIndex, BranchType enmBranchIndex);
    7981
    80     /* Public helpers: */
     82    /** Returns whether there is no need to check. */
    8183    bool isNoNeedToCheck() const;
     84    /** Returns whether there is really need to check. */
    8285    bool isNeedToCheck() const;
     86    /** Returns update data. */
    8387    QString data() const;
     88    /** Returns period index. */
    8489    PeriodType periodIndex() const;
     90    /** Returns update date. */
    8591    QString date() const;
     92    /** Returns branch index. */
    8693    BranchType branchIndex() const;
     94    /** Returns period name. */
    8795    QString branchName() const;
     96    /** Returns version. */
    8897    UIVersion version() const;
    8998
    9099private:
    91100
    92     /* Private helpers: */
     101    /** Decodes data. */
    93102    void decode();
     103    /** Encodes data. */
    94104    void encode();
    95105
    96     /* Private variables: */
     106    /** Holds the populated list of update options. */
    97107    static VBoxUpdateDayList m_dayList;
    98     QString m_strData;
    99     PeriodType m_periodIndex;
    100     QDate m_date;
    101     BranchType m_branchIndex;
    102     UIVersion m_version;
     108
     109    /** Holds the update data. */
     110    QString     m_strData;
     111    /** Holds the update period index. */
     112    PeriodType  m_enmPeriodIndex;
     113    /** Holds the update date. */
     114    QDate       m_date;
     115    /** Holds the update branch index. */
     116    BranchType  m_enmBranchIndex;
     117    /** Holds the update version. */
     118    UIVersion   m_version;
    103119};
     120
    104121
    105122#endif /* !___UIUpdateDefs_h___ */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp

    r71461 r71528  
    3030# include "QIProcess.h"
    3131# include "VBoxGlobal.h"
    32 # include "VBoxLicenseViewer.h"
    3332# include "VBoxUtils.h"
    3433# include "UIDownloaderExtensionPack.h"
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