summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-22 22:18:58 (UTC)
committer alwin <alwin>2005-03-22 22:18:58 (UTC)
commitd7b39880bb7de4908e8a1239d37bb48d83c4a0ba (patch) (unidiff)
tree64ffc1750d149f52c1c48c676f7ecc29cc442b23
parent31035d399edaaaff64976705fd44468b6357c863 (diff)
downloadopie-d7b39880bb7de4908e8a1239d37bb48d83c4a0ba.zip
opie-d7b39880bb7de4908e8a1239d37bb48d83c4a0ba.tar.gz
opie-d7b39880bb7de4908e8a1239d37bb48d83c4a0ba.tar.bz2
-fixed some strange display bugs depending of switch to qte 2.3.10
-inserted the missed (and asked for) feature setting a display brightness on the fly. Known Bugs left: When starting with setting a document the image will not displayed if too large. It is since switch to qte 2.3.10 eg. seems to be a timing problem when loading cost too much time. I have no idea how to fix it this moment.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.cpp19
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.h5
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp68
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h5
4 files changed, 95 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp
index fdf3466..b0fefbf 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.cpp
+++ b/noncore/graphics/opie-eye/gui/basesetup.cpp
@@ -1,80 +1,97 @@
1#include "basesetup.h" 1#include "basesetup.h"
2 2
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qlayout.h> 4#include <qlayout.h>
5#include <qspinbox.h> 5#include <qspinbox.h>
6#include <qcheckbox.h> 6#include <qcheckbox.h>
7 7
8BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f) 8BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f)
9 :QFrame(parent,name,f) 9 :QFrame(parent,name,f)
10{ 10{
11 setFrameStyle(Box|Raised); 11 setFrameStyle(Box|Raised);
12 m_cfg = a_cfg; 12 m_cfg = a_cfg;
13 m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout"); 13 m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout");
14 14
15 m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout"); 15 m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout");
16 m_IconsizeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IconsizeLayout"); 16 m_IconsizeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IconsizeLayout");
17 m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout");
17 18
18 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" ); 19 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" );
19 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 20 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
20 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus ); 21 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus );
21 m_SlideShowTime->setMaxValue( 60 ); 22 m_SlideShowTime->setMaxValue( 60 );
22 m_SlideShowTime->setMinValue(0); 23 m_SlideShowTime->setMinValue(0);
23 m_SlideShowTime->setValue( 2 ); 24 m_SlideShowTime->setValue( 2 );
24 m_SlideShowTime->setSuffix(tr(" seconds")); 25 m_SlideShowTime->setSuffix(tr(" seconds"));
25 26
26 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 ); 27 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 );
27 28
28 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" ); 29 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" );
29 m_SlidetimeLabel->setText(tr("Slideshow timeout:")); 30 m_SlidetimeLabel->setText(tr("Slideshow timeout:"));
30 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 ); 31 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 );
31 m_MainLayout->addLayout( m_SlidetimeLayout ); 32 m_MainLayout->addLayout( m_SlidetimeLayout );
32 33
33 m_Iconsize = new QSpinBox( this, "m_Iconsize" ); 34 m_Iconsize = new QSpinBox( this, "m_Iconsize" );
34 m_Iconsize->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 35 m_Iconsize->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
35 m_Iconsize->setButtonSymbols( QSpinBox::PlusMinus ); 36 m_Iconsize->setButtonSymbols( QSpinBox::PlusMinus );
36 m_Iconsize->setMaxValue( 64 ); 37 m_Iconsize->setMaxValue( 128 );
37 m_Iconsize->setMinValue(12); 38 m_Iconsize->setMinValue(12);
38 m_Iconsize->setValue( 32 ); 39 m_Iconsize->setValue( 32 );
39 m_Iconsize->setSuffix(tr(" pixel")); 40 m_Iconsize->setSuffix(tr(" pixel"));
40 m_IconsizeLayout->addWidget( m_Iconsize, 0, 1 ); 41 m_IconsizeLayout->addWidget( m_Iconsize, 0, 1 );
41 m_IconsizeLabel = new QLabel( this, "m_IconsizeLabel" ); 42 m_IconsizeLabel = new QLabel( this, "m_IconsizeLabel" );
42 m_IconsizeLabel->setText(tr("Size of thumbnails:")); 43 m_IconsizeLabel->setText(tr("Size of thumbnails:"));
43 m_IconsizeLayout->addWidget( m_IconsizeLabel, 0, 0 ); 44 m_IconsizeLayout->addWidget( m_IconsizeLabel, 0, 0 );
44 m_MainLayout->addLayout(m_IconsizeLayout); 45 m_MainLayout->addLayout(m_IconsizeLayout);
45 46
47 m_Intensity = new QSpinBox( this, "m_Intensity" );
48 m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
49 m_Intensity->setButtonSymbols( QSpinBox::PlusMinus );
50 m_Intensity->setMaxValue( 255 );
51 m_Intensity->setMinValue(-255);
52 m_Intensity->setValue( 0 );
53 m_IntensityLayout->addWidget( m_Intensity, 0, 1 );
54 m_IntensityLabel = new QLabel( this, "m_IntensityLabel" );
55 m_IntensityLabel->setText(tr("Default display brightness:"));
56 m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 );
57 m_MainLayout->addLayout(m_IntensityLayout);
46 58
47#if 0 59#if 0
48 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" ); 60 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" );
49 m_ShowToolBar->setText(tr("Show toolbar on startup")); 61 m_ShowToolBar->setText(tr("Show toolbar on startup"));
50 m_MainLayout->addWidget( m_ShowToolBar ); 62 m_MainLayout->addWidget( m_ShowToolBar );
51#endif 63#endif
52 m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" ); 64 m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" );
53 m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate")); 65 m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate"));
54 m_MainLayout->addWidget( m_SaveStateAuto ); 66 m_MainLayout->addWidget( m_SaveStateAuto );
55 67
56 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); 68 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
57 m_MainLayout->addItem( spacer1 ); 69 m_MainLayout->addItem( spacer1 );
58 70
59 int stime = m_cfg->readNumEntry("slideshowtimeout",2); 71 int stime = m_cfg->readNumEntry("slideshowtimeout",2);
60 if (stime<0) stime=2; 72 if (stime<0) stime=2;
61 if (stime>60) stime=60; 73 if (stime>60) stime=60;
62 m_SlideShowTime->setValue(stime); 74 m_SlideShowTime->setValue(stime);
63 m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("savestatus",true)); 75 m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("savestatus",true));
64 stime = m_cfg->readNumEntry("iconsize", 32); 76 stime = m_cfg->readNumEntry("iconsize", 32);
65 if (stime<12)stime = 12; 77 if (stime<12)stime = 12;
66 if (stime>64)stime = 64; 78 if (stime>64)stime = 64;
67 m_Iconsize->setValue(stime); 79 m_Iconsize->setValue(stime);
80 stime = m_cfg->readNumEntry("intensity",0);
81 if (stime<-255) stime = -255;
82 if (stime>255) stime = 255;
83 m_Intensity->setValue(stime);
68} 84}
69 85
70BaseSetup::~BaseSetup() 86BaseSetup::~BaseSetup()
71{ 87{
72} 88}
73 89
74void BaseSetup::save_values() 90void BaseSetup::save_values()
75{ 91{
76 if (!m_cfg) return; 92 if (!m_cfg) return;
77 m_cfg->writeEntry("slideshowtimeout",m_SlideShowTime->value()); 93 m_cfg->writeEntry("slideshowtimeout",m_SlideShowTime->value());
78 m_cfg->writeEntry("savestatus",m_SaveStateAuto->isChecked()); 94 m_cfg->writeEntry("savestatus",m_SaveStateAuto->isChecked());
79 m_cfg->writeEntry("iconsize",m_Iconsize->value()); 95 m_cfg->writeEntry("iconsize",m_Iconsize->value());
96 m_cfg->writeEntry("intensity",m_Intensity->value());
80} 97}
diff --git a/noncore/graphics/opie-eye/gui/basesetup.h b/noncore/graphics/opie-eye/gui/basesetup.h
index 95929f2..cda6777 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.h
+++ b/noncore/graphics/opie-eye/gui/basesetup.h
@@ -1,38 +1,43 @@
1#ifndef _BASESETUP_H 1#ifndef _BASESETUP_H
2#define _BASESETUP_H 2#define _BASESETUP_H
3 3
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5 5
6#include <qframe.h> 6#include <qframe.h>
7 7
8class QVBoxLayout; 8class QVBoxLayout;
9class QGridLayout; 9class QGridLayout;
10class QSpinBox; 10class QSpinBox;
11class QLabel; 11class QLabel;
12class QCheckBox; 12class QCheckBox;
13class QSpacerItem; 13class QSpacerItem;
14 14
15class BaseSetup:public QFrame 15class BaseSetup:public QFrame
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18public: 18public:
19 BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent=0, const char * name=0, WFlags f=0); 19 BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent=0, const char * name=0, WFlags f=0);
20 virtual ~BaseSetup(); 20 virtual ~BaseSetup();
21 21
22public slots: 22public slots:
23 virtual void save_values(); 23 virtual void save_values();
24 24
25protected: 25protected:
26 Opie::Core::OConfig *m_cfg; 26 Opie::Core::OConfig *m_cfg;
27 QVBoxLayout * m_MainLayout; 27 QVBoxLayout * m_MainLayout;
28 QGridLayout * m_SlidetimeLayout; 28 QGridLayout * m_SlidetimeLayout;
29 QSpinBox * m_SlideShowTime; 29 QSpinBox * m_SlideShowTime;
30 QLabel * m_SlidetimeLabel; 30 QLabel * m_SlidetimeLabel;
31 QCheckBox *m_SaveStateAuto; 31 QCheckBox *m_SaveStateAuto;
32 QSpacerItem *spacer1; 32 QSpacerItem *spacer1;
33 QGridLayout * m_IconsizeLayout; 33 QGridLayout * m_IconsizeLayout;
34 QSpinBox * m_Iconsize; 34 QSpinBox * m_Iconsize;
35 QLabel * m_IconsizeLabel; 35 QLabel * m_IconsizeLabel;
36
37 QGridLayout * m_IntensityLayout;
38 QSpinBox * m_Intensity;
39 QLabel * m_IntensityLabel;
40
36}; 41};
37 42
38#endif 43#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index e532867..3a89dfd 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,766 +1,834 @@
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#include <opie2/owait.h>
23#include <opie2/oapplication.h>
22 24
23#include <qpe/resource.h> 25#include <qpe/resource.h>
24#include <qpe/config.h> 26#include <qpe/config.h>
25#include <qpe/ir.h> 27#include <qpe/ir.h>
26#include <qpe/storage.h> 28#include <qpe/storage.h>
27#include <qpe/applnk.h> 29#include <qpe/applnk.h>
28 30
29#include <qtoolbar.h> 31#include <qtoolbar.h>
30#include <qtoolbutton.h> 32#include <qtoolbutton.h>
31#include <qlayout.h> 33#include <qlayout.h>
32#include <qdialog.h> 34#include <qdialog.h>
33#include <qmap.h> 35#include <qmap.h>
34#include <qtimer.h> 36#include <qtimer.h>
35#include <qframe.h> 37#include <qframe.h>
36#include <qmenubar.h> 38#include <qmenubar.h>
37#include <qaction.h> 39#include <qaction.h>
40#include <qspinbox.h>
38 41
39//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 42//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 43OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
41 44
42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 45PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
43 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 46 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
44{ 47{
45 setCaption( QObject::tr("Opie Eye" ) ); 48 setCaption( QObject::tr("Opie Eye" ) );
46 m_cfg = new Opie::Core::OConfig("opie-eye"); 49 m_cfg = new Opie::Core::OConfig("opie-eye");
47 m_cfg->setGroup("main" ); 50 m_cfg->setGroup("main" );
48 readConfig(); 51 readConfig();
49 m_setDocCalled = false; 52 m_setDocCalled = false;
50 m_polishDone = false; 53 m_polishDone = false;
51 m_SmallWindow = QApplication::desktop()->size().width()<330; 54 m_SmallWindow = QApplication::desktop()->size().width()<330;
52 55
53 m_storage = new StorageInfo(); 56 m_storage = new StorageInfo();
54 connect(m_storage, SIGNAL(disksChanged() ), 57 connect(m_storage, SIGNAL(disksChanged() ),
55 this, SLOT( dirChanged() ) ); 58 this, SLOT( dirChanged() ) );
56 59
57 m_stack = new Opie::Ui::OWidgetStack( this ); 60 m_stack = new Opie::Ui::OWidgetStack( this );
58 setCentralWidget( m_stack ); 61 setCentralWidget( m_stack );
59 62
60 m_view = new PIconView( m_stack, m_cfg ); 63 m_view = new PIconView( m_stack, m_cfg );
61 m_stack->addWidget( m_view, IconView ); 64 m_stack->addWidget( m_view, IconView );
62 m_stack->raiseWidget( IconView ); 65 m_stack->raiseWidget( IconView );
63 66
64 connect(m_view, SIGNAL(sig_display(const QString&)), 67 connect(m_view, SIGNAL(sig_display(const QString&)),
65 this, SLOT(slotDisplay(const QString&))); 68 this, SLOT(slotDisplay(const QString&)));
66 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 69 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
67 this, SLOT(slotShowInfo(const QString&)) ); 70 this, SLOT(slotShowInfo(const QString&)) );
68 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 71 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
69 72
70 listviewMenu = 0; 73 listviewMenu = 0;
71 /* setup menu and toolbar */ 74 /* setup menu and toolbar */
72 setupActions(); 75 setupActions();
73 setupToolbar(); 76 setupToolbar();
74 setupMenu(); 77 setupMenu();
75 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); 78 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
76 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); 79 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
77 if (m_aForceSmall) { 80 if (m_aForceSmall) {
78 m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true)); 81 m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true));
79 } 82 }
80 odebug << "mainwindow constructor done" << oendl; 83 odebug << "mainwindow constructor done" << oendl;
81} 84}
82 85
83PMainWindow::~PMainWindow() { 86PMainWindow::~PMainWindow() {
84} 87}
85 88
86void PMainWindow::slotToggleZoomer() 89void PMainWindow::slotToggleZoomer()
87{ 90{
88 m_aZoomer->setOn(!m_aZoomer->isOn()); 91 m_aZoomer->setOn(!m_aZoomer->isOn());
89} 92}
90 93
91void PMainWindow::slotZoomerToggled(bool how) 94void PMainWindow::slotZoomerToggled(bool how)
92{ 95{
93 if (m_disp) { 96 if (m_disp) {
94 m_disp->setShowZoomer(how); 97 m_disp->setShowZoomer(how);
95 } 98 }
96 if (autoSave) { 99 if (autoSave) {
97 m_cfg->writeEntry("zoomeron",how); 100 m_cfg->writeEntry("zoomeron",how);
98 } 101 }
99} 102}
100 103
101void PMainWindow::slotToggleAutorotate() 104void PMainWindow::slotToggleAutorotate()
102{ 105{
103 if (!m_aAutoRotate->isEnabled()) return; 106 if (!m_aAutoRotate->isEnabled()) return;
104 m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); 107 m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
105} 108}
106 109
107void PMainWindow::slotToggleAutoscale() 110void PMainWindow::slotToggleAutoscale()
108{ 111{
109 m_aUnscaled->setOn(!m_aUnscaled->isOn()); 112 m_aUnscaled->setOn(!m_aUnscaled->isOn());
110} 113}
111 114
112void PMainWindow::slotRotateToggled(bool how) 115void PMainWindow::slotRotateToggled(bool how)
113{ 116{
114 if (autoSave) { 117 if (autoSave) {
115 m_cfg->writeEntry("autorotate",how); 118 m_cfg->writeEntry("autorotate",how);
116 } 119 }
117 if (m_disp) { 120 if (m_disp) {
118 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); 121 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
119 } 122 }
120} 123}
121 124
122void PMainWindow::slotScaleToggled(bool how) 125void PMainWindow::slotScaleToggled(bool how)
123{ 126{
124 if (autoSave) { 127 if (autoSave) {
125 m_cfg->writeEntry("unscaled",how); 128 m_cfg->writeEntry("unscaled",how);
126 } 129 }
127 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; 130 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
128 odebug << "How: " << how << oendl; 131 odebug << "How: " << how << oendl;
129 if (how) { 132 if (how) {
130 m_aAutoRotate->setOn(false); 133 m_aAutoRotate->setOn(false);
131 } 134 }
132 if (m_disp) { 135 if (m_disp) {
133 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); 136 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
134 } 137 }
135 m_aAutoRotate->setEnabled(!how); 138 m_aAutoRotate->setEnabled(!how);
136 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; 139 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
137} 140}
138 141
139void PMainWindow::slotConfig() { 142void PMainWindow::slotConfig() {
140 /* 143 /*
141 * have a tab with the possible views 144 * have a tab with the possible views
142 * a tab for globals image cache size.. scaled loading 145 * a tab for globals image cache size.. scaled loading
143 * and one tab for the KeyConfigs 146 * and one tab for the KeyConfigs
144 */ 147 */
145 QDialog dlg(this, 0, true); 148 QDialog dlg(this, 0, true);
146 dlg.setCaption( tr("Opie Eye - Config" ) ); 149 dlg.setCaption( tr("Opie Eye - Config" ) );
147 150
148 QHBoxLayout *lay = new QHBoxLayout(&dlg); 151 QHBoxLayout *lay = new QHBoxLayout(&dlg);
149 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 152 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
150 lay->addWidget( wid ); 153 lay->addWidget( wid );
151 154
152 BaseSetup*bSetup = new BaseSetup(m_cfg,wid); 155 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
153 wid->addTab(bSetup,"SettingsIcon","Basics setup"); 156 wid->addTab(bSetup,"SettingsIcon","Basics setup");
154 157
155 ViewMap *vM = viewMap(); 158 ViewMap *vM = viewMap();
156 ViewMap::Iterator _it = vM->begin(); 159 ViewMap::Iterator _it = vM->begin();
157 QMap<PDirView*, QWidget*> lst; 160 QMap<PDirView*, QWidget*> lst;
158 161
159 for( ; _it != vM->end(); ++_it ) { 162 for( ; _it != vM->end(); ++_it ) {
160 PDirView *view = (_it.data())(*m_cfg); 163 PDirView *view = (_it.data())(*m_cfg);
161 PInterfaceInfo *inf = view->interfaceInfo(); 164 PInterfaceInfo *inf = view->interfaceInfo();
162 QWidget *_wid = inf->configWidget( *m_cfg ); 165 QWidget *_wid = inf->configWidget( *m_cfg );
163 if (!_wid) continue; 166 if (!_wid) continue;
164 _wid->reparent(wid, QPoint() ); 167 _wid->reparent(wid, QPoint() );
165 lst.insert( view, _wid ); 168 lst.insert( view, _wid );
166 wid->addTab( _wid, "fileopen", inf->name() ); 169 wid->addTab( _wid, "fileopen", inf->name() );
167 } 170 }
168 171
169/* 172/*
170 * Add the KeyConfigWidget 173 * Add the KeyConfigWidget
171 */ 174 */
172 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 175 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
173 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 176 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
174 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 177 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
175 QWidget*w = m_stack->visibleWidget(); 178 QWidget*w = m_stack->visibleWidget();
176 179
177 bool reminfo = false; 180 bool reminfo = false;
178 if ( !m_info ) { 181 if ( !m_info ) {
179 reminfo = true; 182 reminfo = true;
180 initInfo(); 183 initInfo();
181 m_info->hide(); 184 m_info->hide();
182 } 185 }
183 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 186 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
184 187
185 bool remdisp = false; 188 bool remdisp = false;
186 if ( !m_disp ) { 189 if ( !m_disp ) {
187 remdisp = true; 190 remdisp = true;
188 initDisp(); 191 initDisp();
189 m_disp->hide(); 192 m_disp->hide();
190 } 193 }
191 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 194 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
192 195
193 keyWid->load(); 196 keyWid->load();
194 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 197 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
195 wid->setCurrentTab(0); 198 wid->setCurrentTab(0);
196 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 199 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
197 200
198/* 201/*
199 * clean up 202 * clean up
200 *apply changes 203 *apply changes
201 */ 204 */
202 205
203 QMap<PDirView*, QWidget*>::Iterator it; 206 QMap<PDirView*, QWidget*>::Iterator it;
204 for ( it = lst.begin(); it != lst.end(); ++it ) { 207 for ( it = lst.begin(); it != lst.end(); ++it ) {
205 if ( act ) 208 if ( act )
206 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 209 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
207 delete it.key(); 210 delete it.key();
208 } 211 }
209 212
210 213
211 if ( act ) { 214 if ( act ) {
212 keyWid->save(); 215 keyWid->save();
213 m_disp->manager()->save(); 216 m_disp->manager()->save();
214 m_info->manager()->save(); 217 m_info->manager()->save();
215 m_view->manager()->save(); 218 m_view->manager()->save();
216 bSetup->save_values(); 219 bSetup->save_values();
217 m_view->resetView(); 220 m_view->resetView();
218 readConfig(); 221 readConfig();
219 } 222 }
220 delete keyWid; 223 delete keyWid;
221 224
222 m_stack->raiseWidget(w); 225 m_stack->raiseWidget(w);
223 if (remdisp) { 226 if (remdisp) {
224 m_disp->hide(); 227 m_disp->hide();
225 } 228 }
226 if (reminfo) { 229 if (reminfo) {
227 m_info->hide(); 230 m_info->hide();
228 } 231 }
232 if (m_disp) {
233 m_disp->setIntensity(m_Intensity,true);
234 }
229} 235}
230 236
231/* 237/*
232 * create a new image info component 238 * create a new image info component
233 * and detach the current one 239 * and detach the current one
234 * we will make the other delete on exit 240 * we will make the other delete on exit
235 */ 241 */
236template<class T> 242template<class T>
237void PMainWindow::initT( const char* name, T** ptr, int id) { 243void PMainWindow::initT( const char* name, T** ptr, int id) {
238 if ( *ptr ) { 244 if ( *ptr ) {
239 (*ptr)->disconnect(this, SLOT(slotReturn())); 245 (*ptr)->disconnect(this, SLOT(slotReturn()));
240 (*ptr)->setDestructiveClose(); 246 (*ptr)->setDestructiveClose();
241 m_stack->removeWidget( *ptr ); 247 m_stack->removeWidget( *ptr );
242 } 248 }
243 *ptr = new T(m_cfg, m_stack, name ); 249 *ptr = new T(m_cfg, m_stack, name );
244 m_stack->addWidget( *ptr, id ); 250 m_stack->addWidget( *ptr, id );
245 251
246 connect(*ptr, SIGNAL(sig_return()), 252 connect(*ptr, SIGNAL(sig_return()),
247 this,SLOT(slotReturn())); 253 this,SLOT(slotReturn()));
248 254
249} 255}
250 256
251void PMainWindow::initInfo() { 257void PMainWindow::initInfo() {
252 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 258 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
253 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 259 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
254} 260}
255 261
256void PMainWindow::initDisp() { 262void PMainWindow::initDisp() {
257 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 263 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
258 if (m_disp) { 264 if (m_disp) {
259// if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 265// if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
260 //m_disp->setMinimumSize(QApplication::desktop()->size()/2); 266 //m_disp->setMinimumSize(QApplication::desktop()->size()/2);
261// } 267// }
262 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); 268 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType);
263 m_disp->setAutoScale(!m_aUnscaled->isOn()); 269 m_disp->setAutoScale(!m_aUnscaled->isOn());
264 m_disp->setAutoRotate(m_aAutoRotate->isOn()); 270 m_disp->setAutoRotate(m_aAutoRotate->isOn());
265 m_disp->setShowZoomer(m_aZoomer->isOn()); 271 m_disp->setShowZoomer(m_aZoomer->isOn());
266 m_disp->setBackgroundColor(white); 272 m_disp->setBackgroundColor(white);
267 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 273 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
268 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 274 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
269 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 275 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
270 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 276 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
271 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 277 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
272 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 278 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
273 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 279 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
274 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 280 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
275 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); 281 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
276 slotFullScreenToggled(m_aFullScreen->isOn()); 282 slotFullScreenToggled(m_aFullScreen->isOn());
277 } 283 }
278} 284}
279 285
280void PMainWindow::slotToggleFullScreen() 286void PMainWindow::slotToggleFullScreen()
281{ 287{
282 bool current = !m_aFullScreen->isOn(); 288 bool current = !m_aFullScreen->isOn();
283 m_aFullScreen->setOn(current); 289 m_aFullScreen->setOn(current);
284} 290}
285 291
286void PMainWindow::slotFullScreenButton(bool current) 292void PMainWindow::slotFullScreenButton(bool current)
287{ 293{
288 if (autoSave) { 294 if (autoSave) {
289 m_cfg->writeEntry("fullscreen",current); 295 m_cfg->writeEntry("fullscreen",current);
290 } 296 }
291 if (!m_disp) return; 297 if (!m_disp) return;
292 if (m_disp->isVisible()) { 298 if (m_disp->isVisible()) {
293 setupViewWindow(current, true); 299 setupViewWindow(current, true);
294 } 300 }
295} 301}
296 302
297void PMainWindow::setupViewWindow(bool current, bool forceDisplay) 303void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
298{ 304{
299 if (!m_disp) { 305 if (!m_disp) {
300 return; 306 return;
301 } 307 }
302 if (current) { 308 if (current) {
303 m_disp->setBackgroundColor(black); 309 m_disp->setBackgroundColor(black);
304 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 310 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
305 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 311 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
306 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 312 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
307 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 313 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
308 m_disp->setFullScreen(current,forceDisplay); 314 m_disp->setFullScreen(current,forceDisplay);
309 } else { 315 } else {
310 setUpdatesEnabled(false); 316 setUpdatesEnabled(false);
311#if 0 317#if 0
312 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 318 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
313 319
314 //m_disp->setMinimumSize(QApplication::desktop()->size()/2); 320 //m_disp->setMinimumSize(QApplication::desktop()->size()/2);
315 } else { 321 } else {
316 //m_disp->setMinimumSize(10,10); 322 //m_disp->setMinimumSize(10,10);
317 } 323 }
318#endif 324#endif
319 m_disp->setBackgroundColor(white); 325 m_disp->setBackgroundColor(white);
320 m_stack->addWidget(m_disp,ImageDisplay); 326 m_stack->addWidget(m_disp,ImageDisplay);
321 m_disp->setVScrollBarMode(QScrollView::Auto); 327 m_disp->setVScrollBarMode(QScrollView::Auto);
322 m_disp->setHScrollBarMode(QScrollView::Auto); 328 m_disp->setHScrollBarMode(QScrollView::Auto);
323 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 329 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
324 m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); 330 m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60);
325 } 331 }
326 if (forceDisplay || m_disp->isVisible()) { 332 if (forceDisplay || m_disp->isVisible()) {
327 m_stack->raiseWidget(m_disp); 333 m_stack->raiseWidget(m_disp);
328 m_disp->setFocus(); 334 m_disp->setFocus();
329 } 335 }
330 setUpdatesEnabled(true); 336 setUpdatesEnabled(true);
331 } 337 }
332 m_disp->setFullScreen(current,forceDisplay); 338 m_disp->setFullScreen(current,forceDisplay);
333} 339}
334 340
335void PMainWindow::slotFullScreenToggled(bool current) 341void PMainWindow::slotFullScreenToggled(bool current)
336{ 342{
337 setupViewWindow(current,true); 343 setupViewWindow(current,true);
338} 344}
339 345
340/** 346/**
341 * With big Screen the plan could be to 'detach' the image 347 * With big Screen the plan could be to 'detach' the image
342 * window if visible and to create a ne wone 348 * window if visible and to create a ne wone
343 * init* already supports it but I make no use of it for 349 * init* already supports it but I make no use of it for
344 * now. We set filename and raise 350 * now. We set filename and raise
345 * 351 *
346 * ### FIXME and talk to alwin 352 * ### FIXME and talk to alwin
347 */ 353 */
348void PMainWindow::slotShowInfo( const QString& inf ) { 354void PMainWindow::slotShowInfo( const QString& inf ) {
349 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 355 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
350 return; 356 return;
351 } 357 }
352 if ( !m_info ) { 358 if ( !m_info ) {
353 initInfo(); 359 initInfo();
354 } 360 }
355 m_info->setPath( inf ); 361 m_info->setPath( inf );
356 if (m_SmallWindow) { 362 if (m_SmallWindow) {
357 m_aNext->removeFrom(toolBar); 363 m_aNext->removeFrom(toolBar);
358 m_aPrevious->removeFrom(toolBar); 364 m_aPrevious->removeFrom(toolBar);
359 fsButton->hide(); 365 fsButton->hide();
360 } 366 }
361 m_aNext->setEnabled(false); 367 m_aNext->setEnabled(false);
362 m_aPrevious->setEnabled(false); 368 m_aPrevious->setEnabled(false);
363 m_aDirUp->setEnabled(false); 369 m_aDirUp->setEnabled(false);
364 m_aShowInfo->setEnabled(false); 370 m_aShowInfo->setEnabled(false);
365 m_aViewfile->setEnabled(true); 371 m_aViewfile->setEnabled(true);
366 m_aStartSlide->setEnabled(false); 372 m_aStartSlide->setEnabled(false);
367 m_stack->raiseWidget( ImageInfo ); 373 m_stack->raiseWidget( ImageInfo );
368} 374}
369 375
370void PMainWindow::slotDisplay( const QString& inf ) { 376void PMainWindow::slotDisplay( const QString& inf ) {
371 bool nwindow = false; 377 bool nwindow = false;
378 bool disp_hack = false;
379 int lb;
380 if (m_disp && m_disp->fullScreen()) {
381 lb = m_disp->Intensity();
382 delete m_disp;
383 m_disp = 0;
384
385 disp_hack = true;
386 }
372 if ( !m_disp ) { 387 if ( !m_disp ) {
373 nwindow = true; 388 nwindow = true;
374 initDisp(); 389 initDisp();
390 m_disp->setIntensity((disp_hack?lb:m_Intensity));
375 } 391 }
392 m_setCurrentBrightness->setEnabled(true);
393
394 Opie::Ui::OWait wdlg;
395 wdlg.setTimerLength(30);
396 wdlg.show();
397 //qApp->processEvents(20);
376 m_disp->setImage( inf ); 398 m_disp->setImage( inf );
399 wdlg.hide();
400 //qApp->processEvents(20);
377 if (m_SmallWindow) { 401 if (m_SmallWindow) {
378 if (m_gPrevNext->isEnabled()==false) { 402 if (m_gPrevNext->isEnabled()==false) {
379 m_gPrevNext->addTo(toolBar); 403 m_gPrevNext->addTo(toolBar);
380 fsButton->hide(); 404 fsButton->hide();
381 } 405 }
382 } 406 }
383 m_gPrevNext->setEnabled(true); 407 m_gPrevNext->setEnabled(true);
384 m_aDirUp->setEnabled(false); 408 m_aDirUp->setEnabled(false);
385 m_aShowInfo->setEnabled(true); 409 m_aShowInfo->setEnabled(true);
386 m_aViewfile->setEnabled(false); 410 m_aViewfile->setEnabled(false);
387 m_aStartSlide->setEnabled(false); 411 m_aStartSlide->setEnabled(false);
388 412
389 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { 413 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) {
390 slotFullScreenToggled(m_aFullScreen->isOn()); 414 slotFullScreenToggled(m_aFullScreen->isOn());
391 } 415 }
392 if (m_disp->fullScreen()) { 416 if (m_disp->fullScreen()) {
393 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 417 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
394 } else { 418 } else {
395 m_stack->raiseWidget( ImageDisplay ); 419 m_stack->raiseWidget( ImageDisplay );
396 } 420 }
397} 421}
398 422
399void PMainWindow::raiseIconView() { 423void PMainWindow::raiseIconView() {
400 setUpdatesEnabled(false); 424 setUpdatesEnabled(false);
401 if (m_SmallWindow) { 425 if (m_SmallWindow) {
402 m_gPrevNext->removeFrom(toolBar); 426 m_gPrevNext->removeFrom(toolBar);
403 fsButton->show(); 427 fsButton->show();
404 } 428 }
405 m_gPrevNext->setEnabled(false); 429 m_gPrevNext->setEnabled(false);
406 m_aDirUp->setEnabled(true); 430 m_aDirUp->setEnabled(true);
407 m_aShowInfo->setEnabled(true); 431 m_aShowInfo->setEnabled(true);
408 m_aViewfile->setEnabled(true); 432 m_aViewfile->setEnabled(true);
409 m_aStartSlide->setEnabled(true); 433 m_aStartSlide->setEnabled(true);
410 434
411 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 435 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
412 m_disp->stopSlide(); 436 m_disp->stopSlide();
413 m_disp->hide(); 437 m_disp->hide();
414 } 438 }
415 m_stack->raiseWidget( IconView ); 439 m_stack->raiseWidget( IconView );
416 setUpdatesEnabled(true); 440 setUpdatesEnabled(true);
417 repaint(); 441 repaint();
418} 442}
419 443
420void PMainWindow::slotReturn() { 444void PMainWindow::slotReturn() {
421 raiseIconView(); 445 raiseIconView();
422} 446}
423 447
424 448
425void PMainWindow::closeEvent( QCloseEvent* ev ) { 449void PMainWindow::closeEvent( QCloseEvent* ev ) {
426 /* 450 /*
427 * return from view 451 * return from view
428 * or properly quit 452 * or properly quit
429 */ 453 */
430 if (!m_setDocCalled) { 454 if (!m_setDocCalled) {
431 if ( m_stack->visibleWidget() == m_info || 455 if ( m_stack->visibleWidget() == m_info ||
432 m_stack->visibleWidget() == m_disp ) { 456 m_stack->visibleWidget() == m_disp ) {
433 ev->ignore(); 457 ev->ignore();
434 raiseIconView(); 458 raiseIconView();
435 return; 459 return;
436 } 460 }
437 } 461 }
438 if (m_disp && m_disp->fullScreen()) { 462 if (m_disp && m_disp->fullScreen()) {
439 /* otherwise opie-eye crashes in bigscreen mode! */ 463 /* otherwise opie-eye crashes in bigscreen mode! */
440 m_disp->reparent(0,QPoint(0,0)); 464 m_disp->reparent(0,QPoint(0,0));
441 m_stack->addWidget(m_disp,ImageDisplay); 465 m_stack->addWidget(m_disp,ImageDisplay);
442 } 466 }
443 ev->accept(); 467 ev->accept();
444 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 468 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
445} 469}
446 470
447void PMainWindow::setDocument( const QString& showImg ) 471void PMainWindow::setDocument( const QString& showImg )
448{ 472{
449 QString file = showImg; 473 QString file = showImg;
450 DocLnk lnk(showImg); 474 DocLnk lnk(showImg);
451 if (lnk.isValid() ) 475 if (lnk.isValid() )
452 file = lnk.file(); 476 file = lnk.file();
453 slotDisplay( file ); 477 slotDisplay( file );
454#if 0 478#if 0
455 if (!m_polishDone) { 479 if (!m_polishDone) {
456 QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); 480 QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
457 } 481 }
458#endif 482#endif
459} 483}
460 484
461void PMainWindow::check_view_fullscreen() 485void PMainWindow::check_view_fullscreen()
462{ 486{
463 if (!m_view) return; 487 if (!m_view) return;
464 if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { 488 if (!m_view->hasFocus()&&m_aFullScreen->isOn()) {
465 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 489 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
466 } 490 }
467} 491}
468 492
469void PMainWindow::slotSelectDir(int id) 493void PMainWindow::slotSelectDir(int id)
470{ 494{
471 emit changeDir( m_dev[fsMenu->text(id )] ); 495 emit changeDir( m_dev[fsMenu->text(id )] );
472} 496}
473 497
474void PMainWindow::dirChanged() 498void PMainWindow::dirChanged()
475{ 499{
476 fsMenu->clear(); 500 fsMenu->clear();
477 m_dev.clear(); 501 m_dev.clear();
478 502
479 /* home dir, too */ 503 /* home dir, too */
480 QString f = getenv( "HOME" ); 504 QString f = getenv( "HOME" );
481 if (!f.isEmpty()) { 505 if (!f.isEmpty()) {
482 m_dev.insert("Home directory",f); 506 m_dev.insert("Home directory",f);
483 fsMenu->insertItem("Home directory"); 507 fsMenu->insertItem("Home directory");
484 } 508 }
485 const QList<FileSystem> &fs = m_storage->fileSystems(); 509 const QList<FileSystem> &fs = m_storage->fileSystems();
486 QListIterator<FileSystem> it(fs ); 510 QListIterator<FileSystem> it(fs );
487 for ( ; it.current(); ++it ) { 511 for ( ; it.current(); ++it ) {
488 const QString disk = (*it)->name(); 512 const QString disk = (*it)->name();
489 const QString path = (*it)->path(); 513 const QString path = (*it)->path();
490 m_dev.insert( disk, path ); 514 m_dev.insert( disk, path );
491 fsMenu->insertItem( disk ); 515 fsMenu->insertItem( disk );
492 } 516 }
493} 517}
494 518
495void PMainWindow::showToolbar(bool how) 519void PMainWindow::showToolbar(bool how)
496{ 520{
497 if (!how) toolBar->hide(); 521 if (!how) toolBar->hide();
498 else toolBar->show(); 522 else toolBar->show();
499 if (autoSave) { 523 if (autoSave) {
500 m_cfg->writeEntry("showtoolbar",how); 524 m_cfg->writeEntry("showtoolbar",how);
501 } 525 }
502} 526}
503 527
504void PMainWindow::setupActions() 528void PMainWindow::setupActions()
505{ 529{
506 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); 530 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
507 m_aDirUp->setToggleAction(false); 531 m_aDirUp->setToggleAction(false);
508 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); 532 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
509 533
510 if ( Ir::supported() ) { 534 if ( Ir::supported() ) {
511 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); 535 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true );
512 m_aBeam->setToggleAction(false); 536 m_aBeam->setToggleAction(false);
513 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); 537 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
514 } else { 538 } else {
515 m_aBeam = 0; 539 m_aBeam = 0;
516 } 540 }
517 541
518 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); 542 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true );
519 m_aShowInfo->setToggleAction(false); 543 m_aShowInfo->setToggleAction(false);
520 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); 544 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
521 545
522 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); 546 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true );
523 m_aTrash->setToggleAction(false); 547 m_aTrash->setToggleAction(false);
524 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); 548 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
525 549
526 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); 550 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true );
527 m_aViewfile->setToggleAction(false); 551 m_aViewfile->setToggleAction(false);
528 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); 552 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
529 553
530 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); 554 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true );
531 m_aStartSlide->setToggleAction(false); 555 m_aStartSlide->setToggleAction(false);
532 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); 556 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
533 557
534 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); 558 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true );
535 m_aHideToolbar->setOn (true); 559 m_aHideToolbar->setOn (true);
536 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); 560 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
537 561
538 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); 562 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true );
539 m_aSetup->setToggleAction(false); 563 m_aSetup->setToggleAction(false);
540 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); 564 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig()));
541 565
542 m_gListViewMode = new QActionGroup(this,"Select listmode",true); 566 m_gListViewMode = new QActionGroup(this,"Select listmode",true);
543 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); 567 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*)));
544 568
545 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); 569 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true );
546 m_aDirLong->setToggleAction(true); 570 m_aDirLong->setToggleAction(true);
547 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); 571 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true );
548 m_aDirShort->setToggleAction(true); 572 m_aDirShort->setToggleAction(true);
549 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); 573 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true );
550 m_aDirName->setToggleAction(true); 574 m_aDirName->setToggleAction(true);
551 int mode = m_cfg->readNumEntry("ListViewMode", 1); 575 int mode = m_cfg->readNumEntry("ListViewMode", 1);
552 if (mode < 1 || mode>3) mode = 1; 576 if (mode < 1 || mode>3) mode = 1;
553 switch (mode) { 577 switch (mode) {
554 case 3: 578 case 3:
555 m_aDirName->setOn(true); 579 m_aDirName->setOn(true);
556 break; 580 break;
557 case 2: 581 case 2:
558 m_aDirShort->setOn(true); 582 m_aDirShort->setOn(true);
559 break; 583 break;
560 case 1: 584 case 1:
561 default: 585 default:
562 m_aDirLong->setOn(true); 586 m_aDirLong->setOn(true);
563 } 587 }
564 m_gListViewMode->insert(m_aDirLong); 588 m_gListViewMode->insert(m_aDirLong);
565 m_gListViewMode->insert(m_aDirShort); 589 m_gListViewMode->insert(m_aDirShort);
566 m_gListViewMode->insert(m_aDirName); 590 m_gListViewMode->insert(m_aDirName);
567 591
568 m_gPrevNext = new QActionGroup(this,"imageprevnext",false); 592 m_gPrevNext = new QActionGroup(this,"imageprevnext",false);
569 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); 593 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true );
570 m_aNext->setToggleAction(false); 594 m_aNext->setToggleAction(false);
571 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); 595 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext()));
572 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); 596 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true );
573 m_aPrevious->setToggleAction(false); 597 m_aPrevious->setToggleAction(false);
574 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); 598 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
575 m_gPrevNext->insert(m_aPrevious); 599 m_gPrevNext->insert(m_aPrevious);
576 m_gPrevNext->insert(m_aNext); 600 m_gPrevNext->insert(m_aNext);
577 601
578 m_aFullScreen = new QAction( tr( "Show images fullscreen" ), 602 m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
579 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); 603 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
580 m_aFullScreen->setToggleAction(true); 604 m_aFullScreen->setToggleAction(true);
581 if (autoSave) { 605 if (autoSave) {
582 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false)); 606 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false));
583 } else { 607 } else {
584 m_aFullScreen->setOn(false); 608 m_aFullScreen->setOn(false);
585 } 609 }
586 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool))); 610 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool)));
587 611
588 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); 612 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
589 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); 613 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
590 m_aAutoRotate->setToggleAction(true); 614 m_aAutoRotate->setToggleAction(true);
591 615
592 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 616 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
593 m_aAutoRotate->setOn(true); 617 m_aAutoRotate->setOn(true);
594 } else { 618 } else {
595 m_aAutoRotate->setOn(false); 619 m_aAutoRotate->setOn(false);
596 } 620 }
597 if (autoSave) { 621 if (autoSave) {
598 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn())); 622 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn()));
599 } 623 }
600 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 624 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
601 625
602 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); 626 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
603 m_aUnscaled->setToggleAction(true); 627 m_aUnscaled->setToggleAction(true);
604 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 628 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
605 if (autoSave) { 629 if (autoSave) {
606 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); 630 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false));
607 } else { 631 } else {
608 m_aUnscaled->setOn(false); 632 m_aUnscaled->setOn(false);
609 } 633 }
610 634
611 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); 635 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
612 m_aZoomer->setToggleAction(true); 636 m_aZoomer->setToggleAction(true);
613 if (autoSave) { 637 if (autoSave) {
614 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); 638 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true));
615 } else { 639 } else {
616 m_aZoomer->setOn (true); 640 m_aZoomer->setOn (true);
617 } 641 }
618 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 642 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
619 m_gDisplayType->insert(m_aAutoRotate); 643 m_gDisplayType->insert(m_aAutoRotate);
620 m_gDisplayType->insert(m_aUnscaled); 644 m_gDisplayType->insert(m_aUnscaled);
621 m_gDisplayType->insert(m_aZoomer); 645 m_gDisplayType->insert(m_aZoomer);
622 646
623 m_hGroup = new QActionGroup(this,"actioncollection",false); 647 m_hGroup = new QActionGroup(this,"actioncollection",false);
624 m_hGroup->insert(m_aFullScreen); 648 m_hGroup->insert(m_aFullScreen);
625 649
626 if (!m_SmallWindow) { 650 if (!m_SmallWindow) {
627 m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); 651 m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true);
628 m_aForceSmall->setToggleAction(true); 652 m_aForceSmall->setToggleAction(true);
629 connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); 653 connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool)));
630 } else { 654 } else {
631 m_aForceSmall = 0; 655 m_aForceSmall = 0;
632 } 656 }
657 m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false);
658 connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness()));
659}
660
661void PMainWindow::setupBrightness()
662{
663 if (!m_disp) {
664 return;
665 }
666 int lb = m_disp->Intensity();
667 if (Valuebox(0,-255,255,lb,lb)) {
668 m_disp->setIntensity(lb,true);
669 }
633} 670}
634 671
635void PMainWindow::setupToolbar() 672void PMainWindow::setupToolbar()
636{ 673{
637 toolBar = new QToolBar( this ); 674 toolBar = new QToolBar( this );
638 addToolBar(toolBar); 675 addToolBar(toolBar);
639 toolBar->setHorizontalStretchable( true ); 676 toolBar->setHorizontalStretchable( true );
640 setToolBarsMovable( false ); 677 setToolBarsMovable( false );
641 m_aDirUp->addTo( toolBar ); 678 m_aDirUp->addTo( toolBar );
642 679
643 fsButton = new PFileSystem( toolBar ); 680 fsButton = new PFileSystem( toolBar );
644 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 681 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
645 m_view, SLOT(slotChangeDir( const QString& ) ) ); 682 m_view, SLOT(slotChangeDir( const QString& ) ) );
646 connect( this, SIGNAL( changeDir( const QString& ) ), 683 connect( this, SIGNAL( changeDir( const QString& ) ),
647 m_view, SLOT(slotChangeDir( const QString& ) ) ); 684 m_view, SLOT(slotChangeDir( const QString& ) ) );
648 685
649 if (m_aBeam) { 686 if (m_aBeam) {
650 m_aBeam->addTo( toolBar ); 687 m_aBeam->addTo( toolBar );
651 } 688 }
652 m_aShowInfo->addTo(toolBar); 689 m_aShowInfo->addTo(toolBar);
653 m_aTrash->addTo(toolBar); 690 m_aTrash->addTo(toolBar);
654// m_aSetup->addTo(toolBar); 691// m_aSetup->addTo(toolBar);
655 692
656 m_gDisplayType->addTo(toolBar); 693 m_gDisplayType->addTo(toolBar);
657 694
658 if (!m_SmallWindow) { 695 if (!m_SmallWindow) {
659 m_gPrevNext->addTo(toolBar); 696 m_gPrevNext->addTo(toolBar);
660 } else { 697 } else {
661 m_gPrevNext->setEnabled(false); 698 m_gPrevNext->setEnabled(false);
662 } 699 }
663} 700}
664 701
665void PMainWindow::setupMenu() 702void PMainWindow::setupMenu()
666{ 703{
667 fileMenu = new QPopupMenu( menuBar() ); 704 fileMenu = new QPopupMenu( menuBar() );
668 menuBar()->insertItem( tr( "File" ), fileMenu ); 705 menuBar()->insertItem( tr( "File" ), fileMenu );
669 dispMenu = new QPopupMenu( menuBar() ); 706 dispMenu = new QPopupMenu( menuBar() );
670 menuBar()->insertItem( tr( "Show" ), dispMenu ); 707 menuBar()->insertItem( tr( "Show" ), dispMenu );
671 settingsMenu = new QPopupMenu( menuBar() ); 708 settingsMenu = new QPopupMenu( menuBar() );
672 menuBar()->insertItem( tr( "Settings" ), settingsMenu ); 709 menuBar()->insertItem( tr( "Settings" ), settingsMenu );
673 710
674 m_aViewfile->addTo(fileMenu); 711 m_aViewfile->addTo(fileMenu);
675 m_aShowInfo->addTo(fileMenu); 712 m_aShowInfo->addTo(fileMenu);
676 m_aStartSlide->addTo(fileMenu); 713 m_aStartSlide->addTo(fileMenu);
677 714
678 fileMenu->insertSeparator(); 715 fileMenu->insertSeparator();
679 m_aDirUp->addTo( fileMenu ); 716 m_aDirUp->addTo( fileMenu );
680 717
681 fsMenu = new QPopupMenu(fileMenu); 718 fsMenu = new QPopupMenu(fileMenu);
682 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); 719 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
683 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); 720 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
684 dirChanged(); 721 dirChanged();
685 722
686 if ( m_aBeam ) { 723 if ( m_aBeam ) {
687 fileMenu->insertSeparator(); 724 fileMenu->insertSeparator();
688 m_aBeam->addTo( fileMenu ); 725 m_aBeam->addTo( fileMenu );
689 } 726 }
690 fileMenu->insertSeparator(); 727 fileMenu->insertSeparator();
691 m_aTrash->addTo(fileMenu); 728 m_aTrash->addTo(fileMenu);
692 729
693 listviewMenu = new QPopupMenu(dispMenu); 730 listviewMenu = new QPopupMenu(dispMenu);
694 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); 731 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
695 m_gListViewMode->addTo(listviewMenu); 732 m_gListViewMode->addTo(listviewMenu);
696 dispMenu->insertSeparator(); 733 dispMenu->insertSeparator();
697 m_aFullScreen->addTo(dispMenu); 734 m_aFullScreen->addTo(dispMenu);
698 m_gDisplayType->addTo(dispMenu); 735 m_gDisplayType->addTo(dispMenu);
699 dispMenu->insertSeparator(); 736 dispMenu->insertSeparator();
700 m_gPrevNext->addTo(dispMenu); 737 m_gPrevNext->addTo(dispMenu);
738 m_setCurrentBrightness->addTo(dispMenu);
739 m_setCurrentBrightness->setEnabled(false);
701 if (m_aForceSmall) { 740 if (m_aForceSmall) {
702 dispMenu->insertSeparator(); 741 dispMenu->insertSeparator();
703 m_aForceSmall->addTo(dispMenu); 742 m_aForceSmall->addTo(dispMenu);
704 } 743 }
705 744
706 m_aSetup->addTo(settingsMenu); 745 m_aSetup->addTo(settingsMenu);
707 m_aHideToolbar->addTo(settingsMenu); 746 m_aHideToolbar->addTo(settingsMenu);
708} 747}
709 748
710void PMainWindow::listviewselected(QAction*which) 749void PMainWindow::listviewselected(QAction*which)
711{ 750{
712 if (!which || which->isOn()==false) return; 751 if (!which || which->isOn()==false) return;
713 int val = 1; 752 int val = 1;
714 753
715 if (which==m_aDirName) { 754 if (which==m_aDirName) {
716 val = 3; 755 val = 3;
717 } else if (which==m_aDirShort) { 756 } else if (which==m_aDirShort) {
718 val = 2; 757 val = 2;
719 } else if (which==m_aDirLong) { 758 } else if (which==m_aDirLong) {
720 val = 1; 759 val = 1;
721 } 760 }
722 emit changeListMode(val); 761 emit changeListMode(val);
723} 762}
724 763
725void PMainWindow::readConfig() 764void PMainWindow::readConfig()
726{ 765{
727 autoSave =m_cfg->readBoolEntry("savestatus",true); 766 autoSave =m_cfg->readBoolEntry("savestatus",true);
767 m_Intensity = m_cfg->readNumEntry("intensity",0);
728} 768}
729 769
730void PMainWindow::polish() 770void PMainWindow::polish()
731{ 771{
732 if (m_disp) { 772 if (m_disp) {
733 odebug << "======================\n" 773 odebug << "======================\n"
734 << "Called via setdocument\n" 774 << "Called via setdocument\n"
735 << "======================" << oendl; 775 << "======================" << oendl;
736 m_setDocCalled = true; 776 m_setDocCalled = true;
737 m_view->setDoccalled(true); 777 m_view->setDoccalled(true);
738 m_disp->setCloseIfHide(true); 778 m_disp->setCloseIfHide(true);
739 } else { 779 } else {
740 m_setDocCalled = false; 780 m_setDocCalled = false;
741 m_view->setDoccalled(false); 781 m_view->setDoccalled(false);
742 } 782 }
743 m_polishDone = true; 783 m_polishDone = true;
744 QMainWindow::polish(); 784 QMainWindow::polish();
745 if (m_setDocCalled) { 785 if (m_setDocCalled) {
746 if (m_aFullScreen->isOn()) { 786 if (m_aFullScreen->isOn()) {
747 QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); 787 QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
748 } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 788 } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
749 } 789 }
750 } 790 }
751} 791}
752 792
753void PMainWindow::slotForceSmall(bool how) 793void PMainWindow::slotForceSmall(bool how)
754{ 794{
755 odebug << "Disable separate windows: " << how << oendl; 795 odebug << "Disable separate windows: " << how << oendl;
756 if (m_stack) { 796 if (m_stack) {
757 if (how) { 797 if (how) {
758 m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); 798 m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen);
759 } else { 799 } else {
760 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 800 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
761 } 801 }
762 } 802 }
763 if (autoSave) { 803 if (autoSave) {
764 m_cfg->writeEntry("dontshowseperate",how); 804 m_cfg->writeEntry("dontshowseperate",how);
765 } 805 }
766} 806}
807
808bool PMainWindow::Valuebox(QWidget*parent,int min, int max, int current,int&store)
809{
810 QDialog dlg(parent,"brightnessbox",true);
811 QVBoxLayout * m_MainLayout;
812 QGridLayout * m_IntensityLayout;
813 QSpinBox * m_Intensity;
814 QLabel * m_IntensityLabel;
815
816 m_MainLayout = new QVBoxLayout( &dlg, 11, 6, "m_MainLayout");
817 m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout");
818 m_Intensity = new QSpinBox( &dlg, "m_Intensity" );
819 m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
820 m_Intensity->setButtonSymbols( QSpinBox::PlusMinus );
821 m_Intensity->setMaxValue( max );
822 m_Intensity->setMinValue(min);
823 m_Intensity->setValue( current );
824 m_IntensityLayout->addWidget( m_Intensity, 0, 1 );
825 m_IntensityLabel = new QLabel( &dlg, "m_IntensityLabel" );
826 m_IntensityLabel->setText(QObject::tr("Display brightness:"));
827 m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 );
828 m_MainLayout->addLayout(m_IntensityLayout);
829 if (dlg.exec()) {
830 store = m_Intensity->value();
831 return true;
832 }
833 return false;
834}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index a49a9d3..62b446b 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -1,112 +1,115 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#ifndef PHUNK_MAIN_WINDOW_H 6#ifndef PHUNK_MAIN_WINDOW_H
7#define PHUNK_MAIN_WINDOW_H 7#define PHUNK_MAIN_WINDOW_H
8 8
9#include <opie2/oconfig.h> 9#include <opie2/oconfig.h>
10 10
11#include <qmainwindow.h> 11#include <qmainwindow.h>
12 12
13 13
14 14
15namespace Opie { 15namespace Opie {
16namespace Ui{ 16namespace Ui{
17 class OWidgetStack; 17 class OWidgetStack;
18} 18}
19namespace Core{ 19namespace Core{
20 class OKeyConfigManager; 20 class OKeyConfigManager;
21} 21}
22} 22}
23 23
24class ImageView; 24class ImageView;
25class ImageWidget; 25class ImageWidget;
26class PIconView; 26class PIconView;
27class imageinfo; 27class imageinfo;
28class QMenuBar; 28class QMenuBar;
29class QToolBar; 29class QToolBar;
30class QPopupMenu; 30class QPopupMenu;
31class QAction; 31class QAction;
32class QActionGroup; 32class QActionGroup;
33class StorageInfo; 33class StorageInfo;
34 34
35class PMainWindow : public QMainWindow { 35class PMainWindow : public QMainWindow {
36 Q_OBJECT 36 Q_OBJECT
37 enum Views { IconView, ImageInfo, ImageDisplay }; 37 enum Views { IconView, ImageInfo, ImageDisplay };
38public: 38public:
39 static QString appName() { return QString::fromLatin1("opie-eye" ); } 39 static QString appName() { return QString::fromLatin1("opie-eye" ); }
40 PMainWindow(QWidget*, const char*, WFlags ); 40 PMainWindow(QWidget*, const char*, WFlags );
41 ~PMainWindow(); 41 ~PMainWindow();
42 42
43signals: 43signals:
44 void configChanged(); 44 void configChanged();
45 void changeDir( const QString& ); 45 void changeDir( const QString& );
46 void changeListMode(int); 46 void changeListMode(int);
47 47
48public slots: 48public slots:
49 void slotShowInfo( const QString& inf ); 49 void slotShowInfo( const QString& inf );
50 void slotDisplay( const QString& inf ); 50 void slotDisplay( const QString& inf );
51 void slotReturn(); 51 void slotReturn();
52 void slotRotateToggled(bool); 52 void slotRotateToggled(bool);
53 void slotScaleToggled(bool); 53 void slotScaleToggled(bool);
54 void slotZoomerToggled(bool); 54 void slotZoomerToggled(bool);
55 void slotToggleZoomer(); 55 void slotToggleZoomer();
56 void slotToggleAutorotate(); 56 void slotToggleAutorotate();
57 void slotToggleAutoscale(); 57 void slotToggleAutoscale();
58 void setDocument( const QString& ); 58 void setDocument( const QString& );
59 virtual void slotToggleFullScreen(); 59 virtual void slotToggleFullScreen();
60 virtual void slotFullScreenToggled(bool); 60 virtual void slotFullScreenToggled(bool);
61 virtual void polish(); 61 virtual void polish();
62 62
63protected slots: 63protected slots:
64 void raiseIconView(); 64 void raiseIconView();
65 void closeEvent( QCloseEvent* ); 65 void closeEvent( QCloseEvent* );
66 void showToolbar(bool); 66 void showToolbar(bool);
67 void listviewselected(QAction*); 67 void listviewselected(QAction*);
68 void slotFullScreenButton(bool); 68 void slotFullScreenButton(bool);
69 void check_view_fullscreen(); 69 void check_view_fullscreen();
70 virtual void setupBrightness();
70 71
71private: 72private:
72 template<class T> void initT( const char* name, T**, int ); 73 template<class T> void initT( const char* name, T**, int );
73 void initInfo(); 74 void initInfo();
74 void initDisp(); 75 void initDisp();
75 void setupViewWindow(bool full, bool forceDisplay); 76 void setupViewWindow(bool full, bool forceDisplay);
76 77
77private: 78private:
78 Opie::Core::OConfig *m_cfg; 79 Opie::Core::OConfig *m_cfg;
79 Opie::Ui::OWidgetStack *m_stack; 80 Opie::Ui::OWidgetStack *m_stack;
80 PIconView* m_view; 81 PIconView* m_view;
81 imageinfo *m_info; 82 imageinfo *m_info;
82 ImageView *m_disp; 83 ImageView *m_disp;
83 bool autoSave:1; 84 bool autoSave:1;
84 bool m_setDocCalled:1; 85 bool m_setDocCalled:1;
85 bool m_polishDone:1; 86 bool m_polishDone:1;
86 bool m_SmallWindow:1; 87 bool m_SmallWindow:1;
88 int m_Intensity;
87 QToolButton*fsButton; 89 QToolButton*fsButton;
88 QToolBar *toolBar; 90 QToolBar *toolBar;
89 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; 91 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu;
90 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; 92 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide;
91 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; 93 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong;
92 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; 94 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup;
93 QAction *m_aNext,*m_aPrevious,*m_aFullScreen; 95 QAction *m_aNext,*m_aPrevious,*m_aFullScreen;
94 QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall; 96 QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall,*m_setCurrentBrightness;
95 97
96 /* init funs */ 98 /* init funs */
97 void readConfig(); 99 void readConfig();
98 void setupActions(); 100 void setupActions();
99 void setupToolbar(); 101 void setupToolbar();
100 void setupMenu(); 102 void setupMenu();
101 /* for the device submenu - ToDo: Merge with the special button */ 103 /* for the device submenu - ToDo: Merge with the special button */
102 StorageInfo *m_storage; 104 StorageInfo *m_storage;
103 QMap<QString, QString> m_dev; 105 QMap<QString, QString> m_dev;
106 static bool Valuebox(QWidget*parent,int min, int max, int current,int&store);
104 107
105private slots: 108private slots:
106 void slotConfig(); 109 void slotConfig();
107 void slotSelectDir(int); 110 void slotSelectDir(int);
108 void dirChanged(); 111 void dirChanged();
109 void slotForceSmall(bool); 112 void slotForceSmall(bool);
110}; 113};
111 114
112#endif 115#endif