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) (side-by-side diff)
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 @@
+/*
+ * GPLv2 zecke@handhelds.org
+ * No WArranty...
+ */
+
+#include <qtoolbar.h>
+#include <qtoolbutton.h>
+#include <qlayout.h>
+#include <qdialog.h>
+#include <qmap.h>
+
+#include <qpe/resource.h>
+#include <qpe/config.h>
+#include <qpe/ir.h>
+
+#include <opie/oapplicationfactory.h>
+#include <opie/otabwidget.h>
+
+#include <iface/ifaceinfo.h>
+#include <iface/dirview.h>
+
+#include "iconview.h"
+#include "filesystem.h"
+
+#include "mainwindow.h"
+
+OPIE_EXPORT_APP( OApplicationFactory<PMainWindow> )
+
+PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
+ : QMainWindow( wid, name, style ), m_cfg("phunkview")
+{
+ setCaption( QObject::tr("Opie Eye Caramba" ) );
+ m_cfg.setGroup("Zecke_view" );
+ /*
+ * Initialize ToolBar and IconView
+ * And Connect Them
+ */
+ QToolBar *bar = new QToolBar( this );
+ bar->setHorizontalStretchable( true );
+ setToolBarsMovable( false );
+
+ m_view = new PIconView( this, &m_cfg );
+ setCentralWidget( m_view );
+
+ 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& ) ) );
+
+ btn = new QToolButton( bar );
+ btn->setIconSet( Resource::loadIconSet( "edit" ) );
+ connect( btn, SIGNAL(clicked()),
+ m_view, SLOT(slotRename()) );
+
+ if ( Ir::supported() ) {
+ btn = new QToolButton( bar );
+ btn->setIconSet( Resource::loadIconSet( "beam" ) );
+ connect( btn, SIGNAL(clicked()),
+ 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() ) );
+
+}
+
+PMainWindow::~PMainWindow() {
+}
+
+
+void PMainWindow::slotConfig() {
+ QDialog dlg(this, 0, true);
+ dlg.setCaption( tr("Phunk View - Config" ) );
+
+ QHBoxLayout *lay = new QHBoxLayout(&dlg);
+ OTabWidget *wid = new OTabWidget(&dlg );
+ lay->addWidget( wid );
+ ViewMap *vM = viewMap();
+ ViewMap::Iterator _it = vM->begin();
+ QMap<PDirView*, QWidget*> lst;
+
+ for( ; _it != vM->end(); ++_it ) {
+ PDirView *view = (_it.data())(m_cfg);
+ PInterfaceInfo *inf = view->interfaceInfo();
+ QWidget *_wid = inf->configWidget( m_cfg );
+ _wid->reparent(wid, QPoint() );
+ lst.insert( view, _wid );
+ wid->addTab( _wid, QString::null, inf->name() );
+ }
+
+ dlg.showMaximized();
+ bool act = ( dlg.exec() == QDialog::Accepted );
+
+ QMap<PDirView*, QWidget*>::Iterator it;
+ for ( it = lst.begin(); it != lst.end(); ++it ) {
+ if ( act )
+ it.key()->interfaceInfo()->writeConfig(it.data(), m_cfg);
+ delete it.key();
+ }
+
+ if ( act )
+ m_view->resetView();
+}