author | alwin <alwin> | 2004-04-06 15:36:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-06 15:36:15 (UTC) |
commit | a0f97fe74df5e6ec3ceea771380a3c61acb2f96c (patch) (side-by-side diff) | |
tree | 1d0819d5ffdf9f212829c35db579695bfe0b4b11 /noncore/graphics/opie-eye/gui/imageinfoui.cpp | |
parent | 9273c064f2ae699885ddef32155df4f5aab9d574 (diff) | |
download | opie-a0f97fe74df5e6ec3ceea771380a3c61acb2f96c.zip opie-a0f97fe74df5e6ec3ceea771380a3c61acb2f96c.tar.gz opie-a0f97fe74df5e6ec3ceea771380a3c61acb2f96c.tar.bz2 |
added keyboard handler for info window
Diffstat (limited to 'noncore/graphics/opie-eye/gui/imageinfoui.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index 74a9ea4..039dfa3 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp @@ -4,51 +4,98 @@ #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 "lib/slavemaster.h" +#include "lib/imagecache.h" + +#include <opie2/oconfig.h> +#include <opie2/oconfig.h> +#include <opie2/okeyconfigwidget.h> +#include <opie2/odebug.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> static const int THUMBSIZE = 128; +using namespace Opie::Core; imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { + m_viewManager = 0; init(name); + initKeys(); } imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ),currentFile(_path) { + m_viewManager = 0; init(name); + initKeys(); slotChangeName(_path); } + +Opie::Ui::OKeyConfigManager* imageinfo::manager() +{ + if (!m_viewManager) { + initKeys(); + } + return m_viewManager; +} + +void imageinfo::initKeys() +{ + odebug << "init imageinfo keys" << oendl; + m_cfg = new Opie::Core::OConfig("phunkview"); + m_cfg->setGroup("Zecke_view" ); + Opie::Ui::OKeyPair::List lst; + lst.append( Opie::Ui::OKeyPair::upArrowKey() ); + lst.append( Opie::Ui::OKeyPair::downArrowKey() ); + lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); + lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); +// lst.append( Opie::Ui::OKeyPair::returnKey() ); + + m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageinfo-KeyBoard-Config", + lst, false,this, "keyconfig name" ); + m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "view", + Resource::loadPixmap("1to1"), ViewItem, + Opie::Ui::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" ); + 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 ); @@ -87,24 +134,28 @@ void imageinfo::slotChangeName(const QString&_path) PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); } else { PixmapLabel1->setPixmap(*m_pix); } } imageinfo::~imageinfo() { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); } + if (m_viewManager) { + m_viewManager->save(); + delete m_viewManager; + } } void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) { if (_path == currentFile) { qDebug(_t); QString t = _t; t.replace(QRegExp("\n"),"<br>"); /* t.replace(QRegeExp("<qt>",""); t.replace(QRegeExp("</qt>","");*/ TextView1->setText(t); } |