Diffstat (limited to 'noncore/graphics/opie-eye/gui') (more/less context) (ignore whitespace changes)
-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 |
3 files changed, 172 insertions, 3 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 | |||
@@ -5,8 +5,9 @@ | |||
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 | ||
@@ -17,9 +18,9 @@ | |||
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> |
@@ -375,9 +376,15 @@ void PIconView::slotShowImage() { | |||
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 | ||