-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 11 | ||||
-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 | 6 |
4 files changed, 175 insertions, 4 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 | |||
@@ -6,6 +6,7 @@ | |||
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> |
@@ -18,7 +19,7 @@ | |||
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> |
@@ -376,8 +377,14 @@ 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 | } |
387 | |||
381 | void PIconView::slotImageInfo( const QString& ) { | 388 | void PIconView::slotImageInfo( const QString& ) { |
382 | 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 | |||
@@ -9,7 +9,8 @@ HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.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 | ||
@@ -18,7 +19,8 @@ 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 = |