summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/mainwindow.cpp
authorzecke <zecke>2004-03-22 23:32:41 (UTC)
committer zecke <zecke>2004-03-22 23:32:41 (UTC)
commit428b687982966dc2efabaf6dbcc55ad0ea30aa10 (patch) (unidiff)
tree86da20abd2e4b97a59dc32e17996bde5ee74cc91 /noncore/graphics/opie-eye/gui/mainwindow.cpp
parent7ce623c6351646ce738a81e103632d73c5454ecc (diff)
downloadopie-428b687982966dc2efabaf6dbcc55ad0ea30aa10.zip
opie-428b687982966dc2efabaf6dbcc55ad0ea30aa10.tar.gz
opie-428b687982966dc2efabaf6dbcc55ad0ea30aa10.tar.bz2
Initial Check in of the Eye Of Zilla. This ImageViewer features
Image Infos, EXIF, Jpeg,Png,Gif support. It supports scaled loading of Jpegs. an smart image cache.... GUI needs some work and we need to find a bug in QCOP as well. TODO: Add Image Service for example Mailer Add ImageCanvas/Zoomer/Display
Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp114
1 files changed, 114 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
new file mode 100644
index 0000000..0a2fcab
--- a/dev/null
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -0,0 +1,114 @@
1/*
2 * GPLv2 zecke@handhelds.org
3 * No WArranty...
4 */
5
6#include <qtoolbar.h>
7#include <qtoolbutton.h>
8#include <qlayout.h>
9#include <qdialog.h>
10#include <qmap.h>
11
12#include <qpe/resource.h>
13#include <qpe/config.h>
14#include <qpe/ir.h>
15
16#include <opie/oapplicationfactory.h>
17#include <opie/otabwidget.h>
18
19#include <iface/ifaceinfo.h>
20#include <iface/dirview.h>
21
22#include "iconview.h"
23#include "filesystem.h"
24
25#include "mainwindow.h"
26
27OPIE_EXPORT_APP( OApplicationFactory<PMainWindow> )
28
29PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
30 : QMainWindow( wid, name, style ), m_cfg("phunkview")
31{
32 setCaption( QObject::tr("Opie Eye Caramba" ) );
33 m_cfg.setGroup("Zecke_view" );
34 /*
35 * Initialize ToolBar and IconView
36 * And Connect Them
37 */
38 QToolBar *bar = new QToolBar( this );
39 bar->setHorizontalStretchable( true );
40 setToolBarsMovable( false );
41
42 m_view = new PIconView( this, &m_cfg );
43 setCentralWidget( m_view );
44
45 QToolButton *btn = new QToolButton( bar );
46 btn->setIconSet( Resource::loadIconSet( "up" ) );
47 connect( btn, SIGNAL(clicked()),
48 m_view, SLOT(slotDirUp()) );
49
50 btn = new PFileSystem( bar );
51 connect( btn, SIGNAL( changeDir( const QString& ) ),
52 m_view, SLOT(slotChangeDir( const QString& ) ) );
53
54 btn = new QToolButton( bar );
55 btn->setIconSet( Resource::loadIconSet( "edit" ) );
56 connect( btn, SIGNAL(clicked()),
57 m_view, SLOT(slotRename()) );
58
59 if ( Ir::supported() ) {
60 btn = new QToolButton( bar );
61 btn->setIconSet( Resource::loadIconSet( "beam" ) );
62 connect( btn, SIGNAL(clicked()),
63 m_view, SLOT(slotBeam()) );
64 }
65
66 btn = new QToolButton( bar );
67 btn->setIconSet( Resource::loadIconSet( "trash" ) );
68 connect( btn, SIGNAL(clicked() ),
69 m_view, SLOT(slotTrash() ) );
70
71 btn = new QToolButton( bar );
72 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
73 connect( btn, SIGNAL(clicked() ),
74 this, SLOT(slotConfig() ) );
75
76}
77
78PMainWindow::~PMainWindow() {
79}
80
81
82void PMainWindow::slotConfig() {
83 QDialog dlg(this, 0, true);
84 dlg.setCaption( tr("Phunk View - Config" ) );
85
86 QHBoxLayout *lay = new QHBoxLayout(&dlg);
87 OTabWidget *wid = new OTabWidget(&dlg );
88 lay->addWidget( wid );
89 ViewMap *vM = viewMap();
90 ViewMap::Iterator _it = vM->begin();
91 QMap<PDirView*, QWidget*> lst;
92
93 for( ; _it != vM->end(); ++_it ) {
94 PDirView *view = (_it.data())(m_cfg);
95 PInterfaceInfo *inf = view->interfaceInfo();
96 QWidget *_wid = inf->configWidget( m_cfg );
97 _wid->reparent(wid, QPoint() );
98 lst.insert( view, _wid );
99 wid->addTab( _wid, QString::null, inf->name() );
100 }
101
102 dlg.showMaximized();
103 bool act = ( dlg.exec() == QDialog::Accepted );
104
105 QMap<PDirView*, QWidget*>::Iterator it;
106 for ( it = lst.begin(); it != lst.end(); ++it ) {
107 if ( act )
108 it.key()->interfaceInfo()->writeConfig(it.data(), m_cfg);
109 delete it.key();
110 }
111
112 if ( act )
113 m_view->resetView();
114}