tools/configure/tools.cpp
changeset 37 758a864f9613
parent 18 2f34d5167611
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    89         while (!buffer.isEmpty()) {
    89         while (!buffer.isEmpty()) {
    90             if( buffer[ 0 ] != '#' ) {
    90             if( buffer[ 0 ] != '#' ) {
    91                 QStringList components = buffer.split( '=' );
    91                 QStringList components = buffer.split( '=' );
    92                 if ( components.size() >= 2 ) {
    92                 if ( components.size() >= 2 ) {
    93                     QStringList::Iterator it = components.begin();
    93                     QStringList::Iterator it = components.begin();
    94                     QString key = (*it++).trimmed().replace( "\"", QString() ).toUpper();
    94                     QString key = (*it++).trimmed().remove('"').toUpper();
    95                     QString value = (*it++).trimmed().replace( "\"", QString() );
    95                     QString value = (*it++).trimmed().remove('"');
    96                     licenseInfo[ key ] = value;
    96                     licenseInfo[ key ] = value;
    97                 }
    97                 }
    98             }
    98             }
    99             // read next line
    99             // read next line
   100             buffer = licenseFile.readLine(1024);
   100             buffer = licenseFile.readLine(1024);
   109     }
   109     }
   110 
   110 
   111     // Verify license info...
   111     // Verify license info...
   112     QString licenseKey = licenseInfo["LICENSEKEYEXT"];
   112     QString licenseKey = licenseInfo["LICENSEKEYEXT"];
   113     QByteArray clicenseKey = licenseKey.toLatin1();
   113     QByteArray clicenseKey = licenseKey.toLatin1();
   114     //We check the licence
   114     //We check the license
   115     static const char * const SEP = "-";
   115     static const char * const SEP = "-";
   116     char *licenseParts[NUMBER_OF_PARTS];
   116     char *licenseParts[NUMBER_OF_PARTS];
   117     int partNumber = 0;
   117     int partNumber = 0;
   118     for (char *part = strtok(clicenseKey.data(), SEP); part != 0; part = strtok(0, SEP))
   118     for (char *part = strtok(clicenseKey.data(), SEP); part != 0; part = strtok(0, SEP))
   119         licenseParts[partNumber++] = part;
   119         licenseParts[partNumber++] = part;
   216     if (dictionary["EDITION"] == "Evaluation")
   216     if (dictionary["EDITION"] == "Evaluation")
   217         dictionary["LICENSE_EXTENSION"] = "-EVALUATION";
   217         dictionary["LICENSE_EXTENSION"] = "-EVALUATION";
   218 
   218 
   219     if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) {
   219     if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) {
   220         // Generic, no-suffix license
   220         // Generic, no-suffix license
   221         dictionary["LICENSE_EXTENSION"] = QString();
   221         dictionary["LICENSE_EXTENSION"].clear();
   222     } else if (dictionary["LICENSE_EXTENSION"].isEmpty()) {
   222     } else if (dictionary["LICENSE_EXTENSION"].isEmpty()) {
   223         cout << "License file does not contain proper license key." << endl;
   223         cout << "License file does not contain proper license key." << endl;
   224         dictionary["DONE"] = "error";
   224         dictionary["DONE"] = "error";
   225     }
   225     }
   226     if (licenseType.isEmpty()
   226     if (licenseType.isEmpty()
   237     if (licenseFeatures == 'B' || licenseFeatures == 'G'
   237     if (licenseFeatures == 'B' || licenseFeatures == 'G'
   238         || licenseFeatures == 'L' || licenseFeatures == 'Y')
   238         || licenseFeatures == 'L' || licenseFeatures == 'Y')
   239         fromLicenseFile += "-US";
   239         fromLicenseFile += "-US";
   240 
   240 
   241     if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(),
   241     if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(),
   242         (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), FALSE)) {
   242         (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), false)) {
   243         cout << "Failed to copy license file (" << fromLicenseFile << ")";
   243         cout << "Failed to copy license file (" << fromLicenseFile << ")";
   244         dictionary["DONE"] = "error";
   244         dictionary["DONE"] = "error";
   245         return;
   245         return;
   246     }
   246     }
   247     dictionary["LICENSE FILE"] = toLicenseFile;
   247     dictionary["LICENSE FILE"] = toLicenseFile;