author | alwin <alwin> | 2004-04-07 12:46:26 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-07 12:46:26 (UTC) |
commit | 9e1ecade17a77c3d50aecc4c92091d852e99e8d9 (patch) (unidiff) | |
tree | bef7f25d64890aab64f5dc0e0fcb40c64497464a | |
parent | d581038dd7875aa65a750f099333a94f43c37ef2 (diff) | |
download | opie-9e1ecade17a77c3d50aecc4c92091d852e99e8d9.zip opie-9e1ecade17a77c3d50aecc4c92091d852e99e8d9.tar.gz opie-9e1ecade17a77c3d50aecc4c92091d852e99e8d9.tar.bz2 |
keys will now be written to config file
all view use the same config object otherwise there will be problems writing
a new config
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 19 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 20 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 6 |
5 files changed, 31 insertions, 18 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index 822fd88..0b3250c 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp | |||
@@ -22,56 +22,62 @@ | |||
22 | 22 | ||
23 | #include <qpe/qcopenvelope_qws.h> | 23 | #include <qpe/qcopenvelope_qws.h> |
24 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
25 | 25 | ||
26 | static const int THUMBSIZE = 128; | 26 | static const int THUMBSIZE = 128; |
27 | 27 | ||
28 | using namespace Opie::Core; | 28 | using namespace Opie::Core; |
29 | 29 | ||
30 | imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) | 30 | imageinfo::imageinfo(Opie::Core::OConfig *cfg,QWidget* parent, const char* name, WFlags fl ) |
31 | : QWidget( parent, name, fl ) | 31 | : QWidget( parent, name, fl ) |
32 | { | 32 | { |
33 | m_viewManager = 0; | 33 | m_viewManager = 0; |
34 | m_cfg = cfg; | ||
34 | init(name); | 35 | init(name); |
35 | initKeys(); | 36 | initKeys(); |
36 | } | 37 | } |
37 | 38 | ||
38 | imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) | 39 | imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) |
39 | : QWidget( parent, name, fl ),currentFile(_path) | 40 | : QWidget( parent, name, fl ),currentFile(_path) |
40 | { | 41 | { |
41 | m_viewManager = 0; | 42 | m_viewManager = 0; |
43 | m_cfg = 0; | ||
42 | init(name); | 44 | init(name); |
43 | initKeys(); | 45 | initKeys(); |
44 | slotChangeName(_path); | 46 | slotChangeName(_path); |
45 | } | 47 | } |
46 | 48 | ||
47 | Opie::Ui::OKeyConfigManager* imageinfo::manager() | 49 | Opie::Ui::OKeyConfigManager* imageinfo::manager() |
48 | { | 50 | { |
49 | if (!m_viewManager) { | 51 | if (!m_viewManager) { |
50 | initKeys(); | 52 | initKeys(); |
51 | } | 53 | } |
52 | return m_viewManager; | 54 | return m_viewManager; |
53 | } | 55 | } |
54 | 56 | ||
55 | void imageinfo::initKeys() | 57 | void imageinfo::initKeys() |
56 | { | 58 | { |
57 | odebug << "init imageinfo keys" << oendl; | 59 | odebug << "init imageinfo keys" << oendl; |
58 | m_cfg = new Opie::Core::OConfig("phunkview"); | 60 | #if 0 |
59 | m_cfg->setGroup("Zecke_view" ); | 61 | if (!m_cfg) { |
62 | m_cfg = new Opie::Core::OConfig("phunkview"); | ||
63 | m_cfg->setGroup("imageinfo_keys" ); | ||
64 | } | ||
65 | #endif | ||
60 | Opie::Ui::OKeyPair::List lst; | 66 | Opie::Ui::OKeyPair::List lst; |
61 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); | 67 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); |
62 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); | 68 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); |
63 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); | 69 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); |
64 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); | 70 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); |
65 | lst.append( Opie::Ui::OKeyPair::returnKey() ); | 71 | lst.append( Opie::Ui::OKeyPair::returnKey() ); |
66 | 72 | ||
67 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageinfo-KeyBoard-Config", | 73 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "imageinfo_keys", |
68 | lst, false,this, "keyconfig name" ); | 74 | lst, false,this, "keyconfig name" ); |
69 | m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "view", | 75 | m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "infoview", |
70 | Resource::loadPixmap("1to1"), ViewItem, | 76 | Resource::loadPixmap("1to1"), ViewItem, |
71 | Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), | 77 | Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), |
72 | this, SLOT(slotShowImage()))); | 78 | this, SLOT(slotShowImage()))); |
73 | m_viewManager->load(); | 79 | m_viewManager->load(); |
74 | m_viewManager->handleWidget( this ); | 80 | m_viewManager->handleWidget( this ); |
75 | m_viewManager->handleWidget( TextView1 ); | 81 | m_viewManager->handleWidget( TextView1 ); |
76 | } | 82 | } |
77 | 83 | ||
@@ -138,29 +144,26 @@ void imageinfo::slotChangeName(const QString&_path) | |||
138 | } | 144 | } |
139 | 145 | ||
140 | imageinfo::~imageinfo() | 146 | imageinfo::~imageinfo() |
141 | { | 147 | { |
142 | { | 148 | { |
143 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 149 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
144 | } | 150 | } |
145 | if (m_viewManager) { | 151 | if (m_viewManager) { |
146 | m_viewManager->save(); | ||
147 | delete m_viewManager; | 152 | delete m_viewManager; |
148 | } | 153 | } |
149 | } | 154 | } |
150 | 155 | ||
151 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) | 156 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) |
152 | { | 157 | { |
153 | if (_path == currentFile) { | 158 | if (_path == currentFile) { |
154 | qDebug(_t); | 159 | qDebug(_t); |
155 | QString t = _t; | 160 | QString t = _t; |
156 | t.replace(QRegExp("\n"),"<br>"); | 161 | t.replace(QRegExp("\n"),"<br>"); |
157 | /* t.replace(QRegeExp("<qt>",""); | ||
158 | t.replace(QRegeExp("</qt>","");*/ | ||
159 | TextView1->setText(t); | 162 | TextView1->setText(t); |
160 | } | 163 | } |
161 | } | 164 | } |
162 | 165 | ||
163 | void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) | 166 | void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) |
164 | { | 167 | { |
165 | if (_path == currentFile) { | 168 | if (_path == currentFile) { |
166 | if (_pix.width()>0) { | 169 | if (_pix.width()>0) { |
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.h b/noncore/graphics/opie-eye/gui/imageinfoui.h index 0ffa423..c9b83a1 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.h +++ b/noncore/graphics/opie-eye/gui/imageinfoui.h | |||
@@ -24,17 +24,17 @@ namespace Opie { | |||
24 | class imageinfo : public QWidget | 24 | class imageinfo : public QWidget |
25 | { | 25 | { |
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | enum ActionIds { | 27 | enum ActionIds { |
28 | ViewItem | 28 | ViewItem |
29 | }; | 29 | }; |
30 | 30 | ||
31 | public: | 31 | public: |
32 | imageinfo( QWidget* parent = 0, const char* name = 0, WFlags fl =0); | 32 | imageinfo(Opie::Core::OConfig *cfg, QWidget* parent = 0, const char* name = 0, WFlags fl =0); |
33 | imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 33 | imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
34 | virtual ~imageinfo(); | 34 | virtual ~imageinfo(); |
35 | 35 | ||
36 | void setDestructiveClose(); | 36 | void setDestructiveClose(); |
37 | Opie::Ui::OKeyConfigManager* manager(); | 37 | Opie::Ui::OKeyConfigManager* manager(); |
38 | 38 | ||
39 | signals: | 39 | signals: |
40 | void dispImage(const QString&); | 40 | void dispImage(const QString&); |
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 8fc258e..e43bbff 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -3,53 +3,59 @@ | |||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <opie2/oconfig.h> | 4 | #include <opie2/oconfig.h> |
5 | #include <opie2/okeyconfigwidget.h> | 5 | #include <opie2/okeyconfigwidget.h> |
6 | 6 | ||
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | 8 | ||
9 | using namespace Opie::Core; | 9 | using namespace Opie::Core; |
10 | 10 | ||
11 | ImageView::ImageView( QWidget* parent, const char* name, WFlags fl ) | 11 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) |
12 | : ImageScrollView(parent,name,fl) | 12 | : ImageScrollView(parent,name,fl) |
13 | { | 13 | { |
14 | m_viewManager = 0; | 14 | m_viewManager = 0; |
15 | m_cfg = cfg; | ||
15 | initKeys(); | 16 | initKeys(); |
16 | } | 17 | } |
17 | 18 | ||
18 | ImageView::~ImageView() | 19 | ImageView::~ImageView() |
19 | { | 20 | { |
21 | if (m_viewManager) { | ||
22 | delete m_viewManager; | ||
23 | } | ||
20 | } | 24 | } |
21 | 25 | ||
22 | Opie::Ui::OKeyConfigManager* ImageView::manager() | 26 | Opie::Ui::OKeyConfigManager* ImageView::manager() |
23 | { | 27 | { |
24 | if (!m_viewManager) { | 28 | if (!m_viewManager) { |
25 | initKeys(); | 29 | initKeys(); |
26 | } | 30 | } |
27 | return m_viewManager; | 31 | return m_viewManager; |
28 | } | 32 | } |
29 | 33 | ||
30 | void ImageView::initKeys() | 34 | void ImageView::initKeys() |
31 | { | 35 | { |
32 | odebug << "init imageview keys" << oendl; | 36 | odebug << "init imageview keys" << oendl; |
33 | m_cfg = new Opie::Core::OConfig("phunkview"); | 37 | if (!m_cfg) { |
34 | m_cfg->setGroup("Zecke_view" ); | 38 | m_cfg = new Opie::Core::OConfig("phunkview"); |
39 | m_cfg->setGroup("image_view_keys" ); | ||
40 | } | ||
35 | Opie::Ui::OKeyPair::List lst; | 41 | Opie::Ui::OKeyPair::List lst; |
36 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); | 42 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); |
37 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); | 43 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); |
38 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); | 44 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); |
39 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); | 45 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); |
40 | lst.append( Opie::Ui::OKeyPair::returnKey() ); | 46 | lst.append( Opie::Ui::OKeyPair::returnKey() ); |
41 | 47 | ||
42 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageview-KeyBoard-Config", | 48 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "image_view_keys", |
43 | lst, false,this, "keyconfig name" ); | 49 | lst, false,this, "image_view_keys" ); |
44 | m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Image Info"), "view", | 50 | m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", |
45 | Resource::loadPixmap("1to1"), ViewInfo, | 51 | Resource::loadPixmap("1to1"), ViewInfo, |
46 | Opie::Ui::OKeyPair(Qt::Key_I,Qt::ShiftButton), | 52 | Opie::Ui::OKeyPair(Qt::Key_I,Qt::ShiftButton), |
47 | this, SLOT(slotShowImageInfo()))); | 53 | this, SLOT(slotShowImageInfo()))); |
48 | m_viewManager->load(); | ||
49 | m_viewManager->handleWidget( this ); | 54 | m_viewManager->handleWidget( this ); |
55 | m_viewManager->load(); | ||
50 | } | 56 | } |
51 | 57 | ||
52 | void ImageView::slotShowImageInfo() | 58 | void ImageView::slotShowImageInfo() |
53 | { | 59 | { |
54 | emit dispImageInfo(m_lastName); | 60 | emit dispImageInfo(m_lastName); |
55 | } | 61 | } |
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 5ee0d7d..f61c93f 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -17,17 +17,17 @@ class ImageView:public ImageScrollView | |||
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | 19 | ||
20 | enum ActionIds { | 20 | enum ActionIds { |
21 | ViewInfo | 21 | ViewInfo |
22 | }; | 22 | }; |
23 | 23 | ||
24 | public: | 24 | public: |
25 | ImageView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); | 25 | ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); |
26 | virtual ~ImageView(); | 26 | virtual ~ImageView(); |
27 | Opie::Ui::OKeyConfigManager* manager(); | 27 | Opie::Ui::OKeyConfigManager* manager(); |
28 | 28 | ||
29 | signals: | 29 | signals: |
30 | void dispImageInfo(const QString&); | 30 | void dispImageInfo(const QString&); |
31 | void sig_return(); | 31 | void sig_return(); |
32 | 32 | ||
33 | protected: | 33 | protected: |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 529bee4..21a668a 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -190,32 +190,36 @@ void PMainWindow::slotConfig() { | |||
190 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); | 190 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); |
191 | delete it.key(); | 191 | delete it.key(); |
192 | } | 192 | } |
193 | 193 | ||
194 | 194 | ||
195 | if ( act ) { | 195 | if ( act ) { |
196 | m_view->resetView(); | 196 | m_view->resetView(); |
197 | keyWid->save(); | 197 | keyWid->save(); |
198 | m_disp->manager()->save(); | ||
199 | m_info->manager()->save(); | ||
200 | m_view->manager()->save(); | ||
198 | } | 201 | } |
202 | delete keyWid; | ||
199 | } | 203 | } |
200 | 204 | ||
201 | /* | 205 | /* |
202 | * create a new image info component | 206 | * create a new image info component |
203 | * and detach the current one | 207 | * and detach the current one |
204 | * we will make the other delete on exit | 208 | * we will make the other delete on exit |
205 | */ | 209 | */ |
206 | template<class T> | 210 | template<class T> |
207 | void PMainWindow::initT( const char* name, T** ptr, int id) { | 211 | void PMainWindow::initT( const char* name, T** ptr, int id) { |
208 | if ( *ptr ) { | 212 | if ( *ptr ) { |
209 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 213 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
210 | (*ptr)->setDestructiveClose(); | 214 | (*ptr)->setDestructiveClose(); |
211 | m_stack->removeWidget( *ptr ); | 215 | m_stack->removeWidget( *ptr ); |
212 | } | 216 | } |
213 | *ptr = new T( m_stack, name ); | 217 | *ptr = new T(m_cfg, m_stack, name ); |
214 | m_stack->addWidget( *ptr, id ); | 218 | m_stack->addWidget( *ptr, id ); |
215 | 219 | ||
216 | connect(*ptr, SIGNAL(sig_return()), | 220 | connect(*ptr, SIGNAL(sig_return()), |
217 | this,SLOT(slotReturn())); | 221 | this,SLOT(slotReturn())); |
218 | 222 | ||
219 | } | 223 | } |
220 | void PMainWindow::initInfo() { | 224 | void PMainWindow::initInfo() { |
221 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 225 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |