~elopio/gallery-app/revert_workaround-1302706-click_toolbar_button_failure

« back to all changes in this revision

Viewing changes to src/photoeditor/photo-data.h

  • Committer: Leo Arias
  • Date: 2015-05-15 08:05:23 UTC
  • mfrom: (954.1.241 gallery-app)
  • Revision ID: leo.arias@canonical.com-20150515080523-i2of3vr8h7dioj59
Now the toolbar object is not needed at all.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011-2014 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authors:
 
17
 * Jim Nelson <jim@yorba.org>
 
18
 * Lucas Beeler <lucas@yorba.org>
 
19
 * Charles Lindsay <chaz@yorba.org>
 
20
 * Ugo Riboni <ugo.riboni@canonical.com>
 
21
 */
 
22
 
 
23
#ifndef PHOTO_DATA_H_
 
24
#define PHOTO_DATA_H_
 
25
 
 
26
// util
 
27
#include "orientation.h"
 
28
 
 
29
// QT
 
30
#include <QFileInfo>
 
31
#include <QVariant>
 
32
 
 
33
class PhotoEditCommand;
 
34
class PhotoEditThread;
 
35
 
 
36
/*!
 
37
 * \brief The Photo class
 
38
 */
 
39
class PhotoData : public QObject
 
40
{
 
41
    Q_OBJECT
 
42
 
 
43
    Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
 
44
    Q_PROPERTY(int orientation READ orientation NOTIFY orientationChanged)
 
45
    Q_PROPERTY(bool busy READ busy NOTIFY busyChanged)
 
46
 
 
47
public:
 
48
    explicit PhotoData();
 
49
    virtual ~PhotoData();
 
50
 
 
51
    static bool isValid(const QFileInfo& file);
 
52
 
 
53
    QString path() const;
 
54
    void setPath(QString path);
 
55
    QFileInfo file() const;
 
56
    bool busy() const;
 
57
 
 
58
    virtual Orientation orientation() const;
 
59
 
 
60
    Q_INVOKABLE void refreshFromDisk();
 
61
    Q_INVOKABLE void rotateRight();
 
62
    Q_INVOKABLE void autoEnhance();
 
63
    Q_INVOKABLE void exposureCompensation(qreal value);
 
64
    Q_INVOKABLE void crop(QVariant vrect);
 
65
 
 
66
    const QString &fileFormat() const;
 
67
    bool fileFormatHasMetadata() const;
 
68
    bool fileFormatHasOrientation() const;
 
69
 
 
70
Q_SIGNALS:
 
71
    void pathChanged();
 
72
    void orientationChanged();
 
73
    void busyChanged();
 
74
 
 
75
    void editFinished();
 
76
    void dataChanged();
 
77
 
 
78
private Q_SLOTS:
 
79
    void finishEditing();
 
80
 
 
81
private:
 
82
    void asyncEdit(const PhotoEditCommand& state);
 
83
 
 
84
    QString m_fileFormat;
 
85
    PhotoEditThread *m_editThread;
 
86
    QFileInfo m_file;
 
87
    bool m_busy;
 
88
 
 
89
    Orientation m_orientation;
 
90
};
 
91
 
 
92
#endif  // PHOTO_DATA_H_