summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-14 13:00:01 (UTC)
committer zecke <zecke>2004-04-14 13:00:01 (UTC)
commit842db6adb0116491d36d78607dfefa76a7e0eb5a (patch) (unidiff)
treeae50fa626e984bdc81a9235745d74fe04e67a9f1
parent4f78995cbb47f78e68eb40d9a86a6a0dcdc576eb (diff)
downloadopie-842db6adb0116491d36d78607dfefa76a7e0eb5a.zip
opie-842db6adb0116491d36d78607dfefa76a7e0eb5a.tar.gz
opie-842db6adb0116491d36d78607dfefa76a7e0eb5a.tar.bz2
Alwin thank you for beeing nice (#ifdef 0 #endif ) next time completely revert
just to piss me off :) Anyway now add the first version of the view button
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp9
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.cpp24
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.h23
3 files changed, 51 insertions, 5 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index f63b5a1..e5921d8 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,203 +1,202 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5#include "mainwindow.h" 5#include "mainwindow.h"
6 6
7#include "iconview.h" 7#include "iconview.h"
8#include "filesystem.h" 8#include "filesystem.h"
9#include "imageinfoui.h" 9#include "imageinfoui.h"
10#include "imageview.h" 10#include "imageview.h"
11#if 0
12#include "viewmodebutton.h" 11#include "viewmodebutton.h"
13#endif 12
14#include <iface/ifaceinfo.h> 13#include <iface/ifaceinfo.h>
15#include <iface/dirview.h> 14#include <iface/dirview.h>
16 15
17#include <opie2/odebug.h> 16#include <opie2/odebug.h>
18#include <opie2/owidgetstack.h> 17#include <opie2/owidgetstack.h>
19#include <opie2/oapplicationfactory.h> 18#include <opie2/oapplicationfactory.h>
20#include <opie2/otabwidget.h> 19#include <opie2/otabwidget.h>
21#include <opie2/okeyconfigwidget.h> 20#include <opie2/okeyconfigwidget.h>
22 21
23#include <qpe/resource.h> 22#include <qpe/resource.h>
24#include <qpe/config.h> 23#include <qpe/config.h>
25#include <qpe/ir.h> 24#include <qpe/ir.h>
26#include <qpe/applnk.h> 25#include <qpe/applnk.h>
27 26
28#include <qtoolbar.h> 27#include <qtoolbar.h>
29#include <qtoolbutton.h> 28#include <qtoolbutton.h>
30#include <qlayout.h> 29#include <qlayout.h>
31#include <qdialog.h> 30#include <qdialog.h>
32#include <qmap.h> 31#include <qmap.h>
33#include <qtimer.h> 32#include <qtimer.h>
34 33
35 34
36 35
37 36
38OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 37OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
39 38
40PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 39PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
41 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 40 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
42{ 41{
43 setCaption( QObject::tr("Opie Eye Caramba" ) ); 42 setCaption( QObject::tr("Opie Eye Caramba" ) );
44 m_cfg = new Opie::Core::OConfig("phunkview"); 43 m_cfg = new Opie::Core::OConfig("phunkview");
45 m_cfg->setGroup("Zecke_view" ); 44 m_cfg->setGroup("Zecke_view" );
46// qDebug( "Process-wide OApplication object @ %0x", oApp ); 45// qDebug( "Process-wide OApplication object @ %0x", oApp );
47 /* 46 /*
48 * Initialize ToolBar and IconView 47 * Initialize ToolBar and IconView
49 * And Connect Them 48 * And Connect Them
50 */ 49 */
51 QToolBar *bar = new QToolBar( this ); 50 QToolBar *bar = new QToolBar( this );
52 bar->setHorizontalStretchable( true ); 51 bar->setHorizontalStretchable( true );
53 setToolBarsMovable( false ); 52 setToolBarsMovable( false );
54 53
55 m_stack = new Opie::Ui::OWidgetStack( this ); 54 m_stack = new Opie::Ui::OWidgetStack( this );
56 setCentralWidget( m_stack ); 55 setCentralWidget( m_stack );
57 56
58 m_view = new PIconView( m_stack, m_cfg ); 57 m_view = new PIconView( m_stack, m_cfg );
59 m_stack->addWidget( m_view, IconView ); 58 m_stack->addWidget( m_view, IconView );
60 m_stack->raiseWidget( IconView ); 59 m_stack->raiseWidget( IconView );
61 connect(m_view, SIGNAL(sig_display(const QString&)), 60 connect(m_view, SIGNAL(sig_display(const QString&)),
62 this, SLOT(slotDisplay(const QString&))); 61 this, SLOT(slotDisplay(const QString&)));
63 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 62 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
64 this, SLOT(slotShowInfo(const QString&)) ); 63 this, SLOT(slotShowInfo(const QString&)) );
65 64
66 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 65 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
67 66
68 QToolButton *btn = new QToolButton( bar ); 67 QToolButton *btn = new QToolButton( bar );
69 btn->setIconSet( Resource::loadIconSet( "up" ) ); 68 btn->setIconSet( Resource::loadIconSet( "up" ) );
70 connect( btn, SIGNAL(clicked()), 69 connect( btn, SIGNAL(clicked()),
71 m_view, SLOT(slotDirUp()) ); 70 m_view, SLOT(slotDirUp()) );
72 71
73 btn = new PFileSystem( bar ); 72 btn = new PFileSystem( bar );
74 connect( btn, SIGNAL( changeDir( const QString& ) ), 73 connect( btn, SIGNAL( changeDir( const QString& ) ),
75 m_view, SLOT(slotChangeDir( const QString& ) ) ); 74 m_view, SLOT(slotChangeDir( const QString& ) ) );
76 75
77 btn = new QToolButton( bar ); 76 btn = new QToolButton( bar );
78 btn->setIconSet( Resource::loadIconSet( "edit" ) ); 77 btn->setIconSet( Resource::loadIconSet( "edit" ) );
79 connect( btn, SIGNAL(clicked()), 78 connect( btn, SIGNAL(clicked()),
80 m_view, SLOT(slotRename()) ); 79 m_view, SLOT(slotRename()) );
81 80
82 if ( Ir::supported() ) { 81 if ( Ir::supported() ) {
83 btn = new QToolButton( bar ); 82 btn = new QToolButton( bar );
84 btn->setIconSet( Resource::loadIconSet( "beam" ) ); 83 btn->setIconSet( Resource::loadIconSet( "beam" ) );
85 connect( btn, SIGNAL(clicked()), 84 connect( btn, SIGNAL(clicked()),
86 m_view, SLOT(slotBeam()) ); 85 m_view, SLOT(slotBeam()) );
87 } 86 }
88 87
89 btn = new QToolButton( bar ); 88 btn = new QToolButton( bar );
90 btn->setIconSet( Resource::loadIconSet( "trash" ) ); 89 btn->setIconSet( Resource::loadIconSet( "trash" ) );
91 connect( btn, SIGNAL(clicked() ), 90 connect( btn, SIGNAL(clicked() ),
92 m_view, SLOT(slotTrash() ) ); 91 m_view, SLOT(slotTrash() ) );
93 92
94#if 0 93
95 btn = new ViewModeButton( bar ); 94 btn = new ViewModeButton( bar );
96 connect( btn, SIGNAL(changeMode(int)), 95 connect( btn, SIGNAL(changeMode(int)),
97 m_view, SLOT(slotChangeMode(int))); 96 m_view, SLOT(slotChangeMode(int)));
98#endif 97
99 btn = new QToolButton( bar ); 98 btn = new QToolButton( bar );
100 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 99 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
101 connect( btn, SIGNAL(clicked() ), 100 connect( btn, SIGNAL(clicked() ),
102 this, SLOT(slotConfig() ) ); 101 this, SLOT(slotConfig() ) );
103 102
104 rotateButton = new QToolButton(bar); 103 rotateButton = new QToolButton(bar);
105 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); 104 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
106 rotateButton->setToggleButton(true); 105 rotateButton->setToggleButton(true);
107 106
108 odebug << "Mode = " << m_stack->mode() << oendl; 107 odebug << "Mode = " << m_stack->mode() << oendl;
109 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 108 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
110 rotateButton->setOn(true); 109 rotateButton->setOn(true);
111 autoRotate = true; 110 autoRotate = true;
112 } else { 111 } else {
113 rotateButton->setOn(false); 112 rotateButton->setOn(false);
114 autoRotate = false; 113 autoRotate = false;
115 } 114 }
116 115
117 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 116 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
118 117
119 btn = new QToolButton(bar); 118 btn = new QToolButton(bar);
120 btn->setIconSet( Resource::loadIconSet( "1to1" ) ); 119 btn->setIconSet( Resource::loadIconSet( "1to1" ) );
121 btn->setToggleButton(true); 120 btn->setToggleButton(true);
122 btn->setOn(false); 121 btn->setOn(false);
123 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 122 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
124 autoScale = true; 123 autoScale = true;
125 124
126 btn = new QToolButton(bar); 125 btn = new QToolButton(bar);
127 btn->setIconSet( Resource::loadIconSet( "mag" ) ); 126 btn->setIconSet( Resource::loadIconSet( "mag" ) );
128 btn->setToggleButton(true); 127 btn->setToggleButton(true);
129 btn->setOn(true); 128 btn->setOn(true);
130 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 129 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
131 zoomerOn = true; 130 zoomerOn = true;
132} 131}
133 132
134PMainWindow::~PMainWindow() { 133PMainWindow::~PMainWindow() {
135 odebug << "Shutting down" << oendl; 134 odebug << "Shutting down" << oendl;
136} 135}
137 136
138void PMainWindow::slotZoomerToggled(bool how) 137void PMainWindow::slotZoomerToggled(bool how)
139{ 138{
140 zoomerOn = how; 139 zoomerOn = how;
141 if (m_disp) { 140 if (m_disp) {
142 m_disp->setShowZoomer(zoomerOn); 141 m_disp->setShowZoomer(zoomerOn);
143 } 142 }
144} 143}
145 144
146void PMainWindow::slotRotateToggled(bool how) 145void PMainWindow::slotRotateToggled(bool how)
147{ 146{
148 autoRotate = how; 147 autoRotate = how;
149 if (m_disp) { 148 if (m_disp) {
150 m_disp->setAutoRotate(how); 149 m_disp->setAutoRotate(how);
151 } 150 }
152} 151}
153 152
154void PMainWindow::slotScaleToggled(bool how) 153void PMainWindow::slotScaleToggled(bool how)
155{ 154{
156 autoScale = !how; 155 autoScale = !how;
157 if (m_disp) { 156 if (m_disp) {
158 m_disp->setAutoScale(autoScale); 157 m_disp->setAutoScale(autoScale);
159 } 158 }
160 if (!autoScale && autoRotate) { 159 if (!autoScale && autoRotate) {
161 rotateButton->setOn(false); 160 rotateButton->setOn(false);
162 } 161 }
163 rotateButton->setEnabled(!how); 162 rotateButton->setEnabled(!how);
164} 163}
165 164
166void PMainWindow::slotConfig() { 165void PMainWindow::slotConfig() {
167 /* 166 /*
168 * have a tab with the possible views 167 * have a tab with the possible views
169 * a tab for globals image cache size.. scaled loading 168 * a tab for globals image cache size.. scaled loading
170 * and one tab for the KeyConfigs 169 * and one tab for the KeyConfigs
171 */ 170 */
172 QDialog dlg(this, 0, true); 171 QDialog dlg(this, 0, true);
173 dlg.setCaption( tr("Phunk View - Config" ) ); 172 dlg.setCaption( tr("Phunk View - Config" ) );
174 173
175 QHBoxLayout *lay = new QHBoxLayout(&dlg); 174 QHBoxLayout *lay = new QHBoxLayout(&dlg);
176 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 175 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
177 lay->addWidget( wid ); 176 lay->addWidget( wid );
178 ViewMap *vM = viewMap(); 177 ViewMap *vM = viewMap();
179 ViewMap::Iterator _it = vM->begin(); 178 ViewMap::Iterator _it = vM->begin();
180 QMap<PDirView*, QWidget*> lst; 179 QMap<PDirView*, QWidget*> lst;
181 180
182 for( ; _it != vM->end(); ++_it ) { 181 for( ; _it != vM->end(); ++_it ) {
183 PDirView *view = (_it.data())(*m_cfg); 182 PDirView *view = (_it.data())(*m_cfg);
184 PInterfaceInfo *inf = view->interfaceInfo(); 183 PInterfaceInfo *inf = view->interfaceInfo();
185 QWidget *_wid = inf->configWidget( *m_cfg ); 184 QWidget *_wid = inf->configWidget( *m_cfg );
186 _wid->reparent(wid, QPoint() ); 185 _wid->reparent(wid, QPoint() );
187 lst.insert( view, _wid ); 186 lst.insert( view, _wid );
188 wid->addTab( _wid, "fileopen", inf->name() ); 187 wid->addTab( _wid, "fileopen", inf->name() );
189 } 188 }
190 189
191/* 190/*
192 * Add the KeyConfigWidget 191 * Add the KeyConfigWidget
193 */ 192 */
194 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 193 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
195 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 194 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
196 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 195 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
197 196
198 if ( !m_info ) { 197 if ( !m_info ) {
199 initInfo(); 198 initInfo();
200 } 199 }
201 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 200 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
202 201
203 if ( !m_disp ) { 202 if ( !m_disp ) {
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
new file mode 100644
index 0000000..fdf4e77
--- a/dev/null
+++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
@@ -0,0 +1,24 @@
1#include "viewmodebutton.h"
2
3#include <qtoolbar.h>
4#include <qpopupmenu.h>
5
6ViewModeButton::ViewModeButton( QToolBar* bar )
7 : QToolButton( bar )
8{
9 setIconSet( Resource::loadIconSet( "toys" ) );
10 QPopupMenu *pop= new QPopupMenu( this );
11 pop->setCheckable( true );
12 pop->insertItem( tr("Thumbnail and Imageinfo"), 0 );
13 pop->insertItem( tr("Thumbnail and Name" ), 1 );
14 pop->insertItem( tr("Name Only" ), 2 );
15 connect(pop, SIGNAL(activated(int)),
16 this, SIGNAL(changeMode(int)) );
17
18
19 setPopup( pop );
20}
21
22ViewModeButton::~ViewModeButton() {
23
24}
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.h b/noncore/graphics/opie-eye/gui/viewmodebutton.h
new file mode 100644
index 0000000..44f2228
--- a/dev/null
+++ b/noncore/graphics/opie-eye/gui/viewmodebutton.h
@@ -0,0 +1,23 @@
1/*
2 * GPLv2 only
3 * zecke@handhelds.org
4 */
5
6#ifndef PHUNK_VIEW_MODE_BUTTON_H
7#define PHUNK_VIEW_MODE_BUTTON_H
8
9#include <qpe/resource.h>
10
11#include <qtoolbutton.h>
12
13class ViewModeButton : public QToolButton {
14 Q_OBJECT
15public:
16 ViewModeButton( QToolBar* );
17 ~ViewModeButton();
18
19signals:
20 void changeMode( int );
21};
22
23#endif