-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 6f3f255..5ba4c8e 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -72,196 +72,199 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
72 | fsButton = new PFileSystem( bar ); | 72 | fsButton = new PFileSystem( bar ); |
73 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 73 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
74 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 74 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
75 | 75 | ||
76 | QToolButton*btn = new QToolButton( bar ); | 76 | QToolButton*btn = new QToolButton( bar ); |
77 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); | 77 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); |
78 | connect( btn, SIGNAL(clicked()), | 78 | connect( btn, SIGNAL(clicked()), |
79 | m_view, SLOT(slotRename()) ); | 79 | m_view, SLOT(slotRename()) ); |
80 | 80 | ||
81 | if ( Ir::supported() ) { | 81 | if ( Ir::supported() ) { |
82 | btn = new QToolButton( bar ); | 82 | btn = new QToolButton( bar ); |
83 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); | 83 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); |
84 | connect( btn, SIGNAL(clicked()), | 84 | connect( btn, SIGNAL(clicked()), |
85 | m_view, SLOT(slotBeam()) ); | 85 | m_view, SLOT(slotBeam()) ); |
86 | } | 86 | } |
87 | 87 | ||
88 | btn = new QToolButton( bar ); | 88 | btn = new QToolButton( bar ); |
89 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); | 89 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); |
90 | connect( btn, SIGNAL(clicked() ), | 90 | connect( btn, SIGNAL(clicked() ), |
91 | m_view, SLOT(slotTrash() ) ); | 91 | m_view, SLOT(slotTrash() ) ); |
92 | 92 | ||
93 | 93 | ||
94 | viewModeButton = new ViewModeButton( bar ); | 94 | viewModeButton = new ViewModeButton( bar ); |
95 | connect( viewModeButton, SIGNAL(changeMode(int)), | 95 | connect( viewModeButton, SIGNAL(changeMode(int)), |
96 | m_view, SLOT(slotChangeMode(int))); | 96 | m_view, SLOT(slotChangeMode(int))); |
97 | 97 | ||
98 | btn = new QToolButton( bar ); | 98 | btn = new QToolButton( bar ); |
99 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); | 99 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); |
100 | connect( btn, SIGNAL(clicked() ), | 100 | connect( btn, SIGNAL(clicked() ), |
101 | this, SLOT(slotConfig() ) ); | 101 | this, SLOT(slotConfig() ) ); |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | prevButton = new QToolButton(bar); | 105 | prevButton = new QToolButton(bar); |
106 | prevButton->setIconSet( Resource::loadIconSet( "back" ) ); | 106 | prevButton->setIconSet( Resource::loadIconSet( "back" ) ); |
107 | connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); | 107 | connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); |
108 | prevButton->hide(); | 108 | prevButton->hide(); |
109 | 109 | ||
110 | nextButton = new QToolButton(bar); | 110 | nextButton = new QToolButton(bar); |
111 | nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); | 111 | nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); |
112 | connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); | 112 | connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); |
113 | nextButton->hide(); | 113 | nextButton->hide(); |
114 | 114 | ||
115 | rotateButton = new QToolButton(bar); | 115 | rotateButton = new QToolButton(bar); |
116 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); | 116 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); |
117 | rotateButton->setToggleButton(true); | 117 | rotateButton->setToggleButton(true); |
118 | 118 | ||
119 | odebug << "Mode = " << m_stack->mode() << oendl; | 119 | odebug << "Mode = " << m_stack->mode() << oendl; |
120 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 120 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
121 | rotateButton->setOn(true); | 121 | rotateButton->setOn(true); |
122 | autoRotate = true; | 122 | autoRotate = true; |
123 | } else { | 123 | } else { |
124 | rotateButton->setOn(false); | 124 | rotateButton->setOn(false); |
125 | autoRotate = false; | 125 | autoRotate = false; |
126 | } | 126 | } |
127 | 127 | ||
128 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | 128 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); |
129 | 129 | ||
130 | btn = new QToolButton(bar); | 130 | btn = new QToolButton(bar); |
131 | btn->setIconSet( Resource::loadIconSet( "1to1" ) ); | 131 | btn->setIconSet( Resource::loadIconSet( "1to1" ) ); |
132 | btn->setToggleButton(true); | 132 | btn->setToggleButton(true); |
133 | btn->setOn(false); | 133 | btn->setOn(false); |
134 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | 134 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); |
135 | autoScale = true; | 135 | autoScale = true; |
136 | 136 | ||
137 | btn = new QToolButton(bar); | 137 | btn = new QToolButton(bar); |
138 | btn->setIconSet( Resource::loadIconSet( "mag" ) ); | 138 | btn->setIconSet( Resource::loadIconSet( "mag" ) ); |
139 | btn->setToggleButton(true); | 139 | btn->setToggleButton(true); |
140 | btn->setOn(true); | 140 | btn->setOn(true); |
141 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 141 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
142 | zoomerOn = true; | 142 | zoomerOn = true; |
143 | } | 143 | } |
144 | 144 | ||
145 | PMainWindow::~PMainWindow() { | 145 | PMainWindow::~PMainWindow() { |
146 | odebug << "Shutting down" << oendl; | 146 | odebug << "Shutting down" << oendl; |
147 | } | 147 | } |
148 | 148 | ||
149 | void PMainWindow::slotZoomerToggled(bool how) | 149 | void PMainWindow::slotZoomerToggled(bool how) |
150 | { | 150 | { |
151 | zoomerOn = how; | 151 | zoomerOn = how; |
152 | if (m_disp) { | 152 | if (m_disp) { |
153 | m_disp->setShowZoomer(zoomerOn); | 153 | m_disp->setShowZoomer(zoomerOn); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | void PMainWindow::slotRotateToggled(bool how) | 157 | void PMainWindow::slotRotateToggled(bool how) |
158 | { | 158 | { |
159 | autoRotate = how; | 159 | autoRotate = how; |
160 | if (m_disp) { | 160 | if (m_disp) { |
161 | m_disp->setAutoRotate(how); | 161 | m_disp->setAutoRotate(how); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | void PMainWindow::slotScaleToggled(bool how) | 165 | void PMainWindow::slotScaleToggled(bool how) |
166 | { | 166 | { |
167 | autoScale = !how; | 167 | autoScale = !how; |
168 | if (!how) { | ||
169 | autoRotate = how; | ||
170 | } | ||
168 | if (m_disp) { | 171 | if (m_disp) { |
169 | m_disp->setAutoScale(autoScale); | 172 | m_disp->setAutoScaleRotate(autoScale,autoRotate); |
170 | } | 173 | } |
171 | if (!autoScale && autoRotate) { | 174 | if (!autoScale) { |
172 | rotateButton->setOn(false); | 175 | rotateButton->setOn(false); |
173 | } | 176 | } |
174 | rotateButton->setEnabled(!how); | 177 | rotateButton->setEnabled(!how); |
175 | } | 178 | } |
176 | 179 | ||
177 | void PMainWindow::slotConfig() { | 180 | void PMainWindow::slotConfig() { |
178 | /* | 181 | /* |
179 | * have a tab with the possible views | 182 | * have a tab with the possible views |
180 | * a tab for globals image cache size.. scaled loading | 183 | * a tab for globals image cache size.. scaled loading |
181 | * and one tab for the KeyConfigs | 184 | * and one tab for the KeyConfigs |
182 | */ | 185 | */ |
183 | QDialog dlg(this, 0, true); | 186 | QDialog dlg(this, 0, true); |
184 | dlg.setCaption( tr("Phunk View - Config" ) ); | 187 | dlg.setCaption( tr("Phunk View - Config" ) ); |
185 | 188 | ||
186 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 189 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
187 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); | 190 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
188 | lay->addWidget( wid ); | 191 | lay->addWidget( wid ); |
189 | ViewMap *vM = viewMap(); | 192 | ViewMap *vM = viewMap(); |
190 | ViewMap::Iterator _it = vM->begin(); | 193 | ViewMap::Iterator _it = vM->begin(); |
191 | QMap<PDirView*, QWidget*> lst; | 194 | QMap<PDirView*, QWidget*> lst; |
192 | 195 | ||
193 | for( ; _it != vM->end(); ++_it ) { | 196 | for( ; _it != vM->end(); ++_it ) { |
194 | PDirView *view = (_it.data())(*m_cfg); | 197 | PDirView *view = (_it.data())(*m_cfg); |
195 | PInterfaceInfo *inf = view->interfaceInfo(); | 198 | PInterfaceInfo *inf = view->interfaceInfo(); |
196 | QWidget *_wid = inf->configWidget( *m_cfg ); | 199 | QWidget *_wid = inf->configWidget( *m_cfg ); |
197 | _wid->reparent(wid, QPoint() ); | 200 | _wid->reparent(wid, QPoint() ); |
198 | lst.insert( view, _wid ); | 201 | lst.insert( view, _wid ); |
199 | wid->addTab( _wid, "fileopen", inf->name() ); | 202 | wid->addTab( _wid, "fileopen", inf->name() ); |
200 | } | 203 | } |
201 | 204 | ||
202 | /* | 205 | /* |
203 | * Add the KeyConfigWidget | 206 | * Add the KeyConfigWidget |
204 | */ | 207 | */ |
205 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | 208 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); |
206 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | 209 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); |
207 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | 210 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); |
208 | 211 | ||
209 | if ( !m_info ) { | 212 | if ( !m_info ) { |
210 | initInfo(); | 213 | initInfo(); |
211 | } | 214 | } |
212 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); | 215 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); |
213 | 216 | ||
214 | if ( !m_disp ) { | 217 | if ( !m_disp ) { |
215 | initDisp(); | 218 | initDisp(); |
216 | } | 219 | } |
217 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); | 220 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); |
218 | 221 | ||
219 | keyWid->load(); | 222 | keyWid->load(); |
220 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | 223 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); |
221 | 224 | ||
222 | 225 | ||
223 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); | 226 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); |
224 | 227 | ||
225 | /* | 228 | /* |
226 | * clean up | 229 | * clean up |
227 | *apply changes | 230 | *apply changes |
228 | */ | 231 | */ |
229 | 232 | ||
230 | QMap<PDirView*, QWidget*>::Iterator it; | 233 | QMap<PDirView*, QWidget*>::Iterator it; |
231 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 234 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
232 | if ( act ) | 235 | if ( act ) |
233 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); | 236 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); |
234 | delete it.key(); | 237 | delete it.key(); |
235 | } | 238 | } |
236 | 239 | ||
237 | 240 | ||
238 | if ( act ) { | 241 | if ( act ) { |
239 | m_view->resetView(); | 242 | m_view->resetView(); |
240 | keyWid->save(); | 243 | keyWid->save(); |
241 | m_disp->manager()->save(); | 244 | m_disp->manager()->save(); |
242 | m_info->manager()->save(); | 245 | m_info->manager()->save(); |
243 | m_view->manager()->save(); | 246 | m_view->manager()->save(); |
244 | } | 247 | } |
245 | delete keyWid; | 248 | delete keyWid; |
246 | } | 249 | } |
247 | 250 | ||
248 | /* | 251 | /* |
249 | * create a new image info component | 252 | * create a new image info component |
250 | * and detach the current one | 253 | * and detach the current one |
251 | * we will make the other delete on exit | 254 | * we will make the other delete on exit |
252 | */ | 255 | */ |
253 | template<class T> | 256 | template<class T> |
254 | void PMainWindow::initT( const char* name, T** ptr, int id) { | 257 | void PMainWindow::initT( const char* name, T** ptr, int id) { |
255 | if ( *ptr ) { | 258 | if ( *ptr ) { |
256 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 259 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
257 | (*ptr)->setDestructiveClose(); | 260 | (*ptr)->setDestructiveClose(); |
258 | m_stack->removeWidget( *ptr ); | 261 | m_stack->removeWidget( *ptr ); |
259 | } | 262 | } |
260 | *ptr = new T(m_cfg, m_stack, name ); | 263 | *ptr = new T(m_cfg, m_stack, name ); |
261 | m_stack->addWidget( *ptr, id ); | 264 | m_stack->addWidget( *ptr, id ); |
262 | 265 | ||
263 | connect(*ptr, SIGNAL(sig_return()), | 266 | connect(*ptr, SIGNAL(sig_return()), |
264 | this,SLOT(slotReturn())); | 267 | this,SLOT(slotReturn())); |
265 | 268 | ||
266 | } | 269 | } |
267 | void PMainWindow::initInfo() { | 270 | void PMainWindow::initInfo() { |