-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 | |||
@@ -1,356 +1,359 @@ | |||
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 | 12 | ||
13 | #include <iface/ifaceinfo.h> | 13 | #include <iface/ifaceinfo.h> |
14 | #include <iface/dirview.h> | 14 | #include <iface/dirview.h> |
15 | 15 | ||
16 | #include <opie2/odebug.h> | 16 | #include <opie2/odebug.h> |
17 | #include <opie2/owidgetstack.h> | 17 | #include <opie2/owidgetstack.h> |
18 | #include <opie2/oapplicationfactory.h> | 18 | #include <opie2/oapplicationfactory.h> |
19 | #include <opie2/otabwidget.h> | 19 | #include <opie2/otabwidget.h> |
20 | #include <opie2/okeyconfigwidget.h> | 20 | #include <opie2/okeyconfigwidget.h> |
21 | 21 | ||
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/ir.h> | 24 | #include <qpe/ir.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | 26 | ||
27 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qdialog.h> | 30 | #include <qdialog.h> |
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 37 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
38 | 38 | ||
39 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 39 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
40 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 40 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
41 | { | 41 | { |
42 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 42 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
43 | m_cfg = new Opie::Core::OConfig("phunkview"); | 43 | m_cfg = new Opie::Core::OConfig("phunkview"); |
44 | m_cfg->setGroup("Zecke_view" ); | 44 | m_cfg->setGroup("Zecke_view" ); |
45 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); | 45 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); |
46 | /* | 46 | /* |
47 | * Initialize ToolBar and IconView | 47 | * Initialize ToolBar and IconView |
48 | * And Connect Them | 48 | * And Connect Them |
49 | */ | 49 | */ |
50 | QToolBar *bar = new QToolBar( this ); | 50 | QToolBar *bar = new QToolBar( this ); |
51 | bar->setHorizontalStretchable( true ); | 51 | bar->setHorizontalStretchable( true ); |
52 | setToolBarsMovable( false ); | 52 | setToolBarsMovable( false ); |
53 | 53 | ||
54 | m_stack = new Opie::Ui::OWidgetStack( this ); | 54 | m_stack = new Opie::Ui::OWidgetStack( this ); |
55 | setCentralWidget( m_stack ); | 55 | setCentralWidget( m_stack ); |
56 | 56 | ||
57 | m_view = new PIconView( m_stack, m_cfg ); | 57 | m_view = new PIconView( m_stack, m_cfg ); |
58 | m_stack->addWidget( m_view, IconView ); | 58 | m_stack->addWidget( m_view, IconView ); |
59 | m_stack->raiseWidget( IconView ); | 59 | m_stack->raiseWidget( IconView ); |
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 | 64 | ||
65 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 65 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
66 | 66 | ||
67 | upButton = new QToolButton( bar ); | 67 | upButton = new QToolButton( bar ); |
68 | upButton->setIconSet( Resource::loadIconSet( "up" ) ); | 68 | upButton->setIconSet( Resource::loadIconSet( "up" ) ); |
69 | connect( upButton, SIGNAL(clicked()), | 69 | connect( upButton, SIGNAL(clicked()), |
70 | m_view, SLOT(slotDirUp()) ); | 70 | m_view, SLOT(slotDirUp()) ); |
71 | 71 | ||
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() { |
268 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 271 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
269 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 272 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
270 | } | 273 | } |
271 | void PMainWindow::initDisp() { | 274 | void PMainWindow::initDisp() { |
272 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 275 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
273 | if (m_disp) { | 276 | if (m_disp) { |
274 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 277 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
275 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 278 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
276 | } | 279 | } |
277 | m_disp->setAutoScale(autoScale); | 280 | m_disp->setAutoScale(autoScale); |
278 | m_disp->setAutoRotate(autoRotate); | 281 | m_disp->setAutoRotate(autoRotate); |
279 | m_disp->setShowZoomer(zoomerOn); | 282 | m_disp->setShowZoomer(zoomerOn); |
280 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 283 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
281 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 284 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
282 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 285 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
283 | } | 286 | } |
284 | } | 287 | } |
285 | 288 | ||
286 | /** | 289 | /** |
287 | * With big Screen the plan could be to 'detach' the image | 290 | * With big Screen the plan could be to 'detach' the image |
288 | * window if visible and to create a ne wone | 291 | * window if visible and to create a ne wone |
289 | * init* already supports it but I make no use of it for | 292 | * init* already supports it but I make no use of it for |
290 | * now. We set filename and raise | 293 | * now. We set filename and raise |
291 | * | 294 | * |
292 | * ### FIXME and talk to alwin | 295 | * ### FIXME and talk to alwin |
293 | */ | 296 | */ |
294 | void PMainWindow::slotShowInfo( const QString& inf ) { | 297 | void PMainWindow::slotShowInfo( const QString& inf ) { |
295 | if ( !m_info ) { | 298 | if ( !m_info ) { |
296 | initInfo(); | 299 | initInfo(); |
297 | } | 300 | } |
298 | m_info->setPath( inf ); | 301 | m_info->setPath( inf ); |
299 | prevButton->hide(); | 302 | prevButton->hide(); |
300 | nextButton->hide(); | 303 | nextButton->hide(); |
301 | upButton->hide(); | 304 | upButton->hide(); |
302 | fsButton->hide(); | 305 | fsButton->hide(); |
303 | viewModeButton->hide(); | 306 | viewModeButton->hide(); |
304 | m_stack->raiseWidget( ImageInfo ); | 307 | m_stack->raiseWidget( ImageInfo ); |
305 | } | 308 | } |
306 | 309 | ||
307 | void PMainWindow::slotDisplay( const QString& inf ) { | 310 | void PMainWindow::slotDisplay( const QString& inf ) { |
308 | if ( !m_disp ) { | 311 | if ( !m_disp ) { |
309 | initDisp(); | 312 | initDisp(); |
310 | } | 313 | } |
311 | m_disp->setImage( inf ); | 314 | m_disp->setImage( inf ); |
312 | prevButton->show(); | 315 | prevButton->show(); |
313 | nextButton->show(); | 316 | nextButton->show(); |
314 | upButton->hide(); | 317 | upButton->hide(); |
315 | fsButton->hide(); | 318 | fsButton->hide(); |
316 | viewModeButton->hide(); | 319 | viewModeButton->hide(); |
317 | m_stack->raiseWidget( ImageDisplay ); | 320 | m_stack->raiseWidget( ImageDisplay ); |
318 | } | 321 | } |
319 | 322 | ||
320 | void PMainWindow::slotReturn() { | 323 | void PMainWindow::slotReturn() { |
321 | raiseIconView(); | 324 | raiseIconView(); |
322 | } | 325 | } |
323 | 326 | ||
324 | 327 | ||
325 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 328 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
326 | /* | 329 | /* |
327 | * return from view | 330 | * return from view |
328 | * or properly quit | 331 | * or properly quit |
329 | */ | 332 | */ |
330 | if ( m_stack->visibleWidget() == m_info || | 333 | if ( m_stack->visibleWidget() == m_info || |
331 | m_stack->visibleWidget() == m_disp ) { | 334 | m_stack->visibleWidget() == m_disp ) { |
332 | raiseIconView(); | 335 | raiseIconView(); |
333 | ev->ignore(); | 336 | ev->ignore(); |
334 | return; | 337 | return; |
335 | } | 338 | } |
336 | ev->accept(); | 339 | ev->accept(); |
337 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 340 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
338 | } | 341 | } |
339 | 342 | ||
340 | void PMainWindow::raiseIconView() { | 343 | void PMainWindow::raiseIconView() { |
341 | prevButton->hide(); | 344 | prevButton->hide(); |
342 | nextButton->hide(); | 345 | nextButton->hide(); |
343 | upButton->show(); | 346 | upButton->show(); |
344 | fsButton->show(); | 347 | fsButton->show(); |
345 | viewModeButton->show(); | 348 | viewModeButton->show(); |
346 | m_stack->raiseWidget( IconView ); | 349 | m_stack->raiseWidget( IconView ); |
347 | } | 350 | } |
348 | 351 | ||
349 | void PMainWindow::setDocument( const QString& showImg ) { | 352 | void PMainWindow::setDocument( const QString& showImg ) { |
350 | QString file = showImg; | 353 | QString file = showImg; |
351 | DocLnk lnk(showImg); | 354 | DocLnk lnk(showImg); |
352 | if (lnk.isValid() ) | 355 | if (lnk.isValid() ) |
353 | file = lnk.file(); | 356 | file = lnk.file(); |
354 | 357 | ||
355 | slotDisplay( file ); | 358 | slotDisplay( file ); |
356 | } | 359 | } |