-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 173 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 20 |
5 files changed, 159 insertions, 40 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 0499af9..a41ce9f 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -674,5 +674,5 @@ void PIconView::slotShowImage( const QString& name) { PDirLister *lister = currentView()->dirLister(); QString r_name = lister->nameToFname(name); - emit sig_display( r_name ); + emit sig_display(r_name); } @@ -693,5 +693,4 @@ void PIconView::slotImageInfo() { QString name = currentFileName(isDir); if (isDir) return; - slotImageInfo( name ); } diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index bccbb0e..dff55ed 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h @@ -38,5 +38,5 @@ public: signals: void sig_showInfo( const QString& ); - void sig_display( const QString& ); + void sig_display(const QString&); void sig_startslide(int timeout); diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index b699aa1..a20c879 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -204,3 +204,2 @@ void ImageView::enableFullscreen() } - diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 3c946b6..a1349a8 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -23,4 +23,5 @@ #include <qpe/config.h> #include <qpe/ir.h> +#include <qpe/storage.h> #include <qpe/applnk.h> @@ -32,5 +33,6 @@ #include <qtimer.h> #include <qframe.h> - +#include <qmenubar.h> +#include <qaction.h> //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) @@ -43,10 +45,22 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) m_cfg = new Opie::Core::OConfig("phunkview"); m_cfg->setGroup("Zecke_view" ); + + m_storage = new StorageInfo(); + connect(m_storage, SIGNAL(disksChanged() ), + this, SLOT( dirChanged() ) ); + /* * Initialize ToolBar and IconView * And Connect Them */ - QToolBar *bar = new QToolBar( this ); - bar->setHorizontalStretchable( true ); + toolBar = new QToolBar( this ); + menuBar = new QMenuBar( this ); + fileMenu = new QPopupMenu( menuBar ); + menuBar->insertItem( tr( "File" ), fileMenu ); + dispMenu = new QPopupMenu( menuBar ); + menuBar->insertItem( tr( "Show" ), dispMenu ); + + addToolBar(toolBar); + toolBar->setHorizontalStretchable( true ); setToolBarsMovable( false ); @@ -57,4 +71,5 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) m_stack->addWidget( m_view, IconView ); m_stack->raiseWidget( IconView ); + connect(m_view, SIGNAL(sig_display(const QString&)), this, SLOT(slotDisplay(const QString&))); @@ -64,56 +79,93 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); - upButton = new QToolButton( bar ); - upButton->setIconSet( Resource::loadIconSet( "up" ) ); - connect( upButton, SIGNAL(clicked()), - m_view, SLOT(slotDirUp()) ); + m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), + 0, 0, this, 0, true ); + m_aDirUp->setToggleAction(false); + connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); + m_aDirUp->addTo( toolBar ); - fsButton = new PFileSystem( bar ); + QToolButton*btn; + + fsButton = new PFileSystem( toolBar ); connect( fsButton, SIGNAL( changeDir( const QString& ) ), m_view, SLOT(slotChangeDir( const QString& ) ) ); + connect( this, SIGNAL( changeDir( const QString& ) ), + m_view, SLOT(slotChangeDir( const QString& ) ) ); - QToolButton*btn = new QToolButton( bar ); - btn->setIconSet( Resource::loadIconSet( "edit" ) ); - connect( btn, SIGNAL(clicked()), - m_view, SLOT(slotImageInfo()) ); + m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), + 0, 0, this, 0, true ); + m_aShowInfo->setToggleAction(false); + connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); + m_aShowInfo->addTo( toolBar ); if ( Ir::supported() ) { - btn = new QToolButton( bar ); - btn->setIconSet( Resource::loadIconSet( "beam" ) ); - connect( btn, SIGNAL(clicked()), - m_view, SLOT(slotBeam()) ); + m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ), + 0, 0, this, 0, true ); + m_aBeam->setToggleAction(false); + connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); + m_aBeam->addTo( toolBar ); } + m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet( "trash" ), + 0, 0, this, 0, true ); + m_aTrash->setToggleAction(false); + connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); + m_aTrash->addTo( toolBar ); - btn = new QToolButton( bar ); - btn->setIconSet( Resource::loadIconSet( "trash" ) ); - connect( btn, SIGNAL(clicked() ), - m_view, SLOT(slotTrash() ) ); + m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet( "mag" ), + 0, 0, this, 0, true ); + m_aViewfile->setToggleAction(false); + connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); + + m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet( "play" ), + 0, 0, this, 0, true ); + m_aStartSlide->setToggleAction(false); + + connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); int mode = m_cfg->readNumEntry("ListViewMode", 1); if (mode < 1 || mode>3) mode = 1; - viewModeButton = new ViewModeButton( bar,mode ); + viewModeButton = new ViewModeButton( toolBar,mode ); connect( viewModeButton, SIGNAL(changeMode(int)), m_view, SLOT(slotChangeMode(int))); - btn = new QToolButton( bar ); + btn = new QToolButton( toolBar ); btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); connect( btn, SIGNAL(clicked() ), this, SLOT(slotConfig() ) ); - - - prevButton = new QToolButton(bar); + prevButton = new QToolButton(toolBar); prevButton->setIconSet( Resource::loadIconSet( "back" ) ); connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); - nextButton = new QToolButton(bar); + nextButton = new QToolButton(toolBar); nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); - rotateButton = new QToolButton(bar); +/* filemenu start */ + m_aViewfile->addTo(fileMenu); + m_aShowInfo->addTo(fileMenu); + m_aStartSlide->addTo(fileMenu); + + fileMenu->insertSeparator(); + m_aDirUp->addTo( fileMenu ); + + fsMenu = new QPopupMenu(fileMenu); + fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); + connect( fsMenu, SIGNAL( activated( int ) ), + this, SLOT(slotSelectDir( int ) ) ); + dirChanged(); + + fileMenu->insertSeparator(); + if ( Ir::supported() ) { + m_aBeam->addTo( fileMenu ); + } + fileMenu->insertSeparator(); + m_aTrash->addTo( fileMenu ); +/* filemenu end */ + + rotateButton = new QToolButton(toolBar); rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); rotateButton->setToggleButton(true); - if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { rotateButton->setOn(true); @@ -125,8 +177,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) autoRotate = false; } - connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); - scaleButton = new QToolButton(bar); + scaleButton = new QToolButton(toolBar); scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); scaleButton->setToggleButton(true); @@ -135,5 +186,5 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) autoScale = true; - zoomButton = new QToolButton(bar); + zoomButton = new QToolButton(toolBar); zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); zoomButton->setToggleButton(true); @@ -141,4 +192,13 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); zoomerOn = true; + +/* showmenu */ + m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), + 0, 0, this, 0, true ); + m_aHideToolbar->setOn (true); + m_aHideToolbar->addTo(dispMenu); + connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); +/* showmenu end*/ + } @@ -178,7 +238,8 @@ void PMainWindow::slotToggleAutoscale() void PMainWindow::slotRotateToggled(bool how) { + odebug << "Autorotate: " << how << oendl; autoRotate = how; if (m_disp) { - m_disp->setAutoRotate(how); + m_disp->setAutoScaleRotate(autoScale,autoRotate); } } @@ -368,5 +429,8 @@ void PMainWindow::slotShowInfo( const QString& inf ) { prevButton->hide(); nextButton->hide(); - upButton->hide(); + m_aDirUp->setEnabled(false); + m_aShowInfo->setEnabled(false); + m_aViewfile->setEnabled(true); + m_aStartSlide->setEnabled(false); fsButton->hide(); viewModeButton->hide(); @@ -376,4 +440,5 @@ void PMainWindow::slotShowInfo( const QString& inf ) { void PMainWindow::slotDisplay( const QString& inf ) { + odebug << "slotDisplay: " << inf << oendl; if ( !m_disp ) { initDisp(); @@ -383,5 +448,8 @@ void PMainWindow::slotDisplay( const QString& inf ) { prevButton->show(); nextButton->show(); - upButton->hide(); + m_aDirUp->setEnabled(false); + m_aShowInfo->setEnabled(true); + m_aViewfile->setEnabled(false); + m_aStartSlide->setEnabled(false); fsButton->hide(); viewModeButton->hide(); @@ -425,5 +493,8 @@ void PMainWindow::raiseIconView() { prevButton->hide(); nextButton->hide(); - upButton->show(); + m_aDirUp->setEnabled(true); + m_aShowInfo->setEnabled(true); + m_aViewfile->setEnabled(true); + m_aStartSlide->setEnabled(true); fsButton->show(); viewModeButton->show(); @@ -445,2 +516,34 @@ void PMainWindow::setDocument( const QString& showImg ) { slotDisplay( file ); } + +void PMainWindow::slotSelectDir(int id) +{ + emit changeDir( m_dev[fsMenu->text(id )] ); +} + +void PMainWindow::dirChanged() +{ + fsMenu->clear(); + m_dev.clear(); + + /* home dir, too */ + QString f = getenv( "HOME" ); + if (!f.isEmpty()) { + m_dev.insert("Home directory",f); + fsMenu->insertItem("Home directory"); + } + const QList<FileSystem> &fs = m_storage->fileSystems(); + QListIterator<FileSystem> it(fs ); + for ( ; it.current(); ++it ) { + const QString disk = (*it)->name(); + const QString path = (*it)->path(); + m_dev.insert( disk, path ); + fsMenu->insertItem( disk ); + } +} + +void PMainWindow::showToolbar(bool how) +{ + if (!how) toolBar->hide(); + else toolBar->show(); +}
\ No newline at end of file diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 6fa1ab6..ae1cc09 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -26,4 +26,9 @@ class ImageWidget; class PIconView; class imageinfo; +class QMenuBar; +class QToolBar; +class QPopupMenu; +class QAction; +class StorageInfo; class PMainWindow : public QMainWindow { @@ -37,4 +42,5 @@ public: signals: void configChanged(); + void changeDir( const QString& ); public slots: @@ -54,4 +60,5 @@ protected slots: void raiseIconView(); void closeEvent( QCloseEvent* ); + void showToolbar(bool); private: @@ -69,9 +76,20 @@ private: bool autoScale; bool zoomerOn; - QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; + QToolButton*rotateButton,*fsButton,*viewModeButton; QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton; + QMenuBar *menuBar; + QToolBar *toolBar; + QPopupMenu *fileMenu,*dispMenu,*fsMenu; + QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; + QAction*m_aHideToolbar; + + /* for the device submenu - ToDo: Merge with the special button */ + StorageInfo *m_storage; + QMap<QString, QString> m_dev; private slots: void slotConfig(); + void slotSelectDir(int); + void dirChanged(); }; |