summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-24 12:16:23 (UTC)
committer alwin <alwin>2005-03-24 12:16:23 (UTC)
commit4fbd94e2fd6432bb15e24e40be59426b309cbb9d (patch) (unidiff)
treeb78ecad37012bb66d956e22dbaa8cfcdb8cf67fc
parentc635023dd68edd0cb0cbb2827b926f33e27e0404 (diff)
downloadopie-4fbd94e2fd6432bb15e24e40be59426b309cbb9d.zip
opie-4fbd94e2fd6432bb15e24e40be59426b309cbb9d.tar.gz
opie-4fbd94e2fd6432bb15e24e40be59426b309cbb9d.tar.bz2
- increased max-thumbnail-size
- shortcuts for inc/dec brightness - make max thumbnail size as a static so there is one point in code where it is stored and not 4 time over the whole code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.cpp11
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp22
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h4
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp37
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h12
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp16
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h3
7 files changed, 84 insertions, 21 deletions
diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp
index b0fefbf..fe51321 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.cpp
+++ b/noncore/graphics/opie-eye/gui/basesetup.cpp
@@ -1,97 +1,98 @@
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 m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout");
18 18
19 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" ); 19 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" );
20 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 20 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
21 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus ); 21 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus );
22 m_SlideShowTime->setMaxValue( 60 ); 22 m_SlideShowTime->setMaxValue( 60 );
23 m_SlideShowTime->setMinValue(0); 23 m_SlideShowTime->setMinValue(0);
24 m_SlideShowTime->setValue( 2 ); 24 m_SlideShowTime->setValue( 2 );
25 m_SlideShowTime->setSuffix(tr(" seconds")); 25 m_SlideShowTime->setSuffix(tr(" seconds"));
26 26
27 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 ); 27 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 );
28 28
29 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" ); 29 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" );
30 m_SlidetimeLabel->setText(tr("Slideshow timeout:")); 30 m_SlidetimeLabel->setText(tr("Slideshow timeout:"));
31 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 ); 31 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 );
32 m_MainLayout->addLayout( m_SlidetimeLayout ); 32 m_MainLayout->addLayout( m_SlidetimeLayout );
33 33
34 m_Iconsize = new QSpinBox( this, "m_Iconsize" ); 34 m_Iconsize = new QSpinBox( this, "m_Iconsize" );
35 m_Iconsize->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 35 m_Iconsize->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
36 m_Iconsize->setButtonSymbols( QSpinBox::PlusMinus ); 36 m_Iconsize->setButtonSymbols( QSpinBox::PlusMinus );
37 m_Iconsize->setMaxValue( 128 ); 37 m_Iconsize->setMaxValue( 128 );
38 m_Iconsize->setMinValue(12); 38 m_Iconsize->setMinValue(12);
39 m_Iconsize->setValue( 32 ); 39 m_Iconsize->setValue( 32 );
40 m_Iconsize->setSuffix(tr(" pixel")); 40 m_Iconsize->setSuffix(tr(" pixel"));
41 m_IconsizeLayout->addWidget( m_Iconsize, 0, 1 ); 41 m_IconsizeLayout->addWidget( m_Iconsize, 0, 1 );
42 m_IconsizeLabel = new QLabel( this, "m_IconsizeLabel" ); 42 m_IconsizeLabel = new QLabel( this, "m_IconsizeLabel" );
43 m_IconsizeLabel->setText(tr("Size of thumbnails:")); 43 m_IconsizeLabel->setText(tr("Size of thumbnails:"));
44 m_IconsizeLayout->addWidget( m_IconsizeLabel, 0, 0 ); 44 m_IconsizeLayout->addWidget( m_IconsizeLabel, 0, 0 );
45 m_MainLayout->addLayout(m_IconsizeLayout); 45 m_MainLayout->addLayout(m_IconsizeLayout);
46 46
47 m_Intensity = new QSpinBox( this, "m_Intensity" ); 47 m_Intensity = new QSpinBox( this, "m_Intensity" );
48 m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 48 m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
49 m_Intensity->setButtonSymbols( QSpinBox::PlusMinus ); 49 m_Intensity->setButtonSymbols( QSpinBox::PlusMinus );
50 m_Intensity->setMaxValue( 255 ); 50 m_Intensity->setMaxValue( 100 );
51 m_Intensity->setMinValue(-255); 51 m_Intensity->setMinValue(-100);
52 m_Intensity->setValue( 0 ); 52 m_Intensity->setValue( 0 );
53 m_IntensityLayout->addWidget( m_Intensity, 0, 1 ); 53 m_IntensityLayout->addWidget( m_Intensity, 0, 1 );
54 m_IntensityLabel = new QLabel( this, "m_IntensityLabel" ); 54 m_IntensityLabel = new QLabel( this, "m_IntensityLabel" );
55 m_IntensityLabel->setText(tr("Default display brightness:")); 55 m_IntensityLabel->setText(tr("Default display brightness:"));
56 m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 ); 56 m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 );
57 m_MainLayout->addLayout(m_IntensityLayout); 57 m_MainLayout->addLayout(m_IntensityLayout);
58 58
59#if 0 59#if 0
60 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" ); 60 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" );
61 m_ShowToolBar->setText(tr("Show toolbar on startup")); 61 m_ShowToolBar->setText(tr("Show toolbar on startup"));
62 m_MainLayout->addWidget( m_ShowToolBar ); 62 m_MainLayout->addWidget( m_ShowToolBar );
63#endif 63#endif
64 m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" ); 64 m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" );
65 m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate")); 65 m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate"));
66 m_MainLayout->addWidget( m_SaveStateAuto ); 66 m_MainLayout->addWidget( m_SaveStateAuto );
67 67
68 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); 68 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
69 m_MainLayout->addItem( spacer1 ); 69 m_MainLayout->addItem( spacer1 );
70 70
71 int stime = m_cfg->readNumEntry("slideshowtimeout",2); 71 int stime = m_cfg->readNumEntry("slideshowtimeout",2);
72 if (stime<0) stime=2; 72 if (stime<0) stime=2;
73 if (stime>60) stime=60; 73 if (stime>60) stime=60;
74 m_SlideShowTime->setValue(stime); 74 m_SlideShowTime->setValue(stime);
75 m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("savestatus",true)); 75 m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("savestatus",true));
76 stime = m_cfg->readNumEntry("iconsize", 32); 76 stime = m_cfg->readNumEntry("iconsize", 32);
77 /* must equal to s(MAX/MIN_ICONSIZE) in iconview.cpp! */
77 if (stime<12)stime = 12; 78 if (stime<12)stime = 12;
78 if (stime>64)stime = 64; 79 if (stime>128)stime = 128;
79 m_Iconsize->setValue(stime); 80 m_Iconsize->setValue(stime);
80 stime = m_cfg->readNumEntry("intensity",0); 81 stime = m_cfg->readNumEntry("intensity",0);
81 if (stime<-255) stime = -255; 82 if (stime<-100) stime = -100;
82 if (stime>255) stime = 255; 83 if (stime>100) stime = 100;
83 m_Intensity->setValue(stime); 84 m_Intensity->setValue(stime);
84} 85}
85 86
86BaseSetup::~BaseSetup() 87BaseSetup::~BaseSetup()
87{ 88{
88} 89}
89 90
90void BaseSetup::save_values() 91void BaseSetup::save_values()
91{ 92{
92 if (!m_cfg) return; 93 if (!m_cfg) return;
93 m_cfg->writeEntry("slideshowtimeout",m_SlideShowTime->value()); 94 m_cfg->writeEntry("slideshowtimeout",m_SlideShowTime->value());
94 m_cfg->writeEntry("savestatus",m_SaveStateAuto->isChecked()); 95 m_cfg->writeEntry("savestatus",m_SaveStateAuto->isChecked());
95 m_cfg->writeEntry("iconsize",m_Iconsize->value()); 96 m_cfg->writeEntry("iconsize",m_Iconsize->value());
96 m_cfg->writeEntry("intensity",m_Intensity->value()); 97 m_cfg->writeEntry("intensity",m_Intensity->value());
97} 98}
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index b2443e8..59091a8 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -1,909 +1,913 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#include "iconview.h" 6#include "iconview.h"
7#include "messagebox.h" 7#include "messagebox.h"
8 8
9#include <lib/imagecache.h> 9#include <lib/imagecache.h>
10#include <gui/imageinfoui.h> 10#include <gui/imageinfoui.h>
11 11
12#include <iface/dirview.h> 12#include <iface/dirview.h>
13#include <iface/dirlister.h> 13#include <iface/dirlister.h>
14 14
15#include <opie2/oconfig.h> 15#include <opie2/oconfig.h>
16#include <opie2/okeyconfigwidget.h> 16#include <opie2/okeyconfigwidget.h>
17#include <opie2/odebug.h> 17#include <opie2/odebug.h>
18#include <opie2/oimagescrollview.h> 18#include <opie2/oimagescrollview.h>
19 19
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qpemessagebox.h> 21#include <qpe/qpemessagebox.h>
22#include <qpe/ir.h> 22#include <qpe/ir.h>
23#include <qpe/qcopenvelope_qws.h> 23#include <qpe/qcopenvelope_qws.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26#include <qiconview.h> 26#include <qiconview.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qhbox.h> 28#include <qhbox.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qdir.h> 30#include <qdir.h>
31#include <qapplication.h> 31#include <qapplication.h>
32#include <qmainwindow.h> 32#include <qmainwindow.h>
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qstyle.h> 34#include <qstyle.h>
35 35
36 36
37using Opie::Core::OKeyConfigItem; 37using Opie::Core::OKeyConfigItem;
38 38
39const int PIconView::sMAX_ICON_SIZE = 128;
40const int PIconView::sMIN_ICON_SIZE = 12;
41const int PIconView::sDEF_ICON_SIZE = 64;
42
39/* 43/*
40 * The Icons, Request Cache and IconViewItem for the IconView 44 * The Icons, Request Cache and IconViewItem for the IconView
41 */ 45 */
42namespace { 46namespace {
43 static QPixmap* _dirPix = 0; 47 static QPixmap* _dirPix = 0;
44 static QPixmap* _unkPix = 0; 48 static QPixmap* _unkPix = 0;
45 static QPixmap* _cpyPix = 0; 49 static QPixmap* _cpyPix = 0;
46 static QPixmap* _emptyPix = 0; 50 static QPixmap* _emptyPix = 0;
47 class IconViewItem : public QIconViewItem { 51 class IconViewItem : public QIconViewItem {
48 public: 52 public:
49 IconViewItem( QIconView*, const QString& path, const QString& name,int a_iconsize, bool isDir = false); 53 IconViewItem( QIconView*, const QString& path, const QString& name,int a_iconsize, bool isDir = false);
50 QPixmap* pixmap()const; 54 QPixmap* pixmap()const;
51 QString path()const { return m_path; } 55 QString path()const { return m_path; }
52 bool isDir()const { return m_isDir; } 56 bool isDir()const { return m_isDir; }
53 void setText( const QString& ); 57 void setText( const QString& );
54 bool textOnly()const{return m_textOnly;} 58 bool textOnly()const{return m_textOnly;}
55 void setTextOnly(bool how){m_textOnly=how;} 59 void setTextOnly(bool how){m_textOnly=how;}
56 /* just for starting recalc of item rect! */ 60 /* just for starting recalc of item rect! */
57 virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE ); 61 virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE );
58 /* just for starting recalc of item rect! */ 62 /* just for starting recalc of item rect! */
59 virtual void setPixmap( const QPixmap & icon); 63 virtual void setPixmap( const QPixmap & icon);
60 64
61 protected: 65 protected:
62 mutable QPixmap* m_pix; 66 mutable QPixmap* m_pix;
63 int m_iconsize; 67 int m_iconsize;
64 void check_pix()const; 68 void check_pix()const;
65 69
66 private: 70 private:
67 QString m_path; 71 QString m_path;
68 bool m_isDir : 1; 72 bool m_isDir : 1;
69 bool m_noInfo :1; 73 bool m_noInfo :1;
70 bool m_textOnly:1; 74 bool m_textOnly:1;
71 bool m_NameOnly:1; 75 bool m_NameOnly:1;
72 bool m_Pixset:1; 76 bool m_Pixset:1;
73 }; 77 };
74 class TextViewItem : public IconViewItem { 78 class TextViewItem : public IconViewItem {
75 TextViewItem( QIconView*, const QString& path, const QString& name, int a_iconsize , bool isDir = false); 79 TextViewItem( QIconView*, const QString& path, const QString& name, int a_iconsize , bool isDir = false);
76 QPixmap *pixmap()const; 80 QPixmap *pixmap()const;
77 void setText( const QString& ); 81 void setText( const QString& );
78 }; 82 };
79 class ThumbViewItem : public IconViewItem { 83 class ThumbViewItem : public IconViewItem {
80 ThumbViewItem( QIconView*, const QString& path, const QString& name, int a_iconsize, bool isDir = false ); 84 ThumbViewItem( QIconView*, const QString& path, const QString& name, int a_iconsize, bool isDir = false );
81 QPixmap *pixmap()const; 85 QPixmap *pixmap()const;
82 void setText( const QString& ); 86 void setText( const QString& );
83 }; 87 };
84 88
85 89
86/* 90/*
87 * If we request an Image or String 91 * If we request an Image or String
88 * we add it to the map 92 * we add it to the map
89 */ 93 */
90 static QMap<QString, IconViewItem*> g_stringInf; 94 static QMap<QString, IconViewItem*> g_stringInf;
91 static QMap<QString, IconViewItem*> g_stringPix; 95 static QMap<QString, IconViewItem*> g_stringPix;
92 96
93 IconViewItem::IconViewItem( QIconView* view,const QString& path, 97 IconViewItem::IconViewItem( QIconView* view,const QString& path,
94 const QString& name, int a_iconsize, bool isDir) 98 const QString& name, int a_iconsize, bool isDir)
95 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), 99 : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
96 m_noInfo( false ),m_textOnly(false),m_Pixset(false) 100 m_noInfo( false ),m_textOnly(false),m_Pixset(false)
97 { 101 {
98 m_iconsize = a_iconsize; 102 m_iconsize = a_iconsize;
99 if ( isDir ) { 103 if ( isDir ) {
100 if (!_dirPix ) { 104 if (!_dirPix ) {
101 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); 105 _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
102 } 106 }
103 } else { 107 } else {
104 if (!_unkPix ) { 108 if (!_unkPix ) {
105 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); 109 _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
106 } 110 }
107 } 111 }
108 check_pix(); 112 check_pix();
109 } 113 }
110 114
111 inline void IconViewItem::check_pix()const 115 inline void IconViewItem::check_pix()const
112 { 116 {
113 if (_dirPix && _dirPix->width()>m_iconsize) { 117 if (_dirPix && _dirPix->width()>m_iconsize) {
114 QImage Pix = _dirPix->convertToImage(); 118 QImage Pix = _dirPix->convertToImage();
115 *_dirPix = Pix.smoothScale(m_iconsize,m_iconsize); 119 *_dirPix = Pix.smoothScale(m_iconsize,m_iconsize);
116 } 120 }
117 if (!_cpyPix && _unkPix) { 121 if (!_cpyPix && _unkPix) {
118 if (_unkPix->width()>=m_iconsize) { 122 if (_unkPix->width()>=m_iconsize) {
119 QImage Pix = _unkPix->convertToImage(); 123 QImage Pix = _unkPix->convertToImage();
120 _cpyPix = new QPixmap(); 124 _cpyPix = new QPixmap();
121 if (_unkPix->width()>m_iconsize) { 125 if (_unkPix->width()>m_iconsize) {
122 *_cpyPix = Pix.smoothScale(m_iconsize,m_iconsize); 126 *_cpyPix = Pix.smoothScale(m_iconsize,m_iconsize);
123 } else { 127 } else {
124 _cpyPix->convertFromImage(Pix); 128 _cpyPix->convertFromImage(Pix);
125 } 129 }
126 130
127 } else { 131 } else {
128 _cpyPix = new QPixmap(m_iconsize,m_iconsize); 132 _cpyPix = new QPixmap(m_iconsize,m_iconsize);
129 _cpyPix->fill(); 133 _cpyPix->fill();
130 QPainter pa(_cpyPix); 134 QPainter pa(_cpyPix);
131 int offset = (m_iconsize-_unkPix->width())/2; 135 int offset = (m_iconsize-_unkPix->width())/2;
132 int offy = (m_iconsize-_unkPix->height())/2; 136 int offy = (m_iconsize-_unkPix->height())/2;
133 if (offy<0) offy=0; 137 if (offy<0) offy=0;
134 pa.drawPixmap(offset,offy,*_unkPix); 138 pa.drawPixmap(offset,offy,*_unkPix);
135 pa.end(); 139 pa.end();
136 } 140 }
137 } 141 }
138 } 142 }
139 143
140 inline void IconViewItem::setPixmap( const QPixmap & , bool, bool ) 144 inline void IconViewItem::setPixmap( const QPixmap & , bool, bool )
141 { 145 {
142 m_Pixset = true; 146 m_Pixset = true;
143 calcRect(text()); 147 calcRect(text());
144 } 148 }
145 inline void IconViewItem::setPixmap( const QPixmap & ) 149 inline void IconViewItem::setPixmap( const QPixmap & )
146 { 150 {
147 m_Pixset = true; 151 m_Pixset = true;
148 calcRect(text()); 152 calcRect(text());
149 } 153 }
150 154
151 inline QPixmap* IconViewItem::pixmap()const { 155 inline QPixmap* IconViewItem::pixmap()const {
152// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() 156// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y()
153// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() 157// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX()
154// << " " << iconView()->contentsY() << oendl; 158// << " " << iconView()->contentsY() << oendl;
155 159
156 if (textOnly()&&!m_isDir) { 160 if (textOnly()&&!m_isDir) {
157 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); 161 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
158 return _emptyPix; 162 return _emptyPix;
159 } 163 }
160 if ( m_isDir ) 164 if ( m_isDir )
161 return _dirPix; 165 return _dirPix;
162 else{ 166 else{
163 if (!m_noInfo && !g_stringInf.contains( m_path ) ) { 167 if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
164 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); 168 g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
165 currentView()->dirLister()->imageInfo( m_path ); 169 currentView()->dirLister()->imageInfo( m_path );
166 } 170 }
167 171
168 m_pix = PPixmapCache::self()->cachedImage( m_path, m_iconsize, m_iconsize ); 172 m_pix = PPixmapCache::self()->cachedImage( m_path, m_iconsize, m_iconsize );
169 if (!m_pix && !g_stringPix.contains( m_path )) { 173 if (!m_pix && !g_stringPix.contains( m_path )) {
170 check_pix(); 174 check_pix();
171 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); 175 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
172 currentView()->dirLister()->thumbNail( m_path, m_iconsize, m_iconsize); 176 currentView()->dirLister()->thumbNail( m_path, m_iconsize, m_iconsize);
173 } 177 }
174 return m_pix ? m_pix : _cpyPix; 178 return m_pix ? m_pix : _cpyPix;
175 } 179 }
176 } 180 }
177 inline void IconViewItem::setText( const QString& str ) { 181 inline void IconViewItem::setText( const QString& str ) {
178 QString text = QIconViewItem::text()+"\n"+str; 182 QString text = QIconViewItem::text()+"\n"+str;
179 m_noInfo = true; 183 m_noInfo = true;
180 QIconViewItem::setText( text ); 184 QIconViewItem::setText( text );
181 } 185 }
182} 186}
183 187
184 188
185/* 189/*
186 * Set up the GUI.. initialize the slave set up gui 190 * Set up the GUI.. initialize the slave set up gui
187 * and also load a dir 191 * and also load a dir
188 */ 192 */
189PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) 193PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
190 : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) 194 : QVBox( wid ), m_cfg( cfg ), m_updatet( false )
191{ 195{
192 { 196 {
193 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 197 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
194 } 198 }
195 m_path = QDir::homeDirPath(); 199 m_path = QDir::homeDirPath();
196 m_mode = 0; 200 m_mode = 0;
197 m_iconsize = 32; 201 m_iconsize = 32;
198 m_internalReset = false; 202 m_internalReset = false;
199 m_customWidget = 0; 203 m_customWidget = 0;
200 m_setDocCalled = false; 204 m_setDocCalled = false;
201 205
202 m_hbox = new QHBox( this ); 206 m_hbox = new QHBox( this );
203 QLabel* lbl = new QLabel( m_hbox ); 207 QLabel* lbl = new QLabel( m_hbox );
204 lbl->setText( tr("View as" ) ); 208 lbl->setText( tr("View as" ) );
205 209
206 m_views = new QComboBox( m_hbox, "View As" ); 210 m_views = new QComboBox( m_hbox, "View As" );
207 211
208 m_view= new QIconView( this ); 212 m_view= new QIconView( this );
209 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 213 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
210 this, SLOT(slotClicked(QIconViewItem*)) ); 214 this, SLOT(slotClicked(QIconViewItem*)) );
211 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), 215 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
212 this, SLOT(slotClicked(QIconViewItem*)) ); 216 this, SLOT(slotClicked(QIconViewItem*)) );
213 217
214 m_view->setArrangement( QIconView::LeftToRight ); 218 m_view->setArrangement( QIconView::LeftToRight );
215 219
216 m_mode = m_cfg->readNumEntry("ListViewMode", 1); 220 m_mode = m_cfg->readNumEntry("ListViewMode", 1);
217 if (m_mode < 1 || m_mode>3) m_mode = 1; 221 if (m_mode < 1 || m_mode>3) m_mode = 1;
218 m_view->setItemTextPos( QIconView::Right ); 222 m_view->setItemTextPos( QIconView::Right );
219 if (m_mode >1) { 223 if (m_mode >1) {
220 m_view->setResizeMode(QIconView::Adjust); 224 m_view->setResizeMode(QIconView::Adjust);
221 } else { 225 } else {
222 m_view->setResizeMode(QIconView::Fixed); 226 m_view->setResizeMode(QIconView::Fixed);
223 } 227 }
224 m_iconsize = m_cfg->readNumEntry("iconsize", 32); 228 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
225 if (m_iconsize<12)m_iconsize = 12; 229 if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE;
226 if (m_iconsize>64)m_iconsize = 64; 230 if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE;
227 231
228 calculateGrid(); 232 calculateGrid();
229 initKeys(); 233 initKeys();
230 loadViews(); 234 loadViews();
231} 235}
232 236
233void PIconView::setDoccalled(bool how) 237void PIconView::setDoccalled(bool how)
234{ 238{
235 m_setDocCalled = how; 239 m_setDocCalled = how;
236} 240}
237 241
238/* 242/*
239 * Unref the slave and save the keyboard manager 243 * Unref the slave and save the keyboard manager
240 */ 244 */
241PIconView::~PIconView() { 245PIconView::~PIconView() {
242 { 246 {
243 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 247 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
244 } 248 }
245 m_viewManager->save(); 249 m_viewManager->save();
246 delete m_viewManager; 250 delete m_viewManager;
247} 251}
248 252
249Opie::Core::OKeyConfigManager* PIconView::manager() { 253Opie::Core::OKeyConfigManager* PIconView::manager() {
250 return m_viewManager; 254 return m_viewManager;
251} 255}
252 256
253 257
254/* 258/*
255 * init the KeyBoard Shortcuts 259 * init the KeyBoard Shortcuts
256 * called from the c'tor 260 * called from the c'tor
257 */ 261 */
258void PIconView::initKeys() { 262void PIconView::initKeys() {
259 Opie::Core::OKeyPair::List lst; 263 Opie::Core::OKeyPair::List lst;
260 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 264 lst.append( Opie::Core::OKeyPair::upArrowKey() );
261 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 265 lst.append( Opie::Core::OKeyPair::downArrowKey() );
262 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 266 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
263 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 267 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
264 lst.append( Opie::Core::OKeyPair::returnKey() ); 268 lst.append( Opie::Core::OKeyPair::returnKey() );
265 269
266 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", 270 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config",
267 lst, false,this, "keyconfig name" ); 271 lst, false,this, "keyconfig name" );
268 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", 272 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam",
269 Resource::loadPixmap("beam"), BeamItem, 273 Resource::loadPixmap("beam"), BeamItem,
270 Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), 274 Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton),
271 this, SLOT(slotBeam())) ); 275 this, SLOT(slotBeam())) );
272 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", 276 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
273 Resource::loadPixmap("trash"), DeleteItem, 277 Resource::loadPixmap("trash"), DeleteItem,
274 Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), 278 Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton),
275 this, SLOT(slotTrash())) ); 279 this, SLOT(slotTrash())) );
276 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", 280 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
277 Resource::loadPixmap("1to1"), ViewItem, 281 Resource::loadPixmap("1to1"), ViewItem,
278 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), 282 Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
279 this, SLOT(slotShowImage()))); 283 this, SLOT(slotShowImage())));
280 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", 284 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
281 Resource::loadPixmap("DocumentTypeWord"), InfoItem, 285 Resource::loadPixmap("DocumentTypeWord"), InfoItem,
282 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), 286 Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
283 this, SLOT(slotImageInfo()) ) ); 287 this, SLOT(slotImageInfo()) ) );
284 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow", 288 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow",
285 Resource::loadPixmap("1to1"), SlideItem, 289 Resource::loadPixmap("1to1"), SlideItem,
286 Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton), 290 Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton),
287 this, SLOT(slotStartSlide()))); 291 this, SLOT(slotStartSlide())));
288 m_viewManager->load(); 292 m_viewManager->load();
289 m_viewManager->handleWidget( m_view ); 293 m_viewManager->handleWidget( m_view );
290} 294}
291 295
292 296
293/* 297/*
294 * change one dir up 298 * change one dir up
295 */ 299 */
296void PIconView::slotDirUp() 300void PIconView::slotDirUp()
297{ 301{
298 slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); 302 slotChangeDir( currentView()->dirLister()->dirUp( m_path ) );
299} 303}
300 304
301/* 305/*
302 * change the dir 306 * change the dir
303 */ 307 */
304void PIconView::slotChangeDir(const QString& path) { 308void PIconView::slotChangeDir(const QString& path) {
305 if ( !currentView() ) 309 if ( !currentView() )
306 return; 310 return;
307 311
308 PDirLister *lister = currentView()->dirLister(); 312 PDirLister *lister = currentView()->dirLister();
309 if (!lister ) 313 if (!lister )
310 return; 314 return;
311 315
312 /* 316 /*
313 * Say what we want and take what we get 317 * Say what we want and take what we get
314 */ 318 */
315 lister->setStartPath( path ); 319 lister->setStartPath( path );
316 m_path = lister->currentPath(); 320 m_path = lister->currentPath();
317 321
318 m_view->viewport()->setUpdatesEnabled( false ); 322 m_view->viewport()->setUpdatesEnabled( false );
319 m_view->clear(); 323 m_view->clear();
320 324
321 // Also invalidate the cache. We can't cancel the operations anyway 325 // Also invalidate the cache. We can't cancel the operations anyway
322 g_stringPix.clear(); 326 g_stringPix.clear();
323 g_stringInf.clear(); 327 g_stringInf.clear();
324 328
325 /* 329 /*
326 * add files and folders 330 * add files and folders
327 */ 331 */
328 addFolders( lister->folders() ); 332 addFolders( lister->folders() );
329 addFiles( lister->files() ); 333 addFiles( lister->files() );
330 m_view->viewport()->setUpdatesEnabled( true ); 334 m_view->viewport()->setUpdatesEnabled( true );
331 335
332 // looks ugly 336 // looks ugly
333 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); 337 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) );
334} 338}
335 339
336/** 340/**
337 * get the current file name 341 * get the current file name
338 * @param isDir see if this is a dir or real file 342 * @param isDir see if this is a dir or real file
339 */ 343 */
340QString PIconView::currentFileName(bool &isDir)const { 344QString PIconView::currentFileName(bool &isDir)const {
341 isDir = false; 345 isDir = false;
342 QIconViewItem* _it = m_view->currentItem(); 346 QIconViewItem* _it = m_view->currentItem();
343 if ( !_it ) 347 if ( !_it )
344 return QString::null; 348 return QString::null;
345 349
346 IconViewItem* it = static_cast<IconViewItem*>( _it ); 350 IconViewItem* it = static_cast<IconViewItem*>( _it );
347 isDir = it->isDir(); 351 isDir = it->isDir();
348 return it->path(); 352 return it->path();
349} 353}
350 354
351QString PIconView::nextFileName(bool &isDir)const 355QString PIconView::nextFileName(bool &isDir)const
352{ 356{
353 isDir = false; 357 isDir = false;
354 QIconViewItem* _it1 = m_view->currentItem(); 358 QIconViewItem* _it1 = m_view->currentItem();
355 if ( !_it1 ) 359 if ( !_it1 )
356 return QString::null; 360 return QString::null;
357 QIconViewItem* _it = _it1->nextItem(); 361 QIconViewItem* _it = _it1->nextItem();
358 if ( !_it ) 362 if ( !_it )
359 return QString::null; 363 return QString::null;
360 IconViewItem* it = static_cast<IconViewItem*>( _it ); 364 IconViewItem* it = static_cast<IconViewItem*>( _it );
361 isDir = it->isDir(); 365 isDir = it->isDir();
362 return it->path(); 366 return it->path();
363} 367}
364 368
365QString PIconView::prevFileName(bool &isDir)const{ 369QString PIconView::prevFileName(bool &isDir)const{
366 isDir = false; 370 isDir = false;
367 QIconViewItem* _it = m_view->currentItem(); 371 QIconViewItem* _it = m_view->currentItem();
368 if ( !_it ) 372 if ( !_it )
369 return QString::null; 373 return QString::null;
370 _it = _it->prevItem(); 374 _it = _it->prevItem();
371 if ( !_it ) 375 if ( !_it )
372 return QString::null; 376 return QString::null;
373 IconViewItem* it = static_cast<IconViewItem*>( _it ); 377 IconViewItem* it = static_cast<IconViewItem*>( _it );
374 isDir = it->isDir(); 378 isDir = it->isDir();
375 return it->path(); 379 return it->path();
376} 380}
377 381
378void PIconView::slotTrash() { 382void PIconView::slotTrash() {
379 bool isDir; 383 bool isDir;
380 QString pa = currentFileName( isDir ); 384 QString pa = currentFileName( isDir );
381 if ( isDir || pa.isEmpty() ) 385 if ( isDir || pa.isEmpty() )
382 return; 386 return;
383 387
384 if (!OMessageBox::confirmDelete( this, tr("the Image"), 388 if (!OMessageBox::confirmDelete( this, tr("the Image"),
385 pa, tr("Delete Image" ))) 389 pa, tr("Delete Image" )))
386 return; 390 return;
387 391
388 392
389 currentView()->dirLister()->deleteImage( pa ); 393 currentView()->dirLister()->deleteImage( pa );
390 delete m_view->currentItem(); 394 delete m_view->currentItem();
391} 395}
392 396
393/* 397/*
394 * see what views are available 398 * see what views are available
395 */ 399 */
396void PIconView::loadViews() { 400void PIconView::loadViews() {
397 ViewMap::Iterator it; 401 ViewMap::Iterator it;
398 ViewMap* map = viewMap(); 402 ViewMap* map = viewMap();
399 for ( it = map->begin(); it != map->end(); ++it ) 403 for ( it = map->begin(); it != map->end(); ++it )
400 m_views->insertItem( it.key() ); 404 m_views->insertItem( it.key() );
401} 405}
402 406
403void PIconView::resetView() { 407void PIconView::resetView() {
404 m_internalReset = true; 408 m_internalReset = true;
405 // Also invalidate the cache. We can't cancel the operations anyway 409 // Also invalidate the cache. We can't cancel the operations anyway
406 g_stringPix.clear(); 410 g_stringPix.clear();
407 g_stringInf.clear(); 411 g_stringInf.clear();
408 if (m_mode>1) { 412 if (m_mode>1) {
409 int osize = m_iconsize; 413 int osize = m_iconsize;
410 m_iconsize = m_cfg->readNumEntry("iconsize", 32); 414 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
411 if (m_iconsize<12)m_iconsize = 12; 415 if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE;
412 if (m_iconsize>64)m_iconsize = 64; 416 if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE;
413 if (osize != m_iconsize) { 417 if (osize != m_iconsize) {
414 if (_dirPix){ 418 if (_dirPix){
415 delete _dirPix; 419 delete _dirPix;
416 _dirPix = 0; 420 _dirPix = 0;
417 } 421 }
418 if (_cpyPix){ 422 if (_cpyPix){
419 delete _cpyPix; 423 delete _cpyPix;
420 _cpyPix = 0; 424 _cpyPix = 0;
421 } 425 }
422 calculateGrid(); 426 calculateGrid();
423 } 427 }
424 } else { 428 } else {
425 m_iconsize = 64; 429 m_iconsize = sDEF_ICON_SIZE;
426 } 430 }
427 slotViewChanged(m_views->currentItem()); 431 slotViewChanged(m_views->currentItem());
428 m_internalReset = false; 432 m_internalReset = false;
429} 433}
430 434
431void PIconView::polish() 435void PIconView::polish()
432{ 436{
433 QVBox::polish(); 437 QVBox::polish();
434 438
435 QString lastView = m_cfg->readEntry("LastView",""); 439 QString lastView = m_cfg->readEntry("LastView","");
436 int cc=0; 440 int cc=0;
437 for (; cc<m_views->count();++cc) { 441 for (; cc<m_views->count();++cc) {
438 if (m_views->text(cc)==lastView) { 442 if (m_views->text(cc)==lastView) {
439 break; 443 break;
440 } 444 }
441 } 445 }
442 if (cc<m_views->count()) { 446 if (cc<m_views->count()) {
443 m_views->setCurrentItem(cc); 447 m_views->setCurrentItem(cc);
444 slotViewChanged(cc); 448 slotViewChanged(cc);
445 } else { 449 } else {
446 slotViewChanged(m_views->currentItem()); 450 slotViewChanged(m_views->currentItem());
447 } 451 }
448 connect( m_views, SIGNAL(activated(int)), 452 connect( m_views, SIGNAL(activated(int)),
449 this, SLOT(slotViewChanged(int)) ); 453 this, SLOT(slotViewChanged(int)) );
450} 454}
451 455
452/* 456/*
453 *swicth view reloadDir and connect signals 457 *swicth view reloadDir and connect signals
454 */ 458 */
455void PIconView::slotViewChanged( int i) { 459void PIconView::slotViewChanged( int i) {
456 if (!m_views->count() ) { 460 if (!m_views->count() ) {
457 setCurrentView( 0l); 461 setCurrentView( 0l);
458 return; 462 return;
459 } 463 }
460 464
461 if (m_customWidget) { 465 if (m_customWidget) {
462 delete m_customWidget; 466 delete m_customWidget;
463 m_customWidget = 0; 467 m_customWidget = 0;
464 } 468 }
465 PDirView* cur = currentView(); 469 PDirView* cur = currentView();
466 if (cur) { 470 if (cur) {
467 delete cur; 471 delete cur;
468 } 472 }
469 QString str = m_views->text(i); 473 QString str = m_views->text(i);
470 ViewMap* map = viewMap(); 474 ViewMap* map = viewMap();
471 if (!map) { 475 if (!map) {
472 setCurrentView(0l); 476 setCurrentView(0l);
473 return; 477 return;
474 } 478 }
475 479
476 if (map->find(str) == map->end()) { 480 if (map->find(str) == map->end()) {
477 owarn << "Key not found" << oendl; 481 owarn << "Key not found" << oendl;
478 setCurrentView(0l); 482 setCurrentView(0l);
479 return; 483 return;
480 } 484 }
481 485
482 m_cfg->writeEntry("LastView",str); 486 m_cfg->writeEntry("LastView",str);
483 m_cfg->write(); 487 m_cfg->write();
484 cur = (*(*map)[str])(*m_cfg); 488 cur = (*(*map)[str])(*m_cfg);
485 setCurrentView( cur ); 489 setCurrentView( cur );
486 m_customWidget = cur->widget(m_hbox); 490 m_customWidget = cur->widget(m_hbox);
487 if (m_customWidget) { 491 if (m_customWidget) {
488 odebug << "Got a widget" << oendl; 492 odebug << "Got a widget" << oendl;
489 m_customWidget->show(); 493 m_customWidget->show();
490 } 494 }
491 495
492 /* connect to the signals of the lister */ 496 /* connect to the signals of the lister */
493 PDirLister* lis = cur->dirLister(); 497 PDirLister* lis = cur->dirLister();
494 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), 498 connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )),
495 this, SLOT( slotThumbInfo(const QString&, const QString&))); 499 this, SLOT( slotThumbInfo(const QString&, const QString&)));
496 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 500 connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
497 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 501 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
498 connect(lis, SIGNAL(sig_start()), 502 connect(lis, SIGNAL(sig_start()),
499 this, SLOT(slotStart())); 503 this, SLOT(slotStart()));
500 connect(lis, SIGNAL(sig_end()) , 504 connect(lis, SIGNAL(sig_end()) ,
501 this, SLOT(slotEnd()) ); 505 this, SLOT(slotEnd()) );
502 connect(lis,SIGNAL(sig_reloadDir()),this,SLOT(slotReloadDir())); 506 connect(lis,SIGNAL(sig_reloadDir()),this,SLOT(slotReloadDir()));
503 507
504 /* reload now with default Path 508 /* reload now with default Path
505 * but only if it isn't a reset like from setupdlg 509 * but only if it isn't a reset like from setupdlg
506 */ 510 */
507 if (!m_internalReset) { 511 if (!m_internalReset) {
508 m_path = lis->defaultPath(); 512 m_path = lis->defaultPath();
509 } 513 }
510 QTimer::singleShot( 0, this, SLOT(slotReloadDir())); 514 QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
511} 515}
512 516
513 517
514void PIconView::slotReloadDir() { 518void PIconView::slotReloadDir() {
515 slotChangeDir( m_path ); 519 slotChangeDir( m_path );
516} 520}
517 521
518 522
519/* 523/*
520 * add files and folders 524 * add files and folders
521 */ 525 */
522void PIconView::addFolders( const QStringList& lst) { 526void PIconView::addFolders( const QStringList& lst) {
523 QStringList::ConstIterator it; 527 QStringList::ConstIterator it;
524 IconViewItem * _iv; 528 IconViewItem * _iv;
525 529
526 for(it=lst.begin(); it != lst.end(); ++it ) { 530 for(it=lst.begin(); it != lst.end(); ++it ) {
527 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it),m_iconsize, true ); 531 _iv = new IconViewItem( m_view, m_path+"/"+(*it), (*it),m_iconsize, true );
528 if (m_mode==3) _iv->setTextOnly(true); 532 if (m_mode==3) _iv->setTextOnly(true);
529 } 533 }
530} 534}
531 535
532void PIconView::addFiles( const QStringList& lst) { 536void PIconView::addFiles( const QStringList& lst) {
533 QStringList::ConstIterator it; 537 QStringList::ConstIterator it;
534 IconViewItem * _iv; 538 IconViewItem * _iv;
535 QPixmap*m_pix = 0; 539 QPixmap*m_pix = 0;
536 QString pre = ""; 540 QString pre = "";
537 if (!m_path.isEmpty()) { 541 if (!m_path.isEmpty()) {
538 pre = m_path+"/"; 542 pre = m_path+"/";
539 } 543 }
540 QString s = ""; 544 QString s = "";
541 int pos; 545 int pos;
542 for (it=lst.begin(); it!= lst.end(); ++it ) { 546 for (it=lst.begin(); it!= lst.end(); ++it ) {
543 s = (*it); 547 s = (*it);
544 pos = s.find(char(0)); 548 pos = s.find(char(0));
545 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize ); 549 m_pix = PPixmapCache::self()->cachedImage( pre+(*it), m_iconsize, m_iconsize );
546 if (pos>-1) { 550 if (pos>-1) {
547 _iv = new IconViewItem( m_view, s.mid(pos+1), s.left(pos),m_iconsize ); 551 _iv = new IconViewItem( m_view, s.mid(pos+1), s.left(pos),m_iconsize );
548 } else { 552 } else {
549 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize ); 553 _iv = new IconViewItem( m_view, pre+(*it), (*it),m_iconsize );
550 } 554 }
551 if (m_mode==3) { 555 if (m_mode==3) {
552 _iv->setTextOnly(true); 556 _iv->setTextOnly(true);
553 _iv->setPixmap(QPixmap()); 557 _iv->setPixmap(QPixmap());
554 } else { 558 } else {
555 if (m_pix) _iv->setPixmap(*m_pix); 559 if (m_pix) _iv->setPixmap(*m_pix);
556 } 560 }
557 } 561 }
558 562
559} 563}
560 564
561/* 565/*
562 * user clicked on the item. Change dir or view 566 * user clicked on the item. Change dir or view
563 */ 567 */
564void PIconView::slotClicked(QIconViewItem* _it) { 568void PIconView::slotClicked(QIconViewItem* _it) {
565 if(!_it ) 569 if(!_it )
566 return; 570 return;
567 571
568 IconViewItem* it = static_cast<IconViewItem*>(_it); 572 IconViewItem* it = static_cast<IconViewItem*>(_it);
569 if( it->isDir() ) 573 if( it->isDir() )
570 slotChangeDir( it->path() ); 574 slotChangeDir( it->path() );
571 else // view image 575 else // view image
572 slotShowImage(); 576 slotShowImage();
573} 577}
574 578
575/* 579/*
576 * Return was pressed. which is triggered by the keydown 580 * Return was pressed. which is triggered by the keydown
577 * handler. The problem is that the key up will be handled 581 * handler. The problem is that the key up will be handled
578 * by the ImageDisplayer and goes to the next image 582 * by the ImageDisplayer and goes to the next image
579 */ 583 */
580void PIconView::slotRetrun( QIconViewItem *_it ) { 584void PIconView::slotRetrun( QIconViewItem *_it ) {
581 if(!_it ) 585 if(!_it )
582 return; 586 return;
583 587
584 IconViewItem* it = static_cast<IconViewItem*>(_it); 588 IconViewItem* it = static_cast<IconViewItem*>(_it);
585 if( it->isDir() ) 589 if( it->isDir() )
586 slotChangeDir( it->path() ); 590 slotChangeDir( it->path() );
587 else 591 else
588 QTimer::singleShot(0, this, SLOT(slotShowImage()) ); 592 QTimer::singleShot(0, this, SLOT(slotShowImage()) );
589} 593}
590 594
591/* 595/*
592 * got thumb info add to the cache if items is visible 596 * got thumb info add to the cache if items is visible
593 * we later need update after processing of slave is done 597 * we later need update after processing of slave is done
594 */ 598 */
595void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { 599void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
596 IconViewItem* item = g_stringInf[_path]; 600 IconViewItem* item = g_stringInf[_path];
597 if (!item ) 601 if (!item )
598 return; 602 return;
599 603
600 if (m_mode == 2) { 604 if (m_mode == 2) {
601 return; 605 return;
602 } 606 }
603 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 607 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
604 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 608 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
605 m_updatet = true; 609 m_updatet = true;
606 610
607 item->setText( str ); 611 item->setText( str );
608 g_stringInf.remove( _path ); 612 g_stringInf.remove( _path );
609} 613}
610 614
611/* 615/*
612 * got thumbnail and see if it is visible so we need to update later 616 * got thumbnail and see if it is visible so we need to update later
613 */ 617 */
614void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { 618void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
615 IconViewItem* item = g_stringPix[_path]; 619 IconViewItem* item = g_stringPix[_path];
616 if (!item ) 620 if (!item )
617 return; 621 return;
618 622
619 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), 623 if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
620 m_view->contentsWidth(), m_view->contentsHeight() ) ) ) 624 m_view->contentsWidth(), m_view->contentsHeight() ) ) )
621 m_updatet = true; 625 m_updatet = true;
622 626
623 if (pix.width()>0) { 627 if (pix.width()>0) {
624 if (pix.width()<m_iconsize) { 628 if (pix.width()<m_iconsize) {
625 QPixmap p(m_iconsize,m_iconsize); 629 QPixmap p(m_iconsize,m_iconsize);
626 p.fill(); 630 p.fill();
627 QPainter pa(&p); 631 QPainter pa(&p);
628 int offset = (m_iconsize-pix.width())/2; 632 int offset = (m_iconsize-pix.width())/2;
629 int offy = (m_iconsize-pix.height())/2; 633 int offy = (m_iconsize-pix.height())/2;
630 if (offy<0) offy=0; 634 if (offy<0) offy=0;
631 pa.drawPixmap(offset,offy,pix); 635 pa.drawPixmap(offset,offy,pix);
632 pa.end(); 636 pa.end();
633 PPixmapCache::self()->insertImage( _path, p, m_iconsize, m_iconsize ); 637 PPixmapCache::self()->insertImage( _path, p, m_iconsize, m_iconsize );
634 item->setPixmap(p,true); 638 item->setPixmap(p,true);
635 } else { 639 } else {
636 PPixmapCache::self()->insertImage( _path, pix, m_iconsize, m_iconsize ); 640 PPixmapCache::self()->insertImage( _path, pix, m_iconsize, m_iconsize );
637 item->setPixmap(pix,true); 641 item->setPixmap(pix,true);
638 } 642 }
639 643
640 } else { 644 } else {
641 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), m_iconsize, m_iconsize ); 645 PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), m_iconsize, m_iconsize );
642 } 646 }
643 g_stringPix.remove( _path ); 647 g_stringPix.remove( _path );
644 m_view->arrangeItemsInGrid(true); 648 m_view->arrangeItemsInGrid(true);
645} 649}
646 650
647 651
648/* 652/*
649 * FIXME rename 653 * FIXME rename
650 */ 654 */
651void PIconView::slotRename() { 655void PIconView::slotRename() {
652 656
653} 657}
654 658
655 659
656/* 660/*
657 * BEAM the current file 661 * BEAM the current file
658 */ 662 */
659void PIconView::slotBeam() { 663void PIconView::slotBeam() {
660 bool isDir; 664 bool isDir;
661 QString pa = currentFileName( isDir ); 665 QString pa = currentFileName( isDir );
662 if ( isDir && pa.isEmpty() ) 666 if ( isDir && pa.isEmpty() )
663 return; 667 return;
664 668
665 Ir* ir = new Ir( this ); 669 Ir* ir = new Ir( this );
666 connect( ir, SIGNAL(done(Ir*)), 670 connect( ir, SIGNAL(done(Ir*)),
667 this, SLOT(slotBeamDone(Ir*))); 671 this, SLOT(slotBeamDone(Ir*)));
668 ir->send(pa, tr( "Image" ) ); 672 ir->send(pa, tr( "Image" ) );
669} 673}
670 674
671/* 675/*
672 * BEAM done clean up 676 * BEAM done clean up
673 */ 677 */
674void PIconView::slotBeamDone( Ir* ir) { 678void PIconView::slotBeamDone( Ir* ir) {
675 delete ir; 679 delete ir;
676} 680}
677 681
678void PIconView::slotStart() { 682void PIconView::slotStart() {
679 m_view->viewport()->setUpdatesEnabled( false ); 683 m_view->viewport()->setUpdatesEnabled( false );
680} 684}
681 685
682void PIconView::slotEnd() { 686void PIconView::slotEnd() {
683 if ( m_updatet ) 687 if ( m_updatet )
684 m_view->arrangeItemsInGrid( ); 688 m_view->arrangeItemsInGrid( );
685 m_view->viewport()->setUpdatesEnabled( true ); 689 m_view->viewport()->setUpdatesEnabled( true );
686 m_updatet = false; 690 m_updatet = false;
687} 691}
688 692
689void PIconView::slotShowLast() 693void PIconView::slotShowLast()
690{ 694{
691 QIconViewItem* last_it = m_view->lastItem(); 695 QIconViewItem* last_it = m_view->lastItem();
692 if (!last_it) return; 696 if (!last_it) return;
693 m_view->setCurrentItem(last_it); 697 m_view->setCurrentItem(last_it);
694 IconViewItem* it = static_cast<IconViewItem*>( last_it ); 698 IconViewItem* it = static_cast<IconViewItem*>( last_it );
695 bool isDir = it->isDir(); 699 bool isDir = it->isDir();
696 QString name = it->path(); 700 QString name = it->path();
697 if (!isDir && !name.isEmpty()) { 701 if (!isDir && !name.isEmpty()) {
698 slotShowImage(name); 702 slotShowImage(name);
699 return; 703 return;
700 } 704 }
701 bool first_loop = true; 705 bool first_loop = true;
702 while(isDir==true) { 706 while(isDir==true) {
703 if (!first_loop) { 707 if (!first_loop) {
704 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 708 m_view->setCurrentItem(m_view->currentItem()->prevItem());
705 } else { 709 } else {
706 first_loop = false; 710 first_loop = false;
707 } 711 }
708 name = prevFileName(isDir); 712 name = prevFileName(isDir);
709 } 713 }
710 714
711 if (name.isEmpty()) return; 715 if (name.isEmpty()) return;
712 /* if we got a name we have a prev item */ 716 /* if we got a name we have a prev item */
713 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 717 m_view->setCurrentItem(m_view->currentItem()->prevItem());
714 slotShowImage(name); 718 slotShowImage(name);
715} 719}
716 720
717bool PIconView::slotShowFirst() 721bool PIconView::slotShowFirst()
718{ 722{
719 /* stop when reached - otherwise we may get an endless loop */ 723 /* stop when reached - otherwise we may get an endless loop */
720 QIconViewItem* first_it = m_view->firstItem(); 724 QIconViewItem* first_it = m_view->firstItem();
721 if (!first_it) return false; 725 if (!first_it) return false;
722 m_view->setCurrentItem(first_it); 726 m_view->setCurrentItem(first_it);
723 IconViewItem* it = static_cast<IconViewItem*>( first_it ); 727 IconViewItem* it = static_cast<IconViewItem*>( first_it );
724 bool isDir = it->isDir(); 728 bool isDir = it->isDir();
725 QString name = it->path(); 729 QString name = it->path();
726 if (!isDir && !name.isEmpty()) { 730 if (!isDir && !name.isEmpty()) {
727 slotShowImage(name); 731 slotShowImage(name);
728 return false; 732 return false;
729 } 733 }
730 bool first_loop = true; 734 bool first_loop = true;
731 while(isDir==true) { 735 while(isDir==true) {
732 /* if name is empty isDir is false, too. */ 736 /* if name is empty isDir is false, too. */
733 if (!first_loop) { 737 if (!first_loop) {
734 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 738 m_view->setCurrentItem(m_view->currentItem()->nextItem());
735 } else { 739 } else {
736 first_loop = false; 740 first_loop = false;
737 } 741 }
738 name = nextFileName(isDir); 742 name = nextFileName(isDir);
739 } 743 }
740 if (name.isEmpty()) return false; 744 if (name.isEmpty()) return false;
741 /* if we got a name we have a next item */ 745 /* if we got a name we have a next item */
742 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 746 m_view->setCurrentItem(m_view->currentItem()->nextItem());
743 slotShowImage(name); 747 slotShowImage(name);
744 return true; 748 return true;
745} 749}
746 750
747void PIconView::slotShowNext() 751void PIconView::slotShowNext()
748{ 752{
749 bool isDir = false; 753 bool isDir = false;
750 QString name = nextFileName(isDir); 754 QString name = nextFileName(isDir);
751 while (isDir==true) { 755 while (isDir==true) {
752 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 756 m_view->setCurrentItem(m_view->currentItem()->nextItem());
753 name = nextFileName(isDir); 757 name = nextFileName(isDir);
754 } 758 }
755 if (name.isEmpty()) { 759 if (name.isEmpty()) {
756 slotShowFirst(); 760 slotShowFirst();
757 return; 761 return;
758 } 762 }
759 if (isDir) return; 763 if (isDir) return;
760 /* if we got a name we have a next item */ 764 /* if we got a name we have a next item */
761 m_view->setCurrentItem(m_view->currentItem()->nextItem()); 765 m_view->setCurrentItem(m_view->currentItem()->nextItem());
762 slotShowImage(name); 766 slotShowImage(name);
763} 767}
764 768
765void PIconView::slotShowPrev() 769void PIconView::slotShowPrev()
766{ 770{
767 bool isDir = false; 771 bool isDir = false;
768 QString name = prevFileName(isDir); 772 QString name = prevFileName(isDir);
769 while (isDir==true) { 773 while (isDir==true) {
770 /* if name is empty isDir is false, too. */ 774 /* if name is empty isDir is false, too. */
771 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 775 m_view->setCurrentItem(m_view->currentItem()->prevItem());
772 name = prevFileName(isDir); 776 name = prevFileName(isDir);
773 } 777 }
774 if (name.isEmpty()) { 778 if (name.isEmpty()) {
775 slotShowLast(); 779 slotShowLast();
776 return; 780 return;
777 } 781 }
778 if (isDir) return; 782 if (isDir) return;
779 /* if we got a name we have a prev item */ 783 /* if we got a name we have a prev item */
780 m_view->setCurrentItem(m_view->currentItem()->prevItem()); 784 m_view->setCurrentItem(m_view->currentItem()->prevItem());
781 slotShowImage(name); 785 slotShowImage(name);
782} 786}
783 787
784void PIconView::slotShowImage() 788void PIconView::slotShowImage()
785{ 789{
786 bool isDir = false; 790 bool isDir = false;
787 QString name = currentFileName(isDir); 791 QString name = currentFileName(isDir);
788 if (isDir) return; 792 if (isDir) return;
789 slotShowImage( name ); 793 slotShowImage( name );
790} 794}
791void PIconView::slotShowImage( const QString& name) { 795void PIconView::slotShowImage( const QString& name) {
792 PDirLister *lister = currentView()->dirLister(); 796 PDirLister *lister = currentView()->dirLister();
793 QString r_name = lister->nameToFname(name); 797 QString r_name = lister->nameToFname(name);
794 emit sig_display(r_name); 798 emit sig_display(r_name);
795} 799}
796 800
797void PIconView::slotStartSlide() { 801void PIconView::slotStartSlide() {
798 bool isDir = false; 802 bool isDir = false;
799 QString name = currentFileName(isDir); 803 QString name = currentFileName(isDir);
800 if (isDir) { 804 if (isDir) {
801 if (!slotShowFirst()) 805 if (!slotShowFirst())
802 return; 806 return;
803 } else { 807 } else {
804 slotShowImage( name ); 808 slotShowImage( name );
805 } 809 }
806 int t = m_cfg->readNumEntry("slideshowtimeout", 2); 810 int t = m_cfg->readNumEntry("slideshowtimeout", 2);
807 emit sig_startslide(t); 811 emit sig_startslide(t);
808} 812}
809 813
810void PIconView::slotImageInfo() { 814void PIconView::slotImageInfo() {
811 bool isDir = false; 815 bool isDir = false;
812 QString name = currentFileName(isDir); 816 QString name = currentFileName(isDir);
813 if (isDir) return; 817 if (isDir) return;
814 slotImageInfo( name ); 818 slotImageInfo( name );
815} 819}
816 820
817void PIconView::slotImageInfo( const QString& name) { 821void PIconView::slotImageInfo( const QString& name) {
818 PDirLister *lister = currentView()->dirLister(); 822 PDirLister *lister = currentView()->dirLister();
819 QString r_name = lister->nameToFname(name); 823 QString r_name = lister->nameToFname(name);
820 emit sig_showInfo(r_name ); 824 emit sig_showInfo(r_name );
821} 825}
822 826
823 827
824void PIconView::slotChangeMode( int mode ) { 828void PIconView::slotChangeMode( int mode ) {
825 if ( mode >= 1 && mode <= 3 ) { 829 if ( mode >= 1 && mode <= 3 ) {
826 m_mode = mode; 830 m_mode = mode;
827 m_cfg->writeEntry("ListViewMode", m_mode); 831 m_cfg->writeEntry("ListViewMode", m_mode);
828 /* performance! */ 832 /* performance! */
829 m_view->clear(); 833 m_view->clear();
830 if (m_mode >1) { 834 if (m_mode >1) {
831 m_view->setResizeMode(QIconView::Adjust); 835 m_view->setResizeMode(QIconView::Adjust);
832 } else { 836 } else {
833 m_view->setResizeMode(QIconView::Fixed); 837 m_view->setResizeMode(QIconView::Fixed);
834 } 838 }
835 if (m_mode==1) { 839 if (m_mode==1) {
836 m_iconsize = 64; 840 m_iconsize = sDEF_ICON_SIZE;
837 } else { 841 } else {
838 m_iconsize = m_cfg->readNumEntry("iconsize", 32); 842 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
839 if (m_iconsize<12)m_iconsize = 12; 843 if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE;
840 if (m_iconsize>64)m_iconsize = 64; 844 if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE;
841 } 845 }
842 if (_dirPix){ 846 if (_dirPix){
843 delete _dirPix; 847 delete _dirPix;
844 _dirPix = 0; 848 _dirPix = 0;
845 } 849 }
846 if (_cpyPix){ 850 if (_cpyPix){
847 delete _cpyPix; 851 delete _cpyPix;
848 _cpyPix = 0; 852 _cpyPix = 0;
849 } 853 }
850 calculateGrid(); 854 calculateGrid();
851 slotReloadDir(); 855 slotReloadDir();
852 } 856 }
853} 857}
854 858
855 859
856void PIconView::resizeEvent( QResizeEvent* re ) { 860void PIconView::resizeEvent( QResizeEvent* re ) {
857 calculateGrid(re); 861 calculateGrid(re);
858 QVBox::resizeEvent( re ); 862 QVBox::resizeEvent( re );
859 //calculateGrid(); 863 //calculateGrid();
860} 864}
861 865
862 866
863void PIconView::calculateGrid(QResizeEvent* re) 867void PIconView::calculateGrid(QResizeEvent* re)
864{ 868{
865 int viewerWidth; 869 int viewerWidth;
866 if (re) { 870 if (re) {
867 viewerWidth=re->size().width(); 871 viewerWidth=re->size().width();
868 } else { 872 } else {
869 int dw = QApplication::desktop()->width(); 873 int dw = QApplication::desktop()->width();
870 viewerWidth = dw-style().scrollBarExtent().width(); 874 viewerWidth = dw-style().scrollBarExtent().width();
871 } 875 }
872 876
873 QIconView::ItemTextPos pos; 877 QIconView::ItemTextPos pos;
874 switch( m_mode ) { 878 switch( m_mode ) {
875 case 2: 879 case 2:
876 pos = QIconView::Bottom; 880 pos = QIconView::Bottom;
877 break; 881 break;
878 case 3: 882 case 3:
879 case 1: 883 case 1:
880 default: 884 default:
881 pos = QIconView::Right; 885 pos = QIconView::Right;
882 break; 886 break;
883 } 887 }
884 int cache = 0; 888 int cache = 0;
885 m_view->setItemTextPos( pos ); 889 m_view->setItemTextPos( pos );
886 switch (m_mode) { 890 switch (m_mode) {
887 case 2: 891 case 2:
888 m_view->setSpacing(2); 892 m_view->setSpacing(2);
889 m_view->setGridX(m_iconsize); 893 m_view->setGridX(m_iconsize);
890 m_view->setGridY(-1); 894 m_view->setGridY(-1);
891 cache = (int)((double)64/(double)m_iconsize*40.0); 895 cache = (int)((double)sDEF_ICON_SIZE/(double)m_iconsize*80.0);
892 odebug << "cache size: " << cache << oendl; 896 odebug << "cache size: " << cache << oendl;
893 PPixmapCache::self()->setMaxImages(cache); 897 PPixmapCache::self()->setMaxImages(cache);
894 break; 898 break;
895 case 3: 899 case 3:
896 m_view->setSpacing(10); 900 m_view->setSpacing(10);
897 m_view->setGridX( fontMetrics().width("testimage.jpg")+20); 901 m_view->setGridX( fontMetrics().width("testimage.jpg")+20);
898 m_view->setGridY(8); 902 m_view->setGridY(8);
899 PPixmapCache::self()->setMaxImages(2); 903 PPixmapCache::self()->setMaxImages(2);
900 break; 904 break;
901 case 1: 905 case 1:
902 default: 906 default:
903 m_view->setSpacing(10); 907 m_view->setSpacing(10);
904 m_view->setGridX( viewerWidth-3*m_view->spacing()); 908 m_view->setGridX( viewerWidth-3*m_view->spacing());
905 m_view->setGridY( fontMetrics().height()*2+40 ); 909 m_view->setGridY( fontMetrics().height()*2+40 );
906 PPixmapCache::self()->setMaxImages(20); 910 PPixmapCache::self()->setMaxImages(20);
907 break; 911 break;
908 } 912 }
909} 913}
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index 6e08fd8..a546b88 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -1,108 +1,112 @@
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_ICON_VIEW_H 6#ifndef PHUNK_ICON_VIEW_H
7#define PHUNK_ICON_VIEW_H 7#define PHUNK_ICON_VIEW_H
8 8
9#include <qvbox.h> 9#include <qvbox.h>
10 10
11 11
12class QIconView; 12class QIconView;
13class QIconViewItem; 13class QIconViewItem;
14class QComboBox; 14class QComboBox;
15class PIconViewItem; 15class PIconViewItem;
16class PDirLister; 16class PDirLister;
17class Ir; 17class Ir;
18 18
19namespace Opie { 19namespace Opie {
20namespace Core{ 20namespace Core{
21 class OConfig; 21 class OConfig;
22 class OKeyConfigManager; 22 class OKeyConfigManager;
23} 23}
24} 24}
25 25
26class PIconView : public QVBox { 26class PIconView : public QVBox {
27 Q_OBJECT 27 Q_OBJECT
28 friend class PIconViewItem; 28 friend class PIconViewItem;
29 enum ActionIds { 29 enum ActionIds {
30 BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem 30 BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem
31 }; 31 };
32public: 32public:
33 PIconView( QWidget* wid, Opie::Core::OConfig *cfg ); 33 PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
34 ~PIconView(); 34 ~PIconView();
35 void resetView(); 35 void resetView();
36 Opie::Core::OKeyConfigManager* manager(); 36 Opie::Core::OKeyConfigManager* manager();
37 37
38 void setDoccalled(bool); 38 void setDoccalled(bool);
39 39
40 static const int sMAX_ICON_SIZE;
41 static const int sMIN_ICON_SIZE;
42 static const int sDEF_ICON_SIZE;
43
40signals: 44signals:
41 void sig_showInfo( const QString& ); 45 void sig_showInfo( const QString& );
42 void sig_display(const QString&); 46 void sig_display(const QString&);
43 void sig_startslide(int timeout); 47 void sig_startslide(int timeout);
44 48
45public slots: 49public slots:
46 virtual void slotShowNext(); 50 virtual void slotShowNext();
47 virtual void slotShowPrev(); 51 virtual void slotShowPrev();
48 virtual void slotShowLast(); 52 virtual void slotShowLast();
49 virtual bool slotShowFirst(); 53 virtual bool slotShowFirst();
50 virtual void polish(); 54 virtual void polish();
51 55
52protected: 56protected:
53 void resizeEvent( QResizeEvent* ); 57 void resizeEvent( QResizeEvent* );
54 58
55private: 59private:
56 void initKeys(); 60 void initKeys();
57 QString currentFileName(bool &isDir)const; 61 QString currentFileName(bool &isDir)const;
58 QString nextFileName(bool &isDir)const; 62 QString nextFileName(bool &isDir)const;
59 QString prevFileName(bool &isDir)const; 63 QString prevFileName(bool &isDir)const;
60 void loadViews(); 64 void loadViews();
61 void calculateGrid(QResizeEvent*e = 0); 65 void calculateGrid(QResizeEvent*e = 0);
62 bool m_setDocCalled:1; 66 bool m_setDocCalled:1;
63 67
64private slots: 68private slots:
65 void slotDirUp(); 69 void slotDirUp();
66 void slotChangeDir(const QString&); 70 void slotChangeDir(const QString&);
67 void slotTrash(); 71 void slotTrash();
68 void slotViewChanged( int ); 72 void slotViewChanged( int );
69 void slotReloadDir(); 73 void slotReloadDir();
70 void slotRename(); 74 void slotRename();
71 void slotBeam(); 75 void slotBeam();
72 void slotBeamDone( Ir* ); 76 void slotBeamDone( Ir* );
73 77
74 void slotShowImage(); 78 void slotShowImage();
75 void slotShowImage( const QString& ); 79 void slotShowImage( const QString& );
76 void slotImageInfo(); 80 void slotImageInfo();
77 void slotImageInfo( const QString& ); 81 void slotImageInfo( const QString& );
78 void slotStartSlide(); 82 void slotStartSlide();
79 83
80 void slotStart(); 84 void slotStart();
81 void slotEnd(); 85 void slotEnd();
82 86
83/* for performance reasons make it inline in the future */ 87/* for performance reasons make it inline in the future */
84 void addFolders( const QStringList& ); 88 void addFolders( const QStringList& );
85 void addFiles( const QStringList& ); 89 void addFiles( const QStringList& );
86 void slotClicked(QIconViewItem* ); 90 void slotClicked(QIconViewItem* );
87 void slotRetrun(QIconViewItem* ); 91 void slotRetrun(QIconViewItem* );
88 92
89/**/ 93/**/
90 void slotThumbInfo(const QString&, const QString&); 94 void slotThumbInfo(const QString&, const QString&);
91 void slotThumbNail(const QString&, const QPixmap&); 95 void slotThumbNail(const QString&, const QPixmap&);
92 96
93 void slotChangeMode( int ); 97 void slotChangeMode( int );
94private: 98private:
95 Opie::Core::OKeyConfigManager *m_viewManager; 99 Opie::Core::OKeyConfigManager *m_viewManager;
96 Opie::Core::OConfig *m_cfg; 100 Opie::Core::OConfig *m_cfg;
97 QComboBox* m_views; 101 QComboBox* m_views;
98 QIconView* m_view; 102 QIconView* m_view;
99 QString m_path; 103 QString m_path;
100 bool m_updatet : 1; 104 bool m_updatet : 1;
101 int m_mode; 105 int m_mode;
102 bool m_internalReset:1; 106 bool m_internalReset:1;
103 int m_iconsize; 107 int m_iconsize;
104 QHBox*m_hbox; 108 QHBox*m_hbox;
105 QWidget*m_customWidget; 109 QWidget*m_customWidget;
106}; 110};
107 111
108#endif 112#endif
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 6c3f9cb..994fe12 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -1,286 +1,321 @@
1#include "imageview.h" 1#include "imageview.h"
2 2
3#include <opie2/odebug.h> 3#include <opie2/odebug.h>
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5#include <opie2/okeyconfigwidget.h> 5#include <opie2/okeyconfigwidget.h>
6 6
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/qcopenvelope_qws.h> 9#include <qpe/qcopenvelope_qws.h>
10 10
11#include <qpopupmenu.h> 11#include <qpopupmenu.h>
12#include <qtimer.h> 12#include <qtimer.h>
13#include <qaction.h> 13#include <qaction.h>
14 14
15using namespace Opie::Core; 15using namespace Opie::Core;
16 16
17ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) 17ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
18 : Opie::MM::OImageScrollView(parent,name,fl) 18 : Opie::MM::OImageScrollView(parent,name,fl)
19{ 19{
20 m_viewManager = 0; 20 m_viewManager = 0;
21 focus_in_count = 0; 21 focus_in_count = 0;
22 m_cfg = cfg; 22 m_cfg = cfg;
23 m_isFullScreen = false; 23 m_isFullScreen = false;
24 m_ignore_next_in = false; 24 m_ignore_next_in = false;
25 m_slideTimer = 0; 25 m_slideTimer = 0;
26 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); 26 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
27 initKeys(); 27 initKeys();
28 m_slideValue = 5; 28 m_slideValue = 5;
29 m_gDisplayType = 0; 29 m_gDisplayType = 0;
30 m_gPrevNext = 0; 30 m_gPrevNext = 0;
31 m_hGroup = 0; 31 m_hGroup = 0;
32 m_gBright = 0;
32 m_Rotated = false; 33 m_Rotated = false;
33 closeIfHide = false; 34 closeIfHide = false;
34 int min = QApplication::desktop()->size().width()>QApplication::desktop()->size().height()? 35 int min = QApplication::desktop()->size().width()>QApplication::desktop()->size().height()?
35 QApplication::desktop()->size().height():QApplication::desktop()->size().width(); 36 QApplication::desktop()->size().height():QApplication::desktop()->size().width();
36 if (min>320) { 37 if (min>320) {
37 // bigscreen 38 // bigscreen
38 setMinimumSize(min/3,min/3); 39 setMinimumSize(min/3,min/3);
39 } else { 40 } else {
40 setMinimumSize(10,10); 41 setMinimumSize(10,10);
41 } 42 }
43 connect(this,SIGNAL(incBrightness()),this,SLOT(slotIncBrightness()));
44 connect(this,SIGNAL(decBrightness()),this,SLOT(slotDecBrightness()));
45
42 m_sysChannel = new QCopChannel( "QPE/System", this ); 46 m_sysChannel = new QCopChannel( "QPE/System", this );
43 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), 47 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
44 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); 48 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
45} 49}
46 50
51void ImageView::slotIncBrightness()
52{
53 int lb = Intensity()+5;
54 if (lb>100) lb=100;
55 setIntensity(lb,true);
56}
57
58void ImageView::slotDecBrightness()
59{
60 int lb = Intensity()-5;
61 if (lb<-100) lb=-100;
62 setIntensity(lb,true);
63}
64
47void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) 65void ImageView::systemMessage( const QCString& msg, const QByteArray& data )
48{ 66{
49 int _newrotation; 67 int _newrotation;
50 QDataStream stream( data, IO_ReadOnly ); 68 QDataStream stream( data, IO_ReadOnly );
51 odebug << "received system message: " << msg << oendl; 69 odebug << "received system message: " << msg << oendl;
52 if ( msg == "setCurrentRotation(int)" ) 70 if ( msg == "setCurrentRotation(int)" )
53 { 71 {
54 stream >> _newrotation; 72 stream >> _newrotation;
55 odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl; 73 odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl;
56 if (!fullScreen()) { 74 if (!fullScreen()) {
57 m_rotation = _newrotation; 75 m_rotation = _newrotation;
58 return; 76 return;
59 } 77 }
60 } 78 }
61} 79}
62 80
63void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) 81void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup)
64{ 82{
65 m_gDisplayType = disptypeGroup; 83 m_gDisplayType = disptypeGroup;
66 m_gPrevNext = nextprevGroup; 84 m_gPrevNext = nextprevGroup;
67 m_hGroup = hGroup; 85 m_hGroup = hGroup;
86 m_gBright = brightGroup;
68} 87}
69 88
70ImageView::~ImageView() 89ImageView::~ImageView()
71{ 90{
72 odebug << "Destructor imageview" << oendl; 91 odebug << "Destructor imageview" << oendl;
73 delete m_viewManager; 92 delete m_viewManager;
74} 93}
75 94
76Opie::Core::OKeyConfigManager* ImageView::manager() 95Opie::Core::OKeyConfigManager* ImageView::manager()
77{ 96{
78 if (!m_viewManager) { 97 if (!m_viewManager) {
79 initKeys(); 98 initKeys();
80 } 99 }
81 return m_viewManager; 100 return m_viewManager;
82} 101}
83 102
84void ImageView::startSlide(int value) 103void ImageView::startSlide(int value)
85{ 104{
86 if (!m_slideTimer) { 105 if (!m_slideTimer) {
87 m_slideTimer = new QTimer(this); 106 m_slideTimer = new QTimer(this);
88 } 107 }
89 m_slideValue=value; 108 m_slideValue=value;
90 connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); 109 connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide()));
91 /* this "+1" is one millisecond. with that we can setup a slideshowvalue 110 /* this "+1" is one millisecond. with that we can setup a slideshowvalue
92 of 0. eg "as fast as possible". 111 of 0. eg "as fast as possible".
93 */ 112 */
94 m_slideTimer->start(m_slideValue*1000+1,true); 113 m_slideTimer->start(m_slideValue*1000+1,true);
95} 114}
96 115
97void ImageView::stopSlide() 116void ImageView::stopSlide()
98{ 117{
99 if (!m_slideTimer) { 118 if (!m_slideTimer) {
100 return; 119 return;
101 } 120 }
102 m_slideTimer->stop(); 121 m_slideTimer->stop();
103 delete m_slideTimer; 122 delete m_slideTimer;
104 m_slideTimer = 0; 123 m_slideTimer = 0;
105} 124}
106 125
107void ImageView::nextSlide() 126void ImageView::nextSlide()
108{ 127{
109 if (!m_slideTimer) { 128 if (!m_slideTimer) {
110 return; 129 return;
111 } 130 }
112#if 0 131#if 0
113 if (isHidden()) { 132 if (isHidden()) {
114 delete m_slideTimer; 133 delete m_slideTimer;
115 m_slideTimer = 0; 134 m_slideTimer = 0;
116 return; 135 return;
117 } 136 }
118#endif 137#endif
119 emit dispNext(); 138 emit dispNext();
120 m_slideTimer->start(m_slideValue*1000,true); 139 m_slideTimer->start(m_slideValue*1000,true);
121} 140}
122void ImageView::initKeys() 141void ImageView::initKeys()
123{ 142{
124 odebug << "init imageview keys" << oendl; 143 odebug << "init imageview keys" << oendl;
125 if (!m_cfg) { 144 if (!m_cfg) {
126 m_cfg = new Opie::Core::OConfig("opie-eye"); 145 m_cfg = new Opie::Core::OConfig("opie-eye");
127 m_cfg->setGroup("image_view_keys" ); 146 m_cfg->setGroup("image_view_keys" );
128 } 147 }
129 Opie::Core::OKeyPair::List lst; 148 Opie::Core::OKeyPair::List lst;
130 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 149 lst.append( Opie::Core::OKeyPair::upArrowKey() );
131 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 150 lst.append( Opie::Core::OKeyPair::downArrowKey() );
132 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 151 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
133 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 152 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
134 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); 153 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0));
135 154
136 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", 155 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys",
137 lst, false,this, "image_view_keys" ); 156 lst, false,this, "image_view_keys" );
138 157
139 /** 158 /**
140 * Handle KeyEvents when they're pressed. This avoids problems 159 * Handle KeyEvents when they're pressed. This avoids problems
141 * with 'double next' on Return. 160 * with 'double next' on Return.
142 * The Return press would switch to this view and the return 161 * The Return press would switch to this view and the return
143 * release would emit the dispNext Signal. 162 * release would emit the dispNext Signal.
144 */ 163 */
145 m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); 164 m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed );
146 165
147 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", 166 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
148 Resource::loadPixmap("1to1"), ViewInfo, 167 Resource::loadPixmap("1to1"), ViewInfo,
149 Opie::Core::OKeyPair(Qt::Key_I,0), 168 Opie::Core::OKeyPair(Qt::Key_I,0),
150 this, SLOT(slotShowImageInfo()))); 169 this, SLOT(slotShowImageInfo())));
151 170
152 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", 171 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate",
153 Resource::loadPixmap("rotate"), Autorotate, 172 Resource::loadPixmap("rotate"), Autorotate,
154 Opie::Core::OKeyPair(Qt::Key_R,0), 173 Opie::Core::OKeyPair(Qt::Key_R,0),
155 this, SIGNAL(toggleAutorotate()))); 174 this, SIGNAL(toggleAutorotate())));
156 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", 175 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
157 Resource::loadPixmap("1to1"), Autoscale, 176 Resource::loadPixmap("1to1"), Autoscale,
158 Opie::Core::OKeyPair(Qt::Key_S,0), 177 Opie::Core::OKeyPair(Qt::Key_S,0),
159 this, SIGNAL(toggleAutoscale()))); 178 this, SIGNAL(toggleAutoscale())));
160 179
161 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", 180 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext",
162 Resource::loadPixmap("forward"), ShowNext, 181 Resource::loadPixmap("forward"), ShowNext,
163 Opie::Core::OKeyPair(Qt::Key_Return,0), 182 Opie::Core::OKeyPair(Qt::Key_Return,0),
164 this, SIGNAL(dispNext()))); 183 this, SIGNAL(dispNext())));
165 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", 184 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev",
166 Resource::loadPixmap("back"), ShowPrevious, 185 Resource::loadPixmap("back"), ShowPrevious,
167 Opie::Core::OKeyPair(Qt::Key_P,0), 186 Opie::Core::OKeyPair(Qt::Key_P,0),
168 this, SIGNAL(dispPrev()))); 187 this, SIGNAL(dispPrev())));
169 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", 188 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
170 Resource::loadPixmap("fullscreen"), FullScreen, 189 Resource::loadPixmap("fullscreen"), FullScreen,
171 Opie::Core::OKeyPair(Qt::Key_F,0), 190 Opie::Core::OKeyPair(Qt::Key_F,0),
172 this, SIGNAL(toggleFullScreen()))); 191 this, SIGNAL(toggleFullScreen())));
173 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", 192 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer",
174 Resource::loadPixmap("mag"), Zoomer, 193 Resource::loadPixmap("mag"), Zoomer,
175 Opie::Core::OKeyPair(Qt::Key_T,0), 194 Opie::Core::OKeyPair(Qt::Key_T,0),
176 this, SIGNAL(toggleZoomer()))); 195 this, SIGNAL(toggleZoomer())));
196
197 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Increase brightness"), "incbrightness",
198 Resource::loadPixmap("up"), Incbrightness,
199 Opie::Core::OKeyPair(Qt::Key_B,0),
200 this, SIGNAL(incBrightness())));
201 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Decrease brightness"), "decbrightness",
202 Resource::loadPixmap("down"), Decbrightness,
203 Opie::Core::OKeyPair(Qt::Key_D,0),
204 this, SIGNAL(decBrightness())));
177 m_viewManager->handleWidget( this ); 205 m_viewManager->handleWidget( this );
178 m_viewManager->load(); 206 m_viewManager->load();
179} 207}
180 208
181void ImageView::keyReleaseEvent(QKeyEvent * e) 209void ImageView::keyReleaseEvent(QKeyEvent * e)
182{ 210{
183 if (!e || e->state()!=0) { 211 if (!e || e->state()!=0) {
184 return; 212 return;
185 } 213 }
186 if (e->key()==Qt::Key_Escape) { 214 if (e->key()==Qt::Key_Escape) {
187 if (fullScreen()) { 215 if (fullScreen()) {
188 emit hideMe(); 216 emit hideMe();
189 } 217 }
190 if (closeIfHide) { 218 if (closeIfHide) {
191 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 219 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
192 } 220 }
193 } 221 }
194} 222}
195 223
196void ImageView::setCloseIfHide(bool how) 224void ImageView::setCloseIfHide(bool how)
197{ 225{
198 closeIfHide = how; 226 closeIfHide = how;
199} 227}
200 228
201void ImageView::slotShowImageInfo() 229void ImageView::slotShowImageInfo()
202{ 230{
203 emit dispImageInfo(m_lastName); 231 emit dispImageInfo(m_lastName);
204} 232}
205 233
206void ImageView::contentsMousePressEvent ( QMouseEvent * e) 234void ImageView::contentsMousePressEvent ( QMouseEvent * e)
207{ 235{
208 if (e->button()==1) { 236 if (e->button()==1) {
209 return OImageScrollView::contentsMousePressEvent(e); 237 return OImageScrollView::contentsMousePressEvent(e);
210 } 238 }
211 odebug << "Popup " << oendl; 239 odebug << "Popup " << oendl;
212 QPopupMenu *m = new QPopupMenu(this); 240 QPopupMenu *m = new QPopupMenu(this);
213 if (!m) return; 241 if (!m) return;
214 if (m_hGroup) { 242 if (m_hGroup) {
215 m_hGroup->addTo(m); 243 m_hGroup->addTo(m);
216 } 244 }
217 if (fullScreen()) { 245 if (fullScreen()) {
218 if (m_gPrevNext) { 246 if (m_gPrevNext) {
219 m->insertSeparator(); 247 m->insertSeparator();
220 m_gPrevNext->addTo(m); 248 m_gPrevNext->addTo(m);
221 } 249 }
222 if (m_gDisplayType) { 250 if (m_gDisplayType) {
223 m->insertSeparator(); 251 m->insertSeparator();
224 m_gDisplayType->addTo(m); 252 m_gDisplayType->addTo(m);
225 } 253 }
254 if (m_gBright) {
255 m->insertSeparator();
256 m_gBright->addTo(m);
257 }
226 } 258 }
227 m->setFocus(); 259 m->setFocus();
228 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 260 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
229 if (m_hGroup) { 261 if (m_hGroup) {
230 m_hGroup->removeFrom(m); 262 m_hGroup->removeFrom(m);
231 } 263 }
232 if (m_gPrevNext) { 264 if (m_gPrevNext) {
233 m_gPrevNext->removeFrom(m); 265 m_gPrevNext->removeFrom(m);
234 } 266 }
235 if (m_gDisplayType) { 267 if (m_gDisplayType) {
236 m_gDisplayType->removeFrom(m); 268 m_gDisplayType->removeFrom(m);
237 } 269 }
270 if (m_gBright) {
271 m_gBright->removeFrom(m);
272 }
238 delete m; 273 delete m;
239} 274}
240 275
241void ImageView::setFullScreen(bool how,bool force) 276void ImageView::setFullScreen(bool how,bool force)
242{ 277{
243 m_isFullScreen = how; 278 m_isFullScreen = how;
244 if (how) { 279 if (how) {
245 m_ignore_next_in = true; 280 m_ignore_next_in = true;
246// setFixedSize(qApp->desktop()->size()); 281// setFixedSize(qApp->desktop()->size());
247 setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); 282 setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height());
248 if (force) showFullScreen(); 283 if (force) showFullScreen();
249 } else { 284 } else {
250// setMinimumSize(10,10); 285// setMinimumSize(10,10);
251 } 286 }
252} 287}
253 288
254void ImageView::focusInEvent(QFocusEvent *) 289void ImageView::focusInEvent(QFocusEvent *)
255{ 290{
256 // Always do it here, no matter the size. 291 // Always do it here, no matter the size.
257 odebug << "Focus in (view)" << oendl; 292 odebug << "Focus in (view)" << oendl;
258 //if (fullScreen()) parentWidget()->showNormal(); 293 //if (fullScreen()) parentWidget()->showNormal();
259 if (m_ignore_next_in){m_ignore_next_in=false;return;} 294 if (m_ignore_next_in){m_ignore_next_in=false;return;}
260 if (fullScreen()) enableFullscreen(); 295 if (fullScreen()) enableFullscreen();
261} 296}
262 297
263void ImageView::hide() 298void ImageView::hide()
264{ 299{
265 if (fullScreen()) { 300 if (fullScreen()) {
266 m_ignore_next_in = true; 301 m_ignore_next_in = true;
267 showNormal(); 302 showNormal();
268 } 303 }
269 QWidget::hide(); 304 QWidget::hide();
270} 305}
271void ImageView::enableFullscreen() 306void ImageView::enableFullscreen()
272{ 307{
273 if (!fullScreen()) return; 308 if (!fullScreen()) return;
274 if (m_ignore_next_in) {m_ignore_next_in = false;return;} 309 if (m_ignore_next_in) {m_ignore_next_in = false;return;}
275 310
276 setUpdatesEnabled(false); 311 setUpdatesEnabled(false);
277 // This is needed because showNormal() forcefully changes the window 312 // This is needed because showNormal() forcefully changes the window
278 // style to WSTyle_TopLevel. 313 // style to WSTyle_TopLevel.
279 reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); 314 reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0));
280 // Enable fullscreen. 315 // Enable fullscreen.
281 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus 316 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
282 * so we must block it here! */ 317 * so we must block it here! */
283 m_ignore_next_in = true; 318 m_ignore_next_in = true;
284 showFullScreen(); 319 showFullScreen();
285 setUpdatesEnabled(true); 320 setUpdatesEnabled(true);
286} 321}
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index e8c8df7..b5801a6 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -1,85 +1,91 @@
1#ifndef _IMAGE_VIEW_H 1#ifndef _IMAGE_VIEW_H
2#define _IMAGE_VIEW_H 2#define _IMAGE_VIEW_H
3 3
4#include <opie2/oimagescrollview.h> 4#include <opie2/oimagescrollview.h>
5 5
6#include <qwidget.h> 6#include <qwidget.h>
7 7
8class QTimer; 8class QTimer;
9class QActionGroup; 9class QActionGroup;
10class QAction; 10class QAction;
11 11
12class QCopChannel; 12class QCopChannel;
13 13
14namespace Opie { 14namespace Opie {
15 namespace Core { 15 namespace Core {
16 class OConfig; 16 class OConfig;
17 class OKeyConfigManager; 17 class OKeyConfigManager;
18 } 18 }
19} 19}
20 20
21class ImageView:public Opie::MM::OImageScrollView 21class ImageView:public Opie::MM::OImageScrollView
22{ 22{
23 Q_OBJECT 23 Q_OBJECT
24 24
25 enum ActionIds { 25 enum ActionIds {
26 ViewInfo, 26 ViewInfo,
27 FullScreen, 27 FullScreen,
28 ShowNext, 28 ShowNext,
29 ShowPrevious, 29 ShowPrevious,
30 Zoomer, 30 Zoomer,
31 Autorotate, 31 Autorotate,
32 Autoscale 32 Autoscale,
33 Incbrightness,
34 Decbrightness
33 }; 35 };
34 36
35public: 37public:
36 ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 ); 38 ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 );
37 virtual ~ImageView(); 39 virtual ~ImageView();
38 Opie::Core::OKeyConfigManager* manager(); 40 Opie::Core::OKeyConfigManager* manager();
39 void setFullScreen(bool how,bool force=true); 41 void setFullScreen(bool how,bool force=true);
40 bool fullScreen(){return m_isFullScreen;} 42 bool fullScreen(){return m_isFullScreen;}
41 virtual void enableFullscreen(); 43 virtual void enableFullscreen();
42 void stopSlide(); 44 void stopSlide();
43 void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); 45 void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup);
44 void setCloseIfHide(bool); 46 void setCloseIfHide(bool);
45 47
46signals: 48signals:
47 void dispImageInfo(const QString&); 49 void dispImageInfo(const QString&);
48 void dispNext(); 50 void dispNext();
49 void dispPrev(); 51 void dispPrev();
50 void toggleFullScreen(); 52 void toggleFullScreen();
51 void hideMe(); 53 void hideMe();
52 void toggleZoomer(); 54 void toggleZoomer();
53 void toggleAutoscale(); 55 void toggleAutoscale();
54 void toggleAutorotate(); 56 void toggleAutorotate();
57 void incBrightness();
58 void decBrightness();
55 59
56protected: 60protected:
57 Opie::Core::OConfig * m_cfg; 61 Opie::Core::OConfig * m_cfg;
58 Opie::Core::OKeyConfigManager*m_viewManager; 62 Opie::Core::OKeyConfigManager*m_viewManager;
59 void initKeys(); 63 void initKeys();
60 bool m_isFullScreen:1; 64 bool m_isFullScreen:1;
61 bool m_ignore_next_in:1; 65 bool m_ignore_next_in:1;
62 bool m_Rotated:1; 66 bool m_Rotated:1;
63 67
64 int focus_in_count; 68 int focus_in_count;
65 QTimer*m_slideTimer; 69 QTimer*m_slideTimer;
66 int m_slideValue; 70 int m_slideValue;
67 virtual void focusInEvent ( QFocusEvent * ); 71 virtual void focusInEvent ( QFocusEvent * );
68 QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; 72 QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup,*m_gBright;
69 bool closeIfHide:1; 73 bool closeIfHide:1;
70 QCopChannel* m_sysChannel; 74 QCopChannel* m_sysChannel;
71 int m_rotation; 75 int m_rotation;
72 76
73public slots: 77public slots:
74 virtual void hide(); 78 virtual void hide();
75 virtual void startSlide(int); 79 virtual void startSlide(int);
76 virtual void nextSlide(); 80 virtual void nextSlide();
77 virtual void systemMessage( const QCString&, const QByteArray& ); 81 virtual void systemMessage( const QCString&, const QByteArray& );
82 virtual void slotIncBrightness();
83 virtual void slotDecBrightness();
78 84
79protected slots: 85protected slots:
80 virtual void slotShowImageInfo(); 86 virtual void slotShowImageInfo();
81 virtual void keyReleaseEvent(QKeyEvent * e); 87 virtual void keyReleaseEvent(QKeyEvent * e);
82 virtual void contentsMousePressEvent ( QMouseEvent * e); 88 virtual void contentsMousePressEvent ( QMouseEvent * e);
83}; 89};
84 90
85#endif 91#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index d11e4e1..4ee252f 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -12,810 +12,822 @@
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> 22#include <opie2/owait.h>
23#include <opie2/oapplication.h> 23#include <opie2/oapplication.h>
24 24
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/ir.h> 27#include <qpe/ir.h>
28#include <qpe/storage.h> 28#include <qpe/storage.h>
29#include <qpe/applnk.h> 29#include <qpe/applnk.h>
30 30
31#include <qtoolbar.h> 31#include <qtoolbar.h>
32#include <qtoolbutton.h> 32#include <qtoolbutton.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qdialog.h> 34#include <qdialog.h>
35#include <qmap.h> 35#include <qmap.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qframe.h> 37#include <qframe.h>
38#include <qmenubar.h> 38#include <qmenubar.h>
39#include <qaction.h> 39#include <qaction.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41 41
42//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 42//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
43OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 43OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
44 44
45PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 45PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
46 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 46 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
47{ 47{
48 setCaption( QObject::tr("Opie Eye" ) ); 48 setCaption( QObject::tr("Opie Eye" ) );
49 m_cfg = new Opie::Core::OConfig("opie-eye"); 49 m_cfg = new Opie::Core::OConfig("opie-eye");
50 m_cfg->setGroup("main" ); 50 m_cfg->setGroup("main" );
51 readConfig(); 51 readConfig();
52 m_setDocCalled = false; 52 m_setDocCalled = false;
53 m_polishDone = false; 53 m_polishDone = false;
54 m_SmallWindow = QApplication::desktop()->size().width()<330; 54 m_SmallWindow = QApplication::desktop()->size().width()<330;
55 55
56 m_storage = new StorageInfo(); 56 m_storage = new StorageInfo();
57 connect(m_storage, SIGNAL(disksChanged() ), 57 connect(m_storage, SIGNAL(disksChanged() ),
58 this, SLOT( dirChanged() ) ); 58 this, SLOT( dirChanged() ) );
59 59
60 m_stack = new Opie::Ui::OWidgetStack( this ); 60 m_stack = new Opie::Ui::OWidgetStack( this );
61 setCentralWidget( m_stack ); 61 setCentralWidget( m_stack );
62 62
63 m_view = new PIconView( m_stack, m_cfg ); 63 m_view = new PIconView( m_stack, m_cfg );
64 m_stack->addWidget( m_view, IconView ); 64 m_stack->addWidget( m_view, IconView );
65 m_stack->raiseWidget( IconView ); 65 m_stack->raiseWidget( IconView );
66 66
67 connect(m_view, SIGNAL(sig_display(const QString&)), 67 connect(m_view, SIGNAL(sig_display(const QString&)),
68 this, SLOT(slotDisplay(const QString&))); 68 this, SLOT(slotDisplay(const QString&)));
69 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 69 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
70 this, SLOT(slotShowInfo(const QString&)) ); 70 this, SLOT(slotShowInfo(const QString&)) );
71 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 71 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
72 72
73 listviewMenu = 0; 73 listviewMenu = 0;
74 /* setup menu and toolbar */ 74 /* setup menu and toolbar */
75 setupActions(); 75 setupActions();
76 setupToolbar(); 76 setupToolbar();
77 setupMenu(); 77 setupMenu();
78 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true)); 78 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
79 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn()); 79 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
80 if (m_aForceSmall) { 80 if (m_aForceSmall) {
81 m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true)); 81 m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true));
82 } 82 }
83 odebug << "mainwindow constructor done" << oendl; 83 odebug << "mainwindow constructor done" << oendl;
84} 84}
85 85
86PMainWindow::~PMainWindow() { 86PMainWindow::~PMainWindow() {
87} 87}
88 88
89void PMainWindow::slotToggleZoomer() 89void PMainWindow::slotToggleZoomer()
90{ 90{
91 m_aZoomer->setOn(!m_aZoomer->isOn()); 91 m_aZoomer->setOn(!m_aZoomer->isOn());
92} 92}
93 93
94void PMainWindow::slotZoomerToggled(bool how) 94void PMainWindow::slotZoomerToggled(bool how)
95{ 95{
96 if (m_disp) { 96 if (m_disp) {
97 m_disp->setShowZoomer(how); 97 m_disp->setShowZoomer(how);
98 } 98 }
99 if (autoSave) { 99 if (autoSave) {
100 m_cfg->writeEntry("zoomeron",how); 100 m_cfg->writeEntry("zoomeron",how);
101 } 101 }
102} 102}
103 103
104void PMainWindow::slotToggleAutorotate() 104void PMainWindow::slotToggleAutorotate()
105{ 105{
106 if (!m_aAutoRotate->isEnabled()) return; 106 if (!m_aAutoRotate->isEnabled()) return;
107 m_aAutoRotate->setOn(!m_aAutoRotate->isOn()); 107 m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
108} 108}
109 109
110void PMainWindow::slotToggleAutoscale() 110void PMainWindow::slotToggleAutoscale()
111{ 111{
112 m_aUnscaled->setOn(!m_aUnscaled->isOn()); 112 m_aUnscaled->setOn(!m_aUnscaled->isOn());
113} 113}
114 114
115void PMainWindow::slotRotateToggled(bool how) 115void PMainWindow::slotRotateToggled(bool how)
116{ 116{
117 if (autoSave) { 117 if (autoSave) {
118 m_cfg->writeEntry("autorotate",how); 118 m_cfg->writeEntry("autorotate",how);
119 } 119 }
120 if (m_disp) { 120 if (m_disp) {
121 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); 121 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
122 } 122 }
123} 123}
124 124
125void PMainWindow::slotScaleToggled(bool how) 125void PMainWindow::slotScaleToggled(bool how)
126{ 126{
127 if (autoSave) { 127 if (autoSave) {
128 m_cfg->writeEntry("unscaled",how); 128 m_cfg->writeEntry("unscaled",how);
129 } 129 }
130 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; 130 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
131 odebug << "How: " << how << oendl; 131 odebug << "How: " << how << oendl;
132 if (how) { 132 if (how) {
133 m_aAutoRotate->setOn(false); 133 m_aAutoRotate->setOn(false);
134 } 134 }
135 if (m_disp) { 135 if (m_disp) {
136 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); 136 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
137 } 137 }
138 m_aAutoRotate->setEnabled(!how); 138 m_aAutoRotate->setEnabled(!how);
139 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; 139 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
140} 140}
141 141
142void PMainWindow::slotConfig() { 142void PMainWindow::slotConfig() {
143 /* 143 /*
144 * have a tab with the possible views 144 * have a tab with the possible views
145 * a tab for globals image cache size.. scaled loading 145 * a tab for globals image cache size.. scaled loading
146 * and one tab for the KeyConfigs 146 * and one tab for the KeyConfigs
147 */ 147 */
148 QDialog dlg(this, 0, true); 148 QDialog dlg(this, 0, true);
149 dlg.setCaption( tr("Opie Eye - Config" ) ); 149 dlg.setCaption( tr("Opie Eye - Config" ) );
150 150
151 QHBoxLayout *lay = new QHBoxLayout(&dlg); 151 QHBoxLayout *lay = new QHBoxLayout(&dlg);
152 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 152 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
153 lay->addWidget( wid ); 153 lay->addWidget( wid );
154 154
155 BaseSetup*bSetup = new BaseSetup(m_cfg,wid); 155 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
156 wid->addTab(bSetup,"SettingsIcon","Basics setup"); 156 wid->addTab(bSetup,"SettingsIcon","Basics setup");
157 157
158 ViewMap *vM = viewMap(); 158 ViewMap *vM = viewMap();
159 ViewMap::Iterator _it = vM->begin(); 159 ViewMap::Iterator _it = vM->begin();
160 QMap<PDirView*, QWidget*> lst; 160 QMap<PDirView*, QWidget*> lst;
161 161
162 for( ; _it != vM->end(); ++_it ) { 162 for( ; _it != vM->end(); ++_it ) {
163 PDirView *view = (_it.data())(*m_cfg); 163 PDirView *view = (_it.data())(*m_cfg);
164 PInterfaceInfo *inf = view->interfaceInfo(); 164 PInterfaceInfo *inf = view->interfaceInfo();
165 QWidget *_wid = inf->configWidget( *m_cfg ); 165 QWidget *_wid = inf->configWidget( *m_cfg );
166 if (!_wid) continue; 166 if (!_wid) continue;
167 _wid->reparent(wid, QPoint() ); 167 _wid->reparent(wid, QPoint() );
168 lst.insert( view, _wid ); 168 lst.insert( view, _wid );
169 wid->addTab( _wid, "fileopen", inf->name() ); 169 wid->addTab( _wid, "fileopen", inf->name() );
170 } 170 }
171 171
172/* 172/*
173 * Add the KeyConfigWidget 173 * Add the KeyConfigWidget
174 */ 174 */
175 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 175 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
176 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 176 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
177 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 177 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
178 QWidget*w = m_stack->visibleWidget(); 178 QWidget*w = m_stack->visibleWidget();
179 179
180 bool reminfo = false; 180 bool reminfo = false;
181 if ( !m_info ) { 181 if ( !m_info ) {
182 reminfo = true; 182 reminfo = true;
183 initInfo(); 183 initInfo();
184 m_info->hide(); 184 m_info->hide();
185 } 185 }
186 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 186 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
187 187
188 bool remdisp = false; 188 bool remdisp = false;
189 if ( !m_disp ) { 189 if ( !m_disp ) {
190 remdisp = true; 190 remdisp = true;
191 initDisp(); 191 initDisp();
192 m_disp->hide(); 192 m_disp->hide();
193 } 193 }
194 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 194 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
195 195
196 keyWid->load(); 196 keyWid->load();
197 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 197 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
198 wid->setCurrentTab(0); 198 wid->setCurrentTab(0);
199 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 199 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
200 200
201/* 201/*
202 * clean up 202 * clean up
203 *apply changes 203 *apply changes
204 */ 204 */
205 205
206 QMap<PDirView*, QWidget*>::Iterator it; 206 QMap<PDirView*, QWidget*>::Iterator it;
207 for ( it = lst.begin(); it != lst.end(); ++it ) { 207 for ( it = lst.begin(); it != lst.end(); ++it ) {
208 if ( act ) 208 if ( act )
209 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 209 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
210 delete it.key(); 210 delete it.key();
211 } 211 }
212 212
213 213
214 if ( act ) { 214 if ( act ) {
215 keyWid->save(); 215 keyWid->save();
216 m_disp->manager()->save(); 216 m_disp->manager()->save();
217 m_info->manager()->save(); 217 m_info->manager()->save();
218 m_view->manager()->save(); 218 m_view->manager()->save();
219 bSetup->save_values(); 219 bSetup->save_values();
220 m_view->resetView(); 220 m_view->resetView();
221 readConfig(); 221 readConfig();
222 } 222 }
223 delete keyWid; 223 delete keyWid;
224 224
225 m_stack->raiseWidget(w); 225 m_stack->raiseWidget(w);
226 if (remdisp) { 226 if (remdisp) {
227 m_disp->hide(); 227 m_disp->hide();
228 } 228 }
229 if (reminfo) { 229 if (reminfo) {
230 m_info->hide(); 230 m_info->hide();
231 } 231 }
232 if (m_disp) { 232 if (m_disp) {
233 m_disp->setIntensity(m_Intensity,true); 233 m_disp->setIntensity(m_Intensity,true);
234 } 234 }
235} 235}
236 236
237/* 237/*
238 * create a new image info component 238 * create a new image info component
239 * and detach the current one 239 * and detach the current one
240 * we will make the other delete on exit 240 * we will make the other delete on exit
241 */ 241 */
242template<class T> 242template<class T>
243void PMainWindow::initT( const char* name, T** ptr, int id) { 243void PMainWindow::initT( const char* name, T** ptr, int id) {
244 if ( *ptr ) { 244 if ( *ptr ) {
245 (*ptr)->disconnect(this, SLOT(slotReturn())); 245 (*ptr)->disconnect(this, SLOT(slotReturn()));
246 (*ptr)->setDestructiveClose(); 246 (*ptr)->setDestructiveClose();
247 m_stack->removeWidget( *ptr ); 247 m_stack->removeWidget( *ptr );
248 } 248 }
249 *ptr = new T(m_cfg, m_stack, name ); 249 *ptr = new T(m_cfg, m_stack, name );
250 m_stack->addWidget( *ptr, id ); 250 m_stack->addWidget( *ptr, id );
251 251
252 connect(*ptr, SIGNAL(sig_return()), 252 connect(*ptr, SIGNAL(sig_return()),
253 this,SLOT(slotReturn())); 253 this,SLOT(slotReturn()));
254 254
255} 255}
256 256
257void PMainWindow::initInfo() { 257void PMainWindow::initInfo() {
258 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 258 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
259 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&)));
260} 260}
261 261
262void PMainWindow::initDisp() { 262void PMainWindow::initDisp() {
263 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 263 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
264 if (m_disp) { 264 if (m_disp) {
265// if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 265// if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
266 //m_disp->setMinimumSize(QApplication::desktop()->size()/2); 266 //m_disp->setMinimumSize(QApplication::desktop()->size()/2);
267// } 267// }
268 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); 268 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType,m_hBright);
269 m_disp->setAutoScale(!m_aUnscaled->isOn()); 269 m_disp->setAutoScale(!m_aUnscaled->isOn());
270 m_disp->setAutoRotate(m_aAutoRotate->isOn()); 270 m_disp->setAutoRotate(m_aAutoRotate->isOn());
271 m_disp->setShowZoomer(m_aZoomer->isOn()); 271 m_disp->setShowZoomer(m_aZoomer->isOn());
272 m_disp->setBackgroundColor(white); 272 m_disp->setBackgroundColor(white);
273 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&)));
274 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 274 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
275 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 275 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
276 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 276 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
277 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 277 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
278 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 278 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
279 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 279 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
280 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 280 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
281 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)));
282 connect(m_IncBrightness,SIGNAL(activated()),m_disp,SLOT(slotIncBrightness()));
283 connect(m_DecBrightness,SIGNAL(activated()),m_disp,SLOT(slotDecBrightness()));
282 slotFullScreenToggled(m_aFullScreen->isOn()); 284 slotFullScreenToggled(m_aFullScreen->isOn());
283 } 285 }
284} 286}
285 287
286void PMainWindow::slotToggleFullScreen() 288void PMainWindow::slotToggleFullScreen()
287{ 289{
288 bool current = !m_aFullScreen->isOn(); 290 bool current = !m_aFullScreen->isOn();
289 m_aFullScreen->setOn(current); 291 m_aFullScreen->setOn(current);
290} 292}
291 293
292void PMainWindow::slotFullScreenButton(bool current) 294void PMainWindow::slotFullScreenButton(bool current)
293{ 295{
294 if (autoSave) { 296 if (autoSave) {
295 m_cfg->writeEntry("fullscreen",current); 297 m_cfg->writeEntry("fullscreen",current);
296 } 298 }
297 if (!m_disp) return; 299 if (!m_disp) return;
298 if (m_disp->isVisible()) { 300 if (m_disp->isVisible()) {
299 setupViewWindow(current, true); 301 setupViewWindow(current, true);
300 } 302 }
301} 303}
302 304
303void PMainWindow::setupViewWindow(bool current, bool forceDisplay) 305void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
304{ 306{
305 if (!m_disp) { 307 if (!m_disp) {
306 return; 308 return;
307 } 309 }
308 if (current) { 310 if (current) {
309 m_disp->setBackgroundColor(black); 311 m_disp->setBackgroundColor(black);
310 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); 312 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0));
311 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 313 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
312 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 314 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
313 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 315 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
314 m_disp->setFullScreen(current,forceDisplay); 316 m_disp->setFullScreen(current,forceDisplay);
315 } else { 317 } else {
316 setUpdatesEnabled(false); 318 setUpdatesEnabled(false);
317#if 0 319#if 0
318 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 320 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
319 321
320 //m_disp->setMinimumSize(QApplication::desktop()->size()/2); 322 //m_disp->setMinimumSize(QApplication::desktop()->size()/2);
321 } else { 323 } else {
322 //m_disp->setMinimumSize(10,10); 324 //m_disp->setMinimumSize(10,10);
323 } 325 }
324#endif 326#endif
325 m_disp->setBackgroundColor(white); 327 m_disp->setBackgroundColor(white);
326 m_stack->addWidget(m_disp,ImageDisplay); 328 m_stack->addWidget(m_disp,ImageDisplay);
327 m_disp->setVScrollBarMode(QScrollView::Auto); 329 m_disp->setVScrollBarMode(QScrollView::Auto);
328 m_disp->setHScrollBarMode(QScrollView::Auto); 330 m_disp->setHScrollBarMode(QScrollView::Auto);
329 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 331 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
330 m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); 332 m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60);
331 } 333 }
332 if (forceDisplay || m_disp->isVisible()) { 334 if (forceDisplay || m_disp->isVisible()) {
333 m_stack->raiseWidget(m_disp); 335 m_stack->raiseWidget(m_disp);
334 m_disp->setFocus(); 336 m_disp->setFocus();
335 } 337 }
336 setUpdatesEnabled(true); 338 setUpdatesEnabled(true);
337 } 339 }
338 m_disp->setFullScreen(current,forceDisplay); 340 m_disp->setFullScreen(current,forceDisplay);
339} 341}
340 342
341void PMainWindow::slotFullScreenToggled(bool current) 343void PMainWindow::slotFullScreenToggled(bool current)
342{ 344{
343 setupViewWindow(current,true); 345 setupViewWindow(current,true);
344} 346}
345 347
346/** 348/**
347 * With big Screen the plan could be to 'detach' the image 349 * With big Screen the plan could be to 'detach' the image
348 * window if visible and to create a ne wone 350 * window if visible and to create a ne wone
349 * init* already supports it but I make no use of it for 351 * init* already supports it but I make no use of it for
350 * now. We set filename and raise 352 * now. We set filename and raise
351 * 353 *
352 * ### FIXME and talk to alwin 354 * ### FIXME and talk to alwin
353 */ 355 */
354void PMainWindow::slotShowInfo( const QString& inf ) { 356void PMainWindow::slotShowInfo( const QString& inf ) {
355 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 357 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
356 return; 358 return;
357 } 359 }
358 if ( !m_info ) { 360 if ( !m_info ) {
359 initInfo(); 361 initInfo();
360 } 362 }
361 m_info->setPath( inf ); 363 m_info->setPath( inf );
362 if (m_SmallWindow) { 364 if (m_SmallWindow) {
363 m_aNext->removeFrom(toolBar); 365 m_aNext->removeFrom(toolBar);
364 m_aPrevious->removeFrom(toolBar); 366 m_aPrevious->removeFrom(toolBar);
365 fsButton->hide(); 367 fsButton->hide();
366 } 368 }
367 m_aNext->setEnabled(false); 369 m_aNext->setEnabled(false);
368 m_aPrevious->setEnabled(false); 370 m_aPrevious->setEnabled(false);
369 m_aDirUp->setEnabled(false); 371 m_aDirUp->setEnabled(false);
370 m_aShowInfo->setEnabled(false); 372 m_aShowInfo->setEnabled(false);
371 m_aViewfile->setEnabled(true); 373 m_aViewfile->setEnabled(true);
372 m_aStartSlide->setEnabled(false); 374 m_aStartSlide->setEnabled(false);
373 m_stack->raiseWidget( ImageInfo ); 375 m_stack->raiseWidget( ImageInfo );
374} 376}
375 377
376void PMainWindow::slotDisplay( const QString& inf ) { 378void PMainWindow::slotDisplay( const QString& inf ) {
377 bool nwindow = false; 379 bool nwindow = false;
378 if ( !m_disp ) { 380 if ( !m_disp ) {
379 nwindow = true; 381 nwindow = true;
380 initDisp(); 382 initDisp();
381 m_disp->setIntensity(m_Intensity); 383 m_disp->setIntensity(m_Intensity);
382 m_setCurrentBrightness->setEnabled(true); 384 m_setCurrentBrightness->setEnabled(true);
385 m_hBright->setEnabled(true);
383 } 386 }
384 m_disp->setImage( inf ); 387 m_disp->setImage( inf );
385 if (m_SmallWindow) { 388 if (m_SmallWindow) {
386 if (m_gPrevNext->isEnabled()==false) { 389 if (m_gPrevNext->isEnabled()==false) {
387 m_gPrevNext->addTo(toolBar); 390 m_gPrevNext->addTo(toolBar);
388 fsButton->hide(); 391 fsButton->hide();
389 } 392 }
390 } 393 }
391 m_gPrevNext->setEnabled(true); 394 m_gPrevNext->setEnabled(true);
392 m_aDirUp->setEnabled(false); 395 m_aDirUp->setEnabled(false);
393 m_aShowInfo->setEnabled(true); 396 m_aShowInfo->setEnabled(true);
394 m_aViewfile->setEnabled(false); 397 m_aViewfile->setEnabled(false);
395 m_aStartSlide->setEnabled(false); 398 m_aStartSlide->setEnabled(false);
396 399
397 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { 400 if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) {
398 slotFullScreenToggled(m_aFullScreen->isOn()); 401 slotFullScreenToggled(m_aFullScreen->isOn());
399 } 402 }
400 if (m_disp->fullScreen()) { 403 if (m_disp->fullScreen()) {
401 if (!m_disp->isVisible()) { 404 if (!m_disp->isVisible()) {
402 m_disp->showFullScreen(); 405 m_disp->showFullScreen();
403 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 406 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
404 } 407 }
405 } else { 408 } else {
406 m_stack->raiseWidget( ImageDisplay ); 409 m_stack->raiseWidget( ImageDisplay );
407 } 410 }
408} 411}
409 412
410void PMainWindow::raiseIconView() { 413void PMainWindow::raiseIconView() {
411 setUpdatesEnabled(false); 414 setUpdatesEnabled(false);
412 if (m_SmallWindow) { 415 if (m_SmallWindow) {
413 m_gPrevNext->removeFrom(toolBar); 416 m_gPrevNext->removeFrom(toolBar);
414 fsButton->show(); 417 fsButton->show();
415 } 418 }
416 m_gPrevNext->setEnabled(false); 419 m_gPrevNext->setEnabled(false);
417 m_aDirUp->setEnabled(true); 420 m_aDirUp->setEnabled(true);
418 m_aShowInfo->setEnabled(true); 421 m_aShowInfo->setEnabled(true);
419 m_aViewfile->setEnabled(true); 422 m_aViewfile->setEnabled(true);
420 m_aStartSlide->setEnabled(true); 423 m_aStartSlide->setEnabled(true);
421 424
422 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 425 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
423 m_disp->stopSlide(); 426 m_disp->stopSlide();
424 m_disp->hide(); 427 m_disp->hide();
425 } 428 }
426 m_stack->raiseWidget( IconView ); 429 m_stack->raiseWidget( IconView );
427 setUpdatesEnabled(true); 430 setUpdatesEnabled(true);
428 repaint(); 431 repaint();
429} 432}
430 433
431void PMainWindow::slotReturn() { 434void PMainWindow::slotReturn() {
432 raiseIconView(); 435 raiseIconView();
433} 436}
434 437
435 438
436void PMainWindow::closeEvent( QCloseEvent* ev ) { 439void PMainWindow::closeEvent( QCloseEvent* ev ) {
437 /* 440 /*
438 * return from view 441 * return from view
439 * or properly quit 442 * or properly quit
440 */ 443 */
441 if (!m_setDocCalled) { 444 if (!m_setDocCalled) {
442 if ( m_stack->visibleWidget() == m_info || 445 if ( m_stack->visibleWidget() == m_info ||
443 m_stack->visibleWidget() == m_disp ) { 446 m_stack->visibleWidget() == m_disp ) {
444 ev->ignore(); 447 ev->ignore();
445 raiseIconView(); 448 raiseIconView();
446 return; 449 return;
447 } 450 }
448 } 451 }
449 if (m_disp && m_disp->fullScreen()) { 452 if (m_disp && m_disp->fullScreen()) {
450 /* otherwise opie-eye crashes in bigscreen mode! */ 453 /* otherwise opie-eye crashes in bigscreen mode! */
451 m_disp->reparent(0,QPoint(0,0)); 454 m_disp->reparent(0,QPoint(0,0));
452 m_stack->addWidget(m_disp,ImageDisplay); 455 m_stack->addWidget(m_disp,ImageDisplay);
453 } 456 }
454 ev->accept(); 457 ev->accept();
455 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 458 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
456} 459}
457 460
458void PMainWindow::setDocument( const QString& showImg ) 461void PMainWindow::setDocument( const QString& showImg )
459{ 462{
460 QString file = showImg; 463 QString file = showImg;
461 DocLnk lnk(showImg); 464 DocLnk lnk(showImg);
462 if (lnk.isValid() ) 465 if (lnk.isValid() )
463 file = lnk.file(); 466 file = lnk.file();
464 slotDisplay( file ); 467 slotDisplay( file );
465#if 0 468#if 0
466 if (!m_polishDone) { 469 if (!m_polishDone) {
467 QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); 470 QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
468 } 471 }
469#endif 472#endif
470} 473}
471 474
472void PMainWindow::check_view_fullscreen() 475void PMainWindow::check_view_fullscreen()
473{ 476{
474 if (!m_view) return; 477 if (!m_view) return;
475 if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { 478 if (!m_view->hasFocus()&&m_aFullScreen->isOn()) {
476 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 479 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
477 } 480 }
478} 481}
479 482
480void PMainWindow::slotSelectDir(int id) 483void PMainWindow::slotSelectDir(int id)
481{ 484{
482 emit changeDir( m_dev[fsMenu->text(id )] ); 485 emit changeDir( m_dev[fsMenu->text(id )] );
483} 486}
484 487
485void PMainWindow::dirChanged() 488void PMainWindow::dirChanged()
486{ 489{
487 fsMenu->clear(); 490 fsMenu->clear();
488 m_dev.clear(); 491 m_dev.clear();
489 492
490 /* home dir, too */ 493 /* home dir, too */
491 QString f = getenv( "HOME" ); 494 QString f = getenv( "HOME" );
492 if (!f.isEmpty()) { 495 if (!f.isEmpty()) {
493 m_dev.insert("Home directory",f); 496 m_dev.insert("Home directory",f);
494 fsMenu->insertItem("Home directory"); 497 fsMenu->insertItem("Home directory");
495 } 498 }
496 const QList<FileSystem> &fs = m_storage->fileSystems(); 499 const QList<FileSystem> &fs = m_storage->fileSystems();
497 QListIterator<FileSystem> it(fs ); 500 QListIterator<FileSystem> it(fs );
498 for ( ; it.current(); ++it ) { 501 for ( ; it.current(); ++it ) {
499 const QString disk = (*it)->name(); 502 const QString disk = (*it)->name();
500 const QString path = (*it)->path(); 503 const QString path = (*it)->path();
501 m_dev.insert( disk, path ); 504 m_dev.insert( disk, path );
502 fsMenu->insertItem( disk ); 505 fsMenu->insertItem( disk );
503 } 506 }
504} 507}
505 508
506void PMainWindow::showToolbar(bool how) 509void PMainWindow::showToolbar(bool how)
507{ 510{
508 if (!how) toolBar->hide(); 511 if (!how) toolBar->hide();
509 else toolBar->show(); 512 else toolBar->show();
510 if (autoSave) { 513 if (autoSave) {
511 m_cfg->writeEntry("showtoolbar",how); 514 m_cfg->writeEntry("showtoolbar",how);
512 } 515 }
513} 516}
514 517
515void PMainWindow::setupActions() 518void PMainWindow::setupActions()
516{ 519{
517 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); 520 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
518 m_aDirUp->setToggleAction(false); 521 m_aDirUp->setToggleAction(false);
519 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); 522 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
520 523
521 if ( Ir::supported() ) { 524 if ( Ir::supported() ) {
522 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); 525 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true );
523 m_aBeam->setToggleAction(false); 526 m_aBeam->setToggleAction(false);
524 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); 527 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
525 } else { 528 } else {
526 m_aBeam = 0; 529 m_aBeam = 0;
527 } 530 }
528 531
529 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); 532 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true );
530 m_aShowInfo->setToggleAction(false); 533 m_aShowInfo->setToggleAction(false);
531 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); 534 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
532 535
533 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); 536 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true );
534 m_aTrash->setToggleAction(false); 537 m_aTrash->setToggleAction(false);
535 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); 538 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
536 539
537 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); 540 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true );
538 m_aViewfile->setToggleAction(false); 541 m_aViewfile->setToggleAction(false);
539 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); 542 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
540 543
541 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); 544 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true );
542 m_aStartSlide->setToggleAction(false); 545 m_aStartSlide->setToggleAction(false);
543 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); 546 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
544 547
545 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); 548 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true );
546 m_aHideToolbar->setOn (true); 549 m_aHideToolbar->setOn (true);
547 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); 550 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
548 551
549 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); 552 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true );
550 m_aSetup->setToggleAction(false); 553 m_aSetup->setToggleAction(false);
551 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); 554 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig()));
552 555
553 m_gListViewMode = new QActionGroup(this,"Select listmode",true); 556 m_gListViewMode = new QActionGroup(this,"Select listmode",true);
554 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); 557 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*)));
555 558
556 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); 559 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true );
557 m_aDirLong->setToggleAction(true); 560 m_aDirLong->setToggleAction(true);
558 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); 561 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true );
559 m_aDirShort->setToggleAction(true); 562 m_aDirShort->setToggleAction(true);
560 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); 563 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true );
561 m_aDirName->setToggleAction(true); 564 m_aDirName->setToggleAction(true);
562 int mode = m_cfg->readNumEntry("ListViewMode", 1); 565 int mode = m_cfg->readNumEntry("ListViewMode", 1);
563 if (mode < 1 || mode>3) mode = 1; 566 if (mode < 1 || mode>3) mode = 1;
564 switch (mode) { 567 switch (mode) {
565 case 3: 568 case 3:
566 m_aDirName->setOn(true); 569 m_aDirName->setOn(true);
567 break; 570 break;
568 case 2: 571 case 2:
569 m_aDirShort->setOn(true); 572 m_aDirShort->setOn(true);
570 break; 573 break;
571 case 1: 574 case 1:
572 default: 575 default:
573 m_aDirLong->setOn(true); 576 m_aDirLong->setOn(true);
574 } 577 }
575 m_gListViewMode->insert(m_aDirLong); 578 m_gListViewMode->insert(m_aDirLong);
576 m_gListViewMode->insert(m_aDirShort); 579 m_gListViewMode->insert(m_aDirShort);
577 m_gListViewMode->insert(m_aDirName); 580 m_gListViewMode->insert(m_aDirName);
578 581
579 m_gPrevNext = new QActionGroup(this,"imageprevnext",false); 582 m_gPrevNext = new QActionGroup(this,"imageprevnext",false);
580 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); 583 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true );
581 m_aNext->setToggleAction(false); 584 m_aNext->setToggleAction(false);
582 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); 585 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext()));
583 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); 586 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true );
584 m_aPrevious->setToggleAction(false); 587 m_aPrevious->setToggleAction(false);
585 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); 588 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
586 m_gPrevNext->insert(m_aPrevious); 589 m_gPrevNext->insert(m_aPrevious);
587 m_gPrevNext->insert(m_aNext); 590 m_gPrevNext->insert(m_aNext);
588 591
589 m_aFullScreen = new QAction( tr( "Show images fullscreen" ), 592 m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
590 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); 593 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
591 m_aFullScreen->setToggleAction(true); 594 m_aFullScreen->setToggleAction(true);
592 if (autoSave) { 595 if (autoSave) {
593 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false)); 596 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false));
594 } else { 597 } else {
595 m_aFullScreen->setOn(false); 598 m_aFullScreen->setOn(false);
596 } 599 }
597 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool))); 600 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool)));
598 601
599 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); 602 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
600 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); 603 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
601 m_aAutoRotate->setToggleAction(true); 604 m_aAutoRotate->setToggleAction(true);
602 605
603 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 606 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
604 m_aAutoRotate->setOn(true); 607 m_aAutoRotate->setOn(true);
605 } else { 608 } else {
606 m_aAutoRotate->setOn(false); 609 m_aAutoRotate->setOn(false);
607 } 610 }
608 if (autoSave) { 611 if (autoSave) {
609 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn())); 612 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn()));
610 } 613 }
611 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 614 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
612 615
613 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); 616 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
614 m_aUnscaled->setToggleAction(true); 617 m_aUnscaled->setToggleAction(true);
615 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 618 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
616 if (autoSave) { 619 if (autoSave) {
617 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); 620 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false));
618 } else { 621 } else {
619 m_aUnscaled->setOn(false); 622 m_aUnscaled->setOn(false);
620 } 623 }
621 624
622 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); 625 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
623 m_aZoomer->setToggleAction(true); 626 m_aZoomer->setToggleAction(true);
624 if (autoSave) { 627 if (autoSave) {
625 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); 628 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true));
626 } else { 629 } else {
627 m_aZoomer->setOn (true); 630 m_aZoomer->setOn (true);
628 } 631 }
629 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 632 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
630 m_gDisplayType->insert(m_aAutoRotate); 633 m_gDisplayType->insert(m_aAutoRotate);
631 m_gDisplayType->insert(m_aUnscaled); 634 m_gDisplayType->insert(m_aUnscaled);
632 m_gDisplayType->insert(m_aZoomer); 635 m_gDisplayType->insert(m_aZoomer);
633 636
634 m_hGroup = new QActionGroup(this,"actioncollection",false); 637 m_hGroup = new QActionGroup(this,"actioncollection",false);
635 m_hGroup->insert(m_aFullScreen); 638 m_hGroup->insert(m_aFullScreen);
636 639
637 if (!m_SmallWindow) { 640 if (!m_SmallWindow) {
638 m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); 641 m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true);
639 m_aForceSmall->setToggleAction(true); 642 m_aForceSmall->setToggleAction(true);
640 connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); 643 connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool)));
641 } else { 644 } else {
642 m_aForceSmall = 0; 645 m_aForceSmall = 0;
643 } 646 }
644 m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); 647 m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false);
645 connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); 648 connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness()));
649 m_IncBrightness = new QAction(tr("Increase brightness by 5"),Resource::loadIconSet( "up" ),0, 0, this, 0, false);
650 m_DecBrightness = new QAction(tr("Decrease brightness by 5"),Resource::loadIconSet( "down" ),0, 0, this, 0, false);
651 m_hBright = new QActionGroup(this,"actioncollection",false),
652 m_hBright->insert(m_IncBrightness);
653 m_hBright->insert(m_DecBrightness);
646} 654}
647 655
648void PMainWindow::setupBrightness() 656void PMainWindow::setupBrightness()
649{ 657{
650 if (!m_disp) { 658 if (!m_disp) {
651 return; 659 return;
652 } 660 }
653 int lb = m_disp->Intensity(); 661 int lb = m_disp->Intensity();
654 if (Valuebox(0,-255,255,lb,lb)) { 662 if (Valuebox(0,-100,100,lb,lb)) {
655 m_disp->setIntensity(lb,true); 663 m_disp->setIntensity(lb,true);
656 } 664 }
657} 665}
658 666
659void PMainWindow::setupToolbar() 667void PMainWindow::setupToolbar()
660{ 668{
661 toolBar = new QToolBar( this ); 669 toolBar = new QToolBar( this );
662 addToolBar(toolBar); 670 addToolBar(toolBar);
663 toolBar->setHorizontalStretchable( true ); 671 toolBar->setHorizontalStretchable( true );
664 setToolBarsMovable( false ); 672 setToolBarsMovable( false );
665 m_aDirUp->addTo( toolBar ); 673 m_aDirUp->addTo( toolBar );
666 674
667 fsButton = new PFileSystem( toolBar ); 675 fsButton = new PFileSystem( toolBar );
668 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 676 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
669 m_view, SLOT(slotChangeDir( const QString& ) ) ); 677 m_view, SLOT(slotChangeDir( const QString& ) ) );
670 connect( this, SIGNAL( changeDir( const QString& ) ), 678 connect( this, SIGNAL( changeDir( const QString& ) ),
671 m_view, SLOT(slotChangeDir( const QString& ) ) ); 679 m_view, SLOT(slotChangeDir( const QString& ) ) );
672 680
673 if (m_aBeam) { 681 if (m_aBeam) {
674 m_aBeam->addTo( toolBar ); 682 m_aBeam->addTo( toolBar );
675 } 683 }
676 m_aShowInfo->addTo(toolBar); 684 m_aShowInfo->addTo(toolBar);
677 m_aTrash->addTo(toolBar); 685 m_aTrash->addTo(toolBar);
678// m_aSetup->addTo(toolBar); 686// m_aSetup->addTo(toolBar);
679 687
680 m_gDisplayType->addTo(toolBar); 688 m_gDisplayType->addTo(toolBar);
681 689
682 if (!m_SmallWindow) { 690 if (!m_SmallWindow) {
683 m_gPrevNext->addTo(toolBar); 691 m_gPrevNext->addTo(toolBar);
684 } else { 692 } else {
685 m_gPrevNext->setEnabled(false); 693 m_gPrevNext->setEnabled(false);
686 } 694 }
687} 695}
688 696
689void PMainWindow::setupMenu() 697void PMainWindow::setupMenu()
690{ 698{
691 fileMenu = new QPopupMenu( menuBar() ); 699 fileMenu = new QPopupMenu( menuBar() );
692 menuBar()->insertItem( tr( "File" ), fileMenu ); 700 menuBar()->insertItem( tr( "File" ), fileMenu );
693 dispMenu = new QPopupMenu( menuBar() ); 701 dispMenu = new QPopupMenu( menuBar() );
694 menuBar()->insertItem( tr( "Show" ), dispMenu ); 702 menuBar()->insertItem( tr( "Show" ), dispMenu );
695 settingsMenu = new QPopupMenu( menuBar() ); 703 settingsMenu = new QPopupMenu( menuBar() );
696 menuBar()->insertItem( tr( "Settings" ), settingsMenu ); 704 menuBar()->insertItem( tr( "Settings" ), settingsMenu );
697 705
698 m_aViewfile->addTo(fileMenu); 706 m_aViewfile->addTo(fileMenu);
699 m_aShowInfo->addTo(fileMenu); 707 m_aShowInfo->addTo(fileMenu);
700 m_aStartSlide->addTo(fileMenu); 708 m_aStartSlide->addTo(fileMenu);
701 709
702 fileMenu->insertSeparator(); 710 fileMenu->insertSeparator();
703 m_aDirUp->addTo( fileMenu ); 711 m_aDirUp->addTo( fileMenu );
704 712
705 fsMenu = new QPopupMenu(fileMenu); 713 fsMenu = new QPopupMenu(fileMenu);
706 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); 714 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
707 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); 715 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
708 dirChanged(); 716 dirChanged();
709 717
710 if ( m_aBeam ) { 718 if ( m_aBeam ) {
711 fileMenu->insertSeparator(); 719 fileMenu->insertSeparator();
712 m_aBeam->addTo( fileMenu ); 720 m_aBeam->addTo( fileMenu );
713 } 721 }
714 fileMenu->insertSeparator(); 722 fileMenu->insertSeparator();
715 m_aTrash->addTo(fileMenu); 723 m_aTrash->addTo(fileMenu);
716 724
717 listviewMenu = new QPopupMenu(dispMenu); 725 listviewMenu = new QPopupMenu(dispMenu);
718 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); 726 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
719 m_gListViewMode->addTo(listviewMenu); 727 m_gListViewMode->addTo(listviewMenu);
720 dispMenu->insertSeparator(); 728 dispMenu->insertSeparator();
721 m_aFullScreen->addTo(dispMenu); 729 m_aFullScreen->addTo(dispMenu);
722 m_gDisplayType->addTo(dispMenu); 730 m_gDisplayType->addTo(dispMenu);
723 dispMenu->insertSeparator(); 731 dispMenu->insertSeparator();
724 m_gPrevNext->addTo(dispMenu); 732 m_gPrevNext->addTo(dispMenu);
725 m_setCurrentBrightness->addTo(dispMenu); 733 m_setCurrentBrightness->addTo(dispMenu);
726 m_setCurrentBrightness->setEnabled(false); 734 m_setCurrentBrightness->setEnabled(false);
735 dispMenu->insertSeparator();
736 m_hBright->addTo(dispMenu);
737 m_hBright->setEnabled(false);
738
727 if (m_aForceSmall) { 739 if (m_aForceSmall) {
728 dispMenu->insertSeparator(); 740 dispMenu->insertSeparator();
729 m_aForceSmall->addTo(dispMenu); 741 m_aForceSmall->addTo(dispMenu);
730 } 742 }
731 743
732 m_aSetup->addTo(settingsMenu); 744 m_aSetup->addTo(settingsMenu);
733 m_aHideToolbar->addTo(settingsMenu); 745 m_aHideToolbar->addTo(settingsMenu);
734} 746}
735 747
736void PMainWindow::listviewselected(QAction*which) 748void PMainWindow::listviewselected(QAction*which)
737{ 749{
738 if (!which || which->isOn()==false) return; 750 if (!which || which->isOn()==false) return;
739 int val = 1; 751 int val = 1;
740 752
741 if (which==m_aDirName) { 753 if (which==m_aDirName) {
742 val = 3; 754 val = 3;
743 } else if (which==m_aDirShort) { 755 } else if (which==m_aDirShort) {
744 val = 2; 756 val = 2;
745 } else if (which==m_aDirLong) { 757 } else if (which==m_aDirLong) {
746 val = 1; 758 val = 1;
747 } 759 }
748 emit changeListMode(val); 760 emit changeListMode(val);
749} 761}
750 762
751void PMainWindow::readConfig() 763void PMainWindow::readConfig()
752{ 764{
753 autoSave =m_cfg->readBoolEntry("savestatus",true); 765 autoSave =m_cfg->readBoolEntry("savestatus",true);
754 m_Intensity = m_cfg->readNumEntry("intensity",0); 766 m_Intensity = m_cfg->readNumEntry("intensity",0);
755} 767}
756 768
757void PMainWindow::polish() 769void PMainWindow::polish()
758{ 770{
759 if (m_disp) { 771 if (m_disp) {
760 odebug << "======================\n" 772 odebug << "======================\n"
761 << "Called via setdocument\n" 773 << "Called via setdocument\n"
762 << "======================" << oendl; 774 << "======================" << oendl;
763 m_setDocCalled = true; 775 m_setDocCalled = true;
764 m_view->setDoccalled(true); 776 m_view->setDoccalled(true);
765 m_disp->setCloseIfHide(true); 777 m_disp->setCloseIfHide(true);
766 } else { 778 } else {
767 m_setDocCalled = false; 779 m_setDocCalled = false;
768 m_view->setDoccalled(false); 780 m_view->setDoccalled(false);
769 } 781 }
770 m_polishDone = true; 782 m_polishDone = true;
771 QMainWindow::polish(); 783 QMainWindow::polish();
772 if (m_setDocCalled) { 784 if (m_setDocCalled) {
773 if (m_aFullScreen->isOn()) { 785 if (m_aFullScreen->isOn()) {
774 QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); 786 QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
775 } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 787 } else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
776 } 788 }
777 } 789 }
778} 790}
779 791
780void PMainWindow::slotForceSmall(bool how) 792void PMainWindow::slotForceSmall(bool how)
781{ 793{
782 odebug << "Disable separate windows: " << how << oendl; 794 odebug << "Disable separate windows: " << how << oendl;
783 if (m_stack) { 795 if (m_stack) {
784 if (how) { 796 if (how) {
785 m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); 797 m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen);
786 } else { 798 } else {
787 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 799 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
788 } 800 }
789 } 801 }
790 if (autoSave) { 802 if (autoSave) {
791 m_cfg->writeEntry("dontshowseperate",how); 803 m_cfg->writeEntry("dontshowseperate",how);
792 } 804 }
793} 805}
794 806
795bool PMainWindow::Valuebox(QWidget*parent,int min, int max, int current,int&store) 807bool PMainWindow::Valuebox(QWidget*parent,int min, int max, int current,int&store)
796{ 808{
797 QDialog dlg(parent,"brightnessbox",true); 809 QDialog dlg(parent,"brightnessbox",true);
798 QVBoxLayout * m_MainLayout; 810 QVBoxLayout * m_MainLayout;
799 QGridLayout * m_IntensityLayout; 811 QGridLayout * m_IntensityLayout;
800 QSpinBox * m_Intensity; 812 QSpinBox * m_Intensity;
801 QLabel * m_IntensityLabel; 813 QLabel * m_IntensityLabel;
802 814
803 m_MainLayout = new QVBoxLayout( &dlg, 11, 6, "m_MainLayout"); 815 m_MainLayout = new QVBoxLayout( &dlg, 11, 6, "m_MainLayout");
804 m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout"); 816 m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout");
805 m_Intensity = new QSpinBox( &dlg, "m_Intensity" ); 817 m_Intensity = new QSpinBox( &dlg, "m_Intensity" );
806 m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 818 m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
807 m_Intensity->setButtonSymbols( QSpinBox::PlusMinus ); 819 m_Intensity->setButtonSymbols( QSpinBox::PlusMinus );
808 m_Intensity->setMaxValue( max ); 820 m_Intensity->setMaxValue( max );
809 m_Intensity->setMinValue(min); 821 m_Intensity->setMinValue(min);
810 m_Intensity->setValue( current ); 822 m_Intensity->setValue( current );
811 m_IntensityLayout->addWidget( m_Intensity, 0, 1 ); 823 m_IntensityLayout->addWidget( m_Intensity, 0, 1 );
812 m_IntensityLabel = new QLabel( &dlg, "m_IntensityLabel" ); 824 m_IntensityLabel = new QLabel( &dlg, "m_IntensityLabel" );
813 m_IntensityLabel->setText(QObject::tr("Display brightness:")); 825 m_IntensityLabel->setText(QObject::tr("Display brightness:"));
814 m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 ); 826 m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 );
815 m_MainLayout->addLayout(m_IntensityLayout); 827 m_MainLayout->addLayout(m_IntensityLayout);
816 if (dlg.exec()) { 828 if (dlg.exec()) {
817 store = m_Intensity->value(); 829 store = m_Intensity->value();
818 return true; 830 return true;
819 } 831 }
820 return false; 832 return false;
821} 833}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 62b446b..c3b51f6 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -1,115 +1,116 @@
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 virtual void setupBrightness();
71 71
72private: 72private:
73 template<class T> void initT( const char* name, T**, int ); 73 template<class T> void initT( const char* name, T**, int );
74 void initInfo(); 74 void initInfo();
75 void initDisp(); 75 void initDisp();
76 void setupViewWindow(bool full, bool forceDisplay); 76 void setupViewWindow(bool full, bool forceDisplay);
77 77
78private: 78private:
79 Opie::Core::OConfig *m_cfg; 79 Opie::Core::OConfig *m_cfg;
80 Opie::Ui::OWidgetStack *m_stack; 80 Opie::Ui::OWidgetStack *m_stack;
81 PIconView* m_view; 81 PIconView* m_view;
82 imageinfo *m_info; 82 imageinfo *m_info;
83 ImageView *m_disp; 83 ImageView *m_disp;
84 bool autoSave:1; 84 bool autoSave:1;
85 bool m_setDocCalled:1; 85 bool m_setDocCalled:1;
86 bool m_polishDone:1; 86 bool m_polishDone:1;
87 bool m_SmallWindow:1; 87 bool m_SmallWindow:1;
88 int m_Intensity; 88 int m_Intensity;
89 QToolButton*fsButton; 89 QToolButton*fsButton;
90 QToolBar *toolBar; 90 QToolBar *toolBar;
91 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; 91 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu;
92 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;
93 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; 93 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong;
94 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; 94 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup,*m_hBright;
95 QAction *m_aNext,*m_aPrevious,*m_aFullScreen; 95 QAction *m_aNext,*m_aPrevious,*m_aFullScreen;
96 QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall,*m_setCurrentBrightness; 96 QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall,*m_setCurrentBrightness;
97 QAction *m_IncBrightness,*m_DecBrightness;
97 98
98 /* init funs */ 99 /* init funs */
99 void readConfig(); 100 void readConfig();
100 void setupActions(); 101 void setupActions();
101 void setupToolbar(); 102 void setupToolbar();
102 void setupMenu(); 103 void setupMenu();
103 /* for the device submenu - ToDo: Merge with the special button */ 104 /* for the device submenu - ToDo: Merge with the special button */
104 StorageInfo *m_storage; 105 StorageInfo *m_storage;
105 QMap<QString, QString> m_dev; 106 QMap<QString, QString> m_dev;
106 static bool Valuebox(QWidget*parent,int min, int max, int current,int&store); 107 static bool Valuebox(QWidget*parent,int min, int max, int current,int&store);
107 108
108private slots: 109private slots:
109 void slotConfig(); 110 void slotConfig();
110 void slotSelectDir(int); 111 void slotSelectDir(int);
111 void dirChanged(); 112 void dirChanged();
112 void slotForceSmall(bool); 113 void slotForceSmall(bool);
113}; 114};
114 115
115#endif 116#endif