Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/configure/tools.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the tools applications of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5959                         const QString &path)
    6060{
     61
     62
     63
     64
     65
     66
     67
    6168    QString tpLicense = dictionary["QT_SOURCE_TREE"] + "/LICENSE.PREVIEW.OPENSOURCE";
    6269    if (QFile::exists(tpLicense)) {
     
    104111    // Verify license info...
    105112    QString licenseKey = licenseInfo["LICENSEKEYEXT"];
    106     const char * clicenseKey = licenseKey.toLatin1();
     113    clicenseKey = licenseKey.toLatin1();
    107114    //We check the licence
    108 #ifndef _WIN32_WCE
    109         char *buffer = strdup(clicenseKey);
    110 #else
    111         char *buffer = (char*) malloc(strlen(clicenseKey) + 1);
    112         strcpy(buffer, clicenseKey);
    113 #endif
    114115    static const char * const SEP = "-";
    115116    char *licenseParts[NUMBER_OF_PARTS];
    116117    int partNumber = 0;
    117     for (char *part = strtok(buffer, SEP); part != 0; part = strtok(0, SEP))
     118    for (char *part = strtok(, SEP); part != 0; part = strtok(0, SEP))
    118119        licenseParts[partNumber++] = part;
    119120    if (partNumber < (NUMBER_OF_PARTS-1)) {
    120121        dictionary["DONE"] = "error";
    121122        cout << "License file does not contain proper license key." <<partNumber<< endl;
    122         free(buffer);
    123123        return;
    124124    }
    125125
    126126    char products = licenseParts[0][0];
    127     char platforms = licenseParts[1][0];
     127    char];
    128128    char* licenseSchema = licenseParts[2];
    129129    char licenseFeatures = licenseParts[3][0];
     
    143143            dictionary["QT_EDITION"] = "QT_EDITION_DESKTOPLIGHT";
    144144        }
    145 
    146         if (platforms == 'X') {
    147             dictionary["LICENSE_EXTENSION"] = "-ALLOS";
    148         } else if (strchr("3679ACDEHJKMSUWX", platforms)) {
    149             dictionary["LICENSE_EXTENSION"] = "-EMBEDDED";
    150         } else if (strchr("4BFPQRTY", platforms)) {
    151             dictionary["LICENSE_EXTENSION"] = "-DESKTOP";
    152         }
    153145    } else if (strcmp(licenseSchema,"Z4M") == 0 || strcmp(licenseSchema,"R4M") == 0 || strcmp(licenseSchema,"Q4M") == 0) {
    154146        if (products == 'B') {
    155147            dictionary["EDITION"] = "Evaluation";
    156148            dictionary["QT_EDITION"] = "QT_EDITION_EVALUATION";
    157             dictionary["LICENSE_EXTENSION"] = "-EVALUATION";
    158         }
    159     }
     149        }
     150    }
     151
     152    if (platforms[2] == 'L') {
     153        static const char src[] = "8NPQRTZ";
     154        static const char dst[] = "UCWX9M7";
     155        const char *p = strchr(src, platforms[1]);
     156        platforms[1] = dst[p - src];
     157    }
     158
     159#define PL(a,b) (int(a)+int(b)*256)
     160    int platformCode = PL(platforms[0],platforms[1]);
     161    switch (platformCode) {
     162    case PL('X','9'):
     163    case PL('X','C'):
     164    case PL('X','U'):
     165    case PL('X','W'):
     166        case PL('X','M'): // old license key
     167        dictionary["LICENSE_EXTENSION"] = "-ALLOS";
     168        break;
     169
     170    case PL('6', 'M'):
     171    case PL('8', 'M'):
     172        case PL('K', 'M'): // old license key
     173    case PL('N', '7'):
     174    case PL('N', '9'):
     175    case PL('N', 'X'):
     176    case PL('S', '9'):
     177    case PL('S', 'C'):
     178    case PL('S', 'U'):
     179    case PL('S', 'W'):
     180        dictionary["LICENSE_EXTENSION"] = "-EMBEDDED";
     181        if (dictionary["PLATFORM NAME"].contains("Windows CE")
     182            && platformCode != PL('6', 'M') && platformCode != PL('S', '9')
     183            && platformCode != PL('S', 'C') && platformCode != PL('S', 'U')
     184            && platformCode != PL('S', 'W') && platformCode != PL('K', 'M')) {
     185            dictionary["DONE"] = "error";
     186        } else if (dictionary["PLATFORM NAME"].contains("Symbian")
     187                   && platformCode != PL('N', '9') && platformCode != PL('S', '9')
     188                   && platformCode != PL('S', 'C') && platformCode != PL('S', 'U')
     189                   && platformCode != PL('S', 'W')) {
     190            dictionary["DONE"] = "error";
     191        }
     192        break;
     193    case PL('R', 'M'):
     194    case PL('F', 'M'):
     195        dictionary["LICENSE_EXTENSION"] = "-DESKTOP";
     196        if (!dictionary["PLATFORM NAME"].endsWith("Windows")) {
     197            dictionary["DONE"] = "error";
     198        }
     199        break;
     200    default:
     201        dictionary["DONE"] = "error";
     202        break;
     203    }
     204#undef PL
     205
     206    if (dictionary.value("DONE") == "error") {
     207        cout << "You are not licensed for the " << dictionary["PLATFORM NAME"] << " platform." << endl << endl;
     208        cout << "Please contact [email protected] to upgrade your license" << endl;
     209        cout << "to include the " << dictionary["PLATFORM NAME"] << " platform, or install the" << endl;
     210        cout << "Qt Open Source Edition if you intend to develop free software." << endl;
     211        return;
     212    }
     213
     214    // Override for evaluation licenses
     215    if (dictionary["Edition"] == "Evaluation")
     216        dictionary["LICENSE_EXTENSION"] = "-EVALUATION";
    160217
    161218    if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) {
     
    174231    }
    175232
    176     if (dictionary["PLATFORM NAME"].contains("Windows CE")) {
    177         // verify that we are licensed to use Qt for Windows CE
    178         if (dictionary["LICENSE_EXTENSION"] != "-EMBEDDED" && dictionary["LICENSE_EXTENSION"] != "-ALLOS") {
    179             cout << "You are not licensed for the " << dictionary["PLATFORM NAME"] << " platform." << endl << endl;
    180             cout << "Please contact [email protected] to upgrade your license" << endl;
    181             cout << "to include the " << dictionary["PLATFORM NAME"] << " platform, or install the" << endl;
    182             cout << "Qt Open Source Edition if you intend to develop free software." << endl;
    183             dictionary["DONE"] = "error";
    184             return;
    185         }
    186     }
    187 
    188233    // copy one of .LICENSE-*(-US) to LICENSE
    189234    QString toLicenseFile   = dictionary["QT_SOURCE_TREE"] + "/LICENSE";
    190235    QString fromLicenseFile = dictionary["QT_SOURCE_TREE"] + "/.LICENSE" + dictionary["LICENSE_EXTENSION"];
    191     if (licenseFeatures == 'G') //US
     236    if (licenseFeatures == 'B' || licenseFeatures == 'G'
     237        || licenseFeatures == 'L' || licenseFeatures == 'Y')
    192238        fromLicenseFile += "-US";
    193239
    194     if (licenseFeatures == '5') //Floating
    195         dictionary["METERED LICENSE"] = "true";
    196 
    197     if (!CopyFileA(QDir::toNativeSeparators(fromLicenseFile).toLocal8Bit(),
    198         QDir::toNativeSeparators(toLicenseFile).toLocal8Bit(), FALSE)) {
     240    if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(),
     241        (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), FALSE)) {
    199242        cout << "Failed to copy license file (" << fromLicenseFile << ")";
    200243        dictionary["DONE"] = "error";
     
    202245    }
    203246    dictionary["LICENSE FILE"] = toLicenseFile;
    204     free(buffer);
    205247}
    206248
Note: See TracChangeset for help on using the changeset viewer.