Changeset View
Changeset View
Standalone View
Standalone View
generators/epub/converter.cpp
Show First 20 Lines • Show All 373 Lines • ▼ Show 20 Line(s) | 372 | if (epub_tit_curr_valid(tit)) { | |||
---|---|---|---|---|---|
374 | QString link = QString::fromUtf8(clink); | 374 | QString link = QString::fromUtf8(clink); | ||
375 | char *label = epub_tit_get_curr_label(tit); | 375 | char *label = epub_tit_get_curr_label(tit); | ||
376 | QTextBlock block = mTextDocument->begin(); // must point somewhere | 376 | QTextBlock block = mTextDocument->begin(); // must point somewhere | ||
377 | 377 | | |||
378 | if (mSectionMap.contains(link)) { | 378 | if (mSectionMap.contains(link)) { | ||
379 | block = mSectionMap.value(link); | 379 | block = mSectionMap.value(link); | ||
380 | } else { // load missing resource | 380 | } else { // load missing resource | ||
381 | char *data = 0; | 381 | char *data = 0; | ||
382 | int size = epub_get_data(mTextDocument->getEpub(), clink, &data); | 382 | //epub_get_data can't handle whitespace url encodings | ||
383 | QByteArray ba = link.replace("%20", " ").toLatin1(); | ||||
384 | const char *clinkClean = ba.data(); | ||||
385 | int size = epub_get_data(mTextDocument->getEpub(), clinkClean, &data); | ||||
386 | | ||||
383 | if (data) { | 387 | if (data) { | ||
384 | _cursor->insertBlock(); | 388 | _cursor->insertBlock(); | ||
385 | 389 | | |||
386 | // try to load as image and if not load as html | 390 | // try to load as image and if not load as html | ||
387 | block = _cursor->block(); | 391 | block = _cursor->block(); | ||
388 | QImage image; | 392 | QImage image; | ||
389 | mSectionMap.insert(link, block); | 393 | mSectionMap.insert(link, block); | ||
390 | if (image.loadFromData((unsigned char *)data, size)) { | 394 | if (image.loadFromData((unsigned char *)data, size)) { | ||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |