-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 27 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 29 |
2 files changed, 26 insertions, 30 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 979549d..828f5a1 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -10,20 +10,19 @@ * (at your option) any later version. * ***************************************************************************/ #define DEVELOPERS_VERSION #include "advancedfm.h" #include <opie2/odebug.h> - +#include <opie2/oresource.h> #include <opie2/ostorageinfo.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/mimetype.h> #include <qpe/applnk.h> -#include <qpe/resource.h> #include <qpe/menubutton.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qlistview.h> #include <qmessagebox.h> @@ -41,13 +40,13 @@ using namespace Opie::Ui; AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) : QMainWindow( ) { init(); renameBox = 0; whichTab = 1; - unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); + unknownXpm = Opie::Core::OResource::loadImage("UnknownDocument", Opie::Core::OResource::SmallIcon); initConnections(); rePopulate(); channel = new QCopChannel( "QPE/Application/advancedfm", this ); connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); switchToLocalTab(); @@ -133,42 +132,37 @@ void AdvancedFm::populateView() { if(fileL !="./" && fi->exists()) { item = new QListViewItem( thisView, fileL, fileS , fileDate); if(isDir || fileL.find("/",0,TRUE) != -1) { if( !QDir( fi->filePath() ).isReadable()) //is directory - pm.convertFromImage( Resource::loadImage( "lockedfolder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + pm = Opie::Core::OResource::loadPixmap( "lockedfolder", Opie::Core::OResource::SmallIcon ); else - pm.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - } + pm = Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ); + } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { - pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + pm = Opie::Core::OResource::loadPixmap( "exec", Opie::Core::OResource::SmallIcon ); } else if( (fileInfo.permission( QFileInfo::ExeUser) | fileInfo.permission( QFileInfo::ExeGroup) | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { - pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + pm = Opie::Core::OResource::loadPixmap( "exec", Opie::Core::OResource::SmallIcon ); } else if( !fi->isReadable() ) { - pm.convertFromImage( Resource::loadImage( "locked" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + pm = Opie::Core::OResource::loadPixmap( "locked", Opie::Core::OResource::SmallIcon ); } else { //everything else goes by mimetype MimeType mt(fi->filePath()); pm=mt.pixmap(); //sets the correct pixmap for mimetype if(pm.isNull()) { pm = unknownXpm; } } if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { // odebug << " overlay link image" << oendl; - pm.convertFromImage( Resource::loadImage( "advancedfm/symlink" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - // pm= Resource::loadPixmap( "folder" ); -// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); -// QPainter painter( &pm ); -// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); -// pm.setMask( pm.createHeuristicMask( FALSE ) ); + pm = Opie::Core::OResource::loadPixmap( "advancedfm/symlink", Opie::Core::OResource::SmallIcon ); } item->setPixmap( 0, pm ); } isDir=FALSE; ++it; @@ -457,13 +451,14 @@ void AdvancedFm::showFileMenu() { } else { if (app) m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this m->insertItem(tr("Execute"),this,SLOT(runThis())); - m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText())); + m->insertItem( Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon ), + tr("Open as text"),this,SLOT(runText())); } m->insertItem(tr("Actions"),n); n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index b43d2ba..aa9db52 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -10,16 +10,16 @@ * (at your option) any later version. * ***************************************************************************/ #include "advancedfm.h" /* OPIE */ #include <opie2/odebug.h> +#include <opie2/oresource.h> #include <qpe/applnk.h> #include <qpe/storage.h> #include <qpe/qpeapplication.h> -#include <qpe/resource.h> #include <qpe/menubutton.h> using namespace Opie::Core; using namespace Opie::Ui; /* QT */ #include <qlayout.h> @@ -49,46 +49,47 @@ void AdvancedFm::init() { layout->addWidget( menuBar ); menuBar->insertItem( tr( "File" ), fileMenu); menuBar->insertItem( tr( "View" ), viewMenu); - QPixmap pm; + bool useBigIcon = qApp->desktop()->size().width() > 330; + cdUpButton = new QToolButton( 0,"cdUpButton"); - pm.convertFromImage( Resource::loadImage( "up" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - cdUpButton->setPixmap( pm ); + cdUpButton->setUsesBigPixmap( useBigIcon ); + cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); cdUpButton->setAutoRaise( true ); menuBar->insertItem( cdUpButton ); qpeDirButton= new QToolButton( 0,"QPEButton"); - pm.convertFromImage( Resource::loadImage( "logo/opielogo" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - qpeDirButton->setPixmap( pm );//,"",this,"QPEButton"); + qpeDirButton->setUsesBigPixmap( useBigIcon ); + qpeDirButton->setPixmap( Opie::Core::OResource::loadPixmap( "logo/opielogo", Opie::Core::OResource::SmallIcon ) ); qpeDirButton->setAutoRaise( true ); menuBar->insertItem( qpeDirButton ); cfButton = new QToolButton( 0, "CFButton"); - pm.convertFromImage( Resource::loadImage( "cardmon/pcmcia" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - cfButton->setPixmap( pm ); + cfButton->setUsesBigPixmap( useBigIcon ); + cfButton->setPixmap( Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ) ); cfButton->setAutoRaise( true ); menuBar->insertItem( cfButton ); sdButton = new QToolButton( 0, "SDButton"); - pm.convertFromImage( Resource::loadImage( "advancedfm/sdcard" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - sdButton->setPixmap( pm ); + sdButton->setUsesBigPixmap( useBigIcon ); + sdButton->setPixmap( Opie::Core::OResource::loadPixmap( "advancedfm/sdcard", Opie::Core::OResource::SmallIcon ) ); sdButton->setAutoRaise( true ); menuBar->insertItem( sdButton ); docButton = new QToolButton( 0,"docsButton"); - pm.convertFromImage( Resource::loadImage( "DocsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - docButton->setPixmap( pm ); + docButton->setUsesBigPixmap( useBigIcon ); + docButton->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) ); docButton->setAutoRaise( true ); menuBar->insertItem( docButton ); homeButton = new QToolButton( 0, "homeButton"); - pm.convertFromImage( Resource::loadImage( "home" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - homeButton->setPixmap( pm ); + homeButton->setUsesBigPixmap( useBigIcon ); + homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); homeButton->setAutoRaise( true ); menuBar->insertItem( homeButton ); fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); fileMenu->insertSeparator(); |