summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp63
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h26
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp64
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h13
4 files changed, 139 insertions, 27 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 74a8d0f..b3f0006 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -7,29 +7,33 @@
7 7
8#include <lib/imagecache.h> 8#include <lib/imagecache.h>
9 9
10#include <iface/dirview.h> 10#include <iface/dirview.h>
11#include <iface/dirlister.h> 11#include <iface/dirlister.h>
12 12
13#include <qpe/config.h> 13#include <opie2/oconfig.h>
14#include <opie2/okeyconfigwidget.h>
15
14#include <qpe/resource.h> 16#include <qpe/resource.h>
15#include <qpe/qpemessagebox.h> 17#include <qpe/qpemessagebox.h>
16#include <qpe/ir.h> 18#include <qpe/ir.h>
17#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
18 20
21
19#include <qiconview.h> 22#include <qiconview.h>
20#include <qlabel.h> 23#include <qlabel.h>
21#include <qhbox.h> 24#include <qhbox.h>
22#include <qcombobox.h> 25#include <qcombobox.h>
23#include <qdir.h> 26#include <qdir.h>
24#include <qapplication.h> 27#include <qapplication.h>
25#include <qmainwindow.h> 28#include <qmainwindow.h>
26#include <qtimer.h> 29#include <qtimer.h>
27#include <qstyle.h> 30#include <qstyle.h>
28 31
29 32
33using Opie::Ui::OKeyConfigItem;
30 34
31namespace { 35namespace {
32 QPixmap* _dirPix = 0; 36 QPixmap* _dirPix = 0;
33 QPixmap* _unkPix = 0; 37 QPixmap* _unkPix = 0;
34 class IconViewItem : public QIconViewItem { 38 class IconViewItem : public QIconViewItem {
35 public: 39 public:
@@ -93,13 +97,13 @@ namespace {
93 { 97 {
94 calcRect(); 98 calcRect();
95 } 99 }
96} 100}
97 101
98 102
99PIconView::PIconView( QWidget* wid, Config* cfg ) 103PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
100 : QVBox( wid ), m_cfg( cfg ) 104 : QVBox( wid ), m_cfg( cfg )
101{ 105{
102 { 106 {
103 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 107 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
104 } 108 }
105 m_path = QDir::homeDirPath(); 109 m_path = QDir::homeDirPath();
@@ -121,20 +125,60 @@ PIconView::PIconView( QWidget* wid, Config* cfg )
121 m_view->setResizeMode(QIconView::Adjust); 125 m_view->setResizeMode(QIconView::Adjust);
122 126
123 int dw = QApplication::desktop()->width(); 127 int dw = QApplication::desktop()->width();
124 int viewerWidth = dw-style().scrollBarExtent().width(); 128 int viewerWidth = dw-style().scrollBarExtent().width();
125 m_view->setGridX( viewerWidth-2*m_view->spacing() ); 129 m_view->setGridX( viewerWidth-2*m_view->spacing() );
126 m_view->setGridY( fontMetrics().height()*2+40 ); 130 m_view->setGridY( fontMetrics().height()*2+40 );
131
132
133 initKeys();
134
127 loadViews(); 135 loadViews();
128 slotViewChanged( m_views->currentItem() ); 136 slotViewChanged( m_views->currentItem() );
129} 137}
130 138
131PIconView::~PIconView() { 139PIconView::~PIconView() {
132 { 140 {
133 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 141 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
134 } 142 }
143 m_viewManager->save();
144 delete m_viewManager;
145}
146
147Opie::Ui::OKeyConfigManager* PIconView::manager() {
148 return m_viewManager;
149}
150
151void PIconView::initKeys() {
152 Opie::Ui::OKeyPair::List lst;
153 lst.append( Opie::Ui::OKeyPair::upArrowKey() );
154 lst.append( Opie::Ui::OKeyPair::downArrowKey() );
155 lst.append( Opie::Ui::OKeyPair::leftArrowKey() );
156 lst.append( Opie::Ui::OKeyPair::rightArrowKey() );
157 lst.append( Opie::Ui::OKeyPair::returnKey() );
158
159 m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "View-KeyBoard-Config",
160 lst, false,this, "keyconfig name" );
161 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam",
162 QString::fromLatin1("beam"), BeamItem,
163 Opie::Ui::OKeyPair(Qt::Key_B, Qt::ShiftButton),
164 this, SLOT(slotBeam())) );
165 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
166 QString::fromLatin1("trash"), DeleteItem,
167 Opie::Ui::OKeyPair(Qt::Key_D, Qt::ShiftButton),
168 this, SLOT(slotTrash())) );
169 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
170 QString::fromLatin1("1to1"), ViewItem,
171 Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton),
172 this, SLOT(slotShowImage())));
173 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
174 QString::fromLatin1("DocumentTypeWord"), InfoItem,
175 Opie::Ui::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
176 this, SLOT(slotImageInfo()) ) );
177 m_viewManager->load();
178 m_viewManager->handleWidget( m_view );
135} 179}
136 180
137void PIconView::slotDirUp() { 181void PIconView::slotDirUp() {
138 QDir dir( m_path ); 182 QDir dir( m_path );
139 dir.cdUp(); 183 dir.cdUp();
140 slotChangeDir( dir.absPath() ); 184 slotChangeDir( dir.absPath() );
@@ -149,15 +193,17 @@ void PIconView::slotChangeDir(const QString& path) {
149 if (!lister ) 193 if (!lister )
150 return; 194 return;
151 195
152 lister->setStartPath( path ); 196 lister->setStartPath( path );
153 m_path = lister->currentPath(); 197 m_path = lister->currentPath();
154 198
199 m_view->setUpdatesEnabled( false );
155 m_view->clear(); 200 m_view->clear();
156 addFolders( lister->folders() ); 201 addFolders( lister->folders() );
157 addFiles( lister->files() ); 202 addFiles( lister->files() );
203 m_view->setUpdatesEnabled( true );
158 204
159 // Also invalidate the cache. We can't cancel the operations anyway 205 // Also invalidate the cache. We can't cancel the operations anyway
160 g_stringPix.clear(); 206 g_stringPix.clear();
161 g_stringInf.clear(); 207 g_stringInf.clear();
162 208
163 // looks ugly 209 // looks ugly
@@ -314,6 +360,19 @@ void PIconView::slotStart() {
314 m_view->setUpdatesEnabled( false ); 360 m_view->setUpdatesEnabled( false );
315} 361}
316 362
317void PIconView::slotEnd() { 363void PIconView::slotEnd() {
318 m_view->setUpdatesEnabled( true ); 364 m_view->setUpdatesEnabled( true );
319} 365}
366
367void PIconView::slotShowImage() {
368
369}
370void PIconView::slotShowImage( const QString& ) {
371
372}
373void PIconView::slotImageInfo() {
374
375}
376void PIconView::slotImageInfo( const QString& ) {
377
378}
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index 439833a..0fba327 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -5,29 +5,43 @@
5 5
6#ifndef PHUNK_ICON_VIEW_H 6#ifndef PHUNK_ICON_VIEW_H
7#define PHUNK_ICON_VIEW_H 7#define PHUNK_ICON_VIEW_H
8 8
9#include <qvbox.h> 9#include <qvbox.h>
10 10
11#include <qpe/config.h>
12 11
13class QIconView; 12class QIconView;
14class QIconViewItem; 13class QIconViewItem;
15class QComboBox; 14class QComboBox;
16class PIconViewItem; 15class PIconViewItem;
17class PDirLister; 16class PDirLister;
18class Ir; 17class Ir;
18
19namespace Opie {
20namespace Core{
21 class OConfig;
22}
23namespace Ui {
24 class OKeyConfigManager;
25}
26}
27
19class PIconView : public QVBox { 28class PIconView : public QVBox {
20 Q_OBJECT 29 Q_OBJECT
21 friend class PIconViewItem; 30 friend class PIconViewItem;
31 enum ActionIds {
32 BeamItem, DeleteItem, ViewItem, InfoItem
33 };
22public: 34public:
23 PIconView( QWidget* wid, Config *cfg ); 35 PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
24 ~PIconView(); 36 ~PIconView();
25 void resetView(); 37 void resetView();
38 Opie::Ui::OKeyConfigManager* manager();
26 39
27private: 40private:
41 void initKeys();
28 QString currentFileName(bool &isDir)const; 42 QString currentFileName(bool &isDir)const;
29 void loadViews(); 43 void loadViews();
30 44
31private slots: 45private slots:
32 void slotDirUp(); 46 void slotDirUp();
33 void slotChangeDir(const QString&); 47 void slotChangeDir(const QString&);
@@ -35,25 +49,31 @@ private slots:
35 void slotViewChanged( int ); 49 void slotViewChanged( int );
36 void slotReloadDir(); 50 void slotReloadDir();
37 void slotRename(); 51 void slotRename();
38 void slotBeam(); 52 void slotBeam();
39 void slotBeamDone( Ir* ); 53 void slotBeamDone( Ir* );
40 54
55 void slotShowImage();
56 void slotShowImage( const QString& );
57 void slotImageInfo();
58 void slotImageInfo( const QString& );
59
41 void slotStart(); 60 void slotStart();
42 void slotEnd(); 61 void slotEnd();
43 62
44/* for performance reasons make it inline in the future */ 63/* for performance reasons make it inline in the future */
45 void addFolders( const QStringList& ); 64 void addFolders( const QStringList& );
46 void addFiles( const QStringList& ); 65 void addFiles( const QStringList& );
47 void slotClicked(QIconViewItem* ); 66 void slotClicked(QIconViewItem* );
48 67
49/**/ 68/**/
50 void slotThumbInfo(const QString&, const QString&); 69 void slotThumbInfo(const QString&, const QString&);
51 void slotThumbNail(const QString&, const QPixmap&); 70 void slotThumbNail(const QString&, const QPixmap&);
52private: 71private:
53 Config *m_cfg; 72 Opie::Ui::OKeyConfigManager *m_viewManager;
73 Opie::Core::OConfig *m_cfg;
54 QComboBox* m_views; 74 QComboBox* m_views;
55 QIconView* m_view; 75 QIconView* m_view;
56 QString m_path; 76 QString m_path;
57}; 77};
58 78
59#endif 79#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index ea765d1..0314659 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,48 +1,56 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5#include "mainwindow.h"
6
7#include "iconview.h"
8#include "filesystem.h"
9
10#include <iface/ifaceinfo.h>
11#include <iface/dirview.h>
12
13#include <opie2/oapplicationfactory.h>
14#include <opie2/otabwidget.h>
15#include <opie2/okeyconfigwidget.h>
16
17
18#include <qpe/resource.h>
19#include <qpe/config.h>
20#include <qpe/ir.h>
5 21
6#include <qtoolbar.h> 22#include <qtoolbar.h>
7#include <qtoolbutton.h> 23#include <qtoolbutton.h>
8#include <qlayout.h> 24#include <qlayout.h>
9#include <qdialog.h> 25#include <qdialog.h>
10#include <qmap.h> 26#include <qmap.h>
11 27
12#include <qpe/resource.h>
13#include <qpe/config.h>
14#include <qpe/ir.h>
15
16#include <opie2/oapplicationfactory.h>
17#include <opie2/otabwidget.h>
18 28
19#include <iface/ifaceinfo.h>
20#include <iface/dirview.h>
21 29
22#include "iconview.h"
23#include "filesystem.h"
24 30
25#include "mainwindow.h"
26 31
27OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> ) 32OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> )
28 33
29PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 34PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
30 : QMainWindow( wid, name, style ), m_cfg("phunkview") 35 : QMainWindow( wid, name, style )
31{ 36{
32 setCaption( QObject::tr("Opie Eye Caramba" ) ); 37 setCaption( QObject::tr("Opie Eye Caramba" ) );
33 m_cfg.setGroup("Zecke_view" ); 38 m_cfg = new Opie::Core::OConfig("phunkview");
39 m_cfg->setGroup("Zecke_view" );
40
41
34 /* 42 /*
35 * Initialize ToolBar and IconView 43 * Initialize ToolBar and IconView
36 * And Connect Them 44 * And Connect Them
37 */ 45 */
38 QToolBar *bar = new QToolBar( this ); 46 QToolBar *bar = new QToolBar( this );
39 bar->setHorizontalStretchable( true ); 47 bar->setHorizontalStretchable( true );
40 setToolBarsMovable( false ); 48 setToolBarsMovable( false );
41 49
42 m_view = new PIconView( this, &m_cfg ); 50 m_view = new PIconView( this, m_cfg );
43 setCentralWidget( m_view ); 51 setCentralWidget( m_view );
44 52
45 QToolButton *btn = new QToolButton( bar ); 53 QToolButton *btn = new QToolButton( bar );
46 btn->setIconSet( Resource::loadIconSet( "up" ) ); 54 btn->setIconSet( Resource::loadIconSet( "up" ) );
47 connect( btn, SIGNAL(clicked()), 55 connect( btn, SIGNAL(clicked()),
48 m_view, SLOT(slotDirUp()) ); 56 m_view, SLOT(slotDirUp()) );
@@ -77,38 +85,54 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
77 85
78PMainWindow::~PMainWindow() { 86PMainWindow::~PMainWindow() {
79} 87}
80 88
81 89
82void PMainWindow::slotConfig() { 90void PMainWindow::slotConfig() {
91/*
92 * have a tab with the possible views
93 * a tab for globals image cache size.. scaled loading
94 * and one tab for the KeyConfigs
95 */
83 QDialog dlg(this, 0, true); 96 QDialog dlg(this, 0, true);
84 dlg.setCaption( tr("Phunk View - Config" ) ); 97 dlg.setCaption( tr("Phunk View - Config" ) );
85 98
86 QHBoxLayout *lay = new QHBoxLayout(&dlg); 99 QHBoxLayout *lay = new QHBoxLayout(&dlg);
87 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 100 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
88 lay->addWidget( wid ); 101 lay->addWidget( wid );
89 ViewMap *vM = viewMap(); 102 ViewMap *vM = viewMap();
90 ViewMap::Iterator _it = vM->begin(); 103 ViewMap::Iterator _it = vM->begin();
91 QMap<PDirView*, QWidget*> lst; 104 QMap<PDirView*, QWidget*> lst;
92 105
93 for( ; _it != vM->end(); ++_it ) { 106 for( ; _it != vM->end(); ++_it ) {
94 PDirView *view = (_it.data())(m_cfg); 107 PDirView *view = (_it.data())(*m_cfg);
95 PInterfaceInfo *inf = view->interfaceInfo(); 108 PInterfaceInfo *inf = view->interfaceInfo();
96 QWidget *_wid = inf->configWidget( m_cfg ); 109 QWidget *_wid = inf->configWidget( *m_cfg );
97 _wid->reparent(wid, QPoint() ); 110 _wid->reparent(wid, QPoint() );
98 lst.insert( view, _wid ); 111 lst.insert( view, _wid );
99 wid->addTab( _wid, QString::null, inf->name() ); 112 wid->addTab( _wid, QString::null, inf->name() );
100 } 113 }
101 114
102 dlg.showMaximized(); 115/*
103 bool act = ( dlg.exec() == QDialog::Accepted ); 116 * Add the KeyConfigWidget
117 */
118 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
119 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
120 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
121 keyWid->load();
122 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
123
124
125 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
104 126
105 QMap<PDirView*, QWidget*>::Iterator it; 127 QMap<PDirView*, QWidget*>::Iterator it;
106 for ( it = lst.begin(); it != lst.end(); ++it ) { 128 for ( it = lst.begin(); it != lst.end(); ++it ) {
107 if ( act ) 129 if ( act )
108 it.key()->interfaceInfo()->writeConfig(it.data(), m_cfg); 130 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
109 delete it.key(); 131 delete it.key();
110 } 132 }
111 133
112 if ( act ) 134 if ( act ) {
113 m_view->resetView(); 135 m_view->resetView();
136 keyWid->save();
137 }
114} 138}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 408fe32..317a51e 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -3,27 +3,36 @@
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>
10
9#include <qmainwindow.h> 11#include <qmainwindow.h>
10 12
11#include <qpe/config.h> 13
14
15namespace Opie {
16namespace Ui{
17 class OKeyConfigManager;
18}
19}
12 20
13class PIconView; 21class PIconView;
14class PMainWindow : public QMainWindow { 22class PMainWindow : public QMainWindow {
15 Q_OBJECT 23 Q_OBJECT
16public: 24public:
17 static QString appName() { return QString::fromLatin1("opie-eye" ); } 25 static QString appName() { return QString::fromLatin1("opie-eye" ); }
18 PMainWindow(QWidget*, const char*, WFlags ); 26 PMainWindow(QWidget*, const char*, WFlags );
19 ~PMainWindow(); 27 ~PMainWindow();
20 28
21private: 29private:
22 Config m_cfg; 30 Opie::Core::OConfig *m_cfg;
23 PIconView* m_view; 31 PIconView* m_view;
24 32
33
25private slots: 34private slots:
26 void slotConfig(); 35 void slotConfig();
27}; 36};
28 37
29#endif 38#endif