diff --git a/NEWS b/NEWS index 81b5cf5ae4..63cf2b3afc 100644 --- a/NEWS +++ b/NEWS @@ -1,47 +1,49 @@ ***************************************************************************************************** digiKam 5.9.0 - Release date: 2018-02-25 NEW FEATURES: General : Libraw updated to last 0.18.8. BUGFIXES FROM BUGZILLA: 001 ==> 388977 - Error during upgrading core database schema from v8 to v9. 002 ==> 388867 - problem migrating databaseschema from 8 to 9. 003 ==> 388824 - UpdateSchemaFromV7ToV9 fails due to foreign key contraint in 5.8.0-01. 004 ==> 389042 - Auto-rotation/flip Images delete face tags. 005 ==> 337243 - Tool-Tips ignoring custom font size setting. 006 ==> 388320 - Selecting print layout does not stay selected. 007 ==> 389246 - Single click confirmation of suggested face tag. 008 ==> 389208 - Request addition of "Lens" to Tool-Tips (Icon Items). 009 ==> 389342 - Tags are copied although moving of file fails because file with the same name already exists in target location. 010 ==> 389420 - Thumbnails diminishing in size after switching Views. 011 ==> 389493 - Collection browse dialog should be consistent with other browse dialogs on KDE. 012 ==> 389512 - Timeline Thumbnails Not Shown. 013 ==> 389651 - Custom font size is not applied until you enter and exit the settings menu. 014 ==> 388345 - AppImage MySQL connection issues. 015 ==> 389827 - Ignores albums selection. 016 ==> 389835 - Incorrect DateTime manipulation if timestamp is before unix epoch time. 017 ==> 390121 - Thumbnail size is too small. 018 ==> 390136 - digiKam crashes when launching scan and recognize faces. 019 ==> 390325 - Segmentation fault - QMutex::lock(). 020 ==> 390443 - FAQ entry unaccurate - Thumbnail generation fails on video files. 021 ==> 390529 - Import from scanner not enabled. 022 ==> 390683 - Batch processing creates 0 byte files on Fujifilm RAF RAW images with lens correction. 023 ==> 390688 - Show pick and color label in thumbnail list [patch]. 024 ==> 390162 - digiKam-5.9.0 appimage fail to start. 025 ==> 384853 - Ungrouping images is not working. 026 ==> 390902 - Right sidebar icons not displayed. 027 ==> 391312 - Rename with time template can add colons (:) forbidden character in Windows 10. 028 ==> 386921 - Import Sony video metadata from sidecar file. 029 ==> 377133 - Multiple tags don't display in video metadata. 030 ==> 389619 - digiKam does not read from sidecars for video/mp4. 031 ==> 375570 - XMP sidecar files are not read for videos when importing metadata. 032 ==> 374684 - Crash in Digikam when importing from SD card via reader. 033 ==> 381586 - Crash after tagging ~5 images. 034 ==> 339803 - digiKam crashes frequently on batch rename. 035 ==> 346698 - Delete Duplicate on NAS - Crash. 036 ==> 379420 - Showphoto crashed after resize. 037 ==> 391440 - Metadata (date) is not refreshed after a file has been modified. -038 ==> +038 ==> 391497 - digiKam crashes when manually stopping database sync. +039 ==> + diff --git a/libs/widgets/itemview/ditemtooltip.cpp b/libs/widgets/itemview/ditemtooltip.cpp index ab932a796d..ee81468e0b 100644 --- a/libs/widgets/itemview/ditemtooltip.cpp +++ b/libs/widgets/itemview/ditemtooltip.cpp @@ -1,411 +1,413 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2008-12-10 * Description : tool tip widget for iconview, thumbbar, and folderview items * * Copyright (C) 2008-2018 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #include "ditemtooltip.h" // Qt includes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // KDE includes #include namespace Digikam { DToolTipStyleSheet::DToolTipStyleSheet(const QFont& font) : maxStringLength(30) { unavailable = i18n("unavailable"); QString fontSize = (font.pointSize() == -1) ? QString::fromUtf8("font-size: %1px;").arg(font.pixelSize()) : QString::fromUtf8("font-size: %1pt;").arg(font.pointSize()); tipHeader = QLatin1String(""); tipFooter = QLatin1String("
"); headBeg = QString::fromLatin1("" "

") .arg(qApp->palette().color(QPalette::Base).name()) .arg(qApp->palette().color(QPalette::Text).name()) .arg(font.family()) .arg(fontSize); headEnd = QLatin1String("

"); cellBeg = QString::fromLatin1("

") .arg(qApp->palette().color(QPalette::ToolTipText).name()) .arg(font.family()) .arg(fontSize); cellMid = QString::fromLatin1("

") .arg(qApp->palette().color(QPalette::ToolTipText).name()) .arg(font.family()) .arg(fontSize); cellEnd = QLatin1String("

"); cellSpecBeg = QString::fromLatin1("

") .arg(qApp->palette().color(QPalette::ToolTipText).name()) .arg(font.family()) .arg(fontSize); cellSpecMid = QString::fromLatin1("

") .arg(qApp->palette().color(QPalette::ToolTipText).name()) .arg(font.family()) .arg(fontSize); cellSpecEnd = QLatin1String("

"); } QString DToolTipStyleSheet::breakString(const QString& input) const { QString str = input.simplified(); str = str.toHtmlEscaped(); if (str.length() <= maxStringLength) { return str; } QString br; int i = 0; int count = 0; while (i < str.length()) { if (count >= maxStringLength && str.at(i).isSpace()) { count = 0; br.append(QLatin1String("
")); } else { br.append(str.at(i)); } ++i; ++count; } return br; } QString DToolTipStyleSheet::elidedText(const QString& str, Qt::TextElideMode elideMode) const { if (str.length() <= maxStringLength) { return str; } switch (elideMode) { case Qt::ElideLeft: return QLatin1String("...") + str.right(maxStringLength-3); case Qt::ElideRight: return str.left(maxStringLength-3) + QLatin1String("..."); case Qt::ElideMiddle: return str.left(maxStringLength / 2 - 2) + QLatin1String("...") + str.right(maxStringLength / 2 - 1); case Qt::ElideNone: return str.left(maxStringLength); default: return str; } } QString DToolTipStyleSheet::imageAsBase64(const QImage& img) const { QByteArray byteArray; QBuffer buffer(&byteArray); img.save(&buffer, "PNG"); QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data()); return QString::fromLatin1("").arg(iconBase64); } // -------------------------------------------------------------------------------------------------- class DItemToolTip::Private { public: Private() : tipBorder(5) { corner = 0; } const int tipBorder; int corner; QPixmap corners[4]; }; DItemToolTip::DItemToolTip(QWidget* const parent) : QLabel(parent, Qt::ToolTip), d(new Private) { hide(); + setBackgroundRole(QPalette::ToolTipBase); + setPalette(QToolTip::palette()); ensurePolished(); const int fwidth = qMax(d->tipBorder, 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this)); setContentsMargins(fwidth, fwidth, fwidth, fwidth); setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0); setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); setFrameStyle(QFrame::StyledPanel); /* Old-style box: setFrameStyle(QFrame::Plain | QFrame::Box); setLineWidth(1); */ renderArrows(); } DItemToolTip::~DItemToolTip() { delete d; } void DItemToolTip::updateToolTip() { renderArrows(); QString contents = tipContents(); //setWordWrap(Qt::mightBeRichText(contents)); setText(contents); resize(sizeHint()); } bool DItemToolTip::toolTipIsEmpty() const { return(text().isEmpty()); } void DItemToolTip::reposition() { QRect rect = repositionRect(); if (rect.isNull()) { return; } QPoint pos = rect.center(); // d->corner: // 0: upperleft // 1: upperright // 2: lowerleft // 3: lowerright d->corner = 0; // should the tooltip be shown to the left or to the right of the ivi ? QRect desk = QApplication::desktop()->screenGeometry(rect.center()); if (rect.center().x() + width() > desk.right()) { // to the left if (pos.x() - width() < 0) { pos.setX(0); d->corner = 4; } else { pos.setX( pos.x() - width() ); d->corner = 1; } } // should the tooltip be shown above or below the ivi ? if (rect.bottom() + height() > desk.bottom()) { // above pos.setY( rect.top() - height() - 5); d->corner += 2; } else { pos.setY( rect.bottom() + 5 ); } move( pos ); } void DItemToolTip::renderArrows() { int w = d->tipBorder; // -- left top arrow ------------------------------------- QPixmap& pix0 = d->corners[0]; pix0 = QPixmap(w, w); pix0.fill(Qt::transparent); QPainter p0(&pix0); p0.setPen(QPen(qApp->palette().color(QPalette::Text), 1)); for (int j=0; jcorners[1]; pix1 = QPixmap(w, w); pix1.fill(Qt::transparent); QPainter p1(&pix1); p1.setPen(QPen(qApp->palette().color(QPalette::Text), 1)); for (int j=0; jcorners[2]; pix2 = QPixmap(w, w); pix2.fill(Qt::transparent); QPainter p2(&pix2); p2.setPen(QPen(qApp->palette().color(QPalette::Text), 1)); for (int j=0; jcorners[3]; pix3 = QPixmap(w, w); pix3.fill(Qt::transparent); QPainter p3(&pix3); p3.setPen(QPen(qApp->palette().color(QPalette::Text), 1)); for (int j=0; jtype() ) { case QEvent::Leave: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::FocusIn: case QEvent::FocusOut: case QEvent::Wheel: hide(); break; default: break; } return QFrame::event(e); } void DItemToolTip::resizeEvent(QResizeEvent* e) { QStyleHintReturnMask frameMask; QStyleOption option; option.init(this); if (style()->styleHint(QStyle::SH_ToolTip_Mask, &option, this, &frameMask)) { setMask(frameMask.region); } update(); QLabel::resizeEvent(e); } void DItemToolTip::paintEvent(QPaintEvent* e) { { QStylePainter p(this); QStyleOptionFrame opt; opt.init(this); p.drawPrimitive(QStyle::PE_PanelTipLabel, opt); } QLabel::paintEvent(e); QPainter p(this); if (d->corner >= 4) { return; } QPixmap& pix = d->corners[d->corner]; switch (d->corner) { case 0: p.drawPixmap( 3, 3, pix ); break; case 1: p.drawPixmap( width() - pix.width() - 3, 3, pix ); break; case 2: p.drawPixmap( 3, height() - pix.height() - 3, pix ); break; case 3: p.drawPixmap( width() - pix.width() - 3, height() - pix.height() - 3, pix ); break; } } } // namespace Digikam