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 /noncore/graphics/opie-eye/gui/mainwindow.cpp | |
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
Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 442 |
1 files changed, 258 insertions, 184 deletions
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 | ||
205 | PMainWindow::~PMainWindow() { | 74 | PMainWindow::~PMainWindow() { |
@@ -208,8 +77,8 @@ PMainWindow::~PMainWindow() { | |||
208 | void PMainWindow::slotToggleZoomer() | 77 | void 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 | ||
215 | void PMainWindow::slotZoomerToggled(bool how) | 84 | void PMainWindow::slotZoomerToggled(bool how) |
@@ -223,16 +92,16 @@ void PMainWindow::slotZoomerToggled(bool how) | |||
223 | void PMainWindow::slotToggleAutorotate() | 92 | void 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 | ||
231 | void PMainWindow::slotToggleAutoscale() | 100 | void 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 | ||
238 | void PMainWindow::slotRotateToggled(bool how) | 107 | void 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 | ||
262 | void PMainWindow::slotConfig() { | 131 | void 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 | ||
379 | void PMainWindow::slotToggleFullScreen() | 250 | void 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 | |||
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) { |
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); |
325 | m_gPrevNext->setEnabled(true); | ||
326 | |||
450 | m_aDirUp->setEnabled(false); | 327 | m_aDirUp->setEnabled(false); |
451 | m_aShowInfo->setEnabled(true); | 328 | m_aShowInfo->setEnabled(true); |
452 | m_aViewfile->setEnabled(false); | 329 | m_aViewfile->setEnabled(false); |
453 | m_aStartSlide->setEnabled(false); | 330 | m_aStartSlide->setEnabled(false); |
454 | fsButton->hide(); | 331 | fsButton->hide(); |
455 | viewModeButton->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 | ||
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() { |
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 | ||
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 ) { |
511 | QString file = showImg; | 388 | QString file = showImg; |
512 | DocLnk lnk(showImg); | 389 | DocLnk lnk(showImg); |
@@ -547,3 +424,200 @@ void PMainWindow::showToolbar(bool how) | |||
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 | } \ No newline at end of file |
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 | } | ||