Diffstat (limited to 'noncore/graphics/opie-eye/gui/imageview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 88a8bc6..5b34ca2 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -5,6 +5,8 @@ | |||
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> | ||
9 | #include <qpopupmenu.h> | ||
8 | 10 | ||
9 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
10 | 12 | ||
@@ -14,11 +16,13 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name | |||
14 | m_viewManager = 0; | 16 | m_viewManager = 0; |
15 | m_cfg = cfg; | 17 | m_cfg = cfg; |
16 | m_isFullScreen = false; | 18 | m_isFullScreen = false; |
19 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); | ||
17 | initKeys(); | 20 | initKeys(); |
18 | } | 21 | } |
19 | 22 | ||
20 | ImageView::~ImageView() | 23 | ImageView::~ImageView() |
21 | { | 24 | { |
25 | odebug << "Delete Imageview" << oendl; | ||
22 | if (m_viewManager) { | 26 | if (m_viewManager) { |
23 | delete m_viewManager; | 27 | delete m_viewManager; |
24 | } | 28 | } |
@@ -48,14 +52,24 @@ void ImageView::initKeys() | |||
48 | 52 | ||
49 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", | 53 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", |
50 | lst, false,this, "image_view_keys" ); | 54 | lst, false,this, "image_view_keys" ); |
55 | |||
51 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", | 56 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", |
52 | Resource::loadPixmap("1to1"), ViewInfo, | 57 | Resource::loadPixmap("1to1"), ViewInfo, |
53 | Opie::Core::OKeyPair(Qt::Key_I,0), | 58 | Opie::Core::OKeyPair(Qt::Key_I,0), |
54 | this, SLOT(slotShowImageInfo()))); | 59 | this, SLOT(slotShowImageInfo()))); |
55 | 60 | ||
61 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", | ||
62 | Resource::loadPixmap("rotate"), Autorotate, | ||
63 | Opie::Core::OKeyPair(Qt::Key_R,0), | ||
64 | this, SIGNAL(toggleAutorotate()))); | ||
65 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", | ||
66 | Resource::loadPixmap("1to1"), Autoscale, | ||
67 | Opie::Core::OKeyPair(Qt::Key_S,0), | ||
68 | this, SIGNAL(toggleAutoscale()))); | ||
69 | |||
56 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", | 70 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", |
57 | Resource::loadPixmap("forward"), ShowNext, | 71 | Resource::loadPixmap("forward"), ShowNext, |
58 | Opie::Core::OKeyPair(Qt::Key_N,0), | 72 | Opie::Core::OKeyPair(Qt::Key_Return,0), |
59 | this, SIGNAL(dispNext()))); | 73 | this, SIGNAL(dispNext()))); |
60 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", | 74 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", |
61 | Resource::loadPixmap("back"), ShowPrevious, | 75 | Resource::loadPixmap("back"), ShowPrevious, |
@@ -85,3 +99,33 @@ void ImageView::slotShowImageInfo() | |||
85 | { | 99 | { |
86 | emit dispImageInfo(m_lastName); | 100 | emit dispImageInfo(m_lastName); |
87 | } | 101 | } |
102 | |||
103 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | ||
104 | { | ||
105 | if (e->button()==1) { | ||
106 | return OImageScrollView::contentsMousePressEvent(e); | ||
107 | } | ||
108 | if (!fullScreen()) return; | ||
109 | #if 0 | ||
110 | // doesn't work right (repainting problems) | ||
111 | odebug << "Popup " << oendl; | ||
112 | QPopupMenu *m = new QPopupMenu(0); | ||
113 | if (!m) return; | ||
114 | m->insertItem(tr("Previous image"),ShowPrevious); | ||
115 | m->insertItem(tr("Next image"),ShowNext); | ||
116 | m->insertSeparator(); | ||
117 | m->insertItem(tr("Toggle fullscreen"),FullScreen); | ||
118 | m->insertItem(tr("Toggle autoscale"),Autoscale); | ||
119 | m->insertItem(tr("Toggle autorotate"),Autorotate); | ||
120 | m->insertItem(tr("Toggle thumbnail"),Zoomer); | ||
121 | m->setFocus(); | ||
122 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | ||
123 | delete m; | ||
124 | parentWidget()->showFullScreen(); | ||
125 | #endif | ||
126 | } | ||
127 | |||
128 | void ImageView::setFullScreen(bool how) | ||
129 | { | ||
130 | m_isFullScreen = how; | ||
131 | } | ||