summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 295f93f..7570ee3 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,237 +1,237 @@
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" )
40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
41 41
42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 42PMainWindow::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" ) );
46 m_cfg = new Opie::Core::OConfig("opie-eye"); 46 m_cfg = new Opie::Core::OConfig("opie-eye");
47 m_cfg->setGroup("main" ); 47 m_cfg->setGroup("main" );
48 readConfig(); 48 readConfig();
49 m_setDocCalled = false; 49 m_setDocCalled = false;
50 m_polishDone = false; 50 m_polishDone = false;
51 51
52 m_storage = new StorageInfo(); 52 m_storage = new StorageInfo();
53 connect(m_storage, SIGNAL(disksChanged() ), 53 connect(m_storage, SIGNAL(disksChanged() ),
54 this, SLOT( dirChanged() ) ); 54 this, SLOT( dirChanged() ) );
55 55
56 m_stack = new Opie::Ui::OWidgetStack( this ); 56 m_stack = new Opie::Ui::OWidgetStack( this );
57 setCentralWidget( m_stack ); 57 setCentralWidget( m_stack );
58 58
59 m_view = new PIconView( m_stack, m_cfg ); 59 m_view = new PIconView( m_stack, m_cfg );
60 m_stack->addWidget( m_view, IconView ); 60 m_stack->addWidget( m_view, IconView );
61 m_stack->raiseWidget( IconView ); 61 m_stack->raiseWidget( IconView );
62 62
63 connect(m_view, SIGNAL(sig_display(const QString&)), 63 connect(m_view, SIGNAL(sig_display(const QString&)),
64 this, SLOT(slotDisplay(const QString&))); 64 this, SLOT(slotDisplay(const QString&)));
65 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 65 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
66 this, SLOT(slotShowInfo(const QString&)) ); 66 this, SLOT(slotShowInfo(const QString&)) );
67 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 67 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
68 68
69 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 69 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
70 70
71 listviewMenu = 0; 71 listviewMenu = 0;
72 /* setup menu and toolbar */ 72 /* setup menu and toolbar */
73 setupActions(); 73 setupActions();
74 setupToolbar(); 74 setupToolbar();
75 setupMenu(); 75 setupMenu();
76 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); 76 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
77 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); 77 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
78 odebug << "mainwindow constructor done" << oendl; 78 odebug << "mainwindow constructor done" << oendl;
79} 79}
80 80
81PMainWindow::~PMainWindow() { 81PMainWindow::~PMainWindow() {
82} 82}
83 83
84void PMainWindow::slotToggleZoomer() 84void PMainWindow::slotToggleZoomer()
85{ 85{
86 m_aZoomer->setOn(!m_aZoomer->isOn()); 86 m_aZoomer->setOn(!m_aZoomer->isOn());
87} 87}
88 88
89void PMainWindow::slotZoomerToggled(bool how) 89void PMainWindow::slotZoomerToggled(bool how)
90{ 90{
91 if (m_disp) { 91 if (m_disp) {
92 m_disp->setShowZoomer(how); 92 m_disp->setShowZoomer(how);
93 } 93 }
94 if (autoSave) { 94 if (autoSave) {
95 m_cfg->writeEntry("zoomeron",how); 95 m_cfg->writeEntry("zoomeron",how);
96 } 96 }
97} 97}
98 98
99void PMainWindow::slotToggleAutorotate() 99void PMainWindow::slotToggleAutorotate()
100{ 100{
101 if (!m_aAutoRotate->isEnabled()) return; 101 if (!m_aAutoRotate->isEnabled()) return;
102 m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); 102 m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
103} 103}
104 104
105void PMainWindow::slotToggleAutoscale() 105void PMainWindow::slotToggleAutoscale()
106{ 106{
107 m_aUnscaled->setOn(!m_aUnscaled->isOn()); 107 m_aUnscaled->setOn(!m_aUnscaled->isOn());
108} 108}
109 109
110void PMainWindow::slotRotateToggled(bool how) 110void PMainWindow::slotRotateToggled(bool how)
111{ 111{
112 if (autoSave) { 112 if (autoSave) {
113 m_cfg->writeEntry("autorotate",how); 113 m_cfg->writeEntry("autorotate",how);
114 } 114 }
115 if (m_disp) { 115 if (m_disp) {
116 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); 116 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
117 } 117 }
118} 118}
119 119
120void PMainWindow::slotScaleToggled(bool how) 120void PMainWindow::slotScaleToggled(bool how)
121{ 121{
122 if (autoSave) { 122 if (autoSave) {
123 m_cfg->writeEntry("unscaled",how); 123 m_cfg->writeEntry("unscaled",how);
124 } 124 }
125 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; 125 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
126 odebug << "How: " << how << oendl; 126 odebug << "How: " << how << oendl;
127 if (how) { 127 if (how) {
128 m_aAutoRotate->setOn(false); 128 m_aAutoRotate->setOn(false);
129 } 129 }
130 if (m_disp) { 130 if (m_disp) {
131 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); 131 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
132 } 132 }
133 m_aAutoRotate->setEnabled(!how); 133 m_aAutoRotate->setEnabled(!how);
134 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; 134 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
135} 135}
136 136
137void PMainWindow::slotConfig() { 137void PMainWindow::slotConfig() {
138 /* 138 /*
139 * have a tab with the possible views 139 * have a tab with the possible views
140 * a tab for globals image cache size.. scaled loading 140 * a tab for globals image cache size.. scaled loading
141 * and one tab for the KeyConfigs 141 * and one tab for the KeyConfigs
142 */ 142 */
143 QDialog dlg(this, 0, true); 143 QDialog dlg(this, 0, true);
144 dlg.setCaption( tr("Opie Eye - Config" ) ); 144 dlg.setCaption( tr("Opie Eye - Config" ) );
145 145
146 QHBoxLayout *lay = new QHBoxLayout(&dlg); 146 QHBoxLayout *lay = new QHBoxLayout(&dlg);
147 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 147 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
148 lay->addWidget( wid ); 148 lay->addWidget( wid );
149 149
150 BaseSetup*bSetup = new BaseSetup(m_cfg,wid); 150 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
151 wid->addTab(bSetup,"SettingsIcon","Basics setup"); 151 wid->addTab(bSetup,"SettingsIcon","Basics setup");
152 152
153 ViewMap *vM = viewMap(); 153 ViewMap *vM = viewMap();
154 ViewMap::Iterator _it = vM->begin(); 154 ViewMap::Iterator _it = vM->begin();
155 QMap<PDirView*, QWidget*> lst; 155 QMap<PDirView*, QWidget*> lst;
156 156
157 for( ; _it != vM->end(); ++_it ) { 157 for( ; _it != vM->end(); ++_it ) {
158 PDirView *view = (_it.data())(*m_cfg); 158 PDirView *view = (_it.data())(*m_cfg);
159 PInterfaceInfo *inf = view->interfaceInfo(); 159 PInterfaceInfo *inf = view->interfaceInfo();
160 QWidget *_wid = inf->configWidget( *m_cfg ); 160 QWidget *_wid = inf->configWidget( *m_cfg );
161 if (!_wid) continue; 161 if (!_wid) continue;
162 _wid->reparent(wid, QPoint() ); 162 _wid->reparent(wid, QPoint() );
163 lst.insert( view, _wid ); 163 lst.insert( view, _wid );
164 wid->addTab( _wid, "fileopen", inf->name() ); 164 wid->addTab( _wid, "fileopen", inf->name() );
165 } 165 }
166 166
167/* 167/*
168 * Add the KeyConfigWidget 168 * Add the KeyConfigWidget
169 */ 169 */
170 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 170 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
171 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 171 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
172 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 172 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
173 QWidget*w = m_stack->visibleWidget(); 173 QWidget*w = m_stack->visibleWidget();
174 174
175 bool reminfo = false; 175 bool reminfo = false;
176 if ( !m_info ) { 176 if ( !m_info ) {
177 reminfo = true; 177 reminfo = true;
178 initInfo(); 178 initInfo();
179 m_info->hide(); 179 m_info->hide();
180 } 180 }
181 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 181 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
182 182
183 bool remdisp = false; 183 bool remdisp = false;
184 if ( !m_disp ) { 184 if ( !m_disp ) {
185 remdisp = true; 185 remdisp = true;
186 initDisp(); 186 initDisp();
187 m_disp->hide(); 187 m_disp->hide();
188 } 188 }
189 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 189 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
190 190
191 keyWid->load(); 191 keyWid->load();
192 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 192 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
193 wid->setCurrentTab(0); 193 wid->setCurrentTab(0);
194 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 194 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
195 195
196/* 196/*
197 * clean up 197 * clean up
198 *apply changes 198 *apply changes
199 */ 199 */
200 200
201 QMap<PDirView*, QWidget*>::Iterator it; 201 QMap<PDirView*, QWidget*>::Iterator it;
202 for ( it = lst.begin(); it != lst.end(); ++it ) { 202 for ( it = lst.begin(); it != lst.end(); ++it ) {
203 if ( act ) 203 if ( act )
204 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 204 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
205 delete it.key(); 205 delete it.key();
206 } 206 }
207 207
208 208
209 if ( act ) { 209 if ( act ) {
210 keyWid->save(); 210 keyWid->save();
211 m_disp->manager()->save(); 211 m_disp->manager()->save();
212 m_info->manager()->save(); 212 m_info->manager()->save();
213 m_view->manager()->save(); 213 m_view->manager()->save();
214 bSetup->save_values(); 214 bSetup->save_values();
215 m_view->resetView(); 215 m_view->resetView();
216 readConfig(); 216 readConfig();
217 } 217 }
218 delete keyWid; 218 delete keyWid;
219 219
220 m_stack->raiseWidget(w); 220 m_stack->raiseWidget(w);
221 if (remdisp) { 221 if (remdisp) {
222 m_disp->hide(); 222 m_disp->hide();
223 } 223 }
224 if (reminfo) { 224 if (reminfo) {
225 m_info->hide(); 225 m_info->hide();
226 } 226 }
227} 227}
228 228
229/* 229/*
230 * create a new image info component 230 * create a new image info component
231 * and detach the current one 231 * and detach the current one
232 * we will make the other delete on exit 232 * we will make the other delete on exit
233 */ 233 */
234template<class T> 234template<class T>
235void PMainWindow::initT( const char* name, T** ptr, int id) { 235void PMainWindow::initT( const char* name, T** ptr, int id) {
236 if ( *ptr ) { 236 if ( *ptr ) {
237 (*ptr)->disconnect(this, SLOT(slotReturn())); 237 (*ptr)->disconnect(this, SLOT(slotReturn()));