12 #include <qapplication.h> 17 #include <qpopupmenu.h> 23 #include "../../config.h" 24 #include "../../backend/album.h" 25 #include "../../backend/subalbum.h" 26 #include "../../backend/photo.h" 27 #include "../../backend/tools/imageTools.h" 29 #define USE_ANIMATION true 30 #define HIDE_MOUSE_DELAY 5000 39 setBackgroundMode( Qt::NoBackground);
86 QDesktopWidget *desktop = QApplication::desktop();
113 setFocusPolicy(QWidget::StrongFocus);
131 qApp->restoreOverrideCursor();
159 if(e->state() & Qt::ControlButton )
165 case Qt::Key_Underscore:
167 if(e->state() & Qt::ControlButton )
202 if(e->button() != Qt::LeftButton)
210 bool buttonClicked =
false;
219 if(e->pos().x() >= x && e->pos().y() >= y &&
220 e->pos().x() <= x+w && e->pos().y() <= y+h &&
223 buttonClicked =
true;
229 int xMid = x + (w/2);
230 int yMid = y + (h/2);
231 int dx = e->pos().x() - xMid;
232 int dy = e->pos().y() - yMid;
233 int distSqrd = dx*dx + dy*dy;
240 if(e->pos().x() < xMid)
243 if(e->pos().y() < yMid)
252 if(e->pos().y() < yMid)
278 qApp->restoreOverrideCursor();
295 QPopupMenu contextMenu(
this);
297 connect( &contextMenu, SIGNAL( aboutToHide() ),
this, SLOT(
contextMenuHiding() ) );
300 contextMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/pause.png") ),
303 contextMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/play.png") ),
306 int speedUpID = contextMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/speedUp.png") ),
307 tr(
"Speed Up"),
this, SLOT(
speedUp()), Key_Plus );
308 int slowDownID = contextMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/slowDown.png") ),
309 tr(
"Slow Down"),
this, SLOT(
slowDown()), Key_Minus );
314 contextMenu.setItemEnabled( speedUpID,
false );
315 contextMenu.setItemEnabled( slowDownID,
false );
318 QPopupMenu navigateMenu(&contextMenu);
319 navigateMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/backupPhoto.png") ),
320 tr(
"Backup Photo"),
this, SLOT(
backupPhoto()), Key_Left );
321 navigateMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/advancePhoto.png") ),
322 tr(
"Advance Photo"),
this, SLOT(
advancePhoto()), Key_Right );
323 navigateMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/skipToFirstPhoto.png") ),
325 navigateMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/skipToLastPhoto.png") ),
327 navigateMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/backupCollection.png") ),
329 navigateMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/advanceCollection.png") ),
331 contextMenu.insertItem( tr(
"Navigate"), &navigateMenu );
333 contextMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/increaseTextSize.png") ),
335 contextMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/decreaseTextSize.png") ),
338 contextMenu.insertItem( QIconSet( QPixmap(QString(
IMAGE_PATH)+
"menuIcons/exit.png") ),
339 tr(
"Exit"),
this, SLOT(
stop()), Key_Escape );
341 contextMenu.exec( QPoint(e->globalX(), e->globalY()) );
376 qApp->setOverrideCursor( QCursor(Qt::BlankCursor));
404 QString tempString =
"";
417 p.setPen(QColor(
"black"));
418 QFont f(
"times",
fontSize, QFont::Bold );
419 QFontMetrics fm( f );
424 if(tempString.stripWhiteSpace().length() > 0)
438 p.drawImage( x +
TL_TextBorder.width() + fm.width(tempString),
442 p.drawImage( QRect( x,
448 p.drawImage( QRect( x +
TL_TextBorder.width() + fm.width(tempString),
464 p.drawImage( x +
TL_TextBorder.width() + fm.width(tempString),
468 fm.width(tempString), fm.height(), QBrush(QColor(
"white")) );
487 QString presentationResourcesPath;
499 presentationResourcesPath = albm->
getSaveLocation() +
"/misc_resources/";
503 Top_TextBorder.load(presentationResourcesPath +
"Top_TextBorder.png" );
505 Left_TextBorder.load(presentationResourcesPath +
"Left_TextBorder.png" );
507 TL_TextBorder.load(presentationResourcesPath +
"TL_TextBorder.png" );
508 TR_TextBorder.load(presentationResourcesPath +
"TR_TextBorder.png" );
509 BL_TextBorder.load(presentationResourcesPath +
"BL_TextBorder.png" );
510 BR_TextBorder.load(presentationResourcesPath +
"BR_TextBorder.png" );
512 qApp->setOverrideCursor( QCursor(Qt::BlankCursor));
514 setMouseTracking(
true);
518 if(startCollection != NULL && startPhoto != NULL)
527 while(tmpCollection != NULL && tmpCollection !=
curCollection)
529 tmpCollection = tmpCollection->
getNext();
534 while(tmpPhoto != NULL && tmpPhoto!=
curPhoto)
536 tmpPhoto = tmpPhoto->
getNext();
806 int inc = (int)(ms/
delay);
835 0, 0,
step, paintBufferCurr->height(),
859 0, 0, paintBufferCurr->width(),
step,
978 QString tempString =
"";
986 QFont f(
"times",
fontSize, QFont::Bold );
987 QFontMetrics fm( f );
1000 int maxWidth =
speed1.width();
1001 if(
speed2.width() > maxWidth) maxWidth =
speed2.width();
1002 if(
speed4.width() > maxWidth) maxWidth =
speed4.width();
1003 if(
speed8.width() > maxWidth) maxWidth =
speed8.width();
1005 int maxHeight =
speed1.height();
1006 if(
speed2.height() > maxHeight) maxHeight =
speed2.height();
1007 if(
speed4.height() > maxHeight) maxHeight =
speed4.height();
1008 if(
speed8.height() > maxHeight) maxHeight =
speed8.height();
1013 p.drawImage( x, y, *speedIcon );
1021 p.setPen(QColor(
"green"));
1027 p.fillRect( x, y, fm.width(tempString), fm.height(), QBrush(QColor(
"black")) );
1028 p.drawText( x, y + fm.ascent(), tempString );
1034 p.fillRect( x, y, fm.width(tempString), fm.height(), QBrush(QColor(
"black")) );
1035 p.drawText(x, y + fm.ascent(), tempString );
1041 QImage* shownInterface;
1047 x = (
screenWidth - shownInterface->width() ) / 2;
1049 p.drawImage( x, y, *shownInterface );
1052 f.setPointSize( 14 );
1053 fm = QFontMetrics( f );
1055 x = x + (shownInterface->width() / 2) - (fm.width(tempString) / 2);
1058 p.setPen(QColor(
"white"));
1059 p.drawText( x, y, tempString );
QString getImageFilename()
Gets the image filename.
A photo consists of a full size image, a smaller slide show image, a very small thumbnail image...
int getNumSubalbums()
Returns number of subalbums.
QString getSaveLocation()
Returns the current save location of all images.
Photo * getNext()
Returns next photo pointer.
A subalbum contains photos.
int getNumPhotos()
Returns the number of photos in the subalbum.
Photo * getFirst()
Returns first photo in subalbum.
Subalbum * getFirstSubalbum()
Returns a pointer to the first Subalbum.
Subalbum * getLastSubalbum()
Returns a pointer to the last Subalbum.
An album contains Subalbums.
Subalbum * getNext()
Returns pointer to next subalbum.
QString getDescription()
Gets the description.
QString getTheme()
Returns currently selected theme.
Photo * getPrev()
Returns the previous photo pointer.
Subalbum * getPrev()
Returns pointer to prev subalbum.
Photo * getLast()
Returns last photo in subalbum.