summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp49
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h7
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp454
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h21
4 files changed, 326 insertions, 205 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index a20c879..c7e48cb 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -8,6 +8,7 @@
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10#include <qtimer.h> 10#include <qtimer.h>
11#include <qaction.h>
11 12
12using namespace Opie::Core; 13using namespace Opie::Core;
13 14
@@ -23,6 +24,16 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name
23 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); 24 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
24 initKeys(); 25 initKeys();
25 m_slideValue = 5; 26 m_slideValue = 5;
27 m_gDisplayType = 0;
28 m_gPrevNext = 0;
29 m_hGroup = 0;
30}
31
32void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup)
33{
34 m_gDisplayType = disptypeGroup;
35 m_gPrevNext = nextprevGroup;
36 m_hGroup = hGroup;
26} 37}
27 38
28ImageView::~ImageView() 39ImageView::~ImageView()
@@ -49,6 +60,16 @@ void ImageView::startSlide(int value)
49 m_slideTimer->start(m_slideValue*1000,true); 60 m_slideTimer->start(m_slideValue*1000,true);
50} 61}
51 62
63void ImageView::stopSlide()
64{
65 if (!m_slideTimer) {
66 return;
67 }
68 m_slideTimer->stop();
69 delete m_slideTimer;
70 m_slideTimer = 0;
71}
72
52void ImageView::nextSlide() 73void ImageView::nextSlide()
53{ 74{
54 if (!m_slideTimer) { 75 if (!m_slideTimer) {
@@ -142,18 +163,30 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e)
142 odebug << "Popup " << oendl; 163 odebug << "Popup " << oendl;
143 QPopupMenu *m = new QPopupMenu(0); 164 QPopupMenu *m = new QPopupMenu(0);
144 if (!m) return; 165 if (!m) return;
145 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); 166 if (m_hGroup) {
167 m_hGroup->addTo(m);
168 }
146 if (fullScreen()) { 169 if (fullScreen()) {
147 m->insertSeparator(); 170 if (m_gPrevNext) {
148 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); 171 m->insertSeparator();
149 m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); 172 m_gPrevNext->addTo(m);
150 m->insertSeparator(); 173 }
151 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); 174 if (m_gDisplayType) {
152 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); 175 m->insertSeparator();
153 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); 176 m_gDisplayType->addTo(m);
177 }
154 } 178 }
155 m->setFocus(); 179 m->setFocus();
156 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 180 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
181 if (m_hGroup) {
182 m_hGroup->removeFrom(m);
183 }
184 if (m_gPrevNext) {
185 m_gPrevNext->removeFrom(m);
186 }
187 if (m_gDisplayType) {
188 m_gDisplayType->removeFrom(m);
189 }
157 delete m; 190 delete m;
158} 191}
159 192
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index f0e6541..640905a 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -6,6 +6,8 @@
6#include <qwidget.h> 6#include <qwidget.h>
7 7
8class QTimer; 8class QTimer;
9class QActionGroup;
10class QAction;
9 11
10namespace Opie { 12namespace Opie {
11 namespace Core { 13 namespace Core {
@@ -29,12 +31,14 @@ class ImageView:public Opie::MM::OImageScrollView
29 }; 31 };
30 32
31public: 33public:
32 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); 34 ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 );
33 virtual ~ImageView(); 35 virtual ~ImageView();
34 Opie::Core::OKeyConfigManager* manager(); 36 Opie::Core::OKeyConfigManager* manager();
35 void setFullScreen(bool how); 37 void setFullScreen(bool how);
36 bool fullScreen(){return m_isFullScreen;} 38 bool fullScreen(){return m_isFullScreen;}
37 virtual void enableFullscreen(); 39 virtual void enableFullscreen();
40 void stopSlide();
41 void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup);
38 42
39signals: 43signals:
40 void dispImageInfo(const QString&); 44 void dispImageInfo(const QString&);
@@ -56,6 +60,7 @@ protected:
56 QTimer*m_slideTimer; 60 QTimer*m_slideTimer;
57 int m_slideValue; 61 int m_slideValue;
58 virtual void focusInEvent ( QFocusEvent * ); 62 virtual void focusInEvent ( QFocusEvent * );
63 QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup;
59 64
60public slots: 65public slots:
61 virtual void hide(); 66 virtual void hide();
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index a1349a8..e714e84 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -49,21 +49,6 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
49 connect(m_storage, SIGNAL(disksChanged() ), 49 connect(m_storage, SIGNAL(disksChanged() ),
50 this, SLOT( dirChanged() ) ); 50 this, SLOT( dirChanged() ) );
51 51
52 /*
53 * Initialize ToolBar and IconView
54 * And Connect Them
55 */
56 toolBar = new QToolBar( this );
57 menuBar = new QMenuBar( this );
58 fileMenu = new QPopupMenu( menuBar );
59 menuBar->insertItem( tr( "File" ), fileMenu );
60 dispMenu = new QPopupMenu( menuBar );
61 menuBar->insertItem( tr( "Show" ), dispMenu );
62
63 addToolBar(toolBar);
64 toolBar->setHorizontalStretchable( true );
65 setToolBarsMovable( false );
66
67 m_stack = new Opie::Ui::OWidgetStack( this ); 52 m_stack = new Opie::Ui::OWidgetStack( this );
68 setCentralWidget( m_stack ); 53 setCentralWidget( m_stack );
69 54
@@ -75,131 +60,15 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
75 this, SLOT(slotDisplay(const QString&))); 60 this, SLOT(slotDisplay(const QString&)));
76 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 61 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
77 this, SLOT(slotShowInfo(const QString&)) ); 62 this, SLOT(slotShowInfo(const QString&)) );
63 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
78 64
79 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 65 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
80 66
81 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 67 listviewMenu = 0;
82 0, 0, this, 0, true ); 68 /* setup menu and toolbar */
83 m_aDirUp->setToggleAction(false); 69 setupActions();
84 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); 70 setupToolbar();
85 m_aDirUp->addTo( toolBar ); 71 setupMenu();
86
87 QToolButton*btn;
88
89 fsButton = new PFileSystem( toolBar );
90 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
91 m_view, SLOT(slotChangeDir( const QString& ) ) );
92 connect( this, SIGNAL( changeDir( const QString& ) ),
93 m_view, SLOT(slotChangeDir( const QString& ) ) );
94
95 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ),
96 0, 0, this, 0, true );
97 m_aShowInfo->setToggleAction(false);
98 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
99 m_aShowInfo->addTo( toolBar );
100
101 if ( Ir::supported() ) {
102 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),
103 0, 0, this, 0, true );
104 m_aBeam->setToggleAction(false);
105 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
106 m_aBeam->addTo( toolBar );
107 }
108 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet( "trash" ),
109 0, 0, this, 0, true );
110 m_aTrash->setToggleAction(false);
111 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
112 m_aTrash->addTo( toolBar );
113
114 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet( "mag" ),
115 0, 0, this, 0, true );
116 m_aViewfile->setToggleAction(false);
117 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
118
119 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet( "play" ),
120 0, 0, this, 0, true );
121 m_aStartSlide->setToggleAction(false);
122
123 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
124
125
126 int mode = m_cfg->readNumEntry("ListViewMode", 1);
127 if (mode < 1 || mode>3) mode = 1;
128 viewModeButton = new ViewModeButton( toolBar,mode );
129 connect( viewModeButton, SIGNAL(changeMode(int)),
130 m_view, SLOT(slotChangeMode(int)));
131
132 btn = new QToolButton( toolBar );
133 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
134 connect( btn, SIGNAL(clicked() ),
135 this, SLOT(slotConfig() ) );
136
137 prevButton = new QToolButton(toolBar);
138 prevButton->setIconSet( Resource::loadIconSet( "back" ) );
139 connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev()));
140
141 nextButton = new QToolButton(toolBar);
142 nextButton->setIconSet( Resource::loadIconSet( "forward" ) );
143 connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext()));
144
145/* filemenu start */
146 m_aViewfile->addTo(fileMenu);
147 m_aShowInfo->addTo(fileMenu);
148 m_aStartSlide->addTo(fileMenu);
149
150 fileMenu->insertSeparator();
151 m_aDirUp->addTo( fileMenu );
152
153 fsMenu = new QPopupMenu(fileMenu);
154 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
155 connect( fsMenu, SIGNAL( activated( int ) ),
156 this, SLOT(slotSelectDir( int ) ) );
157 dirChanged();
158
159 fileMenu->insertSeparator();
160 if ( Ir::supported() ) {
161 m_aBeam->addTo( fileMenu );
162 }
163 fileMenu->insertSeparator();
164 m_aTrash->addTo( fileMenu );
165/* filemenu end */
166
167 rotateButton = new QToolButton(toolBar);
168 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
169 rotateButton->setToggleButton(true);
170 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
171 rotateButton->setOn(true);
172 autoRotate = true;
173 prevButton->hide();
174 nextButton->hide();
175 } else {
176 rotateButton->setOn(false);
177 autoRotate = false;
178 }
179 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
180
181 scaleButton = new QToolButton(toolBar);
182 scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) );
183 scaleButton->setToggleButton(true);
184 scaleButton->setOn(false);
185 connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
186 autoScale = true;
187
188 zoomButton = new QToolButton(toolBar);
189 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) );
190 zoomButton->setToggleButton(true);
191 zoomButton->setOn(true);
192 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
193 zoomerOn = true;
194
195/* showmenu */
196 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ),
197 0, 0, this, 0, true );
198 m_aHideToolbar->setOn (true);
199 m_aHideToolbar->addTo(dispMenu);
200 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
201/* showmenu end*/
202
203} 72}
204 73
205PMainWindow::~PMainWindow() { 74PMainWindow::~PMainWindow() {
@@ -208,8 +77,8 @@ PMainWindow::~PMainWindow() {
208void PMainWindow::slotToggleZoomer() 77void PMainWindow::slotToggleZoomer()
209{ 78{
210 if (!m_disp) return; 79 if (!m_disp) return;
211 bool cur = zoomButton->isOn(); 80 bool cur = m_aZoomer->isOn();
212 zoomButton->setOn(!cur); 81 m_aZoomer->setOn(!cur);
213} 82}
214 83
215void PMainWindow::slotZoomerToggled(bool how) 84void PMainWindow::slotZoomerToggled(bool how)
@@ -223,16 +92,16 @@ void PMainWindow::slotZoomerToggled(bool how)
223void PMainWindow::slotToggleAutorotate() 92void PMainWindow::slotToggleAutorotate()
224{ 93{
225 if (!m_disp) return; 94 if (!m_disp) return;
226 if (!rotateButton->isEnabled()) return; 95 if (!m_aAutoRotate->isEnabled()) return;
227 bool cur = rotateButton->isOn(); 96 bool cur = m_aAutoRotate->isOn();
228 rotateButton->setOn(!cur); 97 m_aAutoRotate->setOn(!cur);
229} 98}
230 99
231void PMainWindow::slotToggleAutoscale() 100void PMainWindow::slotToggleAutoscale()
232{ 101{
233 if (!m_disp) return; 102 if (!m_disp) return;
234 bool cur = scaleButton->isOn(); 103 bool cur = m_aAutoScale->isOn();
235 scaleButton->setOn(!cur); 104 m_aAutoScale->setOn(!cur);
236} 105}
237 106
238void PMainWindow::slotRotateToggled(bool how) 107void PMainWindow::slotRotateToggled(bool how)
@@ -240,7 +109,7 @@ void PMainWindow::slotRotateToggled(bool how)
240 odebug << "Autorotate: " << how << oendl; 109 odebug << "Autorotate: " << how << oendl;
241 autoRotate = how; 110 autoRotate = how;
242 if (m_disp) { 111 if (m_disp) {
243 m_disp->setAutoScaleRotate(autoScale,autoRotate); 112 m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
244 } 113 }
245} 114}
246 115
@@ -250,13 +119,13 @@ void PMainWindow::slotScaleToggled(bool how)
250 if (!how) { 119 if (!how) {
251 autoRotate = how; 120 autoRotate = how;
252 } 121 }
253 if (m_disp) {
254 m_disp->setAutoScaleRotate(autoScale,autoRotate);
255 }
256 if (!autoScale) { 122 if (!autoScale) {
257 rotateButton->setOn(false); 123 m_aAutoRotate->setOn(false);
258 } 124 }
259 rotateButton->setEnabled(!how); 125 if (m_disp) {
126 m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
127 }
128 m_aAutoRotate->setEnabled(!how);
260} 129}
261 130
262void PMainWindow::slotConfig() { 131void PMainWindow::slotConfig() {
@@ -360,9 +229,10 @@ void PMainWindow::initDisp() {
360 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 229 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
361 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 230 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
362 } 231 }
363 m_disp->setAutoScale(autoScale); 232 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType);
364 m_disp->setAutoRotate(autoRotate); 233 m_disp->setAutoScale(!m_aAutoScale->isOn());
365 m_disp->setShowZoomer(zoomerOn); 234 m_disp->setAutoRotate(m_aAutoRotate->isOn());
235 m_disp->setShowZoomer(m_aZoomer->isOn());
366 m_disp->setBackgroundColor(white); 236 m_disp->setBackgroundColor(white);
367 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 237 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
368 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 238 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
@@ -373,15 +243,21 @@ void PMainWindow::initDisp() {
373 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 243 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
374 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 244 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
375 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); 245 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
246 slotFullScreenToggled(m_aFullScreen->isOn());
376 } 247 }
377} 248}
378 249
379void PMainWindow::slotToggleFullScreen() 250void PMainWindow::slotToggleFullScreen()
380{ 251{
381 odebug << "Toggle full " << oendl; 252 odebug << "Toggle full " << oendl;
253 bool current = !m_aFullScreen->isOn();
254 m_aFullScreen->setOn(current);
255}
256
257void PMainWindow::slotFullScreenToggled(bool current)
258{
259 odebug << "slotFullScreenToggled " << current << oendl;
382 if (!m_disp) return; 260 if (!m_disp) return;
383 bool current = !m_disp->fullScreen();
384 odebug << "Current = " << current << oendl;
385 if (current) { 261 if (current) {
386 odebug << "full" << oendl; 262 odebug << "full" << oendl;
387 m_disp->setBackgroundColor(black); 263 m_disp->setBackgroundColor(black);
@@ -389,13 +265,11 @@ void PMainWindow::slotToggleFullScreen()
389 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 265 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
390 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 266 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
391 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 267 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
392 //m_disp->showFullScreen();
393 //qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
394 } else { 268 } else {
395 setUpdatesEnabled(false); 269 setUpdatesEnabled(false);
396 odebug << "window" << oendl; 270 odebug << "window" << oendl;
271 m_disp->setMinimumSize(10,10);
397 m_disp->reparent(0,QPoint(0,0)); 272 m_disp->reparent(0,QPoint(0,0));
398 m_disp->showNormal();
399 m_disp->setBackgroundColor(white); 273 m_disp->setBackgroundColor(white);
400 m_stack->addWidget(m_disp,ImageDisplay); 274 m_stack->addWidget(m_disp,ImageDisplay);
401 m_disp->setVScrollBarMode(QScrollView::Auto); 275 m_disp->setVScrollBarMode(QScrollView::Auto);
@@ -426,14 +300,15 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
426 } 300 }
427 m_info->setPath( inf ); 301 m_info->setPath( inf );
428 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 302 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
429 prevButton->hide(); 303 m_aNext->removeFrom(toolBar);
430 nextButton->hide(); 304 m_aPrevious->removeFrom(toolBar);
305 m_aNext->setEnabled(false);
306 m_aPrevious->setEnabled(false);
431 m_aDirUp->setEnabled(false); 307 m_aDirUp->setEnabled(false);
432 m_aShowInfo->setEnabled(false); 308 m_aShowInfo->setEnabled(false);
433 m_aViewfile->setEnabled(true); 309 m_aViewfile->setEnabled(true);
434 m_aStartSlide->setEnabled(false); 310 m_aStartSlide->setEnabled(false);
435 fsButton->hide(); 311 fsButton->hide();
436 viewModeButton->hide();
437 } 312 }
438 m_stack->raiseWidget( ImageInfo ); 313 m_stack->raiseWidget( ImageInfo );
439} 314}
@@ -445,14 +320,16 @@ void PMainWindow::slotDisplay( const QString& inf ) {
445 } 320 }
446 m_disp->setImage( inf ); 321 m_disp->setImage( inf );
447 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 322 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
448 prevButton->show(); 323 if (m_gPrevNext->isEnabled()==false) {
449 nextButton->show(); 324 m_gPrevNext->addTo(toolBar);
450 m_aDirUp->setEnabled(false); 325 m_gPrevNext->setEnabled(true);
451 m_aShowInfo->setEnabled(true); 326
452 m_aViewfile->setEnabled(false); 327 m_aDirUp->setEnabled(false);
453 m_aStartSlide->setEnabled(false); 328 m_aShowInfo->setEnabled(true);
454 fsButton->hide(); 329 m_aViewfile->setEnabled(false);
455 viewModeButton->hide(); 330 m_aStartSlide->setEnabled(false);
331 fsButton->hide();
332 }
456 } 333 }
457 if (m_disp->fullScreen()) { 334 if (m_disp->fullScreen()) {
458 //m_disp->showFullScreen(); 335 //m_disp->showFullScreen();
@@ -462,6 +339,26 @@ void PMainWindow::slotDisplay( const QString& inf ) {
462 } 339 }
463} 340}
464 341
342void PMainWindow::raiseIconView() {
343 setUpdatesEnabled(false);
344 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
345 m_gPrevNext->removeFrom(toolBar);
346 m_gPrevNext->setEnabled(false);
347 m_aDirUp->setEnabled(true);
348 m_aShowInfo->setEnabled(true);
349 m_aViewfile->setEnabled(true);
350 m_aStartSlide->setEnabled(true);
351 fsButton->show();
352 }
353 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
354 m_disp->stopSlide();
355 m_disp->hide();
356 }
357 m_stack->raiseWidget( IconView );
358 setUpdatesEnabled(true);
359 repaint();
360}
361
465void PMainWindow::slotReturn() { 362void PMainWindow::slotReturn() {
466 raiseIconView(); 363 raiseIconView();
467} 364}
@@ -487,26 +384,6 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) {
487 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 384 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
488} 385}
489 386
490void PMainWindow::raiseIconView() {
491 setUpdatesEnabled(false);
492 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
493 prevButton->hide();
494 nextButton->hide();
495 m_aDirUp->setEnabled(true);
496 m_aShowInfo->setEnabled(true);
497 m_aViewfile->setEnabled(true);
498 m_aStartSlide->setEnabled(true);
499 fsButton->show();
500 viewModeButton->show();
501 }
502 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
503 m_disp->hide();
504 }
505 m_stack->raiseWidget( IconView );
506 setUpdatesEnabled(true);
507 repaint();
508}
509
510void PMainWindow::setDocument( const QString& showImg ) { 387void PMainWindow::setDocument( const QString& showImg ) {
511 QString file = showImg; 388 QString file = showImg;
512 DocLnk lnk(showImg); 389 DocLnk lnk(showImg);
@@ -546,4 +423,201 @@ void PMainWindow::showToolbar(bool how)
546{ 423{
547 if (!how) toolBar->hide(); 424 if (!how) toolBar->hide();
548 else toolBar->show(); 425 else toolBar->show();
549} \ No newline at end of file 426}
427
428void PMainWindow::setupActions()
429{
430 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
431 m_aDirUp->setToggleAction(false);
432 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
433
434 if ( Ir::supported() ) {
435 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true );
436 m_aBeam->setToggleAction(false);
437 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
438 } else {
439 m_aBeam = 0;
440 }
441
442 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true );
443 m_aShowInfo->setToggleAction(false);
444 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
445
446 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true );
447 m_aTrash->setToggleAction(false);
448 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
449
450 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true );
451 m_aViewfile->setToggleAction(false);
452 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
453
454 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true );
455 m_aStartSlide->setToggleAction(false);
456 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
457
458 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true );
459 m_aHideToolbar->setOn (true);
460 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
461
462 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true );
463 m_aSetup->setToggleAction(false);
464 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig()));
465
466 m_gListViewMode = new QActionGroup(this,"Select listmode",true);
467 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*)));
468
469 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true );
470 m_aDirLong->setToggleAction(true);
471 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true );
472 m_aDirShort->setToggleAction(true);
473 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true );
474 m_aDirName->setToggleAction(true);
475 int mode = m_cfg->readNumEntry("ListViewMode", 1);
476 if (mode < 1 || mode>3) mode = 1;
477 switch (mode) {
478 case 3:
479 m_aDirName->setOn(true);
480 break;
481 case 2:
482 m_aDirShort->setOn(true);
483 break;
484 case 1:
485 default:
486 m_aDirLong->setOn(true);
487 }
488 m_gListViewMode->insert(m_aDirLong);
489 m_gListViewMode->insert(m_aDirShort);
490 m_gListViewMode->insert(m_aDirName);
491
492 m_gPrevNext = new QActionGroup(this,"imageprevnext",false);
493 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true );
494 m_aNext->setToggleAction(false);
495 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext()));
496 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true );
497 m_aPrevious->setToggleAction(false);
498 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
499 m_gPrevNext->insert(m_aPrevious);
500 m_gPrevNext->insert(m_aNext);
501
502 m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
503 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
504 m_aFullScreen->setToggleAction(true);
505 m_aFullScreen->setOn(false);
506 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenToggled(bool)));
507
508 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
509 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
510 m_aAutoRotate->setToggleAction(true);
511 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
512 m_aAutoRotate->setOn(true);
513 autoRotate = true;
514 } else {
515 m_aAutoRotate->setOn(false);
516 autoRotate = false;
517 }
518 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
519
520 m_aAutoScale = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
521 m_aAutoScale->setToggleAction(true);
522 m_aAutoScale->setOn (false);
523 connect(m_aAutoScale,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
524
525 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
526 m_aZoomer->setToggleAction(true);
527 m_aZoomer->setOn (true);
528 zoomerOn = true;
529 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
530 m_gDisplayType->insert(m_aAutoRotate);
531 m_gDisplayType->insert(m_aAutoScale);
532 m_gDisplayType->insert(m_aZoomer);
533
534 m_hGroup = new QActionGroup(this,"actioncollection",false);
535 m_hGroup->insert(m_aFullScreen);
536}
537
538void PMainWindow::setupToolbar()
539{
540 toolBar = new QToolBar( this );
541 addToolBar(toolBar);
542 toolBar->setHorizontalStretchable( true );
543 setToolBarsMovable( false );
544 m_aDirUp->addTo( toolBar );
545
546 fsButton = new PFileSystem( toolBar );
547 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
548 m_view, SLOT(slotChangeDir( const QString& ) ) );
549 connect( this, SIGNAL( changeDir( const QString& ) ),
550 m_view, SLOT(slotChangeDir( const QString& ) ) );
551
552 if (m_aBeam) {
553 m_aBeam->addTo( toolBar );
554 }
555 m_aShowInfo->addTo(toolBar);
556 m_aTrash->addTo(toolBar);
557 m_aSetup->addTo(toolBar);
558
559 m_gDisplayType->addTo(toolBar);
560
561 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
562 m_gPrevNext->addTo(toolBar);
563 } else {
564 m_gPrevNext->setEnabled(false);
565 }
566}
567
568void PMainWindow::setupMenu()
569{
570 fileMenu = new QPopupMenu( menuBar() );
571 menuBar()->insertItem( tr( "File" ), fileMenu );
572 dispMenu = new QPopupMenu( menuBar() );
573 menuBar()->insertItem( tr( "Show" ), dispMenu );
574
575 m_aViewfile->addTo(fileMenu);
576 m_aShowInfo->addTo(fileMenu);
577 m_aStartSlide->addTo(fileMenu);
578
579 fileMenu->insertSeparator();
580 m_aDirUp->addTo( fileMenu );
581
582 fsMenu = new QPopupMenu(fileMenu);
583 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
584 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
585 dirChanged();
586
587 if ( m_aBeam ) {
588 fileMenu->insertSeparator();
589 m_aBeam->addTo( fileMenu );
590 }
591 fileMenu->insertSeparator();
592 m_aSetup->addTo(fileMenu);
593 m_aTrash->addTo(fileMenu);
594
595 m_aHideToolbar->addTo(dispMenu);
596 listviewMenu = new QPopupMenu(dispMenu);
597 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
598 m_gListViewMode->addTo(listviewMenu);
599 dispMenu->insertSeparator();
600 m_aFullScreen->addTo(dispMenu);
601 m_gDisplayType->addTo(dispMenu);
602 dispMenu->insertSeparator();
603 m_gPrevNext->addTo(dispMenu);
604}
605
606void PMainWindow::listviewselected(QAction*which)
607{
608 if (!which || which->isOn()==false) return;
609 int val = 1;
610// QString name;
611
612 if (which==m_aDirName) {
613 val = 3;
614// name = "opie-eye/opie-eye-textview";
615 } else if (which==m_aDirShort) {
616 val = 2;
617// name = "opie-eye/opie-eye-thumbonly";
618 } else if (which==m_aDirLong) {
619 val = 1;
620// name = "opie-eye/opie-eye-thumb";
621 }
622 emit changeListMode(val);
623}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index ae1cc09..65151fc 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -29,6 +29,7 @@ class QMenuBar;
29class QToolBar; 29class QToolBar;
30class QPopupMenu; 30class QPopupMenu;
31class QAction; 31class QAction;
32class QActionGroup;
32class StorageInfo; 33class StorageInfo;
33 34
34class PMainWindow : public QMainWindow { 35class PMainWindow : public QMainWindow {
@@ -42,6 +43,7 @@ public:
42signals: 43signals:
43 void configChanged(); 44 void configChanged();
44 void changeDir( const QString& ); 45 void changeDir( const QString& );
46 void changeListMode(int);
45 47
46public slots: 48public slots:
47 void slotShowInfo( const QString& inf ); 49 void slotShowInfo( const QString& inf );
@@ -55,11 +57,13 @@ public slots:
55 void slotToggleAutoscale(); 57 void slotToggleAutoscale();
56 void setDocument( const QString& ); 58 void setDocument( const QString& );
57 virtual void slotToggleFullScreen(); 59 virtual void slotToggleFullScreen();
60 virtual void slotFullScreenToggled(bool);
58 61
59protected slots: 62protected slots:
60 void raiseIconView(); 63 void raiseIconView();
61 void closeEvent( QCloseEvent* ); 64 void closeEvent( QCloseEvent* );
62 void showToolbar(bool); 65 void showToolbar(bool);
66 void listviewselected(QAction*);
63 67
64private: 68private:
65 template<class T> void initT( const char* name, T**, int ); 69 template<class T> void initT( const char* name, T**, int );
@@ -75,14 +79,19 @@ private:
75 bool autoRotate; 79 bool autoRotate;
76 bool autoScale; 80 bool autoScale;
77 bool zoomerOn; 81 bool zoomerOn;
78 QToolButton*rotateButton,*fsButton,*viewModeButton; 82 QToolButton*fsButton;
79 QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton;
80 QMenuBar *menuBar;
81 QToolBar *toolBar; 83 QToolBar *toolBar;
82 QPopupMenu *fileMenu,*dispMenu,*fsMenu; 84 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu;
83 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; 85 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide;
84 QAction*m_aHideToolbar; 86 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong;
85 87 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup;
88 QAction *m_aNext,*m_aPrevious,*m_aFullScreen;
89 QAction *m_aAutoRotate,*m_aAutoScale,*m_aZoomer;
90
91 /* init funs */
92 void setupActions();
93 void setupToolbar();
94 void setupMenu();
86 /* for the device submenu - ToDo: Merge with the special button */ 95 /* for the device submenu - ToDo: Merge with the special button */
87 StorageInfo *m_storage; 96 StorageInfo *m_storage;
88 QMap<QString, QString> m_dev; 97 QMap<QString, QString> m_dev;