summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 7f384bd..88acd59 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -71,55 +71,88 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
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() ) );
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);
+ rotateButton->setOn(true);
+ connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
+ autoRotate = true;
+
+ 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;
}
PMainWindow::~PMainWindow() {
odebug << "Shutting down" << oendl;
}
+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() );
@@ -159,68 +192,74 @@ void PMainWindow::slotConfig() {
/*
* create a new image info component
* and detach the current one
* we will make the other delete on exit
*/
template<class T>
void PMainWindow::initT( const char* name, T** ptr, int id) {
if ( *ptr ) {
(*ptr)->disconnect(this, SLOT(slotReturn()));
(*ptr)->setDestructiveClose();
m_stack->removeWidget( *ptr );
}
*ptr = new T( m_stack, name );
m_stack->addWidget( *ptr, id );
connect(*ptr, SIGNAL(sig_return()),
this,SLOT(slotReturn()));
}
void PMainWindow::initInfo() {
initT<imageinfo>( "Image Info", &m_info, ImageInfo );
}
void PMainWindow::initDisp() {
initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay );
+ if (m_disp) {
+ m_disp->setAutoScale(autoScale);
+ m_disp->setAutoRotate(autoRotate);
+ }
+
}
/**
* 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_info )
initInfo();
m_info->setPath( inf );
m_stack->raiseWidget( ImageInfo );
}
void PMainWindow::slotDisplay( const QString& inf ) {
- if ( !m_disp )
+ if ( !m_disp ) {
initDisp();
+ }
m_disp->setImage( inf );
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 ) {
raiseIconView();
ev->ignore();
return;
}
ev->accept();
QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
}