author | alwin <alwin> | 2004-10-31 16:31:04 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-31 16:31:04 (UTC) |
commit | 6d27de4d1d4ebce0acc9ab68037d7e9f3c1d3703 (patch) (unidiff) | |
tree | 793f8a0e448ff7944dab4ce5187d6e1b93daf416 | |
parent | 92fa51ae338d92b0df078f8283b31afdfcf4341a (diff) | |
download | opie-6d27de4d1d4ebce0acc9ab68037d7e9f3c1d3703.zip opie-6d27de4d1d4ebce0acc9ab68037d7e9f3c1d3703.tar.gz opie-6d27de4d1d4ebce0acc9ab68037d7e9f3c1d3703.tar.bz2 |
all toolbuttons etc. switched to QAction objects
menu mostly finished
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 49 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 454 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 21 |
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 | |||
@@ -10,2 +10,3 @@ | |||
10 | #include <qtimer.h> | 10 | #include <qtimer.h> |
11 | #include <qaction.h> | ||
11 | 12 | ||
@@ -25,2 +26,12 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name | |||
25 | m_slideValue = 5; | 26 | m_slideValue = 5; |
27 | m_gDisplayType = 0; | ||
28 | m_gPrevNext = 0; | ||
29 | m_hGroup = 0; | ||
30 | } | ||
31 | |||
32 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) | ||
33 | { | ||
34 | m_gDisplayType = disptypeGroup; | ||
35 | m_gPrevNext = nextprevGroup; | ||
36 | m_hGroup = hGroup; | ||
26 | } | 37 | } |
@@ -51,2 +62,12 @@ void ImageView::startSlide(int value) | |||
51 | 62 | ||
63 | void ImageView::stopSlide() | ||
64 | { | ||
65 | if (!m_slideTimer) { | ||
66 | return; | ||
67 | } | ||
68 | m_slideTimer->stop(); | ||
69 | delete m_slideTimer; | ||
70 | m_slideTimer = 0; | ||
71 | } | ||
72 | |||
52 | void ImageView::nextSlide() | 73 | void ImageView::nextSlide() |
@@ -144,11 +165,14 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
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 | } |
@@ -156,2 +180,11 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
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; |
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 | |||
@@ -8,2 +8,4 @@ | |||
8 | class QTimer; | 8 | class QTimer; |
9 | class QActionGroup; | ||
10 | class QAction; | ||
9 | 11 | ||
@@ -31,3 +33,3 @@ class ImageView:public Opie::MM::OImageScrollView | |||
31 | public: | 33 | public: |
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(); |
@@ -37,2 +39,4 @@ public: | |||
37 | virtual void enableFullscreen(); | 39 | virtual void enableFullscreen(); |
40 | void stopSlide(); | ||
41 | void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); | ||
38 | 42 | ||
@@ -58,2 +62,3 @@ protected: | |||
58 | virtual void focusInEvent ( QFocusEvent * ); | 62 | virtual void focusInEvent ( QFocusEvent * ); |
63 | QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; | ||
59 | 64 | ||
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 | |||
@@ -51,17 +51,2 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
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 ); |
@@ -77,2 +62,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
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 | ||
@@ -80,124 +66,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
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 | } |
@@ -210,4 +79,4 @@ void PMainWindow::slotToggleZoomer() | |||
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 | } |
@@ -225,5 +94,5 @@ void PMainWindow::slotToggleAutorotate() | |||
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 | } |
@@ -233,4 +102,4 @@ void PMainWindow::slotToggleAutoscale() | |||
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 | } |
@@ -242,3 +111,3 @@ void PMainWindow::slotRotateToggled(bool 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 | } |
@@ -252,9 +121,9 @@ void PMainWindow::slotScaleToggled(bool 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 | } |
@@ -362,5 +231,6 @@ void PMainWindow::initDisp() { | |||
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); |
@@ -375,2 +245,3 @@ void PMainWindow::initDisp() { | |||
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 | } |
@@ -381,5 +252,10 @@ void PMainWindow::slotToggleFullScreen() | |||
381 | odebug << "Toggle full " << oendl; | 252 | odebug << "Toggle full " << oendl; |
253 | bool current = !m_aFullScreen->isOn(); | ||
254 | m_aFullScreen->setOn(current); | ||
255 | } | ||
256 | |||
257 | void 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) { |
@@ -391,4 +267,2 @@ void PMainWindow::slotToggleFullScreen() | |||
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 { |
@@ -396,4 +270,4 @@ void PMainWindow::slotToggleFullScreen() | |||
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); |
@@ -428,4 +302,6 @@ void PMainWindow::slotShowInfo( const QString& 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); |
@@ -435,3 +311,2 @@ void PMainWindow::slotShowInfo( const QString& inf ) { | |||
435 | fsButton->hide(); | 311 | fsButton->hide(); |
436 | viewModeButton->hide(); | ||
437 | } | 312 | } |
@@ -447,10 +322,12 @@ void PMainWindow::slotDisplay( const QString& 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 | } |
@@ -464,2 +341,22 @@ void PMainWindow::slotDisplay( const QString& inf ) { | |||
464 | 341 | ||
342 | void 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 | |||
465 | void PMainWindow::slotReturn() { | 362 | void PMainWindow::slotReturn() { |
@@ -489,22 +386,2 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { | |||
489 | 386 | ||
490 | void 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 | |||
510 | void PMainWindow::setDocument( const QString& showImg ) { | 387 | void PMainWindow::setDocument( const QString& showImg ) { |
@@ -548,2 +425,199 @@ void PMainWindow::showToolbar(bool how) | |||
548 | else toolBar->show(); | 425 | else toolBar->show(); |
549 | } \ No newline at end of file | 426 | } |
427 | |||
428 | void 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 | |||
538 | void 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 | |||
568 | void 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 | |||
606 | void 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 | |||
@@ -31,2 +31,3 @@ class QPopupMenu; | |||
31 | class QAction; | 31 | class QAction; |
32 | class QActionGroup; | ||
32 | class StorageInfo; | 33 | class StorageInfo; |
@@ -44,2 +45,3 @@ signals: | |||
44 | void changeDir( const QString& ); | 45 | void changeDir( const QString& ); |
46 | void changeListMode(int); | ||
45 | 47 | ||
@@ -57,2 +59,3 @@ public slots: | |||
57 | virtual void slotToggleFullScreen(); | 59 | virtual void slotToggleFullScreen(); |
60 | virtual void slotFullScreenToggled(bool); | ||
58 | 61 | ||
@@ -62,2 +65,3 @@ protected slots: | |||
62 | void showToolbar(bool); | 65 | void showToolbar(bool); |
66 | void listviewselected(QAction*); | ||
63 | 67 | ||
@@ -77,10 +81,15 @@ private: | |||
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 */ |