-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 36 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 6 |
4 files changed, 47 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 2a49786..a06844a 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -1,181 +1,194 @@ | |||
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 | #include <gui/imageinfoui.h> |
10 | #include <gui/imagescrollview.h> | 10 | #include <gui/imagescrollview.h> |
11 | 11 | ||
12 | #include <iface/dirview.h> | 12 | #include <iface/dirview.h> |
13 | #include <iface/dirlister.h> | 13 | #include <iface/dirlister.h> |
14 | 14 | ||
15 | #include <opie2/oconfig.h> | 15 | #include <opie2/oconfig.h> |
16 | #include <opie2/okeyconfigwidget.h> | 16 | #include <opie2/okeyconfigwidget.h> |
17 | #include <opie2/odebug.h> | 17 | #include <opie2/odebug.h> |
18 | 18 | ||
19 | #include <qpe/resource.h> | 19 | #include <qpe/resource.h> |
20 | #include <qpe/qpemessagebox.h> | 20 | #include <qpe/qpemessagebox.h> |
21 | #include <qpe/ir.h> | 21 | #include <qpe/ir.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | 24 | ||
25 | #include <qiconview.h> | 25 | #include <qiconview.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qhbox.h> | 27 | #include <qhbox.h> |
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | #include <qmainwindow.h> | 31 | #include <qmainwindow.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qstyle.h> | 33 | #include <qstyle.h> |
34 | 34 | ||
35 | 35 | ||
36 | using Opie::Core::OKeyConfigItem; | 36 | using Opie::Core::OKeyConfigItem; |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * The Icons, Request Cache and IconViewItem for the IconView | 39 | * The Icons, Request Cache and IconViewItem for the IconView |
40 | */ | 40 | */ |
41 | namespace { | 41 | namespace { |
42 | static QPixmap* _dirPix = 0; | 42 | static QPixmap* _dirPix = 0; |
43 | static QPixmap* _unkPix = 0; | 43 | static QPixmap* _unkPix = 0; |
44 | static QPixmap* _picPix = 0; | ||
44 | class IconViewItem : public QIconViewItem { | 45 | class IconViewItem : public QIconViewItem { |
45 | public: | 46 | public: |
46 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); | 47 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); |
47 | QPixmap* pixmap()const; | 48 | QPixmap* pixmap()const; |
48 | QString path()const { return m_path; } | 49 | QString path()const { return m_path; } |
49 | bool isDir()const { return m_isDir; } | 50 | bool isDir()const { return m_isDir; } |
50 | void setText( const QString& ); | 51 | void setText( const QString& ); |
51 | 52 | ||
53 | protected: | ||
54 | mutable QPixmap* m_pix; | ||
52 | 55 | ||
53 | private: | 56 | private: |
54 | mutable QPixmap* m_pix; | ||
55 | QString m_path; | 57 | QString m_path; |
56 | bool m_isDir : 1; | 58 | bool m_isDir : 1; |
57 | bool m_noInfo :1; | 59 | bool m_noInfo :1; |
58 | }; | 60 | }; |
61 | class TextViewItem : public IconViewItem { | ||
62 | TextViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); | ||
63 | QPixmap *pixmap()const; | ||
64 | void setText( const QString& ); | ||
65 | }; | ||
66 | class ThumbViewItem : public IconViewItem { | ||
67 | ThumbViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); | ||
68 | QPixmap *pixmap()const; | ||
69 | void setText( const QString& ); | ||
70 | }; | ||
59 | 71 | ||
60 | 72 | ||
61 | /* | 73 | /* |
62 | * If we request an Image or String | 74 | * If we request an Image or String |
63 | * we add it to the map | 75 | * we add it to the map |
64 | */ | 76 | */ |
65 | static QMap<QString, IconViewItem*> g_stringInf; | 77 | static QMap<QString, IconViewItem*> g_stringInf; |
66 | static QMap<QString, IconViewItem*> g_stringPix; | 78 | static QMap<QString, IconViewItem*> g_stringPix; |
67 | 79 | ||
68 | IconViewItem::IconViewItem( QIconView* view,const QString& path, | 80 | IconViewItem::IconViewItem( QIconView* view,const QString& path, |
69 | const QString& name, bool isDir ) | 81 | const QString& name, bool isDir ) |
70 | : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), | 82 | : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), |
71 | m_noInfo( false ) | 83 | m_noInfo( false ) |
72 | { | 84 | { |
73 | if ( isDir && !_dirPix ) | 85 | if ( isDir && !_dirPix ) |
74 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); | 86 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); |
75 | else if ( !isDir && !_unkPix ) | 87 | else if ( !isDir && !_unkPix ) |
76 | _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); | 88 | _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); |
77 | } | 89 | } |
78 | inline QPixmap* IconViewItem::pixmap()const { | 90 | inline QPixmap* IconViewItem::pixmap()const { |
79 | // qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", | 91 | // qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", |
80 | // rect().x(),rect().y(),rect().width(),rect().height(), | 92 | // rect().x(),rect().y(),rect().width(),rect().height(), |
81 | // iconView()->contentsX(), iconView()->contentsY()); | 93 | // iconView()->contentsX(), iconView()->contentsY()); |
82 | 94 | ||
83 | if ( m_isDir ) | 95 | if ( m_isDir ) |
84 | return _dirPix; | 96 | return _dirPix; |
85 | else{ | 97 | else{ |
86 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { | 98 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { |
87 | currentView()->dirLister()->imageInfo( m_path ); | 99 | currentView()->dirLister()->imageInfo( m_path ); |
88 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); | 100 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); |
89 | } | 101 | } |
90 | 102 | ||
91 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); | 103 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); |
92 | if ( !m_pix && !g_stringPix.contains( m_path )) { | 104 | if ( !m_pix && !g_stringPix.contains( m_path )) { |
93 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); | 105 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); |
94 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); | 106 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); |
95 | } | 107 | } |
96 | return m_pix ? m_pix : _unkPix; | 108 | return m_pix ? m_pix : _unkPix; |
97 | } | 109 | } |
98 | } | 110 | } |
99 | inline void IconViewItem::setText( const QString& str ) { | 111 | inline void IconViewItem::setText( const QString& str ) { |
100 | QString text = QIconViewItem::text()+"\n"+str; | 112 | QString text = QIconViewItem::text()+"\n"+str; |
101 | m_noInfo = true; | 113 | m_noInfo = true; |
102 | QIconViewItem::setText( text ); | 114 | QIconViewItem::setText( text ); |
103 | } | 115 | } |
104 | } | 116 | } |
105 | 117 | ||
106 | 118 | ||
107 | /* | 119 | /* |
108 | * Set up the GUI.. initialize the slave set up gui | 120 | * Set up the GUI.. initialize the slave set up gui |
109 | * and also load a dir | 121 | * and also load a dir |
110 | */ | 122 | */ |
111 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | 123 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) |
112 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) | 124 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) |
113 | { | 125 | { |
114 | { | 126 | { |
115 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 127 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
116 | } | 128 | } |
117 | m_path = QDir::homeDirPath(); | 129 | m_path = QDir::homeDirPath(); |
130 | m_mode = 0; | ||
118 | 131 | ||
119 | QHBox *hbox = new QHBox( this ); | 132 | QHBox *hbox = new QHBox( this ); |
120 | QLabel* lbl = new QLabel( hbox ); | 133 | QLabel* lbl = new QLabel( hbox ); |
121 | lbl->setText( tr("View as" ) ); | 134 | lbl->setText( tr("View as" ) ); |
122 | 135 | ||
123 | m_views = new QComboBox( hbox, "View As" ); | 136 | m_views = new QComboBox( hbox, "View As" ); |
124 | connect( m_views, SIGNAL(activated(int)), | 137 | connect( m_views, SIGNAL(activated(int)), |
125 | this, SLOT(slotViewChanged(int)) ); | 138 | this, SLOT(slotViewChanged(int)) ); |
126 | 139 | ||
127 | m_view= new QIconView( this ); | 140 | m_view= new QIconView( this ); |
128 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 141 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
129 | this, SLOT(slotClicked(QIconViewItem*)) ); | 142 | this, SLOT(slotClicked(QIconViewItem*)) ); |
130 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | 143 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), |
131 | this, SLOT(slotClicked(QIconViewItem*)) ); | 144 | this, SLOT(slotClicked(QIconViewItem*)) ); |
132 | 145 | ||
133 | m_view->setArrangement( QIconView::LeftToRight ); | 146 | m_view->setArrangement( QIconView::LeftToRight ); |
134 | m_view->setItemTextPos( QIconView::Right ); | 147 | m_view->setItemTextPos( QIconView::Right ); |
135 | 148 | ||
136 | int dw = QApplication::desktop()->width(); | 149 | int dw = QApplication::desktop()->width(); |
137 | int viewerWidth = dw-style().scrollBarExtent().width(); | 150 | int viewerWidth = dw-style().scrollBarExtent().width(); |
138 | m_view->setGridX( viewerWidth-3*m_view->spacing()); | 151 | m_view->setGridX( viewerWidth-3*m_view->spacing()); |
139 | m_view->setGridY( fontMetrics().height()*2+40 ); | 152 | m_view->setGridY( fontMetrics().height()*2+40 ); |
140 | 153 | ||
141 | 154 | ||
142 | initKeys(); | 155 | initKeys(); |
143 | 156 | ||
144 | loadViews(); | 157 | loadViews(); |
145 | slotViewChanged( m_views->currentItem() ); | 158 | slotViewChanged( m_views->currentItem() ); |
146 | } | 159 | } |
147 | 160 | ||
148 | /* | 161 | /* |
149 | * Unref the slave and save the keyboard manager | 162 | * Unref the slave and save the keyboard manager |
150 | */ | 163 | */ |
151 | PIconView::~PIconView() { | 164 | PIconView::~PIconView() { |
152 | { | 165 | { |
153 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 166 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
154 | } | 167 | } |
155 | m_viewManager->save(); | 168 | m_viewManager->save(); |
156 | delete m_viewManager; | 169 | delete m_viewManager; |
157 | } | 170 | } |
158 | 171 | ||
159 | Opie::Core::OKeyConfigManager* PIconView::manager() { | 172 | Opie::Core::OKeyConfigManager* PIconView::manager() { |
160 | return m_viewManager; | 173 | return m_viewManager; |
161 | } | 174 | } |
162 | 175 | ||
163 | 176 | ||
164 | /* | 177 | /* |
165 | * init the KeyBoard Shortcuts | 178 | * init the KeyBoard Shortcuts |
166 | * called from the c'tor | 179 | * called from the c'tor |
167 | */ | 180 | */ |
168 | void PIconView::initKeys() { | 181 | void PIconView::initKeys() { |
169 | Opie::Core::OKeyPair::List lst; | 182 | Opie::Core::OKeyPair::List lst; |
170 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 183 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
171 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 184 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
172 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 185 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
173 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 186 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
174 | lst.append( Opie::Core::OKeyPair::returnKey() ); | 187 | lst.append( Opie::Core::OKeyPair::returnKey() ); |
175 | 188 | ||
176 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", | 189 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", |
177 | lst, false,this, "keyconfig name" ); | 190 | lst, false,this, "keyconfig name" ); |
178 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", | 191 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", |
179 | Resource::loadPixmap("beam"), BeamItem, | 192 | Resource::loadPixmap("beam"), BeamItem, |
180 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), | 193 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), |
181 | this, SLOT(slotBeam())) ); | 194 | this, SLOT(slotBeam())) ); |
@@ -394,64 +407,85 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { | |||
394 | 407 | ||
395 | /* | 408 | /* |
396 | * FIXME rename | 409 | * FIXME rename |
397 | */ | 410 | */ |
398 | void PIconView::slotRename() { | 411 | void PIconView::slotRename() { |
399 | 412 | ||
400 | } | 413 | } |
401 | 414 | ||
402 | 415 | ||
403 | /* | 416 | /* |
404 | * BEAM the current file | 417 | * BEAM the current file |
405 | */ | 418 | */ |
406 | void PIconView::slotBeam() { | 419 | void PIconView::slotBeam() { |
407 | bool isDir; | 420 | bool isDir; |
408 | QString pa = currentFileName( isDir ); | 421 | QString pa = currentFileName( isDir ); |
409 | if ( isDir && pa.isEmpty() ) | 422 | if ( isDir && pa.isEmpty() ) |
410 | return; | 423 | return; |
411 | 424 | ||
412 | Ir* ir = new Ir( this ); | 425 | Ir* ir = new Ir( this ); |
413 | connect( ir, SIGNAL(done(Ir*)), | 426 | connect( ir, SIGNAL(done(Ir*)), |
414 | this, SLOT(slotBeamDone(Ir*))); | 427 | this, SLOT(slotBeamDone(Ir*))); |
415 | ir->send(pa, tr( "Image" ) ); | 428 | ir->send(pa, tr( "Image" ) ); |
416 | } | 429 | } |
417 | 430 | ||
418 | /* | 431 | /* |
419 | * BEAM done clean up | 432 | * BEAM done clean up |
420 | */ | 433 | */ |
421 | void PIconView::slotBeamDone( Ir* ir) { | 434 | void PIconView::slotBeamDone( Ir* ir) { |
422 | delete ir; | 435 | delete ir; |
423 | } | 436 | } |
424 | 437 | ||
425 | void PIconView::slotStart() { | 438 | void PIconView::slotStart() { |
426 | m_view->viewport()->setUpdatesEnabled( false ); | 439 | m_view->viewport()->setUpdatesEnabled( false ); |
427 | } | 440 | } |
428 | 441 | ||
429 | void PIconView::slotEnd() { | 442 | void PIconView::slotEnd() { |
430 | if ( m_updatet ) | 443 | if ( m_updatet ) |
431 | m_view->arrangeItemsInGrid( ); | 444 | m_view->arrangeItemsInGrid( ); |
432 | m_view->viewport()->setUpdatesEnabled( true ); | 445 | m_view->viewport()->setUpdatesEnabled( true ); |
433 | m_updatet = false; | 446 | m_updatet = false; |
434 | } | 447 | } |
435 | 448 | ||
436 | void PIconView::slotShowImage() | 449 | void PIconView::slotShowImage() |
437 | { | 450 | { |
438 | bool isDir = false; | 451 | bool isDir = false; |
439 | QString name = currentFileName(isDir); | 452 | QString name = currentFileName(isDir); |
440 | if (isDir) return; | 453 | if (isDir) return; |
441 | 454 | ||
442 | slotShowImage( name ); | 455 | slotShowImage( name ); |
443 | } | 456 | } |
444 | void PIconView::slotShowImage( const QString& name) { | 457 | void PIconView::slotShowImage( const QString& name) { |
445 | emit sig_display( name ); | 458 | emit sig_display( name ); |
446 | } | 459 | } |
447 | void PIconView::slotImageInfo() { | 460 | void PIconView::slotImageInfo() { |
448 | bool isDir = false; | 461 | bool isDir = false; |
449 | QString name = currentFileName(isDir); | 462 | QString name = currentFileName(isDir); |
450 | if (isDir) return; | 463 | if (isDir) return; |
451 | 464 | ||
452 | slotImageInfo( name ); | 465 | slotImageInfo( name ); |
453 | } | 466 | } |
454 | 467 | ||
455 | void PIconView::slotImageInfo( const QString& name) { | 468 | void PIconView::slotImageInfo( const QString& name) { |
456 | emit sig_showInfo( name ); | 469 | emit sig_showInfo( name ); |
457 | } | 470 | } |
471 | |||
472 | |||
473 | void PIconView::slotChangeMode( int mode ) { | ||
474 | if ( mode >= 0 && mode <= 3 ) | ||
475 | m_mode = mode; | ||
476 | |||
477 | QIconView::ItemTextPos pos; | ||
478 | switch( m_mode ) { | ||
479 | case 1: | ||
480 | pos = QIconView::Bottom; | ||
481 | break; | ||
482 | case 2: | ||
483 | case 0: | ||
484 | default: | ||
485 | pos = QIconView::Right; | ||
486 | break; | ||
487 | } | ||
488 | m_view->setItemTextPos( pos ); | ||
489 | |||
490 | slotReloadDir(); | ||
491 | } | ||
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index 9cf7b3e..af41aef 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h | |||
@@ -9,74 +9,77 @@ | |||
9 | #include <qvbox.h> | 9 | #include <qvbox.h> |
10 | 10 | ||
11 | 11 | ||
12 | class QIconView; | 12 | class QIconView; |
13 | class QIconViewItem; | 13 | class QIconViewItem; |
14 | class QComboBox; | 14 | class QComboBox; |
15 | class PIconViewItem; | 15 | class PIconViewItem; |
16 | class PDirLister; | 16 | class PDirLister; |
17 | class Ir; | 17 | class Ir; |
18 | 18 | ||
19 | namespace Opie { | 19 | namespace Opie { |
20 | namespace Core{ | 20 | namespace Core{ |
21 | class OConfig; | 21 | class OConfig; |
22 | class OKeyConfigManager; | 22 | class OKeyConfigManager; |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | class PIconView : public QVBox { | 26 | class PIconView : public QVBox { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | friend class PIconViewItem; | 28 | friend class PIconViewItem; |
29 | enum ActionIds { | 29 | enum ActionIds { |
30 | BeamItem, DeleteItem, ViewItem, InfoItem | 30 | BeamItem, DeleteItem, ViewItem, InfoItem |
31 | }; | 31 | }; |
32 | public: | 32 | public: |
33 | PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); | 33 | PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); |
34 | ~PIconView(); | 34 | ~PIconView(); |
35 | void resetView(); | 35 | void resetView(); |
36 | Opie::Core::OKeyConfigManager* manager(); | 36 | Opie::Core::OKeyConfigManager* manager(); |
37 | 37 | ||
38 | signals: | 38 | signals: |
39 | void sig_showInfo( const QString& ); | 39 | void sig_showInfo( const QString& ); |
40 | void sig_display( const QString& ); | 40 | void sig_display( const QString& ); |
41 | 41 | ||
42 | private: | 42 | private: |
43 | void initKeys(); | 43 | void initKeys(); |
44 | QString currentFileName(bool &isDir)const; | 44 | QString currentFileName(bool &isDir)const; |
45 | void loadViews(); | 45 | void loadViews(); |
46 | 46 | ||
47 | private slots: | 47 | private slots: |
48 | void slotDirUp(); | 48 | void slotDirUp(); |
49 | void slotChangeDir(const QString&); | 49 | void slotChangeDir(const QString&); |
50 | void slotTrash(); | 50 | void slotTrash(); |
51 | void slotViewChanged( int ); | 51 | void slotViewChanged( int ); |
52 | void slotReloadDir(); | 52 | void slotReloadDir(); |
53 | void slotRename(); | 53 | void slotRename(); |
54 | void slotBeam(); | 54 | void slotBeam(); |
55 | void slotBeamDone( Ir* ); | 55 | void slotBeamDone( Ir* ); |
56 | 56 | ||
57 | void slotShowImage(); | 57 | void slotShowImage(); |
58 | void slotShowImage( const QString& ); | 58 | void slotShowImage( const QString& ); |
59 | void slotImageInfo(); | 59 | void slotImageInfo(); |
60 | void slotImageInfo( const QString& ); | 60 | void slotImageInfo( const QString& ); |
61 | 61 | ||
62 | void slotStart(); | 62 | void slotStart(); |
63 | void slotEnd(); | 63 | void slotEnd(); |
64 | 64 | ||
65 | /* for performance reasons make it inline in the future */ | 65 | /* for performance reasons make it inline in the future */ |
66 | void addFolders( const QStringList& ); | 66 | void addFolders( const QStringList& ); |
67 | void addFiles( const QStringList& ); | 67 | void addFiles( const QStringList& ); |
68 | void slotClicked(QIconViewItem* ); | 68 | void slotClicked(QIconViewItem* ); |
69 | 69 | ||
70 | /**/ | 70 | /**/ |
71 | void slotThumbInfo(const QString&, const QString&); | 71 | void slotThumbInfo(const QString&, const QString&); |
72 | void slotThumbNail(const QString&, const QPixmap&); | 72 | void slotThumbNail(const QString&, const QPixmap&); |
73 | |||
74 | void slotChangeMode( int ); | ||
73 | private: | 75 | private: |
74 | Opie::Core::OKeyConfigManager *m_viewManager; | 76 | Opie::Core::OKeyConfigManager *m_viewManager; |
75 | Opie::Core::OConfig *m_cfg; | 77 | Opie::Core::OConfig *m_cfg; |
76 | QComboBox* m_views; | 78 | QComboBox* m_views; |
77 | QIconView* m_view; | 79 | QIconView* m_view; |
78 | QString m_path; | 80 | QString m_path; |
79 | bool m_updatet : 1; | 81 | bool m_updatet : 1; |
82 | int m_mode; | ||
80 | }; | 83 | }; |
81 | 84 | ||
82 | #endif | 85 | #endif |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index ef23f79..dd9cced 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -1,153 +1,158 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | 6 | ||
7 | #include "iconview.h" | 7 | #include "iconview.h" |
8 | #include "filesystem.h" | 8 | #include "filesystem.h" |
9 | #include "imageinfoui.h" | 9 | #include "imageinfoui.h" |
10 | #include "imageview.h" | 10 | #include "imageview.h" |
11 | #include "viewmodebutton.h" | ||
11 | 12 | ||
12 | #include <iface/ifaceinfo.h> | 13 | #include <iface/ifaceinfo.h> |
13 | #include <iface/dirview.h> | 14 | #include <iface/dirview.h> |
14 | 15 | ||
15 | #include <opie2/odebug.h> | 16 | #include <opie2/odebug.h> |
16 | #include <opie2/owidgetstack.h> | 17 | #include <opie2/owidgetstack.h> |
17 | #include <opie2/oapplicationfactory.h> | 18 | #include <opie2/oapplicationfactory.h> |
18 | #include <opie2/otabwidget.h> | 19 | #include <opie2/otabwidget.h> |
19 | #include <opie2/okeyconfigwidget.h> | 20 | #include <opie2/okeyconfigwidget.h> |
20 | 21 | ||
21 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
22 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
23 | #include <qpe/ir.h> | 24 | #include <qpe/ir.h> |
24 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
25 | 26 | ||
26 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
27 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
28 | #include <qlayout.h> | 29 | #include <qlayout.h> |
29 | #include <qdialog.h> | 30 | #include <qdialog.h> |
30 | #include <qmap.h> | 31 | #include <qmap.h> |
31 | #include <qtimer.h> | 32 | #include <qtimer.h> |
32 | 33 | ||
33 | 34 | ||
34 | 35 | ||
35 | 36 | ||
36 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 37 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
37 | 38 | ||
38 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 39 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
39 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 40 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
40 | { | 41 | { |
41 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 42 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
42 | m_cfg = new Opie::Core::OConfig("phunkview"); | 43 | m_cfg = new Opie::Core::OConfig("phunkview"); |
43 | m_cfg->setGroup("Zecke_view" ); | 44 | m_cfg->setGroup("Zecke_view" ); |
44 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); | 45 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); |
45 | /* | 46 | /* |
46 | * Initialize ToolBar and IconView | 47 | * Initialize ToolBar and IconView |
47 | * And Connect Them | 48 | * And Connect Them |
48 | */ | 49 | */ |
49 | QToolBar *bar = new QToolBar( this ); | 50 | QToolBar *bar = new QToolBar( this ); |
50 | bar->setHorizontalStretchable( true ); | 51 | bar->setHorizontalStretchable( true ); |
51 | setToolBarsMovable( false ); | 52 | setToolBarsMovable( false ); |
52 | 53 | ||
53 | m_stack = new Opie::Ui::OWidgetStack( this ); | 54 | m_stack = new Opie::Ui::OWidgetStack( this ); |
54 | setCentralWidget( m_stack ); | 55 | setCentralWidget( m_stack ); |
55 | 56 | ||
56 | m_view = new PIconView( m_stack, m_cfg ); | 57 | m_view = new PIconView( m_stack, m_cfg ); |
57 | m_stack->addWidget( m_view, IconView ); | 58 | m_stack->addWidget( m_view, IconView ); |
58 | m_stack->raiseWidget( IconView ); | 59 | m_stack->raiseWidget( IconView ); |
59 | connect(m_view, SIGNAL(sig_display(const QString&)), | 60 | connect(m_view, SIGNAL(sig_display(const QString&)), |
60 | this, SLOT(slotDisplay(const QString&))); | 61 | this, SLOT(slotDisplay(const QString&))); |
61 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), | 62 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), |
62 | this, SLOT(slotShowInfo(const QString&)) ); | 63 | this, SLOT(slotShowInfo(const QString&)) ); |
63 | 64 | ||
64 | QToolButton *btn = new QToolButton( bar ); | 65 | QToolButton *btn = new QToolButton( bar ); |
65 | btn->setIconSet( Resource::loadIconSet( "up" ) ); | 66 | btn->setIconSet( Resource::loadIconSet( "up" ) ); |
66 | connect( btn, SIGNAL(clicked()), | 67 | connect( btn, SIGNAL(clicked()), |
67 | m_view, SLOT(slotDirUp()) ); | 68 | m_view, SLOT(slotDirUp()) ); |
68 | 69 | ||
69 | btn = new PFileSystem( bar ); | 70 | btn = new PFileSystem( bar ); |
70 | connect( btn, SIGNAL( changeDir( const QString& ) ), | 71 | connect( btn, SIGNAL( changeDir( const QString& ) ), |
71 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 72 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
72 | 73 | ||
73 | btn = new QToolButton( bar ); | 74 | btn = new QToolButton( bar ); |
74 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); | 75 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); |
75 | connect( btn, SIGNAL(clicked()), | 76 | connect( btn, SIGNAL(clicked()), |
76 | m_view, SLOT(slotRename()) ); | 77 | m_view, SLOT(slotRename()) ); |
77 | 78 | ||
78 | if ( Ir::supported() ) { | 79 | if ( Ir::supported() ) { |
79 | btn = new QToolButton( bar ); | 80 | btn = new QToolButton( bar ); |
80 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); | 81 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); |
81 | connect( btn, SIGNAL(clicked()), | 82 | connect( btn, SIGNAL(clicked()), |
82 | m_view, SLOT(slotBeam()) ); | 83 | m_view, SLOT(slotBeam()) ); |
83 | } | 84 | } |
84 | 85 | ||
85 | btn = new QToolButton( bar ); | 86 | btn = new QToolButton( bar ); |
86 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); | 87 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); |
87 | connect( btn, SIGNAL(clicked() ), | 88 | connect( btn, SIGNAL(clicked() ), |
88 | m_view, SLOT(slotTrash() ) ); | 89 | m_view, SLOT(slotTrash() ) ); |
89 | 90 | ||
91 | btn = new ViewModeButton( bar ); | ||
92 | connect( btn, SIGNAL(changeMode(int)), | ||
93 | m_view, SLOT(slotChangeMode(int))); | ||
94 | |||
90 | btn = new QToolButton( bar ); | 95 | btn = new QToolButton( bar ); |
91 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); | 96 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); |
92 | connect( btn, SIGNAL(clicked() ), | 97 | connect( btn, SIGNAL(clicked() ), |
93 | this, SLOT(slotConfig() ) ); | 98 | this, SLOT(slotConfig() ) ); |
94 | 99 | ||
95 | rotateButton = new QToolButton(bar); | 100 | rotateButton = new QToolButton(bar); |
96 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); | 101 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); |
97 | rotateButton->setToggleButton(true); | 102 | rotateButton->setToggleButton(true); |
98 | rotateButton->setOn(true); | 103 | rotateButton->setOn(true); |
99 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | 104 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); |
100 | autoRotate = true; | 105 | autoRotate = true; |
101 | 106 | ||
102 | btn = new QToolButton(bar); | 107 | btn = new QToolButton(bar); |
103 | btn->setIconSet( Resource::loadIconSet( "1to1" ) ); | 108 | btn->setIconSet( Resource::loadIconSet( "1to1" ) ); |
104 | btn->setToggleButton(true); | 109 | btn->setToggleButton(true); |
105 | btn->setOn(false); | 110 | btn->setOn(false); |
106 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | 111 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); |
107 | autoScale = true; | 112 | autoScale = true; |
108 | 113 | ||
109 | btn = new QToolButton(bar); | 114 | btn = new QToolButton(bar); |
110 | btn->setIconSet( Resource::loadIconSet( "mag" ) ); | 115 | btn->setIconSet( Resource::loadIconSet( "mag" ) ); |
111 | btn->setToggleButton(true); | 116 | btn->setToggleButton(true); |
112 | btn->setOn(true); | 117 | btn->setOn(true); |
113 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 118 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
114 | zoomerOn = true; | 119 | zoomerOn = true; |
115 | } | 120 | } |
116 | 121 | ||
117 | PMainWindow::~PMainWindow() { | 122 | PMainWindow::~PMainWindow() { |
118 | odebug << "Shutting down" << oendl; | 123 | odebug << "Shutting down" << oendl; |
119 | } | 124 | } |
120 | 125 | ||
121 | void PMainWindow::slotZoomerToggled(bool how) | 126 | void PMainWindow::slotZoomerToggled(bool how) |
122 | { | 127 | { |
123 | zoomerOn = how; | 128 | zoomerOn = how; |
124 | if (m_disp) { | 129 | if (m_disp) { |
125 | m_disp->setShowZoomer(zoomerOn); | 130 | m_disp->setShowZoomer(zoomerOn); |
126 | } | 131 | } |
127 | } | 132 | } |
128 | 133 | ||
129 | void PMainWindow::slotRotateToggled(bool how) | 134 | void PMainWindow::slotRotateToggled(bool how) |
130 | { | 135 | { |
131 | autoRotate = how; | 136 | autoRotate = how; |
132 | if (m_disp) { | 137 | if (m_disp) { |
133 | m_disp->setAutoRotate(how); | 138 | m_disp->setAutoRotate(how); |
134 | } | 139 | } |
135 | } | 140 | } |
136 | 141 | ||
137 | void PMainWindow::slotScaleToggled(bool how) | 142 | void PMainWindow::slotScaleToggled(bool how) |
138 | { | 143 | { |
139 | autoScale = !how; | 144 | autoScale = !how; |
140 | if (m_disp) { | 145 | if (m_disp) { |
141 | m_disp->setAutoScale(autoScale); | 146 | m_disp->setAutoScale(autoScale); |
142 | } | 147 | } |
143 | if (!autoScale && autoRotate) { | 148 | if (!autoScale && autoRotate) { |
144 | rotateButton->setOn(false); | 149 | rotateButton->setOn(false); |
145 | } | 150 | } |
146 | rotateButton->setEnabled(!how); | 151 | rotateButton->setEnabled(!how); |
147 | } | 152 | } |
148 | 153 | ||
149 | void PMainWindow::slotConfig() { | 154 | void PMainWindow::slotConfig() { |
150 | /* | 155 | /* |
151 | * have a tab with the possible views | 156 | * have a tab with the possible views |
152 | * a tab for globals image cache size.. scaled loading | 157 | * a tab for globals image cache size.. scaled loading |
153 | * and one tab for the KeyConfigs | 158 | * and one tab for the KeyConfigs |
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index e9abe72..e9459ad 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro | |||
@@ -1,40 +1,42 @@ | |||
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 gui/imagescrollview.h \ | 13 | gui/imageinfoui.h gui/imagescrollview.h \ |
14 | gui/imageview.h \ | 14 | gui/imageview.h \ |
15 | lib/oimagezoomer.h | 15 | lib/oimagezoomer.h \ |
16 | gui/viewmodebutton.h | ||
16 | 17 | ||
17 | # A list header files | 18 | # A list header files |
18 | 19 | ||
19 | 20 | ||
20 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ | 21 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ |
21 | lib/imagecache.cpp lib/viewmap.cpp \ | 22 | lib/imagecache.cpp lib/viewmap.cpp \ |
22 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ | 23 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ |
23 | iface/dirview.cpp impl/dir/dir_lister.cpp \ | 24 | iface/dirview.cpp impl/dir/dir_lister.cpp \ |
24 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ | 25 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ |
25 | gui/imageinfoui.cpp gui/imagescrollview.cpp \ | 26 | gui/imageinfoui.cpp gui/imagescrollview.cpp \ |
26 | gui/imageview.cpp \ | 27 | gui/imageview.cpp \ |
27 | lib/oimagezoomer.cpp | 28 | lib/oimagezoomer.cpp \ |
29 | gui/viewmodebutton.cpp | ||
28 | # A list of source files | 30 | # A list of source files |
29 | 31 | ||
30 | INTERFACES = | 32 | INTERFACES = |
31 | # list of ui files | 33 | # list of ui files |
32 | 34 | ||
33 | INCLUDEPATH += . $(OPIEDIR)/include | 35 | INCLUDEPATH += . $(OPIEDIR)/include |
34 | DEPENDPATH += $(OPIEDIR)/include | 36 | DEPENDPATH += $(OPIEDIR)/include |
35 | 37 | ||
36 | 38 | ||
37 | 39 | ||
38 | LIBS += -lqpe -lopiecore2 -lopieui2 | 40 | LIBS += -lqpe -lopiecore2 -lopieui2 |
39 | 41 | ||
40 | include ( $(OPIEDIR)/include.pro ) | 42 | include ( $(OPIEDIR)/include.pro ) |