~ubuntu-branches/ubuntu/wily/kid3/wily

« back to all changes in this revision

Viewing changes to src/core/model/pixmapprovider.h

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2015-05-12 18:56:41 UTC
  • mfrom: (1.1.19) (2.3.3 sid)
  • Revision ID: package-import@ubuntu.com-20150512185641-hgeys2pingwq9mwn
Tags: 3.2.1-1
* New upstream release.
  - Add new build dependency qt4-dev-tools.
* Uploading to unstable.
* Switch to DEP5 debian/copyright format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file pixmapprovider.h
 
3
 * Image provider to get pixmaps by ID.
 
4
 *
 
5
 * \b Project: Kid3
 
6
 * \author Urs Fleisch
 
7
 * \date 21 Jun 2014
 
8
 *
 
9
 * Copyright (C) 2014  Urs Fleisch
 
10
 *
 
11
 * This file is part of Kid3.
 
12
 *
 
13
 * Kid3 is free software; you can redistribute it and/or modify
 
14
 * it under the terms of the GNU General Public License as published by
 
15
 * the Free Software Foundation; either version 2 of the License, or
 
16
 * (at your option) any later version.
 
17
 *
 
18
 * Kid3 is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU General Public License
 
24
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
25
 */
 
26
 
 
27
#ifndef PIXMAPPROVIDER_H
 
28
#define PIXMAPPROVIDER_H
 
29
 
 
30
#include <QByteArray>
 
31
#include <QPixmap>
 
32
#include "kid3api.h"
 
33
 
 
34
class TaggedFileIconProvider;
 
35
 
 
36
/**
 
37
 * Image provider to get pixmaps by ID.
 
38
 *
 
39
 * The following source IDs are supported (starting with "image://kid3/"):
 
40
 * - "fileicon/" followed by "null", "notag", "v1", "v2", "v1v2", or "modified",
 
41
 * - "data" followed by a changing string to force loading of the image set with
 
42
 *   TaggedFileIconProvider::setImageData().
 
43
 */
 
44
class KID3_CORE_EXPORT PixmapProvider {
 
45
public:
 
46
  /**
 
47
   * Constructor.
 
48
   * @param iconProvider icon provider to use
 
49
   */
 
50
  explicit PixmapProvider(TaggedFileIconProvider* iconProvider);
 
51
 
 
52
  /**
 
53
   * Destructor.
 
54
   */
 
55
  ~PixmapProvider();
 
56
 
 
57
  /**
 
58
   * Request a pixmap.
 
59
   * @param id ID of pixmap to get, "image://kid3/fileicon/..." or
 
60
   *  "image://kid3/data..."
 
61
   * @param size the original size of the image is returned here
 
62
   * @param requestedSize the size requested via the Image.sourceSize property
 
63
   * @return pixmap for ID.
 
64
   */
 
65
  QPixmap getPixmap(const QString& id, QSize* size, const QSize& requestedSize);
 
66
 
 
67
  /**
 
68
   * Get image data for the pixmap available via the "data" icon ID.
 
69
   * @return image data.
 
70
   */
 
71
  QByteArray getImageData() const { return m_data; }
 
72
 
 
73
  /**
 
74
   * Set image data for the pixmap available via the "data" icon ID.
 
75
   * @param data image data
 
76
   */
 
77
  void setImageData(const QByteArray& data) {
 
78
    m_data = data;
 
79
  }
 
80
 
 
81
private:
 
82
  TaggedFileIconProvider* m_fileIconProvider;
 
83
  QByteArray m_data;
 
84
  QPixmap m_dataPixmap;
 
85
  uint m_pixmapHash;
 
86
};
 
87
 
 
88
#endif // PIXMAPPROVIDER_H