15 #include <qpushbutton.h> 16 #include <qtoolbutton.h> 18 #include <q3filedialog.h> 20 #include <qapplication.h> 22 #include <qfileinfo.h> 25 #include <QResizeEvent> 26 #include <Q3GridLayout> 42 #include "../config.h" 43 #include "../backend/subalbum.h" 44 #include "../backend/photo.h" 45 #include "../backend/tools/guiTools.h" 46 #include "../backend/tools/wallpaperTools.h" 47 #include "../configuration/configuration.h" 49 #include "../backend/album.h" 57 setWindowFlags(Qt::WNoAutoErase);
69 photos->setArrangement( Q3IconView::LeftToRight );
70 photos->setVScrollBarMode( Q3ScrollView::Auto );
73 photos->setSelectionMode( Q3IconView::Extended ) ;
76 photos->setDragAutoScroll(
true);
77 photos->setAcceptDrops(
true);
80 connect(
photos, SIGNAL(selectionChanged()),
99 connect(
photos, SIGNAL(editSelectedPhoto()),
100 layout, SLOT(editSelectedPhoto()) );
103 layout, SLOT(editSelectedPhoto()) );
109 QFont buttonFont( qApp->font() );
110 buttonFont.setBold(
true);
111 buttonFont.setPointSize( 11 );
114 addImage->setTextLabel(tr(
"Add Photo"));
116 addImage->setTextPosition(QToolButton::BesideIcon);
120 QToolTip::add(
addImage, tr(
"Add photos to selected collection") );
126 removeImage->setTextPosition(QToolButton::BesideIcon);
130 QToolTip::add(
removeImage, tr(
"Remove selected photos from collection") );
136 rotate90Icon.setPixmap( QString(
IMAGE_PATH)+
"buttonIcons/rotate90.png",
139 rotate90Icon.setPixmap( QString(
IMAGE_PATH)+
"buttonIcons/rotate90_disabled.png",
147 QToolTip::add(
rotate90Image, tr(
"Rotate selected photos clockwise") );
153 rotate270Icon.setPixmap( QString(
IMAGE_PATH)+
"buttonIcons/rotate270.png",
156 rotate270Icon.setPixmap( QString(
IMAGE_PATH)+
"buttonIcons/rotate270_disabled.png",
164 QToolTip::add(
rotate270Image, tr(
"Rotate selected photos counterclockwise") );
182 QIcon setDesktopIcon;
183 setDesktopIcon.setPixmap( QString(
IMAGE_PATH)+
"buttonIcons/setDesktopWallpaper.png",
186 setDesktopIcon.setPixmap( QString(
IMAGE_PATH)+
"buttonIcons/setDesktopWallpaper_disabled.png",
195 QToolTip::add(
setDesktopBtn, tr(
"Set desktop wallpaper to selected photo") );
202 mainGrid =
new Q3GridLayout(
this, 2, 1, 0 );
208 setPaletteBackgroundColor( QColor(193, 210, 238) );
217 Q3Accel *keyAccel =
new Q3Accel(
this );
218 keyAccel->connectItem( keyAccel->insertItem( Qt::CTRL + Qt::SHIFT + Qt::Key_A ),
245 QString path = config->
getString(
"loadSave",
"addPhotoDir" );
247 if(!testPath.exists())
250 path = config->
getString(
"loadSave",
"addPhotoDir" );
254 bool setDescriptions;
255 QStringList fileNames = fileDialog->
getFilenames( setDescriptions );
257 if(!fileNames.empty())
260 QDir lastDir = QDir( QFileInfo(*fileNames.begin()).dirPath() );
261 config->
setString(
"loadSave",
"addPhotoDir", lastDir.path() );
268 if(fileNames.empty())
276 photos->setSelectionMode( Q3IconView::NoSelection ) ;
278 qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
281 QString statusMessage = tr(
"Adding %1 photos:");
284 qApp->processEvents();
287 QStringList::iterator it;
289 for(it = fileNames.begin(); it != fileNames.end(); it++ )
298 photos->ensureItemVisible(p);
301 qApp->processEvents();
303 photos->arrangeItemsInGrid();
315 photos->setSelectionMode( Q3IconView::Extended ) ;
317 qApp->restoreOverrideCursor();
326 photos->setSelectionMode( Q3IconView::NoSelection ) ;
330 bool proceed = !((
Window*)qApp->mainWidget())->getConfig()->getBool(
"alerts",
"showDestructiveAlerts" );
334 tr(
"Once removed photos cannot be restored. Furthermore upon resaving they are physically removed from your album."),
335 "alertIcons/warning.png",
337 proceed = sure.exec();
341 qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
346 while(current != NULL)
349 if(!current->isSelected())
351 current = current->nextItem();
356 temp = current->nextItem();
370 photos->arrangeItemsInGrid();
373 qApp->restoreOverrideCursor();
379 photos->setSelectionMode( Q3IconView::Extended ) ;
389 while(current != NULL)
392 if(current->isSelected())
397 qApp->processEvents();
401 current = current->nextItem();
412 if(phto == NULL)
return;
421 qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
424 photos->setSelectionMode( Q3IconView::NoSelection ) ;
428 QString statusMessage = tr(
"Rotating %1 photos:");
430 qApp->processEvents();
435 while(current != NULL)
437 if(current->isSelected())
447 qApp->processEvents();
451 current = current->nextItem();
464 photos->setSelectionMode( Q3IconView::Extended ) ;
466 qApp->restoreOverrideCursor();
472 qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
475 photos->setSelectionMode( Q3IconView::NoSelection ) ;
479 QString statusMessage = tr(
"Rotating %1 photos:");
481 qApp->processEvents();
486 while(current != NULL)
488 if(current->isSelected())
498 qApp->processEvents();
502 current = current->nextItem();
515 photos->setSelectionMode( Q3IconView::Extended ) ;
516 qApp->restoreOverrideCursor();
528 while(currentPhoto != NULL)
531 currentPhoto = currentPhoto->
getNext();
534 photos->arrangeItemsInGrid();
541 while(current != NULL)
545 current = current->nextItem();
552 while(current != NULL)
555 if(current->isSelected())
562 current = current->nextItem();
569 while(current != NULL)
572 if(current->isSelected())
579 current = current->nextItem();
594 while(current != NULL)
597 if(current->isSelected())
604 if(numSelected > 1)
return NULL;
607 current = current->nextItem();
612 else {
return NULL; }
619 while(current != NULL)
622 if(current->isSelected())
626 current = current->nextItem();
637 while(current != NULL)
645 current->setSelected(
true);
646 photos->ensureItemVisible( current );
652 current = current->nextItem();
659 while(current != NULL)
661 if(current->isSelected())
663 current = current->nextItem();
671 while(current != NULL)
673 if(current->isSelected())
678 current = current->nextItem();
685 photos->arrangeItemsInGrid();
697 photos->arrangeItemsInGrid();
716 while(current != NULL)
718 if(current->isSelected())
732 current = current->nextItem();
760 addImage->setEnabled(enable &&
true);
773 addImage->setEnabled(enable &&
true);
bool addPhoto(QString fileName, bool replaceDescription=false, Photo *newPhoto=NULL)
Adds a new photo to the Subalbum and appends it to the end, returns TRUE if successful.
A photo consists of a full size image, a smaller slide show image, a very small thumbnail image...
Top level widget, encapsulates the title widget, the layout widget, and the toolbar widget...
StatusWidget * getStatus()
returns a pointer to the status widget
QString getString(QString group, QString key)
Fetch string setting.
void resetSetting(QString group, QString key)
Resets a setting to it's default value.
void setString(QString group, QString key, QString value)
Sets a setting value, if group does not exist it is created, if setting does not exist it is also cre...
Photo * getNext()
Returns next photo pointer.
QStringList getFilenames(bool &setDescriptions)
returns the list of selected filenames, while setting setDescritions to the state the checkbox was le...
Simple dialog for browsing and select photos to add to a subalbum.
A subalbum contains photos.
Extension of iconview, used to list all photos in a subalbum. supports drag-n-drop within iconview...
Photo * getFirst()
Returns first photo in subalbum.
Configuration object manages all user-specific application settings.
void syncPhotoList(PhotoPreviewWidget *item)
Syncs photo ordering with front end gui ordering.
A configurable question dialog that returns true/false.
void removePhoto(Photo *val)
Removes a specified photo.
TitleWidget * getTitle()
returns a pointer to the title widget
Photo * getLast()
Returns last photo in subalbum.