summaryrefslogtreecommitdiff
authoralwin <alwin>2004-10-30 19:07:22 (UTC)
committer alwin <alwin>2004-10-30 19:07:22 (UTC)
commit193bbcdfb160a1a1dbb59078ae262c1a98207808 (patch) (side-by-side diff)
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
@@ -628,116 +628,115 @@ bool PIconView::slotShowFirst()
void PIconView::slotShowNext()
{
bool isDir = false;
QString name = nextFileName(isDir);
while (isDir==true) {
m_view->setCurrentItem(m_view->currentItem()->nextItem());
name = nextFileName(isDir);
}
if (name.isEmpty()) {
slotShowFirst();
return;
}
if (isDir) return;
/* if we got a name we have a next item */
m_view->setCurrentItem(m_view->currentItem()->nextItem());
slotShowImage(name);
}
void PIconView::slotShowPrev()
{
bool isDir = false;
QString name = prevFileName(isDir);
while (isDir==true) {
/* if name is empty isDir is false, too. */
m_view->setCurrentItem(m_view->currentItem()->prevItem());
name = prevFileName(isDir);
}
if (name.isEmpty()) {
slotShowLast();
return;
}
if (isDir) return;
/* if we got a name we have a prev item */
m_view->setCurrentItem(m_view->currentItem()->prevItem());
slotShowImage(name);
}
void PIconView::slotShowImage()
{
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) return;
slotShowImage( name );
}
void PIconView::slotShowImage( const QString& name) {
PDirLister *lister = currentView()->dirLister();
QString r_name = lister->nameToFname(name);
- emit sig_display( r_name );
+ emit sig_display(r_name);
}
void PIconView::slotStartSlide() {
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) {
if (!slotShowFirst())
return;
} else {
slotShowImage( name );
}
emit sig_startslide(2);
}
void PIconView::slotImageInfo() {
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) return;
-
slotImageInfo( name );
}
void PIconView::slotImageInfo( const QString& name) {
PDirLister *lister = currentView()->dirLister();
QString r_name = lister->nameToFname(name);
emit sig_showInfo(r_name );
}
void PIconView::slotChangeMode( int mode ) {
if ( mode >= 1 && mode <= 3 )
m_mode = mode;
m_cfg->writeEntry("ListViewMode", m_mode);
/* performance! */
m_view->clear();
calculateGrid();
slotReloadDir();
}
void PIconView::resizeEvent( QResizeEvent* re ) {
QVBox::resizeEvent( re );
calculateGrid();
}
void PIconView::calculateGrid() {
int dw = QApplication::desktop()->width();
int viewerWidth = dw-style().scrollBarExtent().width();
QIconView::ItemTextPos pos;
switch( m_mode ) {
case 2:
pos = QIconView::Bottom;
break;
case 3:
case 1:
default:
pos = QIconView::Right;
break;
}
m_view->setItemTextPos( pos );
switch (m_mode) {
case 2:
m_view->setGridX(50);
m_view->setGridY(20);
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
@@ -1,88 +1,88 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#ifndef PHUNK_ICON_VIEW_H
#define PHUNK_ICON_VIEW_H
#include <qvbox.h>
class QIconView;
class QIconViewItem;
class QComboBox;
class PIconViewItem;
class PDirLister;
class Ir;
namespace Opie {
namespace Core{
class OConfig;
class OKeyConfigManager;
}
}
class PIconView : public QVBox {
Q_OBJECT
friend class PIconViewItem;
enum ActionIds {
BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem
};
public:
PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
~PIconView();
void resetView();
Opie::Core::OKeyConfigManager* manager();
signals:
void sig_showInfo( const QString& );
- void sig_display( const QString& );
+ void sig_display(const QString&);
void sig_startslide(int timeout);
public slots:
virtual void slotShowNext();
virtual void slotShowPrev();
virtual void slotShowLast();
virtual bool slotShowFirst();
protected:
void resizeEvent( QResizeEvent* );
private:
void initKeys();
QString currentFileName(bool &isDir)const;
QString nextFileName(bool &isDir)const;
QString prevFileName(bool &isDir)const;
void loadViews();
void calculateGrid();
private slots:
void slotDirUp();
void slotChangeDir(const QString&);
void slotTrash();
void slotViewChanged( int );
void slotReloadDir();
void slotRename();
void slotBeam();
void slotBeamDone( Ir* );
void slotShowImage();
void slotShowImage( const QString& );
void slotImageInfo();
void slotImageInfo( const QString& );
void slotStartSlide();
void slotStart();
void slotEnd();
/* for performance reasons make it inline in the future */
void addFolders( const QStringList& );
void addFiles( const QStringList& );
void slotClicked(QIconViewItem* );
void slotRetrun(QIconViewItem* );
/**/
void slotThumbInfo(const QString&, const QString&);
void slotThumbNail(const QString&, const QPixmap&);
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
@@ -158,49 +158,48 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e)
}
void ImageView::setFullScreen(bool how)
{
m_isFullScreen = how;
if (how) {
m_ignore_next_in = true;
setFixedSize(qApp->desktop()->size());
showFullScreen();
} else {
setMinimumSize(10,10);
}
}
void ImageView::focusInEvent(QFocusEvent *)
{
// Always do it here, no matter the size.
odebug << "Focus in (view)" << oendl;
//if (fullScreen()) parentWidget()->showNormal();
if (m_ignore_next_in){m_ignore_next_in=false;return;}
if (fullScreen()) enableFullscreen();
}
void ImageView::hide()
{
if (fullScreen()) {
m_ignore_next_in = true;
showNormal();
}
QWidget::hide();
}
void ImageView::enableFullscreen()
{
if (!fullScreen()) return;
if (m_ignore_next_in) {m_ignore_next_in = false;return;}
setUpdatesEnabled(false);
// This is needed because showNormal() forcefully changes the window
// style to WSTyle_TopLevel.
reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
// Enable fullscreen.
/* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
* so we must block it here! */
m_ignore_next_in = true;
showFullScreen();
setUpdatesEnabled(true);
}
-
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
@@ -1,230 +1,291 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#include "mainwindow.h"
#include "imageview.h"
#include "iconview.h"
#include "filesystem.h"
#include "imageinfoui.h"
#include "viewmodebutton.h"
#include <iface/ifaceinfo.h>
#include <iface/dirview.h>
#include <opie2/odebug.h>
#include <opie2/owidgetstack.h>
#include <opie2/oapplicationfactory.h>
#include <opie2/otabwidget.h>
#include <opie2/okeyconfigwidget.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/ir.h>
+#include <qpe/storage.h>
#include <qpe/applnk.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qmap.h>
#include <qtimer.h>
#include <qframe.h>
-
+#include <qmenubar.h>
+#include <qaction.h>
//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
: QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
{
setCaption( QObject::tr("Opie Eye Caramba" ) );
m_cfg = new Opie::Core::OConfig("phunkview");
m_cfg->setGroup("Zecke_view" );
+
+ m_storage = new StorageInfo();
+ connect(m_storage, SIGNAL(disksChanged() ),
+ this, SLOT( dirChanged() ) );
+
/*
* Initialize ToolBar and IconView
* And Connect Them
*/
- QToolBar *bar = new QToolBar( this );
- bar->setHorizontalStretchable( true );
+ toolBar = new QToolBar( this );
+ menuBar = new QMenuBar( this );
+ fileMenu = new QPopupMenu( menuBar );
+ menuBar->insertItem( tr( "File" ), fileMenu );
+ dispMenu = new QPopupMenu( menuBar );
+ menuBar->insertItem( tr( "Show" ), dispMenu );
+
+ addToolBar(toolBar);
+ toolBar->setHorizontalStretchable( true );
setToolBarsMovable( false );
m_stack = new Opie::Ui::OWidgetStack( this );
setCentralWidget( m_stack );
m_view = new PIconView( m_stack, m_cfg );
m_stack->addWidget( m_view, IconView );
m_stack->raiseWidget( IconView );
+
connect(m_view, SIGNAL(sig_display(const QString&)),
this, SLOT(slotDisplay(const QString&)));
connect(m_view, SIGNAL(sig_showInfo(const QString&)),
this, SLOT(slotShowInfo(const QString&)) );
m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
- upButton = new QToolButton( bar );
- upButton->setIconSet( Resource::loadIconSet( "up" ) );
- connect( upButton, SIGNAL(clicked()),
- m_view, SLOT(slotDirUp()) );
+ m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ),
+ 0, 0, this, 0, true );
+ m_aDirUp->setToggleAction(false);
+ connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
+ m_aDirUp->addTo( toolBar );
- fsButton = new PFileSystem( bar );
+ QToolButton*btn;
+
+ fsButton = new PFileSystem( toolBar );
connect( fsButton, SIGNAL( changeDir( const QString& ) ),
m_view, SLOT(slotChangeDir( const QString& ) ) );
+ connect( this, SIGNAL( changeDir( const QString& ) ),
+ m_view, SLOT(slotChangeDir( const QString& ) ) );
- QToolButton*btn = new QToolButton( bar );
- btn->setIconSet( Resource::loadIconSet( "edit" ) );
- connect( btn, SIGNAL(clicked()),
- m_view, SLOT(slotImageInfo()) );
+ m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ),
+ 0, 0, this, 0, true );
+ m_aShowInfo->setToggleAction(false);
+ connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
+ m_aShowInfo->addTo( toolBar );
if ( Ir::supported() ) {
- btn = new QToolButton( bar );
- btn->setIconSet( Resource::loadIconSet( "beam" ) );
- connect( btn, SIGNAL(clicked()),
- m_view, SLOT(slotBeam()) );
+ m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),
+ 0, 0, this, 0, true );
+ m_aBeam->setToggleAction(false);
+ connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
+ m_aBeam->addTo( toolBar );
}
+ m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet( "trash" ),
+ 0, 0, this, 0, true );
+ m_aTrash->setToggleAction(false);
+ connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
+ m_aTrash->addTo( toolBar );
- btn = new QToolButton( bar );
- btn->setIconSet( Resource::loadIconSet( "trash" ) );
- connect( btn, SIGNAL(clicked() ),
- m_view, SLOT(slotTrash() ) );
+ m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet( "mag" ),
+ 0, 0, this, 0, true );
+ m_aViewfile->setToggleAction(false);
+ connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
+
+ m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet( "play" ),
+ 0, 0, this, 0, true );
+ m_aStartSlide->setToggleAction(false);
+
+ connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
int mode = m_cfg->readNumEntry("ListViewMode", 1);
if (mode < 1 || mode>3) mode = 1;
- viewModeButton = new ViewModeButton( bar,mode );
+ viewModeButton = new ViewModeButton( toolBar,mode );
connect( viewModeButton, SIGNAL(changeMode(int)),
m_view, SLOT(slotChangeMode(int)));
- btn = new QToolButton( bar );
+ btn = new QToolButton( toolBar );
btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
connect( btn, SIGNAL(clicked() ),
this, SLOT(slotConfig() ) );
-
-
- prevButton = new QToolButton(bar);
+ prevButton = new QToolButton(toolBar);
prevButton->setIconSet( Resource::loadIconSet( "back" ) );
connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev()));
- nextButton = new QToolButton(bar);
+ nextButton = new QToolButton(toolBar);
nextButton->setIconSet( Resource::loadIconSet( "forward" ) );
connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext()));
- rotateButton = new QToolButton(bar);
+/* filemenu start */
+ m_aViewfile->addTo(fileMenu);
+ m_aShowInfo->addTo(fileMenu);
+ m_aStartSlide->addTo(fileMenu);
+
+ fileMenu->insertSeparator();
+ m_aDirUp->addTo( fileMenu );
+
+ fsMenu = new QPopupMenu(fileMenu);
+ fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
+ connect( fsMenu, SIGNAL( activated( int ) ),
+ this, SLOT(slotSelectDir( int ) ) );
+ dirChanged();
+
+ fileMenu->insertSeparator();
+ if ( Ir::supported() ) {
+ m_aBeam->addTo( fileMenu );
+ }
+ fileMenu->insertSeparator();
+ m_aTrash->addTo( fileMenu );
+/* filemenu end */
+
+ rotateButton = new QToolButton(toolBar);
rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
rotateButton->setToggleButton(true);
-
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
rotateButton->setOn(true);
autoRotate = true;
prevButton->hide();
nextButton->hide();
} else {
rotateButton->setOn(false);
autoRotate = false;
}
-
connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
- scaleButton = new QToolButton(bar);
+ scaleButton = new QToolButton(toolBar);
scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) );
scaleButton->setToggleButton(true);
scaleButton->setOn(false);
connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
autoScale = true;
- zoomButton = new QToolButton(bar);
+ zoomButton = new QToolButton(toolBar);
zoomButton->setIconSet( Resource::loadIconSet( "mag" ) );
zoomButton->setToggleButton(true);
zoomButton->setOn(true);
connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
zoomerOn = true;
+
+/* showmenu */
+ m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ),
+ 0, 0, this, 0, true );
+ m_aHideToolbar->setOn (true);
+ m_aHideToolbar->addTo(dispMenu);
+ connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
+/* showmenu end*/
+
}
PMainWindow::~PMainWindow() {
}
void PMainWindow::slotToggleZoomer()
{
if (!m_disp) return;
bool cur = zoomButton->isOn();
zoomButton->setOn(!cur);
}
void PMainWindow::slotZoomerToggled(bool how)
{
zoomerOn = how;
if (m_disp) {
m_disp->setShowZoomer(zoomerOn);
}
}
void PMainWindow::slotToggleAutorotate()
{
if (!m_disp) return;
if (!rotateButton->isEnabled()) return;
bool cur = rotateButton->isOn();
rotateButton->setOn(!cur);
}
void PMainWindow::slotToggleAutoscale()
{
if (!m_disp) return;
bool cur = scaleButton->isOn();
scaleButton->setOn(!cur);
}
void PMainWindow::slotRotateToggled(bool how)
{
+ odebug << "Autorotate: " << how << oendl;
autoRotate = how;
if (m_disp) {
- m_disp->setAutoRotate(how);
+ m_disp->setAutoScaleRotate(autoScale,autoRotate);
}
}
void PMainWindow::slotScaleToggled(bool how)
{
autoScale = !how;
if (!how) {
autoRotate = how;
}
if (m_disp) {
m_disp->setAutoScaleRotate(autoScale,autoRotate);
}
if (!autoScale) {
rotateButton->setOn(false);
}
rotateButton->setEnabled(!how);
}
void PMainWindow::slotConfig() {
/*
* have a tab with the possible views
* a tab for globals image cache size.. scaled loading
* and one tab for the KeyConfigs
*/
QDialog dlg(this, 0, true);
dlg.setCaption( tr("Phunk View - Config" ) );
QHBoxLayout *lay = new QHBoxLayout(&dlg);
Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
lay->addWidget( wid );
ViewMap *vM = viewMap();
ViewMap::Iterator _it = vM->begin();
QMap<PDirView*, QWidget*> lst;
for( ; _it != vM->end(); ++_it ) {
PDirView *view = (_it.data())(*m_cfg);
PInterfaceInfo *inf = view->interfaceInfo();
QWidget *_wid = inf->configWidget( *m_cfg );
if (!_wid) continue;
_wid->reparent(wid, QPoint() );
lst.insert( view, _wid );
wid->addTab( _wid, "fileopen", inf->name() );
}
/*
* Add the KeyConfigWidget
*/
Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
@@ -322,125 +383,167 @@ void PMainWindow::slotToggleFullScreen()
bool current = !m_disp->fullScreen();
odebug << "Current = " << current << oendl;
if (current) {
odebug << "full" << oendl;
m_disp->setBackgroundColor(black);
m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
//m_disp->showFullScreen();
//qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
} else {
setUpdatesEnabled(false);
odebug << "window" << oendl;
m_disp->reparent(0,QPoint(0,0));
m_disp->showNormal();
m_disp->setBackgroundColor(white);
m_stack->addWidget(m_disp,ImageDisplay);
m_disp->setVScrollBarMode(QScrollView::Auto);
m_disp->setHScrollBarMode(QScrollView::Auto);
m_stack->raiseWidget(m_disp);
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
m_disp->resize(m_disp->minimumSize());
}
setUpdatesEnabled(true);
}
m_disp->setFullScreen(current);
}
/**
* With big Screen the plan could be to 'detach' the image
* window if visible and to create a ne wone
* init* already supports it but I make no use of it for
* now. We set filename and raise
*
* ### FIXME and talk to alwin
*/
void PMainWindow::slotShowInfo( const QString& inf ) {
if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
return;
}
if ( !m_info ) {
initInfo();
}
m_info->setPath( inf );
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
prevButton->hide();
nextButton->hide();
- upButton->hide();
+ m_aDirUp->setEnabled(false);
+ m_aShowInfo->setEnabled(false);
+ m_aViewfile->setEnabled(true);
+ m_aStartSlide->setEnabled(false);
fsButton->hide();
viewModeButton->hide();
}
m_stack->raiseWidget( ImageInfo );
}
void PMainWindow::slotDisplay( const QString& inf ) {
+ odebug << "slotDisplay: " << inf << oendl;
if ( !m_disp ) {
initDisp();
}
m_disp->setImage( inf );
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
prevButton->show();
nextButton->show();
- upButton->hide();
+ m_aDirUp->setEnabled(false);
+ m_aShowInfo->setEnabled(true);
+ m_aViewfile->setEnabled(false);
+ m_aStartSlide->setEnabled(false);
fsButton->hide();
viewModeButton->hide();
}
if (m_disp->fullScreen()) {
//m_disp->showFullScreen();
qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
} else {
m_stack->raiseWidget( ImageDisplay );
}
}
void PMainWindow::slotReturn() {
raiseIconView();
}
void PMainWindow::closeEvent( QCloseEvent* ev ) {
/*
* return from view
* or properly quit
*/
if ( m_stack->visibleWidget() == m_info ||
m_stack->visibleWidget() == m_disp ) {
ev->ignore();
raiseIconView();
return;
}
if (m_disp && m_disp->fullScreen()) {
/* otherwise opie-eye crashes in bigscreen mode! */
m_disp->reparent(0,QPoint(0,0));
m_stack->addWidget(m_disp,ImageDisplay);
}
ev->accept();
QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
}
void PMainWindow::raiseIconView() {
setUpdatesEnabled(false);
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
prevButton->hide();
nextButton->hide();
- upButton->show();
+ m_aDirUp->setEnabled(true);
+ m_aShowInfo->setEnabled(true);
+ m_aViewfile->setEnabled(true);
+ m_aStartSlide->setEnabled(true);
fsButton->show();
viewModeButton->show();
}
if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
m_disp->hide();
}
m_stack->raiseWidget( IconView );
setUpdatesEnabled(true);
repaint();
}
void PMainWindow::setDocument( const QString& showImg ) {
QString file = showImg;
DocLnk lnk(showImg);
if (lnk.isValid() )
file = lnk.file();
slotDisplay( file );
}
+
+void PMainWindow::slotSelectDir(int id)
+{
+ emit changeDir( m_dev[fsMenu->text(id )] );
+}
+
+void PMainWindow::dirChanged()
+{
+ fsMenu->clear();
+ m_dev.clear();
+
+ /* home dir, too */
+ QString f = getenv( "HOME" );
+ if (!f.isEmpty()) {
+ m_dev.insert("Home directory",f);
+ fsMenu->insertItem("Home directory");
+ }
+ const QList<FileSystem> &fs = m_storage->fileSystems();
+ QListIterator<FileSystem> it(fs );
+ for ( ; it.current(); ++it ) {
+ const QString disk = (*it)->name();
+ const QString path = (*it)->path();
+ m_dev.insert( disk, path );
+ fsMenu->insertItem( disk );
+ }
+}
+
+void PMainWindow::showToolbar(bool how)
+{
+ if (!how) toolBar->hide();
+ else toolBar->show();
+} \ 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
@@ -1,78 +1,96 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#ifndef PHUNK_MAIN_WINDOW_H
#define PHUNK_MAIN_WINDOW_H
#include <opie2/oconfig.h>
#include <qmainwindow.h>
namespace Opie {
namespace Ui{
class OWidgetStack;
}
namespace Core{
class OKeyConfigManager;
}
}
class ImageView;
class ImageWidget;
class PIconView;
class imageinfo;
+class QMenuBar;
+class QToolBar;
+class QPopupMenu;
+class QAction;
+class StorageInfo;
class PMainWindow : public QMainWindow {
Q_OBJECT
enum Views { IconView, ImageInfo, ImageDisplay };
public:
static QString appName() { return QString::fromLatin1("opie-eye" ); }
PMainWindow(QWidget*, const char*, WFlags );
~PMainWindow();
signals:
void configChanged();
+ void changeDir( const QString& );
public slots:
void slotShowInfo( const QString& inf );
void slotDisplay( const QString& inf );
void slotReturn();
void slotRotateToggled(bool);
void slotScaleToggled(bool);
void slotZoomerToggled(bool);
void slotToggleZoomer();
void slotToggleAutorotate();
void slotToggleAutoscale();
void setDocument( const QString& );
virtual void slotToggleFullScreen();
protected slots:
void raiseIconView();
void closeEvent( QCloseEvent* );
+ void showToolbar(bool);
private:
template<class T> void initT( const char* name, T**, int );
void initInfo();
void initDisp();
private:
Opie::Core::OConfig *m_cfg;
Opie::Ui::OWidgetStack *m_stack;
PIconView* m_view;
imageinfo *m_info;
ImageView *m_disp;
bool autoRotate;
bool autoScale;
bool zoomerOn;
- QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton;
+ QToolButton*rotateButton,*fsButton,*viewModeButton;
QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton;
+ QMenuBar *menuBar;
+ QToolBar *toolBar;
+ QPopupMenu *fileMenu,*dispMenu,*fsMenu;
+ QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide;
+ QAction*m_aHideToolbar;
+
+ /* for the device submenu - ToDo: Merge with the special button */
+ StorageInfo *m_storage;
+ QMap<QString, QString> m_dev;
private slots:
void slotConfig();
+ void slotSelectDir(int);
+ void dirChanged();
};
#endif