summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-06 15:36:15 (UTC)
committer alwin <alwin>2004-04-06 15:36:15 (UTC)
commita0f97fe74df5e6ec3ceea771380a3c61acb2f96c (patch) (side-by-side diff)
tree1d0819d5ffdf9f212829c35db579695bfe0b4b11
parent9273c064f2ae699885ddef32155df4f5aab9d574 (diff)
downloadopie-a0f97fe74df5e6ec3ceea771380a3c61acb2f96c.zip
opie-a0f97fe74df5e6ec3ceea771380a3c61acb2f96c.tar.gz
opie-a0f97fe74df5e6ec3ceea771380a3c61acb2f96c.tar.bz2
added keyboard handler for info window
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.cpp57
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.h23
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp16
3 files changed, 85 insertions, 11 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
@@ -14,6 +14,11 @@
#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>
@@ -22,9 +27,12 @@
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();
}
@@ -32,7 +40,46 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF
: 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) {
{
@@ -40,5 +87,5 @@ void imageinfo::init(const char* name) {
}
if ( !name )
- setName( "imageinfo" );
+ setName( "imageinfo" );
resize( 289, 335 );
setCaption( tr( "Image info" ) );
@@ -97,4 +144,8 @@ imageinfo::~imageinfo()
QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
}
+ if (m_viewManager) {
+ m_viewManager->save();
+ delete m_viewManager;
+ }
}
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.h b/noncore/graphics/opie-eye/gui/imageinfoui.h
index 300c92a..0a5e183 100644
--- a/noncore/graphics/opie-eye/gui/imageinfoui.h
+++ b/noncore/graphics/opie-eye/gui/imageinfoui.h
@@ -13,7 +13,19 @@ class QLabel;
class QTextView;
+namespace Opie {
+ namespace Core {
+ class OConfig;
+ }
+ namespace Ui {
+ class OKeyConfigManager;
+ }
+}
+
class imageinfo : public QWidget
{
Q_OBJECT
+ enum ActionIds {
+ ViewItem
+ };
public:
@@ -23,7 +35,12 @@ public:
void setDestructiveClose();
+ Opie::Ui::OKeyConfigManager* manager();
+
+signals:
+ void dispImage(const QString&);
public slots:
void setPath( const QString& path );
+ void slotShowImage();
private:
@@ -35,9 +52,11 @@ protected:
QFrame* Line1;
QTextView* TextView1;
-
-protected:
QVBoxLayout* imageinfoLayout;
QString currentFile;
+ Opie::Core::OConfig * m_cfg;
+ Opie::Ui::OKeyConfigManager*m_viewManager;
+ void initKeys();
+
protected slots:
virtual void slot_fullInfo(const QString&, const QString&);
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 88acd59..5e94f93 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -19,5 +19,4 @@
#include <opie2/okeyconfigwidget.h>
-
#include <qpe/resource.h>
#include <qpe/config.h>
@@ -34,5 +33,5 @@
-OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> )
+OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
@@ -42,6 +41,5 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
m_cfg = new Opie::Core::OConfig("phunkview");
m_cfg->setGroup("Zecke_view" );
-
-
+// qDebug( "Process-wide OApplication object @ %0x", oApp );
/*
* Initialize ToolBar and IconView
@@ -93,5 +91,5 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
connect( btn, SIGNAL(clicked() ),
this, SLOT(slotConfig() ) );
-
+
rotateButton = new QToolButton(bar);
rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
@@ -165,4 +163,8 @@ void PMainWindow::slotConfig() {
keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
+ if ( !m_info ) {
+ initInfo();
+ }
+ keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
keyWid->load();
wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
@@ -211,4 +213,5 @@ void PMainWindow::initT( const char* name, T** ptr, int id) {
void PMainWindow::initInfo() {
initT<imageinfo>( "Image Info", &m_info, ImageInfo );
+ connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
}
void PMainWindow::initDisp() {
@@ -230,6 +233,7 @@ void PMainWindow::initDisp() {
*/
void PMainWindow::slotShowInfo( const QString& inf ) {
- if ( !m_info )
+ if ( !m_info ) {
initInfo();
+ }
m_info->setPath( inf );
m_stack->raiseWidget( ImageInfo );