Main Page   Compound List   File List   Compound Members   File Members  

ToolbarWidget Class Reference

#include <toolbarWidget.h>

List of all members.


Detailed Description

Toolbar providing buttons for basic actions.

Definition at line 18 of file toolbarWidget.h.

Public Methods

 ToolbarWidget (QWidget *parent=0, const char *name=0)
 Creates layout and places buttons.

 ~ToolbarWidget ()
 Deletes objects.


Private Slots

void loadAction ()
 Called when user clicks "Load" button.

void storeAction ()
 Called when user clicks "Store" button.


Private Attributes

QGridLayout * grid
 Layout widgets place in.

QPixmap * loadImage
 "Load" image

QPushButton * load
 Store button.

QPixmap * storeImage
 "Store" image

QPushButton * store
 Store button.

QFrame * line
 Horizontal line above buttons.

Windowparent
 Parent window.


Constructor & Destructor Documentation

ToolbarWidget::ToolbarWidget QWidget *    parent = 0,
const char *    name = 0
 

Creates layout and places buttons.

Definition at line 21 of file toolbarWidget.cpp.

00022                                                 : QFrame(parent,name)
00023 {
00024   //store parent window pointer
00025   this->parent = (Window*)parent;
00026   //Create horizontal line
00027   line = new QFrame(this);
00028   line->setFrameShadow( QFrame::Plain );
00029   line->setLineWidth( 2 );
00030   line->setFrameShape( QFrame::HLine );
00031 
00032   //Create buttons and connect their click signals to the action slots
00033   loadImage = new QPixmap( "images/load.png" );
00034   load = new QPushButton( this );
00035   load->setPixmap( *loadImage );
00036   connect( load, SIGNAL(clicked()), SLOT(loadAction()) );
00037 
00038   storeImage = new QPixmap( "images/store.png" );
00039   store = new QPushButton( this );
00040   store->setPixmap( *storeImage );
00041   connect( store, SIGNAL(clicked()), SLOT(storeAction()) );
00042   
00043   //Place images in grid
00044   grid = new QGridLayout( this, 2, 5, 0 );
00045   grid->addMultiCellWidget( line, 0, 0, 0, 8 );
00046   grid->addWidget( load, 1, 1, Qt::AlignCenter);
00047   grid->addWidget( store, 1, 3, Qt::AlignCenter);
00048 
00049   //Set spaces between buttons to stretch to fill any empty space
00050   grid->setColStretch( 0, 1 );
00051   grid->setColStretch( 2, 1 );
00052   grid->setColStretch( 4, 1 );
00053 
00054   //set the background of the widget to be white
00055   setPaletteBackgroundColor( QColor(255, 255, 255) );
00056 }

ToolbarWidget::~ToolbarWidget  
 

Deletes objects.

Definition at line 58 of file toolbarWidget.cpp.

References grid, line, load, loadImage, store, and storeImage.

00059 {
00060   delete loadImage;
00061   delete load;
00062   delete storeImage;
00063   delete store;
00064   delete line;
00065   delete grid;
00066 }


Member Function Documentation

void ToolbarWidget::loadAction   [private, slot]
 

Called when user clicks "Load" button.

Definition at line 68 of file toolbarWidget.cpp.

References Window::getTitle(), Album::importFromDisk(), parent, Window::refresh(), and TitleWidget::setAlbum().

00069 {
00070   //create a new album
00071   Album* albm = new Album();
00072   
00073   //attempt to load xml file
00074   albm->importFromDisk();
00075   
00076   //set album in title
00077   parent->getTitle()->setAlbum( albm );
00078   
00079   //refresh screen
00080   parent->refresh();
00081 }

void ToolbarWidget::storeAction   [private, slot]
 

Called when user clicks "Store" button.

Definition at line 83 of file toolbarWidget.cpp.

References Album::exportToDisk(), TitleWidget::getAlbum(), Window::getLayout(), LayoutWidget::getSubalbum(), Window::getTitle(), parent, and SubalbumWidget::syncPhotos().

00084 {
00085   //sync current subalbum to ensure all photo descriptions saved
00086   if(  parent->getLayout()->getSubalbum() != NULL )
00087     parent->getLayout()->getSubalbum()->syncPhotos();
00088     
00089   parent->getTitle()->getAlbum()->exportToDisk();
00090 }


Member Data Documentation

QGridLayout* ToolbarWidget::grid [private]
 

Layout widgets place in.

Definition at line 38 of file toolbarWidget.h.

Referenced by ~ToolbarWidget().

QFrame* ToolbarWidget::line [private]
 

Horizontal line above buttons.

Definition at line 53 of file toolbarWidget.h.

Referenced by ~ToolbarWidget().

QPushButton* ToolbarWidget::load [private]
 

Store button.

Definition at line 44 of file toolbarWidget.h.

Referenced by ~ToolbarWidget().

QPixmap* ToolbarWidget::loadImage [private]
 

"Load" image

Definition at line 41 of file toolbarWidget.h.

Referenced by ~ToolbarWidget().

Window* ToolbarWidget::parent [private]
 

Parent window.

Definition at line 56 of file toolbarWidget.h.

Referenced by loadAction(), and storeAction().

QPushButton* ToolbarWidget::store [private]
 

Store button.

Definition at line 50 of file toolbarWidget.h.

Referenced by ~ToolbarWidget().

QPixmap* ToolbarWidget::storeImage [private]
 

"Store" image

Definition at line 47 of file toolbarWidget.h.

Referenced by ~ToolbarWidget().


The documentation for this class was generated from the following files:
Generated on Sun Feb 23 00:52:10 2003 for AlbumMaker by doxygen1.2.18