-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 21a668a..3650493 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -1,71 +1,72 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #include "mainwindow.h" #include "iconview.h" #include "filesystem.h" #include "imageinfoui.h" #include "imageview.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 <qpe/applnk.h> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qlayout.h> #include <qdialog.h> #include <qmap.h> #include <qtimer.h> 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 ); 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&)) ); QToolButton *btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "up" ) ); connect( btn, SIGNAL(clicked()), m_view, SLOT(slotDirUp()) ); btn = new PFileSystem( bar ); connect( btn, SIGNAL( changeDir( const QString& ) ), m_view, SLOT(slotChangeDir( const QString& ) ) ); @@ -236,48 +237,57 @@ void PMainWindow::initDisp() { /** * 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 ); } + +void PMainWindow::setDocument( const QString& showImg ) { + QString file = showImg; + DocLnk lnk(showImg); + if (lnk.isValid() ) + file = lnk.file(); + + slotDisplay( file ); +} diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 5de2f42..042d568 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -1,67 +1,68 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #ifndef PHUNK_MAIN_WINDOW_H #define PHUNK_MAIN_WINDOW_H #include <opie2/oconfig.h> #include <qmainwindow.h> namespace Opie { namespace Ui{ class OKeyConfigManager; class OWidgetStack; } } class PIconView; class imageinfo; class ImageView; class PMainWindow : public QMainWindow { Q_OBJECT enum Views { IconView, ImageInfo, ImageDisplay }; public: static QString appName() { return QString::fromLatin1("opie-eye" ); } PMainWindow(QWidget*, const char*, WFlags ); ~PMainWindow(); signals: void configChanged(); public slots: void slotShowInfo( const QString& inf ); void slotDisplay( const QString& inf ); void slotReturn(); void slotRotateToggled(bool); void slotScaleToggled(bool); + void setDocument( const QString& ); 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; ImageView *m_disp; bool autoRotate; bool autoScale; QToolButton*rotateButton; private slots: void slotConfig(); }; #endif |