~ubuntu-branches/ubuntu/edgy/gwenview/edgy

« back to all changes in this revision

Viewing changes to src/gvimagepart/gvimagepart.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-12-06 17:59:19 UTC
  • mfrom: (1.1.3 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20051206175919-8yv9nfmw0pws6p52
Tags: 1.3.1-0ubuntu1
* Sync with Debian
* Edit kde.mk for .pot generation

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright 2004 Jonathan Riddell <jr@jriddell.org>
 
3
 
 
4
This program is free software; you can redistribute it and/or
 
5
modify it under the terms of the GNU General Public License
 
6
as published by the Free Software Foundation; either version 2
 
7
of the License, or (at your option) any later version.
 
8
 
 
9
This program is distributed in the hope that it will be useful,
 
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
GNU General Public License for more details.
 
13
 
 
14
You should have received a copy of the GNU General Public License
 
15
along with this program; if not, write to the Free Software
 
16
Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA  02111-1307, USA.
 
17
 
 
18
*/
 
19
#ifndef __gvimagepart_h__
 
20
#define __gvimagepart_h__
 
21
 
 
22
#include <kparts/part.h>
 
23
#include <kparts/browserextension.h>
 
24
 
 
25
// Forward declarations
 
26
class KAboutData;
 
27
class KAction;
 
28
class KDirLister;
 
29
class KFileItem;
 
30
 
 
31
namespace Gwenview {
 
32
class ImageView;
 
33
class Document;
 
34
class ImageLoader;
 
35
 
 
36
class GVImagePart;
 
37
 
 
38
/**
 
39
 * The browser extension is an attribute of GVImagePart and provides
 
40
 * some services to Konqueror.  All Konqueror KParts have one.
 
41
 */
 
42
class GVImagePartBrowserExtension: public KParts::BrowserExtension {
 
43
        Q_OBJECT
 
44
 
 
45
public:
 
46
        GVImagePartBrowserExtension(GVImagePart* viewPart, const char* name=0L);
 
47
        ~GVImagePartBrowserExtension();
 
48
 
 
49
//protected slots:
 
50
public slots:
 
51
        void contextMenu();
 
52
        void print();
 
53
private:
 
54
        GVImagePart* mGVImagePart;
 
55
};
 
56
 
 
57
/**
 
58
 * A Read Only KPart to view images using Gwenview
 
59
 */
 
60
class GVImagePart : public KParts::ReadOnlyPart {
 
61
        Q_OBJECT
 
62
public:
 
63
        GVImagePart(QWidget*, const char*, QObject*, const char*, const QStringList &);
 
64
        virtual ~GVImagePart();
 
65
 
 
66
        /**
 
67
         * Return information about the part
 
68
         */
 
69
        static KAboutData* createAboutData();
 
70
 
 
71
        /**
 
72
         * Returns m_file
 
73
         */
 
74
        QString filePath();
 
75
 
 
76
        /**
 
77
         * Print the image being viewed
 
78
         */
 
79
        void print();
 
80
 
 
81
public slots:
 
82
        virtual bool openURL(const KURL& url);
 
83
 
 
84
protected slots:
 
85
        virtual bool openFile() { return false; }
 
86
        /**
 
87
         * Sets Konqueror's caption, statusbar and emits completed().
 
88
         * Called by loaded() signal in Document
 
89
         */
 
90
        void loaded(const KURL& url);
 
91
 
 
92
        /**
 
93
         * Rotates the current image 90 degrees clockwise
 
94
         */
 
95
        void rotateRight();
 
96
 
 
97
protected:
 
98
        void partActivateEvent(KParts::PartActivateEvent* event);
 
99
 
 
100
private slots:
 
101
 
 
102
        void dirListerClear();
 
103
 
 
104
        void dirListerNewItems( const KFileItemList& );
 
105
 
 
106
        void dirListerDeleteItem(KFileItem*);
 
107
 
 
108
        void slotSelectNext();
 
109
        void slotSelectPrevious();
 
110
 
 
111
        void prefetchDone();
 
112
 
 
113
private:
 
114
 
 
115
        void updateNextPrevious();
 
116
        KURL nextURL() const;
 
117
        KURL previousURL() const;
 
118
 
 
119
        /**
 
120
         * The component's widget
 
121
         */
 
122
        ImageView* mImageView;
 
123
 
 
124
        /**
 
125
         * Holds the image
 
126
         */
 
127
        Document* mDocument;
 
128
 
 
129
        /**
 
130
         * This inherits from KParts::BrowserExtention and supplies
 
131
         * some extra functionality to Konqueror.
 
132
         */
 
133
        GVImagePartBrowserExtension* mBrowserExtension;
 
134
 
 
135
        // for the next/previous actions
 
136
        KDirLister* mDirLister;
 
137
 
 
138
        KAction* mNextImage;
 
139
        KAction* mPreviousImage;
 
140
        // alphabetically sorted filenames of images in the picture's directory
 
141
        QStringList mImagesInDirectory;
 
142
 
 
143
        ImageLoader* mPrefetch;
 
144
        enum LastDirection { DirectionUnknown, DirectionNext, DirectionPrevious };
 
145
        LastDirection mLastDirection; // used for prefetching
 
146
};
 
147
 
 
148
} // namespace
 
149
#endif