summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 6fff5ab..438fbf2 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,271 +1,270 @@
/*
* 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/applnk.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qmap.h>
#include <qtimer.h>
#include <qframe.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" );
-// odebug << "Process-wide OApplication object @ " << oApp << oendl;
/*
* 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);
upButton = new QToolButton( bar );
upButton->setIconSet( Resource::loadIconSet( "up" ) );
connect( upButton, SIGNAL(clicked()),
m_view, SLOT(slotDirUp()) );
fsButton = new PFileSystem( bar );
connect( fsButton, 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(slotRename()) );
+ m_view, SLOT(slotImageInfo()) );
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() ) );
int mode = m_cfg->readNumEntry("ListViewMode", 1);
if (mode < 1 || mode>3) mode = 1;
viewModeButton = new ViewModeButton( bar,mode );
connect( viewModeButton, SIGNAL(changeMode(int)),
m_view, SLOT(slotChangeMode(int)));
btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
connect( btn, SIGNAL(clicked() ),
this, SLOT(slotConfig() ) );
prevButton = new QToolButton(bar);
prevButton->setIconSet( Resource::loadIconSet( "back" ) );
connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev()));
nextButton = new QToolButton(bar);
nextButton->setIconSet( Resource::loadIconSet( "forward" ) );
connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext()));
rotateButton = new QToolButton(bar);
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->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->setIconSet( Resource::loadIconSet( "mag" ) );
zoomButton->setToggleButton(true);
zoomButton->setOn(true);
connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
zoomerOn = true;
}
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)
{
autoRotate = how;
if (m_disp) {
m_disp->setAutoRotate(how);
}
}
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" );
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 ) {
initDisp();
}
keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
keyWid->load();
wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
/*
* clean up
*apply changes
*/
QMap<PDirView*, QWidget*>::Iterator it;
for ( it = lst.begin(); it != lst.end(); ++it ) {
if ( act )
it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
delete it.key();
}
if ( act ) {
m_view->resetView();
keyWid->save();
m_disp->manager()->save();
m_info->manager()->save();
m_view->manager()->save();
}
delete keyWid;