summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye
authoralwin <alwin>2004-11-02 17:52:41 (UTC)
committer alwin <alwin>2004-11-02 17:52:41 (UTC)
commitebdc2d346272bae27c867b855207993985df4450 (patch) (side-by-side diff)
tree37b4710141434e33df3873c16937a6ad6a015eb4 /noncore/graphics/opie-eye
parente246d0590286f6b9b0d5d40f1a17caa78c015b21 (diff)
downloadopie-ebdc2d346272bae27c867b855207993985df4450.zip
opie-ebdc2d346272bae27c867b855207993985df4450.tar.gz
opie-ebdc2d346272bae27c867b855207993985df4450.tar.bz2
if wanted the user may search directories recursiv
Diffstat (limited to 'noncore/graphics/opie-eye') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp10
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h1
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp2
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp14
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_dirview.h2
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp32
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.cpp53
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_lister.h12
8 files changed, 96 insertions, 30 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 7c8c88d..eafff1d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -153,6 +153,7 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
}
m_path = QDir::homeDirPath();
m_mode = 0;
+ m_internalReset = false;
QHBox *hbox = new QHBox( this );
QLabel* lbl = new QLabel( hbox );
@@ -363,7 +364,9 @@ void PIconView::loadViews() {
}
void PIconView::resetView() {
+ m_internalReset = true;
slotViewChanged(m_views->currentItem());
+ m_internalReset = false;
}
/*
@@ -407,8 +410,11 @@ void PIconView::slotViewChanged( int i) {
this, SLOT(slotEnd()) );
- /* reload now with default Path*/
- m_path = lis->defaultPath();
+ /* reload now with default Path
+ * but only if it isn't a reset like from setupdlg
+ */
+ if (!m_internalReset)
+ m_path = lis->defaultPath();
QTimer::singleShot( 0, this, SLOT(slotReloadDir()));
}
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index dff55ed..bea35c2 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -95,6 +95,7 @@ private:
QString m_path;
bool m_updatet : 1;
int m_mode;
+ bool m_internalReset:1;
};
#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 6660eb2..30c9bf1 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -173,6 +173,7 @@ void PMainWindow::slotConfig() {
if ( !m_info ) {
reminfo = true;
initInfo();
+ m_info->hide();
}
keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
@@ -180,6 +181,7 @@ void PMainWindow::slotConfig() {
if ( !m_disp ) {
remdisp = true;
initDisp();
+ m_disp->hide();
}
keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
index 97e3dcb..fc502d4 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.cpp
@@ -8,7 +8,9 @@ PHUNK_VIEW_INTERFACE("Dir View", Dir_DirView );
Dir_DirView::Dir_DirView( const Config& cfg)
: PDirView(cfg)
{
- m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", true);
+ m_cfg = cfg.readBoolEntry( "Dir_Check_All_Files", false);
+ m_recursive = cfg.readBoolEntry( "Dir_Check_Recursive_Files", false);
+ m_recursive_depth = cfg.readNumEntry("Dir_Recursive_Files_Depth",10);
m_lister = 0;
m_info = 0;
}
@@ -17,13 +19,15 @@ Dir_DirView::~Dir_DirView() {
}
PInterfaceInfo* Dir_DirView::interfaceInfo()const{
- if (!m_info )
- m_info =new DirInterfaceInfo;
+ if (!m_info ) {
+ m_info = new DirInterfaceInfo;
+ }
return m_info;
}
PDirLister* Dir_DirView::dirLister()const{
- if (!m_lister )
- m_lister = new Dir_DirLister(m_cfg);
+ if (!m_lister ) {
+ m_lister = new Dir_DirLister(m_cfg,m_recursive,m_recursive_depth);
+ }
return m_lister;
}
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
index 3b9b7a6..89cf6c9 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
+++ b/noncore/graphics/opie-eye/impl/dir/dir_dirview.h
@@ -16,6 +16,8 @@ struct Dir_DirView : public PDirView {
PDirLister* dirLister()const;
private:
bool m_cfg : 1;
+ bool m_recursive:1;
+ int m_recursive_depth;
mutable PDirLister* m_lister;
mutable PInterfaceInfo *m_info;
};
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
index 9c69ce5..1e4ec40 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
@@ -16,6 +16,7 @@
#include <qhbox.h>
#include <qlabel.h>
#include <qlayout.h>
+#include <qspinbox.h>
namespace {
class DirImageWidget : public QFrame {
@@ -23,14 +24,34 @@ namespace {
DirImageWidget(): QFrame() {
setFrameStyle(Box|Raised);
QVBoxLayout *m_MainLayout = new QVBoxLayout( this, 6, 2, "m_MainLayout");
+ QGridLayout*RecDepthLayout = new QGridLayout( 0, 1, 1, 0, 6, "RecDepthLayout");
+
chkbox = new QCheckBox( QObject::tr("Show all files"), this );
m_MainLayout->addWidget(chkbox);
+ recWarningLabel = new QLabel(this);
+ recWarningLabel->setText(QObject::tr("<center><b>Be carefull with the following options!</b></center>"));
+ m_MainLayout->addWidget(recWarningLabel);
+ recBox = new QCheckBox( QObject::tr("Show files recursive"),this);
+ m_MainLayout->addWidget(recBox);
+ recDepthLabel = new QLabel(this);
+ recDepthLabel->setText(QObject::tr("Recursion depth:"));
+ RecDepthLayout->addWidget(recDepthLabel,0,0);
+ recDepth = new QSpinBox(this);
+ recDepth->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
+ recDepth->setMaxValue(10);
+ recDepth->setMinValue(1);
+ recDepth->setSuffix(QObject::tr(" directories"));
+ RecDepthLayout->addWidget(recDepth,0,1);
+ m_MainLayout->addLayout(RecDepthLayout);
QSpacerItem *spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
m_MainLayout->addItem( spacer1 );
}
~DirImageWidget() {}
- QCheckBox* chkbox;
+ QCheckBox* chkbox,*recBox;
+ QSpinBox * recDepth;
+ QLabel* recDepthLabel,*recWarningLabel;
+
};
}
@@ -46,13 +67,16 @@ QString DirInterfaceInfo::name()const {
QWidget* DirInterfaceInfo::configWidget(const Config& cfg) {
DirImageWidget* wid = new DirImageWidget();
- wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) );
-
+ wid->chkbox->setChecked(cfg.readBoolEntry("Dir_Check_All_Files",false));
+ wid->recBox->setChecked(cfg.readBoolEntry("Dir_Check_Recursive_Files",false));
+ wid->recDepth->setValue(cfg.readNumEntry("Dir_Recursive_Files_Depth",10));
return wid;
}
void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) {
owarn << "Write Config" << oendl;
DirImageWidget* wid = static_cast<DirImageWidget*>(_wid);
- cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() );
+ cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked());
+ cfg.writeEntry("Dir_Check_Recursive_Files", wid->recBox->isChecked());
+ cfg.writeEntry("Dir_Recursive_Files_Depth",wid->recDepth->value());
}
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
index d8b332a..ff33cf2 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp
@@ -16,12 +16,17 @@ using namespace Opie::Core;
#include <qdir.h>
#include <qfileinfo.h>
-Dir_DirLister::Dir_DirLister( bool list )
+Dir_DirLister::Dir_DirLister( bool list,bool rec,int recdepth )
: PDirLister( "dir_dir_lister" )
{
m_allFiles = list;
+ m_recursive = rec;
+ m_recDepth = recdepth;
+ if (m_recDepth<1) m_recDepth = 1;
+ if (m_recDepth>10) m_recDepth = 10;
owarn << "All Files " << m_allFiles << "" << oendl;
SlaveHelper::slaveConnectSignals( this );
+ m_Filter = (m_allFiles?"*":"*.jpg;*.jpeg;*.JPG;*.PNG;*.GIF;*.BMP;*.png;*.bmp;*.gif");
}
QString Dir_DirLister::defaultPath()const {
@@ -46,24 +51,38 @@ QStringList Dir_DirLister::folders()const {
return m_currentDir.entryList( QDir::Dirs );
}
-QStringList Dir_DirLister::files()const {
- if ( m_allFiles )
- return m_currentDir.entryList( QDir::Files );
- else {
- QStringList out;
- QStringList list = m_currentDir.entryList( QDir::Files | QDir::Readable );
- for (QStringList::Iterator it = list.begin(); it != list.end();++it ) {
- QFileInfo inf( *it );
- QString ext = inf.extension(false).lower();
- if( ext == QString::fromLatin1("jpg") ||
- ext == QString::fromLatin1("jpeg" ) ||
- ext == QString::fromLatin1("png" ) ||
- ext == QString::fromLatin1("bmp" ) ||
- ext == QString::fromLatin1("gif" ) )
- out.append( *it );
+QStringList Dir_DirLister::recFiles(const QString&aPath,int currentDepth)const
+{
+ QStringList all;
+ if (currentDepth>m_recDepth) return all;
+
+ QString subPath;
+ subPath = aPath;
+ if (subPath.length()==0) {
+ subPath=".";
+ }
+ QDir checkDir(currentPath()+"/"+aPath);
+
+ QStringList p = checkDir.entryList( QDir::Dirs );
+ all+=checkDir.entryList(m_Filter,QDir::Files|QDir::Readable);
+ QStringList tmp;
+ for (unsigned i = 0; i < p.count();++i) {
+ if (p[i]=="." || p[i]=="..") continue;
+ tmp =recFiles(subPath+"/"+p[i],currentDepth+1);
+ for (unsigned j = 0; j < tmp.count();++j) {
+ all.append(p[i]+"/"+tmp[j]);
}
- return out;
}
+ return all;
+}
+
+QStringList Dir_DirLister::files()const
+{
+ if (m_recursive) {
+ odebug << "Startpfad: "<<m_currentDir.absPath()<<oendl;
+ return recFiles("",0);
+ }
+ return m_currentDir.entryList(m_Filter,QDir::Files|QDir::Readable);
}
void Dir_DirLister::deleteImage( const QString& fl) {
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.h b/noncore/graphics/opie-eye/impl/dir/dir_lister.h
index d6ca6c0..445adbf 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_lister.h
+++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.h
@@ -13,7 +13,7 @@ class Config;
class Dir_DirLister : public PDirLister {
Q_OBJECT
public:
- Dir_DirLister( bool );
+ Dir_DirLister(bool,bool,int);
virtual ~Dir_DirLister(){}
QString defaultPath()const;
@@ -30,8 +30,16 @@ public:
virtual QString nameToFname(const QString&name)const;
private:
- bool m_allFiles;
+ bool m_allFiles:1;
+ bool m_recursive:1;
+ int m_recDepth;
QDir m_currentDir;
+ //! recursive listing.
+ /*!
+ * \param path this is the offset to the current path. eg. when currentDepth = 0 then it MUST empty
+ */
+ QStringList recFiles(const QString&path,int currentDepth)const;
+ QString m_Filter;
};
#endif