-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 57 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.h | 23 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 16 |
3 files changed, 85 insertions, 11 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index 74a9ea4..039dfa3 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp | |||
@@ -13,33 +13,80 @@ | |||
13 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | 15 | ||
16 | #include <lib/slavemaster.h> | 16 | #include "lib/slavemaster.h" |
17 | #include <lib/imagecache.h> | 17 | #include "lib/imagecache.h" |
18 | |||
19 | #include <opie2/oconfig.h> | ||
20 | #include <opie2/oconfig.h> | ||
21 | #include <opie2/okeyconfigwidget.h> | ||
22 | #include <opie2/odebug.h> | ||
18 | 23 | ||
19 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
21 | 26 | ||
22 | static const int THUMBSIZE = 128; | 27 | static const int THUMBSIZE = 128; |
23 | 28 | ||
29 | using namespace Opie::Core; | ||
24 | 30 | ||
25 | imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) | 31 | imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) |
26 | : QWidget( parent, name, fl ) | 32 | : QWidget( parent, name, fl ) |
27 | { | 33 | { |
34 | m_viewManager = 0; | ||
28 | init(name); | 35 | init(name); |
36 | initKeys(); | ||
29 | } | 37 | } |
30 | 38 | ||
31 | imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) | 39 | imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) |
32 | : QWidget( parent, name, fl ),currentFile(_path) | 40 | : QWidget( parent, name, fl ),currentFile(_path) |
33 | { | 41 | { |
42 | m_viewManager = 0; | ||
34 | init(name); | 43 | init(name); |
44 | initKeys(); | ||
35 | slotChangeName(_path); | 45 | slotChangeName(_path); |
36 | } | 46 | } |
47 | |||
48 | Opie::Ui::OKeyConfigManager* imageinfo::manager() | ||
49 | { | ||
50 | if (!m_viewManager) { | ||
51 | initKeys(); | ||
52 | } | ||
53 | return m_viewManager; | ||
54 | } | ||
55 | |||
56 | void imageinfo::initKeys() | ||
57 | { | ||
58 | odebug << "init imageinfo keys" << oendl; | ||
59 | m_cfg = new Opie::Core::OConfig("phunkview"); | ||
60 | m_cfg->setGroup("Zecke_view" ); | ||
61 | Opie::Ui::OKeyPair::List lst; | ||
62 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); | ||
63 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); | ||
64 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); | ||
65 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); | ||
66 | // lst.append( Opie::Ui::OKeyPair::returnKey() ); | ||
67 | |||
68 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageinfo-KeyBoard-Config", | ||
69 | lst, false,this, "keyconfig name" ); | ||
70 | m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "view", | ||
71 | Resource::loadPixmap("1to1"), ViewItem, | ||
72 | Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), | ||
73 | this, SLOT(slotShowImage()))); | ||
74 | m_viewManager->load(); | ||
75 | m_viewManager->handleWidget( this ); | ||
76 | m_viewManager->handleWidget( TextView1 ); | ||
77 | } | ||
78 | |||
79 | void imageinfo::slotShowImage() | ||
80 | { | ||
81 | emit dispImage(currentFile); | ||
82 | } | ||
83 | |||
37 | void imageinfo::init(const char* name) { | 84 | void imageinfo::init(const char* name) { |
38 | { | 85 | { |
39 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 86 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
40 | } | 87 | } |
41 | if ( !name ) | 88 | if ( !name ) |
42 | setName( "imageinfo" ); | 89 | setName( "imageinfo" ); |
43 | resize( 289, 335 ); | 90 | resize( 289, 335 ); |
44 | setCaption( tr( "Image info" ) ); | 91 | setCaption( tr( "Image info" ) ); |
45 | imageinfoLayout = new QVBoxLayout( this ); | 92 | imageinfoLayout = new QVBoxLayout( this ); |
@@ -96,6 +143,10 @@ imageinfo::~imageinfo() | |||
96 | { | 143 | { |
97 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 144 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
98 | } | 145 | } |
146 | if (m_viewManager) { | ||
147 | m_viewManager->save(); | ||
148 | delete m_viewManager; | ||
149 | } | ||
99 | } | 150 | } |
100 | 151 | ||
101 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) | 152 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) |
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.h b/noncore/graphics/opie-eye/gui/imageinfoui.h index 300c92a..0a5e183 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.h +++ b/noncore/graphics/opie-eye/gui/imageinfoui.h | |||
@@ -12,9 +12,21 @@ class QFrame; | |||
12 | class QLabel; | 12 | class QLabel; |
13 | class QTextView; | 13 | class QTextView; |
14 | 14 | ||
15 | namespace Opie { | ||
16 | namespace Core { | ||
17 | class OConfig; | ||
18 | } | ||
19 | namespace Ui { | ||
20 | class OKeyConfigManager; | ||
21 | } | ||
22 | } | ||
23 | |||
15 | class imageinfo : public QWidget | 24 | class imageinfo : public QWidget |
16 | { | 25 | { |
17 | Q_OBJECT | 26 | Q_OBJECT |
27 | enum ActionIds { | ||
28 | ViewItem | ||
29 | }; | ||
18 | 30 | ||
19 | public: | 31 | public: |
20 | imageinfo( QWidget* parent = 0, const char* name = 0, WFlags fl =0); | 32 | imageinfo( QWidget* parent = 0, const char* name = 0, WFlags fl =0); |
@@ -22,9 +34,14 @@ public: | |||
22 | ~imageinfo(); | 34 | ~imageinfo(); |
23 | 35 | ||
24 | void setDestructiveClose(); | 36 | void setDestructiveClose(); |
37 | Opie::Ui::OKeyConfigManager* manager(); | ||
38 | |||
39 | signals: | ||
40 | void dispImage(const QString&); | ||
25 | 41 | ||
26 | public slots: | 42 | public slots: |
27 | void setPath( const QString& path ); | 43 | void setPath( const QString& path ); |
44 | void slotShowImage(); | ||
28 | 45 | ||
29 | private: | 46 | private: |
30 | void init(const char* name); | 47 | void init(const char* name); |
@@ -34,11 +51,13 @@ protected: | |||
34 | QLabel* fnameLabel; | 51 | QLabel* fnameLabel; |
35 | QFrame* Line1; | 52 | QFrame* Line1; |
36 | QTextView* TextView1; | 53 | QTextView* TextView1; |
37 | |||
38 | protected: | ||
39 | QVBoxLayout* imageinfoLayout; | 54 | QVBoxLayout* imageinfoLayout; |
40 | QString currentFile; | 55 | QString currentFile; |
41 | 56 | ||
57 | Opie::Core::OConfig * m_cfg; | ||
58 | Opie::Ui::OKeyConfigManager*m_viewManager; | ||
59 | void initKeys(); | ||
60 | |||
42 | protected slots: | 61 | protected slots: |
43 | virtual void slot_fullInfo(const QString&, const QString&); | 62 | virtual void slot_fullInfo(const QString&, const QString&); |
44 | virtual void slotThumbNail(const QString&, const QPixmap&); | 63 | virtual void slotThumbNail(const QString&, const QPixmap&); |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 88acd59..5e94f93 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <opie2/otabwidget.h> | 18 | #include <opie2/otabwidget.h> |
19 | #include <opie2/okeyconfigwidget.h> | 19 | #include <opie2/okeyconfigwidget.h> |
20 | 20 | ||
21 | |||
22 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
23 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
24 | #include <qpe/ir.h> | 23 | #include <qpe/ir.h> |
@@ -33,7 +32,7 @@ | |||
33 | 32 | ||
34 | 33 | ||
35 | 34 | ||
36 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> ) | 35 | OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
37 | 36 | ||
38 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 37 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
39 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 38 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
@@ -41,8 +40,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
41 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 40 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
42 | m_cfg = new Opie::Core::OConfig("phunkview"); | 41 | m_cfg = new Opie::Core::OConfig("phunkview"); |
43 | m_cfg->setGroup("Zecke_view" ); | 42 | m_cfg->setGroup("Zecke_view" ); |
44 | 43 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); | |
45 | |||
46 | /* | 44 | /* |
47 | * Initialize ToolBar and IconView | 45 | * Initialize ToolBar and IconView |
48 | * And Connect Them | 46 | * And Connect Them |
@@ -92,7 +90,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
92 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); | 90 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); |
93 | connect( btn, SIGNAL(clicked() ), | 91 | connect( btn, SIGNAL(clicked() ), |
94 | this, SLOT(slotConfig() ) ); | 92 | this, SLOT(slotConfig() ) ); |
95 | 93 | ||
96 | rotateButton = new QToolButton(bar); | 94 | rotateButton = new QToolButton(bar); |
97 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); | 95 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); |
98 | rotateButton->setToggleButton(true); | 96 | rotateButton->setToggleButton(true); |
@@ -164,6 +162,10 @@ void PMainWindow::slotConfig() { | |||
164 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | 162 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); |
165 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | 163 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); |
166 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | 164 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); |
165 | if ( !m_info ) { | ||
166 | initInfo(); | ||
167 | } | ||
168 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); | ||
167 | keyWid->load(); | 169 | keyWid->load(); |
168 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | 170 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); |
169 | 171 | ||
@@ -210,6 +212,7 @@ void PMainWindow::initT( const char* name, T** ptr, int id) { | |||
210 | } | 212 | } |
211 | void PMainWindow::initInfo() { | 213 | void PMainWindow::initInfo() { |
212 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 214 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
215 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | ||
213 | } | 216 | } |
214 | void PMainWindow::initDisp() { | 217 | void PMainWindow::initDisp() { |
215 | initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay ); | 218 | initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay ); |
@@ -229,8 +232,9 @@ void PMainWindow::initDisp() { | |||
229 | * ### FIXME and talk to alwin | 232 | * ### FIXME and talk to alwin |
230 | */ | 233 | */ |
231 | void PMainWindow::slotShowInfo( const QString& inf ) { | 234 | void PMainWindow::slotShowInfo( const QString& inf ) { |
232 | if ( !m_info ) | 235 | if ( !m_info ) { |
233 | initInfo(); | 236 | initInfo(); |
237 | } | ||
234 | m_info->setPath( inf ); | 238 | m_info->setPath( inf ); |
235 | m_stack->raiseWidget( ImageInfo ); | 239 | m_stack->raiseWidget( ImageInfo ); |
236 | } | 240 | } |