summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/okeyconfigwidget.h96
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp5
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp8
-rw-r--r--noncore/graphics/opie-eye/phunk_view.pro2
-rw-r--r--noncore/graphics/opie-eye/slave/slavereciever.cpp11
-rw-r--r--noncore/graphics/opie-eye/slave/slavereciever.h2
6 files changed, 116 insertions, 8 deletions
diff --git a/libopie2/opieui/okeyconfigwidget.h b/libopie2/opieui/okeyconfigwidget.h
new file mode 100644
index 0000000..d76ea46
--- a/dev/null
+++ b/libopie2/opieui/okeyconfigwidget.h
@@ -0,0 +1,96 @@
+#ifndef ODP_KEY_CONFIG_WIDGET_H
+#define ODP_KEY_CONFIG_WIDGET_H
+
+#include <opie2/oconfig.h>
+
+#include <qstring.h>
+#include <qpixmap.h>
+#include <qbytearray.h>
+#include <qhbox.h>
+#include <qvaluelist.h>
+
+class QKeyEvent;
+
+namespace Opie {
+namespace Ui {
+
+class OKeyConfigItem {
+ friend class OKeyConfigManager;
+public:
+ typedef QValueList<OKeyConfigItem> OKeyConfigItemList;
+ OKeyConfigItem( const QString& text = QString::null , const QCString& config_key = QCString(),
+ const QPixmap& symbol = QPixmap(),
+ int key = 0, int mod = 0,
+ int default_key = 0, int default_modified = 0 );
+ ~OKeyConfigItem();
+
+ QString text()const;
+ QPixmap pixmap()const;
+ int key()const;
+ int modifier()const;
+ int defaultKey()const;
+ int defaultModifier()const;
+
+ void setText( const QString& text );
+ void setPixmap( const QPixmap& );
+ void setKey( int );
+ void setModied( int );
+ void setDefaultKey( int );
+ void setDefaultModifier( int );
+
+ bool isConfigured()const;
+ bool isEmpty()const;
+private:
+ QString m_text;
+ QCString m_config;
+ QPixmap m_pix;
+ int m_key;
+ int m_mod;
+ int m_defKey;
+ int m_defMod;
+ class Private;
+ Private *d;
+};
+
+
+class OKeyConfig : public QObject {
+ Q_OBJECT
+public:
+ OKeyConfig(Opie::Core::OConfig *conf = 0, bool grabkeyboard);
+ ~OKeyConfig();
+
+ void load();
+ void save();
+
+ OKeyConfigItem handleKeyEvent( QKeyEvent* );
+ QString handleKeyEventString( QKeyEvent* );
+
+ void addKeyConfig( const OKeyConfigItem& );
+ void removeKeyConfig( const OKeyConfigItem& );
+signals:
+ void keyConfigChanged( OKeyConfig* );
+
+private:
+ OKeyConfigItemList m_keys;
+};
+
+
+class OKeyConfigWidget : public QHBox {
+ Q_OBJECT
+public:
+ enum ChangeMode { Imediate, Queu };
+ OKeyConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ OKeyConfigWidget( OKeyConfig *, QWidget* parent = 0, const char* = 0, WFlags = 0 );
+ ~OKeyConfigWidget();
+
+ void setChangeMode( enum ChangeMode );
+ ChangeMode changeMode()const;
+
+ void reload();
+};
+
+}
+}
+
+
+#endif
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 38a621e..729b64f 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -72,77 +72,80 @@ namespace {
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 );
}
}
PIconView::PIconView( QWidget* wid, Config* cfg )
: QVBox( wid ), m_cfg( cfg )
{
{
-// QCopEnvelope( "QPE/Application/opie-eye_slave", "foo()" );
+ 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 );
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() {
QDir dir( m_path );
dir.cdUp();
slotChangeDir( dir.absPath() );
}
void PIconView::slotChangeDir(const QString& path) {
if ( !currentView() )
return;
PDirLister *lister = currentView()->dirLister();
if (!lister )
return;
lister->setStartPath( path );
m_path = lister->currentPath();
m_view->clear();
addFolders( lister->folders() );
addFiles( lister->files() );
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 0a2fcab..ea765d1 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,51 +1,51 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qmap.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/ir.h>
-#include <opie/oapplicationfactory.h>
-#include <opie/otabwidget.h>
+#include <opie2/oapplicationfactory.h>
+#include <opie2/otabwidget.h>
#include <iface/ifaceinfo.h>
#include <iface/dirview.h>
#include "iconview.h"
#include "filesystem.h"
#include "mainwindow.h"
-OPIE_EXPORT_APP( OApplicationFactory<PMainWindow> )
+OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> )
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
: QMainWindow( wid, name, style ), m_cfg("phunkview")
{
setCaption( QObject::tr("Opie Eye Caramba" ) );
m_cfg.setGroup("Zecke_view" );
/*
* Initialize ToolBar and IconView
* And Connect Them
*/
QToolBar *bar = new QToolBar( this );
bar->setHorizontalStretchable( true );
setToolBarsMovable( false );
m_view = new PIconView( this, &m_cfg );
setCentralWidget( m_view );
QToolButton *btn = new QToolButton( bar );
btn->setIconSet( Resource::loadIconSet( "up" ) );
connect( btn, SIGNAL(clicked()),
m_view, SLOT(slotDirUp()) );
btn = new PFileSystem( bar );
connect( btn, SIGNAL( changeDir( const QString& ) ),
@@ -63,49 +63,49 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
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() ) );
}
PMainWindow::~PMainWindow() {
}
void PMainWindow::slotConfig() {
QDialog dlg(this, 0, true);
dlg.setCaption( tr("Phunk View - Config" ) );
QHBoxLayout *lay = new QHBoxLayout(&dlg);
- OTabWidget *wid = new OTabWidget(&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, QString::null, inf->name() );
}
dlg.showMaximized();
bool act = ( dlg.exec() == QDialog::Accepted );
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();
}
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro
index 21178ee..0bb5679 100644
--- a/noncore/graphics/opie-eye/phunk_view.pro
+++ b/noncore/graphics/opie-eye/phunk_view.pro
@@ -8,27 +8,27 @@ 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 -lopie
+LIBS += -lqpe -lopieui2
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/graphics/opie-eye/slave/slavereciever.cpp b/noncore/graphics/opie-eye/slave/slavereciever.cpp
index c8e33d4..bbbbb30 100644
--- a/noncore/graphics/opie-eye/slave/slavereciever.cpp
+++ b/noncore/graphics/opie-eye/slave/slavereciever.cpp
@@ -36,49 +36,49 @@ QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
* GUI sends no QPIxmap!!!
*/
QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) {
s >> inf.file >> inf.width >> inf.height;
qWarning( "Recieved %s %d %d", inf.file.latin1(), inf.width, inf.height );
return s;
}
QDataStream &operator<<( QDataStream& s, const ImageInfo& i) {
return s << i.kind << i.file << i.info;
}
QDataStream &operator>>( QDataStream& s, ImageInfo& i ) {
s >> i.kind >> i.file >> i.info;
return s;
}
SlaveObjects* slaveObjects() {
if ( !_slaveObj )
_slaveObj = new SlaveObjects;
return _slaveObj;
}
SlaveReciever::SlaveReciever( QObject* par)
- : QObject( par )
+ : QObject( par ), m_refs( 0 )
{
m_inf = new QTimer(this);
connect(m_inf,SIGNAL(timeout()),
this, SLOT(slotImageInfo()));
m_pix = new QTimer(this);
connect(m_pix,SIGNAL(timeout()),
this, SLOT(slotThumbNail()));
m_out = new QTimer(this);
connect(m_out,SIGNAL(timeout()),
this, SLOT(slotSend()));
SlaveObjects *obj = slaveObjects(); // won't be changed
SlaveMap::Iterator it;
SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!!
for(it = map->begin(); it != map->end(); ++it ) {
obj->insert( it.key(), (*it.data())() );
}
}
SlaveReciever::~SlaveReciever() {
}
void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) {
@@ -99,57 +99,64 @@ void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar)
m_inList.append(inf);
}
}else if ( string == "fullInfo(QString)" ) {
inf.kind = true;
stream >> inf.file;
m_inList.append(inf);
}else if ( string == "fullInfos(QStringList)" ) {
stream >> lst;
for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
qWarning( "Adding fullInfo for"+ *it );
inf.file = (*it);
inf.kind = true;
m_inList.append(inf);
}
}else if ( string == "pixmapInfo(QString,int,int)" ) {
stream >> pix.file >> pix.width >> pix.height;
m_inPix.append(pix);
}else if ( string == "pixmapInfos(PixmapInfos)" ) {
PixmapList list;
stream >> list;
for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) {
qWarning( "Got %d %d " + (*it).file, (*it).width , (*it).height );
m_inPix.append(*it);
}
+ }else if ( string == "refUp()" ) {
+ m_refs++;
+ }else if ( string == "refDown()" ) {
+ m_refs--;
}
if (!m_inf->isActive() && !m_inList.isEmpty() )
m_inf->start(5);
if (!m_pix->isActive() && !m_inPix.isEmpty() )
m_pix->start(5);
- QPEApplication::setKeepRunning();
+ if ( m_refs )
+ QPEApplication::setKeepRunning();
+ else
+ qApp->quit();
}
PixmapList SlaveReciever::outPix()const {
return m_outPix;
}
StringList SlaveReciever::outInf()const{
return m_outList;
}
void SlaveReciever::slotImageInfo() {
ImageInfo inf = m_inList.first();
m_inList.remove( inf );
static SlaveObjects::Iterator it;
static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!!
for(it = map->begin(); it != map->end(); ++it ) {
if( (*it)->supports(inf.file ) ) {
/* full image info */
if (inf.kind )
inf.info = (*it)->fullImageInfo( inf.file );
else
inf.info = (*it)->iconViewName( inf.file );
diff --git a/noncore/graphics/opie-eye/slave/slavereciever.h b/noncore/graphics/opie-eye/slave/slavereciever.h
index 214bfc6..b5aaccf 100644
--- a/noncore/graphics/opie-eye/slave/slavereciever.h
+++ b/noncore/graphics/opie-eye/slave/slavereciever.h
@@ -31,28 +31,30 @@ class SlaveReciever : public QObject {
friend QDataStream &operator<<( QDataStream&, const PixmapInfo& );
friend QDataStream &operator>>( QDataStream&, PixmapInfo& );
friend QDataStream &operator<<( QDataStream&, const ImageInfo& );
friend QDataStream &operator>>( QDataStream&, ImageInfo );
public:
enum Job { ImageInfoJob, FullImageInfoJob, ThumbNailJob };
SlaveReciever( QObject* parent );
~SlaveReciever();
public slots:
void recieveAnswer( const QCString&, const QByteArray& );
public:
PixmapList outPix()const;
StringList outInf()const;
private slots:
void slotSend();
void slotImageInfo();
void slotThumbNail();
private:
QTimer *m_inf, *m_pix, *m_out;
StringList m_inList, m_outList;
PixmapList m_inPix, m_outPix;
+private:
+ int m_refs;
};
#endif