summaryrefslogtreecommitdiff
authoralwin <alwin>2004-10-30 19:07:22 (UTC)
committer alwin <alwin>2004-10-30 19:07:22 (UTC)
commit193bbcdfb160a1a1dbb59078ae262c1a98207808 (patch) (unidiff)
tree9d2cc5e2501cc94b4e61e1edffa421b4886aaa6c
parent0fc9ce0c22bad09470a18eb6d084c6042c914ed8 (diff)
downloadopie-193bbcdfb160a1a1dbb59078ae262c1a98207808.zip
opie-193bbcdfb160a1a1dbb59078ae262c1a98207808.tar.gz
opie-193bbcdfb160a1a1dbb59078ae262c1a98207808.tar.bz2
most part of menu implemented
all buttons etc. should become a QAction inserted into menu and toolbar toolbar may be hidden
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp3
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h2
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp1
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp173
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h20
5 files changed, 159 insertions, 40 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 0499af9..a41ce9f 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -675,3 +675,3 @@ void PIconView::slotShowImage( const QString& name) {
675 QString r_name = lister->nameToFname(name); 675 QString r_name = lister->nameToFname(name);
676 emit sig_display( r_name ); 676 emit sig_display(r_name);
677} 677}
@@ -694,3 +694,2 @@ void PIconView::slotImageInfo() {
694 if (isDir) return; 694 if (isDir) return;
695
696 slotImageInfo( name ); 695 slotImageInfo( name );
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index bccbb0e..dff55ed 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -39,3 +39,3 @@ signals:
39 void sig_showInfo( const QString& ); 39 void sig_showInfo( const QString& );
40 void sig_display( const QString& ); 40 void sig_display(const QString&);
41 void sig_startslide(int timeout); 41 void sig_startslide(int timeout);
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index b699aa1..a20c879 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -205,2 +205 @@ void ImageView::enableFullscreen()
205} }
206
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 3c946b6..a1349a8 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -24,2 +24,3 @@
24#include <qpe/ir.h> 24#include <qpe/ir.h>
25#include <qpe/storage.h>
25#include <qpe/applnk.h> 26#include <qpe/applnk.h>
@@ -33,3 +34,4 @@
33#include <qframe.h> 34#include <qframe.h>
34 35#include <qmenubar.h>
36#include <qaction.h>
35 37
@@ -44,2 +46,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
44 m_cfg->setGroup("Zecke_view" ); 46 m_cfg->setGroup("Zecke_view" );
47
48 m_storage = new StorageInfo();
49 connect(m_storage, SIGNAL(disksChanged() ),
50 this, SLOT( dirChanged() ) );
51
45 /* 52 /*
@@ -48,4 +55,11 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
48 */ 55 */
49 QToolBar *bar = new QToolBar( this ); 56 toolBar = new QToolBar( this );
50 bar->setHorizontalStretchable( true ); 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 );
51 setToolBarsMovable( false ); 65 setToolBarsMovable( false );
@@ -58,2 +72,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
58 m_stack->raiseWidget( IconView ); 72 m_stack->raiseWidget( IconView );
73
59 connect(m_view, SIGNAL(sig_display(const QString&)), 74 connect(m_view, SIGNAL(sig_display(const QString&)),
@@ -65,27 +80,45 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
65 80
66 upButton = new QToolButton( bar ); 81 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ),
67 upButton->setIconSet( Resource::loadIconSet( "up" ) ); 82 0, 0, this, 0, true );
68 connect( upButton, SIGNAL(clicked()), 83 m_aDirUp->setToggleAction(false);
69 m_view, SLOT(slotDirUp()) ); 84 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
85 m_aDirUp->addTo( toolBar );
70 86
71 fsButton = new PFileSystem( bar ); 87 QToolButton*btn;
88
89 fsButton = new PFileSystem( toolBar );
72 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 90 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
73 m_view, SLOT(slotChangeDir( const QString& ) ) ); 91 m_view, SLOT(slotChangeDir( const QString& ) ) );
92 connect( this, SIGNAL( changeDir( const QString& ) ),
93 m_view, SLOT(slotChangeDir( const QString& ) ) );
74 94
75 QToolButton*btn = new QToolButton( bar ); 95 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ),
76 btn->setIconSet( Resource::loadIconSet( "edit" ) ); 96 0, 0, this, 0, true );
77 connect( btn, SIGNAL(clicked()), 97 m_aShowInfo->setToggleAction(false);
78 m_view, SLOT(slotImageInfo()) ); 98 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
99 m_aShowInfo->addTo( toolBar );
79 100
80 if ( Ir::supported() ) { 101 if ( Ir::supported() ) {
81 btn = new QToolButton( bar ); 102 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),
82 btn->setIconSet( Resource::loadIconSet( "beam" ) ); 103 0, 0, this, 0, true );
83 connect( btn, SIGNAL(clicked()), 104 m_aBeam->setToggleAction(false);
84 m_view, SLOT(slotBeam()) ); 105 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
106 m_aBeam->addTo( toolBar );
85 } 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 );
86 113
87 btn = new QToolButton( bar ); 114 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet( "mag" ),
88 btn->setIconSet( Resource::loadIconSet( "trash" ) ); 115 0, 0, this, 0, true );
89 connect( btn, SIGNAL(clicked() ), 116 m_aViewfile->setToggleAction(false);
90 m_view, SLOT(slotTrash() ) ); 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()));
91 124
@@ -94,3 +127,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
94 if (mode < 1 || mode>3) mode = 1; 127 if (mode < 1 || mode>3) mode = 1;
95 viewModeButton = new ViewModeButton( bar,mode ); 128 viewModeButton = new ViewModeButton( toolBar,mode );
96 connect( viewModeButton, SIGNAL(changeMode(int)), 129 connect( viewModeButton, SIGNAL(changeMode(int)),
@@ -98,3 +131,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
98 131
99 btn = new QToolButton( bar ); 132 btn = new QToolButton( toolBar );
100 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 133 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
@@ -103,5 +136,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
103 136
104 137 prevButton = new QToolButton(toolBar);
105
106 prevButton = new QToolButton(bar);
107 prevButton->setIconSet( Resource::loadIconSet( "back" ) ); 138 prevButton->setIconSet( Resource::loadIconSet( "back" ) );
@@ -109,3 +140,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
109 140
110 nextButton = new QToolButton(bar); 141 nextButton = new QToolButton(toolBar);
111 nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); 142 nextButton->setIconSet( Resource::loadIconSet( "forward" ) );
@@ -113,6 +144,27 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
113 144
114 rotateButton = new QToolButton(bar); 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);
115 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); 168 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
116 rotateButton->setToggleButton(true); 169 rotateButton->setToggleButton(true);
117
118 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 170 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
@@ -126,6 +178,5 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
126 } 178 }
127
128 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 179 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
129 180
130 scaleButton = new QToolButton(bar); 181 scaleButton = new QToolButton(toolBar);
131 scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); 182 scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) );
@@ -136,3 +187,3 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
136 187
137 zoomButton = new QToolButton(bar); 188 zoomButton = new QToolButton(toolBar);
138 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); 189 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) );
@@ -142,2 +193,11 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
142 zoomerOn = true; 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
143} 203}
@@ -179,5 +239,6 @@ void PMainWindow::slotRotateToggled(bool how)
179{ 239{
240 odebug << "Autorotate: " << how << oendl;
180 autoRotate = how; 241 autoRotate = how;
181 if (m_disp) { 242 if (m_disp) {
182 m_disp->setAutoRotate(how); 243 m_disp->setAutoScaleRotate(autoScale,autoRotate);
183 } 244 }
@@ -369,3 +430,6 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
369 nextButton->hide(); 430 nextButton->hide();
370 upButton->hide(); 431 m_aDirUp->setEnabled(false);
432 m_aShowInfo->setEnabled(false);
433 m_aViewfile->setEnabled(true);
434 m_aStartSlide->setEnabled(false);
371 fsButton->hide(); 435 fsButton->hide();
@@ -377,2 +441,3 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
377void PMainWindow::slotDisplay( const QString& inf ) { 441void PMainWindow::slotDisplay( const QString& inf ) {
442 odebug << "slotDisplay: " << inf << oendl;
378 if ( !m_disp ) { 443 if ( !m_disp ) {
@@ -384,3 +449,6 @@ void PMainWindow::slotDisplay( const QString& inf ) {
384 nextButton->show(); 449 nextButton->show();
385 upButton->hide(); 450 m_aDirUp->setEnabled(false);
451 m_aShowInfo->setEnabled(true);
452 m_aViewfile->setEnabled(false);
453 m_aStartSlide->setEnabled(false);
386 fsButton->hide(); 454 fsButton->hide();
@@ -426,3 +494,6 @@ void PMainWindow::raiseIconView() {
426 nextButton->hide(); 494 nextButton->hide();
427 upButton->show(); 495 m_aDirUp->setEnabled(true);
496 m_aShowInfo->setEnabled(true);
497 m_aViewfile->setEnabled(true);
498 m_aStartSlide->setEnabled(true);
428 fsButton->show(); 499 fsButton->show();
@@ -446 +517,33 @@ void PMainWindow::setDocument( const QString& showImg ) {
446} 517}
518
519void PMainWindow::slotSelectDir(int id)
520{
521 emit changeDir( m_dev[fsMenu->text(id )] );
522}
523
524void PMainWindow::dirChanged()
525{
526 fsMenu->clear();
527 m_dev.clear();
528
529 /* home dir, too */
530 QString f = getenv( "HOME" );
531 if (!f.isEmpty()) {
532 m_dev.insert("Home directory",f);
533 fsMenu->insertItem("Home directory");
534 }
535 const QList<FileSystem> &fs = m_storage->fileSystems();
536 QListIterator<FileSystem> it(fs );
537 for ( ; it.current(); ++it ) {
538 const QString disk = (*it)->name();
539 const QString path = (*it)->path();
540 m_dev.insert( disk, path );
541 fsMenu->insertItem( disk );
542 }
543}
544
545void PMainWindow::showToolbar(bool how)
546{
547 if (!how) toolBar->hide();
548 else toolBar->show();
549} \ No newline at end of file
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 6fa1ab6..ae1cc09 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -27,2 +27,7 @@ class PIconView;
27class imageinfo; 27class imageinfo;
28class QMenuBar;
29class QToolBar;
30class QPopupMenu;
31class QAction;
32class StorageInfo;
28 33
@@ -38,2 +43,3 @@ signals:
38 void configChanged(); 43 void configChanged();
44 void changeDir( const QString& );
39 45
@@ -55,2 +61,3 @@ protected slots:
55 void closeEvent( QCloseEvent* ); 61 void closeEvent( QCloseEvent* );
62 void showToolbar(bool);
56 63
@@ -70,4 +77,13 @@ private:
70 bool zoomerOn; 77 bool zoomerOn;
71 QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton; 78 QToolButton*rotateButton,*fsButton,*viewModeButton;
72 QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton; 79 QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton;
80 QMenuBar *menuBar;
81 QToolBar *toolBar;
82 QPopupMenu *fileMenu,*dispMenu,*fsMenu;
83 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide;
84 QAction*m_aHideToolbar;
85
86 /* for the device submenu - ToDo: Merge with the special button */
87 StorageInfo *m_storage;
88 QMap<QString, QString> m_dev;
73 89
@@ -75,2 +91,4 @@ private slots:
75 void slotConfig(); 91 void slotConfig();
92 void slotSelectDir(int);
93 void dirChanged();
76}; 94};