-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 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | 6 | ||
7 | #include "iconview.h" | 7 | #include "iconview.h" |
8 | #include "filesystem.h" | 8 | #include "filesystem.h" |
9 | #include "imageinfoui.h" | 9 | #include "imageinfoui.h" |
10 | #include "imageview.h" | 10 | #include "imageview.h" |
11 | 11 | ||
12 | #include <iface/ifaceinfo.h> | 12 | #include <iface/ifaceinfo.h> |
13 | #include <iface/dirview.h> | 13 | #include <iface/dirview.h> |
14 | 14 | ||
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <opie2/owidgetstack.h> | 16 | #include <opie2/owidgetstack.h> |
17 | #include <opie2/oapplicationfactory.h> | 17 | #include <opie2/oapplicationfactory.h> |
18 | #include <opie2/otabwidget.h> | 18 | #include <opie2/otabwidget.h> |
19 | #include <opie2/okeyconfigwidget.h> | 19 | #include <opie2/okeyconfigwidget.h> |
20 | 20 | ||
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | #include <qpe/ir.h> | 23 | #include <qpe/ir.h> |
24 | #include <qpe/applnk.h> | ||
24 | 25 | ||
25 | #include <qtoolbar.h> | 26 | #include <qtoolbar.h> |
26 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
27 | #include <qlayout.h> | 28 | #include <qlayout.h> |
28 | #include <qdialog.h> | 29 | #include <qdialog.h> |
29 | #include <qmap.h> | 30 | #include <qmap.h> |
30 | #include <qtimer.h> | 31 | #include <qtimer.h> |
31 | 32 | ||
32 | 33 | ||
33 | 34 | ||
34 | 35 | ||
35 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 36 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
36 | 37 | ||
37 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 38 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
38 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 39 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
39 | { | 40 | { |
40 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 41 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
41 | m_cfg = new Opie::Core::OConfig("phunkview"); | 42 | m_cfg = new Opie::Core::OConfig("phunkview"); |
42 | m_cfg->setGroup("Zecke_view" ); | 43 | m_cfg->setGroup("Zecke_view" ); |
43 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); | 44 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); |
44 | /* | 45 | /* |
45 | * Initialize ToolBar and IconView | 46 | * Initialize ToolBar and IconView |
46 | * And Connect Them | 47 | * And Connect Them |
47 | */ | 48 | */ |
48 | QToolBar *bar = new QToolBar( this ); | 49 | QToolBar *bar = new QToolBar( this ); |
49 | bar->setHorizontalStretchable( true ); | 50 | bar->setHorizontalStretchable( true ); |
50 | setToolBarsMovable( false ); | 51 | setToolBarsMovable( false ); |
51 | 52 | ||
52 | m_stack = new Opie::Ui::OWidgetStack( this ); | 53 | m_stack = new Opie::Ui::OWidgetStack( this ); |
53 | setCentralWidget( m_stack ); | 54 | setCentralWidget( m_stack ); |
54 | 55 | ||
55 | m_view = new PIconView( m_stack, m_cfg ); | 56 | m_view = new PIconView( m_stack, m_cfg ); |
56 | m_stack->addWidget( m_view, IconView ); | 57 | m_stack->addWidget( m_view, IconView ); |
57 | m_stack->raiseWidget( IconView ); | 58 | m_stack->raiseWidget( IconView ); |
58 | connect(m_view, SIGNAL(sig_display(const QString&)), | 59 | connect(m_view, SIGNAL(sig_display(const QString&)), |
59 | this, SLOT(slotDisplay(const QString&))); | 60 | this, SLOT(slotDisplay(const QString&))); |
60 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), | 61 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), |
61 | this, SLOT(slotShowInfo(const QString&)) ); | 62 | this, SLOT(slotShowInfo(const QString&)) ); |
62 | 63 | ||
63 | QToolButton *btn = new QToolButton( bar ); | 64 | QToolButton *btn = new QToolButton( bar ); |
64 | btn->setIconSet( Resource::loadIconSet( "up" ) ); | 65 | btn->setIconSet( Resource::loadIconSet( "up" ) ); |
65 | connect( btn, SIGNAL(clicked()), | 66 | connect( btn, SIGNAL(clicked()), |
66 | m_view, SLOT(slotDirUp()) ); | 67 | m_view, SLOT(slotDirUp()) ); |
67 | 68 | ||
68 | btn = new PFileSystem( bar ); | 69 | btn = new PFileSystem( bar ); |
69 | connect( btn, SIGNAL( changeDir( const QString& ) ), | 70 | connect( btn, SIGNAL( changeDir( const QString& ) ), |
70 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 71 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
71 | 72 | ||
@@ -236,48 +237,57 @@ void PMainWindow::initDisp() { | |||
236 | 237 | ||
237 | /** | 238 | /** |
238 | * With big Screen the plan could be to 'detach' the image | 239 | * With big Screen the plan could be to 'detach' the image |
239 | * window if visible and to create a ne wone | 240 | * window if visible and to create a ne wone |
240 | * init* already supports it but I make no use of it for | 241 | * init* already supports it but I make no use of it for |
241 | * now. We set filename and raise | 242 | * now. We set filename and raise |
242 | * | 243 | * |
243 | * ### FIXME and talk to alwin | 244 | * ### FIXME and talk to alwin |
244 | */ | 245 | */ |
245 | void PMainWindow::slotShowInfo( const QString& inf ) { | 246 | void PMainWindow::slotShowInfo( const QString& inf ) { |
246 | if ( !m_info ) { | 247 | if ( !m_info ) { |
247 | initInfo(); | 248 | initInfo(); |
248 | } | 249 | } |
249 | m_info->setPath( inf ); | 250 | m_info->setPath( inf ); |
250 | m_stack->raiseWidget( ImageInfo ); | 251 | m_stack->raiseWidget( ImageInfo ); |
251 | } | 252 | } |
252 | 253 | ||
253 | void PMainWindow::slotDisplay( const QString& inf ) { | 254 | void PMainWindow::slotDisplay( const QString& inf ) { |
254 | if ( !m_disp ) { | 255 | if ( !m_disp ) { |
255 | initDisp(); | 256 | initDisp(); |
256 | } | 257 | } |
257 | m_disp->setImage( inf ); | 258 | m_disp->setImage( inf ); |
258 | m_stack->raiseWidget( ImageDisplay ); | 259 | m_stack->raiseWidget( ImageDisplay ); |
259 | } | 260 | } |
260 | 261 | ||
261 | void PMainWindow::slotReturn() { | 262 | void PMainWindow::slotReturn() { |
262 | raiseIconView(); | 263 | raiseIconView(); |
263 | } | 264 | } |
264 | 265 | ||
265 | 266 | ||
266 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 267 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
267 | /* | 268 | /* |
268 | * return from view | 269 | * return from view |
269 | * or properly quit | 270 | * or properly quit |
270 | */ | 271 | */ |
271 | if ( m_stack->visibleWidget() == m_info || | 272 | if ( m_stack->visibleWidget() == m_info || |
272 | m_stack->visibleWidget() == m_disp ) { | 273 | m_stack->visibleWidget() == m_disp ) { |
273 | raiseIconView(); | 274 | raiseIconView(); |
274 | ev->ignore(); | 275 | ev->ignore(); |
275 | return; | 276 | return; |
276 | } | 277 | } |
277 | ev->accept(); | 278 | ev->accept(); |
278 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 279 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
279 | } | 280 | } |
280 | 281 | ||
281 | void PMainWindow::raiseIconView() { | 282 | void PMainWindow::raiseIconView() { |
282 | m_stack->raiseWidget( IconView ); | 283 | m_stack->raiseWidget( IconView ); |
283 | } | 284 | } |
285 | |||
286 | void PMainWindow::setDocument( const QString& showImg ) { | ||
287 | QString file = showImg; | ||
288 | DocLnk lnk(showImg); | ||
289 | if (lnk.isValid() ) | ||
290 | file = lnk.file(); | ||
291 | |||
292 | slotDisplay( file ); | ||
293 | } | ||
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 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef PHUNK_MAIN_WINDOW_H | 6 | #ifndef PHUNK_MAIN_WINDOW_H |
7 | #define PHUNK_MAIN_WINDOW_H | 7 | #define PHUNK_MAIN_WINDOW_H |
8 | 8 | ||
9 | #include <opie2/oconfig.h> | 9 | #include <opie2/oconfig.h> |
10 | 10 | ||
11 | #include <qmainwindow.h> | 11 | #include <qmainwindow.h> |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | namespace Opie { | 15 | namespace Opie { |
16 | namespace Ui{ | 16 | namespace Ui{ |
17 | class OKeyConfigManager; | 17 | class OKeyConfigManager; |
18 | class OWidgetStack; | 18 | class OWidgetStack; |
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 | ||
22 | class PIconView; | 22 | class PIconView; |
23 | class imageinfo; | 23 | class imageinfo; |
24 | class ImageView; | 24 | class ImageView; |
25 | class PMainWindow : public QMainWindow { | 25 | class PMainWindow : public QMainWindow { |
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | enum Views { IconView, ImageInfo, ImageDisplay }; | 27 | enum Views { IconView, ImageInfo, ImageDisplay }; |
28 | public: | 28 | public: |
29 | static QString appName() { return QString::fromLatin1("opie-eye" ); } | 29 | static QString appName() { return QString::fromLatin1("opie-eye" ); } |
30 | PMainWindow(QWidget*, const char*, WFlags ); | 30 | PMainWindow(QWidget*, const char*, WFlags ); |
31 | ~PMainWindow(); | 31 | ~PMainWindow(); |
32 | 32 | ||
33 | signals: | 33 | signals: |
34 | void configChanged(); | 34 | void configChanged(); |
35 | 35 | ||
36 | public slots: | 36 | public slots: |
37 | void slotShowInfo( const QString& inf ); | 37 | void slotShowInfo( const QString& inf ); |
38 | void slotDisplay( const QString& inf ); | 38 | void slotDisplay( const QString& inf ); |
39 | void slotReturn(); | 39 | void slotReturn(); |
40 | void slotRotateToggled(bool); | 40 | void slotRotateToggled(bool); |
41 | void slotScaleToggled(bool); | 41 | void slotScaleToggled(bool); |
42 | void setDocument( const QString& ); | ||
42 | 43 | ||
43 | protected: | 44 | protected: |
44 | void raiseIconView(); | 45 | void raiseIconView(); |
45 | void closeEvent( QCloseEvent* ); | 46 | void closeEvent( QCloseEvent* ); |
46 | 47 | ||
47 | private: | 48 | private: |
48 | template<class T> void initT( const char* name, T**, int ); | 49 | template<class T> void initT( const char* name, T**, int ); |
49 | void initInfo(); | 50 | void initInfo(); |
50 | void initDisp(); | 51 | void initDisp(); |
51 | 52 | ||
52 | private: | 53 | private: |
53 | Opie::Core::OConfig *m_cfg; | 54 | Opie::Core::OConfig *m_cfg; |
54 | Opie::Ui::OWidgetStack *m_stack; | 55 | Opie::Ui::OWidgetStack *m_stack; |
55 | PIconView* m_view; | 56 | PIconView* m_view; |
56 | imageinfo *m_info; | 57 | imageinfo *m_info; |
57 | ImageView *m_disp; | 58 | ImageView *m_disp; |
58 | bool autoRotate; | 59 | bool autoRotate; |
59 | bool autoScale; | 60 | bool autoScale; |
60 | QToolButton*rotateButton; | 61 | QToolButton*rotateButton; |
61 | 62 | ||
62 | 63 | ||
63 | private slots: | 64 | private slots: |
64 | void slotConfig(); | 65 | void slotConfig(); |
65 | }; | 66 | }; |
66 | 67 | ||
67 | #endif | 68 | #endif |