-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 13 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 114 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.h | 48 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 8 |
4 files changed, 177 insertions, 6 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index f415d39..ac4b899 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -1,69 +1,70 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "iconview.h" | 6 | #include "iconview.h" |
7 | 7 | ||
8 | #include <lib/imagecache.h> | 8 | #include <lib/imagecache.h> |
9 | #include <gui/imageinfoui.h> | ||
9 | 10 | ||
10 | #include <iface/dirview.h> | 11 | #include <iface/dirview.h> |
11 | #include <iface/dirlister.h> | 12 | #include <iface/dirlister.h> |
12 | 13 | ||
13 | #include <opie2/oconfig.h> | 14 | #include <opie2/oconfig.h> |
14 | #include <opie2/okeyconfigwidget.h> | 15 | #include <opie2/okeyconfigwidget.h> |
15 | #include <opie2/odebug.h> | 16 | #include <opie2/odebug.h> |
16 | 17 | ||
17 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
18 | #include <qpe/qpemessagebox.h> | 19 | #include <qpe/qpemessagebox.h> |
19 | #include <qpe/ir.h> | 20 | #include <qpe/ir.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
21 | 22 | #include <qpe/qpeapplication.h> | |
22 | 23 | ||
23 | #include <qiconview.h> | 24 | #include <qiconview.h> |
24 | #include <qlabel.h> | 25 | #include <qlabel.h> |
25 | #include <qhbox.h> | 26 | #include <qhbox.h> |
26 | #include <qcombobox.h> | 27 | #include <qcombobox.h> |
27 | #include <qdir.h> | 28 | #include <qdir.h> |
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | #include <qmainwindow.h> | 30 | #include <qmainwindow.h> |
30 | #include <qtimer.h> | 31 | #include <qtimer.h> |
31 | #include <qstyle.h> | 32 | #include <qstyle.h> |
32 | 33 | ||
33 | 34 | ||
34 | using Opie::Ui::OKeyConfigItem; | 35 | using Opie::Ui::OKeyConfigItem; |
35 | 36 | ||
36 | namespace { | 37 | namespace { |
37 | QPixmap* _dirPix = 0; | 38 | QPixmap* _dirPix = 0; |
38 | QPixmap* _unkPix = 0; | 39 | QPixmap* _unkPix = 0; |
39 | class IconViewItem : public QIconViewItem { | 40 | class IconViewItem : public QIconViewItem { |
40 | public: | 41 | public: |
41 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); | 42 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); |
42 | QPixmap* pixmap()const; | 43 | QPixmap* pixmap()const; |
43 | QString path()const { return m_path; } | 44 | QString path()const { return m_path; } |
44 | bool isDir()const { return m_isDir; } | 45 | bool isDir()const { return m_isDir; } |
45 | void setText( const QString& ); | 46 | void setText( const QString& ); |
46 | 47 | ||
47 | 48 | ||
48 | private: | 49 | private: |
49 | mutable QPixmap* m_pix; | 50 | mutable QPixmap* m_pix; |
50 | QString m_path; | 51 | QString m_path; |
51 | bool m_isDir : 1; | 52 | bool m_isDir : 1; |
52 | bool m_noInfo :1; | 53 | bool m_noInfo :1; |
53 | }; | 54 | }; |
54 | 55 | ||
55 | 56 | ||
56 | /* | 57 | /* |
57 | * If we request an Image or String | 58 | * If we request an Image or String |
58 | * we add it to the map | 59 | * we add it to the map |
59 | */ | 60 | */ |
60 | QMap<QString, IconViewItem*> g_stringInf; | 61 | QMap<QString, IconViewItem*> g_stringInf; |
61 | QMap<QString, IconViewItem*> g_stringPix; | 62 | QMap<QString, IconViewItem*> g_stringPix; |
62 | 63 | ||
63 | IconViewItem::IconViewItem( QIconView* view,const QString& path, | 64 | IconViewItem::IconViewItem( QIconView* view,const QString& path, |
64 | const QString& name, bool isDir ) | 65 | const QString& name, bool isDir ) |
65 | : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), | 66 | : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), |
66 | m_noInfo( false ) | 67 | m_noInfo( false ) |
67 | { | 68 | { |
68 | if ( isDir && !_dirPix ) | 69 | if ( isDir && !_dirPix ) |
69 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); | 70 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); |
@@ -331,53 +332,59 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { | |||
331 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); | 332 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); |
332 | 333 | ||
333 | 334 | ||
334 | g_stringPix.remove( _path ); | 335 | g_stringPix.remove( _path ); |
335 | } | 336 | } |
336 | 337 | ||
337 | 338 | ||
338 | void PIconView::slotRename() { | 339 | void PIconView::slotRename() { |
339 | 340 | ||
340 | } | 341 | } |
341 | 342 | ||
342 | void PIconView::slotBeam() { | 343 | void PIconView::slotBeam() { |
343 | bool isDir; | 344 | bool isDir; |
344 | QString pa = currentFileName( isDir ); | 345 | QString pa = currentFileName( isDir ); |
345 | if ( isDir && pa.isEmpty() ) | 346 | if ( isDir && pa.isEmpty() ) |
346 | return; | 347 | return; |
347 | 348 | ||
348 | Ir* ir = new Ir( this ); | 349 | Ir* ir = new Ir( this ); |
349 | connect( ir, SIGNAL(done(Ir*)), | 350 | connect( ir, SIGNAL(done(Ir*)), |
350 | this, SLOT(slotBeamDone(Ir*))); | 351 | this, SLOT(slotBeamDone(Ir*))); |
351 | ir->send(pa, tr( "Image" ) ); | 352 | ir->send(pa, tr( "Image" ) ); |
352 | 353 | ||
353 | } | 354 | } |
354 | 355 | ||
355 | void PIconView::slotBeamDone( Ir* ir) { | 356 | void PIconView::slotBeamDone( Ir* ir) { |
356 | delete ir; | 357 | delete ir; |
357 | } | 358 | } |
358 | 359 | ||
359 | void PIconView::slotStart() { | 360 | void PIconView::slotStart() { |
360 | m_view->viewport()->setUpdatesEnabled( false ); | 361 | m_view->viewport()->setUpdatesEnabled( false ); |
361 | qWarning( "Sig Start" ); | 362 | qWarning( "Sig Start" ); |
362 | } | 363 | } |
363 | 364 | ||
364 | void PIconView::slotEnd() { | 365 | void PIconView::slotEnd() { |
365 | qWarning( "SLot End" ); | 366 | qWarning( "SLot End" ); |
366 | if ( m_updatet ) | 367 | if ( m_updatet ) |
367 | m_view->arrangeItemsInGrid( ); | 368 | m_view->arrangeItemsInGrid( ); |
368 | m_view->viewport()->setUpdatesEnabled( true ); | 369 | m_view->viewport()->setUpdatesEnabled( true ); |
369 | m_updatet = false; | 370 | m_updatet = false; |
370 | } | 371 | } |
371 | 372 | ||
372 | void PIconView::slotShowImage() { | 373 | void PIconView::slotShowImage() { |
373 | 374 | ||
374 | } | 375 | } |
375 | void PIconView::slotShowImage( const QString& ) { | 376 | void PIconView::slotShowImage( const QString& ) { |
376 | 377 | ||
377 | } | 378 | } |
378 | void PIconView::slotImageInfo() { | 379 | void PIconView::slotImageInfo() { |
379 | 380 | qDebug("image info"); | |
381 | bool isDir = false; | ||
382 | QString name = currentFileName(isDir); | ||
383 | if (isDir) return; | ||
384 | infoDlg dlg(name); | ||
385 | QPEApplication::execDialog(&dlg); | ||
380 | } | 386 | } |
381 | void PIconView::slotImageInfo( const QString& ) { | ||
382 | 387 | ||
388 | void PIconView::slotImageInfo( const QString& ) { | ||
389 | |||
383 | } | 390 | } |
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp new file mode 100644 index 0000000..177df77 --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp | |||
@@ -0,0 +1,114 @@ | |||
1 | #include "imageinfoui.h" | ||
2 | |||
3 | #include <qframe.h> | ||
4 | #include <qlabel.h> | ||
5 | #include <qpushbutton.h> | ||
6 | #include <qtextview.h> | ||
7 | #include <qlayout.h> | ||
8 | #include <qvariant.h> | ||
9 | #include <qtooltip.h> | ||
10 | #include <qwhatsthis.h> | ||
11 | #include <qimage.h> | ||
12 | #include <qpixmap.h> | ||
13 | #include <qstring.h> | ||
14 | |||
15 | #include <lib/slavemaster.h> | ||
16 | #include <lib/imagecache.h> | ||
17 | |||
18 | #include <qpe/qcopenvelope_qws.h> | ||
19 | #include <qpe/resource.h> | ||
20 | |||
21 | imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) | ||
22 | : QWidget( parent, name, fl ),currentFile(_path) | ||
23 | { | ||
24 | { | ||
25 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | ||
26 | } | ||
27 | if ( !name ) | ||
28 | setName( "imageinfo" ); | ||
29 | resize( 289, 335 ); | ||
30 | setCaption( tr( "Image info" ) ); | ||
31 | imageinfoLayout = new QVBoxLayout( this ); | ||
32 | imageinfoLayout->setSpacing(2); | ||
33 | imageinfoLayout->setMargin(2); | ||
34 | |||
35 | PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); | ||
36 | PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); | ||
37 | PixmapLabel1->setScaledContents( TRUE ); | ||
38 | imageinfoLayout->addWidget( PixmapLabel1 ); | ||
39 | |||
40 | Line1 = new QFrame( this, "Line1" ); | ||
41 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | ||
42 | imageinfoLayout->addWidget( Line1 ); | ||
43 | |||
44 | fnameLabel = new QLabel( this, "FnameLabel" ); | ||
45 | imageinfoLayout->addWidget( fnameLabel); | ||
46 | |||
47 | TextView1 = new QTextView( this, "TextView1" ); | ||
48 | TextView1->setFrameShadow( QTextView::Plain ); | ||
49 | QToolTip::add( TextView1, tr( "Displays info of selected image" ) ); | ||
50 | QWhatsThis::add( TextView1, tr( "Displays info of selected image" ) ); | ||
51 | imageinfoLayout->addWidget( TextView1 ); | ||
52 | |||
53 | SlaveMaster* master = SlaveMaster::self(); | ||
54 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | ||
55 | this, SLOT(slot_fullInfo(const QString&, const QString&)) ); | ||
56 | connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | ||
57 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | ||
58 | slotChangeName(_path); | ||
59 | } | ||
60 | |||
61 | void imageinfo::slotChangeName(const QString&_path) | ||
62 | { | ||
63 | currentFile=_path; | ||
64 | fnameLabel->setText("<qt><center><b>"+currentFile+"</b></center></qt>"); | ||
65 | SlaveMaster::self()->imageInfo( currentFile ); | ||
66 | |||
67 | QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, 64, 64 ); | ||
68 | if (!m_pix) { | ||
69 | PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); | ||
70 | } else { | ||
71 | PixmapLabel1->setPixmap(*m_pix); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | imageinfo::~imageinfo() | ||
76 | { | ||
77 | { | ||
78 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) | ||
83 | { | ||
84 | if (_path == currentFile) { | ||
85 | qDebug(_t); | ||
86 | QString t = _t; | ||
87 | t.replace(QRegExp("\n"),"<br>"); | ||
88 | TextView1->setText(t); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) | ||
93 | { | ||
94 | if (_pix.width()>0) | ||
95 | PPixmapCache::self()->insertImage( _path, _pix, 64, 64 ); | ||
96 | if (_path == currentFile) { | ||
97 | PixmapLabel1->setPixmap( _pix ); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | /* for testing */ | ||
102 | infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name) | ||
103 | :QDialog(parent,name,true,WStyle_ContextHelp) | ||
104 | { | ||
105 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | ||
106 | dlglayout->setSpacing(2); | ||
107 | dlglayout->setMargin(1); | ||
108 | imageinfo*inf = new imageinfo(fname,this); | ||
109 | dlglayout->addWidget(inf); | ||
110 | } | ||
111 | |||
112 | infoDlg::~infoDlg() | ||
113 | { | ||
114 | } | ||
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.h b/noncore/graphics/opie-eye/gui/imageinfoui.h new file mode 100644 index 0000000..34ec937 --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/imageinfoui.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef IMAGEINFO_H | ||
2 | #define IMAGEINFO_H | ||
3 | |||
4 | #include <qvariant.h> | ||
5 | #include <qwidget.h> | ||
6 | #include <qdialog.h> | ||
7 | |||
8 | class QVBoxLayout; | ||
9 | class QHBoxLayout; | ||
10 | class QGridLayout; | ||
11 | class QFrame; | ||
12 | class QLabel; | ||
13 | class QTextView; | ||
14 | |||
15 | class imageinfo : public QWidget | ||
16 | { | ||
17 | Q_OBJECT | ||
18 | |||
19 | public: | ||
20 | imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
21 | ~imageinfo(); | ||
22 | |||
23 | QLabel* PixmapLabel1; | ||
24 | QLabel* fnameLabel; | ||
25 | QFrame* Line1; | ||
26 | QTextView* TextView1; | ||
27 | |||
28 | protected: | ||
29 | QVBoxLayout* imageinfoLayout; | ||
30 | QString currentFile; | ||
31 | |||
32 | protected slots: | ||
33 | virtual void slot_fullInfo(const QString&, const QString&); | ||
34 | virtual void slotThumbNail(const QString&, const QPixmap&); | ||
35 | |||
36 | virtual void slotChangeName(const QString&); | ||
37 | }; | ||
38 | |||
39 | /* for testing purpose */ | ||
40 | class infoDlg:public QDialog | ||
41 | { | ||
42 | Q_OBJECT | ||
43 | public: | ||
44 | infoDlg(const QString&,QWidget * parent=0, const char * name=0); | ||
45 | virtual ~infoDlg(); | ||
46 | }; | ||
47 | |||
48 | #endif // IMAGEINFO_H | ||
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 3547af0..17fa22c 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro | |||
@@ -1,34 +1,36 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | DESTDIR = $(OPIEDIR)/bin | 2 | DESTDIR = $(OPIEDIR)/bin |
3 | TEMPLATE = app | 3 | TEMPLATE = app |
4 | TARGET = opie-eye | 4 | TARGET = opie-eye |
5 | # the name of the resulting object | 5 | # the name of the resulting object |
6 | 6 | ||
7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ | 7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ |
8 | lib/imagecache.h impl/dir/dir_dirview.h \ | 8 | lib/imagecache.h impl/dir/dir_dirview.h \ |
9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ | 9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ |
10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ | 10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ |
11 | lib/slavemaster.h \ | 11 | lib/slavemaster.h \ |
12 | iface/slaveiface.h | 12 | iface/slaveiface.h \ |
13 | gui/imageinfoui.h | ||
13 | 14 | ||
14 | # A list header files | 15 | # A list header files |
15 | 16 | ||
16 | 17 | ||
17 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ | 18 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ |
18 | lib/imagecache.cpp lib/viewmap.cpp \ | 19 | lib/imagecache.cpp lib/viewmap.cpp \ |
19 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ | 20 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ |
20 | iface/dirview.cpp impl/dir/dir_lister.cpp \ | 21 | iface/dirview.cpp impl/dir/dir_lister.cpp \ |
21 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp | 22 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ |
23 | gui/imageinfoui.cpp | ||
22 | # A list of source files | 24 | # A list of source files |
23 | 25 | ||
24 | INTERFACES = | 26 | INTERFACES = |
25 | # list of ui files | 27 | # list of ui files |
26 | 28 | ||
27 | INCLUDEPATH += . $(OPIEDIR)/include | 29 | INCLUDEPATH += . $(OPIEDIR)/include |
28 | DEPENDPATH += $(OPIEDIR)/include | 30 | DEPENDPATH += $(OPIEDIR)/include |
29 | 31 | ||
30 | 32 | ||
31 | 33 | ||
32 | LIBS += -lqpe -lopieui2 | 34 | LIBS += -lqpe -lopieui2 |
33 | 35 | ||
34 | include ( $(OPIEDIR)/include.pro ) | 36 | include ( $(OPIEDIR)/include.pro ) |