AlbumShaper 1.0a3
LayoutWidget Class Reference

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

#include <layoutWidget.h>

Inheritance diagram for LayoutWidget:
Collaboration diagram for LayoutWidget:

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.
 
Q3GridLayout * 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 39 of file layoutWidget.h.

Constructor & Destructor Documentation

◆ LayoutWidget()

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

Creates empty layout.

Definition at line 33 of file layoutWidget.cpp.

33 : QWidget(parent,name)
34{
35 window = (Window*)parent;
36 subalbums = new SubalbumsWidget( this, "subalbums" );
37 connect( subalbums, SIGNAL( collectionSelected(Subalbum*)),
38 this, SLOT( showCollection( Subalbum* )) );
39
40 subalbum = new SubalbumWidget( NULL, this, "subalbum" );
41 editingInterface = new EditingInterface( this, "editingInterface" );
42
43 tabbedArea = new QTabWidget( this, "tabbedArea" );
44 tabbedArea->addTab(subalbum, tr("Organize") );
45 tabbedArea->addTab(editingInterface, tr("Edit") );
46
47 //by default no photo has been edited
48 tabbedArea->setTabEnabled(editingInterface, false);
49
50 //catch changing tab selection in order to
51 //initialize editing interface if it was selected
52 connect( tabbedArea, SIGNAL( currentChanged(QWidget*) ),
53 this, SLOT( tabChanged(QWidget*) ) );
54
55 //catch selectedPhotoStateChanged signal in order to
56 //enable/disable Photos and Tools menu items
57 connect( subalbum, SIGNAL( selectedPhotoStateChanged() ),
58 this, SLOT( photoStateChangedEvent() ) );
59
60 //catch photo modified signal in order to
61 //enable/disable Photos and Tools menu items
62 connect( editingInterface, SIGNAL( photoModified() ),
63 this, SLOT( photoStateChangedEvent() ) );
64
65 //place the subalbums list and tabbed area in grid
66 grid = new Q3GridLayout( this, 1, 2, 0 );
67
68 grid->addWidget( subalbums, 0, 0 );
69 grid->setColSpacing( 0, subalbums->sizeHint().width() );
70
71 grid->addWidget( tabbedArea, 0, 1 );
72 grid->setColStretch( 1, 1 );
73}
Interface for editing photo.
SubalbumsWidget * subalbums
List of subalbums.
void photoStateChangedEvent()
handle the changing state of selected/shown photos
void collectionSelected(Subalbum *)
EditingInterface * editingInterface
Editing interface.
Q3GridLayout * grid
Grid items placed in.
void showCollection(Subalbum *collection)
Window * window
Window pointer.
SubalbumWidget * subalbum
Collection organize widget.
void tabChanged(QWidget *widget)
handle tab shown changed signal
QTabWidget * tabbedArea
Tab widget containing organize and edit widgets.
Displays subalbum layout.
A subalbum contains photos.
Definition subalbum.h:49
Columnview of all subalbums in album.
Top level widget, encapsulates the title widget, the layout widget, and the toolbar widget.
Definition window.h:40

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

Member Function Documentation

◆ collectionSelected

void LayoutWidget::collectionSelected ( Subalbum * )
signal

Referenced by LayoutWidget(), and showCollection().

◆ editSelectedPhoto

void LayoutWidget::editSelectedPhoto ( )
slot

Edits first select photo.

Definition at line 154 of file layoutWidget.cpp.

155{
156 tabbedArea->showPage( editingInterface );
157}

References editingInterface, and tabbedArea.

◆ getSubalbum()

◆ getSubalbums()

◆ getWindow()

◆ organize

void LayoutWidget::organize ( )
slot

Select organize tab.

Definition at line 159 of file layoutWidget.cpp.

160{
161 tabbedArea->setCurrentPage( 0 );
162}

References tabbedArea.

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

◆ photoStateChangedEvent

void LayoutWidget::photoStateChangedEvent ( )
slot

handle the changing state of selected/shown photos

Definition at line 177 of file layoutWidget.cpp.

178{
179 //determine if:
180 //1.) any photos are selected - false if in editing mode
181 //2.) if any revertable photos are selected/shown
182 bool anySelected = false;
183 bool anyRevertable = false;
184
185 if( tabbedArea->currentPage() == subalbum )
186 {
187 anySelected = subalbum->anyPhotosSelected();
188 anyRevertable = anySelected && subalbum->anySelectedPhotosRevertable();
189 }
190 else
191 {
192 //none selected in editing mode
193 anySelected = false;
194 anyRevertable = editingInterface->currentPhotoRevertable();
195 }
196
197 //update menus
198 window->getTitle()->updateMenus(anySelected, anyRevertable);
199}
bool anyPhotosSelected()
Returns true if any phtos are selected.
bool anySelectedPhotosRevertable()
Returns true if any selected photos are revertable.
void updateMenus(bool anySelected=false, bool anyRevertable=false)
update begin presentation menu entry - disabled when no photos in album
TitleWidget * getTitle()
returns a pointer to the title widget
Definition window.cpp:188

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

Referenced by LayoutWidget(), and tabChanged().

◆ refresh()

void LayoutWidget::refresh ( )

Refreshes layout.

Definition at line 112 of file layoutWidget.cpp.

113{
115}
void refreshCollectionsList()
Refreshes list of collections, selecting first by default.

References SubalbumsWidget::refreshCollectionsList(), and subalbums.

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

◆ refreshSelectedCollectionIconName

void LayoutWidget::refreshSelectedCollectionIconName ( )
slot

updates the selected collection icon name

Definition at line 87 of file layoutWidget.cpp.

References SubalbumsWidget::refreshSelectedCollectionName(), and subalbums.

◆ revertPhotos()

void LayoutWidget::revertPhotos ( )

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

Definition at line 169 of file layoutWidget.cpp.

170{
171 if( tabbedArea->currentPage() == subalbum )
173 else if( tabbedArea->currentPage() == editingInterface )
175}
void revertCurrentPhoto()
reverts current photo and updates display
void revertSelectedPhotos()
Revert selected photos to their original form.

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

Referenced by TitleWidget::revertPhotos().

◆ setEditTabEnabled

void LayoutWidget::setEditTabEnabled ( bool val)
slot

Definition at line 164 of file layoutWidget.cpp.

165{
166 tabbedArea->setTabEnabled(editingInterface, val);
167}

References editingInterface, and tabbedArea.

Referenced by SubalbumWidget::updateButtons(), and SubalbumWidget::updateButtons().

◆ showCollection

void LayoutWidget::showCollection ( Subalbum * collection)
privateslot

Definition at line 75 of file layoutWidget.cpp.

76{
77 //ensure currently in organize mode
78 organize();
79
80 //load collection
81 subalbum->setSubalbum(collection);
82
83 //pass signal on so title area can update as well
84 emit collectionSelected( collection );
85}
void organize()
Select organize tab.
void setSubalbum(Subalbum *salbum)
Resets the subalbum this subalbum widget is displaying.

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

Referenced by LayoutWidget().

◆ tabChanged

void LayoutWidget::tabChanged ( QWidget * widget)
privateslot

handle tab shown changed signal

get current collection and photo pointers

Definition at line 117 of file layoutWidget.cpp.

118{
119 //orignize tab seleced
120 if(widget != editingInterface)
121 {
122 //refresh all thumbnails since any could have changed
124
125 //handle the selected/shown photo state having been changed
127
128 //find and select the last shown photo in the
129 //editing interface, unselect all other items
131
132 return;
133 }
134 //edit tab selected - init editor
135 else
136 {
138 Subalbum* collection = subalbum->getSubalbum();
140
141 //bail if either pointer is null (sanity check)
142 if(collection == NULL || photo == NULL)
143 return;
144
145 //init editing interface for current collection:photo
146 editingInterface->setPhoto( collection, photo);
148
149 //handle the selected/shown photo state having been changed
151 }
152}
void setPhoto(Subalbum *collection, Photo *photo)
Sets the photo pointer and constructs scaled qimage's for painting.
Photo * getPhoto()
Returns a pointer to the currently selected photo.
A photo consists of a full size image, a smaller slide show image, a very small thumbnail image,...
Definition photo.h:45
void refreshAllPhotos()
refreshes all photos, selections are preserved
void setSelectedPhoto(Photo *selection)
Sets the selected photo to selection and ensures it is visible.
Subalbum * getSubalbum()
returns a pointer to the backend subalbum
Photo * getFirstSelectedPhoto()
Returns first selected photo.

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

Referenced by LayoutWidget().

◆ updateSubalbumImage

void LayoutWidget::updateSubalbumImage ( QPixmap * val)
slot

Updates the current subalbums image.

Definition at line 92 of file layoutWidget.cpp.

93{
95}
void updatedSelectedCollectionImage(QPixmap *val)

References subalbums, and SubalbumsWidget::updatedSelectedCollectionImage().

Member Data Documentation

◆ editingInterface

EditingInterface* LayoutWidget::editingInterface
private

Editing interface.

Definition at line 80 of file layoutWidget.h.

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

◆ grid

Q3GridLayout* LayoutWidget::grid
private

Grid items placed in.

Definition at line 68 of file layoutWidget.h.

Referenced by LayoutWidget().

◆ subalbum

SubalbumWidget* LayoutWidget::subalbum
private

Collection organize widget.

Definition at line 77 of file layoutWidget.h.

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

◆ subalbums

SubalbumsWidget* LayoutWidget::subalbums
private

List of subalbums.

Definition at line 71 of file layoutWidget.h.

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

◆ tabbedArea

QTabWidget* LayoutWidget::tabbedArea
private

Tab widget containing organize and edit widgets.

Definition at line 74 of file layoutWidget.h.

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

◆ window

Window* LayoutWidget::window
private

Window pointer.

Definition at line 65 of file layoutWidget.h.

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


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