~ubuntu-branches/ubuntu/edgy/digikam/edgy-proposed

« back to all changes in this revision

Viewing changes to utilities/imageviewer/imageview.h

  • Committer: Bazaar Package Importer
  • Author(s): Paul Telford
  • Date: 2004-09-23 17:21:39 UTC
  • Revision ID: james.westby@ubuntu.com-20040923172139-3b3ji0dvomon3lod
Tags: upstream-0.6.2
ImportĀ upstreamĀ versionĀ 0.6.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////////
 
2
//
 
3
//    IMAGEVIEW.H
 
4
//
 
5
//    Copyright (C) 2003-2004 Renchi Raju <renchi at pooh.tam.uiuc.edu>
 
6
//                            Gilles CAULIER <caulier dot gilles at free.fr>
 
7
//
 
8
//    Original printing code from Kuickshow program.
 
9
//    Copyright (C) 2002 Carsten Pfeiffer <pfeiffer at kde.org>
 
10
//
 
11
//    This program is free software; you can redistribute it and/or modify
 
12
//    it under the terms of the GNU General Public License as published by
 
13
//    the Free Software Foundation; either version 2 of the License, or
 
14
//    (at your option) any later version.
 
15
//
 
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.
 
20
//
 
21
//    You should have received a copy of the GNU General Public License
 
22
//    along with this program; if not, write to the Free Software
 
23
//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
24
//
 
25
//////////////////////////////////////////////////////////////////////////////
 
26
 
 
27
#ifndef IMAGEVIEW_H
 
28
#define IMAGEVIEW_H
 
29
 
 
30
// Qt lib includes
 
31
 
 
32
#include <qwidget.h>
 
33
#include <qfontmetrics.h>
 
34
#include <qstring.h>
 
35
#include <qguardedptr.h>
 
36
 
 
37
// KDE lib includes
 
38
 
 
39
#include <kurl.h>
 
40
#include <kio/job.h>
 
41
#include <kdeprint/kprintdialogpage.h>
 
42
 
 
43
// local includes.
 
44
 
 
45
#include "thumbnailjob.h"
 
46
 
 
47
class QPopupMenu;
 
48
class QCloseEvent;
 
49
class QCheckBox;
 
50
class QRadioButton;
 
51
 
 
52
class KComboBox;
 
53
class KPrinter;
 
54
class KIntNumInput;
 
55
 
 
56
class CAction;
 
57
class ImageViewPrivate;
 
58
 
 
59
class ImageView : public QWidget 
 
60
{
 
61
    Q_OBJECT
 
62
 
 
63
public:
 
64
 
 
65
    // For a list of items
 
66
    ImageView(QWidget* parent, const KURL::List& urlList,
 
67
              const KURL& urlCurrent, bool fromCameraUI=false);
 
68
 
 
69
    // For a single item
 
70
    ImageView(QWidget* parent, const KURL& urlCurrent,
 
71
              bool fromCameraUI=false);
 
72
    
 
73
    ~ImageView();
 
74
 
 
75
private:
 
76
 
 
77
    void init();
 
78
    void initGui();
 
79
    void readSettings();
 
80
    void saveSettings();
 
81
    void setupConnections();
 
82
    void setupActions();
 
83
    void setupButtons();
 
84
    void setupPopupMenu();
 
85
    void addMenuItem(QPopupMenu *menu, CAction *action);
 
86
    void addKeyInDict(const QString& key);
 
87
    void promptUserSave();
 
88
    void loadCurrentItem();
 
89
    void setPrevAction(bool val);
 
90
    void setNextAction(bool val);
 
91
    
 
92
    // For printing. 
 
93
    
 
94
    bool printImageWithQt( const QString& filename, KPrinter& printer,
 
95
                           const QString& originalFileName );
 
96
    void addConfigPages();
 
97
    QString minimizeString( QString text, const QFontMetrics& metrics,
 
98
                            int maxWidth );                           
 
99
 
 
100
    ImageViewPrivate *d;
 
101
    
 
102
    KURL              newFile;
 
103
    bool              fromCameraUIFlag;     // Flag used for to limit ImageViewer options 
 
104
                                            // when the images are opened from the cameraUI 
 
105
                                            // interface (like 'Image Comments Editor'
 
106
                                            // and 'Remove From Album').
 
107
                                            
 
108
    QGuardedPtr<Digikam::ThumbnailJob> m_thumbJob;                                            
 
109
 
 
110
protected:
 
111
 
 
112
    void closeEvent(QCloseEvent *e);
 
113
 
 
114
private slots:
 
115
 
 
116
    void slotNextImage();
 
117
    void slotPrevImage();
 
118
    void slotShowRotateMenu();
 
119
    void slotShowFlipMenu();
 
120
    void slotShowContextMenu();
 
121
    void slotSave();
 
122
    void slotSaveAs();
 
123
    void slotSaveResult(KIO::Job *job);
 
124
    void slotSaveAsResult(KIO::Job *job);
 
125
    void slotToggleAutoZoom();
 
126
    void slotToggleFullScreen();
 
127
    void slotZoomChanged(double zoom);
 
128
    void slotCropSelected(bool val);
 
129
    void slotChanged(bool val);
 
130
    void slotClose();
 
131
    void slotBCGEdit();
 
132
    void slotCommentsEdit();
 
133
    void slotExifInfo();
 
134
    void slotRemoveCurrentItemfromAlbum();
 
135
    void slot_onDeleteCurrentItemFinished(KIO::Job *job);
 
136
    void slotKeyPress(int key);
 
137
    void slotPrintImage();
 
138
    void slotImageProperties();
 
139
    void slotImageNameActived(const QString & filename);
 
140
    void slotHelp(void);
 
141
    void slotAbout(void);
 
142
    void slotGotPreview(const KURL &url, const QPixmap &pixmap);
 
143
    void slotPreviewCompleted(void);
 
144
};
 
145
 
 
146
 
 
147
///////////////////////////////////////////////////////////////////////////////////
 
148
 
 
149
class ImageViewPrintDialogPage : public KPrintDialogPage
 
150
{
 
151
    Q_OBJECT
 
152
 
 
153
public:
 
154
 
 
155
    ImageViewPrintDialogPage( QWidget *parent = 0L, const char *name = 0 );
 
156
    ~ImageViewPrintDialogPage();
 
157
 
 
158
    virtual void getOptions(QMap<QString,QString>& opts, bool incldef = false);
 
159
    virtual void setOptions(const QMap<QString,QString>& opts);
 
160
 
 
161
private slots:
 
162
 
 
163
    void toggleScaling( bool enable );
 
164
 
 
165
private:
 
166
 
 
167
    // return values in pixels!
 
168
    int scaleWidth() const;
 
169
    int scaleHeight() const;
 
170
 
 
171
    void setScaleWidth( int pixels );
 
172
    void setScaleHeight( int pixels );
 
173
 
 
174
    int fromUnitToPixels( float val ) const;
 
175
    float pixelsToUnit( int pixels ) const;
 
176
 
 
177
    QCheckBox *m_shrinkToFit;
 
178
    QRadioButton *m_scale;
 
179
    KIntNumInput *m_width;
 
180
    KIntNumInput *m_height;
 
181
    KComboBox *m_units;
 
182
    QCheckBox *m_addFileName;
 
183
    QCheckBox *m_blackwhite;
 
184
};
 
185
 
 
186
#endif // IMAGEVIEW_H