summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-24 21:13:40 (UTC)
committer alwin <alwin>2005-03-24 21:13:40 (UTC)
commitb6fc9840f4fe9bad392167c49dbcfa2acda9ed21 (patch) (side-by-side diff)
tree1d7d1225a9c440f5d0608d8901dfd151db8a6f1c
parent1e6c3181dcc7ec4edbe99db0d886ce7a9c483056 (diff)
downloadopie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.zip
opie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.tar.gz
opie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.tar.bz2
last bugfixes on opie-eye an imagescrollview. Seems that now all is working
as it should.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/oimagescrollview.cpp5
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp5
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp13
3 files changed, 15 insertions, 8 deletions
diff --git a/libopie2/opiemm/oimagescrollview.cpp b/libopie2/opiemm/oimagescrollview.cpp
index 10da823..76f50e1 100644
--- a/libopie2/opiemm/oimagescrollview.cpp
+++ b/libopie2/opiemm/oimagescrollview.cpp
@@ -144,128 +144,129 @@ void OImageScrollView::setImage( const QString& path ) {
}
}
/* should be called every time the QImage changed it content */
void OImageScrollView::init()
{
/*
* create the zoomer
* and connect ther various signals
*/
_zoomer = new Opie::MM::OImageZoomer( this, "The Zoomer" );
connect(_zoomer, SIGNAL( zoomAreaRel(int,int)),
this, SLOT(scrollBy(int,int)) );
connect(_zoomer, SIGNAL( zoomArea(int,int)),
this, SLOT(center(int,int)) );
connect(this,SIGNAL(contentsMoving(int,int)),
_zoomer, (SLOT(setVisiblePoint(int,int))) );
connect(this,SIGNAL(imageSizeChanged(const QSize&)),
_zoomer, SLOT(setImageSize(const QSize&)) );
connect(this,SIGNAL(viewportSizeChanged(const QSize&)),
_zoomer, SLOT(setViewPortSize(const QSize&)) );
setBackgroundColor(white);
setFocusPolicy(QWidget::StrongFocus);
setImageScaledLoaded(false);
setImageIsJpeg(false);
if (FirstResizeDone()) {
m_last_rot = Rotate0;
generateImage();
} else if (_original_data.size().isValid()) {
if (image_fit_into(_original_data.size()) || !ShowZoomer()) _zoomer->hide();
resizeContents(_original_data.width(),_original_data.height());
}
_intensity = 0;
}
void OImageScrollView::setAutoRotate(bool how)
{
/* to avoid double repaints */
if (AutoRotate() != how) {
m_states.setBit(AUTO_ROTATE,how);
_image_data = QImage();
generateImage();
}
}
bool OImageScrollView::AutoRotate()const
{
return m_states.testBit(AUTO_ROTATE);
}
void OImageScrollView::setAutoScaleRotate(bool scale, bool rotate)
{
m_states.setBit(AUTO_ROTATE,rotate);
setAutoScale(scale);
}
void OImageScrollView::setAutoScale(bool how)
{
m_states.setBit(AUTO_SCALE,how);
_image_data = QImage();
if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) {
loadJpeg(true);
}
+ _newImage = true;
generateImage();
}
bool OImageScrollView::AutoScale()const
{
return m_states.testBit(AUTO_SCALE);
}
OImageScrollView::~OImageScrollView()
{
}
void OImageScrollView::rescaleImage(int w, int h)
{
if (_image_data.width()==w && _image_data.height()==h) {
return;
}
double hs = (double)h / (double)_image_data.height() ;
double ws = (double)w / (double)_image_data.width() ;
double scaleFactor = (hs > ws) ? ws : hs;
int smoothW = (int)(scaleFactor * _image_data.width());
int smoothH = (int)(scaleFactor * _image_data.height());
_image_data = _image_data.smoothScale(smoothW,smoothH);
}
void OImageScrollView::rotate_into_data(Rotation r)
{
/* realy - we must do this that way, 'cause when acting direct on _image_data the app will
segfault :( */
QImage dest;
int x, y;
if ( _original_data.depth() > 8 )
{
unsigned int *srcData, *destData;
switch ( r )
{
case Rotate90:
dest.create(_original_data.height(), _original_data.width(), _original_data.depth());
for ( y=0; y < _original_data.height(); ++y )
{
srcData = (unsigned int *)_original_data.scanLine(y);
for ( x=0; x < _original_data.width(); ++x )
{
destData = (unsigned int *)dest.scanLine(x);
destData[_original_data.height()-y-1] = srcData[x];
}
}
break;
case Rotate180:
dest.create(_original_data.width(), _original_data.height(), _original_data.depth());
for ( y=0; y < _original_data.height(); ++y )
{
srcData = (unsigned int *)_original_data.scanLine(y);
destData = (unsigned int *)dest.scanLine(_original_data.height()-y-1);
for ( x=0; x < _original_data.width(); ++x )
destData[_original_data.width()-x-1] = srcData[x];
}
break;
case Rotate270:
dest.create(_original_data.height(), _original_data.width(), _original_data.depth());
for ( y=0; y < _original_data.height(); ++y )
{
srcData = (unsigned int *)_original_data.scanLine(y);
for ( x=0; x < _original_data.width(); ++x )
@@ -287,130 +288,132 @@ void OImageScrollView::rotate_into_data(Rotation r)
switch ( r )
{
case Rotate90:
dest.create(_original_data.height(), _original_data.width(), _original_data.depth());
dest.setNumColors(_original_data.numColors());
srcTable = (unsigned int *)_original_data.colorTable();
destTable = (unsigned int *)dest.colorTable();
for ( x=0; x < _original_data.numColors(); ++x )
destTable[x] = srcTable[x];
for ( y=0; y < _original_data.height(); ++y )
{
srcData = (unsigned char *)_original_data.scanLine(y);
for ( x=0; x < _original_data.width(); ++x )
{
destData = (unsigned char *)dest.scanLine(x);
destData[_original_data.height()-y-1] = srcData[x];
}
}
break;
case Rotate180:
dest.create(_original_data.width(), _original_data.height(), _original_data.depth());
dest.setNumColors(_original_data.numColors());
srcTable = (unsigned int *)_original_data.colorTable();
destTable = (unsigned int *)dest.colorTable();
for ( x=0; x < _original_data.numColors(); ++x )
destTable[x] = srcTable[x];
for ( y=0; y < _original_data.height(); ++y )
{
srcData = (unsigned char *)_original_data.scanLine(y);
destData = (unsigned char *)dest.scanLine(_original_data.height()-y-1);
for ( x=0; x < _original_data.width(); ++x )
destData[_original_data.width()-x-1] = srcData[x];
}
break;
case Rotate270:
dest.create(_original_data.height(), _original_data.width(), _original_data.depth());
dest.setNumColors(_original_data.numColors());
srcTable = (unsigned int *)_original_data.colorTable();
destTable = (unsigned int *)dest.colorTable();
for ( x=0; x < _original_data.numColors(); ++x )
destTable[x] = srcTable[x];
for ( y=0; y < _original_data.height(); ++y )
{
srcData = (unsigned char *)_original_data.scanLine(y);
for ( x=0; x < _original_data.width(); ++x )
{
destData = (unsigned char *)dest.scanLine(_original_data.width()-x-1);
destData[y] = srcData[x];
}
}
break;
default:
dest = _original_data;
break;
}
}
_newImage = true;
_image_data = dest;
}
// yes - sorry - it is NOT gamma it is just BRIGHTNESS. Alwin
void OImageScrollView::apply_gamma(int aValue)
{
- if (!_image_data.size().isValid()) return;
+ if (aValue==0 || !_image_data.size().isValid()) return;
float percent = ((float)aValue/100.0);
+ /* make sure working on a copy */
+ _image_data.detach();
int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors();
/* must be - otherwise it displays some ... strange colors */
if (segColors<256) segColors=256;
unsigned char *segTbl = new unsigned char[segColors];
int pixels = _image_data.depth()>8?_image_data.width()*_image_data.height() : _image_data.numColors();
bool brighten = (percent >= 0);
if ( percent < 0 ) {
percent = -percent;
}
unsigned int *data = _image_data.depth() > 8 ? (unsigned int *)_image_data.bits() :
(unsigned int *)_image_data.colorTable();
int tmp = 0;
if (brighten) {
for ( int i=0; i < segColors; ++i )
{
tmp = (int)(i*percent);
if ( tmp > 255 )
tmp = 255;
segTbl[i] = tmp;
}
} else {
for ( int i=0; i < segColors; ++i )
{
tmp = (int)(i*percent);
if ( tmp < 0 )
tmp = 0;
segTbl[i] = tmp;
}
}
if (brighten) {
for ( int i=0; i < pixels; ++i )
{
int r = qRed(data[i]);
int g = qGreen(data[i]);
int b = qBlue(data[i]);
int a = qAlpha(data[i]);
r = r + segTbl[r] > 255 ? 255 : r + segTbl[r];
g = g + segTbl[g] > 255 ? 255 : g + segTbl[g];
b = b + segTbl[b] > 255 ? 255 : b + segTbl[b];
data[i] = qRgba(r, g, b,a);
}
} else {
for ( int i=0; i < pixels; ++i )
{
int r = qRed(data[i]);
int g = qGreen(data[i]);
int b = qBlue(data[i]);
int a = qAlpha(data[i]);
r = r - segTbl[r] < 0 ? 0 : r - segTbl[r];
g = g - segTbl[g] < 0 ? 0 : g - segTbl[g];
b = b - segTbl[b] < 0 ? 0 : b - segTbl[b];
data[i] = qRgba(r, g, b, a);
}
}
delete [] segTbl;
}
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 994fe12..b919ca8 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -1,137 +1,136 @@
#include "imageview.h"
#include <opie2/odebug.h>
#include <opie2/oconfig.h>
#include <opie2/okeyconfigwidget.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;
m_gBright = 0;
m_Rotated = false;
closeIfHide = false;
int min = QApplication::desktop()->size().width()>QApplication::desktop()->size().height()?
QApplication::desktop()->size().height():QApplication::desktop()->size().width();
if (min>320) {
// bigscreen
setMinimumSize(min/3,min/3);
} else {
setMinimumSize(10,10);
}
connect(this,SIGNAL(incBrightness()),this,SLOT(slotIncBrightness()));
connect(this,SIGNAL(decBrightness()),this,SLOT(slotDecBrightness()));
m_sysChannel = new QCopChannel( "QPE/System", this );
connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
+ setKeyCompression(true);
}
void ImageView::slotIncBrightness()
{
int lb = Intensity()+5;
if (lb>100) lb=100;
setIntensity(lb,true);
}
void ImageView::slotDecBrightness()
{
int lb = Intensity()-5;
if (lb<-100) lb=-100;
setIntensity(lb,true);
}
void ImageView::systemMessage( const QCString& msg, const QByteArray& data )
{
int _newrotation;
QDataStream stream( data, IO_ReadOnly );
- odebug << "received system message: " << msg << oendl;
if ( msg == "setCurrentRotation(int)" )
{
stream >> _newrotation;
- odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl;
if (!fullScreen()) {
m_rotation = _newrotation;
return;
}
}
}
void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup)
{
m_gDisplayType = disptypeGroup;
m_gPrevNext = nextprevGroup;
m_hGroup = hGroup;
m_gBright = brightGroup;
}
ImageView::~ImageView()
{
odebug << "Destructor imageview" << oendl;
delete m_viewManager;
}
Opie::Core::OKeyConfigManager* ImageView::manager()
{
if (!m_viewManager) {
initKeys();
}
return m_viewManager;
}
void ImageView::startSlide(int value)
{
if (!m_slideTimer) {
m_slideTimer = new QTimer(this);
}
m_slideValue=value;
connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide()));
/* this "+1" is one millisecond. with that we can setup a slideshowvalue
of 0. eg "as fast as possible".
*/
m_slideTimer->start(m_slideValue*1000+1,true);
}
void ImageView::stopSlide()
{
if (!m_slideTimer) {
return;
}
m_slideTimer->stop();
delete m_slideTimer;
m_slideTimer = 0;
}
void ImageView::nextSlide()
{
if (!m_slideTimer) {
return;
}
#if 0
if (isHidden()) {
delete m_slideTimer;
m_slideTimer = 0;
return;
}
#endif
@@ -175,147 +174,145 @@ void ImageView::initKeys()
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
Resource::loadPixmap("1to1"), 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),
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),
this, SIGNAL(dispPrev())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
Resource::loadPixmap("fullscreen"), 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),
this, SIGNAL(toggleZoomer())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Increase brightness"), "incbrightness",
Resource::loadPixmap("up"), 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),
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;
}
void ImageView::slotShowImageInfo()
{
emit dispImageInfo(m_lastName);
}
void ImageView::contentsMousePressEvent ( QMouseEvent * e)
{
if (e->button()==1) {
return OImageScrollView::contentsMousePressEvent(e);
}
- odebug << "Popup " << oendl;
QPopupMenu *m = new QPopupMenu(this);
if (!m) return;
if (m_hGroup) {
m_hGroup->addTo(m);
}
if (fullScreen()) {
if (m_gPrevNext) {
m->insertSeparator();
m_gPrevNext->addTo(m);
}
if (m_gDisplayType) {
m->insertSeparator();
m_gDisplayType->addTo(m);
}
if (m_gBright) {
m->insertSeparator();
m_gBright->addTo(m);
}
}
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
if (m_hGroup) {
m_hGroup->removeFrom(m);
}
if (m_gPrevNext) {
m_gPrevNext->removeFrom(m);
}
if (m_gDisplayType) {
m_gDisplayType->removeFrom(m);
}
if (m_gBright) {
m_gBright->removeFrom(m);
}
delete m;
}
void ImageView::setFullScreen(bool how,bool force)
{
m_isFullScreen = how;
if (how) {
m_ignore_next_in = true;
// setFixedSize(qApp->desktop()->size());
setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height());
if (force) showFullScreen();
} else {
// setMinimumSize(10,10);
}
}
void ImageView::focusInEvent(QFocusEvent *)
{
// Always do it here, no matter the size.
- odebug << "Focus in (view)" << oendl;
//if (fullScreen()) parentWidget()->showNormal();
if (m_ignore_next_in){m_ignore_next_in=false;return;}
if (fullScreen()) enableFullscreen();
}
void ImageView::hide()
{
if (fullScreen()) {
m_ignore_next_in = true;
showNormal();
}
QWidget::hide();
}
void ImageView::enableFullscreen()
{
if (!fullScreen()) return;
if (m_ignore_next_in) {m_ignore_next_in = false;return;}
setUpdatesEnabled(false);
// This is needed because showNormal() forcefully changes the window
// style to WSTyle_TopLevel.
reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0));
// Enable fullscreen.
/* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
* so we must block it here! */
m_ignore_next_in = true;
showFullScreen();
setUpdatesEnabled(true);
}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 4ee252f..3efbb53 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -588,211 +588,218 @@ void PMainWindow::setupActions()
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 );
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->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->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->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->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_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);
+ }
}
void PMainWindow::setupToolbar()
{
toolBar = new QToolBar( this );
addToolBar(toolBar);
toolBar->setHorizontalStretchable( true );
setToolBarsMovable( false );
m_aDirUp->addTo( toolBar );
fsButton = new PFileSystem( toolBar );
connect( fsButton, SIGNAL( changeDir( const QString& ) ),
m_view, SLOT(slotChangeDir( const QString& ) ) );
connect( this, SIGNAL( changeDir( const QString& ) ),
m_view, SLOT(slotChangeDir( const QString& ) ) );
if (m_aBeam) {
m_aBeam->addTo( toolBar );
}
m_aShowInfo->addTo(toolBar);
m_aTrash->addTo(toolBar);
-// m_aSetup->addTo(toolBar);
m_gDisplayType->addTo(toolBar);
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);
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);
m_gListViewMode->addTo(listviewMenu);
dispMenu->insertSeparator();
m_aFullScreen->addTo(dispMenu);
m_gDisplayType->addTo(dispMenu);
dispMenu->insertSeparator();
m_gPrevNext->addTo(dispMenu);
- m_setCurrentBrightness->addTo(dispMenu);
- m_setCurrentBrightness->setEnabled(false);
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;
if (which==m_aDirName) {
val = 3;
} else if (which==m_aDirShort) {
val = 2;
} else if (which==m_aDirLong) {
val = 1;
}
emit changeListMode(val);
}
void PMainWindow::readConfig()
{
autoSave =m_cfg->readBoolEntry("savestatus",true);
m_Intensity = m_cfg->readNumEntry("intensity",0);
}
void PMainWindow::polish()
{
if (m_disp) {
odebug << "======================\n"
<< "Called via setdocument\n"
<< "======================" << oendl;
m_setDocCalled = true;
m_view->setDoccalled(true);
m_disp->setCloseIfHide(true);
} else {
m_setDocCalled = false;
m_view->setDoccalled(false);
}
m_polishDone = true;
QMainWindow::polish();
if (m_setDocCalled) {
if (m_aFullScreen->isOn()) {
QTimer::singleShot(0,this,SLOT(check_view_fullscreen()));
} else if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
}
}
}
void PMainWindow::slotForceSmall(bool how)
{
odebug << "Disable separate windows: " << how << oendl;
if (m_stack) {
if (how) {
m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen);
} else {