Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/MapViewItemDelegate.cpp
1 | // | 1 | // | ||
---|---|---|---|---|---|
2 | // This file is part of the Marble Virtual Globe. | 2 | // This file is part of the Marble Virtual Globe. | ||
3 | // | 3 | // | ||
4 | // This program is free software licensed under the GNU LGPL. You can | 4 | // This program is free software licensed under the GNU LGPL. You can | ||
5 | // find a copy of this license in LICENSE.txt in the top directory of | 5 | // find a copy of this license in LICENSE.txt in the top directory of | ||
6 | // the source code. | 6 | // the source code. | ||
7 | // | 7 | // | ||
8 | // Copyright 2004-2007 Torsten Rahn <tackat@kde.org> | 8 | // Copyright 2004-2007 Torsten Rahn <tackat@kde.org> | ||
9 | // Copyright 2007 Inge Wallin <ingwa@kde.org> | 9 | // Copyright 2007 Inge Wallin <ingwa@kde.org> | ||
10 | // Copyright 2007 Thomas Zander <zander@kde.org> | 10 | // Copyright 2007 Thomas Zander <zander@kde.org> | ||
11 | // Copyright 2010 Bastian Holst <bastianholst@gmx.de> | 11 | // Copyright 2010 Bastian Holst <bastianholst@gmx.de> | ||
12 | // Copyright 2011-2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de> | 12 | // Copyright 2011-2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de> | ||
13 | // Copyright 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com> | 13 | // Copyright 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com> | ||
14 | // | 14 | // | ||
15 | 15 | | |||
16 | //Self | 16 | //Self | ||
17 | #include "config-marble.h" | ||||
17 | #include "MapViewItemDelegate.h" | 18 | #include "MapViewItemDelegate.h" | ||
18 | 19 | | |||
19 | //Qt | 20 | //Qt | ||
20 | #include <QListView> | 21 | #include <QListView> | ||
21 | #include <QModelIndex> | 22 | #include <QModelIndex> | ||
22 | #include <QTextDocument> | 23 | #include <QTextDocument> | ||
23 | #include <QPainter> | 24 | #include <QPainter> | ||
24 | #include <QApplication> | 25 | #include <QApplication> | ||
Show All 32 Lines | 40 | { | |||
57 | QRect const rect = styleOption.rect; | 58 | QRect const rect = styleOption.rect; | ||
58 | QSize const iconSize = styleOption.decorationSize; | 59 | QSize const iconSize = styleOption.decorationSize; | ||
59 | QRect const iconRect( rect.topLeft(), iconSize ); | 60 | QRect const iconRect( rect.topLeft(), iconSize ); | ||
60 | QIcon const icon = index.data( Qt::DecorationRole ).value<QIcon>(); | 61 | QIcon const icon = index.data( Qt::DecorationRole ).value<QIcon>(); | ||
61 | painter->drawPixmap( iconRect, icon.pixmap( iconSize ) ); | 62 | painter->drawPixmap( iconRect, icon.pixmap( iconSize ) ); | ||
62 | 63 | | |||
63 | int const padding = 5; | 64 | int const padding = 5; | ||
64 | QString const name = index.data().toString(); | 65 | QString const name = index.data().toString(); | ||
66 | #ifdef APPLE_STANDARD_UNIX_BUILD | ||||
67 | QSettings::setDefaultFormat(QSettings::IniFormat); | ||||
68 | #endif | ||||
65 | const bool isFavorite = QSettings().contains(QLatin1String("Favorites/") + name); | 69 | const bool isFavorite = QSettings().contains(QLatin1String("Favorites/") + name); | ||
66 | QSize const bookmarkSize( 16, 16 ); | 70 | QSize const bookmarkSize( 16, 16 ); | ||
67 | QRect bookmarkRect( iconRect.bottomRight(), bookmarkSize ); | 71 | QRect bookmarkRect( iconRect.bottomRight(), bookmarkSize ); | ||
68 | bookmarkRect.translate( QPoint( -bookmarkSize.width() - padding, -bookmarkSize.height() - padding ) ); | 72 | bookmarkRect.translate( QPoint( -bookmarkSize.width() - padding, -bookmarkSize.height() - padding ) ); | ||
69 | QIcon::Mode mode = isFavorite ? QIcon::Normal : QIcon::Disabled; | 73 | QIcon::Mode mode = isFavorite ? QIcon::Normal : QIcon::Disabled; | ||
70 | painter->drawPixmap( bookmarkRect, m_bookmarkIcon.pixmap( bookmarkSize, mode ) ); | 74 | painter->drawPixmap( bookmarkRect, m_bookmarkIcon.pixmap( bookmarkSize, mode ) ); | ||
71 | 75 | | |||
72 | QTextDocument document; | 76 | QTextDocument document; | ||
Show All 40 Lines |