#include <subalbumWidget.h>
Inheritance diagram for SubalbumWidget:
Definition at line 35 of file subalbumWidget.h.
Signals | |
void | selectedPhotoStateChanged () |
Public Member Functions | |
SubalbumWidget (Subalbum *salbum, QWidget *parent=0, const char *name=0) | |
Creates layout based on backend object. | |
void | setSubalbum (Subalbum *salbum) |
Resets the subalbum this subalbum widget is displaying. | |
void | refreshPhotos () |
clears and reinserts all photos for the current collection the current selection is cleared | |
void | refreshAllPhotos () |
refreshes all photos, selections are preserved | |
void | refreshSelectedPhotos () |
refreshes selected photos, selections are preserved | |
Subalbum * | getSubalbum () |
returns a pointer to the backend subalbum | |
Photo * | getSelectedPhoto () |
Returns currently selected photo. If no or multiple photos selected returns NULL. | |
void | setSelectedPhoto (Photo *selection) |
Sets the selected photo to selection and ensures it is visible. | |
Photo * | getFirstSelectedPhoto () |
Returns first selected photo. | |
bool | anyPhotosSelected () |
Returns true if any phtos are selected. | |
bool | anySelectedPhotosRevertable () |
Returns true if any selected photos are revertable. | |
QIconView * | getPhotos () |
Returns pointer to icon view. | |
void | updateButtons (bool enable) |
Activates/Deactives remove/rotate buttons. | |
void | stripDescriptionsFromSelectedPhotos () |
Strip descriptions from selected photos. | |
void | revertSelectedPhotos () |
Revert selected photos to their original form. | |
Protected Member Functions | |
void | resizeEvent (QResizeEvent *) |
Private Slots | |
void | setWallpaperAction () |
set desktop wallpaper | |
void | selectionChangedEvent () |
handles changing selections | |
void | updateButtons () |
Activates/Deactives remove/rotate buttons depending on if an image is selected. | |
void | addImageAction () |
Adds an image to the subalbum. | |
void | addImageAction (QStringList fileNames, bool setDescriptions=false) |
void | removeImageAction () |
Remove an image from the subalbum. | |
void | rotate90ImageAction () |
Rotate clockwise selected images. | |
void | rotate270ImageAction () |
Rotate counter-clockwise selected images. | |
void | reorder () |
void | deselectAll () |
Private Attributes | |
QGridLayout * | mainGrid |
Grids widgets are placed in. | |
QGridLayout * | buttonsGrid |
QFrame * | thumbnailFrame |
Grid lower buttons are placed in. | |
QFrame * | buttonsFrame |
PhotosIconView * | photos |
Photos layout. | |
Subalbum * | subalbum |
Pointer to backend subalbum. | |
QToolButton * | addImage |
"Add" button | |
QToolButton * | removeImage |
"Remove" button | |
QToolButton * | rotate90Image |
"Rotate 90" button | |
QToolButton * | rotate270Image |
"Rotate 270" button | |
QToolButton * | setDesktopBtn |
Set desktop wallpaper button. | |
LayoutWidget * | layout |
Pointer to the parent layout widget. | |
bool | buttonsState |
cached enabled/disabled state of buttons | |
bool | wallpaperButtonState |
cached enabled/distable state of set wallpaper button |
|
Creates layout based on backend object.
Definition at line 49 of file subalbumWidget.cpp. References addImage, addImageAction(), buttonsFrame, buttonsGrid, deselectAll(), IMAGE_PATH, layout, mainGrid, photos, removeImage, removeImageAction(), reorder(), rotate270Image, rotate270ImageAction(), rotate90Image, rotate90ImageAction(), selectionChangedEvent(), setDesktopBtn, setWallpaperAction(), setWallpaperSupported(), and subalbum. 00051 : 00052 QWidget(parent,name) 00053 { 00054 setWFlags(WNoAutoErase); 00055 00056 //store subalbum pointer 00057 subalbum = salbum; 00058 00059 //store layout pointer 00060 layout = (LayoutWidget*)parent; 00061 00062 //create photo collection 00063 photos = new PhotosIconView( this ); 00064 00065 //establish a top-down view such that the scrollbar is always placed on the right 00066 photos->setArrangement( QIconView::LeftToRight ); 00067 photos->setVScrollBarMode( QScrollView::Auto ); 00068 00069 //allow multiple photos to be selected with control and shift keys 00070 photos->setSelectionMode( QIconView::Extended ) ; 00071 00072 //set auto-scroll on for drag-n-drop 00073 photos->setDragAutoScroll(true); 00074 photos->setAcceptDrops(true); 00075 00076 //connect selectionChanged signal to update buttons method 00077 connect( photos, SIGNAL(selectionChanged()), 00078 this, SLOT( selectionChangedEvent()) ); 00079 00080 //connect rightButtonClicked signal to update buttons method 00081 connect( photos, SIGNAL(rightButtonClicked(QIconViewItem*, const QPoint&)), 00082 this, SLOT(selectionChangedEvent()) ); 00083 00084 //connect itemhasMoved signal on iconview to reorder slot (phots have been rearranged) 00085 connect( photos, SIGNAL(itemHasMoved()), SLOT(reorder()) ); 00086 00087 //connect addPhtos signal from iconview to actually add photos from disk (Drop from outside target, ie konqueror) 00088 connect( photos, SIGNAL(addPhotos(QStringList)), SLOT(addImageAction(QStringList)) ); 00089 00090 //connect keyevent signals from iconview 00091 connect( photos, SIGNAL(removeSelectedPhotos()), SLOT(removeImageAction()) ); 00092 connect( photos, SIGNAL(rotate90SelectedPhotos()), SLOT(rotate90ImageAction()) ); 00093 connect( photos, SIGNAL(rotate270SelectedPhotos()), SLOT(rotate270ImageAction()) ); 00094 00095 //connect key e press signal to edit slot 00096 connect( photos, SIGNAL(editSelectedPhoto()), 00097 layout, SLOT(editSelectedPhoto()) ); 00098 //connect double click signal to edit slot 00099 connect( photos, SIGNAL( doubleClicked(QIconViewItem*) ), 00100 layout, SLOT(editSelectedPhoto()) ); 00101 00102 //create all buttons 00103 buttonsFrame = new QFrame(this); 00104 if(subalbum == NULL) buttonsFrame->hide(); 00105 00106 QFont buttonFont( qApp->font() ); 00107 buttonFont.setBold(true); 00108 buttonFont.setPointSize( 11 ); 00109 00110 addImage = new QToolButton( buttonsFrame ); 00111 addImage->setTextLabel(tr("Add Photo")); 00112 addImage->setIconSet( QPixmap(QString(IMAGE_PATH)+"buttonIcons/add.png") ); 00113 addImage->setTextPosition(QToolButton::Right); 00114 addImage->setFont( buttonFont ); 00115 addImage->setUsesTextLabel( true ); 00116 addImage->setEnabled( true ); 00117 QToolTip::add( addImage, tr("Add photos to selected collection") ); 00118 connect( addImage, SIGNAL(clicked()), SLOT(addImageAction()) ); 00119 00120 removeImage = new QToolButton( buttonsFrame ); 00121 removeImage->setTextLabel(tr("Remove Photo")); 00122 removeImage->setIconSet( QPixmap(QString(IMAGE_PATH)+"buttonIcons/remove.png") ); 00123 removeImage->setTextPosition(QToolButton::Right); 00124 removeImage->setFont( buttonFont ); 00125 removeImage->setUsesTextLabel( true ); 00126 removeImage->setEnabled( true ); 00127 QToolTip::add( removeImage, tr("Remove selected photos from collection") ); 00128 connect( removeImage, SIGNAL(clicked()), SLOT(removeImageAction()) ); 00129 00130 rotate90Image = new QToolButton( buttonsFrame ); 00131 rotate90Image->setTextLabel(tr("Rotate Right") ); 00132 QIconSet rotate90Icon; 00133 rotate90Icon.setPixmap( QString(IMAGE_PATH)+"buttonIcons/rotate90.png", 00134 QIconSet::Automatic, 00135 QIconSet::Normal ); 00136 rotate90Icon.setPixmap( QString(IMAGE_PATH)+"buttonIcons/rotate90_disabled.png", 00137 QIconSet::Automatic, 00138 QIconSet::Disabled ); 00139 rotate90Image->setIconSet( rotate90Icon ); 00140 00141 rotate90Image->setTextPosition(QToolButton::Right); 00142 rotate90Image->setFont( buttonFont ); 00143 rotate90Image->setUsesTextLabel( true ); 00144 QToolTip::add( rotate90Image, tr("Rotate selected photos clockwise") ); 00145 connect( rotate90Image, SIGNAL(clicked()), SLOT(rotate90ImageAction()) ); 00146 00147 rotate270Image = new QToolButton( buttonsFrame ); 00148 rotate270Image->setTextLabel(tr("Rotate Left") ); 00149 QIconSet rotate270Icon; 00150 rotate270Icon.setPixmap( QString(IMAGE_PATH)+"buttonIcons/rotate270.png", 00151 QIconSet::Automatic, 00152 QIconSet::Normal ); 00153 rotate270Icon.setPixmap( QString(IMAGE_PATH)+"buttonIcons/rotate270_disabled.png", 00154 QIconSet::Automatic, 00155 QIconSet::Disabled ); 00156 rotate270Image->setIconSet( rotate270Icon ); 00157 00158 rotate270Image->setTextPosition(QToolButton::Right); 00159 rotate270Image->setFont( buttonFont ); 00160 rotate270Image->setUsesTextLabel( true ); 00161 QToolTip::add( rotate270Image, tr("Rotate selected photos counterclockwise") ); 00162 connect( rotate270Image, SIGNAL(clicked()), SLOT(rotate270ImageAction()) ); 00163 00164 //place all items in grid layout 00165 buttonsGrid = new QGridLayout( buttonsFrame, 1, 7, 0 ); 00166 buttonsGrid->addWidget( addImage, 0, 1, Qt::AlignLeft ); 00167 buttonsGrid->addWidget( removeImage, 0, 2, Qt::AlignLeft ); 00168 buttonsGrid->addWidget( rotate90Image, 0, 3, Qt::AlignLeft ); 00169 buttonsGrid->addWidget( rotate270Image, 0, 4, Qt::AlignLeft ); 00170 buttonsGrid->setColStretch( 0, 1 ); 00171 buttonsGrid->setColStretch( 6, 1 ); 00172 00173 //If setting the desktop wallpaper is supported on this system then add this button as well 00174 if( setWallpaperSupported() ) 00175 { 00176 setDesktopBtn = new QToolButton( buttonsFrame ); 00177 setDesktopBtn->setUsesTextLabel( true ); 00178 setDesktopBtn->setTextLabel(tr("Wallpaper") ); 00179 QIconSet setDesktopIcon; 00180 setDesktopIcon.setPixmap( QString(IMAGE_PATH)+"buttonIcons/setDesktopWallpaper.png", 00181 QIconSet::Automatic, 00182 QIconSet::Normal ); 00183 setDesktopIcon.setPixmap( QString(IMAGE_PATH)+"buttonIcons/setDesktopWallpaper_disabled.png", 00184 QIconSet::Automatic, 00185 QIconSet::Disabled ); 00186 setDesktopBtn->setIconSet( setDesktopIcon ); 00187 00188 setDesktopBtn->setTextPosition(QToolButton::Right); 00189 setDesktopBtn->setFont( buttonFont ); 00190 setDesktopBtn->setUsesTextLabel( true ); 00191 00192 QToolTip::add( setDesktopBtn, tr("Set desktop wallpaper to selected photo") ); 00193 connect( setDesktopBtn, SIGNAL( clicked() ), this, SLOT( setWallpaperAction() ) ); 00194 buttonsGrid->addWidget( setDesktopBtn, 0, 5, Qt::AlignLeft ); 00195 } 00196 else 00197 { setDesktopBtn = NULL; } 00198 00199 mainGrid = new QGridLayout( this, 2, 1, 0 ); 00200 mainGrid->addMultiCellWidget( photos, 0, 0, 0, 1 ); 00201 mainGrid->addMultiCellWidget( buttonsFrame, 1, 1, 0, 1 ); 00202 mainGrid->setRowStretch( 0, 1 ); 00203 00204 //set the background of the widget to be light blue 00205 setPaletteBackgroundColor( QColor(193, 210, 238) ); 00206 00207 //by default no selected images so disable all buttons besides add 00208 removeImage->setEnabled(false); 00209 rotate90Image->setEnabled(false); 00210 rotate270Image->setEnabled(false); 00211 00212 //hook-up keyboard shortcut for deselecting all photos 00213 //iconview provides select all shortcut for us 00214 QAccel *keyAccel = new QAccel( this ); 00215 keyAccel->connectItem( keyAccel->insertItem( CTRL + SHIFT + Key_A ), 00216 this, SLOT(deselectAll()) ); 00217 } //==============================================
|
|
Definition at line 263 of file subalbumWidget.cpp. References Subalbum::addPhoto(), Subalbum::getLast(), Window::getStatus(), LayoutWidget::getSubalbums(), Window::getTitle(), LayoutWidget::getWindow(), layout, photos, TitleWidget::setBusy(), StatusWidget::setStatus(), StatusWidget::showProgressBar(), subalbum, updateButtons(), SubalbumsWidget::updateButtons(), TitleWidget::updateMenus(), and StatusWidget::updateProgress(). 00264 { 00265 if(fileNames.empty()) 00266 return; 00267 00268 //--------------- 00269 //set busy flag and deactivate menu's/buttons, and selecting photos 00270 layout->getWindow()->getTitle()->setBusy(true); 00271 layout->getSubalbums()->updateButtons(false); 00272 updateButtons(false); 00273 photos->setSelectionMode( QIconView::NoSelection ) ; 00274 00275 qApp->setOverrideCursor( QCursor(Qt::WaitCursor)); 00276 00277 //setup progress bar 00278 QString statusMessage = tr("Adding %1 photos:"); 00279 00280 layout->getWindow()->getStatus()->showProgressBar( statusMessage.arg(fileNames.count()), fileNames.count() ); 00281 qApp->processEvents(); 00282 00283 //iterate through each file and add to album 00284 QStringList::iterator it; 00285 int num=0; 00286 for(it = fileNames.begin(); it != fileNames.end(); it++ ) 00287 { 00288 //update status message 00289 layout->getWindow()->getStatus()->updateProgress( num, statusMessage.arg(fileNames.count() - num) ); 00290 00291 //if item is a file, add photo 00292 if(QFileInfo(*it).isFile() && subalbum->addPhoto(*it, setDescriptions)) 00293 { 00294 PhotoPreviewWidget* p = new PhotoPreviewWidget( photos, subalbum->getLast() ); 00295 photos->ensureItemVisible(p); 00296 } 00297 num++; 00298 qApp->processEvents(); 00299 } 00300 photos->arrangeItemsInGrid(); 00301 00302 //remove progress bar 00303 layout->getWindow()->getStatus()->setStatus( tr("Adding photos complete.") ); 00304 00305 //notifty title widget that the album's photo count has possible changed 00306 layout->getWindow()->getTitle()->updateMenus(); 00307 00308 //unset busy flag and activate menu's/buttons 00309 layout->getWindow()->getTitle()->setBusy(false); 00310 layout->getSubalbums()->updateButtons(true); 00311 updateButtons(true); 00312 photos->setSelectionMode( QIconView::Extended ) ; 00313 00314 qApp->restoreOverrideCursor(); 00315 }
|
|
Adds an image to the subalbum.
Definition at line 236 of file subalbumWidget.cpp. References AddPhotosDialog::getFilenames(), Configuration::getString(), Configuration::resetSetting(), and Configuration::setString(). Referenced by SubalbumWidget(). 00237 { 00238 //--------------- 00239 //get file list 00240 00241 Configuration* config = ((Window*)qApp->mainWidget())->getConfig(); 00242 QString path = config->getString( "loadSave", "addPhotoDir" ); 00243 QDir testPath(path); 00244 if(!testPath.exists()) 00245 { 00246 config->resetSetting( "loadSave", "addPhotoDir" ); 00247 path = config->getString( "loadSave", "addPhotoDir" ); 00248 } 00249 00250 AddPhotosDialog* fileDialog = new AddPhotosDialog( path ); 00251 bool setDescriptions; 00252 QStringList fileNames = fileDialog->getFilenames( setDescriptions ); 00253 00254 if(!fileNames.empty()) 00255 { 00256 //store this addPhoto location 00257 QDir lastDir = QDir( QFileInfo(*fileNames.begin()).dirPath() ); 00258 config->setString( "loadSave", "addPhotoDir", lastDir.path() ); 00259 addImageAction( fileNames, setDescriptions ); 00260 } 00261 }
|
|
Returns true if any phtos are selected.
Definition at line 656 of file subalbumWidget.cpp. References photos. Referenced by LayoutWidget::photoStateChangedEvent(), and TitleWidget::removeSelectedPhotoDesc(). 00657 { 00658 QIconViewItem* current = photos->firstItem(); 00659 while(current != NULL) 00660 { 00661 if(current->isSelected()) 00662 return true; 00663 current = current->nextItem(); 00664 } 00665 return false; 00666 }
|
|
Returns true if any selected photos are revertable.
Definition at line 668 of file subalbumWidget.cpp. References photos. Referenced by LayoutWidget::photoStateChangedEvent(). 00669 { 00670 QIconViewItem* current = photos->firstItem(); 00671 while(current != NULL) 00672 { 00673 if(current->isSelected()) 00674 { 00675 if( ((PhotoPreviewWidget*)current)->getPhoto()->revertPossible() ) 00676 return true; 00677 } 00678 current = current->nextItem(); 00679 } 00680 return false; 00681 }
|
|
Definition at line 782 of file subalbumWidget.cpp. References photos. Referenced by SubalbumWidget(). 00783 { 00784 photos->selectAll(false); 00785 }
|
|
Returns first selected photo.
Definition at line 615 of file subalbumWidget.cpp. References photos. Referenced by LayoutWidget::tabChanged(). 00616 { 00617 //determine if one photo is selected 00618 QIconViewItem* current = photos->firstItem(); 00619 while(current != NULL) 00620 { 00621 //found a selected item! 00622 if(current->isSelected()) 00623 { return ((PhotoPreviewWidget*)current)->getPhoto(); } 00624 00625 //move to next item 00626 current = current->nextItem(); 00627 } 00628 00629 //no selected items found 00630 return NULL; 00631 }
|
|
Returns pointer to icon view.
Definition at line 688 of file subalbumWidget.cpp. Referenced by TitleWidget::dropEvent(), and SubalbumPreviewWidget::dropped(). 00689 {
00690 return photos;
00691 }
|
|
Returns currently selected photo. If no or multiple photos selected returns NULL.
Definition at line 588 of file subalbumWidget.cpp. References photos. Referenced by TitleWidget::setAlbumImage(), TitleWidget::setSubalbumImage(), and setWallpaperAction(). 00589 { 00590 //determine if one photo is selected 00591 int numSelected = 0; 00592 QIconViewItem* current = photos->firstItem(); 00593 QIconViewItem* selected = NULL; 00594 while(current != NULL) 00595 { 00596 //found a selected item! 00597 if(current->isSelected()) 00598 { 00599 numSelected++; 00600 selected = current; 00601 } 00602 00603 //if more than one found then bail! 00604 if(numSelected > 1) return NULL; 00605 00606 //move to next item 00607 current = current->nextItem(); 00608 } 00609 00610 //if one item is selected then return photo pointer 00611 if(numSelected == 1) { return ((PhotoPreviewWidget*)selected)->getPhoto(); } 00612 else { return NULL; } 00613 }
|
|
returns a pointer to the backend subalbum
Definition at line 583 of file subalbumWidget.cpp. Referenced by SubalbumPreviewWidget::dropped(), TitleWidget::setSubalbumImage(), and LayoutWidget::tabChanged(). 00584 {
00585 return subalbum;
00586 }
|
|
refreshes all photos, selections are preserved
Definition at line 538 of file subalbumWidget.cpp. References photos. Referenced by LayoutWidget::tabChanged(). 00539 { 00540 QIconViewItem* current = photos->firstItem(); 00541 while(current != NULL) 00542 { 00543 ((PhotoPreviewWidget*)current)->updateImage(); 00544 ((PhotoPreviewWidget*)current)->updateDescription(); 00545 current = current->nextItem(); 00546 } 00547 }
|
|
clears and reinserts all photos for the current collection the current selection is cleared
Definition at line 519 of file subalbumWidget.cpp. References Subalbum::getFirst(), Photo::getNext(), photos, and subalbum. Referenced by setSubalbum(). 00520 { 00521 //remove all thumbnails 00522 photos->clear(); 00523 00524 if(subalbum != NULL) 00525 { 00526 //insert photo thumbnails 00527 Photo* currentPhoto = subalbum->getFirst(); 00528 while(currentPhoto != NULL) 00529 { 00530 new PhotoPreviewWidget( photos, currentPhoto ); 00531 currentPhoto = currentPhoto->getNext(); 00532 } 00533 00534 photos->arrangeItemsInGrid(); 00535 } 00536 }
|
|
refreshes selected photos, selections are preserved
Definition at line 549 of file subalbumWidget.cpp. References photos. 00550 { 00551 QIconViewItem* current = photos->firstItem(); 00552 while(current != NULL) 00553 { 00554 //found a selected item! 00555 if(current->isSelected()) 00556 { 00557 ((PhotoPreviewWidget*)current)->updateImage(); 00558 ((PhotoPreviewWidget*)current)->updateDescription(); 00559 } 00560 00561 //move to next item 00562 current = current->nextItem(); 00563 } 00564 }
|
|
Remove an image from the subalbum.
Definition at line 317 of file subalbumWidget.cpp. References LayoutWidget::getSubalbums(), Window::getTitle(), LayoutWidget::getWindow(), layout, photos, Subalbum::removePhoto(), selectedPhotoStateChanged(), selectionChangedEvent(), TitleWidget::setBusy(), subalbum, updateButtons(), and SubalbumsWidget::updateButtons(). Referenced by SubalbumWidget(). 00318 { 00319 //set busy flag and deactivate menu's/buttons 00320 layout->getWindow()->getTitle()->setBusy(true); 00321 layout->getSubalbums()->updateButtons(false); 00322 updateButtons(false); 00323 photos->setSelectionMode( QIconView::NoSelection ) ; 00324 00325 //if user has chosen to not receive destructive action warnings, or agrees to the action, then 00326 //delete photo and refresh view 00327 bool proceed = !((Window*)qApp->mainWidget())->getConfig()->getBool( "alerts", "showDestructiveAlerts" ); 00328 if(!proceed) 00329 { 00330 QuestionDialog sure( tr("Remove selected photos?"), 00331 tr("Once removed photos cannot be restored. Furthermore upon resaving they are physically removed from your album."), 00332 "alertIcons/warning.png", 00333 this ); 00334 proceed = sure.exec(); 00335 } 00336 if(proceed) 00337 { 00338 qApp->setOverrideCursor( QCursor(Qt::WaitCursor)); 00339 //iterate through all photos and remove those that are selected 00340 QIconViewItem* current = photos->firstItem(); 00341 QIconViewItem* temp; 00342 00343 while(current != NULL) 00344 { 00345 //if not selected move on 00346 if(!current->isSelected()) 00347 { 00348 current = current->nextItem(); 00349 continue; 00350 } 00351 00352 //get next pointer 00353 temp = current->nextItem(); 00354 00355 //grab point to backend photo 00356 Photo* phto = ((PhotoPreviewWidget*)current)->getPhoto(); 00357 00358 //delete photo widget 00359 delete current; 00360 current = temp; 00361 00362 //delete backend photo 00363 subalbum->removePhoto(phto); 00364 } 00365 00366 //cleanup arrangement in case items were deleted in the middle or front 00367 photos->arrangeItemsInGrid(); 00368 00369 //update buttons and emit selection changed signal 00370 selectionChangedEvent(); 00371 00372 //unset busy flag and activate menu's/buttons 00373 qApp->restoreOverrideCursor(); 00374 } 00375 00376 //state of selected photos has changed 00377 emit selectedPhotoStateChanged(); 00378 00379 layout->getWindow()->getTitle()->setBusy(false); 00380 layout->getSubalbums()->updateButtons(true); 00381 updateButtons(true); 00382 photos->setSelectionMode( QIconView::Extended ) ; 00383 }
|
|
Definition at line 693 of file subalbumWidget.cpp. References photos, subalbum, and Subalbum::syncPhotoList(). Referenced by SubalbumWidget(). 00694 { 00695 //so item has been moved, reorder linked list of items as necessary 00696 photos->sort( true ); 00697 photos->arrangeItemsInGrid(); 00698 00699 //sync lists 00700 subalbum->syncPhotoList((PhotoPreviewWidget*)photos->firstItem()); 00701 }
|
|
Definition at line 683 of file subalbumWidget.cpp. References photos. 00684 { 00685 photos->arrangeItemsInGrid(); 00686 }
|
|
Revert selected photos to their original form.
Definition at line 385 of file subalbumWidget.cpp. References photos, and selectedPhotoStateChanged(). Referenced by LayoutWidget::revertPhotos(). 00386 { 00387 //iterate over photos in current collection 00388 QIconViewItem* current = photos->firstItem(); 00389 while(current != NULL) 00390 { 00391 //found a selected item! 00392 if(current->isSelected()) 00393 { 00394 ((PhotoPreviewWidget*)current)->getPhoto()->revertPhoto(); 00395 photos->ensureItemVisible(((PhotoPreviewWidget*)current)); 00396 ((PhotoPreviewWidget*)current)->updateImage(); 00397 qApp->processEvents(); 00398 } 00399 00400 //move to next item 00401 current = current->nextItem(); 00402 } 00403 00404 //state of selected photos has changed 00405 emit selectedPhotoStateChanged(); 00406 }
|
|
Rotate counter-clockwise selected images.
Definition at line 469 of file subalbumWidget.cpp. References Window::getStatus(), LayoutWidget::getSubalbums(), Window::getTitle(), LayoutWidget::getWindow(), layout, PhotosIconView::numSelected(), photos, selectedPhotoStateChanged(), TitleWidget::setBusy(), StatusWidget::setStatus(), StatusWidget::showProgressBar(), updateButtons(), SubalbumsWidget::updateButtons(), and StatusWidget::updateProgress(). Referenced by SubalbumWidget(). 00470 { 00471 //set busy flag and deactivate menu's/buttons 00472 qApp->setOverrideCursor( QCursor(Qt::WaitCursor)); 00473 layout->getWindow()->getTitle()->setBusy(true); 00474 layout->getSubalbums()->updateButtons(false); 00475 photos->setSelectionMode( QIconView::NoSelection ) ; 00476 updateButtons(false); 00477 00478 //setup progress bar 00479 QString statusMessage = tr("Rotating %1 photos:"); 00480 layout->getWindow()->getStatus()->showProgressBar( statusMessage.arg(photos->numSelected()), photos->numSelected() ); 00481 qApp->processEvents(); 00482 00483 //rotate the selected photos 00484 int num = 0; 00485 QIconViewItem* current = photos->firstItem(); 00486 while(current != NULL) 00487 { 00488 if(current->isSelected()) 00489 { 00490 //update status message 00491 layout->getWindow()->getStatus()->updateProgress( num, statusMessage.arg(photos->numSelected() - num) ); 00492 00493 ((PhotoPreviewWidget*)current)->getPhoto()->rotate270(); 00494 photos->ensureItemVisible(((PhotoPreviewWidget*)current)); 00495 ((PhotoPreviewWidget*)current)->updateImage(); 00496 num++; 00497 layout->getWindow()->getStatus()->updateProgress( num ); 00498 qApp->processEvents(); 00499 } 00500 00501 //move to next item 00502 current = current->nextItem(); 00503 } 00504 00505 //state of selected photos has changed 00506 emit selectedPhotoStateChanged(); 00507 00508 //hide progress bar 00509 layout->getWindow()->getStatus()->setStatus( tr("Rotating complete.") ); 00510 00511 //not busy any more 00512 layout->getWindow()->getTitle()->setBusy(false); 00513 layout->getSubalbums()->updateButtons(true); 00514 updateButtons(true); 00515 photos->setSelectionMode( QIconView::Extended ) ; 00516 qApp->restoreOverrideCursor(); 00517 }
|
|
Rotate clockwise selected images.
Definition at line 418 of file subalbumWidget.cpp. References Window::getStatus(), LayoutWidget::getSubalbums(), Window::getTitle(), LayoutWidget::getWindow(), layout, PhotosIconView::numSelected(), photos, selectedPhotoStateChanged(), TitleWidget::setBusy(), StatusWidget::setStatus(), StatusWidget::showProgressBar(), updateButtons(), SubalbumsWidget::updateButtons(), and StatusWidget::updateProgress(). Referenced by SubalbumWidget(). 00419 { 00420 //set busy flag and deactivate menu's/buttons 00421 qApp->setOverrideCursor( QCursor(Qt::WaitCursor)); 00422 layout->getWindow()->getTitle()->setBusy(true); 00423 layout->getSubalbums()->updateButtons(false); 00424 photos->setSelectionMode( QIconView::NoSelection ) ; 00425 updateButtons(false); 00426 00427 //setup progress bar 00428 QString statusMessage = tr("Rotating %1 photos:"); 00429 layout->getWindow()->getStatus()->showProgressBar( statusMessage.arg(photos->numSelected()), photos->numSelected() ); 00430 qApp->processEvents(); 00431 00432 //rotate the selected photos 00433 int num = 0; 00434 QIconViewItem* current = photos->firstItem(); 00435 while(current != NULL) 00436 { 00437 if(current->isSelected()) 00438 { 00439 //update status message 00440 layout->getWindow()->getStatus()->updateProgress( num, statusMessage.arg(photos->numSelected() - num) ); 00441 00442 ((PhotoPreviewWidget*)current)->getPhoto()->rotate90(); 00443 photos->ensureItemVisible(((PhotoPreviewWidget*)current)); 00444 ((PhotoPreviewWidget*)current)->updateImage(); 00445 num++; 00446 layout->getWindow()->getStatus()->updateProgress( num ); 00447 qApp->processEvents(); 00448 } 00449 00450 //move to next item 00451 current = current->nextItem(); 00452 } 00453 00454 //state of selected photos has changed 00455 emit selectedPhotoStateChanged(); 00456 00457 //hide progress bar 00458 layout->getWindow()->getStatus()->setStatus( tr("Rotating complete.") ); 00459 00460 //not busy any more 00461 layout->getWindow()->getTitle()->setBusy(false); 00462 layout->getSubalbums()->updateButtons(true); 00463 updateButtons(true); 00464 photos->setSelectionMode( QIconView::Extended ) ; 00465 00466 qApp->restoreOverrideCursor(); 00467 }
|
|
Referenced by removeImageAction(), revertSelectedPhotos(), rotate270ImageAction(), rotate90ImageAction(), and selectionChangedEvent(). |
|
handles changing selections
Definition at line 703 of file subalbumWidget.cpp. References selectedPhotoStateChanged(), and updateButtons(). Referenced by removeImageAction(), setSubalbum(), and SubalbumWidget(). 00704 { 00705 //update rotate/add/remove buttons depending on whether or not any items are selected 00706 updateButtons(); 00707 00708 //emit selection changed signal so other menu's etc an be updated as well 00709 emit selectedPhotoStateChanged(); 00710 }
|
|
Sets the selected photo to selection and ensures it is visible.
Definition at line 633 of file subalbumWidget.cpp. References photos. Referenced by LayoutWidget::tabChanged(). 00634 { 00635 //select specified photo 00636 QIconViewItem* current = photos->firstItem(); 00637 while(current != NULL) 00638 { 00639 if( ((PhotoPreviewWidget*)current)->getPhoto() == selection ) 00640 { 00641 //deselect all 00642 photos->selectAll(false); 00643 00644 //select photo and make sure it is visible 00645 current->setSelected(true); 00646 photos->ensureItemVisible( current ); 00647 00648 return; 00649 } 00650 00651 //move on to next photo 00652 current = current->nextItem(); 00653 } 00654 }
|
|
Resets the subalbum this subalbum widget is displaying.
Definition at line 219 of file subalbumWidget.cpp. References buttonsFrame, refreshPhotos(), selectionChangedEvent(), and subalbum. Referenced by TitleWidget::loadAlbum(), TitleWidget::newAlbum(), and LayoutWidget::showCollection(). 00220 { 00221 //set new subalbum pointer 00222 subalbum = salbum; 00223 00224 //update photo listing 00225 refreshPhotos(); 00226 00227 if(subalbum == NULL) { buttonsFrame->hide(); } 00228 else 00229 { 00230 //disable/enable buttons as necessary 00231 buttonsFrame->show(); 00232 selectionChangedEvent(); 00233 } 00234 }
|
|
set desktop wallpaper
Definition at line 408 of file subalbumWidget.cpp. References getSelectedPhoto(), and setWallpaper(). Referenced by SubalbumWidget(). 00409 { 00410 //get first selected photo, if no photo is selected then bail 00411 Photo* phto = getSelectedPhoto(); 00412 if(phto == NULL) return; 00413 00414 //set the wallpaper 00415 setWallpaper( phto ); 00416 }
|
|
Strip descriptions from selected photos.
Definition at line 566 of file subalbumWidget.cpp. References photos. Referenced by TitleWidget::removeSelectedPhotoDesc(). 00567 { 00568 QIconViewItem* current = photos->firstItem(); 00569 while(current != NULL) 00570 { 00571 //found a selected item! 00572 if(current->isSelected()) 00573 { 00574 ((PhotoPreviewWidget*)current)->getPhoto()->setDescription(""); 00575 ((PhotoPreviewWidget*)current)->setText( "" ); 00576 } 00577 00578 //move to next item 00579 current = current->nextItem(); 00580 } 00581 }
|
|
Activates/Deactives remove/rotate buttons depending on if an image is selected.
Definition at line 712 of file subalbumWidget.cpp. References layout, photos, removeImage, rotate270Image, rotate90Image, setDesktopBtn, and LayoutWidget::setEditTabEnabled(). Referenced by addImageAction(), removeImageAction(), rotate270ImageAction(), rotate90ImageAction(), and selectionChangedEvent(). 00713 { 00714 int numSelected = 0; 00715 QIconViewItem* current = photos->firstItem(); 00716 while(current != NULL) 00717 { 00718 if(current->isSelected()) 00719 { 00720 numSelected++; 00721 00722 //there are effectively 3 states: 00723 //1) no items selected -> disable all buttons besides addPhoto 00724 //2) one itme selected -> enable all button, including set desktop wallpaper button 00725 //3) more than one item selected -> enable all but edit button (since we don't know which photo to edit) 00726 //thus once 2 selected photos are found we know we are in the multi select mode and can terminate the search 00727 if(numSelected > 1) 00728 break; 00729 } 00730 00731 //move to next item 00732 current = current->nextItem(); 00733 } 00734 00735 if(numSelected == 0) 00736 { 00737 removeImage->setEnabled(false); 00738 rotate90Image->setEnabled(false); 00739 rotate270Image->setEnabled(false); 00740 if(setDesktopBtn) { setDesktopBtn->setEnabled(false); } 00741 layout->setEditTabEnabled(false); 00742 } 00743 else 00744 { 00745 removeImage->setEnabled(true); 00746 rotate90Image->setEnabled(true); 00747 rotate270Image->setEnabled(true); 00748 if(setDesktopBtn) { setDesktopBtn->setEnabled(true); } 00749 layout->setEditTabEnabled(true); 00750 } 00751 00752 if(setDesktopBtn) { setDesktopBtn->setEnabled( numSelected == 1 ); } 00753 }
|
|
Activates/Deactives remove/rotate buttons.
Definition at line 755 of file subalbumWidget.cpp. References addImage, buttonsState, layout, removeImage, rotate270Image, rotate90Image, setDesktopBtn, LayoutWidget::setEditTabEnabled(), and wallpaperButtonState. Referenced by TitleWidget::exportLargeImages(), TitleWidget::exportSmallWebGallery(), TitleWidget::loadAlbum(), TitleWidget::saveAlbum(), and TitleWidget::saveAsAlbum(). 00756 { 00757 if(!enable) 00758 { 00759 buttonsState = rotate90Image->isEnabled(); 00760 addImage->setEnabled(enable && true); 00761 removeImage->setEnabled(enable && true); 00762 rotate90Image->setEnabled(enable); 00763 rotate270Image->setEnabled(enable); 00764 if(setDesktopBtn) 00765 { 00766 wallpaperButtonState = setDesktopBtn->isEnabled(); 00767 setDesktopBtn->setEnabled(enable); 00768 } 00769 layout->setEditTabEnabled(enable); 00770 } 00771 else 00772 { 00773 addImage->setEnabled(enable && true); 00774 removeImage->setEnabled(buttonsState && true); 00775 rotate90Image->setEnabled(buttonsState); 00776 rotate270Image->setEnabled(buttonsState); 00777 if(setDesktopBtn) { setDesktopBtn->setEnabled(wallpaperButtonState); } 00778 layout->setEditTabEnabled(buttonsState); 00779 } 00780 }
|
|
"Add" button
Definition at line 140 of file subalbumWidget.h. Referenced by SubalbumWidget(), and updateButtons(). |
|
Definition at line 131 of file subalbumWidget.h. Referenced by setSubalbum(), and SubalbumWidget(). |
|
Definition at line 127 of file subalbumWidget.h. Referenced by SubalbumWidget(). |
|
cached enabled/disabled state of buttons
Definition at line 158 of file subalbumWidget.h. Referenced by updateButtons(). |
|
Pointer to the parent layout widget.
Definition at line 155 of file subalbumWidget.h. Referenced by addImageAction(), removeImageAction(), rotate270ImageAction(), rotate90ImageAction(), SubalbumWidget(), and updateButtons(). |
|
Grids widgets are placed in.
Definition at line 126 of file subalbumWidget.h. Referenced by SubalbumWidget(). |
|
Photos layout.
Definition at line 134 of file subalbumWidget.h. Referenced by addImageAction(), anyPhotosSelected(), anySelectedPhotosRevertable(), deselectAll(), getFirstSelectedPhoto(), getSelectedPhoto(), refreshAllPhotos(), refreshPhotos(), refreshSelectedPhotos(), removeImageAction(), reorder(), resizeEvent(), revertSelectedPhotos(), rotate270ImageAction(), rotate90ImageAction(), setSelectedPhoto(), stripDescriptionsFromSelectedPhotos(), SubalbumWidget(), and updateButtons(). |
|
"Remove" button
Definition at line 143 of file subalbumWidget.h. Referenced by SubalbumWidget(), and updateButtons(). |
|
"Rotate 270" button
Definition at line 149 of file subalbumWidget.h. Referenced by SubalbumWidget(), and updateButtons(). |
|
"Rotate 90" button
Definition at line 146 of file subalbumWidget.h. Referenced by SubalbumWidget(), and updateButtons(). |
|
Set desktop wallpaper button.
Definition at line 152 of file subalbumWidget.h. Referenced by SubalbumWidget(), and updateButtons(). |
|
Pointer to backend subalbum.
Definition at line 137 of file subalbumWidget.h. Referenced by addImageAction(), refreshPhotos(), removeImageAction(), reorder(), setSubalbum(), and SubalbumWidget(). |
|
Grid lower buttons are placed in.
Definition at line 130 of file subalbumWidget.h. |
|
cached enabled/distable state of set wallpaper button
Definition at line 161 of file subalbumWidget.h. Referenced by updateButtons(). |