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.cpp | 37 |
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 | |||
@@ -26,27 +26,45 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name | |||
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 | ||
51 | void ImageView::slotIncBrightness() | ||
52 | { | ||
53 | int lb = Intensity()+5; | ||
54 | if (lb>100) lb=100; | ||
55 | setIntensity(lb,true); | ||
56 | } | ||
57 | |||
58 | void ImageView::slotDecBrightness() | ||
59 | { | ||
60 | int lb = Intensity()-5; | ||
61 | if (lb<-100) lb=-100; | ||
62 | setIntensity(lb,true); | ||
63 | } | ||
64 | |||
47 | void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) | 65 | void 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)" ) |
@@ -57,17 +75,18 @@ void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) | |||
57 | m_rotation = _newrotation; | 75 | m_rotation = _newrotation; |
58 | return; | 76 | return; |
59 | } | 77 | } |
60 | } | 78 | } |
61 | } | 79 | } |
62 | 80 | ||
63 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) | 81 | void 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 | ||
70 | ImageView::~ImageView() | 89 | ImageView::~ImageView() |
71 | { | 90 | { |
72 | odebug << "Destructor imageview" << oendl; | 91 | odebug << "Destructor imageview" << oendl; |
73 | delete m_viewManager; | 92 | delete m_viewManager; |
@@ -171,12 +190,21 @@ void ImageView::initKeys() | |||
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 | ||
181 | void ImageView::keyReleaseEvent(QKeyEvent * e) | 209 | void ImageView::keyReleaseEvent(QKeyEvent * e) |
182 | { | 210 | { |
@@ -220,24 +248,31 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) | |||
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 | ||
241 | void ImageView::setFullScreen(bool how,bool force) | 276 | void ImageView::setFullScreen(bool how,bool force) |
242 | { | 277 | { |
243 | m_isFullScreen = how; | 278 | m_isFullScreen = how; |