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 | |||
@@ -1,202 +1,205 @@ | |||
1 | #include "imageinfoui.h" | 1 | #include "imageinfoui.h" |
2 | 2 | ||
3 | #include <qframe.h> | 3 | #include <qframe.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qtextview.h> | 6 | #include <qtextview.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | #include <qvariant.h> | 8 | #include <qvariant.h> |
9 | #include <qtooltip.h> | 9 | #include <qtooltip.h> |
10 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
11 | #include <qimage.h> | 11 | #include <qimage.h> |
12 | #include <qpixmap.h> | 12 | #include <qpixmap.h> |
13 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | 15 | ||
16 | #include "lib/slavemaster.h" | 16 | #include "lib/slavemaster.h" |
17 | #include "lib/imagecache.h" | 17 | #include "lib/imagecache.h" |
18 | 18 | ||
19 | #include <opie2/oconfig.h> | 19 | #include <opie2/oconfig.h> |
20 | #include <opie2/okeyconfigwidget.h> | 20 | #include <opie2/okeyconfigwidget.h> |
21 | #include <opie2/odebug.h> | 21 | #include <opie2/odebug.h> |
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 | ||
78 | void imageinfo::slotShowImage() | 84 | void imageinfo::slotShowImage() |
79 | { | 85 | { |
80 | emit dispImage(currentFile); | 86 | emit dispImage(currentFile); |
81 | } | 87 | } |
82 | 88 | ||
83 | void imageinfo::init(const char* name) { | 89 | void imageinfo::init(const char* name) { |
84 | { | 90 | { |
85 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 91 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
86 | } | 92 | } |
87 | if ( !name ) | 93 | if ( !name ) |
88 | setName( "imageinfo" ); | 94 | setName( "imageinfo" ); |
89 | resize( 289, 335 ); | 95 | resize( 289, 335 ); |
90 | setCaption( tr( "Image info" ) ); | 96 | setCaption( tr( "Image info" ) ); |
91 | imageinfoLayout = new QVBoxLayout( this ); | 97 | imageinfoLayout = new QVBoxLayout( this ); |
92 | imageinfoLayout->setSpacing(2); | 98 | imageinfoLayout->setSpacing(2); |
93 | imageinfoLayout->setMargin(4); | 99 | imageinfoLayout->setMargin(4); |
94 | 100 | ||
95 | PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); | 101 | PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); |
96 | PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); | 102 | PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); |
97 | QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); | 103 | QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); |
98 | 104 | ||
99 | imageinfoLayout->addWidget( PixmapLabel1 ); | 105 | imageinfoLayout->addWidget( PixmapLabel1 ); |
100 | 106 | ||
101 | Line1 = new QFrame( this, "Line1" ); | 107 | Line1 = new QFrame( this, "Line1" ); |
102 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 108 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
103 | imageinfoLayout->addWidget( Line1 ); | 109 | imageinfoLayout->addWidget( Line1 ); |
104 | 110 | ||
105 | fnameLabel = new QLabel( this, "FnameLabel" ); | 111 | fnameLabel = new QLabel( this, "FnameLabel" ); |
106 | imageinfoLayout->addWidget( fnameLabel); | 112 | imageinfoLayout->addWidget( fnameLabel); |
107 | 113 | ||
108 | TextView1 = new QTextView( this, "TextView1" ); | 114 | TextView1 = new QTextView( this, "TextView1" ); |
109 | TextView1->setFrameShadow( QTextView::Sunken ); | 115 | TextView1->setFrameShadow( QTextView::Sunken ); |
110 | TextView1->setResizePolicy( QTextView::AutoOneFit ); | 116 | TextView1->setResizePolicy( QTextView::AutoOneFit ); |
111 | TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); | 117 | TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); |
112 | TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); | 118 | TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); |
113 | // TextView1->setVScrollBarMode(QScrollView::AlwaysOn); | 119 | // TextView1->setVScrollBarMode(QScrollView::AlwaysOn); |
114 | QWhatsThis::add( TextView1, tr("Displays info of selected image") ); | 120 | QWhatsThis::add( TextView1, tr("Displays info of selected image") ); |
115 | imageinfoLayout->addWidget( TextView1 ); | 121 | imageinfoLayout->addWidget( TextView1 ); |
116 | 122 | ||
117 | SlaveMaster* master = SlaveMaster::self(); | 123 | SlaveMaster* master = SlaveMaster::self(); |
118 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), | 124 | connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), |
119 | this, SLOT(slot_fullInfo(const QString&, const QString&)) ); | 125 | this, SLOT(slot_fullInfo(const QString&, const QString&)) ); |
120 | connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | 126 | connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), |
121 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | 127 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); |
122 | } | 128 | } |
123 | 129 | ||
124 | void imageinfo::slotChangeName(const QString&_path) | 130 | void imageinfo::slotChangeName(const QString&_path) |
125 | { | 131 | { |
126 | currentFile=_path; | 132 | currentFile=_path; |
127 | QFileInfo fi(_path); | 133 | QFileInfo fi(_path); |
128 | fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>"); | 134 | fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>"); |
129 | SlaveMaster::self()->imageInfo( currentFile ); | 135 | SlaveMaster::self()->imageInfo( currentFile ); |
130 | 136 | ||
131 | QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); | 137 | QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); |
132 | if (!m_pix) { | 138 | if (!m_pix) { |
133 | PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); | 139 | PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); |
134 | SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); | 140 | SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); |
135 | } else { | 141 | } else { |
136 | PixmapLabel1->setPixmap(*m_pix); | 142 | PixmapLabel1->setPixmap(*m_pix); |
137 | } | 143 | } |
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) { |
167 | PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); | 170 | PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); |
168 | PixmapLabel1->setPixmap( _pix ); | 171 | PixmapLabel1->setPixmap( _pix ); |
169 | PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); | 172 | PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); |
170 | } | 173 | } |
171 | } | 174 | } |
172 | } | 175 | } |
173 | 176 | ||
174 | void imageinfo::setPath( const QString& str ) { | 177 | void imageinfo::setPath( const QString& str ) { |
175 | slotChangeName( str ); | 178 | slotChangeName( str ); |
176 | } | 179 | } |
177 | 180 | ||
178 | void imageinfo::setDestructiveClose() { | 181 | void imageinfo::setDestructiveClose() { |
179 | WFlags fl = getWFlags(); | 182 | WFlags fl = getWFlags(); |
180 | /* clear it just in case */ | 183 | /* clear it just in case */ |
181 | fl &= ~WDestructiveClose; | 184 | fl &= ~WDestructiveClose; |
182 | fl |= WDestructiveClose; | 185 | fl |= WDestructiveClose; |
183 | setWFlags( fl ); | 186 | setWFlags( fl ); |
184 | } | 187 | } |
185 | 188 | ||
186 | 189 | ||
187 | /* for testing */ | 190 | /* for testing */ |
188 | infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name) | 191 | infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name) |
189 | :QDialog(parent,name,true,WStyle_ContextHelp) | 192 | :QDialog(parent,name,true,WStyle_ContextHelp) |
190 | { | 193 | { |
191 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 194 | QVBoxLayout*dlglayout = new QVBoxLayout(this); |
192 | dlglayout->setSpacing(2); | 195 | dlglayout->setSpacing(2); |
193 | dlglayout->setMargin(1); | 196 | dlglayout->setMargin(1); |
194 | imageinfo*inf = new imageinfo(fname,this); | 197 | imageinfo*inf = new imageinfo(fname,this); |
195 | dlglayout->addWidget(inf); | 198 | dlglayout->addWidget(inf); |
196 | } | 199 | } |
197 | 200 | ||
198 | infoDlg::~infoDlg() | 201 | infoDlg::~infoDlg() |
199 | { | 202 | { |
200 | } | 203 | } |
201 | 204 | ||
202 | 205 | ||
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 | |||
@@ -1,78 +1,78 @@ | |||
1 | #ifndef IMAGEINFO_H | 1 | #ifndef IMAGEINFO_H |
2 | #define IMAGEINFO_H | 2 | #define IMAGEINFO_H |
3 | 3 | ||
4 | #include <qvariant.h> | 4 | #include <qvariant.h> |
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | #include <qdialog.h> | 6 | #include <qdialog.h> |
7 | 7 | ||
8 | class QVBoxLayout; | 8 | class QVBoxLayout; |
9 | class QHBoxLayout; | 9 | class QHBoxLayout; |
10 | class QGridLayout; | 10 | class QGridLayout; |
11 | class QFrame; | 11 | class QFrame; |
12 | class QLabel; | 12 | class QLabel; |
13 | class QTextView; | 13 | class QTextView; |
14 | 14 | ||
15 | namespace Opie { | 15 | namespace Opie { |
16 | namespace Core { | 16 | namespace Core { |
17 | class OConfig; | 17 | class OConfig; |
18 | } | 18 | } |
19 | namespace Ui { | 19 | namespace Ui { |
20 | class OKeyConfigManager; | 20 | class OKeyConfigManager; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
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&); |
41 | void sig_return(); | 41 | void sig_return(); |
42 | 42 | ||
43 | public slots: | 43 | public slots: |
44 | virtual void setPath( const QString& path ); | 44 | virtual void setPath( const QString& path ); |
45 | virtual void slotShowImage(); | 45 | virtual void slotShowImage(); |
46 | 46 | ||
47 | private: | 47 | private: |
48 | void init(const char* name); | 48 | void init(const char* name); |
49 | 49 | ||
50 | protected: | 50 | protected: |
51 | QLabel* PixmapLabel1; | 51 | QLabel* PixmapLabel1; |
52 | QLabel* fnameLabel; | 52 | QLabel* fnameLabel; |
53 | QFrame* Line1; | 53 | QFrame* Line1; |
54 | QTextView* TextView1; | 54 | QTextView* TextView1; |
55 | QVBoxLayout* imageinfoLayout; | 55 | QVBoxLayout* imageinfoLayout; |
56 | QString currentFile; | 56 | QString currentFile; |
57 | 57 | ||
58 | Opie::Core::OConfig * m_cfg; | 58 | Opie::Core::OConfig * m_cfg; |
59 | Opie::Ui::OKeyConfigManager*m_viewManager; | 59 | Opie::Ui::OKeyConfigManager*m_viewManager; |
60 | void initKeys(); | 60 | void initKeys(); |
61 | 61 | ||
62 | protected slots: | 62 | protected slots: |
63 | virtual void slot_fullInfo(const QString&, const QString&); | 63 | virtual void slot_fullInfo(const QString&, const QString&); |
64 | virtual void slotThumbNail(const QString&, const QPixmap&); | 64 | virtual void slotThumbNail(const QString&, const QPixmap&); |
65 | 65 | ||
66 | virtual void slotChangeName(const QString&); | 66 | virtual void slotChangeName(const QString&); |
67 | }; | 67 | }; |
68 | 68 | ||
69 | /* for testing purpose */ | 69 | /* for testing purpose */ |
70 | class infoDlg:public QDialog | 70 | class infoDlg:public QDialog |
71 | { | 71 | { |
72 | Q_OBJECT | 72 | Q_OBJECT |
73 | public: | 73 | public: |
74 | infoDlg(const QString&,QWidget * parent=0, const char * name=0); | 74 | infoDlg(const QString&,QWidget * parent=0, const char * name=0); |
75 | virtual ~infoDlg(); | 75 | virtual ~infoDlg(); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | #endif // IMAGEINFO_H | 78 | #endif // IMAGEINFO_H |
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 | |||
@@ -1,55 +1,61 @@ | |||
1 | #include "imageview.h" | 1 | #include "imageview.h" |
2 | 2 | ||
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 | |||
@@ -1,40 +1,40 @@ | |||
1 | #ifndef _IMAGE_VIEW_H | 1 | #ifndef _IMAGE_VIEW_H |
2 | #define _IMAGE_VIEW_H | 2 | #define _IMAGE_VIEW_H |
3 | 3 | ||
4 | /* must be changed when it will moved to Opie::MM */ | 4 | /* must be changed when it will moved to Opie::MM */ |
5 | #include "imagescrollview.h" | 5 | #include "imagescrollview.h" |
6 | 6 | ||
7 | namespace Opie { | 7 | namespace Opie { |
8 | namespace Core { | 8 | namespace Core { |
9 | class OConfig; | 9 | class OConfig; |
10 | } | 10 | } |
11 | namespace Ui { | 11 | namespace Ui { |
12 | class OKeyConfigManager; | 12 | class OKeyConfigManager; |
13 | } | 13 | } |
14 | } | 14 | } |
15 | 15 | ||
16 | class ImageView:public ImageScrollView | 16 | 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: |
34 | Opie::Core::OConfig * m_cfg; | 34 | Opie::Core::OConfig * m_cfg; |
35 | Opie::Ui::OKeyConfigManager*m_viewManager; | 35 | Opie::Ui::OKeyConfigManager*m_viewManager; |
36 | void initKeys(); | 36 | void initKeys(); |
37 | protected slots: | 37 | protected slots: |
38 | virtual void slotShowImageInfo(); | 38 | virtual void slotShowImageInfo(); |
39 | }; | 39 | }; |
40 | #endif | 40 | #endif |
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 | |||
@@ -150,112 +150,116 @@ void PMainWindow::slotConfig() { | |||
150 | for( ; _it != vM->end(); ++_it ) { | 150 | for( ; _it != vM->end(); ++_it ) { |
151 | PDirView *view = (_it.data())(*m_cfg); | 151 | PDirView *view = (_it.data())(*m_cfg); |
152 | PInterfaceInfo *inf = view->interfaceInfo(); | 152 | PInterfaceInfo *inf = view->interfaceInfo(); |
153 | QWidget *_wid = inf->configWidget( *m_cfg ); | 153 | QWidget *_wid = inf->configWidget( *m_cfg ); |
154 | _wid->reparent(wid, QPoint() ); | 154 | _wid->reparent(wid, QPoint() ); |
155 | lst.insert( view, _wid ); | 155 | lst.insert( view, _wid ); |
156 | wid->addTab( _wid, "fileopen", inf->name() ); | 156 | wid->addTab( _wid, "fileopen", inf->name() ); |
157 | } | 157 | } |
158 | 158 | ||
159 | /* | 159 | /* |
160 | * Add the KeyConfigWidget | 160 | * Add the KeyConfigWidget |
161 | */ | 161 | */ |
162 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | 162 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); |
163 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | 163 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); |
164 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | 164 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); |
165 | 165 | ||
166 | if ( !m_info ) { | 166 | if ( !m_info ) { |
167 | initInfo(); | 167 | initInfo(); |
168 | } | 168 | } |
169 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); | 169 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); |
170 | 170 | ||
171 | if ( !m_disp ) { | 171 | if ( !m_disp ) { |
172 | initDisp(); | 172 | initDisp(); |
173 | } | 173 | } |
174 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); | 174 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); |
175 | 175 | ||
176 | keyWid->load(); | 176 | keyWid->load(); |
177 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | 177 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); |
178 | 178 | ||
179 | 179 | ||
180 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); | 180 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); |
181 | 181 | ||
182 | /* | 182 | /* |
183 | * clean up | 183 | * clean up |
184 | *apply changes | 184 | *apply changes |
185 | */ | 185 | */ |
186 | 186 | ||
187 | QMap<PDirView*, QWidget*>::Iterator it; | 187 | QMap<PDirView*, QWidget*>::Iterator it; |
188 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 188 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
189 | if ( act ) | 189 | if ( act ) |
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 ); |
222 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 226 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
223 | } | 227 | } |
224 | void PMainWindow::initDisp() { | 228 | void PMainWindow::initDisp() { |
225 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 229 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
226 | if (m_disp) { | 230 | if (m_disp) { |
227 | m_disp->setAutoScale(autoScale); | 231 | m_disp->setAutoScale(autoScale); |
228 | m_disp->setAutoRotate(autoRotate); | 232 | m_disp->setAutoRotate(autoRotate); |
229 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 233 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
230 | } | 234 | } |
231 | } | 235 | } |
232 | 236 | ||
233 | /** | 237 | /** |
234 | * With big Screen the plan could be to 'detach' the image | 238 | * With big Screen the plan could be to 'detach' the image |
235 | * window if visible and to create a ne wone | 239 | * window if visible and to create a ne wone |
236 | * init* already supports it but I make no use of it for | 240 | * init* already supports it but I make no use of it for |
237 | * now. We set filename and raise | 241 | * now. We set filename and raise |
238 | * | 242 | * |
239 | * ### FIXME and talk to alwin | 243 | * ### FIXME and talk to alwin |
240 | */ | 244 | */ |
241 | void PMainWindow::slotShowInfo( const QString& inf ) { | 245 | void PMainWindow::slotShowInfo( const QString& inf ) { |
242 | if ( !m_info ) { | 246 | if ( !m_info ) { |
243 | initInfo(); | 247 | initInfo(); |
244 | } | 248 | } |
245 | m_info->setPath( inf ); | 249 | m_info->setPath( inf ); |
246 | m_stack->raiseWidget( ImageInfo ); | 250 | m_stack->raiseWidget( ImageInfo ); |
247 | } | 251 | } |
248 | 252 | ||
249 | void PMainWindow::slotDisplay( const QString& inf ) { | 253 | void PMainWindow::slotDisplay( const QString& inf ) { |
250 | if ( !m_disp ) { | 254 | if ( !m_disp ) { |
251 | initDisp(); | 255 | initDisp(); |
252 | } | 256 | } |
253 | m_disp->setImage( inf ); | 257 | m_disp->setImage( inf ); |
254 | m_stack->raiseWidget( ImageDisplay ); | 258 | m_stack->raiseWidget( ImageDisplay ); |
255 | } | 259 | } |
256 | 260 | ||
257 | void PMainWindow::slotReturn() { | 261 | void PMainWindow::slotReturn() { |
258 | raiseIconView(); | 262 | raiseIconView(); |
259 | } | 263 | } |
260 | 264 | ||
261 | 265 | ||