Version: 0.9.1-rc1 (using KDE KDE 3.5.6) Installed from: SuSE RPMs Compiler: gcc 4.1.2 OS: Linux When a comment in a photo is longer than about 60 characters and this photo is shown using the new great slideshow tool then this comment is tuncated (actually "..." replaces the rest of what is not shown) when displayed in the slide show. Actually the comment should be displayed as is and not be truncated. When a photo is in portrait orientation there really is no need to truncate the comment at all, since there is room enough beneath the photo. If the photo is in protrait orientation, the comment should be formatted into several lines.
SVN commit 635665 by cgilles: digikam from trunk : Native SlideShow tool : print long comment on the screen using multilines. BUG: 141961 M +61 -3 slideshow.cpp M +1 -0 slideshow.h --- trunk/extragear/graphics/digikam/utilities/slideshow/slideshow.cpp #635664:635665 @@ -18,7 +18,7 @@ * * ============================================================ */ -#define MAXSTRINGLEN 60 +#define MAXSTRINGLEN 80 // Qt includes. @@ -320,8 +320,7 @@ if (d->settings.printComment) { str = d->settings.pictInfoMap[d->currentImage].comment; - if (str.length() > MAXSTRINGLEN) str = str.left(MAXSTRINGLEN-3) + "..."; - printInfoText(p, offset, str); + printComments(p, offset, str); } // Display the Make and Model. @@ -469,6 +468,65 @@ } } +void SlideShow::printComments(QPainter &p, int &offset, const QString& comments) +{ + QStringList commentsByLines; + + uint commentsIndex = 0; // Comments QString index + + while (commentsIndex < comments.length()) + { + QString newLine; + bool breakLine = false; // End Of Line found + uint currIndex; // Comments QString current index + + // Check miminal lines dimension + + uint commentsLinesLengthLocal = MAXSTRINGLEN; + + for (currIndex = commentsIndex; currIndex < comments.length() && !breakLine; currIndex++ ) + { + if( comments[currIndex] == QChar('\n') || comments[currIndex].isSpace() ) + breakLine = true; + } + + if (commentsLinesLengthLocal <= (currIndex - commentsIndex)) + commentsLinesLengthLocal = (currIndex - commentsIndex); + + breakLine = false; + + for (currIndex = commentsIndex ; currIndex <= commentsIndex + commentsLinesLengthLocal && + currIndex < comments.length() && !breakLine ; + currIndex++ ) + { + breakLine = (comments[currIndex] == QChar('\n')) ? true : false; + + if (breakLine) + newLine.append(QString(" ")); + else + newLine.append(comments[currIndex]); + } + + commentsIndex = currIndex; // The line is ended + + if (commentsIndex != comments.length()) + { + while (!newLine.endsWith(" ")) + { + newLine.truncate(newLine.length() - 1); + commentsIndex--; + } + } + + commentsByLines.prepend(newLine.stripWhiteSpace()); + } + + for (int i = 0 ; i < (int)commentsByLines.count() ; i++ ) + { + printInfoText(p, offset, commentsByLines[i]); + } +} + void SlideShow::paintEvent(QPaintEvent *) { bitBlt(this, 0, 0, &d->pixmap, --- trunk/extragear/graphics/digikam/utilities/slideshow/slideshow.h #635664:635665 @@ -74,6 +74,7 @@ void preloadNextImage(); void updatePixmap(); void printInfoText(QPainter &p, int &offset, const QString& str); + void printComments(QPainter &p, int &offset, const QString& comments); private: