summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp61
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h4
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.cpp29
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.h20
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.cpp20
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.h6
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp109
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h24
8 files changed, 237 insertions, 36 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index de2cdf0..4ced52d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -37,5 +37,8 @@ using Opie::Ui::OKeyConfigItem;
+/*
+ * The Icons, Request Cache and IconViewItem for the IconView
+ */
namespace {
- QPixmap* _dirPix = 0;
- QPixmap* _unkPix = 0;
+ static QPixmap* _dirPix = 0;
+ static QPixmap* _unkPix = 0;
class IconViewItem : public QIconViewItem {
@@ -61,4 +64,4 @@ namespace {
*/
- QMap<QString, IconViewItem*> g_stringInf;
- QMap<QString, IconViewItem*> g_stringPix;
+ static QMap<QString, IconViewItem*> g_stringInf;
+ static QMap<QString, IconViewItem*> g_stringPix;
@@ -103,2 +106,6 @@ namespace {
+/*
+ * Set up the GUI.. initialize the slave set up gui
+ * and also load a dir
+ */
PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
@@ -138,2 +145,5 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
+/*
+ * Unref the slave and save the keyboard manager
+ */
PIconView::~PIconView() {
@@ -150,2 +160,7 @@ Opie::Ui::OKeyConfigManager* PIconView::manager() {
+
+/*
+ * init the KeyBoard Shortcuts
+ * called from the c'tor
+ */
void PIconView::initKeys() {
@@ -180,2 +195,6 @@ void PIconView::initKeys() {
+
+/*
+ * change one dir up
+ */
void PIconView::slotDirUp() {
@@ -187,2 +206,5 @@ void PIconView::slotDirUp() {
+/*
+ * change the dir
+ */
void PIconView::slotChangeDir(const QString& path) {
@@ -286,5 +308,5 @@ void PIconView::addFolders( const QStringList& lst) {
- for(it=lst.begin(); it != lst.end(); ++it ) {
+ for(it=lst.begin(); it != lst.end(); ++it )
(void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
- }
+
@@ -307,3 +329,3 @@ void PIconView::slotClicked(QIconViewItem* _it) {
else // view image
- ;
+ slotShowImage();
}
@@ -362,3 +384,2 @@ void PIconView::slotStart() {
m_view->viewport()->setUpdatesEnabled( false );
- qWarning( "Sig Start" );
}
@@ -366,3 +387,2 @@ void PIconView::slotStart() {
void PIconView::slotEnd() {
- qWarning( "SLot End" );
if ( m_updatet )
@@ -373,4 +393,5 @@ void PIconView::slotEnd() {
-void PIconView::slotShowImage() {
- qDebug("image show");
+void PIconView::slotShowImage()
+{
+ qWarning( "SLotShowImage" );
bool isDir = false;
@@ -378,10 +399,10 @@ void PIconView::slotShowImage() {
if (isDir) return;
- ImageDlg dlg(name);
- QPEApplication::execDialog(&dlg);
-}
-void PIconView::slotShowImage( const QString& ) {
+ slotShowImage( name );
+}
+void PIconView::slotShowImage( const QString& name) {
+ emit sig_display( name );
}
void PIconView::slotImageInfo() {
- qDebug("image info");
+ qWarning( "SlotImageInfo" );
bool isDir = false;
@@ -389,8 +410,8 @@ void PIconView::slotImageInfo() {
if (isDir) return;
- infoDlg dlg(name);
- QPEApplication::execDialog(&dlg);
+
+ slotImageInfo( name );
}
-void PIconView::slotImageInfo( const QString& ) {
-
+void PIconView::slotImageInfo( const QString& name) {
+ emit sig_showInfo( name );
}
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index 7ddb023..a4ca0bc 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -39,2 +39,6 @@ public:
+signals:
+ void sig_showInfo( const QString& );
+ void sig_display( const QString& );
+
private:
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
index 3463ba6..74a9ea4 100644
--- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp
+++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
@@ -21,3 +21,10 @@
-#define THUMBSIZE 128
+static const int THUMBSIZE = 128;
+
+
+imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ init(name);
+}
@@ -26,2 +33,6 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF
{
+ init(name);
+ slotChangeName(_path);
+}
+void imageinfo::init(const char* name) {
{
@@ -64,3 +75,2 @@ imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WF
this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
- slotChangeName(_path);
}
@@ -113,2 +123,15 @@ void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix)
+void imageinfo::setPath( const QString& str ) {
+ slotChangeName( str );
+}
+
+void imageinfo::setDestructiveClose() {
+ WFlags fl = getWFlags();
+ /* clear it just in case */
+ fl &= ~WDestructiveClose;
+ fl |= WDestructiveClose;
+ setWFlags( fl );
+}
+
+
/* for testing */
@@ -127 +150,3 @@ infoDlg::~infoDlg()
}
+
+
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.h b/noncore/graphics/opie-eye/gui/imageinfoui.h
index 34ec937..300c92a 100644
--- a/noncore/graphics/opie-eye/gui/imageinfoui.h
+++ b/noncore/graphics/opie-eye/gui/imageinfoui.h
@@ -7,5 +7,5 @@
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
class QFrame;
@@ -15,3 +15,3 @@ class QTextView;
class imageinfo : public QWidget
-{
+{
Q_OBJECT
@@ -19,2 +19,3 @@ class imageinfo : public QWidget
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 );
@@ -22,2 +23,11 @@ public:
+ void setDestructiveClose();
+
+public slots:
+ void setPath( const QString& path );
+
+private:
+ void init(const char* name);
+
+protected:
QLabel* PixmapLabel1;
@@ -34,3 +44,3 @@ protected slots:
virtual void slotThumbNail(const QString&, const QPixmap&);
-
+
virtual void slotChangeName(const QString&);
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.cpp b/noncore/graphics/opie-eye/gui/imagescrollview.cpp
index 0d35354..7d83e29 100644
--- a/noncore/graphics/opie-eye/gui/imagescrollview.cpp
+++ b/noncore/graphics/opie-eye/gui/imagescrollview.cpp
@@ -9,2 +9,9 @@ using namespace Opie::Core;
+ImageScrollView::ImageScrollView( QWidget* parent, const char* name, WFlags f )
+ :QScrollView(parent,name,f|Qt::WRepaintNoErase ),_image_data(),_original_data(),scale_to_fit(true),
+ rotate_to_fit(true),first_resize_done(false)
+{
+ init();
+}
+
ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit)
@@ -31,2 +38,6 @@ void ImageScrollView::setImage(const QImage&img)
+void ImageScrollView::setImage( const QString& path ) {
+
+}
+
/* should be called every time the QImage changed it content */
@@ -261,2 +272,11 @@ void ImageScrollView::contentsMousePressEvent ( QMouseEvent * e)
+void ImageScrollView::setDestructiveClose() {
+ WFlags fl = getWFlags();
+ /* clear it just in case */
+ fl &= ~WDestructiveClose;
+ fl |= WDestructiveClose;
+ setWFlags( fl );
+}
+
+
/* for testing */
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.h b/noncore/graphics/opie-eye/gui/imagescrollview.h
index e25f955..864a015 100644
--- a/noncore/graphics/opie-eye/gui/imagescrollview.h
+++ b/noncore/graphics/opie-eye/gui/imagescrollview.h
@@ -14,2 +14,3 @@ class ImageScrollView:public QScrollView
public:
+ ImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 );
ImageScrollView (const QImage&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false );
@@ -19,2 +20,4 @@ public:
void setImage(const QImage&);
+ void setImage( const QString& path );
+ void setDestructiveClose();
@@ -27,2 +30,5 @@ public:
+signals:
+ void sig_return();
+
protected:
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 83ff4f1..7f384bd 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -8,2 +8,4 @@
#include "filesystem.h"
+#include "imageinfoui.h"
+#include "imagescrollview.h"
@@ -12,2 +14,4 @@
+#include <opie2/odebug.h>
+#include <opie2/owidgetstack.h>
#include <opie2/oapplicationfactory.h>
@@ -26,3 +30,3 @@
#include <qmap.h>
-
+#include <qtimer.h>
@@ -34,3 +38,3 @@ OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> )
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
- : QMainWindow( wid, name, style )
+ : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
{
@@ -49,4 +53,12 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
- m_view = new PIconView( this, m_cfg );
- setCentralWidget( m_view );
+ m_stack = new Opie::Ui::OWidgetStack( this );
+ setCentralWidget( m_stack );
+
+ m_view = new PIconView( m_stack, m_cfg );
+ m_stack->addWidget( m_view, IconView );
+ 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&)) );
@@ -86,2 +98,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
PMainWindow::~PMainWindow() {
+ odebug << "Shutting down" << oendl;
}
@@ -90,7 +103,7 @@ PMainWindow::~PMainWindow() {
void PMainWindow::slotConfig() {
-/*
- * have a tab with the possible views
- * a tab for globals image cache size.. scaled loading
- * and one tab for the KeyConfigs
- */
+ /*
+ * have a tab with the possible views
+ * a tab for globals image cache size.. scaled loading
+ * and one tab for the KeyConfigs
+ */
QDialog dlg(this, 0, true);
@@ -126,2 +139,7 @@ void PMainWindow::slotConfig() {
+/*
+ * clean up
+ *apply changes
+ */
+
QMap<PDirView*, QWidget*>::Iterator it;
@@ -133,2 +151,3 @@ void PMainWindow::slotConfig() {
+
if ( act ) {
@@ -138 +157,73 @@ void PMainWindow::slotConfig() {
}
+
+/*
+ * create a new image info component
+ * and detach the current one
+ * we will make the other delete on exit
+ */
+template<class T>
+void PMainWindow::initT( const char* name, T** ptr, int id) {
+ if ( *ptr ) {
+ (*ptr)->disconnect(this, SLOT(slotReturn()));
+ (*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 );
+}
+void PMainWindow::initDisp() {
+ initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay );
+}
+
+/**
+ * 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 )
+ 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 );
+}
+
+void PMainWindow::slotReturn() {
+ raiseIconView();
+}
+
+
+void PMainWindow::closeEvent( QCloseEvent* ev ) {
+ /*
+ * return from view
+ * or properly quit
+ */
+ if ( m_stack->visibleWidget() == m_info ||
+ m_stack->visibleWidget() == m_disp ) {
+ raiseIconView();
+ ev->ignore();
+ return;
+ }
+ ev->accept();
+ QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
+}
+
+void PMainWindow::raiseIconView() {
+ m_stack->raiseWidget( IconView );
+}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 317a51e..35116ae 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -17,2 +17,3 @@ namespace Ui{
class OKeyConfigManager;
+ class OWidgetStack;
}
@@ -21,4 +22,7 @@ namespace Ui{
class PIconView;
+class imageinfo;
+class ImageScrollView;
class PMainWindow : public QMainWindow {
Q_OBJECT
+ enum Views { IconView, ImageInfo, ImageDisplay };
public:
@@ -28,5 +32,25 @@ public:
+signals:
+ void configChanged();
+
+public slots:
+ void slotShowInfo( const QString& inf );
+ void slotDisplay( const QString& inf );
+ void slotReturn();
+
+protected:
+ void raiseIconView();
+ void closeEvent( QCloseEvent* );
+
+private:
+ template<class T> void initT( const char* name, T**, int );
+ void initInfo();
+ void initDisp();
+
private:
Opie::Core::OConfig *m_cfg;
+ Opie::Ui::OWidgetStack *m_stack;
PIconView* m_view;
+ imageinfo *m_info;
+ ImageScrollView *m_disp;