author | alwin <alwin> | 2004-04-16 00:54:42 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-16 00:54:42 (UTC) |
commit | 7c29eeaecc8301fb500851382b3d94092ae72719 (patch) (side-by-side diff) | |
tree | aa93d419a5b5752f080a6dc66afd5d8a3ec4ace0 | |
parent | de3d551d3b07617653c01e540ee3c6262a2cd595 (diff) | |
download | opie-7c29eeaecc8301fb500851382b3d94092ae72719.zip opie-7c29eeaecc8301fb500851382b3d94092ae72719.tar.gz opie-7c29eeaecc8301fb500851382b3d94092ae72719.tar.bz2 |
not all buttons will showed in every view, small beauties
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 11 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 43 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 4 |
4 files changed, 45 insertions, 15 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index f6e1816..7231bfb 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -274,31 +274,29 @@ QString PIconView::nextFileName(bool &isDir)const QIconViewItem* _it1 = m_view->currentItem(); if ( !_it1 ) return QString::null; QIconViewItem* _it = _it1->nextItem(); if ( !_it ) return QString::null; IconViewItem* it = static_cast<IconViewItem*>( _it ); isDir = it->isDir(); - m_view->setCurrentItem(_it); return it->path(); } QString PIconView::prevFileName(bool &isDir)const{ isDir = false; QIconViewItem* _it = m_view->currentItem(); if ( !_it ) return QString::null; _it = _it->prevItem(); if ( !_it ) return QString::null; IconViewItem* it = static_cast<IconViewItem*>( _it ); isDir = it->isDir(); - m_view->setCurrentItem(_it); return it->path(); } void PIconView::slotTrash() { bool isDir; QString pa = currentFileName( isDir ); if ( isDir && pa.isEmpty() ) return; @@ -474,28 +472,31 @@ void PIconView::slotEnd() { m_view->viewport()->setUpdatesEnabled( true ); m_updatet = false; } void PIconView::slotShowNext() { bool isDir = false; QString name = nextFileName(isDir); - if (isDir) return; if (name.isEmpty()) return; - odebug << "Show next: " << name << oendl; + if (isDir) return; + /* if we got a name we have a next item */ + m_view->setCurrentItem(m_view->currentItem()->nextItem()); slotShowImage(name); } void PIconView::slotShowPrev() { bool isDir = false; QString name = prevFileName(isDir); - if (isDir) return; if (name.isEmpty()) return; + if (isDir) return; + /* if we got a name we have a prev item */ + m_view->setCurrentItem(m_view->currentItem()->prevItem()); slotShowImage(name); } void PIconView::slotShowImage() { bool isDir = false; QString name = currentFileName(isDir); if (isDir) return; diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index aa2b9bc..fbc4494 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -38,16 +38,18 @@ void ImageView::initKeys() m_cfg = new Opie::Core::OConfig("phunkview"); m_cfg->setGroup("image_view_keys" ); } Opie::Core::OKeyPair::List lst; lst.append( Opie::Core::OKeyPair::upArrowKey() ); lst.append( Opie::Core::OKeyPair::downArrowKey() ); lst.append( Opie::Core::OKeyPair::leftArrowKey() ); lst.append( Opie::Core::OKeyPair::rightArrowKey() ); + lst.append( Opie::Core::OKeyPair(Qt::Key_N,0)); + lst.append( Opie::Core::OKeyPair(Qt::Key_P,0)); m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", lst, false,this, "image_view_keys" ); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", Resource::loadPixmap("1to1"), ViewInfo, Opie::Core::OKeyPair(Qt::Key_I,Qt::ShiftButton), this, SLOT(slotShowImageInfo()))); #if 0 diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 57be247..6f3f255 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -59,26 +59,26 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) m_stack->raiseWidget( IconView ); connect(m_view, SIGNAL(sig_display(const QString&)), this, SLOT(slotDisplay(const QString&))); connect(m_view, SIGNAL(sig_showInfo(const QString&)), this, SLOT(slotShowInfo(const QString&)) ); m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); - QToolButton *btn = new QToolButton( bar ); - btn->setIconSet( Resource::loadIconSet( "up" ) ); - connect( btn, SIGNAL(clicked()), + upButton = new QToolButton( bar ); + upButton->setIconSet( Resource::loadIconSet( "up" ) ); + connect( upButton, SIGNAL(clicked()), m_view, SLOT(slotDirUp()) ); - btn = new PFileSystem( bar ); - connect( btn, SIGNAL( changeDir( const QString& ) ), + fsButton = new PFileSystem( bar ); + connect( fsButton, SIGNAL( changeDir( const QString& ) ), m_view, SLOT(slotChangeDir( const QString& ) ) ); - btn = new QToolButton( bar ); + QToolButton*btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "edit" ) ); connect( btn, SIGNAL(clicked()), m_view, SLOT(slotRename()) ); if ( Ir::supported() ) { btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "beam" ) ); connect( btn, SIGNAL(clicked()), @@ -86,25 +86,37 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) } btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "trash" ) ); connect( btn, SIGNAL(clicked() ), m_view, SLOT(slotTrash() ) ); - btn = new ViewModeButton( bar ); - connect( btn, SIGNAL(changeMode(int)), + viewModeButton = new ViewModeButton( bar ); + connect( viewModeButton, SIGNAL(changeMode(int)), m_view, SLOT(slotChangeMode(int))); btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); connect( btn, SIGNAL(clicked() ), this, SLOT(slotConfig() ) ); + + + prevButton = new QToolButton(bar); + prevButton->setIconSet( Resource::loadIconSet( "back" ) ); + connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); + prevButton->hide(); + + nextButton = new QToolButton(bar); + nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); + connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); + nextButton->hide(); + rotateButton = new QToolButton(bar); rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); rotateButton->setToggleButton(true); odebug << "Mode = " << m_stack->mode() << oendl; if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { rotateButton->setOn(true); autoRotate = true; @@ -279,24 +291,34 @@ void PMainWindow::initDisp() { * * ### FIXME and talk to alwin */ void PMainWindow::slotShowInfo( const QString& inf ) { if ( !m_info ) { initInfo(); } m_info->setPath( inf ); + prevButton->hide(); + nextButton->hide(); + upButton->hide(); + fsButton->hide(); + viewModeButton->hide(); m_stack->raiseWidget( ImageInfo ); } void PMainWindow::slotDisplay( const QString& inf ) { if ( !m_disp ) { initDisp(); } m_disp->setImage( inf ); + prevButton->show(); + nextButton->show(); + upButton->hide(); + fsButton->hide(); + viewModeButton->hide(); m_stack->raiseWidget( ImageDisplay ); } void PMainWindow::slotReturn() { raiseIconView(); } @@ -311,16 +333,21 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { ev->ignore(); return; } ev->accept(); QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); } void PMainWindow::raiseIconView() { + prevButton->hide(); + nextButton->hide(); + upButton->show(); + fsButton->show(); + viewModeButton->show(); m_stack->raiseWidget( IconView ); } void PMainWindow::setDocument( const QString& showImg ) { QString file = showImg; DocLnk lnk(showImg); if (lnk.isValid() ) file = lnk.file(); diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index adb5dc2..1967ef7 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -58,16 +58,16 @@ private: Opie::Core::OConfig *m_cfg; Opie::Ui::OWidgetStack *m_stack; PIconView* m_view; imageinfo *m_info; ImageView *m_disp; bool autoRotate; bool autoScale; bool zoomerOn; - QToolButton*rotateButton; - + QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; + QToolButton*nextButton,*prevButton; private slots: void slotConfig(); }; #endif |