-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.h | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index 039dfa3..d56d65a 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp | |||
@@ -1,203 +1,203 @@ | |||
1 | #include "imageinfoui.h" | 1 | #include "imageinfoui.h" |
2 | 2 | ||
3 | #include <qframe.h> | 3 | #include <qframe.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qtextview.h> | 6 | #include <qtextview.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | #include <qvariant.h> | 8 | #include <qvariant.h> |
9 | #include <qtooltip.h> | 9 | #include <qtooltip.h> |
10 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
11 | #include <qimage.h> | 11 | #include <qimage.h> |
12 | #include <qpixmap.h> | 12 | #include <qpixmap.h> |
13 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | 15 | ||
16 | #include "lib/slavemaster.h" | 16 | #include "lib/slavemaster.h" |
17 | #include "lib/imagecache.h" | 17 | #include "lib/imagecache.h" |
18 | 18 | ||
19 | #include <opie2/oconfig.h> | 19 | #include <opie2/oconfig.h> |
20 | #include <opie2/oconfig.h> | 20 | #include <opie2/oconfig.h> |
21 | #include <opie2/okeyconfigwidget.h> | 21 | #include <opie2/okeyconfigwidget.h> |
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | 23 | ||
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | 26 | ||
27 | static const int THUMBSIZE = 128; | 27 | static const int THUMBSIZE = 128; |
28 | 28 | ||
29 | using namespace Opie::Core; | 29 | using namespace Opie::Core; |
30 | 30 | ||
31 | imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) | 31 | imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) |
32 | : QWidget( parent, name, fl ) | 32 | : QWidget( parent, name, fl ) |
33 | { | 33 | { |
34 | m_viewManager = 0; | 34 | m_viewManager = 0; |
35 | init(name); | 35 | init(name); |
36 | initKeys(); | 36 | initKeys(); |
37 | } | 37 | } |
38 | 38 | ||
39 | imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) | 39 | imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) |
40 | : QWidget( parent, name, fl ),currentFile(_path) | 40 | : QWidget( parent, name, fl ),currentFile(_path) |
41 | { | 41 | { |
42 | m_viewManager = 0; | 42 | m_viewManager = 0; |
43 | init(name); | 43 | init(name); |
44 | initKeys(); | 44 | initKeys(); |
45 | slotChangeName(_path); | 45 | slotChangeName(_path); |
46 | } | 46 | } |
47 | 47 | ||
48 | Opie::Ui::OKeyConfigManager* imageinfo::manager() | 48 | Opie::Ui::OKeyConfigManager* imageinfo::manager() |
49 | { | 49 | { |
50 | if (!m_viewManager) { | 50 | if (!m_viewManager) { |
51 | initKeys(); | 51 | initKeys(); |
52 | } | 52 | } |
53 | return m_viewManager; | 53 | return m_viewManager; |
54 | } | 54 | } |
55 | 55 | ||
56 | void imageinfo::initKeys() | 56 | void imageinfo::initKeys() |
57 | { | 57 | { |
58 | odebug << "init imageinfo keys" << oendl; | 58 | odebug << "init imageinfo keys" << oendl; |
59 | m_cfg = new Opie::Core::OConfig("phunkview"); | 59 | m_cfg = new Opie::Core::OConfig("phunkview"); |
60 | m_cfg->setGroup("Zecke_view" ); | 60 | m_cfg->setGroup("Zecke_view" ); |
61 | Opie::Ui::OKeyPair::List lst; | 61 | Opie::Ui::OKeyPair::List lst; |
62 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); | 62 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); |
63 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); | 63 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); |
64 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); | 64 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); |
65 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); | 65 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); |
66 | // lst.append( Opie::Ui::OKeyPair::returnKey() ); | 66 | lst.append( Opie::Ui::OKeyPair::returnKey() ); |
67 | 67 | ||
68 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageinfo-KeyBoard-Config", | 68 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageinfo-KeyBoard-Config", |
69 | lst, false,this, "keyconfig name" ); | 69 | lst, false,this, "keyconfig name" ); |
70 | m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "view", | 70 | m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "view", |
71 | Resource::loadPixmap("1to1"), ViewItem, | 71 | Resource::loadPixmap("1to1"), ViewItem, |
72 | Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), | 72 | Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), |
73 | this, SLOT(slotShowImage()))); | 73 | this, SLOT(slotShowImage()))); |
74 | m_viewManager->load(); | 74 | m_viewManager->load(); |
75 | m_viewManager->handleWidget( this ); | 75 | m_viewManager->handleWidget( this ); |
76 | m_viewManager->handleWidget( TextView1 ); | 76 | m_viewManager->handleWidget( TextView1 ); |
77 | } | 77 | } |
78 | 78 | ||
79 | void imageinfo::slotShowImage() | 79 | void imageinfo::slotShowImage() |
80 | { | 80 | { |
81 | emit dispImage(currentFile); | 81 | emit dispImage(currentFile); |
82 | } | 82 | } |
83 | 83 | ||
84 | void imageinfo::init(const char* name) { | 84 | void imageinfo::init(const char* name) { |
85 | { | 85 | { |
86 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 86 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
87 | } | 87 | } |
88 | if ( !name ) | 88 | if ( !name ) |
89 | setName( "imageinfo" ); | 89 | setName( "imageinfo" ); |
90 | resize( 289, 335 ); | 90 | resize( 289, 335 ); |
91 | setCaption( tr( "Image info" ) ); | 91 | setCaption( tr( "Image info" ) ); |
92 | imageinfoLayout = new QVBoxLayout( this ); | 92 | imageinfoLayout = new QVBoxLayout( this ); |
93 | imageinfoLayout->setSpacing(2); | 93 | imageinfoLayout->setSpacing(2); |
94 | imageinfoLayout->setMargin(4); | 94 | imageinfoLayout->setMargin(4); |
95 | 95 | ||
96 | PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); | 96 | PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); |
97 | PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); | 97 | PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); |
98 | QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); | 98 | QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); |
99 | 99 | ||
100 | imageinfoLayout->addWidget( PixmapLabel1 ); | 100 | imageinfoLayout->addWidget( PixmapLabel1 ); |
101 | 101 | ||
102 | Line1 = new QFrame( this, "Line1" ); | 102 | Line1 = new QFrame( this, "Line1" ); |
103 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 103 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
104 | imageinfoLayout->addWidget( Line1 ); | 104 | imageinfoLayout->addWidget( Line1 ); |
105 | 105 | ||
106 | fnameLabel = new QLabel( this, "FnameLabel" ); | 106 | fnameLabel = new QLabel( this, "FnameLabel" ); |
107 | imageinfoLayout->addWidget( fnameLabel); | 107 | imageinfoLayout->addWidget( fnameLabel); |
108 | 108 | ||
109 | TextView1 = new QTextView( this, "TextView1" ); | 109 | TextView1 = new QTextView( this, "TextView1" ); |
110 | TextView1->setFrameShadow( QTextView::Sunken ); | 110 | TextView1->setFrameShadow( QTextView::Sunken ); |
111 | TextView1->setResizePolicy( QTextView::AutoOneFit ); | 111 | TextView1->setResizePolicy( QTextView::AutoOneFit ); |
112 | TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); | 112 | TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); |
113 | TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); | 113 | TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); |
114 | // TextView1->setVScrollBarMode(QScrollView::AlwaysOn); | 114 | // TextView1->setVScrollBarMode(QScrollView::AlwaysOn); |
115 | QWhatsThis::add( TextView1, tr("Displays info of selected image") ); | 115 | QWhatsThis::add( TextView1, tr("Displays info of selected image") ); |
116 | imageinfoLayout->addWidget( TextView1 ); | 116 | imageinfoLayout->addWidget( TextView1 ); |
117 | 117 | ||
118 | SlaveMaster* master = SlaveMaster::self(); | 118 | SlaveMaster* master = SlaveMaster::self(); |
119 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 119 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
120 | this, SLOT(slot_fullInfo(const QString&, const QString&)) ); | 120 | this, SLOT(slot_fullInfo(const QString&, const QString&)) ); |
121 | connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | 121 | connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), |
122 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | 122 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); |
123 | } | 123 | } |
124 | 124 | ||
125 | void imageinfo::slotChangeName(const QString&_path) | 125 | void imageinfo::slotChangeName(const QString&_path) |
126 | { | 126 | { |
127 | currentFile=_path; | 127 | currentFile=_path; |
128 | QFileInfo fi(_path); | 128 | QFileInfo fi(_path); |
129 | fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>"); | 129 | fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>"); |
130 | SlaveMaster::self()->imageInfo( currentFile ); | 130 | SlaveMaster::self()->imageInfo( currentFile ); |
131 | 131 | ||
132 | QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); | 132 | QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); |
133 | if (!m_pix) { | 133 | if (!m_pix) { |
134 | PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); | 134 | PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); |
135 | SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); | 135 | SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); |
136 | } else { | 136 | } else { |
137 | PixmapLabel1->setPixmap(*m_pix); | 137 | PixmapLabel1->setPixmap(*m_pix); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | imageinfo::~imageinfo() | 141 | imageinfo::~imageinfo() |
142 | { | 142 | { |
143 | { | 143 | { |
144 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 144 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
145 | } | 145 | } |
146 | if (m_viewManager) { | 146 | if (m_viewManager) { |
147 | m_viewManager->save(); | 147 | m_viewManager->save(); |
148 | delete m_viewManager; | 148 | delete m_viewManager; |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) | 152 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) |
153 | { | 153 | { |
154 | if (_path == currentFile) { | 154 | if (_path == currentFile) { |
155 | qDebug(_t); | 155 | qDebug(_t); |
156 | QString t = _t; | 156 | QString t = _t; |
157 | t.replace(QRegExp("\n"),"<br>"); | 157 | t.replace(QRegExp("\n"),"<br>"); |
158 | /* t.replace(QRegeExp("<qt>",""); | 158 | /* t.replace(QRegeExp("<qt>",""); |
159 | t.replace(QRegeExp("</qt>","");*/ | 159 | t.replace(QRegeExp("</qt>","");*/ |
160 | TextView1->setText(t); | 160 | TextView1->setText(t); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) | 164 | void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) |
165 | { | 165 | { |
166 | if (_path == currentFile) { | 166 | if (_path == currentFile) { |
167 | if (_pix.width()>0) { | 167 | if (_pix.width()>0) { |
168 | PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); | 168 | PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); |
169 | PixmapLabel1->setPixmap( _pix ); | 169 | PixmapLabel1->setPixmap( _pix ); |
170 | PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); | 170 | PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | void imageinfo::setPath( const QString& str ) { | 175 | void imageinfo::setPath( const QString& str ) { |
176 | slotChangeName( str ); | 176 | slotChangeName( str ); |
177 | } | 177 | } |
178 | 178 | ||
179 | void imageinfo::setDestructiveClose() { | 179 | void imageinfo::setDestructiveClose() { |
180 | WFlags fl = getWFlags(); | 180 | WFlags fl = getWFlags(); |
181 | /* clear it just in case */ | 181 | /* clear it just in case */ |
182 | fl &= ~WDestructiveClose; | 182 | fl &= ~WDestructiveClose; |
183 | fl |= WDestructiveClose; | 183 | fl |= WDestructiveClose; |
184 | setWFlags( fl ); | 184 | setWFlags( fl ); |
185 | } | 185 | } |
186 | 186 | ||
187 | 187 | ||
188 | /* for testing */ | 188 | /* for testing */ |
189 | infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name) | 189 | infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name) |
190 | :QDialog(parent,name,true,WStyle_ContextHelp) | 190 | :QDialog(parent,name,true,WStyle_ContextHelp) |
191 | { | 191 | { |
192 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 192 | QVBoxLayout*dlglayout = new QVBoxLayout(this); |
193 | dlglayout->setSpacing(2); | 193 | dlglayout->setSpacing(2); |
194 | dlglayout->setMargin(1); | 194 | dlglayout->setMargin(1); |
195 | imageinfo*inf = new imageinfo(fname,this); | 195 | imageinfo*inf = new imageinfo(fname,this); |
196 | dlglayout->addWidget(inf); | 196 | dlglayout->addWidget(inf); |
197 | } | 197 | } |
198 | 198 | ||
199 | infoDlg::~infoDlg() | 199 | infoDlg::~infoDlg() |
200 | { | 200 | { |
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.h b/noncore/graphics/opie-eye/gui/imageinfoui.h index 0a5e183..0ffa423 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.h +++ b/noncore/graphics/opie-eye/gui/imageinfoui.h | |||
@@ -1,77 +1,78 @@ | |||
1 | #ifndef IMAGEINFO_H | 1 | #ifndef IMAGEINFO_H |
2 | #define IMAGEINFO_H | 2 | #define IMAGEINFO_H |
3 | 3 | ||
4 | #include <qvariant.h> | 4 | #include <qvariant.h> |
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | #include <qdialog.h> | 6 | #include <qdialog.h> |
7 | 7 | ||
8 | class QVBoxLayout; | 8 | class QVBoxLayout; |
9 | class QHBoxLayout; | 9 | class QHBoxLayout; |
10 | class QGridLayout; | 10 | class QGridLayout; |
11 | class QFrame; | 11 | class QFrame; |
12 | class QLabel; | 12 | class QLabel; |
13 | class QTextView; | 13 | class QTextView; |
14 | 14 | ||
15 | namespace Opie { | 15 | namespace Opie { |
16 | namespace Core { | 16 | namespace Core { |
17 | class OConfig; | 17 | class OConfig; |
18 | } | 18 | } |
19 | namespace Ui { | 19 | namespace Ui { |
20 | class OKeyConfigManager; | 20 | class OKeyConfigManager; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | class imageinfo : public QWidget | 24 | class imageinfo : public QWidget |
25 | { | 25 | { |
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | enum ActionIds { | 27 | enum ActionIds { |
28 | ViewItem | 28 | ViewItem |
29 | }; | 29 | }; |
30 | 30 | ||
31 | public: | 31 | public: |
32 | imageinfo( QWidget* parent = 0, const char* name = 0, WFlags fl =0); | 32 | imageinfo( QWidget* parent = 0, const char* name = 0, WFlags fl =0); |
33 | imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 33 | imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
34 | ~imageinfo(); | 34 | virtual ~imageinfo(); |
35 | 35 | ||
36 | void setDestructiveClose(); | 36 | void setDestructiveClose(); |
37 | Opie::Ui::OKeyConfigManager* manager(); | 37 | Opie::Ui::OKeyConfigManager* manager(); |
38 | 38 | ||
39 | signals: | 39 | signals: |
40 | void dispImage(const QString&); | 40 | void dispImage(const QString&); |
41 | void sig_return(); | ||
41 | 42 | ||
42 | public slots: | 43 | public slots: |
43 | void setPath( const QString& path ); | 44 | virtual void setPath( const QString& path ); |
44 | void slotShowImage(); | 45 | virtual void slotShowImage(); |
45 | 46 | ||
46 | private: | 47 | private: |
47 | void init(const char* name); | 48 | void init(const char* name); |
48 | 49 | ||
49 | protected: | 50 | protected: |
50 | QLabel* PixmapLabel1; | 51 | QLabel* PixmapLabel1; |
51 | QLabel* fnameLabel; | 52 | QLabel* fnameLabel; |
52 | QFrame* Line1; | 53 | QFrame* Line1; |
53 | QTextView* TextView1; | 54 | QTextView* TextView1; |
54 | QVBoxLayout* imageinfoLayout; | 55 | QVBoxLayout* imageinfoLayout; |
55 | QString currentFile; | 56 | QString currentFile; |
56 | 57 | ||
57 | Opie::Core::OConfig * m_cfg; | 58 | Opie::Core::OConfig * m_cfg; |
58 | Opie::Ui::OKeyConfigManager*m_viewManager; | 59 | Opie::Ui::OKeyConfigManager*m_viewManager; |
59 | void initKeys(); | 60 | void initKeys(); |
60 | 61 | ||
61 | protected slots: | 62 | protected slots: |
62 | virtual void slot_fullInfo(const QString&, const QString&); | 63 | virtual void slot_fullInfo(const QString&, const QString&); |
63 | virtual void slotThumbNail(const QString&, const QPixmap&); | 64 | virtual void slotThumbNail(const QString&, const QPixmap&); |
64 | 65 | ||
65 | virtual void slotChangeName(const QString&); | 66 | virtual void slotChangeName(const QString&); |
66 | }; | 67 | }; |
67 | 68 | ||
68 | /* for testing purpose */ | 69 | /* for testing purpose */ |
69 | class infoDlg:public QDialog | 70 | class infoDlg:public QDialog |
70 | { | 71 | { |
71 | Q_OBJECT | 72 | Q_OBJECT |
72 | public: | 73 | public: |
73 | infoDlg(const QString&,QWidget * parent=0, const char * name=0); | 74 | infoDlg(const QString&,QWidget * parent=0, const char * name=0); |
74 | virtual ~infoDlg(); | 75 | virtual ~infoDlg(); |
75 | }; | 76 | }; |
76 | 77 | ||
77 | #endif // IMAGEINFO_H | 78 | #endif // IMAGEINFO_H |