VirtualBox

Changeset 70830 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 31, 2018 1:22:39 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9104: Move a bit of copy-pasted code from downloaders to UIVersion class to be reused.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIVersion.h

    r70827 r70830  
    8686    int z() const { return m_z; }
    8787
     88    /** Defines the object X value. */
     89    void setX(int x) { m_x = x; }
     90    /** Defines the object Y value. */
     91    void setY(int y) { m_y = y; }
     92    /** Defines the object Z value. */
     93    void setZ(int z) { m_z = z; }
     94
     95    /** Returns effective released version guessed or hardcoded for this one version.
     96      * This can be even the version itself. */
     97    UIVersion effectiveRelasedVersion() const
     98    {
     99        /* First, we just copy the current one: */
     100        UIVersion version = *this;
     101
     102        /* If this version being developed: */
     103        if (version.z() % 2 == 1)
     104        {
     105            /* If this version being developed on release branch (we guess the right one): */
     106            if (version.z() < 97)
     107                version.setZ(version.z() - 1);
     108            /* If this version being developed on trunk (we use hardcoded one for now): */
     109            else
     110                version.setZ(6); /* Current .z for 5.2.z */
     111        }
     112
     113        /* Finally, we just return that we have:  */
     114        return version;
     115    }
     116
    88117private:
    89118
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp

    r70724 r70830  
    3131# include "UIMessageCenter.h"
    3232# include "UIModalWindowManager.h"
     33# include "UIVersion.h"
    3334
    3435#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    6162        m_spInstance = this;
    6263
    63     /* Get version number and adjust it for test and trunk builds,
    64      * both have odd build numbers. The server only has official releases. */
    65     QString strVersion = vboxGlobal().vboxVersionStringNormalized();
    66     const QChar qchLastDigit = strVersion[strVersion.length() - 1];
    67     if (   qchLastDigit == '1'
    68         || qchLastDigit == '3'
    69         || qchLastDigit == '5'
    70         || qchLastDigit == '7'
    71         || qchLastDigit == '9')
    72     {
    73         if (   !strVersion.endsWith(".51")
    74             && !strVersion.endsWith(".53")
    75             && !strVersion.endsWith(".97")
    76             && !strVersion.endsWith(".99"))
    77             strVersion[strVersion.length() - 1] = qchLastDigit.toLatin1() - 1;
    78         else
    79         {
    80             strVersion.chop(2);
    81             strVersion += "6"; /* Current for 5.2.x */
    82         }
    83     }
     64    /* Get version number and adjust it for test and trunk builds. The server only has official releases. */
     65    const QString strVersion = UIVersion(vboxGlobal().vboxVersionStringNormalized()).effectiveRelasedVersion().toString();
    8466
    8567    /* Prepare source/target: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp

    r70722 r70830  
    3131# include "UIMessageCenter.h"
    3232# include "UIModalWindowManager.h"
     33# include "UIVersion.h"
    3334
    3435#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    6162        m_spInstance = this;
    6263
    63     /* Get version number and adjust it for test and trunk builds,
    64      * both have odd build numbers. The server only has official releases. */
    65     QString strVersion = vboxGlobal().vboxVersionStringNormalized();
    66     const QChar qchLastDigit = strVersion[strVersion.length() - 1];
    67     if (   qchLastDigit == '1'
    68         || qchLastDigit == '3'
    69         || qchLastDigit == '5'
    70         || qchLastDigit == '7'
    71         || qchLastDigit == '9')
    72     {
    73         if (   !strVersion.endsWith(".51")
    74             && !strVersion.endsWith(".53")
    75             && !strVersion.endsWith(".97")
    76             && !strVersion.endsWith(".99"))
    77             strVersion[strVersion.length() - 1] = qchLastDigit.toLatin1() - 1;
    78         else
    79         {
    80             strVersion.chop(2);
    81             strVersion += "6"; /* Current for 5.2.x */
    82         }
    83     }
     64    /* Get version number and adjust it for test and trunk builds. The server only has official releases. */
     65    const QString strVersion = UIVersion(vboxGlobal().vboxVersionStringNormalized()).effectiveRelasedVersion().toString();
    8466
    8567    /* Prepare source/target: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.cpp

    r70725 r70830  
    3131# include "UIMessageCenter.h"
    3232# include "UIModalWindowManager.h"
     33# include "UIVersion.h"
    3334
    3435#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    5859        m_spInstance = this;
    5960
    60     /* Get version number and adjust it for test and trunk builds,
    61      * both have odd build numbers. The server only has official releases. */
    62     QString strVersion = vboxGlobal().vboxVersionStringNormalized();
    63     const QChar qchLastDigit = strVersion[strVersion.length() - 1];
    64     if (   qchLastDigit == '1'
    65         || qchLastDigit == '3'
    66         || qchLastDigit == '5'
    67         || qchLastDigit == '7'
    68         || qchLastDigit == '9')
    69     {
    70         if (   !strVersion.endsWith(".51")
    71             && !strVersion.endsWith(".53")
    72             && !strVersion.endsWith(".97")
    73             && !strVersion.endsWith(".99"))
    74             strVersion[strVersion.length() - 1] = qchLastDigit.toLatin1() - 1;
    75         else
    76         {
    77             strVersion.chop(2);
    78             strVersion += "6"; /* Current for 5.2.x */
    79         }
    80     }
     61    /* Get version number and adjust it for test and trunk builds. The server only has official releases. */
     62    const QString strVersion = UIVersion(vboxGlobal().vboxVersionStringNormalized()).effectiveRelasedVersion().toString();
    8163
    8264    /* Compose User Manual filename: */
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