AlbumShaper  1.0a3
Public Slots | Signals | Public Member Functions | Private Slots | Private Attributes
LayoutWidget Class Reference

Displays list of subalbums and a particular subalbum layout. More...

#include <layoutWidget.h>

Inheritance diagram for LayoutWidget:
Inheritance graph
[legend]
Collaboration diagram for LayoutWidget:
Collaboration graph
[legend]

List of all members.

Public Slots

void setEditTabEnabled (bool val)
void editSelectedPhoto ()
 Edits first select photo.
void organize ()
 Select organize tab.
void photoStateChangedEvent ()
 handle the changing state of selected/shown photos
void refreshSelectedCollectionIconName ()
 updates the selected collection icon name
void updateSubalbumImage (QPixmap *val)
 Updates the current subalbums image.

Signals

void collectionSelected (Subalbum *)

Public Member Functions

 LayoutWidget (QWidget *parent=0, const char *name=0)
 Creates empty layout.
SubalbumWidgetgetSubalbum ()
 Returns a pointer to the subalbum.
SubalbumsWidgetgetSubalbums ()
 Returns a pointer to the subalbums.
WindowgetWindow ()
 Returns a pointer to the window.
void refresh ()
 Refreshes layout.
void revertPhotos ()
 Reverts all selected photos in organize mode, or currently shown photo if in editing mode.

Private Slots

void tabChanged (QWidget *widget)
 handle tab shown changed signal
void showCollection (Subalbum *collection)

Private Attributes

Windowwindow
 Window pointer.
QGridLayout * grid
 Grid items placed in.
SubalbumsWidgetsubalbums
 List of subalbums.
QTabWidget * tabbedArea
 Tab widget containing organize and edit widgets.
SubalbumWidgetsubalbum
 Collection organize widget.
EditingInterfaceeditingInterface
 Editing interface.

Detailed Description

Displays list of subalbums and a particular subalbum layout.

Definition at line 35 of file layoutWidget.h.


Constructor & Destructor Documentation

LayoutWidget::LayoutWidget ( QWidget parent = 0,
const char *  name = 0 
)

Creates empty layout.

Definition at line 30 of file layoutWidget.cpp.

References collectionSelected(), editingInterface, grid, photoStateChangedEvent(), showCollection(), subalbum, subalbums, tabbedArea, tabChanged(), and window.

                                                             : QWidget(parent,name)
{
  window = (Window*)parent;
  subalbums = new SubalbumsWidget( this, "subalbums" );
  connect( subalbums, SIGNAL( collectionSelected(Subalbum*)),
           this,      SLOT( showCollection( Subalbum* )) );
  
  subalbum = new SubalbumWidget( NULL, this, "subalbum" );
  editingInterface = new EditingInterface( this, "editingInterface" );

  tabbedArea = new QTabWidget( this, "tabbedArea" );  
  tabbedArea->addTab(subalbum, tr("Organize") );
  tabbedArea->addTab(editingInterface, tr("Edit") );
  
  //by default no photo has been edited
  tabbedArea->setTabEnabled(editingInterface, false);   
  
  //catch changing tab selection in order to
  //initialize editing interface if it was selected
  connect( tabbedArea, SIGNAL( currentChanged(QWidget*) ),
           this, SLOT( tabChanged(QWidget*) ) );
  
  //catch selectedPhotoStateChanged signal in order to
  //enable/disable Photos and Tools menu items
  connect( subalbum, SIGNAL( selectedPhotoStateChanged() ),
           this, SLOT( photoStateChangedEvent() ) );
  
  //catch photo modified signal in order to 
  //enable/disable Photos and Tools menu items
  connect( editingInterface, SIGNAL( photoModified() ),
           this, SLOT( photoStateChangedEvent() ) );
    
  //place the subalbums list and tabbed area in grid
  grid = new QGridLayout( this, 1, 2, 0 );
  
  grid->addWidget( subalbums, 0, 0 );
  grid->setColSpacing( 0, subalbums->sizeHint().width() );

  grid->addWidget( tabbedArea, 0, 1 );
  grid->setColStretch( 1, 1 );
}

Member Function Documentation

void LayoutWidget::collectionSelected ( Subalbum ) [signal]

Referenced by LayoutWidget(), and showCollection().

void LayoutWidget::editSelectedPhoto ( ) [slot]

Edits first select photo.

Definition at line 151 of file layoutWidget.cpp.

References editingInterface, and tabbedArea.

{
  tabbedArea->showPage( editingInterface );
}
SubalbumWidget * LayoutWidget::getSubalbum ( )
SubalbumsWidget * LayoutWidget::getSubalbums ( )
Window * LayoutWidget::getWindow ( )
void LayoutWidget::organize ( ) [slot]

Select organize tab.

Definition at line 156 of file layoutWidget.cpp.

References tabbedArea.

Referenced by EditingInterface::returnAction(), and showCollection().

{
  tabbedArea->setCurrentPage( 0 );
}
void LayoutWidget::photoStateChangedEvent ( ) [slot]

handle the changing state of selected/shown photos

Definition at line 174 of file layoutWidget.cpp.

References SubalbumWidget::anyPhotosSelected(), SubalbumWidget::anySelectedPhotosRevertable(), EditingInterface::currentPhotoRevertable(), editingInterface, Window::getTitle(), subalbum, tabbedArea, TitleWidget::updateMenus(), and window.

Referenced by LayoutWidget(), and tabChanged().

{
  //determine if:
  //1.) any photos are selected - false if in editing mode
  //2.) if any revertable photos are selected/shown
  bool anySelected = false;
  bool anyRevertable = false;
  
  if( tabbedArea->currentPage() == subalbum )
  {
    anySelected = subalbum->anyPhotosSelected();
    anyRevertable = anySelected && subalbum->anySelectedPhotosRevertable();    
  }
  else
  {
    //none selected in editing mode
    anySelected = false;
    anyRevertable = editingInterface->currentPhotoRevertable();
  }
  
  //update menus
  window->getTitle()->updateMenus(anySelected, anyRevertable);    
}
void LayoutWidget::refresh ( )

Refreshes layout.

Definition at line 109 of file layoutWidget.cpp.

References SubalbumsWidget::refreshCollectionsList(), and subalbums.

Referenced by Window::refresh(), and Window::Window().

void LayoutWidget::refreshSelectedCollectionIconName ( ) [slot]

updates the selected collection icon name

Definition at line 84 of file layoutWidget.cpp.

References SubalbumsWidget::refreshSelectedCollectionName(), and subalbums.

void LayoutWidget::revertPhotos ( )

Reverts all selected photos in organize mode, or currently shown photo if in editing mode.

Definition at line 166 of file layoutWidget.cpp.

References editingInterface, EditingInterface::revertCurrentPhoto(), SubalbumWidget::revertSelectedPhotos(), subalbum, and tabbedArea.

Referenced by TitleWidget::revertPhotos().

{
  if( tabbedArea->currentPage() == subalbum )
    subalbum->revertSelectedPhotos();
  else if( tabbedArea->currentPage() == editingInterface )
    editingInterface->revertCurrentPhoto();
}
void LayoutWidget::setEditTabEnabled ( bool  val) [slot]

Definition at line 161 of file layoutWidget.cpp.

References editingInterface, and tabbedArea.

Referenced by SubalbumWidget::updateButtons().

{
  tabbedArea->setTabEnabled(editingInterface, val);   
}
void LayoutWidget::showCollection ( Subalbum collection) [private, slot]

Definition at line 72 of file layoutWidget.cpp.

References collectionSelected(), organize(), SubalbumWidget::setSubalbum(), and subalbum.

Referenced by LayoutWidget().

{
  //ensure currently in organize mode
  organize();
  
  //load collection
  subalbum->setSubalbum(collection);
  
  //pass signal on so title area can update as well
  emit collectionSelected( collection );
}
void LayoutWidget::tabChanged ( QWidget widget) [private, slot]

handle tab shown changed signal

get current collection and photo pointers

Definition at line 114 of file layoutWidget.cpp.

References editingInterface, SubalbumWidget::getFirstSelectedPhoto(), EditingInterface::getPhoto(), SubalbumWidget::getSubalbum(), photoStateChangedEvent(), SubalbumWidget::refreshAllPhotos(), EditingInterface::setFocus(), EditingInterface::setPhoto(), SubalbumWidget::setSelectedPhoto(), and subalbum.

Referenced by LayoutWidget().

{
  //orignize tab seleced
  if(widget != editingInterface)
  {
    //refresh all thumbnails since any could have changed
    subalbum->refreshAllPhotos();

    //handle the selected/shown photo state having been changed
    photoStateChangedEvent();

    //find and select the last shown photo in the
    //editing interface, unselect all other items
    subalbum->setSelectedPhoto( editingInterface->getPhoto() );
    
    return;
  }
  //edit tab selected - init editor
  else
  {
    Subalbum* collection = subalbum->getSubalbum();
    Photo* photo = subalbum->getFirstSelectedPhoto();    

    //bail if either pointer is null (sanity check)
    if(collection == NULL || photo == NULL)
      return;
  
    //init editing interface for current collection:photo
    editingInterface->setPhoto( collection, photo);
    editingInterface->setFocus();

    //handle the selected/shown photo state having been changed
    photoStateChangedEvent();
  }
}
void LayoutWidget::updateSubalbumImage ( QPixmap *  val) [slot]

Updates the current subalbums image.

Definition at line 89 of file layoutWidget.cpp.

References subalbums, and SubalbumsWidget::updatedSelectedCollectionImage().


Member Data Documentation

Editing interface.

Definition at line 76 of file layoutWidget.h.

Referenced by editSelectedPhoto(), LayoutWidget(), photoStateChangedEvent(), revertPhotos(), setEditTabEnabled(), and tabChanged().

QGridLayout* LayoutWidget::grid [private]

Grid items placed in.

Definition at line 64 of file layoutWidget.h.

Referenced by LayoutWidget().

Collection organize widget.

Definition at line 73 of file layoutWidget.h.

Referenced by getSubalbum(), LayoutWidget(), photoStateChangedEvent(), revertPhotos(), showCollection(), and tabChanged().

List of subalbums.

Definition at line 67 of file layoutWidget.h.

Referenced by getSubalbums(), LayoutWidget(), refresh(), refreshSelectedCollectionIconName(), and updateSubalbumImage().

QTabWidget* LayoutWidget::tabbedArea [private]

Tab widget containing organize and edit widgets.

Definition at line 70 of file layoutWidget.h.

Referenced by editSelectedPhoto(), LayoutWidget(), organize(), photoStateChangedEvent(), revertPhotos(), and setEditTabEnabled().

Window pointer.

Definition at line 61 of file layoutWidget.h.

Referenced by getWindow(), LayoutWidget(), and photoStateChangedEvent().


The documentation for this class was generated from the following files: