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