summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp3
-rw-r--r--noncore/graphics/opie-eye/phunk_view.pro2
2 files changed, 3 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index aeaa3c6..74a8d0f 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -41,96 +41,97 @@ namespace {
void reCalc();
private:
mutable QPixmap* m_pix;
QString m_path;
bool m_isDir : 1;
bool m_noInfo :1;
};
/*
* If we request an Image or String
* we add it to the map
*/
QMap<QString, IconViewItem*> g_stringInf;
QMap<QString, IconViewItem*> g_stringPix;
IconViewItem::IconViewItem( QIconView* view,const QString& path,
const QString& name, bool isDir )
: QIconViewItem( view ), m_path( path ), m_isDir( isDir ),
m_noInfo( false )
{
QIconViewItem::setText( name );
if ( isDir && !_dirPix )
_dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
else if ( !isDir && !_unkPix )
_unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
}
inline QPixmap* IconViewItem::pixmap()const {
if ( m_isDir )
return _dirPix;
else{
if (!m_noInfo && !g_stringInf.contains( m_path ) ) {
currentView()->dirLister()->imageInfo( m_path );
g_stringInf.insert( m_path, const_cast<IconViewItem*>(this));
}
m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 );
if ( !m_pix && !g_stringPix.contains( m_path )) {
currentView()->dirLister()->thumbNail( m_path, 64, 64 );
g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
}
return m_pix ? m_pix : _unkPix;
}
}
inline void IconViewItem::setText( const QString& str ) {
QString text = QIconViewItem::text()+"\n"+str;
m_noInfo = true;
QIconViewItem::setText( text );
+ reCalc();
}
inline void IconViewItem::reCalc()
{
calcRect();
}
}
PIconView::PIconView( QWidget* wid, Config* cfg )
: QVBox( wid ), m_cfg( cfg )
{
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
}
m_path = QDir::homeDirPath();
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*)) );
m_view->setArrangement( QIconView::LeftToRight );
m_view->setItemTextPos( QIconView::Right );
m_view->setResizeMode(QIconView::Adjust);
int dw = QApplication::desktop()->width();
int viewerWidth = dw-style().scrollBarExtent().width();
m_view->setGridX( viewerWidth-2*m_view->spacing() );
m_view->setGridY( fontMetrics().height()*2+40 );
loadViews();
slotViewChanged( m_views->currentItem() );
}
PIconView::~PIconView() {
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
}
}
void PIconView::slotDirUp() {
@@ -221,97 +222,97 @@ void PIconView::slotViewChanged( int i) {
connect(lis, SIGNAL(sig_start()),
this, SLOT(slotStart()));
connect(lis, SIGNAL(sig_end()) ,
this, SLOT(slotEnd()) );
/* reload now */
QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
}
void PIconView::slotReloadDir() {
slotChangeDir( m_path );
}
void PIconView::addFolders( const QStringList& lst) {
QStringList::ConstIterator it;
for(it=lst.begin(); it != lst.end(); ++it ) {
(void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true );
}
}
void PIconView::addFiles( const QStringList& lst) {
QStringList::ConstIterator it;
for (it=lst.begin(); it!= lst.end(); ++it )
(void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) );
}
void PIconView::slotClicked(QIconViewItem* _it) {
if(!_it )
return;
IconViewItem* it = static_cast<IconViewItem*>(_it);
if( it->isDir() )
slotChangeDir( it->path() );
else // view image
;
}
void PIconView::slotThumbInfo( const QString& _path, const QString& str ) {
if ( g_stringInf.contains( _path ) ) {
IconViewItem* item = g_stringInf[_path];
/* if set the view shows nonsens!
I dont know how to fix the format of displayed text :(*/
- //item->setText( str );
+ item->setText( str );
item->repaint();
g_stringInf.remove( _path );
}
}
void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
if ( g_stringPix.contains( _path ) ) {
IconViewItem* item = g_stringPix[_path];
if (pix.width()>0) {
PPixmapCache::self()->insertImage( _path, pix, 64, 64 );
/* required for a recalculated rectangle. otherwise the view show nonsense! */
item->reCalc();
} else {
PPixmapCache::self()->insertImage(_path,Resource::loadPixmap( "UnknownDocument" ),64,64 );
}
item->repaint();
g_stringPix.remove( _path );
}
}
void PIconView::slotRename() {
}
void PIconView::slotBeam() {
bool isDir;
QString pa = currentFileName( isDir );
if ( isDir && pa.isEmpty() )
return;
Ir* ir = new Ir( this );
connect( ir, SIGNAL(done(Ir*)),
this, SLOT(slotBeamDone(Ir*)));
ir->send(pa, tr( "Image" ) );
}
void PIconView::slotBeamDone( Ir* ir) {
delete ir;
}
void PIconView::slotStart() {
m_view->setUpdatesEnabled( false );
}
void PIconView::slotEnd() {
m_view->setUpdatesEnabled( true );
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro
index 0bb5679..3547af0 100644
--- a/noncore/graphics/opie-eye/phunk_view.pro
+++ b/noncore/graphics/opie-eye/phunk_view.pro
@@ -1,34 +1,34 @@
-CONFIG += qt warn_on #quick-app
+CONFIG += qt warn_on quick-app
DESTDIR = $(OPIEDIR)/bin
TEMPLATE = app
TARGET = opie-eye
# the name of the resulting object
HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \
lib/imagecache.h impl/dir/dir_dirview.h \
iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \
impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \
lib/slavemaster.h \
iface/slaveiface.h
# A list header files
SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \
lib/imagecache.cpp lib/viewmap.cpp \
impl/dir/dir_dirview.cpp iface/dirlister.cpp \
iface/dirview.cpp impl/dir/dir_lister.cpp \
impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp
# A list of source files
INTERFACES =
# list of ui files
INCLUDEPATH += . $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopieui2
include ( $(OPIEDIR)/include.pro )