Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 6660eb2..30c9bf1 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -80,199 +80,201 @@ PMainWindow::~PMainWindow() { | |||
80 | 80 | ||
81 | void PMainWindow::slotToggleZoomer() | 81 | void PMainWindow::slotToggleZoomer() |
82 | { | 82 | { |
83 | m_aZoomer->setOn(!m_aZoomer->isOn()); | 83 | m_aZoomer->setOn(!m_aZoomer->isOn()); |
84 | } | 84 | } |
85 | 85 | ||
86 | void PMainWindow::slotZoomerToggled(bool how) | 86 | void PMainWindow::slotZoomerToggled(bool how) |
87 | { | 87 | { |
88 | if (m_disp) { | 88 | if (m_disp) { |
89 | m_disp->setShowZoomer(how); | 89 | m_disp->setShowZoomer(how); |
90 | } | 90 | } |
91 | if (autoSave) { | 91 | if (autoSave) { |
92 | m_cfg->writeEntry("zoomeron",how); | 92 | m_cfg->writeEntry("zoomeron",how); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | void PMainWindow::slotToggleAutorotate() | 96 | void PMainWindow::slotToggleAutorotate() |
97 | { | 97 | { |
98 | if (!m_aAutoRotate->isEnabled()) return; | 98 | if (!m_aAutoRotate->isEnabled()) return; |
99 | m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); | 99 | m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); |
100 | } | 100 | } |
101 | 101 | ||
102 | void PMainWindow::slotToggleAutoscale() | 102 | void PMainWindow::slotToggleAutoscale() |
103 | { | 103 | { |
104 | m_aUnscaled->setOn(!m_aUnscaled->isOn()); | 104 | m_aUnscaled->setOn(!m_aUnscaled->isOn()); |
105 | } | 105 | } |
106 | 106 | ||
107 | void PMainWindow::slotRotateToggled(bool how) | 107 | void PMainWindow::slotRotateToggled(bool how) |
108 | { | 108 | { |
109 | if (autoSave) { | 109 | if (autoSave) { |
110 | m_cfg->writeEntry("autorotate",how); | 110 | m_cfg->writeEntry("autorotate",how); |
111 | } | 111 | } |
112 | if (m_disp) { | 112 | if (m_disp) { |
113 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); | 113 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | void PMainWindow::slotScaleToggled(bool how) | 117 | void PMainWindow::slotScaleToggled(bool how) |
118 | { | 118 | { |
119 | if (autoSave) { | 119 | if (autoSave) { |
120 | m_cfg->writeEntry("unscaled",how); | 120 | m_cfg->writeEntry("unscaled",how); |
121 | } | 121 | } |
122 | odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; | 122 | odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; |
123 | odebug << "How: " << how << oendl; | 123 | odebug << "How: " << how << oendl; |
124 | if (how) { | 124 | if (how) { |
125 | m_aAutoRotate->setOn(false); | 125 | m_aAutoRotate->setOn(false); |
126 | } | 126 | } |
127 | if (m_disp) { | 127 | if (m_disp) { |
128 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); | 128 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); |
129 | } | 129 | } |
130 | m_aAutoRotate->setEnabled(!how); | 130 | m_aAutoRotate->setEnabled(!how); |
131 | odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; | 131 | odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; |
132 | } | 132 | } |
133 | 133 | ||
134 | void PMainWindow::slotConfig() { | 134 | void PMainWindow::slotConfig() { |
135 | /* | 135 | /* |
136 | * have a tab with the possible views | 136 | * have a tab with the possible views |
137 | * a tab for globals image cache size.. scaled loading | 137 | * a tab for globals image cache size.. scaled loading |
138 | * and one tab for the KeyConfigs | 138 | * and one tab for the KeyConfigs |
139 | */ | 139 | */ |
140 | QDialog dlg(this, 0, true); | 140 | QDialog dlg(this, 0, true); |
141 | dlg.setCaption( tr("Opie Eye - Config" ) ); | 141 | dlg.setCaption( tr("Opie Eye - Config" ) ); |
142 | 142 | ||
143 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 143 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
144 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); | 144 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
145 | lay->addWidget( wid ); | 145 | lay->addWidget( wid ); |
146 | 146 | ||
147 | BaseSetup*bSetup = new BaseSetup(m_cfg,wid); | 147 | BaseSetup*bSetup = new BaseSetup(m_cfg,wid); |
148 | wid->addTab(bSetup,"SettingsIcon","Basics setup"); | 148 | wid->addTab(bSetup,"SettingsIcon","Basics setup"); |
149 | 149 | ||
150 | ViewMap *vM = viewMap(); | 150 | ViewMap *vM = viewMap(); |
151 | ViewMap::Iterator _it = vM->begin(); | 151 | ViewMap::Iterator _it = vM->begin(); |
152 | QMap<PDirView*, QWidget*> lst; | 152 | QMap<PDirView*, QWidget*> lst; |
153 | 153 | ||
154 | for( ; _it != vM->end(); ++_it ) { | 154 | for( ; _it != vM->end(); ++_it ) { |
155 | PDirView *view = (_it.data())(*m_cfg); | 155 | PDirView *view = (_it.data())(*m_cfg); |
156 | PInterfaceInfo *inf = view->interfaceInfo(); | 156 | PInterfaceInfo *inf = view->interfaceInfo(); |
157 | QWidget *_wid = inf->configWidget( *m_cfg ); | 157 | QWidget *_wid = inf->configWidget( *m_cfg ); |
158 | if (!_wid) continue; | 158 | if (!_wid) continue; |
159 | _wid->reparent(wid, QPoint() ); | 159 | _wid->reparent(wid, QPoint() ); |
160 | lst.insert( view, _wid ); | 160 | lst.insert( view, _wid ); |
161 | wid->addTab( _wid, "fileopen", inf->name() ); | 161 | wid->addTab( _wid, "fileopen", inf->name() ); |
162 | } | 162 | } |
163 | 163 | ||
164 | /* | 164 | /* |
165 | * Add the KeyConfigWidget | 165 | * Add the KeyConfigWidget |
166 | */ | 166 | */ |
167 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | 167 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); |
168 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | 168 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); |
169 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | 169 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); |
170 | QWidget*w = m_stack->visibleWidget(); | 170 | QWidget*w = m_stack->visibleWidget(); |
171 | 171 | ||
172 | bool reminfo = false; | 172 | bool reminfo = false; |
173 | if ( !m_info ) { | 173 | if ( !m_info ) { |
174 | reminfo = true; | 174 | reminfo = true; |
175 | initInfo(); | 175 | initInfo(); |
176 | m_info->hide(); | ||
176 | } | 177 | } |
177 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); | 178 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); |
178 | 179 | ||
179 | bool remdisp = false; | 180 | bool remdisp = false; |
180 | if ( !m_disp ) { | 181 | if ( !m_disp ) { |
181 | remdisp = true; | 182 | remdisp = true; |
182 | initDisp(); | 183 | initDisp(); |
184 | m_disp->hide(); | ||
183 | } | 185 | } |
184 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); | 186 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); |
185 | 187 | ||
186 | keyWid->load(); | 188 | keyWid->load(); |
187 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | 189 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); |
188 | wid->setCurrentTab(0); | 190 | wid->setCurrentTab(0); |
189 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); | 191 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); |
190 | 192 | ||
191 | /* | 193 | /* |
192 | * clean up | 194 | * clean up |
193 | *apply changes | 195 | *apply changes |
194 | */ | 196 | */ |
195 | 197 | ||
196 | QMap<PDirView*, QWidget*>::Iterator it; | 198 | QMap<PDirView*, QWidget*>::Iterator it; |
197 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 199 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
198 | if ( act ) | 200 | if ( act ) |
199 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); | 201 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); |
200 | delete it.key(); | 202 | delete it.key(); |
201 | } | 203 | } |
202 | 204 | ||
203 | 205 | ||
204 | if ( act ) { | 206 | if ( act ) { |
205 | m_view->resetView(); | 207 | m_view->resetView(); |
206 | keyWid->save(); | 208 | keyWid->save(); |
207 | m_disp->manager()->save(); | 209 | m_disp->manager()->save(); |
208 | m_info->manager()->save(); | 210 | m_info->manager()->save(); |
209 | m_view->manager()->save(); | 211 | m_view->manager()->save(); |
210 | bSetup->save_values(); | 212 | bSetup->save_values(); |
211 | readConfig(); | 213 | readConfig(); |
212 | } | 214 | } |
213 | delete keyWid; | 215 | delete keyWid; |
214 | 216 | ||
215 | m_stack->raiseWidget(w); | 217 | m_stack->raiseWidget(w); |
216 | if (remdisp) { | 218 | if (remdisp) { |
217 | m_disp->hide(); | 219 | m_disp->hide(); |
218 | } | 220 | } |
219 | if (reminfo) { | 221 | if (reminfo) { |
220 | m_info->hide(); | 222 | m_info->hide(); |
221 | } | 223 | } |
222 | } | 224 | } |
223 | 225 | ||
224 | /* | 226 | /* |
225 | * create a new image info component | 227 | * create a new image info component |
226 | * and detach the current one | 228 | * and detach the current one |
227 | * we will make the other delete on exit | 229 | * we will make the other delete on exit |
228 | */ | 230 | */ |
229 | template<class T> | 231 | template<class T> |
230 | void PMainWindow::initT( const char* name, T** ptr, int id) { | 232 | void PMainWindow::initT( const char* name, T** ptr, int id) { |
231 | if ( *ptr ) { | 233 | if ( *ptr ) { |
232 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 234 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
233 | (*ptr)->setDestructiveClose(); | 235 | (*ptr)->setDestructiveClose(); |
234 | m_stack->removeWidget( *ptr ); | 236 | m_stack->removeWidget( *ptr ); |
235 | } | 237 | } |
236 | *ptr = new T(m_cfg, m_stack, name ); | 238 | *ptr = new T(m_cfg, m_stack, name ); |
237 | m_stack->addWidget( *ptr, id ); | 239 | m_stack->addWidget( *ptr, id ); |
238 | 240 | ||
239 | connect(*ptr, SIGNAL(sig_return()), | 241 | connect(*ptr, SIGNAL(sig_return()), |
240 | this,SLOT(slotReturn())); | 242 | this,SLOT(slotReturn())); |
241 | 243 | ||
242 | } | 244 | } |
243 | 245 | ||
244 | void PMainWindow::initInfo() { | 246 | void PMainWindow::initInfo() { |
245 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 247 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
246 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 248 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
247 | } | 249 | } |
248 | 250 | ||
249 | void PMainWindow::initDisp() { | 251 | void PMainWindow::initDisp() { |
250 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 252 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
251 | if (m_disp) { | 253 | if (m_disp) { |
252 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 254 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
253 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 255 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
254 | } | 256 | } |
255 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 257 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); |
256 | m_disp->setAutoScale(!m_aUnscaled->isOn()); | 258 | m_disp->setAutoScale(!m_aUnscaled->isOn()); |
257 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); | 259 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
258 | m_disp->setShowZoomer(m_aZoomer->isOn()); | 260 | m_disp->setShowZoomer(m_aZoomer->isOn()); |
259 | m_disp->setBackgroundColor(white); | 261 | m_disp->setBackgroundColor(white); |
260 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 262 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
261 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 263 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
262 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 264 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
263 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 265 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
264 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 266 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
265 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 267 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
266 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 268 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
267 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 269 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
268 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); | 270 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); |
269 | slotFullScreenToggled(m_aFullScreen->isOn()); | 271 | slotFullScreenToggled(m_aFullScreen->isOn()); |
270 | } | 272 | } |
271 | } | 273 | } |
272 | 274 | ||
273 | void PMainWindow::slotToggleFullScreen() | 275 | void PMainWindow::slotToggleFullScreen() |
274 | { | 276 | { |
275 | bool current = !m_aFullScreen->isOn(); | 277 | bool current = !m_aFullScreen->isOn(); |
276 | m_aFullScreen->setOn(current); | 278 | m_aFullScreen->setOn(current); |
277 | } | 279 | } |
278 | 280 | ||