summaryrefslogtreecommitdiff
Side-by-side diff
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 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#include "mainwindow.h"
#include "iconview.h"
#include "filesystem.h"
#include "imageinfoui.h"
#include "imageview.h"
-#if 0
#include "viewmodebutton.h"
-#endif
+
#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/applnk.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qmap.h>
#include <qtimer.h>
OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
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" );
// qDebug( "Process-wide OApplication object @ %0x", oApp );
/*
* Initialize ToolBar and IconView
* And Connect Them
*/
QToolBar *bar = new QToolBar( this );
bar->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);
QToolButton *btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "up" ) );
connect( btn, SIGNAL(clicked()),
m_view, SLOT(slotDirUp()) );
btn = new PFileSystem( bar );
connect( btn, SIGNAL( changeDir( const QString& ) ),
m_view, SLOT(slotChangeDir( const QString& ) ) );
btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "edit" ) );
connect( btn, SIGNAL(clicked()),
m_view, SLOT(slotRename()) );
if ( Ir::supported() ) {
btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "beam" ) );
connect( btn, SIGNAL(clicked()),
m_view, SLOT(slotBeam()) );
}
btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "trash" ) );
connect( btn, SIGNAL(clicked() ),
m_view, SLOT(slotTrash() ) );
-#if 0
+
btn = new ViewModeButton( bar );
connect( btn, SIGNAL(changeMode(int)),
m_view, SLOT(slotChangeMode(int)));
-#endif
+
btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
connect( btn, SIGNAL(clicked() ),
this, SLOT(slotConfig() ) );
rotateButton = new QToolButton(bar);
rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
rotateButton->setToggleButton(true);
-
+
odebug << "Mode = " << m_stack->mode() << oendl;
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
rotateButton->setOn(true);
autoRotate = true;
} else {
rotateButton->setOn(false);
autoRotate = false;
}
connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
btn = new QToolButton(bar);
btn->setIconSet( Resource::loadIconSet( "1to1" ) );
btn->setToggleButton(true);
btn->setOn(false);
connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
autoScale = true;
btn = new QToolButton(bar);
btn->setIconSet( Resource::loadIconSet( "mag" ) );
btn->setToggleButton(true);
btn->setOn(true);
connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
zoomerOn = true;
}
PMainWindow::~PMainWindow() {
odebug << "Shutting down" << oendl;
}
void PMainWindow::slotZoomerToggled(bool how)
{
zoomerOn = how;
if (m_disp) {
m_disp->setShowZoomer(zoomerOn);
}
}
void PMainWindow::slotRotateToggled(bool how)
{
autoRotate = how;
if (m_disp) {
m_disp->setAutoRotate(how);
}
}
void PMainWindow::slotScaleToggled(bool how)
{
autoScale = !how;
if (m_disp) {
m_disp->setAutoScale(autoScale);
}
if (!autoScale && autoRotate) {
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 );
_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" );
keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
if ( !m_info ) {
initInfo();
}
keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
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 @@
+#include "viewmodebutton.h"
+
+#include <qtoolbar.h>
+#include <qpopupmenu.h>
+
+ViewModeButton::ViewModeButton( QToolBar* bar )
+ : QToolButton( bar )
+{
+ setIconSet( Resource::loadIconSet( "toys" ) );
+ QPopupMenu *pop= new QPopupMenu( this );
+ pop->setCheckable( true );
+ pop->insertItem( tr("Thumbnail and Imageinfo"), 0 );
+ pop->insertItem( tr("Thumbnail and Name" ), 1 );
+ pop->insertItem( tr("Name Only" ), 2 );
+ connect(pop, SIGNAL(activated(int)),
+ this, SIGNAL(changeMode(int)) );
+
+
+ setPopup( pop );
+}
+
+ViewModeButton::~ViewModeButton() {
+
+}
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 @@
+/*
+ * GPLv2 only
+ * zecke@handhelds.org
+ */
+
+#ifndef PHUNK_VIEW_MODE_BUTTON_H
+#define PHUNK_VIEW_MODE_BUTTON_H
+
+#include <qpe/resource.h>
+
+#include <qtoolbutton.h>
+
+class ViewModeButton : public QToolButton {
+ Q_OBJECT
+public:
+ ViewModeButton( QToolBar* );
+ ~ViewModeButton();
+
+signals:
+ void changeMode( int );
+};
+
+#endif