1
/* ============================================================
3
* This file is a part of kipi-plugins project
4
* http://www.kipi-plugins.org
7
* Description : Figure out camera clock delta from a clock picture.
9
* Copyright (C) 2009 by Pieter Edelman (p dot edelman at gmx dot net)
11
* This program is free software; you can redistribute it
12
* and/or modify it under the terms of the GNU General
13
* Public License as published by the Free Software Foundation;
14
* either version 2, or (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* ============================================================ */
23
#ifndef CLOCKPHOTODIALOG_H
24
#define CLOCKPHOTODIALOG_H
29
#include <QScrollArea>
48
namespace KIPITimeAdjustPlugin
51
/* Overloaded class for displaying the image in a QScrollArea, to provide
52
* support for dragging it around with the middle button. */
53
class ImageDisplay : public QLabel
59
ImageDisplay(QScrollArea *);
63
void mousePressEvent(QMouseEvent*);
64
void mouseMoveEvent(QMouseEvent*);
65
void mouseReleaseEvent(QMouseEvent*);
76
// -----------------------------------------------------------------------------------
78
class ClockPhotoDialogPrivate;
80
/* Class for determining the camera time difference from a photo of a time
81
* display. The user can load a photo and tell the time displayed on this
82
* photo. This class calculates the time difference and stores it in a set
83
* of public variables: deltaNegative indicates whether the time should be
84
* added (false) or subtracted (true). deltaDays, deltaHours, deltaMinutes
85
* and deltaSeconds hold the numbers of days, hours, minutes and seconds
86
* to add or subtract. Months and years are not used, because these can be
88
class ClockPhotoDialog : public KDialog
94
ClockPhotoDialog(KIPI::Interface* interface, QWidget* parent);
97
/* The public variables that hold the time difference. */
104
/* Try to load the photo specified by the KUrl, and set the datetime widget
105
* to the photo time. Return true on succes, or false if eithe the photo
106
* can't be read or the datetime information can't be read. */
107
bool setImage(const KUrl&);
111
void resizeEvent(QResizeEvent *);
115
void slotLoadPhoto();
116
void slotAdjustZoom(int);
124
/* Calculate the minimum value for the scroll slider according to the window
125
* size. If fit is true, the image is made to fit in the viewport. */
126
void adjustToWindowSize(bool);
132
QDateTime photoDateTime;
133
ClockPhotoDialogPrivate* const d;
136
} // namespace KIPITimeAdjustPlugin
138
#endif /* CLOCKPHOTODIALOG_H */