summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/imageview.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/imageview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp37
1 files changed, 36 insertions, 1 deletions
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
@@ -20,60 +20,79 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name
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();
@@ -165,24 +184,33 @@ void ImageView::initKeys()
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();
@@ -214,36 +242,43 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e)
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 {