| 1 |
/**************************************************************************** |
| 2 |
** |
| 3 |
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). |
| 4 |
** All rights reserved. |
| 5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
| 6 |
** |
| 7 |
** This file is part of the QtCore module of the Qt Toolkit. |
| 8 |
** |
| 9 |
** $QT_BEGIN_LICENSE:LGPL$ |
| 10 |
** GNU Lesser General Public License Usage |
| 11 |
** This file may be used under the terms of the GNU Lesser General Public |
| 12 |
** License version 2.1 as published by the Free Software Foundation and |
| 13 |
** appearing in the file LICENSE.LGPL included in the packaging of this |
| 14 |
** file. Please review the following information to ensure the GNU Lesser |
| 15 |
** General Public License version 2.1 requirements will be met: |
| 16 |
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 17 |
** |
| 18 |
** In addition, as a special exception, Nokia gives you certain additional |
| 19 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
| 20 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 21 |
** |
| 22 |
** GNU General Public License Usage |
| 23 |
** Alternatively, this file may be used under the terms of the GNU General |
| 24 |
** Public License version 3.0 as published by the Free Software Foundation |
| 25 |
** and appearing in the file LICENSE.GPL included in the packaging of this |
| 26 |
** file. Please review the following information to ensure the GNU General |
| 27 |
** Public License version 3.0 requirements will be met: |
| 28 |
** http://www.gnu.org/copyleft/gpl.html. |
| 29 |
** |
| 30 |
** Other Usage |
| 31 |
** Alternatively, this file may be used in accordance with the terms and |
| 32 |
** conditions contained in a signed written agreement between you and Nokia. |
| 33 |
** |
| 34 |
** |
| 35 |
** |
| 36 |
** |
| 37 |
** |
| 38 |
** $QT_END_LICENSE$ |
| 39 |
** |
| 40 |
****************************************************************************/ |
| 41 |
|
| 42 |
#include <qcoreevent.h> |
| 43 |
#include <qdatetime.h> |
| 44 |
#include <qlibraryinfo.h> |
| 45 |
#include <qobject.h> |
| 46 |
#include <qcoreapplication.h> |
| 47 |
|
| 48 |
#include "stdio.h" |
| 49 |
#include "stdlib.h" |
| 50 |
|
| 51 |
QT_BEGIN_NAMESPACE |
| 52 |
|
| 53 |
#include "qconfig_eval.cpp" |
| 54 |
|
| 55 |
static const char boilerplate_unsuported[] = |
| 56 |
"\nQt %1 Evaluation License\n" |
| 57 |
"Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).\n" |
| 58 |
"All rights reserved.\n\n" |
| 59 |
"This trial version may only be used for evaluation purposes\n" |
| 60 |
"and will shut down after 120 minutes.\n" |
| 61 |
"Registered to:\n" |
| 62 |
" Licensee: %2\n\n" |
| 63 |
"The evaluation expires in %4 days\n\n" |
| 64 |
"Contact http://qt.nokia.com/about/contact-us for pricing and purchasing information.\n"; |
| 65 |
|
| 66 |
static const char boilerplate_supported[] = |
| 67 |
"\nQt %1 Evaluation License\n" |
| 68 |
"Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).\n" |
| 69 |
"All rights reserved.\n\n" |
| 70 |
"This trial version may only be used for evaluation purposes\n" |
| 71 |
"Registered to:\n" |
| 72 |
" Licensee: %2\n\n" |
| 73 |
"The evaluation expires in %4 days\n\n" |
| 74 |
"Contact http://qt.nokia.com/about/contact-us for pricing and purchasing information.\n"; |
| 75 |
|
| 76 |
static const char boilerplate_expired[] = |
| 77 |
"This software is using the trial version of the Qt GUI toolkit.\n" |
| 78 |
"The trial period has expired. If you need more time to\n" |
| 79 |
"evaluate Qt, or if you have any questions about Qt, contact us\n" |
| 80 |
"at: http://qt.nokia.com/about/contact-us.\n\n"; |
| 81 |
|
| 82 |
static const char will_shutdown_1min[] = |
| 83 |
"\nThe evaluation of Qt will SHUT DOWN in 1 minute.\n" |
| 84 |
"Contact http://qt.nokia.com/about/contact-us for pricing and purchasing information.\n"; |
| 85 |
|
| 86 |
static const char will_shutdown_now[] = |
| 87 |
"\nThe evaluation of Qt has now reached its automatic\n" |
| 88 |
"timeout and will shut down.\n" |
| 89 |
"Contact http://qt.nokia.com/about/contact-us for pricing and purchasing information.\n"; |
| 90 |
|
| 91 |
static int qt_eval_is_supported() |
| 92 |
{ |
| 93 |
const volatile char *const license_key = qt_eval_key_data + 12; |
| 94 |
|
| 95 |
// fast fail |
| 96 |
if (!qt_eval_key_data[0] || !*license_key) |
| 97 |
return -1; |
| 98 |
|
| 99 |
// is this an unsupported evaluation? |
| 100 |
const volatile char *typecode = license_key; |
| 101 |
int field = 2; |
| 102 |
for ( ; field && *typecode; ++typecode) |
| 103 |
if (*typecode == '-') |
| 104 |
--field; |
| 105 |
|
| 106 |
if (!field && typecode[1] == '4' && typecode[2] == 'M') { |
| 107 |
if (typecode[0] == 'Q') |
| 108 |
return 0; |
| 109 |
else if (typecode[0] == 'R' || typecode[0] == 'Z') |
| 110 |
return 1; |
| 111 |
} |
| 112 |
return -1; |
| 113 |
} |
| 114 |
|
| 115 |
static int qt_eval_days_left() |
| 116 |
{ |
| 117 |
if (qt_eval_is_supported() < 0) |
| 118 |
return -2; |
| 119 |
|
| 120 |
QDate today = QDate::currentDate(); |
| 121 |
QDate build = QLibraryInfo::buildDate(); |
| 122 |
return qMax(-1, today.daysTo(build) + 30); |
| 123 |
} |
| 124 |
|
| 125 |
static QString qt_eval_string() |
| 126 |
{ |
| 127 |
const char *msg; |
| 128 |
switch (qt_eval_is_supported()) { |
| 129 |
case 0: |
| 130 |
msg = boilerplate_unsuported; |
| 131 |
break; |
| 132 |
case 1: |
| 133 |
msg = boilerplate_supported; |
| 134 |
break; |
| 135 |
default: |
| 136 |
return QString(); |
| 137 |
msg = 0; |
| 138 |
} |
| 139 |
|
| 140 |
return QString::fromLatin1(msg) |
| 141 |
.arg(QLatin1String(QT_VERSION_STR)) |
| 142 |
.arg(QLibraryInfo::licensee()) |
| 143 |
.arg(qt_eval_days_left()); |
| 144 |
} |
| 145 |
|
| 146 |
#define WARN_TIMEOUT 60 * 1000 * 119 |
| 147 |
#define KILL_DELAY 60 * 1000 * 1 |
| 148 |
|
| 149 |
class QCoreFuriCuri : public QObject |
| 150 |
{ |
| 151 |
public: |
| 152 |
|
| 153 |
int warn; |
| 154 |
int kill; |
| 155 |
|
| 156 |
QCoreFuriCuri() : QObject(), warn(-1), kill(-1) |
| 157 |
{ |
| 158 |
if (!qt_eval_is_supported()) { |
| 159 |
warn = startTimer(WARN_TIMEOUT); |
| 160 |
kill = 0; |
| 161 |
} |
| 162 |
} |
| 163 |
|
| 164 |
void timerEvent(QTimerEvent *e) { |
| 165 |
if (e->timerId() == warn) { |
| 166 |
killTimer(warn); |
| 167 |
fprintf(stderr, "%s\n", will_shutdown_1min); |
| 168 |
kill = startTimer(KILL_DELAY); |
| 169 |
} else if (e->timerId() == kill) { |
| 170 |
fprintf(stderr, "%s\n", will_shutdown_now); |
| 171 |
QCoreApplication::instance()->quit(); |
| 172 |
} |
| 173 |
} |
| 174 |
}; |
| 175 |
|
| 176 |
#if defined(QT_BUILD_CORE_LIB) || defined (QT_BOOTSTRAPPED) |
| 177 |
|
| 178 |
void qt_core_eval_init(uint type) |
| 179 |
{ |
| 180 |
if (!type) |
| 181 |
return; // GUI app |
| 182 |
|
| 183 |
switch (qt_eval_days_left()) { |
| 184 |
case -2: |
| 185 |
return; |
| 186 |
|
| 187 |
case -1: |
| 188 |
fprintf(stderr, "%s\n", boilerplate_expired); |
| 189 |
if (type == 0) { |
| 190 |
// if we're a console app only. |
| 191 |
exit(0); |
| 192 |
} |
| 193 |
|
| 194 |
default: |
| 195 |
fprintf(stderr, "%s\n", qPrintable(qt_eval_string())); |
| 196 |
if (type == 0) { |
| 197 |
Q_UNUSED(new QCoreFuriCuri()); |
| 198 |
} |
| 199 |
} |
| 200 |
} |
| 201 |
#endif |
| 202 |
|
| 203 |
#ifdef QT_BUILD_GUI_LIB |
| 204 |
|
| 205 |
QT_BEGIN_INCLUDE_NAMESPACE |
| 206 |
#include <qdialog.h> |
| 207 |
#include <qlabel.h> |
| 208 |
#include <qlayout.h> |
| 209 |
#include <qmessagebox.h> |
| 210 |
#include <qpushbutton.h> |
| 211 |
#include <qtimer.h> |
| 212 |
#include <qapplication.h> |
| 213 |
QT_END_INCLUDE_NAMESPACE |
| 214 |
|
| 215 |
|
| 216 |
static const char * const qtlogo_eval_xpm[] = { |
| 217 |
/* columns rows colors chars-per-pixel */ |
| 218 |
"46 55 174 2", |
| 219 |
" c #002E02", |
| 220 |
". c #00370D", |
| 221 |
"X c #003A0E", |
| 222 |
"o c #003710", |
| 223 |
"O c #013C13", |
| 224 |
"+ c #043E1A", |
| 225 |
"@ c #084F0A", |
| 226 |
"# c #0B520C", |
| 227 |
"$ c #054413", |
| 228 |
"% c #0C4C17", |
| 229 |
"& c #07421D", |
| 230 |
"* c #09451D", |
| 231 |
"= c #0D491E", |
| 232 |
"- c #125515", |
| 233 |
"; c #13541A", |
| 234 |
": c #17591B", |
| 235 |
"> c #1B5C1D", |
| 236 |
", c #1F611F", |
| 237 |
"< c #20621E", |
| 238 |
"1 c #337B1E", |
| 239 |
"2 c #0B4521", |
| 240 |
"3 c #0F4923", |
| 241 |
"4 c #114B24", |
| 242 |
"5 c #154D2A", |
| 243 |
"6 c #175323", |
| 244 |
"7 c #1C5924", |
| 245 |
"8 c #1C532F", |
| 246 |
"9 c #1E5432", |
| 247 |
"0 c #245936", |
| 248 |
"q c #265938", |
| 249 |
"w c #295C3B", |
| 250 |
"e c #246324", |
| 251 |
"r c #266823", |
| 252 |
"t c #2A6C24", |
| 253 |
"y c #276628", |
| 254 |
"u c #2D7026", |
| 255 |
"i c #327427", |
| 256 |
"p c #367927", |
| 257 |
"a c #37782A", |
| 258 |
"s c #397C2A", |
| 259 |
"d c #2E613E", |
| 260 |
"f c #336C37", |
| 261 |
"g c #2F6040", |
| 262 |
"h c #356545", |
| 263 |
"j c #3C6B4E", |
| 264 |
"k c #3F6C51", |
| 265 |
"l c #406E4F", |
| 266 |
"z c #406D52", |
| 267 |
"x c #477457", |
| 268 |
"c c #497557", |
| 269 |
"v c #4B7857", |
| 270 |
"b c #517B5E", |
| 271 |
"n c #3C8423", |
| 272 |
"m c #3E812C", |
| 273 |
"M c #53A61D", |
| 274 |
"N c #41862C", |
| 275 |
"B c #458A2D", |
| 276 |
"V c #498F2D", |
| 277 |
"C c #479324", |
| 278 |
"Z c #489226", |
| 279 |
"A c #4D952C", |
| 280 |
"S c #478B30", |
| 281 |
"D c #488C30", |
| 282 |
"F c #4D9232", |
| 283 |
"G c #509632", |
| 284 |
"H c #549A33", |
| 285 |
"J c #589F35", |
| 286 |
"K c #56A526", |
| 287 |
"L c #57A821", |
| 288 |
"P c #5BAA27", |
| 289 |
"I c #57A32A", |
| 290 |
"U c #5CA72E", |
| 291 |
"Y c #5DAB2A", |
| 292 |
"T c #5CA336", |
| 293 |
"R c #60AD2E", |
| 294 |
"E c #63B12D", |
| 295 |
"W c #65AF35", |
| 296 |
"Q c #62A53F", |
| 297 |
"! c #65AE39", |
| 298 |
"~ c #66B036", |
| 299 |
"^ c #6AB437", |
| 300 |
"/ c #67B138", |
| 301 |
"( c #6AB339", |
| 302 |
") c #6DB838", |
| 303 |
"_ c #70BA3C", |
| 304 |
"` c #4D8545", |
| 305 |
"' c #4E8942", |
| 306 |
"] c #548851", |
| 307 |
"[ c #6FAF4A", |
| 308 |
"{ c #6DB243", |
| 309 |
"} c #71B546", |
| 310 |
"| c #70B840", |
| 311 |
" . c #73B648", |
| 312 |
".. c #79BA4E", |
| 313 |
"X. c #7CBB53", |
| 314 |
"o. c #598266", |
| 315 |
"O. c #62886D", |
| 316 |
"+. c #6A8F75", |
| 317 |
"@. c #6B9173", |
| 318 |
"#. c #70937A", |
| 319 |
"$. c #799F79", |
| 320 |
"%. c #7BAF66", |
| 321 |
"&. c #81BD5B", |
| 322 |
"*. c #85BF60", |
| 323 |
"=. c #85AC7F", |
| 324 |
"-. c #8DBA7B", |
| 325 |
";. c #87C061", |
| 326 |
":. c #8AC364", |
| 327 |
">. c #8DC46A", |
| 328 |
",. c #90C56E", |
| 329 |
"<. c #93C771", |
| 330 |
"1. c #96CA73", |
| 331 |
"2. c #9ACB7C", |
| 332 |
"3. c #9FD07D", |
| 333 |
"4. c #779981", |
| 334 |
"5. c #7F9F89", |
| 335 |
"6. c #809F88", |
| 336 |
"7. c #82A18B", |
| 337 |
"8. c #86A192", |
| 338 |
"9. c #8DA994", |
| 339 |
"0. c #8FA998", |
| 340 |
"q. c #94AF9B", |
| 341 |
"w. c #97B991", |
| 342 |
"e. c #97B19E", |
| 343 |
"r. c #9DB6A3", |
| 344 |
"t. c #A3BCA7", |
| 345 |
"y. c #A6BCAB", |
| 346 |
"u. c #A9BEB1", |
| 347 |
"i. c #9ECD81", |
| 348 |
"p. c #A2CF85", |
| 349 |
"a. c #A5D284", |
| 350 |
"s. c #A6D189", |
| 351 |
"d. c #A9D28E", |
| 352 |
"f. c #ABD491", |
| 353 |
"g. c #B1D797", |
| 354 |
"h. c #B1D699", |
| 355 |
"j. c #B5D89E", |
| 356 |
"k. c #ADC5AC", |
| 357 |
"l. c #B1CAAE", |
| 358 |
"z. c #B9DAA3", |
| 359 |
"x. c #BDDDA8", |
| 360 |
"c. c #ADC1B4", |
| 361 |
"v. c #B2C6B6", |
| 362 |
"b. c #B5C6BC", |
| 363 |
"n. c #B6C9BA", |
| 364 |
"m. c #BCD1BA", |
| 365 |
"M. c #C6E1B4", |
| 366 |
"N. c #CDE5BD", |
| 367 |
"B. c #C2D2C6", |
| 368 |
"V. c #CADEC2", |
| 369 |
"C. c #C6D3CC", |
| 370 |
"Z. c #C8D7CB", |
| 371 |
"A. c #CEDAD2", |
| 372 |
"S. c #D2DDD4", |
| 373 |
"D. c #D3E9C6", |
| 374 |
"F. c #D7EBC9", |
| 375 |
"G. c #D9EBCD", |
| 376 |
"H. c #DEEED4", |
| 377 |
"J. c #D6E0D9", |
| 378 |
"K. c #DAE4DC", |
| 379 |
"L. c #E0EFD7", |
| 380 |
"P. c #E5F2DD", |
| 381 |
"I. c #DFE8E0", |
| 382 |
"U. c #E4EBE5", |
| 383 |
"Y. c #E9EFEA", |
| 384 |
"T. c #EDF4EB", |
| 385 |
"R. c #F0FAE6", |
| 386 |
"E. c #F1F8EC", |
| 387 |
"W. c #EDF0F0", |
| 388 |
"Q. c #F4F7F3", |
| 389 |
"!. c #F6F9F4", |
| 390 |
"~. c #F8FAF7", |
| 391 |
"^. c #FEFEFE", |
| 392 |
"/. c None", |
| 393 |
/* pixels */ |
| 394 |
"/././././.c h ' Q / W _ &.p././././././././././././././././././././././././././././././././.", |
| 395 |
"/././.4 O % Z ~ ~ W ~ W R U R R ( X.>.p././././././././././././././././././././././././././.", |
| 396 |
"/./.. * = J _ ~ ~ ~ ~ ~ / / / / W W U P P U W .;.2././././././././././././././././././././.", |
| 397 |
"/.= = & a ) W ~ ~ ~ ~ ~ / W / ~ ~ ~ ^ ( ( ^ ~ R R U P Y ~ .;.2././././././././././././././.", |
| 398 |
"O.O = = T ^ W ~ ~ ~ ~ ~ ~ W W / W ~ ~ ~ ~ ~ ~ ~ ( ( ( ( ~ W Y Y Y Y W { &.1././././././././.", |
| 399 |
"0 = * 7 ~ ~ ~ ~ ~ ~ ~ ~ ~ / / W ~ ~ ~ ~ ~ ~ ~ ~ W W W ~ ~ ~ ~ ( ( ( W W R U P U W { X.1.f./.", |
| 400 |
"= = & e ^ W ~ ~ ~ ~ ~ ~ ~ ~ / / ~ ~ ~ ~ ~ ~ ~ ~ W ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ^ ( ( / ~ W R U U Y ", |
| 401 |
"= = & e ^ W ~ ~ ~ ~ ~ ~ ~ ~ W W ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W ( W ~ ~ ~ ^ ^ ( ", |
| 402 |
"= = * e ^ W ~ ~ ~ ~ ~ ~ / W / W ! ( / ~ W ^ ( ( ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W ~ W W ~ ~ ~ ~ ~ ~ ", |
| 403 |
"= = & e ^ ! ~ ~ ~ ~ ~ ~ W W ^ _ ~ K Y W W R P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 443 |
"= = * e ( / ~ / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ W W W ! ( ( ( W W E U P Y W ( X.,.d./././././././././.", |
| 444 |
"= = * e ( W ~ ~ ~ ~ W ! ~ W ~ W ~ ( ( / ^ W W U Y P W ( X.,.d./././././././././././././././.", |
| 445 |
"8 $ * e ( W ~ ~ ~ ! ( ( ( / ( W R Y Y Y R ( X.>.d./././././././././././././././././././././.", |
| 446 |
"/.d . y ^ / / / ( W Y Y P P W ( X.>.d./././././././././././././././././././././././././././.", |
| 447 |
"/./.h : ^ R R R W ( X.<.f./././././././././././././././././././././././././././././././././.", |
| 448 |
"/././.] _ *.3./././././././././././././././././././././././././././././././././././././././." |
| 449 |
}; |
| 450 |
|
| 451 |
class EvalMessageBox : public QDialog |
| 452 |
{ |
| 453 |
public: |
| 454 |
EvalMessageBox(bool expired) |
| 455 |
{ |
| 456 |
setWindowTitle(QLatin1String(" ")); |
| 457 |
|
| 458 |
QString str = qt_eval_string(); |
| 459 |
if (expired) { |
| 460 |
str = QLatin1String(boilerplate_expired); |
| 461 |
} else { |
| 462 |
str = qt_eval_string(); |
| 463 |
} |
| 464 |
str = str.trimmed(); |
| 465 |
|
| 466 |
QFrame *border = new QFrame(this); |
| 467 |
|
| 468 |
QLabel *pixmap_label = new QLabel(border); |
| 469 |
pixmap_label->setPixmap(qtlogo_eval_xpm); |
| 470 |
pixmap_label->setAlignment(Qt::AlignTop); |
| 471 |
|
| 472 |
QLabel *text_label = new QLabel(str, border); |
| 473 |
|
| 474 |
QHBoxLayout *pm_and_text_layout = new QHBoxLayout(); |
| 475 |
pm_and_text_layout->addWidget(pixmap_label); |
| 476 |
pm_and_text_layout->addWidget(text_label); |
| 477 |
|
| 478 |
QVBoxLayout *master_layout = new QVBoxLayout(border); |
| 479 |
master_layout->addLayout(pm_and_text_layout); |
| 480 |
|
| 481 |
QVBoxLayout *border_layout = new QVBoxLayout(this); |
| 482 |
border_layout->setMargin(0); |
| 483 |
border_layout->addWidget(border); |
| 484 |
|
| 485 |
if (expired) { |
| 486 |
QPushButton *cmd = new QPushButton(QLatin1String("OK"), border); |
| 487 |
cmd->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
| 488 |
cmd->setDefault(true); |
| 489 |
|
| 490 |
QHBoxLayout *button_layout = new QHBoxLayout(); |
| 491 |
master_layout->addLayout(button_layout); |
| 492 |
button_layout->addWidget(cmd); |
| 493 |
|
| 494 |
connect(cmd, SIGNAL(clicked()), this, SLOT(close())); |
| 495 |
} else { |
| 496 |
border->setFrameShape(QFrame::WinPanel); |
| 497 |
border->setFrameShadow(QFrame::Raised); |
| 498 |
setParent(parentWidget(), Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); |
| 499 |
QTimer::singleShot(7000, this, SLOT(close())); |
| 500 |
setAttribute(Qt::WA_DeleteOnClose); |
| 501 |
} |
| 502 |
|
| 503 |
setFixedSize(sizeHint()); |
| 504 |
} |
| 505 |
}; |
| 506 |
|
| 507 |
class QGuiFuriCuri : public QCoreFuriCuri |
| 508 |
{ |
| 509 |
public: |
| 510 |
void timerEvent(QTimerEvent *e) { |
| 511 |
if (e->timerId() == warn) { |
| 512 |
killTimer(warn); |
| 513 |
QMessageBox::information(0, QLatin1String("Automatic Timeout"), QLatin1String(will_shutdown_1min)); |
| 514 |
kill = startTimer(KILL_DELAY); |
| 515 |
} else if (e->timerId() == kill) { |
| 516 |
killTimer(kill); |
| 517 |
QMessageBox::information(0, QLatin1String("Automatic Timeout"), QLatin1String(will_shutdown_now)); |
| 518 |
qApp->quit(); |
| 519 |
} |
| 520 |
} |
| 521 |
}; |
| 522 |
|
| 523 |
|
| 524 |
void qt_gui_eval_init(uint) |
| 525 |
{ |
| 526 |
switch (qt_eval_days_left()) { |
| 527 |
case -2: |
| 528 |
return; |
| 529 |
|
| 530 |
case -1: { |
| 531 |
EvalMessageBox box(true); |
| 532 |
box.exec(); |
| 533 |
::exit(0); |
| 534 |
} |
| 535 |
|
| 536 |
default: { |
| 537 |
EvalMessageBox *box = new EvalMessageBox(false); |
| 538 |
box->show(); |
| 539 |
Q_UNUSED(new QGuiFuriCuri()); |
| 540 |
} |
| 541 |
} |
| 542 |
} |
| 543 |
|
| 544 |
static QString qt_eval_title_prefix() |
| 545 |
{ |
| 546 |
return QLatin1String("[Qt Evaluation] "); |
| 547 |
} |
| 548 |
|
| 549 |
QString qt_eval_adapt_window_title(const QString &title) |
| 550 |
{ |
| 551 |
if (qt_eval_days_left() == -2) |
| 552 |
return title; |
| 553 |
return qt_eval_title_prefix() + title; |
| 554 |
} |
| 555 |
|
| 556 |
void qt_eval_init_widget(QWidget *w) |
| 557 |
{ |
| 558 |
if (qt_eval_days_left() == -2) |
| 559 |
return; |
| 560 |
if (w->isTopLevel()) { |
| 561 |
QString windowTitle = w->windowTitle(); |
| 562 |
if (windowTitle.isEmpty()) { |
| 563 |
w->setWindowTitle(QLatin1String(" ")); |
| 564 |
} else if (!windowTitle.startsWith(qt_eval_title_prefix())) { |
| 565 |
qt_eval_adapt_window_title(windowTitle); |
| 566 |
} |
| 567 |
} |
| 568 |
} |
| 569 |
#endif |
| 570 |
|
| 571 |
QT_END_NAMESPACE |