Diffstat (limited to 'noncore/graphics/opie-eye/gui') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 7 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 54 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 4 |
5 files changed, 45 insertions, 23 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index e70d6a6..7afb62d 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp | |||
@@ -11,97 +11,96 @@ | |||
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(Opie::Core::OConfig *cfg,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 | m_cfg = cfg; |
35 | init(name); | 35 | init(name); |
36 | initKeys(); | 36 | initKeys(); |
37 | } | 37 | } |
38 | 38 | ||
39 | 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 ) |
40 | : QWidget( parent, name, fl ),currentFile(_path) | 40 | : QWidget( parent, name, fl ),currentFile(_path) |
41 | { | 41 | { |
42 | m_viewManager = 0; | 42 | m_viewManager = 0; |
43 | m_cfg = 0; | 43 | m_cfg = 0; |
44 | init(name); | 44 | init(name); |
45 | initKeys(); | 45 | initKeys(); |
46 | slotChangeName(_path); | 46 | slotChangeName(_path); |
47 | } | 47 | } |
48 | 48 | ||
49 | Opie::Core::OKeyConfigManager* imageinfo::manager() | 49 | Opie::Core::OKeyConfigManager* imageinfo::manager() |
50 | { | 50 | { |
51 | if (!m_viewManager) { | 51 | if (!m_viewManager) { |
52 | initKeys(); | 52 | initKeys(); |
53 | } | 53 | } |
54 | return m_viewManager; | 54 | return m_viewManager; |
55 | } | 55 | } |
56 | 56 | ||
57 | void imageinfo::initKeys() | 57 | void imageinfo::initKeys() |
58 | { | 58 | { |
59 | odebug << "init imageinfo keys" << oendl; | ||
60 | #if 0 | 59 | #if 0 |
61 | if (!m_cfg) { | 60 | if (!m_cfg) { |
62 | m_cfg = new Opie::Core::OConfig("phunkview"); | 61 | m_cfg = new Opie::Core::OConfig("phunkview"); |
63 | m_cfg->setGroup("imageinfo_keys" ); | 62 | m_cfg->setGroup("imageinfo_keys" ); |
64 | } | 63 | } |
65 | #endif | 64 | #endif |
66 | Opie::Core::OKeyPair::List lst; | 65 | Opie::Core::OKeyPair::List lst; |
67 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 66 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
68 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 67 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
69 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 68 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
70 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 69 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
71 | lst.append( Opie::Core::OKeyPair::returnKey() ); | 70 | lst.append( Opie::Core::OKeyPair::returnKey() ); |
72 | 71 | ||
73 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "imageinfo_keys", | 72 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "imageinfo_keys", |
74 | lst, false,this, "keyconfig name" ); | 73 | lst, false,this, "keyconfig name" ); |
75 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Full Image"), "infoview", | 74 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Full Image"), "infoview", |
76 | Resource::loadPixmap("1to1"), ViewItem, | 75 | Resource::loadPixmap("1to1"), ViewItem, |
77 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), | 76 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), |
78 | this, SLOT(slotShowImage()))); | 77 | this, SLOT(slotShowImage()))); |
79 | m_viewManager->load(); | 78 | m_viewManager->load(); |
80 | m_viewManager->handleWidget( this ); | 79 | m_viewManager->handleWidget( this ); |
81 | m_viewManager->handleWidget( TextView1 ); | 80 | m_viewManager->handleWidget( TextView1 ); |
82 | } | 81 | } |
83 | 82 | ||
84 | void imageinfo::slotShowImage() | 83 | void imageinfo::slotShowImage() |
85 | { | 84 | { |
86 | emit dispImage(currentFile); | 85 | emit dispImage(currentFile); |
87 | } | 86 | } |
88 | 87 | ||
89 | void imageinfo::init(const char* name) { | 88 | void imageinfo::init(const char* name) { |
90 | { | 89 | { |
91 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 90 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
92 | } | 91 | } |
93 | if ( !name ) | 92 | if ( !name ) |
94 | setName( "imageinfo" ); | 93 | setName( "imageinfo" ); |
95 | resize( 289, 335 ); | 94 | resize( 289, 335 ); |
96 | setCaption( tr( "Image info" ) ); | 95 | setCaption( tr( "Image info" ) ); |
97 | imageinfoLayout = new QVBoxLayout( this ); | 96 | imageinfoLayout = new QVBoxLayout( this ); |
98 | imageinfoLayout->setSpacing(2); | 97 | imageinfoLayout->setSpacing(2); |
99 | imageinfoLayout->setMargin(4); | 98 | imageinfoLayout->setMargin(4); |
100 | 99 | ||
101 | PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); | 100 | PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); |
102 | PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); | 101 | PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); |
103 | QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); | 102 | QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); |
104 | 103 | ||
105 | imageinfoLayout->addWidget( PixmapLabel1 ); | 104 | imageinfoLayout->addWidget( PixmapLabel1 ); |
106 | 105 | ||
107 | Line1 = new QFrame( this, "Line1" ); | 106 | Line1 = new QFrame( this, "Line1" ); |
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index c7e48cb..86db732 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -42,97 +42,97 @@ ImageView::~ImageView() | |||
42 | delete m_viewManager; | 42 | delete m_viewManager; |
43 | } | 43 | } |
44 | 44 | ||
45 | Opie::Core::OKeyConfigManager* ImageView::manager() | 45 | Opie::Core::OKeyConfigManager* ImageView::manager() |
46 | { | 46 | { |
47 | if (!m_viewManager) { | 47 | if (!m_viewManager) { |
48 | initKeys(); | 48 | initKeys(); |
49 | } | 49 | } |
50 | return m_viewManager; | 50 | return m_viewManager; |
51 | } | 51 | } |
52 | 52 | ||
53 | void ImageView::startSlide(int value) | 53 | void ImageView::startSlide(int value) |
54 | { | 54 | { |
55 | if (!m_slideTimer) { | 55 | if (!m_slideTimer) { |
56 | m_slideTimer = new QTimer(this); | 56 | m_slideTimer = new QTimer(this); |
57 | } | 57 | } |
58 | m_slideValue=value; | 58 | m_slideValue=value; |
59 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); | 59 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); |
60 | m_slideTimer->start(m_slideValue*1000,true); | 60 | m_slideTimer->start(m_slideValue*1000,true); |
61 | } | 61 | } |
62 | 62 | ||
63 | void ImageView::stopSlide() | 63 | void ImageView::stopSlide() |
64 | { | 64 | { |
65 | if (!m_slideTimer) { | 65 | if (!m_slideTimer) { |
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | m_slideTimer->stop(); | 68 | m_slideTimer->stop(); |
69 | delete m_slideTimer; | 69 | delete m_slideTimer; |
70 | m_slideTimer = 0; | 70 | m_slideTimer = 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | void ImageView::nextSlide() | 73 | void ImageView::nextSlide() |
74 | { | 74 | { |
75 | if (!m_slideTimer) { | 75 | if (!m_slideTimer) { |
76 | return; | 76 | return; |
77 | } | 77 | } |
78 | if (isHidden()) { | 78 | if (isHidden()) { |
79 | delete m_slideTimer; | 79 | delete m_slideTimer; |
80 | m_slideTimer = 0; | 80 | m_slideTimer = 0; |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | emit dispNext(); | 83 | emit dispNext(); |
84 | m_slideTimer->start(m_slideValue*1000,true); | 84 | m_slideTimer->start(m_slideValue*1000,true); |
85 | } | 85 | } |
86 | void ImageView::initKeys() | 86 | void ImageView::initKeys() |
87 | { | 87 | { |
88 | odebug << "init imageview keys" << oendl; | 88 | odebug << "init imageview keys" << oendl; |
89 | if (!m_cfg) { | 89 | if (!m_cfg) { |
90 | m_cfg = new Opie::Core::OConfig("phunkview"); | 90 | m_cfg = new Opie::Core::OConfig("opie-eye"); |
91 | m_cfg->setGroup("image_view_keys" ); | 91 | m_cfg->setGroup("image_view_keys" ); |
92 | } | 92 | } |
93 | Opie::Core::OKeyPair::List lst; | 93 | Opie::Core::OKeyPair::List lst; |
94 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 94 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
95 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 95 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
96 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 96 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
97 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 97 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
98 | lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); | 98 | lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); |
99 | 99 | ||
100 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", | 100 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", |
101 | lst, false,this, "image_view_keys" ); | 101 | lst, false,this, "image_view_keys" ); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Handle KeyEvents when they're pressed. This avoids problems | 104 | * Handle KeyEvents when they're pressed. This avoids problems |
105 | * with 'double next' on Return. | 105 | * with 'double next' on Return. |
106 | * The Return press would switch to this view and the return | 106 | * The Return press would switch to this view and the return |
107 | * release would emit the dispNext Signal. | 107 | * release would emit the dispNext Signal. |
108 | */ | 108 | */ |
109 | m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); | 109 | m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); |
110 | 110 | ||
111 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", | 111 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", |
112 | Resource::loadPixmap("1to1"), ViewInfo, | 112 | Resource::loadPixmap("1to1"), ViewInfo, |
113 | Opie::Core::OKeyPair(Qt::Key_I,0), | 113 | Opie::Core::OKeyPair(Qt::Key_I,0), |
114 | this, SLOT(slotShowImageInfo()))); | 114 | this, SLOT(slotShowImageInfo()))); |
115 | 115 | ||
116 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", | 116 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", |
117 | Resource::loadPixmap("rotate"), Autorotate, | 117 | Resource::loadPixmap("rotate"), Autorotate, |
118 | Opie::Core::OKeyPair(Qt::Key_R,0), | 118 | Opie::Core::OKeyPair(Qt::Key_R,0), |
119 | this, SIGNAL(toggleAutorotate()))); | 119 | this, SIGNAL(toggleAutorotate()))); |
120 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", | 120 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", |
121 | Resource::loadPixmap("1to1"), Autoscale, | 121 | Resource::loadPixmap("1to1"), Autoscale, |
122 | Opie::Core::OKeyPair(Qt::Key_S,0), | 122 | Opie::Core::OKeyPair(Qt::Key_S,0), |
123 | this, SIGNAL(toggleAutoscale()))); | 123 | this, SIGNAL(toggleAutoscale()))); |
124 | 124 | ||
125 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", | 125 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", |
126 | Resource::loadPixmap("forward"), ShowNext, | 126 | Resource::loadPixmap("forward"), ShowNext, |
127 | Opie::Core::OKeyPair(Qt::Key_Return,0), | 127 | Opie::Core::OKeyPair(Qt::Key_Return,0), |
128 | this, SIGNAL(dispNext()))); | 128 | this, SIGNAL(dispNext()))); |
129 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", | 129 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", |
130 | Resource::loadPixmap("back"), ShowPrevious, | 130 | Resource::loadPixmap("back"), ShowPrevious, |
131 | Opie::Core::OKeyPair(Qt::Key_P,0), | 131 | Opie::Core::OKeyPair(Qt::Key_P,0), |
132 | this, SIGNAL(dispPrev()))); | 132 | this, SIGNAL(dispPrev()))); |
133 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", | 133 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", |
134 | Resource::loadPixmap("fullscreen"), FullScreen, | 134 | Resource::loadPixmap("fullscreen"), FullScreen, |
135 | Opie::Core::OKeyPair(Qt::Key_F,0), | 135 | Opie::Core::OKeyPair(Qt::Key_F,0), |
136 | this, SIGNAL(toggleFullScreen()))); | 136 | this, SIGNAL(toggleFullScreen()))); |
137 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", | 137 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", |
138 | Resource::loadPixmap("mag"), Zoomer, | 138 | Resource::loadPixmap("mag"), Zoomer, |
@@ -145,94 +145,93 @@ void ImageView::initKeys() | |||
145 | void ImageView::keyReleaseEvent(QKeyEvent * e) | 145 | void ImageView::keyReleaseEvent(QKeyEvent * e) |
146 | { | 146 | { |
147 | if (!e || e->state()!=0) { | 147 | if (!e || e->state()!=0) { |
148 | return; | 148 | return; |
149 | } | 149 | } |
150 | if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); | 150 | if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); |
151 | } | 151 | } |
152 | 152 | ||
153 | void ImageView::slotShowImageInfo() | 153 | void ImageView::slotShowImageInfo() |
154 | { | 154 | { |
155 | emit dispImageInfo(m_lastName); | 155 | emit dispImageInfo(m_lastName); |
156 | } | 156 | } |
157 | 157 | ||
158 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | 158 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) |
159 | { | 159 | { |
160 | if (e->button()==1) { | 160 | if (e->button()==1) { |
161 | return OImageScrollView::contentsMousePressEvent(e); | 161 | return OImageScrollView::contentsMousePressEvent(e); |
162 | } | 162 | } |
163 | odebug << "Popup " << oendl; | 163 | odebug << "Popup " << oendl; |
164 | QPopupMenu *m = new QPopupMenu(0); | 164 | QPopupMenu *m = new QPopupMenu(0); |
165 | if (!m) return; | 165 | if (!m) return; |
166 | if (m_hGroup) { | 166 | if (m_hGroup) { |
167 | m_hGroup->addTo(m); | 167 | m_hGroup->addTo(m); |
168 | } | 168 | } |
169 | if (fullScreen()) { | 169 | if (fullScreen()) { |
170 | if (m_gPrevNext) { | 170 | if (m_gPrevNext) { |
171 | m->insertSeparator(); | 171 | m->insertSeparator(); |
172 | m_gPrevNext->addTo(m); | 172 | m_gPrevNext->addTo(m); |
173 | } | 173 | } |
174 | if (m_gDisplayType) { | 174 | if (m_gDisplayType) { |
175 | m->insertSeparator(); | 175 | m->insertSeparator(); |
176 | m_gDisplayType->addTo(m); | 176 | m_gDisplayType->addTo(m); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | m->setFocus(); | 179 | m->setFocus(); |
180 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 180 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
181 | if (m_hGroup) { | 181 | if (m_hGroup) { |
182 | m_hGroup->removeFrom(m); | 182 | m_hGroup->removeFrom(m); |
183 | } | 183 | } |
184 | if (m_gPrevNext) { | 184 | if (m_gPrevNext) { |
185 | m_gPrevNext->removeFrom(m); | 185 | m_gPrevNext->removeFrom(m); |
186 | } | 186 | } |
187 | if (m_gDisplayType) { | 187 | if (m_gDisplayType) { |
188 | m_gDisplayType->removeFrom(m); | 188 | m_gDisplayType->removeFrom(m); |
189 | } | 189 | } |
190 | delete m; | 190 | delete m; |
191 | } | 191 | } |
192 | 192 | ||
193 | void ImageView::setFullScreen(bool how) | 193 | void ImageView::setFullScreen(bool how,bool force) |
194 | { | 194 | { |
195 | m_isFullScreen = how; | 195 | m_isFullScreen = how; |
196 | if (how) { | 196 | if (how) { |
197 | m_ignore_next_in = true; | 197 | m_ignore_next_in = true; |
198 | setFixedSize(qApp->desktop()->size()); | 198 | setFixedSize(qApp->desktop()->size()); |
199 | showFullScreen(); | 199 | if (force) showFullScreen(); |
200 | } else { | 200 | } else { |
201 | setMinimumSize(10,10); | 201 | setMinimumSize(10,10); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | void ImageView::focusInEvent(QFocusEvent *) | 205 | void ImageView::focusInEvent(QFocusEvent *) |
206 | { | 206 | { |
207 | // Always do it here, no matter the size. | 207 | // Always do it here, no matter the size. |
208 | odebug << "Focus in (view)" << oendl; | 208 | odebug << "Focus in (view)" << oendl; |
209 | //if (fullScreen()) parentWidget()->showNormal(); | 209 | //if (fullScreen()) parentWidget()->showNormal(); |
210 | if (m_ignore_next_in){m_ignore_next_in=false;return;} | 210 | if (m_ignore_next_in){m_ignore_next_in=false;return;} |
211 | if (fullScreen()) enableFullscreen(); | 211 | if (fullScreen()) enableFullscreen(); |
212 | } | 212 | } |
213 | 213 | ||
214 | void ImageView::hide() | 214 | void ImageView::hide() |
215 | { | 215 | { |
216 | if (fullScreen()) { | 216 | if (fullScreen()) { |
217 | m_ignore_next_in = true; | 217 | m_ignore_next_in = true; |
218 | showNormal(); | 218 | showNormal(); |
219 | } | 219 | } |
220 | QWidget::hide(); | 220 | QWidget::hide(); |
221 | } | 221 | } |
222 | void ImageView::enableFullscreen() | 222 | void ImageView::enableFullscreen() |
223 | { | 223 | { |
224 | if (!fullScreen()) return; | 224 | if (!fullScreen()) return; |
225 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} | 225 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} |
226 | 226 | ||
227 | setUpdatesEnabled(false); | 227 | setUpdatesEnabled(false); |
228 | // This is needed because showNormal() forcefully changes the window | 228 | // This is needed because showNormal() forcefully changes the window |
229 | // style to WSTyle_TopLevel. | 229 | // style to WSTyle_TopLevel. |
230 | reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 230 | reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
231 | // Enable fullscreen. | 231 | // Enable fullscreen. |
232 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus | 232 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus |
233 | * so we must block it here! */ | 233 | * so we must block it here! */ |
234 | m_ignore_next_in = true; | 234 | m_ignore_next_in = true; |
235 | showFullScreen(); | 235 | showFullScreen(); |
236 | setUpdatesEnabled(true); | 236 | setUpdatesEnabled(true); |
237 | |||
238 | } | 237 | } |
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index 640905a..2408211 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -1,76 +1,76 @@ | |||
1 | #ifndef _IMAGE_VIEW_H | 1 | #ifndef _IMAGE_VIEW_H |
2 | #define _IMAGE_VIEW_H | 2 | #define _IMAGE_VIEW_H |
3 | 3 | ||
4 | #include <opie2/oimagescrollview.h> | 4 | #include <opie2/oimagescrollview.h> |
5 | 5 | ||
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | 7 | ||
8 | class QTimer; | 8 | class QTimer; |
9 | class QActionGroup; | 9 | class QActionGroup; |
10 | class QAction; | 10 | class QAction; |
11 | 11 | ||
12 | namespace Opie { | 12 | namespace Opie { |
13 | namespace Core { | 13 | namespace Core { |
14 | class OConfig; | 14 | class OConfig; |
15 | class OKeyConfigManager; | 15 | class OKeyConfigManager; |
16 | } | 16 | } |
17 | } | 17 | } |
18 | 18 | ||
19 | class ImageView:public Opie::MM::OImageScrollView | 19 | class ImageView:public Opie::MM::OImageScrollView |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | 22 | ||
23 | enum ActionIds { | 23 | enum ActionIds { |
24 | ViewInfo, | 24 | ViewInfo, |
25 | FullScreen, | 25 | FullScreen, |
26 | ShowNext, | 26 | ShowNext, |
27 | ShowPrevious, | 27 | ShowPrevious, |
28 | Zoomer, | 28 | Zoomer, |
29 | Autorotate, | 29 | Autorotate, |
30 | Autoscale | 30 | Autoscale |
31 | }; | 31 | }; |
32 | 32 | ||
33 | public: | 33 | public: |
34 | ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 ); | 34 | ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 ); |
35 | virtual ~ImageView(); | 35 | virtual ~ImageView(); |
36 | Opie::Core::OKeyConfigManager* manager(); | 36 | Opie::Core::OKeyConfigManager* manager(); |
37 | void setFullScreen(bool how); | 37 | void setFullScreen(bool how,bool force=true); |
38 | bool fullScreen(){return m_isFullScreen;} | 38 | bool fullScreen(){return m_isFullScreen;} |
39 | virtual void enableFullscreen(); | 39 | virtual void enableFullscreen(); |
40 | void stopSlide(); | 40 | void stopSlide(); |
41 | void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); | 41 | void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); |
42 | 42 | ||
43 | signals: | 43 | signals: |
44 | void dispImageInfo(const QString&); | 44 | void dispImageInfo(const QString&); |
45 | void dispNext(); | 45 | void dispNext(); |
46 | void dispPrev(); | 46 | void dispPrev(); |
47 | void toggleFullScreen(); | 47 | void toggleFullScreen(); |
48 | void hideMe(); | 48 | void hideMe(); |
49 | void toggleZoomer(); | 49 | void toggleZoomer(); |
50 | void toggleAutoscale(); | 50 | void toggleAutoscale(); |
51 | void toggleAutorotate(); | 51 | void toggleAutorotate(); |
52 | 52 | ||
53 | protected: | 53 | protected: |
54 | Opie::Core::OConfig * m_cfg; | 54 | Opie::Core::OConfig * m_cfg; |
55 | Opie::Core::OKeyConfigManager*m_viewManager; | 55 | Opie::Core::OKeyConfigManager*m_viewManager; |
56 | void initKeys(); | 56 | void initKeys(); |
57 | bool m_isFullScreen:1; | 57 | bool m_isFullScreen:1; |
58 | bool m_ignore_next_in:1; | 58 | bool m_ignore_next_in:1; |
59 | int focus_in_count; | 59 | int focus_in_count; |
60 | QTimer*m_slideTimer; | 60 | QTimer*m_slideTimer; |
61 | int m_slideValue; | 61 | int m_slideValue; |
62 | virtual void focusInEvent ( QFocusEvent * ); | 62 | virtual void focusInEvent ( QFocusEvent * ); |
63 | QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; | 63 | QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; |
64 | 64 | ||
65 | public slots: | 65 | public slots: |
66 | virtual void hide(); | 66 | virtual void hide(); |
67 | virtual void startSlide(int); | 67 | virtual void startSlide(int); |
68 | virtual void nextSlide(); | 68 | virtual void nextSlide(); |
69 | 69 | ||
70 | protected slots: | 70 | protected slots: |
71 | virtual void slotShowImageInfo(); | 71 | virtual void slotShowImageInfo(); |
72 | virtual void keyReleaseEvent(QKeyEvent * e); | 72 | virtual void keyReleaseEvent(QKeyEvent * e); |
73 | virtual void contentsMousePressEvent ( QMouseEvent * e); | 73 | virtual void contentsMousePressEvent ( QMouseEvent * e); |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 570ee45..ece51a1 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -1,159 +1,158 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include "imageview.h" | 6 | #include "imageview.h" |
7 | 7 | ||
8 | #include "iconview.h" | 8 | #include "iconview.h" |
9 | #include "filesystem.h" | 9 | #include "filesystem.h" |
10 | #include "imageinfoui.h" | 10 | #include "imageinfoui.h" |
11 | #include "viewmodebutton.h" | 11 | #include "viewmodebutton.h" |
12 | #include "basesetup.h" | 12 | #include "basesetup.h" |
13 | 13 | ||
14 | #include <iface/ifaceinfo.h> | 14 | #include <iface/ifaceinfo.h> |
15 | #include <iface/dirview.h> | 15 | #include <iface/dirview.h> |
16 | 16 | ||
17 | #include <opie2/odebug.h> | 17 | #include <opie2/odebug.h> |
18 | #include <opie2/owidgetstack.h> | 18 | #include <opie2/owidgetstack.h> |
19 | #include <opie2/oapplicationfactory.h> | 19 | #include <opie2/oapplicationfactory.h> |
20 | #include <opie2/otabwidget.h> | 20 | #include <opie2/otabwidget.h> |
21 | #include <opie2/okeyconfigwidget.h> | 21 | #include <opie2/okeyconfigwidget.h> |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/ir.h> | 25 | #include <qpe/ir.h> |
26 | #include <qpe/storage.h> | 26 | #include <qpe/storage.h> |
27 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
28 | 28 | ||
29 | #include <qtoolbar.h> | 29 | #include <qtoolbar.h> |
30 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qtimer.h> | 34 | #include <qtimer.h> |
35 | #include <qframe.h> | 35 | #include <qframe.h> |
36 | #include <qmenubar.h> | 36 | #include <qmenubar.h> |
37 | #include <qaction.h> | 37 | #include <qaction.h> |
38 | 38 | ||
39 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 39 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
40 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 40 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
41 | 41 | ||
42 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 42 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
43 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 43 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
44 | { | 44 | { |
45 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 45 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
46 | m_cfg = new Opie::Core::OConfig("phunkview"); | 46 | m_cfg = new Opie::Core::OConfig("opie-eye"); |
47 | m_cfg->setGroup("Zecke_view" ); | 47 | m_cfg->setGroup("main" ); |
48 | 48 | ||
49 | m_storage = new StorageInfo(); | 49 | m_storage = new StorageInfo(); |
50 | connect(m_storage, SIGNAL(disksChanged() ), | 50 | connect(m_storage, SIGNAL(disksChanged() ), |
51 | this, SLOT( dirChanged() ) ); | 51 | this, SLOT( dirChanged() ) ); |
52 | 52 | ||
53 | m_stack = new Opie::Ui::OWidgetStack( this ); | 53 | m_stack = new Opie::Ui::OWidgetStack( this ); |
54 | setCentralWidget( m_stack ); | 54 | setCentralWidget( m_stack ); |
55 | 55 | ||
56 | m_view = new PIconView( m_stack, m_cfg ); | 56 | m_view = new PIconView( m_stack, m_cfg ); |
57 | m_stack->addWidget( m_view, IconView ); | 57 | m_stack->addWidget( m_view, IconView ); |
58 | m_stack->raiseWidget( IconView ); | 58 | m_stack->raiseWidget( IconView ); |
59 | 59 | ||
60 | connect(m_view, SIGNAL(sig_display(const QString&)), | 60 | connect(m_view, SIGNAL(sig_display(const QString&)), |
61 | this, SLOT(slotDisplay(const QString&))); | 61 | this, SLOT(slotDisplay(const QString&))); |
62 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), | 62 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), |
63 | this, SLOT(slotShowInfo(const QString&)) ); | 63 | this, SLOT(slotShowInfo(const QString&)) ); |
64 | connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); | 64 | connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); |
65 | 65 | ||
66 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 66 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
67 | 67 | ||
68 | listviewMenu = 0; | 68 | listviewMenu = 0; |
69 | /* setup menu and toolbar */ | 69 | /* setup menu and toolbar */ |
70 | setupActions(); | 70 | setupActions(); |
71 | setupToolbar(); | 71 | setupToolbar(); |
72 | setupMenu(); | 72 | setupMenu(); |
73 | m_aHideToolbar->setOn(m_cfg->readBoolEntry("base_showtoolbar",true)); | 73 | m_aHideToolbar->setOn(m_cfg->readBoolEntry("base_showtoolbar",true)); |
74 | } | 74 | } |
75 | 75 | ||
76 | PMainWindow::~PMainWindow() { | 76 | PMainWindow::~PMainWindow() { |
77 | } | 77 | } |
78 | 78 | ||
79 | void PMainWindow::slotToggleZoomer() | 79 | void PMainWindow::slotToggleZoomer() |
80 | { | 80 | { |
81 | if (!m_disp) return; | 81 | if (!m_disp) return; |
82 | bool cur = m_aZoomer->isOn(); | 82 | bool cur = m_aZoomer->isOn(); |
83 | m_aZoomer->setOn(!cur); | 83 | m_aZoomer->setOn(!cur); |
84 | } | 84 | } |
85 | 85 | ||
86 | void PMainWindow::slotZoomerToggled(bool how) | 86 | void PMainWindow::slotZoomerToggled(bool how) |
87 | { | 87 | { |
88 | zoomerOn = how; | 88 | zoomerOn = how; |
89 | if (m_disp) { | 89 | if (m_disp) { |
90 | m_disp->setShowZoomer(zoomerOn); | 90 | m_disp->setShowZoomer(zoomerOn); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | void PMainWindow::slotToggleAutorotate() | 94 | void PMainWindow::slotToggleAutorotate() |
95 | { | 95 | { |
96 | if (!m_disp) return; | 96 | if (!m_disp) return; |
97 | if (!m_aAutoRotate->isEnabled()) return; | 97 | if (!m_aAutoRotate->isEnabled()) return; |
98 | bool cur = m_aAutoRotate->isOn(); | 98 | bool cur = m_aAutoRotate->isOn(); |
99 | m_aAutoRotate->setOn(!cur); | 99 | m_aAutoRotate->setOn(!cur); |
100 | } | 100 | } |
101 | 101 | ||
102 | void PMainWindow::slotToggleAutoscale() | 102 | void PMainWindow::slotToggleAutoscale() |
103 | { | 103 | { |
104 | if (!m_disp) return; | 104 | if (!m_disp) return; |
105 | bool cur = m_aAutoScale->isOn(); | 105 | bool cur = m_aAutoScale->isOn(); |
106 | m_aAutoScale->setOn(!cur); | 106 | m_aAutoScale->setOn(!cur); |
107 | } | 107 | } |
108 | 108 | ||
109 | void PMainWindow::slotRotateToggled(bool how) | 109 | void PMainWindow::slotRotateToggled(bool how) |
110 | { | 110 | { |
111 | odebug << "Autorotate: " << how << oendl; | ||
112 | autoRotate = how; | 111 | autoRotate = how; |
113 | if (m_disp) { | 112 | if (m_disp) { |
114 | m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); | 113 | m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); |
115 | } | 114 | } |
116 | } | 115 | } |
117 | 116 | ||
118 | void PMainWindow::slotScaleToggled(bool how) | 117 | void PMainWindow::slotScaleToggled(bool how) |
119 | { | 118 | { |
120 | autoScale = !how; | 119 | autoScale = !how; |
121 | if (!how) { | 120 | if (!how) { |
122 | autoRotate = how; | 121 | autoRotate = how; |
123 | } | 122 | } |
124 | if (!autoScale) { | 123 | if (!autoScale) { |
125 | m_aAutoRotate->setOn(false); | 124 | m_aAutoRotate->setOn(false); |
126 | } | 125 | } |
127 | if (m_disp) { | 126 | if (m_disp) { |
128 | m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); | 127 | m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); |
129 | } | 128 | } |
130 | m_aAutoRotate->setEnabled(!how); | 129 | m_aAutoRotate->setEnabled(!how); |
131 | } | 130 | } |
132 | 131 | ||
133 | void PMainWindow::slotConfig() { | 132 | void PMainWindow::slotConfig() { |
134 | /* | 133 | /* |
135 | * have a tab with the possible views | 134 | * have a tab with the possible views |
136 | * a tab for globals image cache size.. scaled loading | 135 | * a tab for globals image cache size.. scaled loading |
137 | * and one tab for the KeyConfigs | 136 | * and one tab for the KeyConfigs |
138 | */ | 137 | */ |
139 | QDialog dlg(this, 0, true); | 138 | QDialog dlg(this, 0, true); |
140 | dlg.setCaption( tr("Phunk View - Config" ) ); | 139 | dlg.setCaption( tr("Phunk View - Config" ) ); |
141 | 140 | ||
142 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 141 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
143 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); | 142 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
144 | lay->addWidget( wid ); | 143 | lay->addWidget( wid ); |
145 | 144 | ||
146 | BaseSetup*bSetup = new BaseSetup(m_cfg,wid); | 145 | BaseSetup*bSetup = new BaseSetup(m_cfg,wid); |
147 | wid->addTab(bSetup,"SettingsIcon","Basics setup"); | 146 | wid->addTab(bSetup,"SettingsIcon","Basics setup"); |
148 | 147 | ||
149 | ViewMap *vM = viewMap(); | 148 | ViewMap *vM = viewMap(); |
150 | ViewMap::Iterator _it = vM->begin(); | 149 | ViewMap::Iterator _it = vM->begin(); |
151 | QMap<PDirView*, QWidget*> lst; | 150 | QMap<PDirView*, QWidget*> lst; |
152 | 151 | ||
153 | for( ; _it != vM->end(); ++_it ) { | 152 | for( ; _it != vM->end(); ++_it ) { |
154 | PDirView *view = (_it.data())(*m_cfg); | 153 | PDirView *view = (_it.data())(*m_cfg); |
155 | PInterfaceInfo *inf = view->interfaceInfo(); | 154 | PInterfaceInfo *inf = view->interfaceInfo(); |
156 | QWidget *_wid = inf->configWidget( *m_cfg ); | 155 | QWidget *_wid = inf->configWidget( *m_cfg ); |
157 | if (!_wid) continue; | 156 | if (!_wid) continue; |
158 | _wid->reparent(wid, QPoint() ); | 157 | _wid->reparent(wid, QPoint() ); |
159 | lst.insert( view, _wid ); | 158 | lst.insert( view, _wid ); |
@@ -181,218 +180,238 @@ void PMainWindow::slotConfig() { | |||
181 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | 180 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); |
182 | 181 | ||
183 | 182 | ||
184 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); | 183 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); |
185 | 184 | ||
186 | /* | 185 | /* |
187 | * clean up | 186 | * clean up |
188 | *apply changes | 187 | *apply changes |
189 | */ | 188 | */ |
190 | 189 | ||
191 | QMap<PDirView*, QWidget*>::Iterator it; | 190 | QMap<PDirView*, QWidget*>::Iterator it; |
192 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 191 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
193 | if ( act ) | 192 | if ( act ) |
194 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); | 193 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); |
195 | delete it.key(); | 194 | delete it.key(); |
196 | } | 195 | } |
197 | 196 | ||
198 | 197 | ||
199 | if ( act ) { | 198 | if ( act ) { |
200 | m_view->resetView(); | 199 | m_view->resetView(); |
201 | keyWid->save(); | 200 | keyWid->save(); |
202 | m_disp->manager()->save(); | 201 | m_disp->manager()->save(); |
203 | m_info->manager()->save(); | 202 | m_info->manager()->save(); |
204 | m_view->manager()->save(); | 203 | m_view->manager()->save(); |
205 | bSetup->save_values(); | 204 | bSetup->save_values(); |
206 | } | 205 | } |
207 | delete keyWid; | 206 | delete keyWid; |
208 | } | 207 | } |
209 | 208 | ||
210 | /* | 209 | /* |
211 | * create a new image info component | 210 | * create a new image info component |
212 | * and detach the current one | 211 | * and detach the current one |
213 | * we will make the other delete on exit | 212 | * we will make the other delete on exit |
214 | */ | 213 | */ |
215 | template<class T> | 214 | template<class T> |
216 | void PMainWindow::initT( const char* name, T** ptr, int id) { | 215 | void PMainWindow::initT( const char* name, T** ptr, int id) { |
217 | if ( *ptr ) { | 216 | if ( *ptr ) { |
218 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 217 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
219 | (*ptr)->setDestructiveClose(); | 218 | (*ptr)->setDestructiveClose(); |
220 | m_stack->removeWidget( *ptr ); | 219 | m_stack->removeWidget( *ptr ); |
221 | } | 220 | } |
222 | *ptr = new T(m_cfg, m_stack, name ); | 221 | *ptr = new T(m_cfg, m_stack, name ); |
223 | m_stack->addWidget( *ptr, id ); | 222 | m_stack->addWidget( *ptr, id ); |
224 | 223 | ||
225 | connect(*ptr, SIGNAL(sig_return()), | 224 | connect(*ptr, SIGNAL(sig_return()), |
226 | this,SLOT(slotReturn())); | 225 | this,SLOT(slotReturn())); |
227 | 226 | ||
228 | } | 227 | } |
228 | |||
229 | void PMainWindow::initInfo() { | 229 | void PMainWindow::initInfo() { |
230 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 230 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
231 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 231 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
232 | } | 232 | } |
233 | |||
233 | void PMainWindow::initDisp() { | 234 | void PMainWindow::initDisp() { |
234 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 235 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
235 | if (m_disp) { | 236 | if (m_disp) { |
236 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 237 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
237 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 238 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
238 | } | 239 | } |
239 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 240 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); |
240 | m_disp->setAutoScale(!m_aAutoScale->isOn()); | 241 | m_disp->setAutoScale(!m_aAutoScale->isOn()); |
241 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); | 242 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
242 | m_disp->setShowZoomer(m_aZoomer->isOn()); | 243 | m_disp->setShowZoomer(m_aZoomer->isOn()); |
243 | m_disp->setBackgroundColor(white); | 244 | m_disp->setBackgroundColor(white); |
244 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 245 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
245 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 246 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
246 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 247 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
247 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 248 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
248 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 249 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
249 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 250 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
250 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 251 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
251 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 252 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
252 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); | 253 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); |
253 | slotFullScreenToggled(m_aFullScreen->isOn()); | 254 | slotFullScreenToggled(m_aFullScreen->isOn()); |
254 | } | 255 | } |
255 | } | 256 | } |
256 | 257 | ||
257 | void PMainWindow::slotToggleFullScreen() | 258 | void PMainWindow::slotToggleFullScreen() |
258 | { | 259 | { |
259 | odebug << "Toggle full " << oendl; | ||
260 | bool current = !m_aFullScreen->isOn(); | 260 | bool current = !m_aFullScreen->isOn(); |
261 | m_aFullScreen->setOn(current); | 261 | m_aFullScreen->setOn(current); |
262 | } | 262 | } |
263 | 263 | ||
264 | void PMainWindow::slotFullScreenToggled(bool current) | 264 | void PMainWindow::slotFullScreenButton(bool current) |
265 | { | ||
266 | if (m_disp) odebug << "Disp fenster ist hidden: "<<m_disp->isHidden()<<oendl; | ||
267 | if (!m_disp) return; | ||
268 | |||
269 | /* I can not solve this effects here - it seems that we require some | ||
270 | status variable, too. so we will live with some interesting effects | ||
271 | meanwhile */ | ||
272 | #if 0 | ||
273 | bool th = m_disp->isHidden(); | ||
274 | setupViewWindow(current, false); | ||
275 | /* realy - after setting up the fullscreenmode while the window is hidden | ||
276 | it is unvisibile not hidden!!!!! Hell. */ | ||
277 | if (th) m_disp->hide(); | ||
278 | #endif | ||
279 | setupViewWindow(current, true); | ||
280 | } | ||
281 | |||
282 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | ||
265 | { | 283 | { |
266 | odebug << "slotFullScreenToggled " << current << oendl; | ||
267 | if (!m_disp) return; | 284 | if (!m_disp) return; |
268 | if (current) { | 285 | if (current) { |
269 | odebug << "full" << oendl; | ||
270 | m_disp->setBackgroundColor(black); | 286 | m_disp->setBackgroundColor(black); |
271 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 287 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
272 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 288 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
273 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 289 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
274 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 290 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
275 | } else { | 291 | } else { |
276 | setUpdatesEnabled(false); | 292 | setUpdatesEnabled(false); |
277 | odebug << "window" << oendl; | ||
278 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 293 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
279 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 294 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
280 | } else { | 295 | } else { |
281 | m_disp->setMinimumSize(10,10); | 296 | m_disp->setMinimumSize(10,10); |
282 | } | 297 | } |
283 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 298 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
284 | m_disp->reparent(0,QPoint(50,50)); | 299 | m_disp->reparent(0,QPoint(50,50)); |
285 | } else { | 300 | } else { |
286 | m_disp->reparent(0,QPoint(0,0)); | 301 | m_disp->reparent(0,QPoint(0,0)); |
287 | } | 302 | } |
288 | m_disp->setBackgroundColor(white); | 303 | m_disp->setBackgroundColor(white); |
289 | m_stack->addWidget(m_disp,ImageDisplay); | 304 | m_stack->addWidget(m_disp,ImageDisplay); |
290 | m_disp->setVScrollBarMode(QScrollView::Auto); | 305 | m_disp->setVScrollBarMode(QScrollView::Auto); |
291 | m_disp->setHScrollBarMode(QScrollView::Auto); | 306 | m_disp->setHScrollBarMode(QScrollView::Auto); |
292 | m_stack->raiseWidget(m_disp); | 307 | if (forceDisplay || m_disp->isVisible()) |
308 | m_stack->raiseWidget(m_disp); | ||
293 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 309 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
294 | m_disp->resize(m_disp->minimumSize()); | 310 | m_disp->resize(m_disp->minimumSize()); |
295 | } | 311 | } |
296 | setUpdatesEnabled(true); | 312 | setUpdatesEnabled(true); |
297 | } | 313 | } |
298 | m_disp->setFullScreen(current); | 314 | m_disp->setFullScreen(current,forceDisplay); |
315 | } | ||
316 | |||
317 | void PMainWindow::slotFullScreenToggled(bool current) | ||
318 | { | ||
319 | setupViewWindow(current,true); | ||
299 | } | 320 | } |
300 | 321 | ||
301 | /** | 322 | /** |
302 | * With big Screen the plan could be to 'detach' the image | 323 | * With big Screen the plan could be to 'detach' the image |
303 | * window if visible and to create a ne wone | 324 | * window if visible and to create a ne wone |
304 | * init* already supports it but I make no use of it for | 325 | * init* already supports it but I make no use of it for |
305 | * now. We set filename and raise | 326 | * now. We set filename and raise |
306 | * | 327 | * |
307 | * ### FIXME and talk to alwin | 328 | * ### FIXME and talk to alwin |
308 | */ | 329 | */ |
309 | void PMainWindow::slotShowInfo( const QString& inf ) { | 330 | void PMainWindow::slotShowInfo( const QString& inf ) { |
310 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 331 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
311 | return; | 332 | return; |
312 | } | 333 | } |
313 | if ( !m_info ) { | 334 | if ( !m_info ) { |
314 | initInfo(); | 335 | initInfo(); |
315 | } | 336 | } |
316 | m_info->setPath( inf ); | 337 | m_info->setPath( inf ); |
317 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 338 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
318 | m_aNext->removeFrom(toolBar); | 339 | m_aNext->removeFrom(toolBar); |
319 | m_aPrevious->removeFrom(toolBar); | 340 | m_aPrevious->removeFrom(toolBar); |
320 | m_aNext->setEnabled(false); | 341 | m_aNext->setEnabled(false); |
321 | m_aPrevious->setEnabled(false); | 342 | m_aPrevious->setEnabled(false); |
322 | m_aDirUp->setEnabled(false); | 343 | m_aDirUp->setEnabled(false); |
323 | m_aShowInfo->setEnabled(false); | 344 | m_aShowInfo->setEnabled(false); |
324 | m_aViewfile->setEnabled(true); | 345 | m_aViewfile->setEnabled(true); |
325 | m_aStartSlide->setEnabled(false); | 346 | m_aStartSlide->setEnabled(false); |
326 | fsButton->hide(); | 347 | fsButton->hide(); |
327 | } | 348 | } |
328 | m_stack->raiseWidget( ImageInfo ); | 349 | m_stack->raiseWidget( ImageInfo ); |
329 | } | 350 | } |
330 | 351 | ||
331 | void PMainWindow::slotDisplay( const QString& inf ) { | 352 | void PMainWindow::slotDisplay( const QString& inf ) { |
332 | odebug << "slotDisplay: " << inf << oendl; | ||
333 | if ( !m_disp ) { | 353 | if ( !m_disp ) { |
334 | initDisp(); | 354 | initDisp(); |
335 | } | 355 | } |
336 | m_disp->setImage( inf ); | 356 | m_disp->setImage( inf ); |
337 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 357 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
338 | if (m_gPrevNext->isEnabled()==false) { | 358 | if (m_gPrevNext->isEnabled()==false) { |
339 | m_gPrevNext->addTo(toolBar); | 359 | m_gPrevNext->addTo(toolBar); |
340 | m_gPrevNext->setEnabled(true); | 360 | m_gPrevNext->setEnabled(true); |
341 | 361 | ||
342 | m_aDirUp->setEnabled(false); | 362 | m_aDirUp->setEnabled(false); |
343 | m_aShowInfo->setEnabled(true); | 363 | m_aShowInfo->setEnabled(true); |
344 | m_aViewfile->setEnabled(false); | 364 | m_aViewfile->setEnabled(false); |
345 | m_aStartSlide->setEnabled(false); | 365 | m_aStartSlide->setEnabled(false); |
346 | fsButton->hide(); | 366 | fsButton->hide(); |
347 | } | 367 | } |
348 | } | 368 | } |
349 | if (m_disp->fullScreen()) { | 369 | if (m_disp->fullScreen()) { |
350 | //m_disp->showFullScreen(); | ||
351 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 370 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
352 | } else { | 371 | } else { |
353 | m_stack->raiseWidget( ImageDisplay ); | 372 | m_stack->raiseWidget( ImageDisplay ); |
354 | } | 373 | } |
355 | } | 374 | } |
356 | 375 | ||
357 | void PMainWindow::raiseIconView() { | 376 | void PMainWindow::raiseIconView() { |
358 | setUpdatesEnabled(false); | 377 | setUpdatesEnabled(false); |
359 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 378 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
360 | m_gPrevNext->removeFrom(toolBar); | 379 | m_gPrevNext->removeFrom(toolBar); |
361 | m_gPrevNext->setEnabled(false); | 380 | m_gPrevNext->setEnabled(false); |
362 | m_aDirUp->setEnabled(true); | 381 | m_aDirUp->setEnabled(true); |
363 | m_aShowInfo->setEnabled(true); | 382 | m_aShowInfo->setEnabled(true); |
364 | m_aViewfile->setEnabled(true); | 383 | m_aViewfile->setEnabled(true); |
365 | m_aStartSlide->setEnabled(true); | 384 | m_aStartSlide->setEnabled(true); |
366 | fsButton->show(); | 385 | fsButton->show(); |
367 | } | 386 | } |
368 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 387 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
369 | m_disp->stopSlide(); | 388 | m_disp->stopSlide(); |
370 | m_disp->hide(); | 389 | m_disp->hide(); |
371 | } | 390 | } |
372 | m_stack->raiseWidget( IconView ); | 391 | m_stack->raiseWidget( IconView ); |
373 | setUpdatesEnabled(true); | 392 | setUpdatesEnabled(true); |
374 | repaint(); | 393 | repaint(); |
375 | } | 394 | } |
376 | 395 | ||
377 | void PMainWindow::slotReturn() { | 396 | void PMainWindow::slotReturn() { |
378 | raiseIconView(); | 397 | raiseIconView(); |
379 | } | 398 | } |
380 | 399 | ||
381 | 400 | ||
382 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 401 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
383 | /* | 402 | /* |
384 | * return from view | 403 | * return from view |
385 | * or properly quit | 404 | * or properly quit |
386 | */ | 405 | */ |
387 | if ( m_stack->visibleWidget() == m_info || | 406 | if ( m_stack->visibleWidget() == m_info || |
388 | m_stack->visibleWidget() == m_disp ) { | 407 | m_stack->visibleWidget() == m_disp ) { |
389 | ev->ignore(); | 408 | ev->ignore(); |
390 | raiseIconView(); | 409 | raiseIconView(); |
391 | return; | 410 | return; |
392 | } | 411 | } |
393 | if (m_disp && m_disp->fullScreen()) { | 412 | if (m_disp && m_disp->fullScreen()) { |
394 | /* otherwise opie-eye crashes in bigscreen mode! */ | 413 | /* otherwise opie-eye crashes in bigscreen mode! */ |
395 | m_disp->reparent(0,QPoint(0,0)); | 414 | m_disp->reparent(0,QPoint(0,0)); |
396 | m_stack->addWidget(m_disp,ImageDisplay); | 415 | m_stack->addWidget(m_disp,ImageDisplay); |
397 | } | 416 | } |
398 | ev->accept(); | 417 | ev->accept(); |
@@ -473,166 +492,169 @@ void PMainWindow::setupActions() | |||
473 | m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); | 492 | m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); |
474 | m_aHideToolbar->setOn (true); | 493 | m_aHideToolbar->setOn (true); |
475 | connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); | 494 | connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); |
476 | 495 | ||
477 | m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); | 496 | m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); |
478 | m_aSetup->setToggleAction(false); | 497 | m_aSetup->setToggleAction(false); |
479 | connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); | 498 | connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); |
480 | 499 | ||
481 | m_gListViewMode = new QActionGroup(this,"Select listmode",true); | 500 | m_gListViewMode = new QActionGroup(this,"Select listmode",true); |
482 | connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); | 501 | connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); |
483 | 502 | ||
484 | m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); | 503 | m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); |
485 | m_aDirLong->setToggleAction(true); | 504 | m_aDirLong->setToggleAction(true); |
486 | m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); | 505 | m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); |
487 | m_aDirShort->setToggleAction(true); | 506 | m_aDirShort->setToggleAction(true); |
488 | m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); | 507 | m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); |
489 | m_aDirName->setToggleAction(true); | 508 | m_aDirName->setToggleAction(true); |
490 | int mode = m_cfg->readNumEntry("ListViewMode", 1); | 509 | int mode = m_cfg->readNumEntry("ListViewMode", 1); |
491 | if (mode < 1 || mode>3) mode = 1; | 510 | if (mode < 1 || mode>3) mode = 1; |
492 | switch (mode) { | 511 | switch (mode) { |
493 | case 3: | 512 | case 3: |
494 | m_aDirName->setOn(true); | 513 | m_aDirName->setOn(true); |
495 | break; | 514 | break; |
496 | case 2: | 515 | case 2: |
497 | m_aDirShort->setOn(true); | 516 | m_aDirShort->setOn(true); |
498 | break; | 517 | break; |
499 | case 1: | 518 | case 1: |
500 | default: | 519 | default: |
501 | m_aDirLong->setOn(true); | 520 | m_aDirLong->setOn(true); |
502 | } | 521 | } |
503 | m_gListViewMode->insert(m_aDirLong); | 522 | m_gListViewMode->insert(m_aDirLong); |
504 | m_gListViewMode->insert(m_aDirShort); | 523 | m_gListViewMode->insert(m_aDirShort); |
505 | m_gListViewMode->insert(m_aDirName); | 524 | m_gListViewMode->insert(m_aDirName); |
506 | 525 | ||
507 | m_gPrevNext = new QActionGroup(this,"imageprevnext",false); | 526 | m_gPrevNext = new QActionGroup(this,"imageprevnext",false); |
508 | m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); | 527 | m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); |
509 | m_aNext->setToggleAction(false); | 528 | m_aNext->setToggleAction(false); |
510 | connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); | 529 | connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); |
511 | m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); | 530 | m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); |
512 | m_aPrevious->setToggleAction(false); | 531 | m_aPrevious->setToggleAction(false); |
513 | connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); | 532 | connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); |
514 | m_gPrevNext->insert(m_aPrevious); | 533 | m_gPrevNext->insert(m_aPrevious); |
515 | m_gPrevNext->insert(m_aNext); | 534 | m_gPrevNext->insert(m_aNext); |
516 | 535 | ||
517 | m_aFullScreen = new QAction( tr( "Show images fullscreen" ), | 536 | m_aFullScreen = new QAction( tr( "Show images fullscreen" ), |
518 | Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); | 537 | Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); |
519 | m_aFullScreen->setToggleAction(true); | 538 | m_aFullScreen->setToggleAction(true); |
520 | m_aFullScreen->setOn(false); | 539 | m_aFullScreen->setOn(false); |
521 | connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenToggled(bool))); | 540 | connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool))); |
522 | 541 | ||
523 | m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); | 542 | m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); |
524 | m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); | 543 | m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); |
525 | m_aAutoRotate->setToggleAction(true); | 544 | m_aAutoRotate->setToggleAction(true); |
526 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 545 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
527 | m_aAutoRotate->setOn(true); | 546 | m_aAutoRotate->setOn(true); |
528 | autoRotate = true; | 547 | autoRotate = true; |
529 | } else { | 548 | } else { |
530 | m_aAutoRotate->setOn(false); | 549 | m_aAutoRotate->setOn(false); |
531 | autoRotate = false; | 550 | autoRotate = false; |
532 | } | 551 | } |
533 | connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | 552 | connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); |
534 | 553 | ||
535 | m_aAutoScale = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); | 554 | m_aAutoScale = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); |
536 | m_aAutoScale->setToggleAction(true); | 555 | m_aAutoScale->setToggleAction(true); |
537 | m_aAutoScale->setOn (false); | 556 | m_aAutoScale->setOn (false); |
538 | connect(m_aAutoScale,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | 557 | connect(m_aAutoScale,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); |
539 | 558 | ||
540 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); | 559 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); |
541 | m_aZoomer->setToggleAction(true); | 560 | m_aZoomer->setToggleAction(true); |
542 | m_aZoomer->setOn (true); | 561 | m_aZoomer->setOn (true); |
543 | zoomerOn = true; | 562 | zoomerOn = true; |
544 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 563 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
545 | m_gDisplayType->insert(m_aAutoRotate); | 564 | m_gDisplayType->insert(m_aAutoRotate); |
546 | m_gDisplayType->insert(m_aAutoScale); | 565 | m_gDisplayType->insert(m_aAutoScale); |
547 | m_gDisplayType->insert(m_aZoomer); | 566 | m_gDisplayType->insert(m_aZoomer); |
548 | 567 | ||
549 | m_hGroup = new QActionGroup(this,"actioncollection",false); | 568 | m_hGroup = new QActionGroup(this,"actioncollection",false); |
550 | m_hGroup->insert(m_aFullScreen); | 569 | m_hGroup->insert(m_aFullScreen); |
551 | } | 570 | } |
552 | 571 | ||
553 | void PMainWindow::setupToolbar() | 572 | void PMainWindow::setupToolbar() |
554 | { | 573 | { |
555 | toolBar = new QToolBar( this ); | 574 | toolBar = new QToolBar( this ); |
556 | addToolBar(toolBar); | 575 | addToolBar(toolBar); |
557 | toolBar->setHorizontalStretchable( true ); | 576 | toolBar->setHorizontalStretchable( true ); |
558 | setToolBarsMovable( false ); | 577 | setToolBarsMovable( false ); |
559 | m_aDirUp->addTo( toolBar ); | 578 | m_aDirUp->addTo( toolBar ); |
560 | 579 | ||
561 | fsButton = new PFileSystem( toolBar ); | 580 | fsButton = new PFileSystem( toolBar ); |
562 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 581 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
563 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 582 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
564 | connect( this, SIGNAL( changeDir( const QString& ) ), | 583 | connect( this, SIGNAL( changeDir( const QString& ) ), |
565 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 584 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
566 | 585 | ||
567 | if (m_aBeam) { | 586 | if (m_aBeam) { |
568 | m_aBeam->addTo( toolBar ); | 587 | m_aBeam->addTo( toolBar ); |
569 | } | 588 | } |
570 | m_aShowInfo->addTo(toolBar); | 589 | m_aShowInfo->addTo(toolBar); |
571 | m_aTrash->addTo(toolBar); | 590 | m_aTrash->addTo(toolBar); |
572 | m_aSetup->addTo(toolBar); | 591 | // m_aSetup->addTo(toolBar); |
573 | 592 | ||
574 | m_gDisplayType->addTo(toolBar); | 593 | m_gDisplayType->addTo(toolBar); |
575 | 594 | ||
576 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 595 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
577 | m_gPrevNext->addTo(toolBar); | 596 | m_gPrevNext->addTo(toolBar); |
578 | } else { | 597 | } else { |
579 | m_gPrevNext->setEnabled(false); | 598 | m_gPrevNext->setEnabled(false); |
580 | } | 599 | } |
581 | } | 600 | } |
582 | 601 | ||
583 | void PMainWindow::setupMenu() | 602 | void PMainWindow::setupMenu() |
584 | { | 603 | { |
585 | fileMenu = new QPopupMenu( menuBar() ); | 604 | fileMenu = new QPopupMenu( menuBar() ); |
586 | menuBar()->insertItem( tr( "File" ), fileMenu ); | 605 | menuBar()->insertItem( tr( "File" ), fileMenu ); |
587 | dispMenu = new QPopupMenu( menuBar() ); | 606 | dispMenu = new QPopupMenu( menuBar() ); |
588 | menuBar()->insertItem( tr( "Show" ), dispMenu ); | 607 | menuBar()->insertItem( tr( "Show" ), dispMenu ); |
608 | settingsMenu = new QPopupMenu( menuBar() ); | ||
609 | menuBar()->insertItem( tr( "Settings" ), settingsMenu ); | ||
589 | 610 | ||
590 | m_aViewfile->addTo(fileMenu); | 611 | m_aViewfile->addTo(fileMenu); |
591 | m_aShowInfo->addTo(fileMenu); | 612 | m_aShowInfo->addTo(fileMenu); |
592 | m_aStartSlide->addTo(fileMenu); | 613 | m_aStartSlide->addTo(fileMenu); |
593 | 614 | ||
594 | fileMenu->insertSeparator(); | 615 | fileMenu->insertSeparator(); |
595 | m_aDirUp->addTo( fileMenu ); | 616 | m_aDirUp->addTo( fileMenu ); |
596 | 617 | ||
597 | fsMenu = new QPopupMenu(fileMenu); | 618 | fsMenu = new QPopupMenu(fileMenu); |
598 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); | 619 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); |
599 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); | 620 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); |
600 | dirChanged(); | 621 | dirChanged(); |
601 | 622 | ||
602 | if ( m_aBeam ) { | 623 | if ( m_aBeam ) { |
603 | fileMenu->insertSeparator(); | 624 | fileMenu->insertSeparator(); |
604 | m_aBeam->addTo( fileMenu ); | 625 | m_aBeam->addTo( fileMenu ); |
605 | } | 626 | } |
606 | fileMenu->insertSeparator(); | 627 | fileMenu->insertSeparator(); |
607 | m_aSetup->addTo(fileMenu); | ||
608 | m_aTrash->addTo(fileMenu); | 628 | m_aTrash->addTo(fileMenu); |
609 | 629 | ||
610 | m_aHideToolbar->addTo(dispMenu); | ||
611 | listviewMenu = new QPopupMenu(dispMenu); | 630 | listviewMenu = new QPopupMenu(dispMenu); |
612 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); | 631 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); |
613 | m_gListViewMode->addTo(listviewMenu); | 632 | m_gListViewMode->addTo(listviewMenu); |
614 | dispMenu->insertSeparator(); | 633 | dispMenu->insertSeparator(); |
615 | m_aFullScreen->addTo(dispMenu); | 634 | m_aFullScreen->addTo(dispMenu); |
616 | m_gDisplayType->addTo(dispMenu); | 635 | m_gDisplayType->addTo(dispMenu); |
617 | dispMenu->insertSeparator(); | 636 | dispMenu->insertSeparator(); |
618 | m_gPrevNext->addTo(dispMenu); | 637 | m_gPrevNext->addTo(dispMenu); |
638 | |||
639 | m_aSetup->addTo(settingsMenu); | ||
640 | m_aHideToolbar->addTo(settingsMenu); | ||
619 | } | 641 | } |
620 | 642 | ||
621 | void PMainWindow::listviewselected(QAction*which) | 643 | void PMainWindow::listviewselected(QAction*which) |
622 | { | 644 | { |
623 | if (!which || which->isOn()==false) return; | 645 | if (!which || which->isOn()==false) return; |
624 | int val = 1; | 646 | int val = 1; |
625 | // QString name; | 647 | // QString name; |
626 | 648 | ||
627 | if (which==m_aDirName) { | 649 | if (which==m_aDirName) { |
628 | val = 3; | 650 | val = 3; |
629 | // name = "opie-eye/opie-eye-textview"; | 651 | // name = "opie-eye/opie-eye-textview"; |
630 | } else if (which==m_aDirShort) { | 652 | } else if (which==m_aDirShort) { |
631 | val = 2; | 653 | val = 2; |
632 | // name = "opie-eye/opie-eye-thumbonly"; | 654 | // name = "opie-eye/opie-eye-thumbonly"; |
633 | } else if (which==m_aDirLong) { | 655 | } else if (which==m_aDirLong) { |
634 | val = 1; | 656 | val = 1; |
635 | // name = "opie-eye/opie-eye-thumb"; | 657 | // name = "opie-eye/opie-eye-thumb"; |
636 | } | 658 | } |
637 | emit changeListMode(val); | 659 | emit changeListMode(val); |
638 | } | 660 | } |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 65151fc..703965b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h | |||
@@ -19,87 +19,89 @@ namespace Ui{ | |||
19 | namespace Core{ | 19 | namespace Core{ |
20 | class OKeyConfigManager; | 20 | class OKeyConfigManager; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | class ImageView; | 24 | class ImageView; |
25 | class ImageWidget; | 25 | class ImageWidget; |
26 | class PIconView; | 26 | class PIconView; |
27 | class imageinfo; | 27 | class imageinfo; |
28 | class QMenuBar; | 28 | class QMenuBar; |
29 | class QToolBar; | 29 | class QToolBar; |
30 | class QPopupMenu; | 30 | class QPopupMenu; |
31 | class QAction; | 31 | class QAction; |
32 | class QActionGroup; | 32 | class QActionGroup; |
33 | class StorageInfo; | 33 | class StorageInfo; |
34 | 34 | ||
35 | class PMainWindow : public QMainWindow { | 35 | class PMainWindow : public QMainWindow { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | enum Views { IconView, ImageInfo, ImageDisplay }; | 37 | enum Views { IconView, ImageInfo, ImageDisplay }; |
38 | public: | 38 | public: |
39 | static QString appName() { return QString::fromLatin1("opie-eye" ); } | 39 | static QString appName() { return QString::fromLatin1("opie-eye" ); } |
40 | PMainWindow(QWidget*, const char*, WFlags ); | 40 | PMainWindow(QWidget*, const char*, WFlags ); |
41 | ~PMainWindow(); | 41 | ~PMainWindow(); |
42 | 42 | ||
43 | signals: | 43 | signals: |
44 | void configChanged(); | 44 | void configChanged(); |
45 | void changeDir( const QString& ); | 45 | void changeDir( const QString& ); |
46 | void changeListMode(int); | 46 | void changeListMode(int); |
47 | 47 | ||
48 | public slots: | 48 | public slots: |
49 | void slotShowInfo( const QString& inf ); | 49 | void slotShowInfo( const QString& inf ); |
50 | void slotDisplay( const QString& inf ); | 50 | void slotDisplay( const QString& inf ); |
51 | void slotReturn(); | 51 | void slotReturn(); |
52 | void slotRotateToggled(bool); | 52 | void slotRotateToggled(bool); |
53 | void slotScaleToggled(bool); | 53 | void slotScaleToggled(bool); |
54 | void slotZoomerToggled(bool); | 54 | void slotZoomerToggled(bool); |
55 | void slotToggleZoomer(); | 55 | void slotToggleZoomer(); |
56 | void slotToggleAutorotate(); | 56 | void slotToggleAutorotate(); |
57 | void slotToggleAutoscale(); | 57 | void slotToggleAutoscale(); |
58 | void setDocument( const QString& ); | 58 | void setDocument( const QString& ); |
59 | virtual void slotToggleFullScreen(); | 59 | virtual void slotToggleFullScreen(); |
60 | virtual void slotFullScreenToggled(bool); | 60 | virtual void slotFullScreenToggled(bool); |
61 | 61 | ||
62 | protected slots: | 62 | protected slots: |
63 | void raiseIconView(); | 63 | void raiseIconView(); |
64 | void closeEvent( QCloseEvent* ); | 64 | void closeEvent( QCloseEvent* ); |
65 | void showToolbar(bool); | 65 | void showToolbar(bool); |
66 | void listviewselected(QAction*); | 66 | void listviewselected(QAction*); |
67 | void slotFullScreenButton(bool); | ||
67 | 68 | ||
68 | private: | 69 | private: |
69 | template<class T> void initT( const char* name, T**, int ); | 70 | template<class T> void initT( const char* name, T**, int ); |
70 | void initInfo(); | 71 | void initInfo(); |
71 | void initDisp(); | 72 | void initDisp(); |
73 | void setupViewWindow(bool full, bool forceDisplay); | ||
72 | 74 | ||
73 | private: | 75 | private: |
74 | Opie::Core::OConfig *m_cfg; | 76 | Opie::Core::OConfig *m_cfg; |
75 | Opie::Ui::OWidgetStack *m_stack; | 77 | Opie::Ui::OWidgetStack *m_stack; |
76 | PIconView* m_view; | 78 | PIconView* m_view; |
77 | imageinfo *m_info; | 79 | imageinfo *m_info; |
78 | ImageView *m_disp; | 80 | ImageView *m_disp; |
79 | bool autoRotate; | 81 | bool autoRotate; |
80 | bool autoScale; | 82 | bool autoScale; |
81 | bool zoomerOn; | 83 | bool zoomerOn; |
82 | QToolButton*fsButton; | 84 | QToolButton*fsButton; |
83 | QToolBar *toolBar; | 85 | QToolBar *toolBar; |
84 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu; | 86 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; |
85 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; | 87 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; |
86 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; | 88 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; |
87 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; | 89 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; |
88 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; | 90 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; |
89 | QAction *m_aAutoRotate,*m_aAutoScale,*m_aZoomer; | 91 | QAction *m_aAutoRotate,*m_aAutoScale,*m_aZoomer; |
90 | 92 | ||
91 | /* init funs */ | 93 | /* init funs */ |
92 | void setupActions(); | 94 | void setupActions(); |
93 | void setupToolbar(); | 95 | void setupToolbar(); |
94 | void setupMenu(); | 96 | void setupMenu(); |
95 | /* for the device submenu - ToDo: Merge with the special button */ | 97 | /* for the device submenu - ToDo: Merge with the special button */ |
96 | StorageInfo *m_storage; | 98 | StorageInfo *m_storage; |
97 | QMap<QString, QString> m_dev; | 99 | QMap<QString, QString> m_dev; |
98 | 100 | ||
99 | private slots: | 101 | private slots: |
100 | void slotConfig(); | 102 | void slotConfig(); |
101 | void slotSelectDir(int); | 103 | void slotSelectDir(int); |
102 | void dirChanged(); | 104 | void dirChanged(); |
103 | }; | 105 | }; |
104 | 106 | ||
105 | #endif | 107 | #endif |