Changeset 561 for trunk/tools/configure/tools.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/tools/configure/tools.cpp
r2 r561 2 2 ** 3 3 ** 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]) 5 6 ** 6 7 ** This file is part of the tools applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 59 59 const QString &path) 60 60 { 61 62 63 64 65 66 67 61 68 QString tpLicense = dictionary["QT_SOURCE_TREE"] + "/LICENSE.PREVIEW.OPENSOURCE"; 62 69 if (QFile::exists(tpLicense)) { … … 104 111 // Verify license info... 105 112 QString licenseKey = licenseInfo["LICENSEKEYEXT"]; 106 const char *clicenseKey = licenseKey.toLatin1();113 clicenseKey = licenseKey.toLatin1(); 107 114 //We check the licence 108 #ifndef _WIN32_WCE109 char *buffer = strdup(clicenseKey);110 #else111 char *buffer = (char*) malloc(strlen(clicenseKey) + 1);112 strcpy(buffer, clicenseKey);113 #endif114 115 static const char * const SEP = "-"; 115 116 char *licenseParts[NUMBER_OF_PARTS]; 116 117 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)) 118 119 licenseParts[partNumber++] = part; 119 120 if (partNumber < (NUMBER_OF_PARTS-1)) { 120 121 dictionary["DONE"] = "error"; 121 122 cout << "License file does not contain proper license key." <<partNumber<< endl; 122 free(buffer);123 123 return; 124 124 } 125 125 126 126 char products = licenseParts[0][0]; 127 char platforms = licenseParts[1][0];127 char]; 128 128 char* licenseSchema = licenseParts[2]; 129 129 char licenseFeatures = licenseParts[3][0]; … … 143 143 dictionary["QT_EDITION"] = "QT_EDITION_DESKTOPLIGHT"; 144 144 } 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 }153 145 } else if (strcmp(licenseSchema,"Z4M") == 0 || strcmp(licenseSchema,"R4M") == 0 || strcmp(licenseSchema,"Q4M") == 0) { 154 146 if (products == 'B') { 155 147 dictionary["EDITION"] = "Evaluation"; 156 148 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"; 160 217 161 218 if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) { … … 174 231 } 175 232 176 if (dictionary["PLATFORM NAME"].contains("Windows CE")) {177 // verify that we are licensed to use Qt for Windows CE178 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 188 233 // copy one of .LICENSE-*(-US) to LICENSE 189 234 QString toLicenseFile = dictionary["QT_SOURCE_TREE"] + "/LICENSE"; 190 235 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') 192 238 fromLicenseFile += "-US"; 193 239 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)) { 199 242 cout << "Failed to copy license file (" << fromLicenseFile << ")"; 200 243 dictionary["DONE"] = "error"; … … 202 245 } 203 246 dictionary["LICENSE FILE"] = toLicenseFile; 204 free(buffer);205 247 } 206 248
Note:
See TracChangeset
for help on using the changeset viewer.