author | zecke <zecke> | 2005-06-14 21:29:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-06-14 21:29:17 (UTC) |
commit | 1c8aab0c489b9d469646a0e0ab08f500f1bbb507 (patch) (side-by-side diff) | |
tree | 899752b16b9c00029ffd76696e6d87096a1e6d2e | |
parent | dc9c09480660793768851e36d089e0c36e7f3eae (diff) | |
download | opie-1c8aab0c489b9d469646a0e0ab08f500f1bbb507.zip opie-1c8aab0c489b9d469646a0e0ab08f500f1bbb507.tar.gz opie-1c8aab0c489b9d469646a0e0ab08f500f1bbb507.tar.bz2 |
Opie Eye:
-Change the keyboard shortcut configuration to not blacklist
keys found on the joypad (up,down,left,right,enter).
This was done on request of Gints Polis
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 6 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 4 |
3 files changed, 0 insertions, 15 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 9365932..ca5746d 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -168,197 +168,192 @@ namespace { g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); currentView()->dirLister()->imageInfo( m_path ); } m_pix = PPixmapCache::self()->cachedImage( m_path, m_iconsize, m_iconsize ); if (!m_pix && !g_stringPix.contains( m_path )) { check_pix(); g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); currentView()->dirLister()->thumbNail( m_path, m_iconsize, m_iconsize); } return m_pix ? m_pix : _cpyPix; } } inline void IconViewItem::setText( const QString& str ) { QString text = QIconViewItem::text()+"\n"+str; m_noInfo = true; QIconViewItem::setText( text ); } } /* * Set up the GUI.. initialize the slave set up gui * and also load a dir */ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); } m_path = QDir::homeDirPath(); m_mode = 0; m_iconsize = 32; m_internalReset = false; m_customWidget = 0; m_setDocCalled = false; m_hbox = new QHBox( this ); QLabel* lbl = new QLabel( m_hbox ); lbl->setText( tr("View as" ) ); m_views = new QComboBox( m_hbox, "View As" ); m_view= new QIconView( this ); connect(m_view, SIGNAL(clicked(QIconViewItem*) ), this, SLOT(slotClicked(QIconViewItem*)) ); connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), this, SLOT(slotClicked(QIconViewItem*)) ); m_view->setArrangement( QIconView::LeftToRight ); m_mode = m_cfg->readNumEntry("ListViewMode", 1); if (m_mode < 1 || m_mode>3) m_mode = 1; m_view->setItemTextPos( QIconView::Right ); if (m_mode >1) { m_view->setResizeMode(QIconView::Adjust); } else { m_view->setResizeMode(QIconView::Fixed); } m_iconsize = m_cfg->readNumEntry("iconsize", 32); if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE; if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE; calculateGrid(); initKeys(); loadViews(); } void PIconView::setDoccalled(bool how) { m_setDocCalled = how; } /* * Unref the slave and save the keyboard manager */ PIconView::~PIconView() { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); } m_viewManager->save(); delete m_viewManager; } Opie::Core::OKeyConfigManager* PIconView::manager() { return m_viewManager; } /* * init the KeyBoard Shortcuts * called from the c'tor */ void PIconView::initKeys() { 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::returnKey() ); m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", lst, false,this, "keyconfig name" ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", Opie::Core::OResource::loadPixmap("beam", Opie::Core::OResource::SmallIcon), BeamItem, Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), this, SLOT(slotBeam())) ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon), DeleteItem, Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), this, SLOT(slotTrash())) ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), this, SLOT(slotShowImage()))); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", Opie::Core::OResource::loadPixmap("DocumentTypeWord", Opie::Core::OResource::SmallIcon), InfoItem, Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), this, SLOT(slotImageInfo()) ) ); m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow", Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), SlideItem, Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton), this, SLOT(slotStartSlide()))); m_viewManager->load(); m_viewManager->handleWidget( m_view ); } /* * change one dir up */ void PIconView::slotDirUp() { slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); } /* * change the dir */ void PIconView::slotChangeDir(const QString& path) { if ( !currentView() ) return; PDirLister *lister = currentView()->dirLister(); if (!lister ) return; /* * Say what we want and take what we get */ lister->setStartPath( path ); m_path = lister->currentPath(); m_view->viewport()->setUpdatesEnabled( false ); m_view->clear(); // Also invalidate the cache. We can't cancel the operations anyway g_stringPix.clear(); g_stringInf.clear(); /* * add files and folders */ addFolders( lister->folders() ); addFiles( lister->files() ); m_view->viewport()->setUpdatesEnabled( true ); // looks ugly static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); } /** * get the current file name * @param isDir see if this is a dir or real file */ QString PIconView::currentFileName(bool &isDir)const { isDir = false; QIconViewItem* _it = m_view->currentItem(); if ( !_it ) return QString::null; IconViewItem* it = static_cast<IconViewItem*>( _it ); isDir = it->isDir(); return it->path(); } QString PIconView::nextFileName(bool &isDir)const { isDir = false; 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 ); diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index 8f70602..8e31521 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp @@ -1,167 +1,161 @@ #include "imageinfoui.h" #include <qframe.h> #include <qlabel.h> #include <qpushbutton.h> #include <qtextview.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h> #include <qstring.h> #include <qfileinfo.h> #include "lib/slavemaster.h" #include "lib/imagecache.h" #include <opie2/oconfig.h> #include <opie2/okeyconfigwidget.h> #include <opie2/odebug.h> #include <opie2/oresource.h> #include <qpe/qcopenvelope_qws.h> static const int THUMBSIZE = 128; using namespace Opie::Core; imageinfo::imageinfo(Opie::Core::OConfig *cfg,QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { m_viewManager = 0; m_cfg = cfg; init(name); initKeys(); } imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ),currentFile(_path) { m_viewManager = 0; m_cfg = 0; init(name); initKeys(); slotChangeName(_path); } Opie::Core::OKeyConfigManager* imageinfo::manager() { if (!m_viewManager) { initKeys(); } return m_viewManager; } void imageinfo::initKeys() { #if 0 if (!m_cfg) { m_cfg = new Opie::Core::OConfig("phunkview"); m_cfg->setGroup("imageinfo_keys" ); } #endif 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::returnKey() ); - m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "imageinfo_keys", lst, false,this, "keyconfig name" ); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Full Image"), "infoview", Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), this, SLOT(slotShowImage()))); m_viewManager->load(); m_viewManager->handleWidget( this ); m_viewManager->handleWidget( TextView1 ); } void imageinfo::slotShowImage() { emit dispImage(currentFile); } void imageinfo::init(const char* name) { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); } if ( !name ) setName( "imageinfo" ); resize( 289, 335 ); setCaption( tr( "Image info" ) ); imageinfoLayout = new QVBoxLayout( this ); imageinfoLayout->setSpacing(2); imageinfoLayout->setMargin(4); PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); imageinfoLayout->addWidget( PixmapLabel1 ); Line1 = new QFrame( this, "Line1" ); Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); imageinfoLayout->addWidget( Line1 ); fnameLabel = new QLabel( this, "FnameLabel" ); imageinfoLayout->addWidget( fnameLabel); TextView1 = new QTextView( this, "TextView1" ); TextView1->setFrameShadow( QTextView::Sunken ); TextView1->setResizePolicy( QTextView::AutoOneFit ); TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); // TextView1->setVScrollBarMode(QScrollView::AlwaysOn); QWhatsThis::add( TextView1, tr("Displays info of selected image") ); imageinfoLayout->addWidget( TextView1 ); SlaveMaster* master = SlaveMaster::self(); connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), this, SLOT(slot_fullInfo(const QString&, const QString&)) ); connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), this, SLOT(slotThumbNail(const QString&, const QPixmap&))); } void imageinfo::slotChangeName(const QString&_path) { currentFile=_path; QFileInfo fi(_path); fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>"); SlaveMaster::self()->imageInfo( currentFile ); QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); if (!m_pix) { PixmapLabel1->setPixmap(QPixmap( Opie::Core::OResource::loadPixmap( "UnknownDocument", Opie::Core::OResource::SmallIcon ))); SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); } else { PixmapLabel1->setPixmap(*m_pix); } } imageinfo::~imageinfo() { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); } if (m_viewManager) { delete m_viewManager; } } void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) { if (_path == currentFile) { odebug << _t << oendl; QString t = _t; t.replace(QRegExp("\n"),"<br>"); TextView1->setText(t); } } void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) { if (_path == currentFile) { diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index cda1a96..ec891a8 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -52,196 +52,192 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name void ImageView::slotIncBrightness() { int lb = Intensity()+5; if (lb>100) lb=100; setIntensity(lb,true); } void ImageView::slotDecBrightness() { int lb = Intensity()-5; if (lb<-100) lb=-100; setIntensity(lb,true); } void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) { int _newrotation; QDataStream stream( data, IO_ReadOnly ); if ( msg == "setCurrentRotation(int)" ) { stream >> _newrotation; if (!fullScreen()) { m_rotation = _newrotation; return; } } } void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup) { m_gDisplayType = disptypeGroup; m_gPrevNext = nextprevGroup; m_hGroup = hGroup; m_gBright = brightGroup; } ImageView::~ImageView() { odebug << "Destructor imageview" << oendl; delete m_viewManager; } Opie::Core::OKeyConfigManager* ImageView::manager() { if (!m_viewManager) { initKeys(); } return m_viewManager; } void ImageView::startSlide(int value) { if (!m_slideTimer) { m_slideTimer = new QTimer(this); } m_slideValue=value; connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); /* this "+1" is one millisecond. with that we can setup a slideshowvalue of 0. eg "as fast as possible". */ m_slideTimer->start(m_slideValue*1000+1,true); } void ImageView::stopSlide() { if (!m_slideTimer) { return; } m_slideTimer->stop(); delete m_slideTimer; m_slideTimer = 0; } void ImageView::nextSlide() { if (!m_slideTimer) { return; } #if 0 if (isHidden()) { delete m_slideTimer; m_slideTimer = 0; return; } #endif emit dispNext(); m_slideTimer->start(m_slideValue*1000,true); } void ImageView::initKeys() { odebug << "init imageview keys" << oendl; if (!m_cfg) { m_cfg = new Opie::Core::OConfig("opie-eye"); 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_Escape,0)); m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", lst, false,this, "image_view_keys" ); /** * Handle KeyEvents when they're pressed. This avoids problems * with 'double next' on Return. * The Return press would switch to this view and the return * release would emit the dispNext Signal. */ m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), ViewInfo, Opie::Core::OKeyPair(Qt::Key_I,0), this, SLOT(slotShowImageInfo()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", Opie::Core::OResource::loadPixmap("rotate", Opie::Core::OResource::SmallIcon), Autorotate, Opie::Core::OKeyPair(Qt::Key_R,0), this, SIGNAL(toggleAutorotate()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), Autoscale, Opie::Core::OKeyPair(Qt::Key_S,0), this, SIGNAL(toggleAutoscale()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon), ShowNext, Opie::Core::OKeyPair(Qt::Key_Return,0), this, SIGNAL(dispNext()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon), ShowPrevious, Opie::Core::OKeyPair(Qt::Key_P,0), this, SIGNAL(dispPrev()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", Opie::Core::OResource::loadPixmap("fullscreen", Opie::Core::OResource::SmallIcon), FullScreen, Opie::Core::OKeyPair(Qt::Key_F,0), this, SIGNAL(toggleFullScreen()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", Opie::Core::OResource::loadPixmap("mag", Opie::Core::OResource::SmallIcon), Zoomer, Opie::Core::OKeyPair(Qt::Key_T,0), this, SIGNAL(toggleZoomer()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Increase brightness"), "incbrightness", Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon), Incbrightness, Opie::Core::OKeyPair(Qt::Key_B,0), this, SIGNAL(incBrightness()))); m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Decrease brightness"), "decbrightness", Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon), Decbrightness, Opie::Core::OKeyPair(Qt::Key_D,0), this, SIGNAL(decBrightness()))); m_viewManager->handleWidget( this ); m_viewManager->load(); } void ImageView::keyReleaseEvent(QKeyEvent * e) { if (!e || e->state()!=0) { return; } if (e->key()==Qt::Key_Escape) { if (fullScreen()) { emit hideMe(); } if (closeIfHide) { QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); } } } void ImageView::setCloseIfHide(bool how) { closeIfHide = how; } void ImageView::slotShowImageInfo() { emit dispImageInfo(m_lastName); } void ImageView::contentsMousePressEvent ( QMouseEvent * e) { if (e->button()==1) { return OImageScrollView::contentsMousePressEvent(e); } QPopupMenu *m = new QPopupMenu(this); if (!m) return; if (m_hGroup) { m_hGroup->addTo(m); } if (fullScreen()) { if (m_gPrevNext) { m->insertSeparator(); m_gPrevNext->addTo(m); } |