AlbumShaper  1.0a3
photoDescEdit.cpp
Go to the documentation of this file.
1 //==============================================
2 // copyright : (C) 2003-2005 by Will Stokes
3 //==============================================
4 // This program is free software; you can redistribute it
5 // and/or modify it under the terms of the GNU General
6 // Public License as published by the Free Software
7 // Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //==============================================
10 
11 //Systemwide includes
12 #include <qlayout.h>
13 #include <qlabel.h>
14 #include <qimage.h>
15 #include <qpixmap.h>
16 #include <qtimer.h>
17 #include <qapplication.h>
18 #include <qpainter.h>
19 #include <q3textedit.h>
20 #include <qcursor.h>
21 //Added by qt3to4:
22 #include <Q3GridLayout>
23 #include <QFocusEvent>
24 #include <Q3Frame>
25 #include <Q3PopupMenu>
26 #include <QKeyEvent>
27 #include <QDesktopWidget>
28 
29 //Projectwide includes
30 #include "photoDescEdit.h"
31 #include "photoPreviewWidget.h"
32 #include "photosIconView.h"
33 #include "clickableLabel.h"
34 #include "../config.h"
35 #include "../backend/photo.h"
36 #include "../backend/tools/imageTools.h"
37 
38 #define EDIT_MARGIN 4
39 
40 //PLATFORM_SPECIFIC_CODE
41 #if defined(Q_OS_MACX)
42 #include "/Developer/Headers/FlatCarbon/MacWindows.h"
43 #endif
44 
45 //PLATFORM_SPECIFIC_CODE
46 #if defined(Q_OS_WIN)
47 #include <windows.h>
48 #include <winuser.h>
49 #define SPI_GETDROPSHADOW 0x1024
50 #define SPI_SETDROPSHADOW 0x1025
51 #endif
52 
53 //==============================================
55  QWidget* parent, const char* name ) :
56  QWidget(parent,name,
57  Qt::WStyle_Customize |
58 #if defined(Q_OS_MACX)
59  Qt::WStyle_Splash )
60 #else
61  Qt::WStyle_NoBorder | Qt::WType_Popup )
62 #endif
63 {
64  //PLATFORM_SPECIFIC_CODE
65  //disable drop shadow on mac os x
66  #if defined(Q_OS_MACX)
67  ChangeWindowAttributes( (OpaqueWindowPtr*)winId(), kWindowNoShadowAttribute, kWindowNoAttributes );
68  #endif
69 
70  //PLATFORM_SPECIFIC_CODE
71  //disable drop shadow on win xp
72  #if defined(Q_OS_WIN)
73  SystemParametersInfo( SPI_GETDROPSHADOW, 0, &dropShadowsEnabled, 0 );
74  SystemParametersInfo( SPI_SETDROPSHADOW, 0, NULL, 0 );
75  #endif
76 
77  this->ppw = ppw;
78  //-----------------------------------------------
79  //don't erase before painting, avoids flicker
80  setWindowFlags(Qt::WNoAutoErase);
81  //-----------------------------------------------
82  //determine small image size
84  //-------------------------------------------
85  QRect appRec = qApp->mainWidget()->frameGeometry();
86  int finalWidth, finalHeight;
87  int actualFinalWidth, actualFinalHeight;
88 
89  //image is wider than tall, place text and buttons below image
90  if(smallWidth > smallHeight )
91  {
92  finalWidth = 400;
93  finalHeight = (finalWidth * smallHeight) / smallWidth;
94 
95  //fix width
96  if(finalWidth +2*EDIT_MARGIN> appRec.width())
97  {
98  finalWidth = appRec.width() - 2*EDIT_MARGIN;
99  finalHeight = (finalWidth * smallHeight) / smallWidth;
100  }
101 
102  //fix height
103  QFontMetrics fm( qApp->font() );
104  idealTextSize = 4*fm.height() + 5*fm.leading() + 4;
105 
106  if(finalHeight + idealTextSize + 2*EDIT_MARGIN > appRec.height() )
107  {
108  finalHeight = appRec.height() - idealTextSize - 2*EDIT_MARGIN;
109  finalWidth = (finalHeight * smallWidth) / smallHeight;
110  }
111 
112  //sanity check
113  if(finalHeight < 0)
114  {
115  finalHeight = (appRec.height() - 2*EDIT_MARGIN) / 2;
116  finalWidth = (finalHeight * smallWidth) / smallHeight;
117  idealTextSize = finalHeight;
118  }
119 
120  actualFinalWidth = finalWidth + 2*EDIT_MARGIN;
121  actualFinalHeight = finalHeight + idealTextSize + 2*EDIT_MARGIN;
122 
123  //an additional fudge is necessary for MacOSX, not sure why
124 #if defined(Q_OS_MACX)
125  actualFinalHeight+=2;
126 #endif
127  }
128  //image is taller than wide, text and buttons will be placed to the right
129  else
130  {
131  finalHeight = 300;
132  finalWidth = (finalHeight * smallWidth) / smallHeight;
133 
134  //fix height
135  if(finalHeight + 2*EDIT_MARGIN > appRec.height())
136  {
137  finalHeight = appRec.height() - 2*EDIT_MARGIN;
138  finalWidth = (finalHeight * smallWidth) / smallHeight;
139  }
140 
141  //fix width
142  QString calibrationString( qApp->translate("PhotoDescEdit", "This is the photo description calibration string.") );
143  QFontMetrics fm( qApp->font() );
144  idealTextSize = fm.width( calibrationString );
145  if(finalWidth + idealTextSize + 2*EDIT_MARGIN > appRec.width() )
146  {
147  finalWidth = appRec.width() - idealTextSize - 2*EDIT_MARGIN;
148  finalHeight = (finalWidth * smallHeight) / smallWidth;
149  }
150 
151  //sanity check
152  if(finalWidth < 0)
153  {
154  finalWidth = (appRec.width() - 2*EDIT_MARGIN) / 2;
155  finalHeight = (finalWidth * smallHeight) / smallWidth;
156  idealTextSize = finalWidth;
157  }
158 
159  actualFinalWidth = finalWidth + idealTextSize + 2*EDIT_MARGIN;
160  actualFinalHeight = finalHeight + 2*EDIT_MARGIN;
161  }
162  //-----------------------------------------------
163  //setup scaled up image
164  //find full size photo dimensions, if unable to then use scaled up thumbnail image
165  int fullWidth, fullHeight;
166  if(!getImageSize( ppw->getPhoto()->getImageFilename(), fullWidth, fullHeight ) )
167  {
168  imageLarge = new QImage( QImage( ppw->getPhoto()->getThumbnailFilename()).
169  scaled(finalWidth,finalHeight, Qt::IgnoreAspectRatio ));
170  }
171  //else find cropped region of slideshow image using these dimensions
172  else
173  {
174  //load padded slideshow image
175  QImage paddedSSImage( ppw->getPhoto()->getSlideshowFilename() );
176 
177  //unpadded dimensions
178  int actualWidth, actualHeight;
179  calcScaledImageDimensions( fullWidth, fullHeight,
180  paddedSSImage.width(), paddedSSImage.height(),
181  actualWidth, actualHeight );
182 
183  //construct new image with padding removed
184  int leftOffset = (paddedSSImage.width() - actualWidth) / 2;
185  int topOffset = (paddedSSImage.height() - actualHeight) / 2;
186  QImage SSImage( actualWidth, actualHeight, paddedSSImage.depth() );
187 
188  int x, y;
189  for(x=0; x<actualWidth; x++)
190  {
191  for(y=0; y<actualHeight; y++)
192  {
193  SSImage.setPixel( x, y, QColor(Qt::red).rgb() );
194  SSImage.setPixel( x, y, paddedSSImage.pixel(x+leftOffset, y+topOffset) );
195  }
196  }
197  imageLarge = new QImage(SSImage.smoothScale(finalWidth,finalHeight, Qt::IgnoreAspectRatio ));
198  }
199  //-----------------------------------------------
200  //construct final text area pixmap used for morphing text region
201  TextEdit tmpTextEdit;
202  tmpTextEdit.setText( ppw->getPhoto()->getDescription() );
203 
204  if(smallWidth > smallHeight )
205  tmpTextEdit.resize( finalWidth, idealTextSize );
206  else
207  tmpTextEdit.resize( idealTextSize, finalHeight );
208 
209  tmpTextEdit.setLineWidth( 0 );
210  tmpTextEdit.setMargin( 0 );
211  tmpTextEdit.setMidLineWidth( 0 );
212  tmpTextEdit.setFrameStyle( Q3Frame::NoFrame | Q3Frame::Plain );
213 
214  tmpTextEdit.setWrapPolicy( Q3TextEdit::AtWordOrDocumentBoundary );
215  tmpTextEdit.constPolish();
216  tmpTextEdit.polish();
217 
218  tmpTextEdit.setWordWrap( Q3TextEdit::FixedPixelWidth );
219  if(smallWidth > smallHeight )
220  tmpTextEdit.setWrapColumnOrWidth( finalWidth );
221  else
222  tmpTextEdit.setWrapColumnOrWidth( idealTextSize );
223  tmpTextEdit.updateScrollBars();
224  tmpTextEdit.constPolish();
225  tmpTextEdit.polish();
226 
227  if(smallWidth > smallHeight )
228  {
229  if(tmpTextEdit.lines() > 4)
230  {
231  tmpTextEdit.setWrapColumnOrWidth( finalWidth - tmpTextEdit.verticalScrollBar()->width() );
232  tmpTextEdit.updateScrollBars();
233  tmpTextEdit.constPolish();
234  tmpTextEdit.polish();
235  }
236  }
237  else
238  {
239  QFontMetrics fm( qApp->font() );
240  if(tmpTextEdit.lines() > idealTextSize / (fm.leading() + fm.height()) )
241  {
242  tmpTextEdit.setWrapColumnOrWidth( idealTextSize - tmpTextEdit.verticalScrollBar()->width() );
243  tmpTextEdit.updateScrollBars();
244  tmpTextEdit.constPolish();
245  tmpTextEdit.polish();
246  }
247  }
248 
249  //paint to pixmap
250  tmpTextEdit.paintNow();
251  textRectangle = new QImage( QPixmap::grabWidget(&tmpTextEdit).convertToImage() );
252  //-----------------------------------------------
253  //set beginning and end positions
254  initPos = ppw->getPhotoPos();
255 
256  //offset by margin
257  initPos += QPoint( -EDIT_MARGIN, -EDIT_MARGIN );
258 
259  int initCenterX = initPos.x() + smallWidth/2;
260  int initCenterY = initPos.y() + smallHeight/2;
261 
262  finalPos = QPoint( initCenterX - actualFinalWidth/2, initCenterY - actualFinalHeight/2 );
263  if(finalPos.x() < appRec.x() )
264  finalPos.setX( appRec.x() );
265  if(finalPos.x() + actualFinalWidth > appRec.x() + appRec.width() )
266  finalPos.setX( appRec.x() + appRec.width()- actualFinalWidth );
267 
268  if(finalPos.y() < appRec.y() )
269  finalPos.setY( appRec.y() );
270  if(finalPos.y() + actualFinalHeight > appRec.y() + appRec.height() )
271  finalPos.setY( appRec.y() + appRec.height()- actualFinalHeight );
272  //-----------------------------------------------
273  //find bounding rectangle
274  left = QMIN( finalPos.x(), initPos.x() );
275  top = QMIN( finalPos.y(), initPos.y() );
276  right = QMAX( finalPos.x() + actualFinalWidth, initPos.x() + smallWidth );
277  bottom = QMAX( finalPos.y() + actualFinalHeight, initPos.y() + smallHeight );
278  //-----------------------------------------------
279  //grab window in region of interest, setup label and use this image
280  backgroundImage = new QPixmap( QPixmap::grabWindow(QApplication::desktop()->winId(),
281  left, top,
282  right-left, bottom-top) );
283  setBackgroundMode( Qt::NoBackground );
284  //-----------------------------------------------
285  //Setup animation widgets and place in main grid
286  animationLabel = new QLabel(this, "animationLabel", Qt::WNoAutoErase);
287  animationLabel->setPixmap( *backgroundImage );
288  animationLabel->setBackgroundMode( Qt::NoBackground );
289  buffer = new QPixmap( backgroundImage->width(), backgroundImage->height() );
290 
291  mainGrid = new Q3GridLayout( this, 1, 2, 0 );
292  mainGrid->addWidget(animationLabel, 0, 0 );
293  //-----------------------------------------------
294  //Setup static widgets
295  staticFrame = new QWidget(this);
296  staticFrame->hide();
297  staticFrame->setBackgroundMode( Qt::NoBackground );
298  mainGrid->addWidget(staticFrame, 0, 1 );
299 
300  staticPhoto = new QLabel( staticFrame, "staticPhoto", Qt::WNoAutoErase);
301  staticPhoto->setPixmap( QPixmap( *imageLarge) );
302  staticPhoto->setBackgroundMode( Qt::NoBackground );
303 
304  photoDesc = new TextEdit( staticFrame );
305  photoDesc->setText( ppw->getPhoto()->getDescription() );
306 
307  photoDesc->setWrapPolicy( Q3TextEdit::AtWordOrDocumentBoundary );
308  photoDesc->setFrameStyle( Q3Frame::NoFrame );
309  photoDesc->setLineWidth( 0 );
310  photoDesc->setMargin( 0 );
311  photoDesc->setMidLineWidth( 0 );
312  photoDesc->setFrameStyle( QFrame::StyledPanel | Q3Frame::Plain );
313 
314  //start disappearing once the text edit reports the user is finished
315  connect( photoDesc, SIGNAL( finished() ),
316  this, SLOT( disappear() ) );
317 
318  QWidget* bw1 = new QWidget(staticFrame);
319  QWidget* bw2 = new QWidget(staticFrame);
320  QWidget* bw3 = new QWidget(staticFrame);
321  QWidget* bw4 = new QWidget(staticFrame);
322  QColor darkBlue(35, 75, 139);
323  bw1->setPaletteBackgroundColor( darkBlue );
324  bw2->setPaletteBackgroundColor( darkBlue );
325  bw3->setPaletteBackgroundColor( darkBlue );
326  bw4->setPaletteBackgroundColor( darkBlue );
327 
328  //image is wider than tall, place text and buttons below image
329  if(smallWidth > smallHeight )
330  {
331  staticGrid = new Q3GridLayout( staticFrame, 4, 3);
332 
333  staticGrid->addWidget( staticPhoto, 1, 1 );
334  staticGrid->addWidget( photoDesc, 2, 1 );
335 
336  staticGrid->setColSpacing( 2, staticPhoto->width() );
337  staticGrid->setRowSpacing( 2, idealTextSize );
338 
339  staticGrid->addMultiCellWidget( bw1, 0, 0, 0, 2 );
340  staticGrid->addMultiCellWidget( bw2, 1, 2, 0, 0 );
341  staticGrid->addMultiCellWidget( bw3, 1, 2, 2, 2 );
342  staticGrid->addMultiCellWidget( bw4, 3, 3, 0, 2 );
343  staticGrid->setRowSpacing( 0, EDIT_MARGIN );
344  staticGrid->setRowSpacing( 3, EDIT_MARGIN );
345  staticGrid->setColSpacing( 0, EDIT_MARGIN );
346  staticGrid->setColSpacing( 2, EDIT_MARGIN );
347  }
348  else
349  {
350  staticGrid = new Q3GridLayout( staticFrame, 3, 4);
351 
352  staticGrid->addWidget( staticPhoto, 1, 1 );
353  staticGrid->addWidget( photoDesc, 1, 2 );
354 
355  staticGrid->setRowSpacing( 1, staticPhoto->height() );
356  staticGrid->setColSpacing( 2, idealTextSize );
357 
358  staticGrid->addMultiCellWidget( bw1, 0, 0, 0, 3 );
359  staticGrid->addWidget( bw2, 1, 0 );
360  staticGrid->addWidget( bw3, 1, 3 );
361  staticGrid->addMultiCellWidget( bw4, 2, 2, 0, 3 );
362  staticGrid->setRowSpacing( 0, EDIT_MARGIN );
363  staticGrid->setRowSpacing( 2, EDIT_MARGIN );
364  staticGrid->setColSpacing( 0, EDIT_MARGIN );
365  staticGrid->setColSpacing( 3, EDIT_MARGIN );
366  }
367  //-----------------------------------------------
368  //set delay defaults
369  initDelay = 130;
370  accel = 50;
371  minDelay = 1;
372 
373  this->useAnimation = useAnimation;
374  if(useAnimation)
375  step = 0;
376  else
377  step = 100;
378 
379  mode = STATIC;
380 
381  //create timer object and setup signals
382  timer = new QTimer();
383  connect(timer, SIGNAL(timeout()), this, SLOT(animate()) );
384  //---------------------------
385  //place widget in intial position
386  move( left, top );
387  show();
388 
389  //start appearing process
390  mode = APPEARING;
391  delay = initDelay;
392  lastTime.start();
393  animate();
394 }
395 //==============================================
397 {
398  delete textRectangle;
399  delete timer;
400  delete buffer;
401  delete backgroundImage;
402  delete imageLarge;
403 }
404 //==============================================
406 {
407  //---------------------------------
408  //determine # of ms that have passed since last redraw
409  currentTime.start();
410  double ms = lastTime.msecsTo(currentTime);
411 
412  //determine increment
413  int inc = (int)(ms/(delay+1));
414 
415  //if increment is not zero then update last time
416  if(inc != 0)
417  {
419 
420  //update step
421  step = step + inc;
422  if(step > 100)
423  step = 100;
424 
425  //update position and size
426  double alpha = ((double)step) / 100.0;
427  int newX, newY;
428  int imageW, imageH;
429  int textDim;
430  QColor darkBlue(35, 75, 139);
431  if(mode == APPEARING)
432  {
433  newX = (int)((1-alpha)*initPos.x() + alpha*finalPos.x());
434  newY = (int)((1-alpha)*initPos.y() + alpha*finalPos.y());
435  imageW = (int)((1-alpha)*smallWidth + alpha*imageLarge->width());
436  imageH = (int)((1-alpha)*smallHeight + alpha*imageLarge->height());
437  textDim = (int) (alpha * idealTextSize);
438  }
439  else
440  {
441  newX = (int)(alpha*initPos.x() + (1-alpha)*finalPos.x());
442  newY = (int)(alpha*initPos.y() + (1-alpha)*finalPos.y());
443  imageW = (int)(alpha*smallWidth + (1-alpha)*imageLarge->width());
444  imageH = (int)(alpha*smallHeight + (1-alpha)*imageLarge->height());
445  textDim = (int) ((1-alpha) * idealTextSize);
446  }
447 
448  //draw background image to buffer
449  QPainter bufferPainter( buffer );
450  bufferPainter.drawPixmap(0,0, *backgroundImage );
451 
452  //draw selection and white text rectangles
453  if(smallWidth > smallHeight )
454  {
455  bufferPainter.fillRect( newX - left,
456  newY - top,
457  imageW + 2*EDIT_MARGIN,
458  imageH + 2*EDIT_MARGIN + textDim,
459  darkBlue );
460 
461  bufferPainter.drawPixmap( newX - left + EDIT_MARGIN,
462  newY - top + EDIT_MARGIN + imageH,
463  QPixmap( textRectangle->scaled( imageW, textDim ) ) );
464  }
465  else
466  {
467  bufferPainter.fillRect( newX - left, newY - top,
468  imageW + 2*EDIT_MARGIN + textDim,
469  imageH + 2*EDIT_MARGIN,
470  darkBlue );
471 
472  bufferPainter.drawPixmap( newX - left + EDIT_MARGIN + imageW,
473  newY - top + EDIT_MARGIN,
474  QPixmap( textRectangle->scaled( textDim, imageH ) ) );
475  }
476 
477  //draw scaled moved image to buffer
478  bufferPainter.drawPixmap( newX - left + EDIT_MARGIN,
479  newY - top + EDIT_MARGIN,
480  QPixmap( imageLarge->scaled( imageW, imageH ) ) );
481 
482  //set label to use buffer pixmap
483  animationLabel->setPixmap( *buffer );
484  }
485 
486  //not done restart timer
487  if(step < 100)
488  {
489  //update speed
490  delay = delay - accel;
491  if(delay < minDelay) delay = minDelay;
492 
493  //restart timer
494  timer->start( delay, TRUE );
495  }
496  else
497  {
498  if(mode == APPEARING)
499  {
500  animationLabel->hide();
501  staticFrame->show();
502 
503  //auto focus text area, put cursor at very end
504  photoDesc->setFocus();
505 
506  mode = STATIC;
507  }
508  else
509  {
510  //reenable drop shadows on windows xp if they were previously enabled
511  #if defined(Q_OS_WIN)
513  SystemParametersInfo( SPI_SETDROPSHADOW, 0, &dropShadowsEnabled, 0 );
514  else
515  SystemParametersInfo( SPI_SETDROPSHADOW, 0, NULL, 0 );
516  #endif //Q_OS_WIN
517 
518  mode = DISAPPEARED;
519  hide();
520  qApp->mainWidget()->repaint(false);
521  }
522  }
523 }
524 //==============================================
526 {
527  delete textRectangle;
528  textRectangle = new QImage( QPixmap::grabWidget(photoDesc).convertToImage() );
529 
530  ppw->getPhoto()->setDescription( photoDesc->text() );
531  ppw->setText( photoDesc->text() );
532 
533  //start disappearing process
534  staticFrame->hide();
535  animationLabel->show();
536 
537  initDelay = 130;
538  accel = 50;
539  minDelay = 1;
540 
541  if(useAnimation)
542  step = 0;
543  else
544  step = 100;
545 
546  mode = DISAPPEARING;
547  lastTime.start();
548  animate();
549 }
550 //==============================================
552 {
553  if(mode == DISAPPEARED )
554  {
555  QWidget::hide();
556 
557  //check to see if mouse is over a new item,
558  //if so immediately set it as being moused over
559  Q3IconView* iconView = ppw->iconView();
560  Q3IconViewItem* item = iconView->findItem( iconView->viewport()->mapFromGlobal( QCursor::pos() )+=QPoint( iconView->contentsX(), iconView->contentsY() ) );
561  if(item != NULL && item != ppw )
562  {
563  ((PhotosIconView*)item->iconView())->repaintGroup( item );
564  }
565  }
566  else if(mode == STATIC)
567  {
568  disappear();
569  }
570 }
571 //==============================================
572 TextEdit::TextEdit( QWidget* parent, const char* name ) : Q3TextEdit(parent,name)
573 {
574  setHScrollBarMode( Q3ScrollView::AlwaysOff );
575  setTextFormat( Qt::PlainText );
576  contextMenu = NULL;
577 }
578 //==============================================
580 {
581  constPolish();
582  repaint( rect(), false );
583 }
584 //==============================================
585 void TextEdit::keyPressEvent ( QKeyEvent * e )
586 {
587  //finish when user hits escape
588  if( e->key() == Qt::Key_Escape )
589  {
590  emit finished();
591  }
592  //if Ctrl+A then select all text, otherwise, apply base class key press rules
593  else if( (e->state() & Qt::ControlModifier) && e->key() == Qt::Key_A )
594  {
595  selectAll();
596  }
597  else
598  {
599  Q3TextEdit::keyPressEvent( e );
600  }
601 }
602 //==============================================
603 void TextEdit::focusOutEvent ( QFocusEvent * )
604 {
605  //if user right clicked on text field a context menu is popping up so ignore focusOut.
606  //otherwise user has clicked off photo description so close
607  if( contextMenu == NULL ) emit finished();
608 }
609 //==============================================
610 Q3PopupMenu* TextEdit::createPopupMenu ( const QPoint& pos )
611 {
612  //when context menu's are created store their handle
613  contextMenu = Q3TextEdit::createPopupMenu( pos );
614  connect( ((QObject*)contextMenu), SIGNAL(aboutToHide()),
615  this, SLOT(contextMenuHiding()) );
616  return contextMenu;
617 }
618 //==============================================
620 {
621  //clear context menu handle since it's disappearing
622  disconnect( ((QObject*)contextMenu), SIGNAL(aboutToHide()),
623  this, SLOT(contextMenuHiding()) );
624  contextMenu = NULL;
625 }
626 //==============================================
QPixmap * buffer
buffer we&#39;ll iteratively update and use for the label which shows the animation taking place ...
Definition: photoDescEdit.h:99
#define DISAPPEARED
Definition: photoDescEdit.h:36
QString getImageFilename()
Gets the image filename.
Definition: photo.cpp:192
QWidget * staticFrame
frame which contains static widget
void paintNow()
QImage * textRectangle
text area widget used to computing painting surface
Definition: photoDescEdit.h:72
Q3GridLayout * mainGrid
Definition: photoDescEdit.h:91
void setText(const QString &text)
Photo * getPhoto()
Returns photo pointer.
#define APPEARING
Definition: photoDescEdit.h:34
TextEdit(QWidget *parent=0, const char *name=0)
int idealTextSize
ultimate text dimension
Definition: photoDescEdit.h:81
Displays photo thumbnail and description.
#define EDIT_MARGIN
QString getThumbnailFilename()
Gets the thumbnail filename.
Definition: photo.cpp:194
Q3GridLayout * staticGrid
Static Widgets
TextEdit * photoDesc
photo description
QImage * imageLarge
beginning and end pixmaps
Definition: photoDescEdit.h:69
int initDelay
Animation Stuff
#define DISAPPEARING
Definition: photoDescEdit.h:35
void contextMenuHiding()
void setDescription(QString val)
Sets the description.
Definition: photo.cpp:210
Extension of iconview, used to list all photos in a subalbum. supports drag-n-drop within iconview...
Q3PopupMenu * createPopupMenu(const QPoint &pos)
void finished()
void disappear()
this method is called by the acceptAndClose and rejectAndClose slots and actually initiates the closi...
int smallWidth
small size
Definition: photoDescEdit.h:88
QLabel * staticPhoto
photo being displayed
QLabel * animationLabel
Animating Widgets
Definition: photoDescEdit.h:96
bool getImageSize(const char *filename, QSize &size)
Get image dimensions.
Definition: imageTools.cpp:192
int left
bounaries of entire animation
Definition: photoDescEdit.h:78
#define STATIC
Definition: photoDescEdit.h:33
void animate()
this method is iteratively called and animates the opening/closing of the image
QTimer * timer
QString getSlideshowFilename()
Gets the slideshow filename.
Definition: photo.cpp:193
void focusOutEvent(QFocusEvent *)
PhotoPreviewWidget * ppw
photo preview widget pointer
Definition: photoDescEdit.h:66
void keyPressEvent(QKeyEvent *e)
QString getDescription()
Gets the description.
Definition: photo.cpp:208
PhotoDescEdit(PhotoPreviewWidget *ppw, bool useAnimation, QWidget *parent=0, const char *name=0)
QPixmap * backgroundImage
this pixmap contains the screen contents for the entire region which we will be painting on top of ...
Definition: photoDescEdit.h:85
Q3PopupMenu * contextMenu
void calcScaledImageDimensions(int origWidth, int origHeight, int idealWidth, int idealHeight, int &width, int &height)
Computes scale of image dimensions while respecting aspect ratio, equivalent to a QImage::scaleMin wi...
Definition: imageTools.cpp:39
bool dropShadowsEnabled
are drop shadows enabled in windows (xp)?
bool useAnimation
actually animate the opening/closing process?
Definition: photoDescEdit.h:63