#include <photoDescEdit.h>
Public Slots | |
void | hide () |
Public Member Functions | |
PhotoDescEdit (PhotoPreviewWidget *ppw, bool useAnimation, QWidget *parent=0, const char *name=0) | |
~PhotoDescEdit () | |
Private Slots | |
void | animate () |
this method is iteratively called and animates the opening/closing of the image | |
void | disappear () |
this method is called by the acceptAndClose and rejectAndClose slots and actually initiates the closing process | |
Private Attributes | |
bool | useAnimation |
actually animate the opening/closing process? | |
PhotoPreviewWidget * | ppw |
photo preview widget pointer | |
QImage * | imageLarge |
beginning and end pixmaps | |
QImage * | textRectangle |
text area widget used to computing painting surface | |
QPoint | initPos |
QPoint | finalPos |
int | left |
bounaries of entire animation | |
int | right |
int | top |
int | bottom |
int | idealTextSize |
ultimate text dimension | |
QPixmap * | backgroundImage |
this pixmap contains the screen contents for the entire region which we will be painting on top of | |
int | smallWidth |
small size | |
int | smallHeight |
QGridLayout * | mainGrid |
------------------------------------- | |
QLabel * | animationLabel |
------------------------------------- Animating Widgets | |
QPixmap * | buffer |
buffer we'll iteratively update and use for the label which shows the animation taking place | |
QGridLayout * | staticGrid |
------------------------------------- Static Widgets | |
QWidget * | staticFrame |
frame which contains static widget | |
QLabel * | staticPhoto |
photo being displayed | |
TextEdit * | photoDesc |
photo description | |
int | initDelay |
------------------------------------- Animation Stuff | |
int | accel |
int | minDelay |
int | step |
int | delay |
int | mode |
bool | dropShadowsEnabled |
are drop shadows enabled in windows (xp)? | |
QTimer * | timer |
QTime | lastTime |
QTime | currentTime |
Definition at line 35 of file photoDescEdit.h.
PhotoDescEdit::PhotoDescEdit | ( | PhotoPreviewWidget * | ppw, | |
bool | useAnimation, | |||
QWidget * | parent = 0 , |
|||
const char * | name = 0 | |||
) |
Definition at line 47 of file photoDescEdit.cpp.
References accel, animate(), animationLabel, APPEARING, backgroundImage, bottom, buffer, calcScaledImageDimensions(), delay, disappear(), dropShadowsEnabled, EDIT_MARGIN, finalPos, Photo::getDescription(), Photo::getImageFilename(), getImageSize(), PhotoPreviewWidget::getPhoto(), PhotoPreviewWidget::getPhotoPos(), Photo::getSlideshowFilename(), Photo::getThumbnailFilename(), idealTextSize, imageLarge, initDelay, initPos, lastTime, left, mainGrid, minDelay, mode, TextEdit::paintNow(), photoDesc, right, smallHeight, smallWidth, STATIC, staticFrame, staticGrid, staticPhoto, step, textRectangle, timer, and top.
00049 : 00050 QWidget(parent,name, 00051 Qt::WStyle_Customize | 00052 #if defined(Q_OS_MACX) 00053 Qt::WStyle_Splash ) 00054 #else 00055 Qt::WStyle_NoBorder | Qt::WType_Popup ) 00056 #endif 00057 { 00058 //PLATFORM_SPECIFIC_CODE 00059 //disable drop shadow on mac os x 00060 #if defined(Q_OS_MACX) 00061 ChangeWindowAttributes( (OpaqueWindowPtr*)winId(), kWindowNoShadowAttribute, kWindowNoAttributes ); 00062 #endif 00063 00064 //PLATFORM_SPECIFIC_CODE 00065 //disable drop shadow on win xp 00066 #if defined(Q_OS_WIN) 00067 SystemParametersInfo( SPI_GETDROPSHADOW, 0, &dropShadowsEnabled, 0 ); 00068 SystemParametersInfo( SPI_SETDROPSHADOW, 0, NULL, 0 ); 00069 #endif 00070 00071 this->ppw = ppw; 00072 //----------------------------------------------- 00073 //don't erase before painting, avoids flicker 00074 setWFlags(WNoAutoErase); 00075 //----------------------------------------------- 00076 //determine small image size 00077 getImageSize( ppw->getPhoto()->getThumbnailFilename(), smallWidth, smallHeight ); 00078 //------------------------------------------- 00079 QRect appRec = qApp->mainWidget()->frameGeometry(); 00080 int finalWidth, finalHeight; 00081 int actualFinalWidth, actualFinalHeight; 00082 00083 //image is wider than tall, place text and buttons below image 00084 if(smallWidth > smallHeight ) 00085 { 00086 finalWidth = 400; 00087 finalHeight = (finalWidth * smallHeight) / smallWidth; 00088 00089 //fix width 00090 if(finalWidth +2*EDIT_MARGIN> appRec.width()) 00091 { 00092 finalWidth = appRec.width() - 2*EDIT_MARGIN; 00093 finalHeight = (finalWidth * smallHeight) / smallWidth; 00094 } 00095 00096 //fix height 00097 QFontMetrics fm( qApp->font() ); 00098 idealTextSize = 4*fm.height() + 5*fm.leading() + 4; 00099 00100 if(finalHeight + idealTextSize + 2*EDIT_MARGIN > appRec.height() ) 00101 { 00102 finalHeight = appRec.height() - idealTextSize - 2*EDIT_MARGIN; 00103 finalWidth = (finalHeight * smallWidth) / smallHeight; 00104 } 00105 00106 //sanity check 00107 if(finalHeight < 0) 00108 { 00109 finalHeight = (appRec.height() - 2*EDIT_MARGIN) / 2; 00110 finalWidth = (finalHeight * smallWidth) / smallHeight; 00111 idealTextSize = finalHeight; 00112 } 00113 00114 actualFinalWidth = finalWidth + 2*EDIT_MARGIN; 00115 actualFinalHeight = finalHeight + idealTextSize + 2*EDIT_MARGIN; 00116 00117 //an additional fudge is necessary for MacOSX, not sure why 00118 #if defined(Q_OS_MACX) 00119 actualFinalHeight+=2; 00120 #endif 00121 } 00122 //image is taller than wide, text and buttons will be placed to the right 00123 else 00124 { 00125 finalHeight = 300; 00126 finalWidth = (finalHeight * smallWidth) / smallHeight; 00127 00128 //fix height 00129 if(finalHeight + 2*EDIT_MARGIN > appRec.height()) 00130 { 00131 finalHeight = appRec.height() - 2*EDIT_MARGIN; 00132 finalWidth = (finalHeight * smallWidth) / smallHeight; 00133 } 00134 00135 //fix width 00136 QString calibrationString( qApp->translate("PhotoDescEdit", "This is the photo description calibration string.") ); 00137 QFontMetrics fm( qApp->font() ); 00138 idealTextSize = fm.width( calibrationString ); 00139 if(finalWidth + idealTextSize + 2*EDIT_MARGIN > appRec.width() ) 00140 { 00141 finalWidth = appRec.width() - idealTextSize - 2*EDIT_MARGIN; 00142 finalHeight = (finalWidth * smallHeight) / smallWidth; 00143 } 00144 00145 //sanity check 00146 if(finalWidth < 0) 00147 { 00148 finalWidth = (appRec.width() - 2*EDIT_MARGIN) / 2; 00149 finalHeight = (finalWidth * smallHeight) / smallWidth; 00150 idealTextSize = finalWidth; 00151 } 00152 00153 actualFinalWidth = finalWidth + idealTextSize + 2*EDIT_MARGIN; 00154 actualFinalHeight = finalHeight + 2*EDIT_MARGIN; 00155 } 00156 //----------------------------------------------- 00157 //setup scaled up image 00158 //find full size photo dimensions, if unable to then use scaled up thumbnail image 00159 int fullWidth, fullHeight; 00160 if(!getImageSize( ppw->getPhoto()->getImageFilename(), fullWidth, fullHeight ) ) 00161 { 00162 imageLarge = new QImage( QImage( ppw->getPhoto()->getThumbnailFilename()). 00163 scale(finalWidth,finalHeight, QImage::ScaleFree )); 00164 } 00165 //else find cropped region of slideshow image using these dimensions 00166 else 00167 { 00168 //load padded slideshow image 00169 QImage paddedSSImage( ppw->getPhoto()->getSlideshowFilename() ); 00170 00171 //unpadded dimensions 00172 int actualWidth, actualHeight; 00173 calcScaledImageDimensions( fullWidth, fullHeight, 00174 paddedSSImage.width(), paddedSSImage.height(), 00175 actualWidth, actualHeight ); 00176 00177 //construct new image with padding removed 00178 int leftOffset = (paddedSSImage.width() - actualWidth) / 2; 00179 int topOffset = (paddedSSImage.height() - actualHeight) / 2; 00180 QImage SSImage( actualWidth, actualHeight, paddedSSImage.depth() ); 00181 00182 int x, y; 00183 for(x=0; x<actualWidth; x++) 00184 { 00185 for(y=0; y<actualHeight; y++) 00186 { 00187 SSImage.setPixel( x, y, red.rgb() ); 00188 SSImage.setPixel( x, y, paddedSSImage.pixel(x+leftOffset, y+topOffset) ); 00189 } 00190 } 00191 imageLarge = new QImage(SSImage.smoothScale(finalWidth,finalHeight, QImage::ScaleFree )); 00192 } 00193 //----------------------------------------------- 00194 //construct final text area pixmap used for morphing text region 00195 TextEdit tmpTextEdit; 00196 tmpTextEdit.setText( ppw->getPhoto()->getDescription() ); 00197 00198 if(smallWidth > smallHeight ) 00199 tmpTextEdit.resize( finalWidth, idealTextSize ); 00200 else 00201 tmpTextEdit.resize( idealTextSize, finalHeight ); 00202 00203 tmpTextEdit.setLineWidth( 0 ); 00204 tmpTextEdit.setMargin( 0 ); 00205 tmpTextEdit.setMidLineWidth( 0 ); 00206 tmpTextEdit.setFrameStyle( QFrame::NoFrame | QFrame::Plain ); 00207 00208 tmpTextEdit.setWrapPolicy( QTextEdit::AtWordOrDocumentBoundary ); 00209 tmpTextEdit.constPolish(); 00210 tmpTextEdit.polish(); 00211 00212 tmpTextEdit.setWordWrap( QTextEdit::FixedPixelWidth ); 00213 if(smallWidth > smallHeight ) 00214 tmpTextEdit.setWrapColumnOrWidth( finalWidth ); 00215 else 00216 tmpTextEdit.setWrapColumnOrWidth( idealTextSize ); 00217 tmpTextEdit.updateScrollBars(); 00218 tmpTextEdit.constPolish(); 00219 tmpTextEdit.polish(); 00220 00221 if(smallWidth > smallHeight ) 00222 { 00223 if(tmpTextEdit.lines() > 4) 00224 { 00225 tmpTextEdit.setWrapColumnOrWidth( finalWidth - tmpTextEdit.verticalScrollBar()->width() ); 00226 tmpTextEdit.updateScrollBars(); 00227 tmpTextEdit.constPolish(); 00228 tmpTextEdit.polish(); 00229 } 00230 } 00231 else 00232 { 00233 QFontMetrics fm( qApp->font() ); 00234 if(tmpTextEdit.lines() > idealTextSize / (fm.leading() + fm.height()) ) 00235 { 00236 tmpTextEdit.setWrapColumnOrWidth( idealTextSize - tmpTextEdit.verticalScrollBar()->width() ); 00237 tmpTextEdit.updateScrollBars(); 00238 tmpTextEdit.constPolish(); 00239 tmpTextEdit.polish(); 00240 } 00241 } 00242 00243 //paint to pixmap 00244 tmpTextEdit.paintNow(); 00245 textRectangle = new QImage( QPixmap::grabWidget(&tmpTextEdit).convertToImage() ); 00246 //----------------------------------------------- 00247 //set beginning and end positions 00248 initPos = ppw->getPhotoPos(); 00249 00250 //offset by margin 00251 initPos += QPoint( -EDIT_MARGIN, -EDIT_MARGIN ); 00252 00253 int initCenterX = initPos.x() + smallWidth/2; 00254 int initCenterY = initPos.y() + smallHeight/2; 00255 00256 finalPos = QPoint( initCenterX - actualFinalWidth/2, initCenterY - actualFinalHeight/2 ); 00257 if(finalPos.x() < appRec.x() ) 00258 finalPos.setX( appRec.x() ); 00259 if(finalPos.x() + actualFinalWidth > appRec.x() + appRec.width() ) 00260 finalPos.setX( appRec.x() + appRec.width()- actualFinalWidth ); 00261 00262 if(finalPos.y() < appRec.y() ) 00263 finalPos.setY( appRec.y() ); 00264 if(finalPos.y() + actualFinalHeight > appRec.y() + appRec.height() ) 00265 finalPos.setY( appRec.y() + appRec.height()- actualFinalHeight ); 00266 //----------------------------------------------- 00267 //find bounding rectangle 00268 left = QMIN( finalPos.x(), initPos.x() ); 00269 top = QMIN( finalPos.y(), initPos.y() ); 00270 right = QMAX( finalPos.x() + actualFinalWidth, initPos.x() + smallWidth ); 00271 bottom = QMAX( finalPos.y() + actualFinalHeight, initPos.y() + smallHeight ); 00272 //----------------------------------------------- 00273 //grab window in region of interest, setup label and use this image 00274 backgroundImage = new QPixmap( QPixmap::grabWindow(QApplication::desktop()->winId(), 00275 left, top, 00276 right-left, bottom-top) ); 00277 setBackgroundMode( Qt::NoBackground ); 00278 //----------------------------------------------- 00279 //Setup animation widgets and place in main grid 00280 animationLabel = new QLabel(this, "animationLabel", WNoAutoErase); 00281 animationLabel->setPixmap( *backgroundImage ); 00282 animationLabel->setBackgroundMode( Qt::NoBackground ); 00283 buffer = new QPixmap( backgroundImage->width(), backgroundImage->height() ); 00284 00285 mainGrid = new QGridLayout( this, 1, 2, 0 ); 00286 mainGrid->addWidget(animationLabel, 0, 0 ); 00287 //----------------------------------------------- 00288 //Setup static widgets 00289 staticFrame = new QWidget(this); 00290 staticFrame->hide(); 00291 staticFrame->setBackgroundMode( Qt::NoBackground ); 00292 mainGrid->addWidget(staticFrame, 0, 1 ); 00293 00294 staticPhoto = new QLabel( staticFrame, "staticPhoto", WNoAutoErase); 00295 staticPhoto->setPixmap( QPixmap( *imageLarge) ); 00296 staticPhoto->setBackgroundMode( Qt::NoBackground ); 00297 00298 photoDesc = new TextEdit( staticFrame ); 00299 photoDesc->setText( ppw->getPhoto()->getDescription() ); 00300 00301 photoDesc->setWrapPolicy( QTextEdit::AtWordOrDocumentBoundary ); 00302 photoDesc->setFrameStyle( QFrame::NoFrame ); 00303 photoDesc->setLineWidth( 0 ); 00304 photoDesc->setMargin( 0 ); 00305 photoDesc->setMidLineWidth( 0 ); 00306 photoDesc->setFrameStyle( QFrame::MenuBarPanel | QFrame::Plain ); 00307 00308 //start disappearing once the text edit reports the user is finished 00309 connect( photoDesc, SIGNAL( finished() ), 00310 this, SLOT( disappear() ) ); 00311 00312 QWidget* bw1 = new QWidget(staticFrame); 00313 QWidget* bw2 = new QWidget(staticFrame); 00314 QWidget* bw3 = new QWidget(staticFrame); 00315 QWidget* bw4 = new QWidget(staticFrame); 00316 QColor darkBlue(35, 75, 139); 00317 bw1->setPaletteBackgroundColor( darkBlue ); 00318 bw2->setPaletteBackgroundColor( darkBlue ); 00319 bw3->setPaletteBackgroundColor( darkBlue ); 00320 bw4->setPaletteBackgroundColor( darkBlue ); 00321 00322 //image is wider than tall, place text and buttons below image 00323 if(smallWidth > smallHeight ) 00324 { 00325 staticGrid = new QGridLayout( staticFrame, 4, 3); 00326 00327 staticGrid->addWidget( staticPhoto, 1, 1 ); 00328 staticGrid->addWidget( photoDesc, 2, 1 ); 00329 00330 staticGrid->setColSpacing( 2, staticPhoto->width() ); 00331 staticGrid->setRowSpacing( 2, idealTextSize ); 00332 00333 staticGrid->addMultiCellWidget( bw1, 0, 0, 0, 2 ); 00334 staticGrid->addMultiCellWidget( bw2, 1, 2, 0, 0 ); 00335 staticGrid->addMultiCellWidget( bw3, 1, 2, 2, 2 ); 00336 staticGrid->addMultiCellWidget( bw4, 3, 3, 0, 2 ); 00337 staticGrid->setRowSpacing( 0, EDIT_MARGIN ); 00338 staticGrid->setRowSpacing( 3, EDIT_MARGIN ); 00339 staticGrid->setColSpacing( 0, EDIT_MARGIN ); 00340 staticGrid->setColSpacing( 2, EDIT_MARGIN ); 00341 } 00342 else 00343 { 00344 staticGrid = new QGridLayout( staticFrame, 3, 4); 00345 00346 staticGrid->addWidget( staticPhoto, 1, 1 ); 00347 staticGrid->addWidget( photoDesc, 1, 2 ); 00348 00349 staticGrid->setRowSpacing( 1, staticPhoto->height() ); 00350 staticGrid->setColSpacing( 2, idealTextSize ); 00351 00352 staticGrid->addMultiCellWidget( bw1, 0, 0, 0, 3 ); 00353 staticGrid->addWidget( bw2, 1, 0 ); 00354 staticGrid->addWidget( bw3, 1, 3 ); 00355 staticGrid->addMultiCellWidget( bw4, 2, 2, 0, 3 ); 00356 staticGrid->setRowSpacing( 0, EDIT_MARGIN ); 00357 staticGrid->setRowSpacing( 2, EDIT_MARGIN ); 00358 staticGrid->setColSpacing( 0, EDIT_MARGIN ); 00359 staticGrid->setColSpacing( 3, EDIT_MARGIN ); 00360 } 00361 //----------------------------------------------- 00362 //set delay defaults 00363 initDelay = 130; 00364 accel = 50; 00365 minDelay = 1; 00366 00367 this->useAnimation = useAnimation; 00368 if(useAnimation) 00369 step = 0; 00370 else 00371 step = 100; 00372 00373 mode = STATIC; 00374 00375 //create timer object and setup signals 00376 timer = new QTimer(); 00377 connect(timer, SIGNAL(timeout()), this, SLOT(animate()) ); 00378 //--------------------------- 00379 //place widget in intial position 00380 move( left, top ); 00381 show(); 00382 00383 //start appearing process 00384 mode = APPEARING; 00385 delay = initDelay; 00386 lastTime.start(); 00387 animate(); }
PhotoDescEdit::~PhotoDescEdit | ( | ) |
Definition at line 389 of file photoDescEdit.cpp.
References backgroundImage, buffer, imageLarge, textRectangle, and timer.
00390 { 00391 delete textRectangle; 00392 delete timer; 00393 delete buffer; 00394 delete backgroundImage; 00395 delete imageLarge; 00396 }
void PhotoDescEdit::animate | ( | ) | [private, slot] |
this method is iteratively called and animates the opening/closing of the image
Definition at line 398 of file photoDescEdit.cpp.
References accel, animationLabel, APPEARING, backgroundImage, buffer, currentTime, delay, DISAPPEARED, dropShadowsEnabled, EDIT_MARGIN, finalPos, hide(), idealTextSize, imageLarge, initPos, lastTime, left, minDelay, mode, photoDesc, smallHeight, smallWidth, STATIC, staticFrame, step, textRectangle, timer, and top.
Referenced by disappear(), and PhotoDescEdit().
00399 { 00400 //--------------------------------- 00401 //determine # of ms that have passed since last redraw 00402 currentTime.start(); 00403 double ms = lastTime.msecsTo(currentTime); 00404 00405 //determine increment 00406 int inc = (int)(ms/(delay+1)); 00407 00408 //if increment is not zero then update last time 00409 if(inc != 0) 00410 { 00411 lastTime = currentTime; 00412 00413 //update step 00414 step = step + inc; 00415 if(step > 100) 00416 step = 100; 00417 00418 //update position and size 00419 double alpha = ((double)step) / 100.0; 00420 int newX, newY; 00421 int imageW, imageH; 00422 int textDim; 00423 QColor darkBlue(35, 75, 139); 00424 if(mode == APPEARING) 00425 { 00426 newX = (int)((1-alpha)*initPos.x() + alpha*finalPos.x()); 00427 newY = (int)((1-alpha)*initPos.y() + alpha*finalPos.y()); 00428 imageW = (int)((1-alpha)*smallWidth + alpha*imageLarge->width()); 00429 imageH = (int)((1-alpha)*smallHeight + alpha*imageLarge->height()); 00430 textDim = (int) (alpha * idealTextSize); 00431 } 00432 else 00433 { 00434 newX = (int)(alpha*initPos.x() + (1-alpha)*finalPos.x()); 00435 newY = (int)(alpha*initPos.y() + (1-alpha)*finalPos.y()); 00436 imageW = (int)(alpha*smallWidth + (1-alpha)*imageLarge->width()); 00437 imageH = (int)(alpha*smallHeight + (1-alpha)*imageLarge->height()); 00438 textDim = (int) ((1-alpha) * idealTextSize); 00439 } 00440 00441 //draw background image to buffer 00442 QPainter bufferPainter( buffer ); 00443 bufferPainter.drawPixmap(0,0, *backgroundImage ); 00444 00445 //draw selection and white text rectangles 00446 if(smallWidth > smallHeight ) 00447 { 00448 bufferPainter.fillRect( newX - left, 00449 newY - top, 00450 imageW + 2*EDIT_MARGIN, 00451 imageH + 2*EDIT_MARGIN + textDim, 00452 darkBlue ); 00453 00454 bufferPainter.drawPixmap( newX - left + EDIT_MARGIN, 00455 newY - top + EDIT_MARGIN + imageH, 00456 QPixmap( textRectangle->scale( imageW, textDim ) ) ); 00457 } 00458 else 00459 { 00460 bufferPainter.fillRect( newX - left, newY - top, 00461 imageW + 2*EDIT_MARGIN + textDim, 00462 imageH + 2*EDIT_MARGIN, 00463 darkBlue ); 00464 00465 bufferPainter.drawPixmap( newX - left + EDIT_MARGIN + imageW, 00466 newY - top + EDIT_MARGIN, 00467 QPixmap( textRectangle->scale( textDim, imageH ) ) ); 00468 } 00469 00470 //draw scaled moved image to buffer 00471 bufferPainter.drawPixmap( newX - left + EDIT_MARGIN, 00472 newY - top + EDIT_MARGIN, 00473 QPixmap( imageLarge->scale( imageW, imageH ) ) ); 00474 00475 //set label to use buffer pixmap 00476 animationLabel->setPixmap( *buffer ); 00477 } 00478 00479 //not done restart timer 00480 if(step < 100) 00481 { 00482 //update speed 00483 delay = delay - accel; 00484 if(delay < minDelay) delay = minDelay; 00485 00486 //restart timer 00487 timer->start( delay, TRUE ); 00488 } 00489 else 00490 { 00491 if(mode == APPEARING) 00492 { 00493 animationLabel->hide(); 00494 staticFrame->show(); 00495 00496 //auto focus text area, put cursor at very end 00497 photoDesc->setFocus(); 00498 00499 mode = STATIC; 00500 } 00501 else 00502 { 00503 //reenable drop shadows on windows xp if they were previously enabled 00504 #if defined(Q_OS_WIN) 00505 if(dropShadowsEnabled) 00506 SystemParametersInfo( SPI_SETDROPSHADOW, 0, &dropShadowsEnabled, 0 ); 00507 else 00508 SystemParametersInfo( SPI_SETDROPSHADOW, 0, NULL, 0 ); 00509 #endif //Q_OS_WIN 00510 00511 mode = DISAPPEARED; 00512 hide(); 00513 qApp->mainWidget()->repaint(false); 00514 } 00515 } 00516 }
void PhotoDescEdit::disappear | ( | ) | [private, slot] |
this method is called by the acceptAndClose and rejectAndClose slots and actually initiates the closing process
Definition at line 518 of file photoDescEdit.cpp.
References accel, animate(), animationLabel, DISAPPEARING, PhotoPreviewWidget::getPhoto(), initDelay, lastTime, minDelay, mode, photoDesc, ppw, Photo::setDescription(), PhotoPreviewWidget::setText(), staticFrame, step, textRectangle, and useAnimation.
Referenced by hide(), and PhotoDescEdit().
00519 { 00520 delete textRectangle; 00521 textRectangle = new QImage( QPixmap::grabWidget(photoDesc).convertToImage() ); 00522 00523 ppw->getPhoto()->setDescription( photoDesc->text() ); 00524 ppw->setText( photoDesc->text() ); 00525 00526 //start disappearing process 00527 staticFrame->hide(); 00528 animationLabel->show(); 00529 00530 initDelay = 130; 00531 accel = 50; 00532 minDelay = 1; 00533 00534 if(useAnimation) 00535 step = 0; 00536 else 00537 step = 100; 00538 00539 mode = DISAPPEARING; 00540 lastTime.start(); 00541 animate(); 00542 }
void PhotoDescEdit::hide | ( | ) | [slot] |
Definition at line 544 of file photoDescEdit.cpp.
References disappear(), DISAPPEARED, mode, ppw, and STATIC.
Referenced by animate().
00545 { 00546 if(mode == DISAPPEARED ) 00547 { 00548 QWidget::hide(); 00549 00550 //check to see if mouse is over a new item, 00551 //if so immediately set it as being moused over 00552 QIconView* iconView = ppw->iconView(); 00553 QIconViewItem* item = iconView->findItem( iconView->viewport()->mapFromGlobal( QCursor::pos() )+=QPoint( iconView->contentsX(), iconView->contentsY() ) ); 00554 if(item != NULL && item != ppw ) 00555 { 00556 ((PhotosIconView*)item->iconView())->repaintGroup( item ); 00557 } 00558 } 00559 else if(mode == STATIC) 00560 { 00561 disappear(); 00562 } 00563 }
int PhotoDescEdit::accel [private] |
Definition at line 111 of file photoDescEdit.h.
Referenced by animate(), disappear(), and PhotoDescEdit().
QLabel* PhotoDescEdit::animationLabel [private] |
------------------------------------- Animating Widgets
label which shows moving and expanding photo on background
Definition at line 89 of file photoDescEdit.h.
Referenced by animate(), disappear(), and PhotoDescEdit().
QPixmap* PhotoDescEdit::backgroundImage [private] |
this pixmap contains the screen contents for the entire region which we will be painting on top of
Definition at line 78 of file photoDescEdit.h.
Referenced by animate(), PhotoDescEdit(), and ~PhotoDescEdit().
int PhotoDescEdit::bottom [private] |
Definition at line 71 of file photoDescEdit.h.
Referenced by PhotoDescEdit().
QPixmap* PhotoDescEdit::buffer [private] |
buffer we'll iteratively update and use for the label which shows the animation taking place
Definition at line 92 of file photoDescEdit.h.
Referenced by animate(), PhotoDescEdit(), and ~PhotoDescEdit().
QTime PhotoDescEdit::currentTime [private] |
Definition at line 121 of file photoDescEdit.h.
Referenced by animate().
int PhotoDescEdit::delay [private] |
Definition at line 111 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
bool PhotoDescEdit::dropShadowsEnabled [private] |
are drop shadows enabled in windows (xp)?
Definition at line 117 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
QPoint PhotoDescEdit::finalPos [private] |
Definition at line 68 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
int PhotoDescEdit::idealTextSize [private] |
ultimate text dimension
Definition at line 74 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
QImage* PhotoDescEdit::imageLarge [private] |
beginning and end pixmaps
Definition at line 62 of file photoDescEdit.h.
Referenced by animate(), PhotoDescEdit(), and ~PhotoDescEdit().
int PhotoDescEdit::initDelay [private] |
------------------------------------- Animation Stuff
Definition at line 111 of file photoDescEdit.h.
Referenced by disappear(), and PhotoDescEdit().
QPoint PhotoDescEdit::initPos [private] |
Definition at line 68 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
QTime PhotoDescEdit::lastTime [private] |
Definition at line 121 of file photoDescEdit.h.
Referenced by animate(), disappear(), and PhotoDescEdit().
int PhotoDescEdit::left [private] |
bounaries of entire animation
Definition at line 71 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
QGridLayout* PhotoDescEdit::mainGrid [private] |
-------------------------------------
Definition at line 84 of file photoDescEdit.h.
Referenced by PhotoDescEdit().
int PhotoDescEdit::minDelay [private] |
Definition at line 111 of file photoDescEdit.h.
Referenced by animate(), disappear(), and PhotoDescEdit().
int PhotoDescEdit::mode [private] |
Definition at line 114 of file photoDescEdit.h.
Referenced by animate(), disappear(), hide(), and PhotoDescEdit().
TextEdit* PhotoDescEdit::photoDesc [private] |
photo description
Definition at line 106 of file photoDescEdit.h.
Referenced by animate(), disappear(), and PhotoDescEdit().
PhotoPreviewWidget* PhotoDescEdit::ppw [private] |
photo preview widget pointer
Definition at line 59 of file photoDescEdit.h.
Referenced by disappear(), and hide().
int PhotoDescEdit::right [private] |
Definition at line 71 of file photoDescEdit.h.
Referenced by PhotoDescEdit().
int PhotoDescEdit::smallHeight [private] |
Definition at line 81 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
int PhotoDescEdit::smallWidth [private] |
small size
Definition at line 81 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
QWidget* PhotoDescEdit::staticFrame [private] |
frame which contains static widget
Definition at line 100 of file photoDescEdit.h.
Referenced by animate(), disappear(), and PhotoDescEdit().
QGridLayout* PhotoDescEdit::staticGrid [private] |
------------------------------------- Static Widgets
grid static widgets placed in
Definition at line 97 of file photoDescEdit.h.
Referenced by PhotoDescEdit().
QLabel* PhotoDescEdit::staticPhoto [private] |
photo being displayed
Definition at line 103 of file photoDescEdit.h.
Referenced by PhotoDescEdit().
int PhotoDescEdit::step [private] |
Definition at line 111 of file photoDescEdit.h.
Referenced by animate(), disappear(), and PhotoDescEdit().
QImage* PhotoDescEdit::textRectangle [private] |
text area widget used to computing painting surface
Definition at line 65 of file photoDescEdit.h.
Referenced by animate(), disappear(), PhotoDescEdit(), and ~PhotoDescEdit().
QTimer* PhotoDescEdit::timer [private] |
Definition at line 120 of file photoDescEdit.h.
Referenced by animate(), PhotoDescEdit(), and ~PhotoDescEdit().
int PhotoDescEdit::top [private] |
Definition at line 71 of file photoDescEdit.h.
Referenced by animate(), and PhotoDescEdit().
bool PhotoDescEdit::useAnimation [private] |
actually animate the opening/closing process?
Definition at line 56 of file photoDescEdit.h.
Referenced by disappear().