summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index a96bfbd..e532867 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,167 +1,165 @@
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" ) ); 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 m_SmallWindow = QApplication::desktop()->size().width()<330; 51 m_SmallWindow = QApplication::desktop()->size().width()<330;
52 52
53 m_storage = new StorageInfo(); 53 m_storage = new StorageInfo();
54 connect(m_storage, SIGNAL(disksChanged() ), 54 connect(m_storage, SIGNAL(disksChanged() ),
55 this, SLOT( dirChanged() ) ); 55 this, SLOT( dirChanged() ) );
56 56
57 m_stack = new Opie::Ui::OWidgetStack( this ); 57 m_stack = new Opie::Ui::OWidgetStack( this );
58 setCentralWidget( m_stack ); 58 setCentralWidget( m_stack );
59 59
60 m_view = new PIconView( m_stack, m_cfg ); 60 m_view = new PIconView( m_stack, m_cfg );
61 m_stack->addWidget( m_view, IconView ); 61 m_stack->addWidget( m_view, IconView );
62 m_stack->raiseWidget( IconView ); 62 m_stack->raiseWidget( IconView );
63 63
64 connect(m_view, SIGNAL(sig_display(const QString&)), 64 connect(m_view, SIGNAL(sig_display(const QString&)),
65 this, SLOT(slotDisplay(const QString&))); 65 this, SLOT(slotDisplay(const QString&)));
66 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 66 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
67 this, SLOT(slotShowInfo(const QString&)) ); 67 this, SLOT(slotShowInfo(const QString&)) );
68 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 68 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
69 69
70 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
71
72 listviewMenu = 0; 70 listviewMenu = 0;
73 /* setup menu and toolbar */ 71 /* setup menu and toolbar */
74 setupActions(); 72 setupActions();
75 setupToolbar(); 73 setupToolbar();
76 setupMenu(); 74 setupMenu();
77 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); 75 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
78 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); 76 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
79 if (m_aForceSmall) { 77 if (m_aForceSmall) {
80 m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true)); 78 m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true));
81 } 79 }
82 odebug << "mainwindow constructor done" << oendl; 80 odebug << "mainwindow constructor done" << oendl;
83} 81}
84 82
85PMainWindow::~PMainWindow() { 83PMainWindow::~PMainWindow() {
86} 84}
87 85
88void PMainWindow::slotToggleZoomer() 86void PMainWindow::slotToggleZoomer()
89{ 87{
90 m_aZoomer->setOn(!m_aZoomer->isOn()); 88 m_aZoomer->setOn(!m_aZoomer->isOn());
91} 89}
92 90
93void PMainWindow::slotZoomerToggled(bool how) 91void PMainWindow::slotZoomerToggled(bool how)
94{ 92{
95 if (m_disp) { 93 if (m_disp) {
96 m_disp->setShowZoomer(how); 94 m_disp->setShowZoomer(how);
97 } 95 }
98 if (autoSave) { 96 if (autoSave) {
99 m_cfg->writeEntry("zoomeron",how); 97 m_cfg->writeEntry("zoomeron",how);
100 } 98 }
101} 99}
102 100
103void PMainWindow::slotToggleAutorotate() 101void PMainWindow::slotToggleAutorotate()
104{ 102{
105 if (!m_aAutoRotate->isEnabled()) return; 103 if (!m_aAutoRotate->isEnabled()) return;
106 m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); 104 m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
107} 105}
108 106
109void PMainWindow::slotToggleAutoscale() 107void PMainWindow::slotToggleAutoscale()
110{ 108{
111 m_aUnscaled->setOn(!m_aUnscaled->isOn()); 109 m_aUnscaled->setOn(!m_aUnscaled->isOn());
112} 110}
113 111
114void PMainWindow::slotRotateToggled(bool how) 112void PMainWindow::slotRotateToggled(bool how)
115{ 113{
116 if (autoSave) { 114 if (autoSave) {
117 m_cfg->writeEntry("autorotate",how); 115 m_cfg->writeEntry("autorotate",how);
118 } 116 }
119 if (m_disp) { 117 if (m_disp) {
120 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); 118 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
121 } 119 }
122} 120}
123 121
124void PMainWindow::slotScaleToggled(bool how) 122void PMainWindow::slotScaleToggled(bool how)
125{ 123{
126 if (autoSave) { 124 if (autoSave) {
127 m_cfg->writeEntry("unscaled",how); 125 m_cfg->writeEntry("unscaled",how);
128 } 126 }
129 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; 127 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
130 odebug << "How: " << how << oendl; 128 odebug << "How: " << how << oendl;
131 if (how) { 129 if (how) {
132 m_aAutoRotate->setOn(false); 130 m_aAutoRotate->setOn(false);
133 } 131 }
134 if (m_disp) { 132 if (m_disp) {
135 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); 133 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
136 } 134 }
137 m_aAutoRotate->setEnabled(!how); 135 m_aAutoRotate->setEnabled(!how);
138 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; 136 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
139} 137}
140 138
141void PMainWindow::slotConfig() { 139void PMainWindow::slotConfig() {
142 /* 140 /*
143 * have a tab with the possible views 141 * have a tab with the possible views
144 * a tab for globals image cache size.. scaled loading 142 * a tab for globals image cache size.. scaled loading
145 * and one tab for the KeyConfigs 143 * and one tab for the KeyConfigs
146 */ 144 */
147 QDialog dlg(this, 0, true); 145 QDialog dlg(this, 0, true);
148 dlg.setCaption( tr("Opie Eye - Config" ) ); 146 dlg.setCaption( tr("Opie Eye - Config" ) );
149 147
150 QHBoxLayout *lay = new QHBoxLayout(&dlg); 148 QHBoxLayout *lay = new QHBoxLayout(&dlg);
151 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 149 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
152 lay->addWidget( wid ); 150 lay->addWidget( wid );
153 151
154 BaseSetup*bSetup = new BaseSetup(m_cfg,wid); 152 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
155 wid->addTab(bSetup,"SettingsIcon","Basics setup"); 153 wid->addTab(bSetup,"SettingsIcon","Basics setup");
156 154
157 ViewMap *vM = viewMap(); 155 ViewMap *vM = viewMap();
158 ViewMap::Iterator _it = vM->begin(); 156 ViewMap::Iterator _it = vM->begin();
159 QMap<PDirView*, QWidget*> lst; 157 QMap<PDirView*, QWidget*> lst;
160 158
161 for( ; _it != vM->end(); ++_it ) { 159 for( ; _it != vM->end(); ++_it ) {
162 PDirView *view = (_it.data())(*m_cfg); 160 PDirView *view = (_it.data())(*m_cfg);
163 PInterfaceInfo *inf = view->interfaceInfo(); 161 PInterfaceInfo *inf = view->interfaceInfo();
164 QWidget *_wid = inf->configWidget( *m_cfg ); 162 QWidget *_wid = inf->configWidget( *m_cfg );
165 if (!_wid) continue; 163 if (!_wid) continue;
166 _wid->reparent(wid, QPoint() ); 164 _wid->reparent(wid, QPoint() );
167 lst.insert( view, _wid ); 165 lst.insert( view, _wid );