summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp45
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp4
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.cpp4
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.h2
4 files changed, 30 insertions, 25 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index d546b64..660c4fa 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -149,55 +149,56 @@ namespace {
PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
: QVBox( wid ), m_cfg( cfg ), m_updatet( false )
{
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
}
m_path = QDir::homeDirPath();
m_mode = 0;
QHBox *hbox = new QHBox( this );
QLabel* lbl = new QLabel( hbox );
lbl->setText( tr("View as" ) );
m_views = new QComboBox( hbox, "View As" );
connect( m_views, SIGNAL(activated(int)),
this, SLOT(slotViewChanged(int)) );
m_view= new QIconView( this );
connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
this, SLOT(slotClicked(QIconViewItem*)) );
connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
this, SLOT(slotClicked(QIconViewItem*)) );
m_view->setArrangement( QIconView::LeftToRight );
- m_view->setItemTextPos( QIconView::Right );
- int dw = QApplication::desktop()->width();
- int viewerWidth = dw-style().scrollBarExtent().width();
- m_view->setGridX( viewerWidth-3*m_view->spacing());
- m_view->setGridY( fontMetrics().height()*2+40 );
+ m_mode = cfg->readNumEntry("ListViewMode", 1);
+ if (m_mode < 1 || m_mode>3) m_mode = 1;
+
+ m_view->setItemTextPos( QIconView::Right );
+
+ calculateGrid();
initKeys();
loadViews();
slotViewChanged( m_views->currentItem() );
}
/*
* Unref the slave and save the keyboard manager
*/
PIconView::~PIconView() {
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
}
m_viewManager->save();
delete m_viewManager;
}
Opie::Core::OKeyConfigManager* PIconView::manager() {
return m_viewManager;
}
/*
@@ -544,71 +545,73 @@ void PIconView::slotShowImage()
if (isDir) return;
slotShowImage( name );
}
void PIconView::slotShowImage( const QString& name) {
emit sig_display( name );
}
void PIconView::slotImageInfo() {
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) return;
slotImageInfo( name );
}
void PIconView::slotImageInfo( const QString& name) {
emit sig_showInfo( name );
}
void PIconView::slotChangeMode( int mode ) {
if ( mode >= 1 && mode <= 3 )
m_mode = mode;
- 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 );
-
+ m_cfg->writeEntry("ListViewMode", m_mode);
calculateGrid();
slotReloadDir();
}
void PIconView::resizeEvent( QResizeEvent* re ) {
QVBox::resizeEvent( re );
calculateGrid();
}
void PIconView::calculateGrid() {
odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl;
odebug << "Size of view: " << m_view->size() << oendl;
+ 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);
PPixmapCache::self()->setMaxImages(40);
break;
case 3:
- m_view->setGridX(m_view->width());
+ m_view->setGridX( fontMetrics().width("testimage.jpg")+20);
m_view->setGridY(8);
PPixmapCache::self()->setMaxImages(2);
break;
case 1:
default:
- m_view->setGridX(m_view->width());
- m_view->setGridY(80);
+ m_view->setGridX( viewerWidth-3*m_view->spacing());
+ m_view->setGridY( fontMetrics().height()*2+40 );
PPixmapCache::self()->setMaxImages(20);
break;
}
}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index ef6e6df..a90231b 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -70,49 +70,51 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
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()) );
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() ) );
- viewModeButton = new ViewModeButton( bar );
+ 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);
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
index 0e4a7cb..36e5dcf 100644
--- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
+++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
@@ -1,35 +1,35 @@
#include "viewmodebutton.h"
#include <opie2/odebug.h>
#include <qtoolbar.h>
#include <qpopupmenu.h>
-ViewModeButton::ViewModeButton( QToolBar* bar )
+ViewModeButton::ViewModeButton( QToolBar* bar,int def )
: QToolButton( bar )
{
- slotChange( 1 );
+ slotChange( def );
QPopupMenu *pop= new QPopupMenu( this );
pop->setCheckable( true );
pop->insertItem( tr("Thumbnail and Imageinfo"), 1 );
pop->insertItem( tr("Thumbnail and Name" ), 2 );
pop->insertItem( tr("Name Only" ), 3 );
connect(pop, SIGNAL(activated(int)),
this, SIGNAL(changeMode(int)) );
connect(pop, SIGNAL(activated(int)),
this, SLOT(slotChange(int)) );
setPopup( pop );
}
ViewModeButton::~ViewModeButton() {
}
void ViewModeButton::slotChange( int i ) {
QString name;
switch( i ) {
case 1:
name = "opie-eye/opie-eye-thumb";
break;
case 2:
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.h b/noncore/graphics/opie-eye/gui/viewmodebutton.h
index 3247114..48f0e67 100644
--- a/noncore/graphics/opie-eye/gui/viewmodebutton.h
+++ b/noncore/graphics/opie-eye/gui/viewmodebutton.h
@@ -1,25 +1,25 @@
/*
* 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( QToolBar*,int def=1 );
~ViewModeButton();
signals:
void changeMode( int );
private slots:
void slotChange( int i );
};
#endif