Hello community,

here is the log from the commit of package palapeli for openSUSE:Factory 
checked in at 2016-01-10 13:06:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/palapeli (Old)
 and      /work/SRC/openSUSE:Factory/.palapeli.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "palapeli"

Changes:
--------
--- /work/SRC/openSUSE:Factory/palapeli/palapeli.changes        2015-11-15 
12:43:51.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.palapeli.new/palapeli.changes   2016-01-10 
13:07:12.000000000 +0100
@@ -1,0 +2,9 @@
+Sun Dec 13 13:33:37 UTC 2015 - [email protected]
+
+- Update to KDE Applications 15.12.0
+   * KDE Applications 15.12.0 
+   * https://www.kde.org/announcements/announce-applications-15.12.0.php
+   * boo#958887
+
+
+-------------------------------------------------------------------

Old:
----
  palapeli-15.08.3.tar.xz

New:
----
  palapeli-15.12.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ palapeli.spec ++++++
--- /var/tmp/diff_new_pack.qfywMO/_old  2016-01-10 13:07:13.000000000 +0100
+++ /var/tmp/diff_new_pack.qfywMO/_new  2016-01-10 13:07:13.000000000 +0100
@@ -21,7 +21,7 @@
 License:        GPL-2.0+
 Group:          Amusements/Games/Board/Puzzle
 Url:            http://www.kde.org
-Version:        15.08.3
+Version:        15.12.0
 Release:        0
 Source0:        palapeli-%{version}.tar.xz
 BuildRequires:  libkdegames4-devel

++++++ palapeli-15.08.3.tar.xz -> palapeli-15.12.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/palapeli-15.08.3/src/file-io/collection-delegate.cpp 
new/palapeli-15.12.0/src/file-io/collection-delegate.cpp
--- old/palapeli-15.08.3/src/file-io/collection-delegate.cpp    2015-11-04 
14:02:20.000000000 +0100
+++ new/palapeli-15.12.0/src/file-io/collection-delegate.cpp    2015-11-11 
17:16:53.000000000 +0100
@@ -31,117 +31,183 @@
 
 namespace Metrics
 {
-       const int Padding = 6;
+    const int Padding = 6;
 }
 
-Palapeli::CollectionDelegate::CollectionDelegate(QObject* parent)
-       : QStyledItemDelegate(parent)
+Palapeli::CollectionDelegate::CollectionDelegate (QObject* parent)
+        : QStyledItemDelegate(parent)
 {
-       QAbstractItemView* view = qobject_cast<QAbstractItemView*>(parent);
-       if (view)
-               view->setItemDelegate(this);
-}
-
-QRect Palapeli::CollectionDelegate::thumbnailRect(const QRect& baseRect) const
-{
-       QRect thumbnailBaseRect(QPoint(Metrics::Padding + baseRect.left(), 0), 
Palapeli::PuzzleMetadata::ThumbnailBaseSize);
-       thumbnailBaseRect.moveCenter(QPoint(thumbnailBaseRect.center().x(), 
baseRect.center().y()));
-       if (QApplication::isRightToLeft())
-               thumbnailBaseRect.moveRight(baseRect.right() - 
Metrics::Padding);
-       return thumbnailBaseRect;
-}
-
-void Palapeli::CollectionDelegate::paint(QPainter* painter, const 
QStyleOptionViewItem& option, const QModelIndex& index) const
-{
-       paintItem(painter, option, index);
-}
+    QAbstractItemView* view = qobject_cast<QAbstractItemView*>(parent);
+    if (view) {
+        view->setItemDelegate(this);
+        m_viewport = view->viewport();
+    }
+}
+
+QRect Palapeli::CollectionDelegate::thumbnailRect (const QRect& baseRect) const
+{
+    QRect thumbnailBaseRect (QPoint(Metrics::Padding + baseRect.left(), 0),
+                             Palapeli::PuzzleMetadata::ThumbnailBaseSize);
+    thumbnailBaseRect.moveCenter (QPoint(thumbnailBaseRect.center().x(),
+                                  baseRect.center().y()));
+    if (QApplication::isRightToLeft()) {
+        thumbnailBaseRect.moveRight (baseRect.right() - Metrics::Padding);
+    }
+    return thumbnailBaseRect;
+}
+
+void Palapeli::CollectionDelegate::paint (
+                                        QPainter* painter,
+                                        const QStyleOptionViewItem& option,
+                                        const QModelIndex& index) const
+{
+    QRect baseRect = option.rect;      // Total space available for item.
+
+    // Calculate item's column number in list-view. Add 1 in odd-numbered rows.
+    int nItemsPerRow = qMax (m_viewport->width() / baseRect.width(), 1);
+    int oddColumn = index.row() % nItemsPerRow;
+    oddColumn = oddColumn + ((index.row() / nItemsPerRow) % 2);
+
+    // Draw background of item.
+    QColor bkgColor;
+    if (option.state & QStyle::State_Selected) {
+        bkgColor = option.palette.color (QPalette::Highlight);
+    } else if (oddColumn % 2) {
+        // The shading alternates along each row in the list view and
+        // each odd-numbered row starts with a shaded item, so we have
+        // a checkerboard pattern, regardless of whether nItemsPerRow
+        // is odd or even (see the above calculation).
+        bkgColor = option.palette.color (QPalette::AlternateBase);
+    } else {
+        bkgColor = option.palette.color (QPalette::Base);
+    }
+    painter->fillRect (option.rect, bkgColor);
+
+    // Draw thumbnail.
+    QRect thumbnailBaseRect = this->thumbnailRect (baseRect);
+    const QPixmap thumbnail = index.data (Palapeli::Collection::ThumbnailRole)
+                                          .value<QPixmap>();
+    QRect thumbnailRect (thumbnailBaseRect.topLeft(), thumbnail.size());
+    thumbnailRect.translate (          // Center inside thumbnailBaseRect.
+                (thumbnailBaseRect.width()  - thumbnailRect.width()) / 2,
+                (thumbnailBaseRect.height() - thumbnailRect.height()) / 2);
+    painter->drawPixmap (thumbnailRect.topLeft(), thumbnail);
+
+    // Calculate the maximum space available for text lines.
+    QRect textBaseRect (baseRect);
+    textBaseRect.setWidth (baseRect.width() - thumbnailBaseRect.width()
+                                            - 2*Metrics::Padding);
+    if (option.direction == Qt::RightToLeft) {
+        textBaseRect.moveRight (thumbnailBaseRect.left() - Metrics::Padding);
+        textBaseRect.adjust (Metrics::Padding, Metrics::Padding,
+                             0, -Metrics::Padding);
+    }
+    else {
+        textBaseRect.moveLeft (thumbnailBaseRect.right() + Metrics::Padding);
+        textBaseRect.adjust (0, Metrics::Padding,
+                             -Metrics::Padding, -Metrics::Padding);
+    }
+
+    // Find the contents and sizes for the text lines.
+    QStringList texts; QList<QFont> fonts;
+    {
+        QString name = index.data(Palapeli::Collection::NameRole).toString();
+        const int pieceCount = index.data 
(Palapeli::Collection::PieceCountRole)
+                                           .toInt();
+        if (name.isEmpty()) {
+            name = i18n("[No name]");
+        }
+        if (pieceCount > 0) {
+            name = ki18ncp (
+                    "Puzzle description, %2 = name string, %1 = piece count",
+                    "%2 (%1 piece)",
+                    "%2 (%1 pieces)")
+                    .subs(pieceCount).subs(name).toString();
+        }
+        texts << name;
+        QFont theFont (painter->font());
+        theFont.setBold(true);
+        fonts << theFont;
+    }{
+        QString comment = index.data (Palapeli::Collection::CommentRole)
+                                      .toString();
+        if (!comment.isEmpty()) {
+            texts << comment;
+            fonts << painter->font();
+        }
+    }{
+        QString author = index.data (Palapeli::Collection::AuthorRole)
+                                     .toString();
+        if (!author.isEmpty()) {
+            const QString authorString = ki18nc (
+                        "Author attribution, e.g. \"by Jack\"",
+                        "by %1")
+                        .subs(author).toString();
+            texts << authorString;
+            QFont theFont (painter->font());
+            theFont.setItalic(true);
+            fonts << theFont;
+        }
+    }
+    QList<QRect> textRects;
+    int totalTextHeight = 0;
+    QRect maxRect (QPoint(0, 0), textBaseRect.size());
+    for (int i = 0; i < texts.count(); ++i) {
+        QFontMetrics fm(fonts[i]);
+        textRects << fm.boundingRect (maxRect, Qt::AlignLeft | Qt::AlignTop |
+                                      Qt::TextWordWrap, texts[i]);
+        totalTextHeight += textRects[i].height();
+    }
+
+    // Vertically center however many text lines there are.
+    textBaseRect.setHeight (totalTextHeight);
+    textBaseRect.moveTop (baseRect.top() +
+                          (baseRect.height() - textBaseRect.height()) / 2);
+
+    // Draw the text lines.
+    QRect currentTextRect (textBaseRect);
+    painter->save();
+    for (int i = 0; i < texts.count(); ++i) {
+        painter->setFont(fonts[i]);
+        const QRect& textRect = textRects[i];
+        currentTextRect.setHeight(textRect.height());
+        painter->drawText (currentTextRect,
+                           Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap,
+                           texts[i]);
+        currentTextRect.moveTop (currentTextRect.bottom());
+    }
+    painter->restore();
+}
+
+QSize Palapeli::CollectionDelegate::sizeHint (
+                                        const QStyleOptionViewItem& option,
+                                        const QModelIndex& index) const
+{
+    Q_UNUSED(index)
+
+    // Fit a varying number of columns into the list-view.
+    int minWidth = 4 * (Palapeli::PuzzleMetadata::ThumbnailBaseSize.width() +
+                        Metrics::Padding);
+    int viewportWidth = m_viewport->width();
+    int hintWidth     = minWidth;
+    int nItemsPerRow  = viewportWidth / minWidth;
+
+    // Expand the hinted width, so that the columns will fill the viewport.
+    if (nItemsPerRow > 0) {
+        // The 0:1 adjustment works around a graphics glitch, when nItemsPerRow
+        // exactly divides viewportWidth and instead of nItemsPerRow columns
+        // we suddenly get one column less, plus a large empty space, even
+        // though QListView::spacing() is zero.
+        viewportWidth = viewportWidth - ((viewportWidth % nItemsPerRow) ? 0:1);
+        hintWidth     = viewportWidth / nItemsPerRow;
+    }
+
+    // Set the height to contain the thumbnail or 4 lines of text.
+    int hintHeight    = Palapeli::PuzzleMetadata::ThumbnailBaseSize.height();
+    int fontHeight = option.fontMetrics.height();
+    if (hintHeight < fontHeight*4) {
+        hintHeight = fontHeight*4;
+    }
 
-void Palapeli::CollectionDelegate::paintItem(QPainter* painter, const 
QStyleOptionViewItem& option, const QModelIndex& index) const
-{
-       const bool rtl = option.direction == Qt::RightToLeft;
-       QRect baseRect = option.rect;
-       //draw background
-       QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, 
&option, painter, 0);
-       //draw thumbnail
-       QRect thumbnailBaseRect = this->thumbnailRect(baseRect);
-       const QPixmap thumbnail = 
index.data(Palapeli::Collection::ThumbnailRole).value<QPixmap>();
-       QRect thumbnailRect(thumbnailBaseRect.topLeft(), thumbnail.size());
-       thumbnailRect.translate( //center inside thumbnailBaseRect
-               (thumbnailBaseRect.width() - thumbnailRect.width()) / 2,
-               (thumbnailBaseRect.height() - thumbnailRect.height()) / 2
-       );
-       painter->drawPixmap(thumbnailRect.topLeft(), thumbnail);
-       //find metrics: text
-       QStringList texts; QList<QFont> fonts;
-       {
-               QString name = 
index.data(Palapeli::Collection::NameRole).toString();
-               const int pieceCount = 
index.data(Palapeli::Collection::PieceCountRole).toInt();
-               if (name.isEmpty())
-                       name = i18n("[No name]");
-               if (pieceCount > 0)
-                       name = ki18ncp("Puzzle description, %2 = name string, 
%1 = piece count", "%2 (%1 piece)", "%2 (%1 pieces)")
-                      .subs(pieceCount).subs(name).toString();
-               texts << name;
-               QFont theFont(painter->font()); theFont.setBold(true); fonts << 
theFont;
-       }{
-               QString comment = 
index.data(Palapeli::Collection::CommentRole).toString();
-               if (!comment.isEmpty())
-               {
-                       texts << comment;
-                       fonts << painter->font();
-               }
-       }{
-               QString author = 
index.data(Palapeli::Collection::AuthorRole).toString();
-               if (!author.isEmpty())
-               {
-                       const QString authorString = ki18nc("Author 
attribution, e.g. \"by Jack\"", "by %1").subs(author).toString();
-                       texts << authorString;
-                       QFont theFont(painter->font()); 
theFont.setItalic(true); fonts << theFont;
-               }
-       }
-       QList<QRect> textRects; int totalTextHeight = 0;
-       for (int i = 0; i < texts.count(); ++i)
-       {
-               QFontMetrics fm(fonts[i]);
-               textRects << fm.boundingRect(texts[i]);
-               textRects[i].setHeight(qMax(textRects[i].height(), 
fm.lineSpacing()));
-               totalTextHeight += textRects[i].height();
-       }
-       QRect textBaseRect(baseRect);
-       if (rtl)
-       {
-               textBaseRect.moveRight(thumbnailBaseRect.left() - 
Metrics::Padding);
-               textBaseRect.adjust(Metrics::Padding, Metrics::Padding, 0, 
-Metrics::Padding);
-       }
-       else
-       {
-               textBaseRect.moveLeft(thumbnailBaseRect.right() + 
Metrics::Padding);
-               textBaseRect.adjust(0, Metrics::Padding, -Metrics::Padding, 
-Metrics::Padding);
-       }
-       textBaseRect.setHeight(totalTextHeight);
-       textBaseRect.moveTop(baseRect.top() + (baseRect.height() - 
textBaseRect.height()) / 2);
-       //draw texts
-       QRect currentTextRect(textBaseRect);
-       painter->save();
-       for (int i = 0; i < texts.count(); ++i)
-       {
-               painter->setFont(fonts[i]);
-               const QRect& textRect = textRects[i];
-               currentTextRect.setHeight(textRect.height());
-               painter->drawText(currentTextRect, Qt::AlignLeft | 
Qt::AlignVCenter, texts[i]);
-               currentTextRect.moveTop(currentTextRect.bottom());
-       }
-       painter->restore();
-}
-
-void Palapeli::CollectionDelegate::paintHeader(QPainter* painter, const 
QStyleOptionViewItem& option, const QModelIndex& index) const
-{
-       QStyledItemDelegate::paint(painter, option, index);
-}
-
-QSize Palapeli::CollectionDelegate::sizeHint(const QStyleOptionViewItem& 
option, const QModelIndex& index) const
-{
-       Q_UNUSED(option) Q_UNUSED(index)
-       //TODO: take text size into account
-       return QSize(400, Palapeli::PuzzleMetadata::ThumbnailBaseSize.height() 
+ 2 * Metrics::Padding);
+    return QSize(hintWidth, hintHeight + 2 * Metrics::Padding);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/palapeli-15.08.3/src/file-io/collection-delegate.h 
new/palapeli-15.12.0/src/file-io/collection-delegate.h
--- old/palapeli-15.08.3/src/file-io/collection-delegate.h      2015-11-04 
14:02:20.000000000 +0100
+++ new/palapeli-15.12.0/src/file-io/collection-delegate.h      2015-11-11 
17:16:53.000000000 +0100
@@ -23,17 +23,21 @@
 
 namespace Palapeli
 {
-       class CollectionDelegate : public QStyledItemDelegate
-       {
-               public:
-                       CollectionDelegate(QObject* parent = 0);
-                       virtual void paint(QPainter* painter, const 
QStyleOptionViewItem& option, const QModelIndex& index) const;
-                       virtual QSize sizeHint(const QStyleOptionViewItem& 
option, const QModelIndex& index) const;
-                       QRect thumbnailRect(const QRect& baseRect) const;
-               private:
-                       void paintItem(QPainter* painter, const 
QStyleOptionViewItem& option, const QModelIndex& index) const;
-                       void paintHeader(QPainter* painter, const 
QStyleOptionViewItem& option, const QModelIndex& index) const;
-       };
+    class CollectionDelegate : public QStyledItemDelegate
+    {
+    public:
+        CollectionDelegate     (QObject* parent = 0);
+
+        virtual void paint     (QPainter* painter,
+                                const QStyleOptionViewItem& option,
+                                const QModelIndex& index) const;
+        virtual QSize sizeHint (const QStyleOptionViewItem& option,
+                                const QModelIndex& index) const;
+
+    private:
+        QRect thumbnailRect    (const QRect& baseRect) const;
+       QWidget * m_viewport;
+    };
 }
 
 #endif // PALAPELI_COLLECTIONDELEGATE_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/palapeli-15.08.3/src/file-io/collection-view.cpp 
new/palapeli-15.12.0/src/file-io/collection-view.cpp
--- old/palapeli-15.08.3/src/file-io/collection-view.cpp        2015-11-04 
14:02:20.000000000 +0100
+++ new/palapeli-15.12.0/src/file-io/collection-view.cpp        2015-11-11 
17:16:53.000000000 +0100
@@ -38,9 +38,21 @@
 {
        //setup view
        connect(m_view, SIGNAL(activated(QModelIndex)), this, 
SLOT(handleActivated(QModelIndex)));
-       m_view->setAlternatingRowColors(true);
+
+       // Set up for multi-column display of the Puzzle Collection, which
+       // allows the user to see more of the collection at one time.
+       m_view->setWrapping(true);
+       m_view->setResizeMode(QListView::Adjust);
+       m_view->setUniformItemSizes(true);
+       m_view->setFlow(QListView::LeftToRight);
+
+       // Avoid a resize loop (with the scrollbar appearing and disappearing)
+       // when the number of items and display-columns hits a bad combination.
+       m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+
        m_view->setMouseTracking(true);
        m_view->setSelectionMode(QAbstractItemView::ExtendedSelection);
+       m_view->setVerticalScrollMode(QListView::ScrollPerPixel); // Smooth.
        //setup proxy model
        m_view->setModel(m_proxyModel);
        connect(m_view->selectionModel(), 
SIGNAL(selectionChanged(QItemSelection,QItemSelection)), 
SLOT(handleSelectionChanged()));
@@ -66,7 +78,10 @@
        layout->addWidget(sortButton, 0, 0);
        layout->addWidget(searchLine, 0, 1);
        layout->addWidget(m_view, 1, 0, 1, 2);
-       layout->setMargin(0);
+       // Removed this because setMargin is obsolete and (0) cuts off the right
+       // hand and bottom edges of the search and ListView widgets --- on Apple
+       // OSX at least. The default margin is 11 pixels all round and looks OK.
+       // layout->setMargin(0);
 }
 
 void Palapeli::CollectionView::setModel(QAbstractItemModel* model)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/palapeli-15.08.3/src/main.cpp 
new/palapeli-15.12.0/src/main.cpp
--- old/palapeli-15.08.3/src/main.cpp   2015-11-04 14:02:20.000000000 +0100
+++ new/palapeli-15.12.0/src/main.cpp   2015-11-11 17:16:53.000000000 +0100
@@ -33,6 +33,7 @@
        about.addCredit (ki18n ("Johannes Loehnert"),
                         ki18n ("The option to preview the completed puzzle"),
                         "[email protected]");
+       about.setHomepage("https://www.kde.org/applications/games/palapeli/";);
        KCmdLineArgs::init(argc, argv, &about);
 
        KCmdLineOptions options;


Reply via email to