|
|
@ -95,7 +95,7 @@ ImageWindow::~ImageWindow()
|
|
|
|
void ImageWindow::init()
|
|
|
|
void ImageWindow::init()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setFocusPolicy( TQ_StrongFocus );
|
|
|
|
setFocusPolicy( TQ_StrongFocus );
|
|
|
|
|
|
|
|
|
|
|
|
KCursor::setAutoHideCursor( this, true, true );
|
|
|
|
KCursor::setAutoHideCursor( this, true, true );
|
|
|
|
KCursor::setHideCursorDelay( 1500 );
|
|
|
|
KCursor::setHideCursorDelay( 1500 );
|
|
|
|
|
|
|
|
|
|
|
@ -182,10 +182,10 @@ void ImageWindow::setupActions()
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT( rotate270() ),
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT( rotate270() ),
|
|
|
|
m_actions, "rotate270" );
|
|
|
|
m_actions, "rotate270" );
|
|
|
|
|
|
|
|
|
|
|
|
new TDEAction( i18n("FlipQt::Horizontally"), Key_Asterisk,
|
|
|
|
new TDEAction( i18n("Flip Horizontally"), Key_Asterisk,
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT( flipHoriz() ),
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT( flipHoriz() ),
|
|
|
|
m_actions, "flip_horicontally" );
|
|
|
|
m_actions, "flip_horicontally" );
|
|
|
|
new TDEAction( i18n("FlipQt::Vertically"), Key_Slash,
|
|
|
|
new TDEAction( i18n("Flip Vertically"), Key_Slash,
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT( flipVert() ),
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT( flipVert() ),
|
|
|
|
m_actions, "flip_vertically" );
|
|
|
|
m_actions, "flip_vertically" );
|
|
|
|
|
|
|
|
|
|
|
@ -307,7 +307,7 @@ void ImageWindow::updateGeometry( int imWidth, int imHeight )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
updateCursor();
|
|
|
|
updateCursor();
|
|
|
|
|
|
|
|
|
|
|
|
TQString caption = i18n( "Filename (Imagewidth x Imageheight)",
|
|
|
|
TQString caption = i18n( "Filename (Imagewidth x Imageheight)",
|
|
|
|
"%3 (%1 x %2)" );
|
|
|
|
"%3 (%1 x %2)" );
|
|
|
|
caption = caption.arg( m_kuim->originalWidth() ).
|
|
|
|
caption = caption.arg( m_kuim->originalWidth() ).
|
|
|
@ -439,7 +439,7 @@ bool ImageWindow::showNextImage( KuickFile *file )
|
|
|
|
// updateWidget( true ); // already called from loadImage()
|
|
|
|
// updateWidget( true ); // already called from loadImage()
|
|
|
|
if ( !isVisible() )
|
|
|
|
if ( !isVisible() )
|
|
|
|
showWindow();
|
|
|
|
showWindow();
|
|
|
|
|
|
|
|
|
|
|
|
showImage();
|
|
|
|
showImage();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -592,7 +592,7 @@ void ImageWindow::keyPressEvent( TQKeyEvent *e )
|
|
|
|
|
|
|
|
|
|
|
|
if ( key == Key_Shift )
|
|
|
|
if ( key == Key_Shift )
|
|
|
|
updateCursor( ZoomCursor );
|
|
|
|
updateCursor( ZoomCursor );
|
|
|
|
|
|
|
|
|
|
|
|
if ( key == Key_Escape || TDEStdAccel::close().contains( KKey( e ) ) )
|
|
|
|
if ( key == Key_Escape || TDEStdAccel::close().contains( KKey( e ) ) )
|
|
|
|
close( true );
|
|
|
|
close( true );
|
|
|
|
else if ( TDEStdAccel::save().contains( KKey( e ) ) )
|
|
|
|
else if ( TDEStdAccel::save().contains( KKey( e ) ) )
|
|
|
@ -664,7 +664,7 @@ void ImageWindow::updateCursor( KuickCursor cursor )
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
if ( isCursorHidden() )
|
|
|
|
if ( isCursorHidden() )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if ( imageWidth() > width() || imageHeight() > height() )
|
|
|
|
if ( imageWidth() > width() || imageHeight() > height() )
|
|
|
|
setCursor( *s_handCursor );
|
|
|
|
setCursor( *s_handCursor );
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -680,7 +680,7 @@ void ImageWindow::mouseMoveEvent( TQMouseEvent *e )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( e->state() & ShiftButton ) {
|
|
|
|
if ( e->state() & ShiftButton ) {
|
|
|
|
|
|
|
|
|
|
|
|
if ( !transWidget ) {
|
|
|
|
if ( !transWidget ) {
|
|
|
|
transWidget = new TQWidget( this );
|
|
|
|
transWidget = new TQWidget( this );
|
|
|
|
transWidget->setGeometry( 0, 0, width(), height() );
|
|
|
|
transWidget->setGeometry( 0, 0, width(), height() );
|
|
|
@ -693,10 +693,10 @@ void ImageWindow::mouseMoveEvent( TQMouseEvent *e )
|
|
|
|
p.eraseRect( transWidget->rect() );
|
|
|
|
p.eraseRect( transWidget->rect() );
|
|
|
|
transWidget->show();
|
|
|
|
transWidget->show();
|
|
|
|
tqApp->processOneEvent();
|
|
|
|
tqApp->processOneEvent();
|
|
|
|
|
|
|
|
|
|
|
|
int width = e->x() - xposPress;
|
|
|
|
int width = e->x() - xposPress;
|
|
|
|
int height = e->y() - yposPress;
|
|
|
|
int height = e->y() - yposPress;
|
|
|
|
|
|
|
|
|
|
|
|
if ( width < 0 ) {
|
|
|
|
if ( width < 0 ) {
|
|
|
|
width = abs( width );
|
|
|
|
width = abs( width );
|
|
|
|
xzoom = e->x();
|
|
|
|
xzoom = e->x();
|
|
|
@ -759,7 +759,7 @@ void ImageWindow::mouseReleaseEvent( TQMouseEvent *e )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( yposPress > y ) {
|
|
|
|
if ( yposPress > y ) {
|
|
|
|
topY = y;
|
|
|
|
topY = y;
|
|
|
|
botY = yposPress;
|
|
|
|
botY = yposPress;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
@ -981,34 +981,34 @@ bool ImageWindow::saveImage( const KURL& dest, bool keepOriginalSize )
|
|
|
|
TQString saveFile;
|
|
|
|
TQString saveFile;
|
|
|
|
if ( dest.isLocalFile() )
|
|
|
|
if ( dest.isLocalFile() )
|
|
|
|
saveFile = dest.path();
|
|
|
|
saveFile = dest.path();
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString extension = TQFileInfo( dest.fileName() ).extension();
|
|
|
|
TQString extension = TQFileInfo( dest.fileName() ).extension();
|
|
|
|
if ( !extension.isEmpty() )
|
|
|
|
if ( !extension.isEmpty() )
|
|
|
|
extension.prepend( '.' );
|
|
|
|
extension.prepend( '.' );
|
|
|
|
|
|
|
|
|
|
|
|
KTempFile tmpFile( TQString(), extension );
|
|
|
|
KTempFile tmpFile( TQString(), extension );
|
|
|
|
if ( tmpFile.status() != 0 )
|
|
|
|
if ( tmpFile.status() != 0 )
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
tmpFile.close();
|
|
|
|
tmpFile.close();
|
|
|
|
if ( tmpFile.status() != 0 )
|
|
|
|
if ( tmpFile.status() != 0 )
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
saveFile = tmpFile.name();
|
|
|
|
saveFile = tmpFile.name();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( saveIm )
|
|
|
|
if ( saveIm )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Imlib_apply_modifiers_to_rgb( id, saveIm );
|
|
|
|
Imlib_apply_modifiers_to_rgb( id, saveIm );
|
|
|
|
success = Imlib_save_image( id, saveIm,
|
|
|
|
success = Imlib_save_image( id, saveIm,
|
|
|
|
TQFile::encodeName( saveFile ).data(),
|
|
|
|
TQFile::encodeName( saveFile ).data(),
|
|
|
|
NULL );
|
|
|
|
NULL );
|
|
|
|
if ( success && !dest.isLocalFile() )
|
|
|
|
if ( success && !dest.isLocalFile() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( isFullscreen() )
|
|
|
|
if ( isFullscreen() )
|
|
|
|
toggleFullscreen(); // otherwise upload window would block us invisibly
|
|
|
|
toggleFullscreen(); // otherwise upload window would block us invisibly
|
|
|
|
success = TDEIO::NetAccess::upload( saveFile, dest, const_cast<ImageWindow*>( this ) );
|
|
|
|
success = TDEIO::NetAccess::upload( saveFile, dest, const_cast<ImageWindow*>( this ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Imlib_kill_image( id, saveIm );
|
|
|
|
Imlib_kill_image( id, saveIm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1192,12 +1192,12 @@ bool ImageWindow::canZoomTo( int newWidth, int newHeight )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( !ImlibWidget::canZoomTo( newWidth, newHeight ) )
|
|
|
|
if ( !ImlibWidget::canZoomTo( newWidth, newHeight ) )
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
TQSize desktopSize = TDEGlobalSettings::desktopGeometry(topLevelWidget()).size();
|
|
|
|
TQSize desktopSize = TDEGlobalSettings::desktopGeometry(topLevelWidget()).size();
|
|
|
|
|
|
|
|
|
|
|
|
int desktopArea = desktopSize.width() * desktopSize.height();
|
|
|
|
int desktopArea = desktopSize.width() * desktopSize.height();
|
|
|
|
int imageArea = newWidth * newHeight;
|
|
|
|
int imageArea = newWidth * newHeight;
|
|
|
|
|
|
|
|
|
|
|
|
if ( imageArea > desktopArea * kdata->maxZoomFactor )
|
|
|
|
if ( imageArea > desktopArea * kdata->maxZoomFactor )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return KMessageBox::warningContinueCancel(
|
|
|
|
return KMessageBox::warningContinueCancel(
|
|
|
@ -1209,7 +1209,7 @@ bool ImageWindow::canZoomTo( int newWidth, int newHeight )
|
|
|
|
"ImageWindow_confirm_very_large_window"
|
|
|
|
"ImageWindow_confirm_very_large_window"
|
|
|
|
) == KMessageBox::Continue;
|
|
|
|
) == KMessageBox::Continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1219,7 +1219,7 @@ void ImageWindow::rotated( KuickImage *kuim, int rotation )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
ImlibWidget::rotated( kuim, rotation );
|
|
|
|
ImlibWidget::rotated( kuim, rotation );
|
|
|
|
|
|
|
|
|
|
|
|
if ( rotation == ROT_90 || rotation == ROT_270 )
|
|
|
|
if ( rotation == ROT_90 || rotation == ROT_270 )
|
|
|
|
autoScale( kuim ); // ### BUG: only autoScale when configured!
|
|
|
|
autoScale( kuim ); // ### BUG: only autoScale when configured!
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1247,5 +1247,5 @@ bool ImageWindow::isCursorHidden() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return cursor().shape() == TQt::BlankCursor;
|
|
|
|
return cursor().shape() == TQt::BlankCursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "imagewindow.moc"
|
|
|
|
#include "imagewindow.moc"
|
|
|
|