summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -192,32 +192,33 @@ 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;
@@ -335,34 +336,36 @@ void OImageScrollView::rotate_into_data(Rotation r)
}
}
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();
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
@@ -33,57 +33,56 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name
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()
@@ -223,33 +222,32 @@ void ImageView::keyReleaseEvent(QKeyEvent * e)
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();
@@ -276,33 +274,32 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e)
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;
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
@@ -636,67 +636,76 @@ void PMainWindow::setupActions()
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 );
@@ -717,34 +726,32 @@ void PMainWindow::setupMenu()
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;