summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -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);
}
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
@@ -3,51 +3,70 @@
#include <qvariant.h>
#include <qwidget.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QFrame;
class QLabel;
class QTextView;
+namespace Opie {
+ namespace Core {
+ class OConfig;
+ }
+ namespace Ui {
+ class OKeyConfigManager;
+ }
+}
+
class imageinfo : public QWidget
{
Q_OBJECT
+ enum ActionIds {
+ ViewItem
+ };
public:
imageinfo( QWidget* parent = 0, const char* name = 0, WFlags fl =0);
imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~imageinfo();
void setDestructiveClose();
+ Opie::Ui::OKeyConfigManager* manager();
+
+signals:
+ void dispImage(const QString&);
public slots:
void setPath( const QString& path );
+ void slotShowImage();
private:
void init(const char* name);
protected:
QLabel* PixmapLabel1;
QLabel* fnameLabel;
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&);
virtual void slotThumbNail(const QString&, const QPixmap&);
virtual void slotChangeName(const QString&);
};
/* for testing purpose */
class infoDlg:public QDialog
{
Q_OBJECT
public:
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
@@ -9,49 +9,47 @@
#include "imageinfoui.h"
#include "imagescrollview.h"
#include <iface/ifaceinfo.h>
#include <iface/dirview.h>
#include <opie2/odebug.h>
#include <opie2/owidgetstack.h>
#include <opie2/oapplicationfactory.h>
#include <opie2/otabwidget.h>
#include <opie2/okeyconfigwidget.h>
-
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/ir.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qmap.h>
#include <qtimer.h>
-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)
: QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
{
setCaption( QObject::tr("Opie Eye Caramba" ) );
m_cfg = new Opie::Core::OConfig("phunkview");
m_cfg->setGroup("Zecke_view" );
-
-
+// qDebug( "Process-wide OApplication object @ %0x", oApp );
/*
* Initialize ToolBar and IconView
* And Connect Them
*/
QToolBar *bar = new QToolBar( this );
bar->setHorizontalStretchable( true );
setToolBarsMovable( false );
m_stack = new Opie::Ui::OWidgetStack( this );
setCentralWidget( m_stack );
m_view = new PIconView( m_stack, m_cfg );
@@ -83,25 +81,25 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
m_view, SLOT(slotBeam()) );
}
btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "trash" ) );
connect( btn, SIGNAL(clicked() ),
m_view, SLOT(slotTrash() ) );
btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
connect( btn, SIGNAL(clicked() ),
this, SLOT(slotConfig() ) );
-
+
rotateButton = new QToolButton(bar);
rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
rotateButton->setToggleButton(true);
rotateButton->setOn(true);
connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
autoRotate = true;
btn = new QToolButton(bar);
btn->setIconSet( Resource::loadIconSet( "1to1" ) );
btn->setToggleButton(true);
btn->setOn(false);
connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
@@ -155,24 +153,28 @@ void PMainWindow::slotConfig() {
QWidget *_wid = inf->configWidget( *m_cfg );
_wid->reparent(wid, QPoint() );
lst.insert( view, _wid );
wid->addTab( _wid, "fileopen", inf->name() );
}
/*
* Add the KeyConfigWidget
*/
Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
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") );
bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
/*
* clean up
*apply changes
*/
QMap<PDirView*, QWidget*>::Iterator it;
@@ -201,45 +203,47 @@ void PMainWindow::initT( const char* name, T** ptr, int id) {
(*ptr)->setDestructiveClose();
m_stack->removeWidget( *ptr );
}
*ptr = new T( m_stack, name );
m_stack->addWidget( *ptr, id );
connect(*ptr, SIGNAL(sig_return()),
this,SLOT(slotReturn()));
}
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() {
initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay );
if (m_disp) {
m_disp->setAutoScale(autoScale);
m_disp->setAutoRotate(autoRotate);
}
}
/**
* With big Screen the plan could be to 'detach' the image
* window if visible and to create a ne wone
* init* already supports it but I make no use of it for
* now. We set filename and raise
*
* ### FIXME and talk to alwin
*/
void PMainWindow::slotShowInfo( const QString& inf ) {
- if ( !m_info )
+ if ( !m_info ) {
initInfo();
+ }
m_info->setPath( inf );
m_stack->raiseWidget( ImageInfo );
}
void PMainWindow::slotDisplay( const QString& inf ) {
if ( !m_disp ) {
initDisp();
}
m_disp->setImage( inf );
m_stack->raiseWidget( ImageDisplay );
}