summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-02 13:34:44 (UTC)
committer zecke <zecke>2004-04-02 13:34:44 (UTC)
commit96105800596dfbd6b828ef47dd7774769f1e3ef3 (patch) (unidiff)
treee8862c0d4f8cc6fb3a90da0856857cd21010ba8b
parent02696a8b22d86f74a4f123edcd24bfa32dd00441 (diff)
downloadopie-96105800596dfbd6b828ef47dd7774769f1e3ef3.zip
opie-96105800596dfbd6b828ef47dd7774769f1e3ef3.tar.gz
opie-96105800596dfbd6b828ef47dd7774769f1e3ef3.tar.bz2
-Use OConfig
-Use OKeyConfigManager/Widget for Keyboard short cuts
Diffstat (more/less context) (ignore 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
@@ -10,12 +10,15 @@
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>
@@ -27,6 +30,7 @@
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;
@@ -96,7 +100,7 @@ namespace {
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 {
@@ -124,6 +128,10 @@ PIconView::PIconView( QWidget* wid, Config* cfg )
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}
@@ -132,6 +140,42 @@ PIconView::~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() {
@@ -152,9 +196,11 @@ void PIconView::slotChangeDir(const QString& path) {
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();
@@ -317,3 +363,16 @@ void PIconView::slotStart() {
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
@@ -8,7 +8,6 @@
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;
@@ -16,15 +15,30 @@ class 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
@@ -38,6 +52,11 @@ private slots:
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
@@ -50,7 +69,8 @@ private slots:
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;
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
@@ -2,6 +2,22 @@
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>
@@ -9,28 +25,20 @@
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 28
16#include <opie2/oapplicationfactory.h>
17#include <opie2/otabwidget.h>
18 29
19#include <iface/ifaceinfo.h>
20#include <iface/dirview.h>
21 30
22#include "iconview.h"
23#include "filesystem.h"
24
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
@@ -39,7 +47,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
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 );
@@ -80,6 +88,11 @@ PMainWindow::~PMainWindow() {
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
@@ -91,24 +104,35 @@ void PMainWindow::slotConfig() {
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
@@ -6,9 +6,17 @@
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 {
@@ -19,9 +27,10 @@ public:
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};