Merge lp:~jpakkane/ubuntu-ui-toolkit/removethumbnailer into lp:ubuntu-ui-toolkit

Proposed by Jussi Pakkanen
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1110
Merged at revision: 1115
Proposed branch: lp:~jpakkane/ubuntu-ui-toolkit/removethumbnailer
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 197 lines (+1/-134)
5 files modified
debian/control (+0/-1)
modules/Ubuntu/Components/plugin/plugin.cpp (+0/-7)
modules/Ubuntu/Components/plugin/plugin.pro (+1/-3)
modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp (+0/-87)
modules/Ubuntu/Components/plugin/thumbnailgenerator.h (+0/-36)
To merge this branch: bzr merge lp:~jpakkane/ubuntu-ui-toolkit/removethumbnailer
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Zsombor Egri Approve
Review via email: mp+237535@code.launchpad.net

Commit message

Remove the thumbnailer image provider here, because thumbnailer provides it by itself.

Description of the change

Remove the thumbnailer image provider here, because thumbnailer provides it by itself.

This change has big regression potential and needs to be thoroughly manually tested. Nothing _should_ break (because the other image providers in the thumbnailer package provably work just fine) but these things are always finicky. Testing by several different people is required.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Good to go from my side.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

This won't autoland because it was proposed against trunk, not staging.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-09-11 17:24:38 +0000
3+++ debian/control 2014-10-08 07:01:30 +0000
4@@ -35,7 +35,6 @@
5 libqt5organizer5,
6 qtpim5-dev,
7 language-pack-en-base,
8- libthumbnailer-dev,
9 libdbus-1-dev,
10 libnih-dbus-dev,
11 xvfb,
12
13=== modified file 'modules/Ubuntu/Components/plugin/plugin.cpp'
14--- modules/Ubuntu/Components/plugin/plugin.cpp 2014-09-07 16:42:47 +0000
15+++ modules/Ubuntu/Components/plugin/plugin.cpp 2014-10-08 07:01:30 +0000
16@@ -35,7 +35,6 @@
17 #include "inversemouseareatype.h"
18 #include "qquickclipboard.h"
19 #include "qquickmimedata.h"
20-#include "thumbnailgenerator.h"
21 #include "ucubuntuanimation.h"
22 #include "ucfontutils.h"
23 #include "ucarguments.h"
24@@ -214,12 +213,6 @@
25 // register icon provider
26 engine->addImageProvider(QLatin1String("theme"), new UnityThemeIconProvider);
27
28- try {
29- engine->addImageProvider(QLatin1String("thumbnailer"), new ThumbnailGenerator);
30- } catch(std::runtime_error &e) {
31- qDebug() << "Could not create thumbnailer: " << e.what();
32- }
33-
34 // Necessary for Screen.orientation (from import QtQuick.Window 2.0) to work
35 QGuiApplication::primaryScreen()->setOrientationUpdateMask(
36 Qt::PortraitOrientation |
37
38=== modified file 'modules/Ubuntu/Components/plugin/plugin.pro'
39--- modules/Ubuntu/Components/plugin/plugin.pro 2014-09-07 16:42:47 +0000
40+++ modules/Ubuntu/Components/plugin/plugin.pro 2014-10-08 07:01:30 +0000
41@@ -1,6 +1,6 @@
42 unix {
43 CONFIG += link_pkgconfig
44- PKGCONFIG += gio-2.0 thumbnailer dbus-1 libnih-dbus
45+ PKGCONFIG += gio-2.0 dbus-1 libnih-dbus
46 }
47
48 TEMPLATE = lib
49@@ -50,7 +50,6 @@
50 alarmmanager_p.h \
51 ucalarmmodel.h \
52 unitythemeiconprovider.h \
53- thumbnailgenerator.h \
54 alarmrequest_p.h \
55 alarmrequest_p_p.h \
56 adapters/alarmsadapter_p.h \
57@@ -93,7 +92,6 @@
58 alarmmanager_p.cpp \
59 ucalarmmodel.cpp \
60 unitythemeiconprovider.cpp \
61- thumbnailgenerator.cpp \
62 alarmrequest_p.cpp \
63 ucstatesaver.cpp \
64 sortbehavior.cpp \
65
66=== removed file 'modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp'
67--- modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 2014-05-27 14:07:00 +0000
68+++ modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 1970-01-01 00:00:00 +0000
69@@ -1,87 +0,0 @@
70-/*
71- * Copyright 2013 Canonical Ltd.
72- *
73- * This program is free software; you can redistribute it and/or modify
74- * it under the terms of the GNU Lesser General Public License as published by
75- * the Free Software Foundation; version 3.
76- *
77- * This program is distributed in the hope that it will be useful,
78- * but WITHOUT ANY WARRANTY; without even the implied warranty of
79- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80- * GNU Lesser General Public License for more details.
81- *
82- * You should have received a copy of the GNU Lesser General Public License
83- * along with this program. If not, see <http://www.gnu.org/licenses/>.
84- *
85- * Authors: Jussi Pakkanen <jussi.pakkanen@canonical.com>
86-*/
87-
88-#include "thumbnailgenerator.h"
89-#include <stdexcept>
90-#include <QDebug>
91-#include <QMimeDatabase>
92-#include <QUrl>
93-
94-const char *DEFAULT_VIDEO_ART = "/usr/share/unity/icons/video_missing.png";
95-const char *DEFAULT_ALBUM_ART = "/usr/share/unity/icons/album_missing.png";
96-
97-ThumbnailGenerator::ThumbnailGenerator() : QQuickImageProvider(QQuickImageProvider::Image,
98- QQmlImageProviderBase::ForceAsynchronousImageLoading) {
99-
100-}
101-
102-QImage ThumbnailGenerator::requestImage(const QString &id, QSize *realSize,
103- const QSize &requestedSize) {
104- /* Allow appending a query string (e.g. ?something=timestamp)
105- * to the id and then ignore it.
106- * This is workaround to force reloading a thumbnail when it has
107- * the same file name on disk but we know the content has changed.
108- * It is necessary because in such a situation the QML image cache
109- * will kick in and this ImageProvider will never get called.
110- * The only "solution" is setting Image.cache = false, but in some
111- * cases we don't want to do that for performance reasons, so this
112- * is the only way around the issue for now. */
113- std::string src_path(QUrl(id).path().toUtf8().data());
114- std::string tgt_path;
115- const int xlarge_cutoff = 512;
116- const int large_cutoff = 256;
117- const int small_cutoff = 128;
118- try {
119- ThumbnailSize desiredSize;
120- if(requestedSize.width() > xlarge_cutoff || requestedSize.height() > xlarge_cutoff) {
121- desiredSize = TN_SIZE_ORIGINAL;
122- } else if(requestedSize.width() > large_cutoff || requestedSize.height() > large_cutoff) {
123- desiredSize = TN_SIZE_XLARGE;
124- } else if(requestedSize.width() > small_cutoff || requestedSize.height() > small_cutoff) {
125- desiredSize = TN_SIZE_LARGE;
126- } else {
127- desiredSize = TN_SIZE_SMALL;
128- }
129- tgt_path = tn.get_thumbnail(src_path, desiredSize);
130- if(!tgt_path.empty()) {
131- QString tgt(tgt_path.c_str());
132- QImage image;
133- image.load(tgt);
134- *realSize = image.size();
135- return image;
136- }
137- } catch(std::runtime_error &e) {
138- qDebug() << "Thumbnail generator failed: " << e.what();
139- }
140- return getFallbackImage(id, realSize, requestedSize);
141-}
142-
143-QImage ThumbnailGenerator::getFallbackImage(const QString &id, QSize *size,
144- const QSize &requestedSize) {
145- Q_UNUSED(requestedSize);
146- QMimeDatabase db;
147- QMimeType mime = db.mimeTypeForFile(id);
148- QImage result;
149- if(mime.name().contains("audio")) {
150- result.load(DEFAULT_ALBUM_ART);
151- } else if(mime.name().contains("video")) {
152- result.load(DEFAULT_VIDEO_ART);
153- }
154- *size = result.size();
155- return result;
156-}
157
158=== removed file 'modules/Ubuntu/Components/plugin/thumbnailgenerator.h'
159--- modules/Ubuntu/Components/plugin/thumbnailgenerator.h 2013-10-10 10:56:22 +0000
160+++ modules/Ubuntu/Components/plugin/thumbnailgenerator.h 1970-01-01 00:00:00 +0000
161@@ -1,36 +0,0 @@
162-/*
163- * Copyright 2013 Canonical Ltd.
164- *
165- * This program is free software; you can redistribute it and/or modify
166- * it under the terms of the GNU Lesser General Public License as published by
167- * the Free Software Foundation; version 3.
168- *
169- * This program is distributed in the hope that it will be useful,
170- * but WITHOUT ANY WARRANTY; without even the implied warranty of
171- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
172- * GNU Lesser General Public License for more details.
173- *
174- * You should have received a copy of the GNU Lesser General Public License
175- * along with this program. If not, see <http://www.gnu.org/licenses/>.
176- *
177- * Authors: Jussi Pakkanen <jussi.pakkanen@canonical.com>
178-*/
179-
180-#ifndef THUMBNAIL_GENERATOR_H
181-#define THUMBNAIL_GENERATOR_H
182-
183-#include <QQuickImageProvider>
184-#include <thumbnailer.h>
185-
186-class ThumbnailGenerator: public QQuickImageProvider
187-{
188-private:
189- Thumbnailer tn;
190-
191-public:
192- ThumbnailGenerator();
193- QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize);
194- QImage getFallbackImage(const QString &id, QSize *size, const QSize &requestedSize);
195-};
196-
197-#endif

Subscribers

People subscribed via source and target branches

to status/vote changes: