summaryrefslogtreecommitdiff
authordrw <drw>2005-05-23 23:25:38 (UTC)
committer drw <drw>2005-05-23 23:25:38 (UTC)
commit3e2acb4665ddcdb24e0749e3ebfc589313be0065 (patch) (side-by-side diff)
treeb7884a189d1b4928e61d71c1c4b5f908205a3655
parent71ecaf241641c2c58b997df56074cf4849e6d6c5 (diff)
downloadopie-3e2acb4665ddcdb24e0749e3ebfc589313be0065.zip
opie-3e2acb4665ddcdb24e0749e3ebfc589313be0065.tar.gz
opie-3e2acb4665ddcdb24e0749e3ebfc589313be0065.tar.bz2
Resource -> OResource
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/filesystem.cpp5
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp29
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.cpp8
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp38
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp73
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.cpp2
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.h2
7 files changed, 93 insertions, 64 deletions
diff --git a/noncore/graphics/opie-eye/gui/filesystem.cpp b/noncore/graphics/opie-eye/gui/filesystem.cpp
index 8efcdf7..d84e9f8 100644
--- a/noncore/graphics/opie-eye/gui/filesystem.cpp
+++ b/noncore/graphics/opie-eye/gui/filesystem.cpp
@@ -1,42 +1,43 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#include <stdlib.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
+
#include <qpe/storage.h>
#include "filesystem.h"
PFileSystem::PFileSystem( QToolBar* bar)
: QToolButton( bar )
{
- setIconSet( Resource::loadIconSet( "cardmon/pcmcia" ) );
+ setIconSet( Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ) );
m_pop = new QPopupMenu( this );
connect( m_pop, SIGNAL( activated( int ) ),
this, SLOT(slotSelectDir( int ) ) );
m_storage = new StorageInfo();
connect(m_storage, SIGNAL(disksChanged() ),
this, SLOT( changed() ) );
changed();
connect(this,SIGNAL(pressed()),SLOT(slotPopUp()));
}
PFileSystem::~PFileSystem() {
delete m_storage;
}
void PFileSystem::changed() {
m_pop->clear();
m_dev.clear();
/* home dir, too */
QString f = getenv( "HOME" );
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 59091a8..9365932 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -1,44 +1,44 @@
/*
* GPLv2 zecke@handhelds.org
* No WArranty...
*/
#include "iconview.h"
#include "messagebox.h"
#include <lib/imagecache.h>
#include <gui/imageinfoui.h>
#include <iface/dirview.h>
#include <iface/dirlister.h>
#include <opie2/oconfig.h>
#include <opie2/okeyconfigwidget.h>
#include <opie2/odebug.h>
#include <opie2/oimagescrollview.h>
+#include <opie2/oresource.h>
-#include <qpe/resource.h>
#include <qpe/qpemessagebox.h>
#include <qpe/ir.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qiconview.h>
#include <qlabel.h>
#include <qhbox.h>
#include <qcombobox.h>
#include <qdir.h>
#include <qapplication.h>
#include <qmainwindow.h>
#include <qtimer.h>
#include <qstyle.h>
using Opie::Core::OKeyConfigItem;
const int PIconView::sMAX_ICON_SIZE = 128;
const int PIconView::sMIN_ICON_SIZE = 12;
const int PIconView::sDEF_ICON_SIZE = 64;
/*
* The Icons, Request Cache and IconViewItem for the IconView
@@ -81,53 +81,53 @@ namespace {
void setText( const QString& );
};
class ThumbViewItem : public IconViewItem {
ThumbViewItem( QIconView*, const QString& path, const QString& name, int a_iconsize, bool isDir = false );
QPixmap *pixmap()const;
void setText( const QString& );
};
/*
* If we request an Image or String
* we add it to the map
*/
static QMap<QString, IconViewItem*> g_stringInf;
static QMap<QString, IconViewItem*> g_stringPix;
IconViewItem::IconViewItem( QIconView* view,const QString& path,
const QString& name, int a_iconsize, bool isDir)
: QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ),
m_noInfo( false ),m_textOnly(false),m_Pixset(false)
{
m_iconsize = a_iconsize;
if ( isDir ) {
if (!_dirPix ) {
- _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser"));
+ _dirPix = new QPixmap( Opie::Core::OResource::loadPixmap("advancedfm/FileBrowser", Opie::Core::OResource::SmallIcon));
}
} else {
if (!_unkPix ) {
- _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) );
+ _unkPix = new QPixmap( Opie::Core::OResource::loadPixmap( "UnknownDocument", Opie::Core::OResource::SmallIcon ) );
}
}
check_pix();
}
inline void IconViewItem::check_pix()const
{
if (_dirPix && _dirPix->width()>m_iconsize) {
QImage Pix = _dirPix->convertToImage();
*_dirPix = Pix.smoothScale(m_iconsize,m_iconsize);
}
if (!_cpyPix && _unkPix) {
if (_unkPix->width()>=m_iconsize) {
QImage Pix = _unkPix->convertToImage();
_cpyPix = new QPixmap();
if (_unkPix->width()>m_iconsize) {
*_cpyPix = Pix.smoothScale(m_iconsize,m_iconsize);
} else {
_cpyPix->convertFromImage(Pix);
}
} else {
_cpyPix = new QPixmap(m_iconsize,m_iconsize);
_cpyPix->fill();
@@ -249,66 +249,66 @@ PIconView::~PIconView() {
m_viewManager->save();
delete m_viewManager;
}
Opie::Core::OKeyConfigManager* PIconView::manager() {
return m_viewManager;
}
/*
* init the KeyBoard Shortcuts
* called from the c'tor
*/
void PIconView::initKeys() {
Opie::Core::OKeyPair::List lst;
lst.append( Opie::Core::OKeyPair::upArrowKey() );
lst.append( Opie::Core::OKeyPair::downArrowKey() );
lst.append( Opie::Core::OKeyPair::leftArrowKey() );
lst.append( Opie::Core::OKeyPair::rightArrowKey() );
lst.append( Opie::Core::OKeyPair::returnKey() );
m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config",
lst, false,this, "keyconfig name" );
m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam",
- Resource::loadPixmap("beam"), BeamItem,
- Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton),
+ Opie::Core::OResource::loadPixmap("beam", Opie::Core::OResource::SmallIcon),
+ BeamItem, Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton),
this, SLOT(slotBeam())) );
m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
- Resource::loadPixmap("trash"), DeleteItem,
- Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton),
+ Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),
+ DeleteItem, Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton),
this, SLOT(slotTrash())) );
m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
- Resource::loadPixmap("1to1"), ViewItem,
- Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
+ Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
+ ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
this, SLOT(slotShowImage())));
m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
- Resource::loadPixmap("DocumentTypeWord"), InfoItem,
- Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
+ Opie::Core::OResource::loadPixmap("DocumentTypeWord", Opie::Core::OResource::SmallIcon),
+ InfoItem, Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
this, SLOT(slotImageInfo()) ) );
m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow",
- Resource::loadPixmap("1to1"), SlideItem,
- Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton),
+ Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
+ SlideItem, Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton),
this, SLOT(slotStartSlide())));
m_viewManager->load();
m_viewManager->handleWidget( m_view );
}
/*
* change one dir up
*/
void PIconView::slotDirUp()
{
slotChangeDir( currentView()->dirLister()->dirUp( m_path ) );
}
/*
* change the dir
*/
void PIconView::slotChangeDir(const QString& path) {
if ( !currentView() )
return;
PDirLister *lister = currentView()->dirLister();
if (!lister )
return;
@@ -621,49 +621,50 @@ void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) {
return;
if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(),
m_view->contentsWidth(), m_view->contentsHeight() ) ) )
m_updatet = true;
if (pix.width()>0) {
if (pix.width()<m_iconsize) {
QPixmap p(m_iconsize,m_iconsize);
p.fill();
QPainter pa(&p);
int offset = (m_iconsize-pix.width())/2;
int offy = (m_iconsize-pix.height())/2;
if (offy<0) offy=0;
pa.drawPixmap(offset,offy,pix);
pa.end();
PPixmapCache::self()->insertImage( _path, p, m_iconsize, m_iconsize );
item->setPixmap(p,true);
} else {
PPixmapCache::self()->insertImage( _path, pix, m_iconsize, m_iconsize );
item->setPixmap(pix,true);
}
} else {
- PPixmapCache::self()->insertImage( _path, Resource::loadPixmap( "UnknownDocument" ), m_iconsize, m_iconsize );
+ PPixmapCache::self()->insertImage( _path, Opie::Core::OResource::loadPixmap( "UnknownDocument",
+ Opie::Core::OResource::SmallIcon ), m_iconsize, m_iconsize );
}
g_stringPix.remove( _path );
m_view->arrangeItemsInGrid(true);
}
/*
* FIXME rename
*/
void PIconView::slotRename() {
}
/*
* BEAM the current file
*/
void PIconView::slotBeam() {
bool isDir;
QString pa = currentFileName( isDir );
if ( isDir && pa.isEmpty() )
return;
Ir* ir = new Ir( this );
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
index 7afb62d..8f70602 100644
--- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp
+++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
@@ -1,48 +1,48 @@
#include "imageinfoui.h"
#include <qframe.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qtextview.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qstring.h>
#include <qfileinfo.h>
#include "lib/slavemaster.h"
#include "lib/imagecache.h"
#include <opie2/oconfig.h>
#include <opie2/okeyconfigwidget.h>
#include <opie2/odebug.h>
+#include <opie2/oresource.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qpe/resource.h>
static const int THUMBSIZE = 128;
using namespace Opie::Core;
imageinfo::imageinfo(Opie::Core::OConfig *cfg,QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
m_viewManager = 0;
m_cfg = cfg;
init(name);
initKeys();
}
imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl ),currentFile(_path)
{
m_viewManager = 0;
m_cfg = 0;
init(name);
initKeys();
slotChangeName(_path);
}
@@ -51,50 +51,50 @@ Opie::Core::OKeyConfigManager* imageinfo::manager()
if (!m_viewManager) {
initKeys();
}
return m_viewManager;
}
void imageinfo::initKeys()
{
#if 0
if (!m_cfg) {
m_cfg = new Opie::Core::OConfig("phunkview");
m_cfg->setGroup("imageinfo_keys" );
}
#endif
Opie::Core::OKeyPair::List lst;
lst.append( Opie::Core::OKeyPair::upArrowKey() );
lst.append( Opie::Core::OKeyPair::downArrowKey() );
lst.append( Opie::Core::OKeyPair::leftArrowKey() );
lst.append( Opie::Core::OKeyPair::rightArrowKey() );
lst.append( Opie::Core::OKeyPair::returnKey() );
m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "imageinfo_keys",
lst, false,this, "keyconfig name" );
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Full Image"), "infoview",
- Resource::loadPixmap("1to1"), ViewItem,
- Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
+ Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
+ ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
this, SLOT(slotShowImage())));
m_viewManager->load();
m_viewManager->handleWidget( this );
m_viewManager->handleWidget( TextView1 );
}
void imageinfo::slotShowImage()
{
emit dispImage(currentFile);
}
void imageinfo::init(const char* name) {
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
}
if ( !name )
setName( "imageinfo" );
resize( 289, 335 );
setCaption( tr( "Image info" ) );
imageinfoLayout = new QVBoxLayout( this );
imageinfoLayout->setSpacing(2);
imageinfoLayout->setMargin(4);
PixmapLabel1 = new QLabel( this, "PixmapLabel1" );
@@ -114,49 +114,49 @@ void imageinfo::init(const char* name) {
TextView1->setFrameShadow( QTextView::Sunken );
TextView1->setResizePolicy( QTextView::AutoOneFit );
TextView1->setBackgroundOrigin( QTextView::ParentOrigin );
TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) );
// TextView1->setVScrollBarMode(QScrollView::AlwaysOn);
QWhatsThis::add( TextView1, tr("Displays info of selected image") );
imageinfoLayout->addWidget( TextView1 );
SlaveMaster* master = SlaveMaster::self();
connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
this, SLOT(slot_fullInfo(const QString&, const QString&)) );
connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
}
void imageinfo::slotChangeName(const QString&_path)
{
currentFile=_path;
QFileInfo fi(_path);
fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>");
SlaveMaster::self()->imageInfo( currentFile );
QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE );
if (!m_pix) {
- PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" )));
+ PixmapLabel1->setPixmap(QPixmap( Opie::Core::OResource::loadPixmap( "UnknownDocument", Opie::Core::OResource::SmallIcon )));
SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE);
} else {
PixmapLabel1->setPixmap(*m_pix);
}
}
imageinfo::~imageinfo()
{
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
}
if (m_viewManager) {
delete m_viewManager;
}
}
void imageinfo::slot_fullInfo(const QString&_path, const QString&_t)
{
if (_path == currentFile) {
odebug << _t << oendl;
QString t = _t;
t.replace(QRegExp("\n"),"<br>");
TextView1->setText(t);
}
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index b919ca8..cda1a96 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -1,31 +1,31 @@
#include "imageview.h"
#include <opie2/odebug.h>
#include <opie2/oconfig.h>
#include <opie2/okeyconfigwidget.h>
+#include <opie2/oresource.h>
-#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpopupmenu.h>
#include <qtimer.h>
#include <qaction.h>
using namespace Opie::Core;
ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
: Opie::MM::OImageScrollView(parent,name,fl)
{
m_viewManager = 0;
focus_in_count = 0;
m_cfg = cfg;
m_isFullScreen = false;
m_ignore_next_in = false;
m_slideTimer = 0;
QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
initKeys();
m_slideValue = 5;
m_gDisplayType = 0;
m_gPrevNext = 0;
m_hGroup = 0;
@@ -142,85 +142,85 @@ void ImageView::initKeys()
odebug << "init imageview keys" << oendl;
if (!m_cfg) {
m_cfg = new Opie::Core::OConfig("opie-eye");
m_cfg->setGroup("image_view_keys" );
}
Opie::Core::OKeyPair::List lst;
lst.append( Opie::Core::OKeyPair::upArrowKey() );
lst.append( Opie::Core::OKeyPair::downArrowKey() );
lst.append( Opie::Core::OKeyPair::leftArrowKey() );
lst.append( Opie::Core::OKeyPair::rightArrowKey() );
lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0));
m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys",
lst, false,this, "image_view_keys" );
/**
* Handle KeyEvents when they're pressed. This avoids problems
* with 'double next' on Return.
* The Return press would switch to this view and the return
* release would emit the dispNext Signal.
*/
m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed );
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
- Resource::loadPixmap("1to1"), ViewInfo,
- Opie::Core::OKeyPair(Qt::Key_I,0),
+ Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
+ ViewInfo, Opie::Core::OKeyPair(Qt::Key_I,0),
this, SLOT(slotShowImageInfo())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate",
- Resource::loadPixmap("rotate"), Autorotate,
- Opie::Core::OKeyPair(Qt::Key_R,0),
+ Opie::Core::OResource::loadPixmap("rotate", Opie::Core::OResource::SmallIcon),
+ Autorotate, Opie::Core::OKeyPair(Qt::Key_R,0),
this, SIGNAL(toggleAutorotate())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
- Resource::loadPixmap("1to1"), Autoscale,
- Opie::Core::OKeyPair(Qt::Key_S,0),
+ Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
+ Autoscale, Opie::Core::OKeyPair(Qt::Key_S,0),
this, SIGNAL(toggleAutoscale())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext",
- Resource::loadPixmap("forward"), ShowNext,
- Opie::Core::OKeyPair(Qt::Key_Return,0),
+ Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon),
+ ShowNext, Opie::Core::OKeyPair(Qt::Key_Return,0),
this, SIGNAL(dispNext())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev",
- Resource::loadPixmap("back"), ShowPrevious,
- Opie::Core::OKeyPair(Qt::Key_P,0),
+ Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon),
+ ShowPrevious, Opie::Core::OKeyPair(Qt::Key_P,0),
this, SIGNAL(dispPrev())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
- Resource::loadPixmap("fullscreen"), FullScreen,
- Opie::Core::OKeyPair(Qt::Key_F,0),
+ Opie::Core::OResource::loadPixmap("fullscreen", Opie::Core::OResource::SmallIcon),
+ FullScreen, Opie::Core::OKeyPair(Qt::Key_F,0),
this, SIGNAL(toggleFullScreen())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer",
- Resource::loadPixmap("mag"), Zoomer,
- Opie::Core::OKeyPair(Qt::Key_T,0),
+ Opie::Core::OResource::loadPixmap("mag", Opie::Core::OResource::SmallIcon),
+ Zoomer, Opie::Core::OKeyPair(Qt::Key_T,0),
this, SIGNAL(toggleZoomer())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Increase brightness"), "incbrightness",
- Resource::loadPixmap("up"), Incbrightness,
- Opie::Core::OKeyPair(Qt::Key_B,0),
+ Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon),
+ Incbrightness, Opie::Core::OKeyPair(Qt::Key_B,0),
this, SIGNAL(incBrightness())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Decrease brightness"), "decbrightness",
- Resource::loadPixmap("down"), Decbrightness,
- Opie::Core::OKeyPair(Qt::Key_D,0),
+ Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon),
+ Decbrightness, Opie::Core::OKeyPair(Qt::Key_D,0),
this, SIGNAL(decBrightness())));
m_viewManager->handleWidget( this );
m_viewManager->load();
}
void ImageView::keyReleaseEvent(QKeyEvent * e)
{
if (!e || e->state()!=0) {
return;
}
if (e->key()==Qt::Key_Escape) {
if (fullScreen()) {
emit hideMe();
}
if (closeIfHide) {
QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
}
}
}
void ImageView::setCloseIfHide(bool how)
{
closeIfHide = how;
}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 3efbb53..d4c5b42 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,49 +1,49 @@
/*
* 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 <opie2/owait.h>
#include <opie2/oapplication.h>
+#include <opie2/oresource.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>
#include <qspinbox.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" ) );
m_cfg = new Opie::Core::OConfig("opie-eye");
@@ -496,179 +496,204 @@ void PMainWindow::dirChanged()
m_dev.insert("Home directory",f);
fsMenu->insertItem("Home directory");
}
const QList<FileSystem> &fs = m_storage->fileSystems();
QListIterator<FileSystem> it(fs );
for ( ; it.current(); ++it ) {
const QString disk = (*it)->name();
const QString path = (*it)->path();
m_dev.insert( disk, path );
fsMenu->insertItem( disk );
}
}
void PMainWindow::showToolbar(bool how)
{
if (!how) toolBar->hide();
else toolBar->show();
if (autoSave) {
m_cfg->writeEntry("showtoolbar",how);
}
}
void PMainWindow::setupActions()
{
- m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
+ m_aDirUp = new QAction( tr( "Go dir up" ), Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, true );
m_aDirUp->setToggleAction(false);
connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
if ( Ir::supported() ) {
- m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true );
+ m_aBeam = new QAction( tr( "Beam file" ), Opie::Core::OResource::loadPixmap( "beam", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, true );
m_aBeam->setToggleAction(false);
connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
} else {
m_aBeam = 0;
}
- m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true );
+ m_aShowInfo = new QAction( tr( "Show imageinfo" ), Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, true );
m_aShowInfo->setToggleAction(false);
connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
- m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true );
+ m_aTrash = new QAction( tr( "Delete file" ), Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),
+ 0, 0, this, 0, true );
m_aTrash->setToggleAction(false);
connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
- m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true );
+ m_aViewfile = new QAction( tr( "Display image" ), Opie::Core::OResource::loadPixmap("mag", Opie::Core::OResource::SmallIcon),
+ 0, 0, this, 0, true );
m_aViewfile->setToggleAction(false);
connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
- m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true );
+ m_aStartSlide = new QAction( tr( "Start slideshow" ), Opie::Core::OResource::loadPixmap("play", Opie::Core::OResource::SmallIcon),
+ 0, 0, this, 0, true );
m_aStartSlide->setToggleAction(false);
connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
- m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true );
+ m_aHideToolbar = new QAction( tr( "Show toolbar" ), Opie::Core::OResource::loadPixmap( "UtilsIcon",
+ Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, true );
m_aHideToolbar->setOn (true);
connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
- m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true );
+ m_aSetup = new QAction( tr( "Settings" ), Opie::Core::OResource::loadPixmap("SettingsIcon", Opie::Core::OResource::SmallIcon),
+ 0, 0, this, 0, true );
m_aSetup->setToggleAction(false);
connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig()));
m_gListViewMode = new QActionGroup(this,"Select listmode",true);
connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*)));
- m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true );
+ m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Opie::Core::OResource::loadPixmap("opie-eye/opie-eye-thumb",
+ Opie::Core::OResource::SmallIcon), 0, 0, this, 0, true );
m_aDirLong->setToggleAction(true);
- m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true );
+ m_aDirShort = new QAction( tr( "Thumbnail and name" ),Opie::Core::OResource::loadPixmap("opie-eye/opie-eye-thumbonly",
+ Opie::Core::OResource::SmallIcon), 0, 0, this, 0, true );
m_aDirShort->setToggleAction(true);
- m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true );
+ m_aDirName = new QAction( tr( "Name only" ), Opie::Core::OResource::loadPixmap("opie-eye/opie-eye-textview",
+ Opie::Core::OResource::SmallIcon),0, 0, this, 0, true );
m_aDirName->setToggleAction(true);
int mode = m_cfg->readNumEntry("ListViewMode", 1);
if (mode < 1 || mode>3) mode = 1;
switch (mode) {
case 3:
m_aDirName->setOn(true);
break;
case 2:
m_aDirShort->setOn(true);
break;
case 1:
default:
m_aDirLong->setOn(true);
}
m_gListViewMode->insert(m_aDirLong);
m_gListViewMode->insert(m_aDirShort);
m_gListViewMode->insert(m_aDirName);
m_gPrevNext = new QActionGroup(this,"imageprevnext",false);
- m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true );
+ m_aNext = new QAction( tr( "Next image" ),Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon),
+ 0, 0, this, 0, true );
m_aNext->setToggleAction(false);
connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext()));
- m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true );
+ m_aPrevious = new QAction( tr( "Previous image" ),Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon),
+ 0, 0, this, 0, true );
m_aPrevious->setToggleAction(false);
connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
m_gPrevNext->insert(m_aPrevious);
m_gPrevNext->insert(m_aNext);
m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
- Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
+ Opie::Core::OResource::loadPixmap("fullscreen", Opie::Core::OResource::SmallIcon), 0, 0, this, 0, true );
m_aFullScreen->setToggleAction(true);
if (autoSave) {
m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false));
} else {
m_aFullScreen->setOn(false);
}
connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool)));
m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
- m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
+ m_aAutoRotate = new QAction( tr( "Auto rotate images" ),
+ Opie::Core::OResource::loadPixmap( "rotate", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, true );
m_aAutoRotate->setToggleAction(true);
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
m_aAutoRotate->setOn(true);
} else {
m_aAutoRotate->setOn(false);
}
if (autoSave) {
m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn()));
}
connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
- m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
+ m_aUnscaled = new QAction( tr( "Show images unscaled" ),
+ Opie::Core::OResource::loadPixmap( "1to1", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, true );
m_aUnscaled->setToggleAction(true);
connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
if (autoSave) {
m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false));
} else {
m_aUnscaled->setOn(false);
}
- m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
+ m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ),
+ Opie::Core::OResource::loadPixmap( "mag", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, true );
m_aZoomer->setToggleAction(true);
if (autoSave) {
m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true));
} else {
m_aZoomer->setOn (true);
}
connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
m_gDisplayType->insert(m_aAutoRotate);
m_gDisplayType->insert(m_aUnscaled);
m_gDisplayType->insert(m_aZoomer);
m_hGroup = new QActionGroup(this,"actioncollection",false);
m_hGroup->insert(m_aFullScreen);
if (!m_SmallWindow) {
- m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true);
+ m_aForceSmall = new QAction(tr("Dont show seperate windows"),
+ Opie::Core::OResource::loadPixmap( "AppsIcon", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, true);
m_aForceSmall->setToggleAction(true);
connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool)));
} else {
m_aForceSmall = 0;
}
m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false);
connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness()));
- m_IncBrightness = new QAction(tr("Increase brightness by 5"),Resource::loadIconSet( "up" ),0, 0, this, 0, false);
- m_DecBrightness = new QAction(tr("Decrease brightness by 5"),Resource::loadIconSet( "down" ),0, 0, this, 0, false);
+ m_IncBrightness = new QAction(tr("Increase brightness by 5"),
+ Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, false);
+ m_DecBrightness = new QAction(tr("Decrease brightness by 5"),
+ Opie::Core::OResource::loadPixmap( "down", Opie::Core::OResource::SmallIcon ),
+ 0, 0, this, 0, false);
m_hBright = new QActionGroup(this,"actioncollection",false),
m_hBright->insert(m_setCurrentBrightness);
m_hBright->insert(m_IncBrightness);
m_hBright->insert(m_DecBrightness);
}
void PMainWindow::setupBrightness()
{
if (!m_disp) {
return;
}
bool reshow=false;
if (m_disp->isVisible()&&m_disp->fullScreen()) {
m_disp->hide();
reshow = true;
}
int lb = m_disp->Intensity();
if (Valuebox(0,-100,100,lb,lb)) {
m_disp->setIntensity(lb,true);
}
if (reshow) {
m_disp->showFullScreen();
qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
}
@@ -699,61 +724,63 @@ void PMainWindow::setupToolbar()
if (!m_SmallWindow) {
m_gPrevNext->addTo(toolBar);
} else {
m_gPrevNext->setEnabled(false);
}
}
void PMainWindow::setupMenu()
{
fileMenu = new QPopupMenu( menuBar() );
menuBar()->insertItem( tr( "File" ), fileMenu );
dispMenu = new QPopupMenu( menuBar() );
menuBar()->insertItem( tr( "Show" ), dispMenu );
settingsMenu = new QPopupMenu( menuBar() );
menuBar()->insertItem( tr( "Settings" ), settingsMenu );
m_aViewfile->addTo(fileMenu);
m_aShowInfo->addTo(fileMenu);
m_aStartSlide->addTo(fileMenu);
fileMenu->insertSeparator();
m_aDirUp->addTo( fileMenu );
fsMenu = new QPopupMenu(fileMenu);
- fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
+ fileMenu->insertItem(Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ),
+ tr("Select filesystem"),fsMenu);
connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
dirChanged();
if ( m_aBeam ) {
fileMenu->insertSeparator();
m_aBeam->addTo( fileMenu );
}
fileMenu->insertSeparator();
m_aTrash->addTo(fileMenu);
listviewMenu = new QPopupMenu(dispMenu);
- dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
+ dispMenu->insertItem(Opie::Core::OResource::loadPixmap("opie-eye/opie-eye-thumb", Opie::Core::OResource::SmallIcon),
+ tr("Listview mode"),listviewMenu);
m_gListViewMode->addTo(listviewMenu);
dispMenu->insertSeparator();
m_aFullScreen->addTo(dispMenu);
m_gDisplayType->addTo(dispMenu);
dispMenu->insertSeparator();
m_gPrevNext->addTo(dispMenu);
dispMenu->insertSeparator();
m_hBright->addTo(dispMenu);
m_hBright->setEnabled(false);
if (m_aForceSmall) {
dispMenu->insertSeparator();
m_aForceSmall->addTo(dispMenu);
}
m_aSetup->addTo(settingsMenu);
m_aHideToolbar->addTo(settingsMenu);
}
void PMainWindow::listviewselected(QAction*which)
{
if (!which || which->isOn()==false) return;
int val = 1;
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
index aa15d31..5680454 100644
--- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
+++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
@@ -23,26 +23,26 @@ ViewModeButton::ViewModeButton( QToolBar* bar,int def )
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:
name = "opie-eye/opie-eye-thumbonly";
break;
case 3:
name = "opie-eye/opie-eye-textview";
break;
}
owarn << "foo " << name << oendl;
- setIconSet( Resource::loadIconSet( name ) );
+ setIconSet( Opie::Core::OResource::loadPixmap( name, Opie::Core::OResource::SmallIcon ) );
}
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.h b/noncore/graphics/opie-eye/gui/viewmodebutton.h
index 48f0e67..1637888 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 <opie2/oresource.h>
#include <qtoolbutton.h>
class ViewModeButton : public QToolButton {
Q_OBJECT
public:
ViewModeButton( QToolBar*,int def=1 );
~ViewModeButton();
signals:
void changeMode( int );
private slots:
void slotChange( int i );
};
#endif