author | alwin <alwin> | 2004-10-31 16:31:04 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-31 16:31:04 (UTC) |
commit | 6d27de4d1d4ebce0acc9ab68037d7e9f3c1d3703 (patch) (unidiff) | |
tree | 793f8a0e448ff7944dab4ce5187d6e1b93daf416 /noncore/graphics | |
parent | 92fa51ae338d92b0df078f8283b31afdfcf4341a (diff) | |
download | opie-6d27de4d1d4ebce0acc9ab68037d7e9f3c1d3703.zip opie-6d27de4d1d4ebce0acc9ab68037d7e9f3c1d3703.tar.gz opie-6d27de4d1d4ebce0acc9ab68037d7e9f3c1d3703.tar.bz2 |
all toolbuttons etc. switched to QAction objects
menu mostly finished
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 45 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 442 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 21 |
4 files changed, 317 insertions, 196 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index a20c879..c7e48cb 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -1,37 +1,48 @@ | |||
1 | #include "imageview.h" | 1 | #include "imageview.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <opie2/oconfig.h> | 4 | #include <opie2/oconfig.h> |
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> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <qpopupmenu.h> | 9 | #include <qpopupmenu.h> |
10 | #include <qtimer.h> | 10 | #include <qtimer.h> |
11 | #include <qaction.h> | ||
11 | 12 | ||
12 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
13 | 14 | ||
14 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) | 15 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) |
15 | : Opie::MM::OImageScrollView(parent,name,fl) | 16 | : Opie::MM::OImageScrollView(parent,name,fl) |
16 | { | 17 | { |
17 | m_viewManager = 0; | 18 | m_viewManager = 0; |
18 | focus_in_count = 0; | 19 | focus_in_count = 0; |
19 | m_cfg = cfg; | 20 | m_cfg = cfg; |
20 | m_isFullScreen = false; | 21 | m_isFullScreen = false; |
21 | m_ignore_next_in = false; | 22 | m_ignore_next_in = false; |
22 | m_slideTimer = 0; | 23 | m_slideTimer = 0; |
23 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); | 24 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); |
24 | initKeys(); | 25 | initKeys(); |
25 | m_slideValue = 5; | 26 | m_slideValue = 5; |
27 | m_gDisplayType = 0; | ||
28 | m_gPrevNext = 0; | ||
29 | m_hGroup = 0; | ||
30 | } | ||
31 | |||
32 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) | ||
33 | { | ||
34 | m_gDisplayType = disptypeGroup; | ||
35 | m_gPrevNext = nextprevGroup; | ||
36 | m_hGroup = hGroup; | ||
26 | } | 37 | } |
27 | 38 | ||
28 | ImageView::~ImageView() | 39 | ImageView::~ImageView() |
29 | { | 40 | { |
30 | odebug << "Delete Imageview" << oendl; | 41 | odebug << "Delete Imageview" << oendl; |
31 | delete m_viewManager; | 42 | delete m_viewManager; |
32 | } | 43 | } |
33 | 44 | ||
34 | Opie::Core::OKeyConfigManager* ImageView::manager() | 45 | Opie::Core::OKeyConfigManager* ImageView::manager() |
35 | { | 46 | { |
36 | if (!m_viewManager) { | 47 | if (!m_viewManager) { |
37 | initKeys(); | 48 | initKeys(); |
@@ -40,24 +51,34 @@ Opie::Core::OKeyConfigManager* ImageView::manager() | |||
40 | } | 51 | } |
41 | 52 | ||
42 | void ImageView::startSlide(int value) | 53 | void ImageView::startSlide(int value) |
43 | { | 54 | { |
44 | if (!m_slideTimer) { | 55 | if (!m_slideTimer) { |
45 | m_slideTimer = new QTimer(this); | 56 | m_slideTimer = new QTimer(this); |
46 | } | 57 | } |
47 | m_slideValue=value; | 58 | m_slideValue=value; |
48 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); | 59 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); |
49 | m_slideTimer->start(m_slideValue*1000,true); | 60 | m_slideTimer->start(m_slideValue*1000,true); |
50 | } | 61 | } |
51 | 62 | ||
63 | void ImageView::stopSlide() | ||
64 | { | ||
65 | if (!m_slideTimer) { | ||
66 | return; | ||
67 | } | ||
68 | m_slideTimer->stop(); | ||
69 | delete m_slideTimer; | ||
70 | m_slideTimer = 0; | ||
71 | } | ||
72 | |||
52 | void ImageView::nextSlide() | 73 | void ImageView::nextSlide() |
53 | { | 74 | { |
54 | if (!m_slideTimer) { | 75 | if (!m_slideTimer) { |
55 | return; | 76 | return; |
56 | } | 77 | } |
57 | if (isHidden()) { | 78 | if (isHidden()) { |
58 | delete m_slideTimer; | 79 | delete m_slideTimer; |
59 | m_slideTimer = 0; | 80 | m_slideTimer = 0; |
60 | return; | 81 | return; |
61 | } | 82 | } |
62 | emit dispNext(); | 83 | emit dispNext(); |
63 | m_slideTimer->start(m_slideValue*1000,true); | 84 | m_slideTimer->start(m_slideValue*1000,true); |
@@ -133,36 +154,48 @@ void ImageView::slotShowImageInfo() | |||
133 | { | 154 | { |
134 | emit dispImageInfo(m_lastName); | 155 | emit dispImageInfo(m_lastName); |
135 | } | 156 | } |
136 | 157 | ||
137 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | 158 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) |
138 | { | 159 | { |
139 | if (e->button()==1) { | 160 | if (e->button()==1) { |
140 | return OImageScrollView::contentsMousePressEvent(e); | 161 | return OImageScrollView::contentsMousePressEvent(e); |
141 | } | 162 | } |
142 | odebug << "Popup " << oendl; | 163 | odebug << "Popup " << oendl; |
143 | QPopupMenu *m = new QPopupMenu(0); | 164 | QPopupMenu *m = new QPopupMenu(0); |
144 | if (!m) return; | 165 | if (!m) return; |
145 | m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); | 166 | if (m_hGroup) { |
167 | m_hGroup->addTo(m); | ||
168 | } | ||
146 | if (fullScreen()) { | 169 | if (fullScreen()) { |
170 | if (m_gPrevNext) { | ||
147 | m->insertSeparator(); | 171 | m->insertSeparator(); |
148 | m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); | 172 | m_gPrevNext->addTo(m); |
149 | m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); | 173 | } |
174 | if (m_gDisplayType) { | ||
150 | m->insertSeparator(); | 175 | m->insertSeparator(); |
151 | m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); | 176 | m_gDisplayType->addTo(m); |
152 | m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); | 177 | } |
153 | m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); | ||
154 | } | 178 | } |
155 | m->setFocus(); | 179 | m->setFocus(); |
156 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 180 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
181 | if (m_hGroup) { | ||
182 | m_hGroup->removeFrom(m); | ||
183 | } | ||
184 | if (m_gPrevNext) { | ||
185 | m_gPrevNext->removeFrom(m); | ||
186 | } | ||
187 | if (m_gDisplayType) { | ||
188 | m_gDisplayType->removeFrom(m); | ||
189 | } | ||
157 | delete m; | 190 | delete m; |
158 | } | 191 | } |
159 | 192 | ||
160 | void ImageView::setFullScreen(bool how) | 193 | void ImageView::setFullScreen(bool how) |
161 | { | 194 | { |
162 | m_isFullScreen = how; | 195 | m_isFullScreen = how; |
163 | if (how) { | 196 | if (how) { |
164 | m_ignore_next_in = true; | 197 | m_ignore_next_in = true; |
165 | setFixedSize(qApp->desktop()->size()); | 198 | setFixedSize(qApp->desktop()->size()); |
166 | showFullScreen(); | 199 | showFullScreen(); |
167 | } else { | 200 | } else { |
168 | setMinimumSize(10,10); | 201 | setMinimumSize(10,10); |
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index f0e6541..640905a 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -1,20 +1,22 @@ | |||
1 | #ifndef _IMAGE_VIEW_H | 1 | #ifndef _IMAGE_VIEW_H |
2 | #define _IMAGE_VIEW_H | 2 | #define _IMAGE_VIEW_H |
3 | 3 | ||
4 | #include <opie2/oimagescrollview.h> | 4 | #include <opie2/oimagescrollview.h> |
5 | 5 | ||
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | 7 | ||
8 | class QTimer; | 8 | class QTimer; |
9 | class QActionGroup; | ||
10 | class QAction; | ||
9 | 11 | ||
10 | namespace Opie { | 12 | namespace Opie { |
11 | namespace Core { | 13 | namespace Core { |
12 | class OConfig; | 14 | class OConfig; |
13 | class OKeyConfigManager; | 15 | class OKeyConfigManager; |
14 | } | 16 | } |
15 | } | 17 | } |
16 | 18 | ||
17 | class ImageView:public Opie::MM::OImageScrollView | 19 | class ImageView:public Opie::MM::OImageScrollView |
18 | { | 20 | { |
19 | Q_OBJECT | 21 | Q_OBJECT |
20 | 22 | ||
@@ -26,45 +28,48 @@ class ImageView:public Opie::MM::OImageScrollView | |||
26 | Zoomer, | 28 | Zoomer, |
27 | Autorotate, | 29 | Autorotate, |
28 | Autoscale | 30 | Autoscale |
29 | }; | 31 | }; |
30 | 32 | ||
31 | public: | 33 | public: |
32 | ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); | 34 | ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); |
33 | virtual ~ImageView(); | 35 | virtual ~ImageView(); |
34 | Opie::Core::OKeyConfigManager* manager(); | 36 | Opie::Core::OKeyConfigManager* manager(); |
35 | void setFullScreen(bool how); | 37 | void setFullScreen(bool how); |
36 | bool fullScreen(){return m_isFullScreen;} | 38 | bool fullScreen(){return m_isFullScreen;} |
37 | virtual void enableFullscreen(); | 39 | virtual void enableFullscreen(); |
40 | void stopSlide(); | ||
41 | void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); | ||
38 | 42 | ||
39 | signals: | 43 | signals: |
40 | void dispImageInfo(const QString&); | 44 | void dispImageInfo(const QString&); |
41 | void dispNext(); | 45 | void dispNext(); |
42 | void dispPrev(); | 46 | void dispPrev(); |
43 | void toggleFullScreen(); | 47 | void toggleFullScreen(); |
44 | void hideMe(); | 48 | void hideMe(); |
45 | void toggleZoomer(); | 49 | void toggleZoomer(); |
46 | void toggleAutoscale(); | 50 | void toggleAutoscale(); |
47 | void toggleAutorotate(); | 51 | void toggleAutorotate(); |
48 | 52 | ||
49 | protected: | 53 | protected: |
50 | Opie::Core::OConfig * m_cfg; | 54 | Opie::Core::OConfig * m_cfg; |
51 | Opie::Core::OKeyConfigManager*m_viewManager; | 55 | Opie::Core::OKeyConfigManager*m_viewManager; |
52 | void initKeys(); | 56 | void initKeys(); |
53 | bool m_isFullScreen:1; | 57 | bool m_isFullScreen:1; |
54 | bool m_ignore_next_in:1; | 58 | bool m_ignore_next_in:1; |
55 | int focus_in_count; | 59 | int focus_in_count; |
56 | QTimer*m_slideTimer; | 60 | QTimer*m_slideTimer; |
57 | int m_slideValue; | 61 | int m_slideValue; |
58 | virtual void focusInEvent ( QFocusEvent * ); | 62 | virtual void focusInEvent ( QFocusEvent * ); |
63 | QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; | ||
59 | 64 | ||
60 | public slots: | 65 | public slots: |
61 | virtual void hide(); | 66 | virtual void hide(); |
62 | virtual void startSlide(int); | 67 | virtual void startSlide(int); |
63 | virtual void nextSlide(); | 68 | virtual void nextSlide(); |
64 | 69 | ||
65 | protected slots: | 70 | protected slots: |
66 | virtual void slotShowImageInfo(); | 71 | virtual void slotShowImageInfo(); |
67 | virtual void keyReleaseEvent(QKeyEvent * e); | 72 | virtual void keyReleaseEvent(QKeyEvent * e); |
68 | virtual void contentsMousePressEvent ( QMouseEvent * e); | 73 | virtual void contentsMousePressEvent ( QMouseEvent * e); |
69 | }; | 74 | }; |
70 | 75 | ||
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index a1349a8..e714e84 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -40,232 +40,101 @@ OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | |||
40 | 40 | ||
41 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 41 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
42 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 42 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
43 | { | 43 | { |
44 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 44 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
45 | m_cfg = new Opie::Core::OConfig("phunkview"); | 45 | m_cfg = new Opie::Core::OConfig("phunkview"); |
46 | m_cfg->setGroup("Zecke_view" ); | 46 | m_cfg->setGroup("Zecke_view" ); |
47 | 47 | ||
48 | m_storage = new StorageInfo(); | 48 | m_storage = new StorageInfo(); |
49 | connect(m_storage, SIGNAL(disksChanged() ), | 49 | connect(m_storage, SIGNAL(disksChanged() ), |
50 | this, SLOT( dirChanged() ) ); | 50 | this, SLOT( dirChanged() ) ); |
51 | 51 | ||
52 | /* | ||
53 | * Initialize ToolBar and IconView | ||
54 | * And Connect Them | ||
55 | */ | ||
56 | toolBar = new QToolBar( this ); | ||
57 | menuBar = new QMenuBar( this ); | ||
58 | fileMenu = new QPopupMenu( menuBar ); | ||
59 | menuBar->insertItem( tr( "File" ), fileMenu ); | ||
60 | dispMenu = new QPopupMenu( menuBar ); | ||
61 | menuBar->insertItem( tr( "Show" ), dispMenu ); | ||
62 | |||
63 | addToolBar(toolBar); | ||
64 | toolBar->setHorizontalStretchable( true ); | ||
65 | setToolBarsMovable( false ); | ||
66 | |||
67 | m_stack = new Opie::Ui::OWidgetStack( this ); | 52 | m_stack = new Opie::Ui::OWidgetStack( this ); |
68 | setCentralWidget( m_stack ); | 53 | setCentralWidget( m_stack ); |
69 | 54 | ||
70 | m_view = new PIconView( m_stack, m_cfg ); | 55 | m_view = new PIconView( m_stack, m_cfg ); |
71 | m_stack->addWidget( m_view, IconView ); | 56 | m_stack->addWidget( m_view, IconView ); |
72 | m_stack->raiseWidget( IconView ); | 57 | m_stack->raiseWidget( IconView ); |
73 | 58 | ||
74 | connect(m_view, SIGNAL(sig_display(const QString&)), | 59 | connect(m_view, SIGNAL(sig_display(const QString&)), |
75 | this, SLOT(slotDisplay(const QString&))); | 60 | this, SLOT(slotDisplay(const QString&))); |
76 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), | 61 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), |
77 | this, SLOT(slotShowInfo(const QString&)) ); | 62 | this, SLOT(slotShowInfo(const QString&)) ); |
63 | connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); | ||
78 | 64 | ||
79 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 65 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
80 | 66 | ||
81 | m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), | 67 | listviewMenu = 0; |
82 | 0, 0, this, 0, true ); | 68 | /* setup menu and toolbar */ |
83 | m_aDirUp->setToggleAction(false); | 69 | setupActions(); |
84 | connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); | 70 | setupToolbar(); |
85 | m_aDirUp->addTo( toolBar ); | 71 | setupMenu(); |
86 | |||
87 | QToolButton*btn; | ||
88 | |||
89 | fsButton = new PFileSystem( toolBar ); | ||
90 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | ||
91 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | ||
92 | connect( this, SIGNAL( changeDir( const QString& ) ), | ||
93 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | ||
94 | |||
95 | m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), | ||
96 | 0, 0, this, 0, true ); | ||
97 | m_aShowInfo->setToggleAction(false); | ||
98 | connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); | ||
99 | m_aShowInfo->addTo( toolBar ); | ||
100 | |||
101 | if ( Ir::supported() ) { | ||
102 | m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ), | ||
103 | 0, 0, this, 0, true ); | ||
104 | m_aBeam->setToggleAction(false); | ||
105 | connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); | ||
106 | m_aBeam->addTo( toolBar ); | ||
107 | } | ||
108 | m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet( "trash" ), | ||
109 | 0, 0, this, 0, true ); | ||
110 | m_aTrash->setToggleAction(false); | ||
111 | connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); | ||
112 | m_aTrash->addTo( toolBar ); | ||
113 | |||
114 | m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet( "mag" ), | ||
115 | 0, 0, this, 0, true ); | ||
116 | m_aViewfile->setToggleAction(false); | ||
117 | connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); | ||
118 | |||
119 | m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet( "play" ), | ||
120 | 0, 0, this, 0, true ); | ||
121 | m_aStartSlide->setToggleAction(false); | ||
122 | |||
123 | connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); | ||
124 | |||
125 | |||
126 | int mode = m_cfg->readNumEntry("ListViewMode", 1); | ||
127 | if (mode < 1 || mode>3) mode = 1; | ||
128 | viewModeButton = new ViewModeButton( toolBar,mode ); | ||
129 | connect( viewModeButton, SIGNAL(changeMode(int)), | ||
130 | m_view, SLOT(slotChangeMode(int))); | ||
131 | |||
132 | btn = new QToolButton( toolBar ); | ||
133 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); | ||
134 | connect( btn, SIGNAL(clicked() ), | ||
135 | this, SLOT(slotConfig() ) ); | ||
136 | |||
137 | prevButton = new QToolButton(toolBar); | ||
138 | prevButton->setIconSet( Resource::loadIconSet( "back" ) ); | ||
139 | connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); | ||
140 | |||
141 | nextButton = new QToolButton(toolBar); | ||
142 | nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); | ||
143 | connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); | ||
144 | |||
145 | /* filemenu start */ | ||
146 | m_aViewfile->addTo(fileMenu); | ||
147 | m_aShowInfo->addTo(fileMenu); | ||
148 | m_aStartSlide->addTo(fileMenu); | ||
149 | |||
150 | fileMenu->insertSeparator(); | ||
151 | m_aDirUp->addTo( fileMenu ); | ||
152 | |||
153 | fsMenu = new QPopupMenu(fileMenu); | ||
154 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); | ||
155 | connect( fsMenu, SIGNAL( activated( int ) ), | ||
156 | this, SLOT(slotSelectDir( int ) ) ); | ||
157 | dirChanged(); | ||
158 | |||
159 | fileMenu->insertSeparator(); | ||
160 | if ( Ir::supported() ) { | ||
161 | m_aBeam->addTo( fileMenu ); | ||
162 | } | ||
163 | fileMenu->insertSeparator(); | ||
164 | m_aTrash->addTo( fileMenu ); | ||
165 | /* filemenu end */ | ||
166 | |||
167 | rotateButton = new QToolButton(toolBar); | ||
168 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); | ||
169 | rotateButton->setToggleButton(true); | ||
170 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | ||
171 | rotateButton->setOn(true); | ||
172 | autoRotate = true; | ||
173 | prevButton->hide(); | ||
174 | nextButton->hide(); | ||
175 | } else { | ||
176 | rotateButton->setOn(false); | ||
177 | autoRotate = false; | ||
178 | } | ||
179 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | ||
180 | |||
181 | scaleButton = new QToolButton(toolBar); | ||
182 | scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); | ||
183 | scaleButton->setToggleButton(true); | ||
184 | scaleButton->setOn(false); | ||
185 | connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | ||
186 | autoScale = true; | ||
187 | |||
188 | zoomButton = new QToolButton(toolBar); | ||
189 | zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); | ||
190 | zoomButton->setToggleButton(true); | ||
191 | zoomButton->setOn(true); | ||
192 | connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | ||
193 | zoomerOn = true; | ||
194 | |||
195 | /* showmenu */ | ||
196 | m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), | ||
197 | 0, 0, this, 0, true ); | ||
198 | m_aHideToolbar->setOn (true); | ||
199 | m_aHideToolbar->addTo(dispMenu); | ||
200 | connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); | ||
201 | /* showmenu end*/ | ||
202 | |||
203 | } | 72 | } |
204 | 73 | ||
205 | PMainWindow::~PMainWindow() { | 74 | PMainWindow::~PMainWindow() { |
206 | } | 75 | } |
207 | 76 | ||
208 | void PMainWindow::slotToggleZoomer() | 77 | void PMainWindow::slotToggleZoomer() |
209 | { | 78 | { |
210 | if (!m_disp) return; | 79 | if (!m_disp) return; |
211 | bool cur = zoomButton->isOn(); | 80 | bool cur = m_aZoomer->isOn(); |
212 | zoomButton->setOn(!cur); | 81 | m_aZoomer->setOn(!cur); |
213 | } | 82 | } |
214 | 83 | ||
215 | void PMainWindow::slotZoomerToggled(bool how) | 84 | void PMainWindow::slotZoomerToggled(bool how) |
216 | { | 85 | { |
217 | zoomerOn = how; | 86 | zoomerOn = how; |
218 | if (m_disp) { | 87 | if (m_disp) { |
219 | m_disp->setShowZoomer(zoomerOn); | 88 | m_disp->setShowZoomer(zoomerOn); |
220 | } | 89 | } |
221 | } | 90 | } |
222 | 91 | ||
223 | void PMainWindow::slotToggleAutorotate() | 92 | void PMainWindow::slotToggleAutorotate() |
224 | { | 93 | { |
225 | if (!m_disp) return; | 94 | if (!m_disp) return; |
226 | if (!rotateButton->isEnabled()) return; | 95 | if (!m_aAutoRotate->isEnabled()) return; |
227 | bool cur = rotateButton->isOn(); | 96 | bool cur = m_aAutoRotate->isOn(); |
228 | rotateButton->setOn(!cur); | 97 | m_aAutoRotate->setOn(!cur); |
229 | } | 98 | } |
230 | 99 | ||
231 | void PMainWindow::slotToggleAutoscale() | 100 | void PMainWindow::slotToggleAutoscale() |
232 | { | 101 | { |
233 | if (!m_disp) return; | 102 | if (!m_disp) return; |
234 | bool cur = scaleButton->isOn(); | 103 | bool cur = m_aAutoScale->isOn(); |
235 | scaleButton->setOn(!cur); | 104 | m_aAutoScale->setOn(!cur); |
236 | } | 105 | } |
237 | 106 | ||
238 | void PMainWindow::slotRotateToggled(bool how) | 107 | void PMainWindow::slotRotateToggled(bool how) |
239 | { | 108 | { |
240 | odebug << "Autorotate: " << how << oendl; | 109 | odebug << "Autorotate: " << how << oendl; |
241 | autoRotate = how; | 110 | autoRotate = how; |
242 | if (m_disp) { | 111 | if (m_disp) { |
243 | m_disp->setAutoScaleRotate(autoScale,autoRotate); | 112 | m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); |
244 | } | 113 | } |
245 | } | 114 | } |
246 | 115 | ||
247 | void PMainWindow::slotScaleToggled(bool how) | 116 | void PMainWindow::slotScaleToggled(bool how) |
248 | { | 117 | { |
249 | autoScale = !how; | 118 | autoScale = !how; |
250 | if (!how) { | 119 | if (!how) { |
251 | autoRotate = how; | 120 | autoRotate = how; |
252 | } | 121 | } |
253 | if (m_disp) { | ||
254 | m_disp->setAutoScaleRotate(autoScale,autoRotate); | ||
255 | } | ||
256 | if (!autoScale) { | 122 | if (!autoScale) { |
257 | rotateButton->setOn(false); | 123 | m_aAutoRotate->setOn(false); |
258 | } | 124 | } |
259 | rotateButton->setEnabled(!how); | 125 | if (m_disp) { |
126 | m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); | ||
127 | } | ||
128 | m_aAutoRotate->setEnabled(!how); | ||
260 | } | 129 | } |
261 | 130 | ||
262 | void PMainWindow::slotConfig() { | 131 | void PMainWindow::slotConfig() { |
263 | /* | 132 | /* |
264 | * have a tab with the possible views | 133 | * have a tab with the possible views |
265 | * a tab for globals image cache size.. scaled loading | 134 | * a tab for globals image cache size.. scaled loading |
266 | * and one tab for the KeyConfigs | 135 | * and one tab for the KeyConfigs |
267 | */ | 136 | */ |
268 | QDialog dlg(this, 0, true); | 137 | QDialog dlg(this, 0, true); |
269 | dlg.setCaption( tr("Phunk View - Config" ) ); | 138 | dlg.setCaption( tr("Phunk View - Config" ) ); |
270 | 139 | ||
271 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 140 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
@@ -351,60 +220,65 @@ void PMainWindow::initT( const char* name, T** ptr, int id) { | |||
351 | 220 | ||
352 | } | 221 | } |
353 | void PMainWindow::initInfo() { | 222 | void PMainWindow::initInfo() { |
354 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 223 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
355 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 224 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
356 | } | 225 | } |
357 | void PMainWindow::initDisp() { | 226 | void PMainWindow::initDisp() { |
358 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 227 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
359 | if (m_disp) { | 228 | if (m_disp) { |
360 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 229 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
361 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 230 | m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
362 | } | 231 | } |
363 | m_disp->setAutoScale(autoScale); | 232 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); |
364 | m_disp->setAutoRotate(autoRotate); | 233 | m_disp->setAutoScale(!m_aAutoScale->isOn()); |
365 | m_disp->setShowZoomer(zoomerOn); | 234 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
235 | m_disp->setShowZoomer(m_aZoomer->isOn()); | ||
366 | m_disp->setBackgroundColor(white); | 236 | m_disp->setBackgroundColor(white); |
367 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 237 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
368 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 238 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
369 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 239 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
370 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 240 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
371 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 241 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
372 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 242 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
373 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 243 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
374 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 244 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
375 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); | 245 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); |
246 | slotFullScreenToggled(m_aFullScreen->isOn()); | ||
376 | } | 247 | } |
377 | } | 248 | } |
378 | 249 | ||
379 | void PMainWindow::slotToggleFullScreen() | 250 | void PMainWindow::slotToggleFullScreen() |
380 | { | 251 | { |
381 | odebug << "Toggle full " << oendl; | 252 | odebug << "Toggle full " << oendl; |
253 | bool current = !m_aFullScreen->isOn(); | ||
254 | m_aFullScreen->setOn(current); | ||
255 | } | ||
256 | |||
257 | void PMainWindow::slotFullScreenToggled(bool current) | ||
258 | { | ||
259 | odebug << "slotFullScreenToggled " << current << oendl; | ||
382 | if (!m_disp) return; | 260 | if (!m_disp) return; |
383 | bool current = !m_disp->fullScreen(); | ||
384 | odebug << "Current = " << current << oendl; | ||
385 | if (current) { | 261 | if (current) { |
386 | odebug << "full" << oendl; | 262 | odebug << "full" << oendl; |
387 | m_disp->setBackgroundColor(black); | 263 | m_disp->setBackgroundColor(black); |
388 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 264 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); |
389 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 265 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
390 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 266 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
391 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 267 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
392 | //m_disp->showFullScreen(); | ||
393 | //qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | ||
394 | } else { | 268 | } else { |
395 | setUpdatesEnabled(false); | 269 | setUpdatesEnabled(false); |
396 | odebug << "window" << oendl; | 270 | odebug << "window" << oendl; |
271 | m_disp->setMinimumSize(10,10); | ||
397 | m_disp->reparent(0,QPoint(0,0)); | 272 | m_disp->reparent(0,QPoint(0,0)); |
398 | m_disp->showNormal(); | ||
399 | m_disp->setBackgroundColor(white); | 273 | m_disp->setBackgroundColor(white); |
400 | m_stack->addWidget(m_disp,ImageDisplay); | 274 | m_stack->addWidget(m_disp,ImageDisplay); |
401 | m_disp->setVScrollBarMode(QScrollView::Auto); | 275 | m_disp->setVScrollBarMode(QScrollView::Auto); |
402 | m_disp->setHScrollBarMode(QScrollView::Auto); | 276 | m_disp->setHScrollBarMode(QScrollView::Auto); |
403 | m_stack->raiseWidget(m_disp); | 277 | m_stack->raiseWidget(m_disp); |
404 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 278 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
405 | m_disp->resize(m_disp->minimumSize()); | 279 | m_disp->resize(m_disp->minimumSize()); |
406 | } | 280 | } |
407 | setUpdatesEnabled(true); | 281 | setUpdatesEnabled(true); |
408 | } | 282 | } |
409 | m_disp->setFullScreen(current); | 283 | m_disp->setFullScreen(current); |
410 | } | 284 | } |
@@ -417,60 +291,83 @@ void PMainWindow::slotToggleFullScreen() | |||
417 | * | 291 | * |
418 | * ### FIXME and talk to alwin | 292 | * ### FIXME and talk to alwin |
419 | */ | 293 | */ |
420 | void PMainWindow::slotShowInfo( const QString& inf ) { | 294 | void PMainWindow::slotShowInfo( const QString& inf ) { |
421 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 295 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
422 | return; | 296 | return; |
423 | } | 297 | } |
424 | if ( !m_info ) { | 298 | if ( !m_info ) { |
425 | initInfo(); | 299 | initInfo(); |
426 | } | 300 | } |
427 | m_info->setPath( inf ); | 301 | m_info->setPath( inf ); |
428 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 302 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
429 | prevButton->hide(); | 303 | m_aNext->removeFrom(toolBar); |
430 | nextButton->hide(); | 304 | m_aPrevious->removeFrom(toolBar); |
305 | m_aNext->setEnabled(false); | ||
306 | m_aPrevious->setEnabled(false); | ||
431 | m_aDirUp->setEnabled(false); | 307 | m_aDirUp->setEnabled(false); |
432 | m_aShowInfo->setEnabled(false); | 308 | m_aShowInfo->setEnabled(false); |
433 | m_aViewfile->setEnabled(true); | 309 | m_aViewfile->setEnabled(true); |
434 | m_aStartSlide->setEnabled(false); | 310 | m_aStartSlide->setEnabled(false); |
435 | fsButton->hide(); | 311 | fsButton->hide(); |
436 | viewModeButton->hide(); | ||
437 | } | 312 | } |
438 | m_stack->raiseWidget( ImageInfo ); | 313 | m_stack->raiseWidget( ImageInfo ); |
439 | } | 314 | } |
440 | 315 | ||
441 | void PMainWindow::slotDisplay( const QString& inf ) { | 316 | void PMainWindow::slotDisplay( const QString& inf ) { |
442 | odebug << "slotDisplay: " << inf << oendl; | 317 | odebug << "slotDisplay: " << inf << oendl; |
443 | if ( !m_disp ) { | 318 | if ( !m_disp ) { |
444 | initDisp(); | 319 | initDisp(); |
445 | } | 320 | } |
446 | m_disp->setImage( inf ); | 321 | m_disp->setImage( inf ); |
447 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 322 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
448 | prevButton->show(); | 323 | if (m_gPrevNext->isEnabled()==false) { |
449 | nextButton->show(); | 324 | m_gPrevNext->addTo(toolBar); |
325 | m_gPrevNext->setEnabled(true); | ||
326 | |||
450 | m_aDirUp->setEnabled(false); | 327 | m_aDirUp->setEnabled(false); |
451 | m_aShowInfo->setEnabled(true); | 328 | m_aShowInfo->setEnabled(true); |
452 | m_aViewfile->setEnabled(false); | 329 | m_aViewfile->setEnabled(false); |
453 | m_aStartSlide->setEnabled(false); | 330 | m_aStartSlide->setEnabled(false); |
454 | fsButton->hide(); | 331 | fsButton->hide(); |
455 | viewModeButton->hide(); | 332 | } |
456 | } | 333 | } |
457 | if (m_disp->fullScreen()) { | 334 | if (m_disp->fullScreen()) { |
458 | //m_disp->showFullScreen(); | 335 | //m_disp->showFullScreen(); |
459 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 336 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
460 | } else { | 337 | } else { |
461 | m_stack->raiseWidget( ImageDisplay ); | 338 | m_stack->raiseWidget( ImageDisplay ); |
462 | } | 339 | } |
463 | } | 340 | } |
464 | 341 | ||
342 | void PMainWindow::raiseIconView() { | ||
343 | setUpdatesEnabled(false); | ||
344 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | ||
345 | m_gPrevNext->removeFrom(toolBar); | ||
346 | m_gPrevNext->setEnabled(false); | ||
347 | m_aDirUp->setEnabled(true); | ||
348 | m_aShowInfo->setEnabled(true); | ||
349 | m_aViewfile->setEnabled(true); | ||
350 | m_aStartSlide->setEnabled(true); | ||
351 | fsButton->show(); | ||
352 | } | ||
353 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | ||
354 | m_disp->stopSlide(); | ||
355 | m_disp->hide(); | ||
356 | } | ||
357 | m_stack->raiseWidget( IconView ); | ||
358 | setUpdatesEnabled(true); | ||
359 | repaint(); | ||
360 | } | ||
361 | |||
465 | void PMainWindow::slotReturn() { | 362 | void PMainWindow::slotReturn() { |
466 | raiseIconView(); | 363 | raiseIconView(); |
467 | } | 364 | } |
468 | 365 | ||
469 | 366 | ||
470 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 367 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
471 | /* | 368 | /* |
472 | * return from view | 369 | * return from view |
473 | * or properly quit | 370 | * or properly quit |
474 | */ | 371 | */ |
475 | if ( m_stack->visibleWidget() == m_info || | 372 | if ( m_stack->visibleWidget() == m_info || |
476 | m_stack->visibleWidget() == m_disp ) { | 373 | m_stack->visibleWidget() == m_disp ) { |
@@ -478,44 +375,24 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { | |||
478 | raiseIconView(); | 375 | raiseIconView(); |
479 | return; | 376 | return; |
480 | } | 377 | } |
481 | if (m_disp && m_disp->fullScreen()) { | 378 | if (m_disp && m_disp->fullScreen()) { |
482 | /* otherwise opie-eye crashes in bigscreen mode! */ | 379 | /* otherwise opie-eye crashes in bigscreen mode! */ |
483 | m_disp->reparent(0,QPoint(0,0)); | 380 | m_disp->reparent(0,QPoint(0,0)); |
484 | m_stack->addWidget(m_disp,ImageDisplay); | 381 | m_stack->addWidget(m_disp,ImageDisplay); |
485 | } | 382 | } |
486 | ev->accept(); | 383 | ev->accept(); |
487 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 384 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
488 | } | 385 | } |
489 | 386 | ||
490 | void PMainWindow::raiseIconView() { | ||
491 | setUpdatesEnabled(false); | ||
492 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | ||
493 | prevButton->hide(); | ||
494 | nextButton->hide(); | ||
495 | m_aDirUp->setEnabled(true); | ||
496 | m_aShowInfo->setEnabled(true); | ||
497 | m_aViewfile->setEnabled(true); | ||
498 | m_aStartSlide->setEnabled(true); | ||
499 | fsButton->show(); | ||
500 | viewModeButton->show(); | ||
501 | } | ||
502 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | ||
503 | m_disp->hide(); | ||
504 | } | ||
505 | m_stack->raiseWidget( IconView ); | ||
506 | setUpdatesEnabled(true); | ||
507 | repaint(); | ||
508 | } | ||
509 | |||
510 | void PMainWindow::setDocument( const QString& showImg ) { | 387 | void PMainWindow::setDocument( const QString& showImg ) { |
511 | QString file = showImg; | 388 | QString file = showImg; |
512 | DocLnk lnk(showImg); | 389 | DocLnk lnk(showImg); |
513 | if (lnk.isValid() ) | 390 | if (lnk.isValid() ) |
514 | file = lnk.file(); | 391 | file = lnk.file(); |
515 | 392 | ||
516 | slotDisplay( file ); | 393 | slotDisplay( file ); |
517 | } | 394 | } |
518 | 395 | ||
519 | void PMainWindow::slotSelectDir(int id) | 396 | void PMainWindow::slotSelectDir(int id) |
520 | { | 397 | { |
521 | emit changeDir( m_dev[fsMenu->text(id )] ); | 398 | emit changeDir( m_dev[fsMenu->text(id )] ); |
@@ -538,12 +415,209 @@ void PMainWindow::dirChanged() | |||
538 | const QString disk = (*it)->name(); | 415 | const QString disk = (*it)->name(); |
539 | const QString path = (*it)->path(); | 416 | const QString path = (*it)->path(); |
540 | m_dev.insert( disk, path ); | 417 | m_dev.insert( disk, path ); |
541 | fsMenu->insertItem( disk ); | 418 | fsMenu->insertItem( disk ); |
542 | } | 419 | } |
543 | } | 420 | } |
544 | 421 | ||
545 | void PMainWindow::showToolbar(bool how) | 422 | void PMainWindow::showToolbar(bool how) |
546 | { | 423 | { |
547 | if (!how) toolBar->hide(); | 424 | if (!how) toolBar->hide(); |
548 | else toolBar->show(); | 425 | else toolBar->show(); |
549 | } \ No newline at end of file | 426 | } \ No newline at end of file |
427 | |||
428 | void PMainWindow::setupActions() | ||
429 | { | ||
430 | m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); | ||
431 | m_aDirUp->setToggleAction(false); | ||
432 | connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); | ||
433 | |||
434 | if ( Ir::supported() ) { | ||
435 | m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); | ||
436 | m_aBeam->setToggleAction(false); | ||
437 | connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); | ||
438 | } else { | ||
439 | m_aBeam = 0; | ||
440 | } | ||
441 | |||
442 | m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); | ||
443 | m_aShowInfo->setToggleAction(false); | ||
444 | connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); | ||
445 | |||
446 | m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); | ||
447 | m_aTrash->setToggleAction(false); | ||
448 | connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); | ||
449 | |||
450 | m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); | ||
451 | m_aViewfile->setToggleAction(false); | ||
452 | connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); | ||
453 | |||
454 | m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); | ||
455 | m_aStartSlide->setToggleAction(false); | ||
456 | connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); | ||
457 | |||
458 | m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); | ||
459 | m_aHideToolbar->setOn (true); | ||
460 | connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); | ||
461 | |||
462 | m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); | ||
463 | m_aSetup->setToggleAction(false); | ||
464 | connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); | ||
465 | |||
466 | m_gListViewMode = new QActionGroup(this,"Select listmode",true); | ||
467 | connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); | ||
468 | |||
469 | m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); | ||
470 | m_aDirLong->setToggleAction(true); | ||
471 | m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); | ||
472 | m_aDirShort->setToggleAction(true); | ||
473 | m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); | ||
474 | m_aDirName->setToggleAction(true); | ||
475 | int mode = m_cfg->readNumEntry("ListViewMode", 1); | ||
476 | if (mode < 1 || mode>3) mode = 1; | ||
477 | switch (mode) { | ||
478 | case 3: | ||
479 | m_aDirName->setOn(true); | ||
480 | break; | ||
481 | case 2: | ||
482 | m_aDirShort->setOn(true); | ||
483 | break; | ||
484 | case 1: | ||
485 | default: | ||
486 | m_aDirLong->setOn(true); | ||
487 | } | ||
488 | m_gListViewMode->insert(m_aDirLong); | ||
489 | m_gListViewMode->insert(m_aDirShort); | ||
490 | m_gListViewMode->insert(m_aDirName); | ||
491 | |||
492 | m_gPrevNext = new QActionGroup(this,"imageprevnext",false); | ||
493 | m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); | ||
494 | m_aNext->setToggleAction(false); | ||
495 | connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); | ||
496 | m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); | ||
497 | m_aPrevious->setToggleAction(false); | ||
498 | connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); | ||
499 | m_gPrevNext->insert(m_aPrevious); | ||
500 | m_gPrevNext->insert(m_aNext); | ||
501 | |||
502 | m_aFullScreen = new QAction( tr( "Show images fullscreen" ), | ||
503 | Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); | ||
504 | m_aFullScreen->setToggleAction(true); | ||
505 | m_aFullScreen->setOn(false); | ||
506 | connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenToggled(bool))); | ||
507 | |||
508 | m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); | ||
509 | m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); | ||
510 | m_aAutoRotate->setToggleAction(true); | ||
511 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | ||
512 | m_aAutoRotate->setOn(true); | ||
513 | autoRotate = true; | ||
514 | } else { | ||
515 | m_aAutoRotate->setOn(false); | ||
516 | autoRotate = false; | ||
517 | } | ||
518 | connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | ||
519 | |||
520 | m_aAutoScale = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); | ||
521 | m_aAutoScale->setToggleAction(true); | ||
522 | m_aAutoScale->setOn (false); | ||
523 | connect(m_aAutoScale,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | ||
524 | |||
525 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); | ||
526 | m_aZoomer->setToggleAction(true); | ||
527 | m_aZoomer->setOn (true); | ||
528 | zoomerOn = true; | ||
529 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | ||
530 | m_gDisplayType->insert(m_aAutoRotate); | ||
531 | m_gDisplayType->insert(m_aAutoScale); | ||
532 | m_gDisplayType->insert(m_aZoomer); | ||
533 | |||
534 | m_hGroup = new QActionGroup(this,"actioncollection",false); | ||
535 | m_hGroup->insert(m_aFullScreen); | ||
536 | } | ||
537 | |||
538 | void PMainWindow::setupToolbar() | ||
539 | { | ||
540 | toolBar = new QToolBar( this ); | ||
541 | addToolBar(toolBar); | ||
542 | toolBar->setHorizontalStretchable( true ); | ||
543 | setToolBarsMovable( false ); | ||
544 | m_aDirUp->addTo( toolBar ); | ||
545 | |||
546 | fsButton = new PFileSystem( toolBar ); | ||
547 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | ||
548 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | ||
549 | connect( this, SIGNAL( changeDir( const QString& ) ), | ||
550 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | ||
551 | |||
552 | if (m_aBeam) { | ||
553 | m_aBeam->addTo( toolBar ); | ||
554 | } | ||
555 | m_aShowInfo->addTo(toolBar); | ||
556 | m_aTrash->addTo(toolBar); | ||
557 | m_aSetup->addTo(toolBar); | ||
558 | |||
559 | m_gDisplayType->addTo(toolBar); | ||
560 | |||
561 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | ||
562 | m_gPrevNext->addTo(toolBar); | ||
563 | } else { | ||
564 | m_gPrevNext->setEnabled(false); | ||
565 | } | ||
566 | } | ||
567 | |||
568 | void PMainWindow::setupMenu() | ||
569 | { | ||
570 | fileMenu = new QPopupMenu( menuBar() ); | ||
571 | menuBar()->insertItem( tr( "File" ), fileMenu ); | ||
572 | dispMenu = new QPopupMenu( menuBar() ); | ||
573 | menuBar()->insertItem( tr( "Show" ), dispMenu ); | ||
574 | |||
575 | m_aViewfile->addTo(fileMenu); | ||
576 | m_aShowInfo->addTo(fileMenu); | ||
577 | m_aStartSlide->addTo(fileMenu); | ||
578 | |||
579 | fileMenu->insertSeparator(); | ||
580 | m_aDirUp->addTo( fileMenu ); | ||
581 | |||
582 | fsMenu = new QPopupMenu(fileMenu); | ||
583 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); | ||
584 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); | ||
585 | dirChanged(); | ||
586 | |||
587 | if ( m_aBeam ) { | ||
588 | fileMenu->insertSeparator(); | ||
589 | m_aBeam->addTo( fileMenu ); | ||
590 | } | ||
591 | fileMenu->insertSeparator(); | ||
592 | m_aSetup->addTo(fileMenu); | ||
593 | m_aTrash->addTo(fileMenu); | ||
594 | |||
595 | m_aHideToolbar->addTo(dispMenu); | ||
596 | listviewMenu = new QPopupMenu(dispMenu); | ||
597 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); | ||
598 | m_gListViewMode->addTo(listviewMenu); | ||
599 | dispMenu->insertSeparator(); | ||
600 | m_aFullScreen->addTo(dispMenu); | ||
601 | m_gDisplayType->addTo(dispMenu); | ||
602 | dispMenu->insertSeparator(); | ||
603 | m_gPrevNext->addTo(dispMenu); | ||
604 | } | ||
605 | |||
606 | void PMainWindow::listviewselected(QAction*which) | ||
607 | { | ||
608 | if (!which || which->isOn()==false) return; | ||
609 | int val = 1; | ||
610 | // QString name; | ||
611 | |||
612 | if (which==m_aDirName) { | ||
613 | val = 3; | ||
614 | // name = "opie-eye/opie-eye-textview"; | ||
615 | } else if (which==m_aDirShort) { | ||
616 | val = 2; | ||
617 | // name = "opie-eye/opie-eye-thumbonly"; | ||
618 | } else if (which==m_aDirLong) { | ||
619 | val = 1; | ||
620 | // name = "opie-eye/opie-eye-thumb"; | ||
621 | } | ||
622 | emit changeListMode(val); | ||
623 | } | ||
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index ae1cc09..65151fc 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h | |||
@@ -20,77 +20,86 @@ namespace Core{ | |||
20 | class OKeyConfigManager; | 20 | class OKeyConfigManager; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | class ImageView; | 24 | class ImageView; |
25 | class ImageWidget; | 25 | class ImageWidget; |
26 | class PIconView; | 26 | class PIconView; |
27 | class imageinfo; | 27 | class imageinfo; |
28 | class QMenuBar; | 28 | class QMenuBar; |
29 | class QToolBar; | 29 | class QToolBar; |
30 | class QPopupMenu; | 30 | class QPopupMenu; |
31 | class QAction; | 31 | class QAction; |
32 | class QActionGroup; | ||
32 | class StorageInfo; | 33 | class StorageInfo; |
33 | 34 | ||
34 | class PMainWindow : public QMainWindow { | 35 | class PMainWindow : public QMainWindow { |
35 | Q_OBJECT | 36 | Q_OBJECT |
36 | enum Views { IconView, ImageInfo, ImageDisplay }; | 37 | enum Views { IconView, ImageInfo, ImageDisplay }; |
37 | public: | 38 | public: |
38 | static QString appName() { return QString::fromLatin1("opie-eye" ); } | 39 | static QString appName() { return QString::fromLatin1("opie-eye" ); } |
39 | PMainWindow(QWidget*, const char*, WFlags ); | 40 | PMainWindow(QWidget*, const char*, WFlags ); |
40 | ~PMainWindow(); | 41 | ~PMainWindow(); |
41 | 42 | ||
42 | signals: | 43 | signals: |
43 | void configChanged(); | 44 | void configChanged(); |
44 | void changeDir( const QString& ); | 45 | void changeDir( const QString& ); |
46 | void changeListMode(int); | ||
45 | 47 | ||
46 | public slots: | 48 | public slots: |
47 | void slotShowInfo( const QString& inf ); | 49 | void slotShowInfo( const QString& inf ); |
48 | void slotDisplay( const QString& inf ); | 50 | void slotDisplay( const QString& inf ); |
49 | void slotReturn(); | 51 | void slotReturn(); |
50 | void slotRotateToggled(bool); | 52 | void slotRotateToggled(bool); |
51 | void slotScaleToggled(bool); | 53 | void slotScaleToggled(bool); |
52 | void slotZoomerToggled(bool); | 54 | void slotZoomerToggled(bool); |
53 | void slotToggleZoomer(); | 55 | void slotToggleZoomer(); |
54 | void slotToggleAutorotate(); | 56 | void slotToggleAutorotate(); |
55 | void slotToggleAutoscale(); | 57 | void slotToggleAutoscale(); |
56 | void setDocument( const QString& ); | 58 | void setDocument( const QString& ); |
57 | virtual void slotToggleFullScreen(); | 59 | virtual void slotToggleFullScreen(); |
60 | virtual void slotFullScreenToggled(bool); | ||
58 | 61 | ||
59 | protected slots: | 62 | protected slots: |
60 | void raiseIconView(); | 63 | void raiseIconView(); |
61 | void closeEvent( QCloseEvent* ); | 64 | void closeEvent( QCloseEvent* ); |
62 | void showToolbar(bool); | 65 | void showToolbar(bool); |
66 | void listviewselected(QAction*); | ||
63 | 67 | ||
64 | private: | 68 | private: |
65 | template<class T> void initT( const char* name, T**, int ); | 69 | template<class T> void initT( const char* name, T**, int ); |
66 | void initInfo(); | 70 | void initInfo(); |
67 | void initDisp(); | 71 | void initDisp(); |
68 | 72 | ||
69 | private: | 73 | private: |
70 | Opie::Core::OConfig *m_cfg; | 74 | Opie::Core::OConfig *m_cfg; |
71 | Opie::Ui::OWidgetStack *m_stack; | 75 | Opie::Ui::OWidgetStack *m_stack; |
72 | PIconView* m_view; | 76 | PIconView* m_view; |
73 | imageinfo *m_info; | 77 | imageinfo *m_info; |
74 | ImageView *m_disp; | 78 | ImageView *m_disp; |
75 | bool autoRotate; | 79 | bool autoRotate; |
76 | bool autoScale; | 80 | bool autoScale; |
77 | bool zoomerOn; | 81 | bool zoomerOn; |
78 | QToolButton*rotateButton,*fsButton,*viewModeButton; | 82 | QToolButton*fsButton; |
79 | QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton; | ||
80 | QMenuBar *menuBar; | ||
81 | QToolBar *toolBar; | 83 | QToolBar *toolBar; |
82 | QPopupMenu *fileMenu,*dispMenu,*fsMenu; | 84 | QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu; |
83 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; | 85 | QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; |
84 | QAction*m_aHideToolbar; | 86 | QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; |
85 | 87 | QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; | |
88 | QAction *m_aNext,*m_aPrevious,*m_aFullScreen; | ||
89 | QAction *m_aAutoRotate,*m_aAutoScale,*m_aZoomer; | ||
90 | |||
91 | /* init funs */ | ||
92 | void setupActions(); | ||
93 | void setupToolbar(); | ||
94 | void setupMenu(); | ||
86 | /* for the device submenu - ToDo: Merge with the special button */ | 95 | /* for the device submenu - ToDo: Merge with the special button */ |
87 | StorageInfo *m_storage; | 96 | StorageInfo *m_storage; |
88 | QMap<QString, QString> m_dev; | 97 | QMap<QString, QString> m_dev; |
89 | 98 | ||
90 | private slots: | 99 | private slots: |
91 | void slotConfig(); | 100 | void slotConfig(); |
92 | void slotSelectDir(int); | 101 | void slotSelectDir(int); |
93 | void dirChanged(); | 102 | void dirChanged(); |
94 | }; | 103 | }; |
95 | 104 | ||
96 | #endif | 105 | #endif |