summaryrefslogtreecommitdiff
path: root/noncore
authoralwin <alwin>2004-10-31 21:25:56 (UTC)
committer alwin <alwin>2004-10-31 21:25:56 (UTC)
commit05784b5484029af9947612b150b2a17d3314d680 (patch) (side-by-side diff)
tree68d1bb338dcc5ed863de0690960f9aeb969c6fb5 /noncore
parentc0920559a3df4abb8f8c6e58dd769abdb14170ce (diff)
downloadopie-05784b5484029af9947612b150b2a17d3314d680.zip
opie-05784b5484029af9947612b150b2a17d3314d680.tar.gz
opie-05784b5484029af9947612b150b2a17d3314d680.tar.bz2
some more settings the user can do
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/gui.pro6
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp3
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp19
3 files changed, 23 insertions, 5 deletions
diff --git a/noncore/graphics/opie-eye/gui/gui.pro b/noncore/graphics/opie-eye/gui/gui.pro
index b9f0bf8..2759dd5 100644
--- a/noncore/graphics/opie-eye/gui/gui.pro
+++ b/noncore/graphics/opie-eye/gui/gui.pro
@@ -1,15 +1,17 @@
HEADERS += gui/filesystem.h \
gui/iconview.h \
gui/imageinfoui.h \
gui/imageview.h \
gui/mainwindow.h \
- gui/viewmodebutton.h
+ gui/viewmodebutton.h \
+ gui/basesetup.h
SOURCES += gui/filesystem.cpp \
gui/iconview.cpp \
gui/imageinfoui.cpp \
gui/imageview.cpp \
gui/mainwindow.cpp \
- gui/viewmodebutton.cpp
+ gui/viewmodebutton.cpp \
+ gui/basesetup.cpp
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index a41ce9f..7c8c88d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -640,97 +640,98 @@ void PIconView::slotShowNext()
}
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);
}
void PIconView::slotStartSlide() {
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) {
if (!slotShowFirst())
return;
} else {
slotShowImage( name );
}
- emit sig_startslide(2);
+ int t = m_cfg->readNumEntry("base_slideshowtimeout", 2);
+ emit sig_startslide(t);
}
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;
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index e714e84..570ee45 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,320 +1,335 @@
/*
* 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 "basesetup.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() ) );
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&)) );
connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
listviewMenu = 0;
/* setup menu and toolbar */
setupActions();
setupToolbar();
setupMenu();
+ m_aHideToolbar->setOn(m_cfg->readBoolEntry("base_showtoolbar",true));
}
PMainWindow::~PMainWindow() {
}
void PMainWindow::slotToggleZoomer()
{
if (!m_disp) return;
bool cur = m_aZoomer->isOn();
m_aZoomer->setOn(!cur);
}
void PMainWindow::slotZoomerToggled(bool how)
{
zoomerOn = how;
if (m_disp) {
m_disp->setShowZoomer(zoomerOn);
}
}
void PMainWindow::slotToggleAutorotate()
{
if (!m_disp) return;
if (!m_aAutoRotate->isEnabled()) return;
bool cur = m_aAutoRotate->isOn();
m_aAutoRotate->setOn(!cur);
}
void PMainWindow::slotToggleAutoscale()
{
if (!m_disp) return;
bool cur = m_aAutoScale->isOn();
m_aAutoScale->setOn(!cur);
}
void PMainWindow::slotRotateToggled(bool how)
{
odebug << "Autorotate: " << how << oendl;
autoRotate = how;
if (m_disp) {
m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
}
}
void PMainWindow::slotScaleToggled(bool how)
{
autoScale = !how;
if (!how) {
autoRotate = how;
}
if (!autoScale) {
m_aAutoRotate->setOn(false);
}
if (m_disp) {
m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
}
m_aAutoRotate->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 );
+
+ BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
+ wid->addTab(bSetup,"SettingsIcon","Basics setup");
+
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();
+ bSetup->save_values();
}
delete keyWid;
}
/*
* 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_cfg, 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 );
connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
}
void PMainWindow::initDisp() {
initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
if (m_disp) {
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
m_disp->setMinimumSize(QApplication::desktop()->size()/2);
}
m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType);
m_disp->setAutoScale(!m_aAutoScale->isOn());
m_disp->setAutoRotate(m_aAutoRotate->isOn());
m_disp->setShowZoomer(m_aZoomer->isOn());
m_disp->setBackgroundColor(white);
connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
slotFullScreenToggled(m_aFullScreen->isOn());
}
}
void PMainWindow::slotToggleFullScreen()
{
odebug << "Toggle full " << oendl;
bool current = !m_aFullScreen->isOn();
m_aFullScreen->setOn(current);
}
void PMainWindow::slotFullScreenToggled(bool current)
{
odebug << "slotFullScreenToggled " << current << oendl;
if (!m_disp) return;
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());
} else {
setUpdatesEnabled(false);
odebug << "window" << oendl;
- m_disp->setMinimumSize(10,10);
- m_disp->reparent(0,QPoint(0,0));
+ if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
+ m_disp->setMinimumSize(QApplication::desktop()->size()/2);
+ } else {
+ m_disp->setMinimumSize(10,10);
+ }
+ if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
+ m_disp->reparent(0,QPoint(50,50));
+ } else {
+ m_disp->reparent(0,QPoint(0,0));
+ }
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) {
m_aNext->removeFrom(toolBar);
m_aPrevious->removeFrom(toolBar);
m_aNext->setEnabled(false);
m_aPrevious->setEnabled(false);
m_aDirUp->setEnabled(false);
m_aShowInfo->setEnabled(false);
m_aViewfile->setEnabled(true);
m_aStartSlide->setEnabled(false);
fsButton->hide();
}
m_stack->raiseWidget( ImageInfo );
}
void PMainWindow::slotDisplay( const QString& inf ) {
odebug << "slotDisplay: " << inf << oendl;
if ( !m_disp ) {
initDisp();
}