AlbumShaper
1.0a3
|
Top level widget, encapsulates the title widget, the layout widget, and the toolbar widget. More...
#include <window.h>
Public Member Functions | |
Window (QWidget *parent=0, const char *name=0) | |
Creates title area, layout, and tool bar and places them in grid. | |
~Window () | |
Save user settings on destruct. | |
TitleWidget * | getTitle () |
returns a pointer to the title widget | |
LayoutWidget * | getLayout () |
returns a pointer to the layout object | |
StatusWidget * | getStatus () |
returns a pointer to the status widget | |
void | refresh () |
refreshes the layout | |
Configuration * | getConfig () |
get setting object | |
Public Attributes | |
QPixmap * | shadowBL |
QPixmap * | shadowB |
QPixmap * | shadowBR |
QPixmap * | shadowR |
QPixmap * | shadowTR |
QPixmap * | photoInfo |
Protected Member Functions | |
bool | event (QEvent *) |
void | hideEvent (QHideEvent *) |
void | showEvent (QShowEvent *) |
void | closeEvent (QCloseEvent *e) |
Private Member Functions | |
void | startSlideshow (bool startAtBeginning) |
utility function used by above, actually started slideshow | |
Private Attributes | |
Configuration * | config |
Configuration settings. | |
QGridLayout * | grid |
Grid objects placed in. | |
TitleWidget * | title |
Title widget cont ains menu's, album information and Album Shaper icon. | |
LayoutWidget * | layout |
Layout includes subalbums listing and particular subalbum layout. | |
StatusWidget * | status |
Status widget either displays a status message or progress bar. |
Top level widget, encapsulates the title widget, the layout widget, and the toolbar widget.
Window::Window | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
Creates title area, layout, and tool bar and places them in grid.
refresh title annotations when collections are selected
refresh collection icons when collection names are edited
Definition at line 48 of file window.cpp.
References config, Configuration::getBool(), Configuration::getString(), grid, IMAGE_PATH, layout, Configuration::loadSettings(), photoInfo, LayoutWidget::refresh(), Configuration::resetSetting(), MiscSettings::setDefaults(), AlertsWidget::setDefaults(), LoadingSavingWidget::setDefaults(), LayoutSettingsWidget::setDefaults(), shadowB, shadowBL, shadowBR, shadowR, shadowTR, status, title, and TitleWidget::useAnimation().
: QWidget(parent,name) { //don't clear pixmap area before painting, prevents flicker setWFlags(WRepaintNoErase); //load shadow pixmaps shadowBL = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottomLeft.png" ); shadowB = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottom.png" ); shadowBR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottomRight.png" ); shadowR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientRight.png" ); shadowTR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientTopRight.png" ); //load photo info pixmap photoInfo = new QPixmap( QString(IMAGE_PATH)+"buttonIcons/photoInfo.png"); //------------------------------------------------ //create configuration object with default settings config = new Configuration(); LoadingSavingWidget::setDefaults(config); LayoutSettingsWidget::setDefaults(config); AlertsWidget::setDefaults(config); MiscSettings::setDefaults(config); //------------------------------------------------ //load user settings config->loadSettings(); //if temorary image directory does not exist create it QDir homeDir; bool configDirMade = true; if(!homeDir.exists( config->getString( "loadSave", "tempImageDirectory")) ) { configDirMade = homeDir.mkdir( config->getString( "loadSave", "tempImageDirectory")); } //if directory could not be made attempt to revert to default directory if(!configDirMade) { AlertDialog alert( "unable to create temp dir", QString("unable to make temporary directory! (" + config->getString( "loadSave", "tempImageDirectory") ), "alertIcons/warning.png", this ); alert.exec(); config->resetSetting( "loadSave", "tempImageDirectory" ); configDirMade = true; if(!homeDir.exists( config->getString( "loadSave", "tempImageDirectory")) ) { configDirMade = homeDir.mkdir( config->getString( "loadSave", "tempImageDirectory")); } } //if we are still unable to create the temporary image directory then immediately abort if(!configDirMade) { AlertDialog alert( "unable to create temp dir", QString("unable to make temporary directory! (" + config->getString( "loadSave", "tempImageDirectory") ), "alertIcons/warning.png", this ); alert.exec(); close(); } //------------------------------------------------ //create top level widgets title = new TitleWidget (this, "title"); layout = new LayoutWidget(this, "layout"); status = new StatusWidget(this, "status"); connect( layout, SIGNAL(collectionSelected(Subalbum*)), title, SLOT(refreshCollectionAnnotations(Subalbum*)) ); connect( title, SIGNAL(subalbumNameChanged()), layout, SLOT(refreshSelectedCollectionIconName()) ); // slideshow = new SlideshowWidget(this, "slideshow", WResizeNoErase); // slideshow->hide(); // connect( slideshow, SIGNAL(endSlideshow()), this, SLOT(endSlideshow()) ); //refresh subalbums listing layout->refresh(); //place widgets in main frame grid = new QGridLayout( this, 3, 2, 0); grid->addWidget( title, 0, 0 ); grid->addWidget( layout, 1, 0 ); grid->setRowStretch( 1, 1 ); grid->addWidget( status, 2, 0 ); grid->setRowSpacing( 2, 24 ); // grid->addMultiCellWidget( slideshow, 0, 2, 1, 1 ); grid->setColStretch(0, 1 ); //PLATFORM_SPECIFIC_CODE //create and set application icon #if( !defined(Q_OS_MACX) && !defined(Q_OS_WIN) ) setIcon( QPixmap(QString(IMAGE_PATH)+"miscImages/as32.png") ); #endif setCaption( #ifdef CVS_CODE "(CVS BUILD) " + #endif tr("Album Shaper")); //------------------------------------------------ //apply settings QToolTip::setGloballyEnabled( config->getBool( "layout", "showTooltips" ) ); title->useAnimation( config->getBool( "layout", "animation" ) ); //------------------------------------------------ }
Window::~Window | ( | ) |
Save user settings on destruct.
Definition at line 152 of file window.cpp.
References config, RecentAlbums::getEntry(), TitleWidget::getRecentAlbums(), height, RecentAlbums::numEntries(), Configuration::removeGroup(), Configuration::saveSettings(), Configuration::setInt(), Configuration::setString(), title, and width.
{ //flush and reinsert recent albums listing config->removeGroup( "recentAlbums" ); RecentAlbums* recentAlbums = title->getRecentAlbums(); int num = recentAlbums->numEntries(); int i; QString albumName, albumLocation, albumPhotoCount; for(i=0; i<num; i++) { recentAlbums->getEntry( i, albumName, albumLocation, albumPhotoCount ); config->setString( "recentAlbums", QString("%1_name").arg(i), albumName ); config->setString( "recentAlbums", QString("%1_location").arg(i), albumLocation ); config->setString( "recentAlbums", QString("%1_photoCount").arg(i), albumPhotoCount ); } //store window size and placement in config object config->setInt( "layout", "windowPosX", pos().x() ); config->setInt( "layout", "windowPosY", pos().y() ); config->setInt( "layout", "windowWidth", size().width() ); config->setInt( "layout", "windowHeight", size().height() ); //save user settings config->saveSettings(); //delete non-qt objects delete config; config = NULL; }
void Window::closeEvent | ( | QCloseEvent * | e | ) | [protected] |
Definition at line 202 of file window.cpp.
References Album::albumModified(), config, TitleWidget::getAlbum(), Configuration::getBool(), and title.
{ //check if unsaved modifications exist, warn user they //will lose these if they quit now if(title->getAlbum()->albumModified() ) { //if user has chosen to not receive destructive action warnings, or agrees to the action then quit bool proceed = (!config->getBool( "alerts", "showDestructiveAlerts" )); if(!proceed) { QuestionDialog sure( tr("Quit without saving?"), tr("You have unsaved work. Are you sure you want to quit without saving?"), "alertIcons/warning.png", this ); proceed = sure.exec(); } if(proceed) e->accept(); else e->ignore(); } else { e->accept(); } }
bool Window::event | ( | QEvent * | e | ) | [protected] |
Definition at line 322 of file window.cpp.
References title, and TitleWidget::windowStateChanged().
{ //if base class handles event return immediately if (QWidget::event( e ) ) return true; //handle showMinimized events if ( e->type() == QEvent::ShowMinimized ) { //update menu entries as per window state change title->windowStateChanged( false ); return true; } return false; }
Configuration * Window::getConfig | ( | ) |
get setting object
Definition at line 229 of file window.cpp.
References config.
Referenced by TitleWidget::createTmpDir(), TitleWidget::exportLargeImages(), TitleWidget::exportSmallWebGallery(), TitleWidget::loadAlbum(), main(), TitleWidget::newAlbum(), TitleWidget::proceedWithLoad(), TitleWidget::removeSelectedPhotoDesc(), TitleWidget::revertToSaved(), TitleWidget::saveAlbum(), TitleWidget::saveAsAlbum(), TitleWidget::settings(), and TitleWidget::TitleWidget().
{ return config; }
LayoutWidget * Window::getLayout | ( | ) |
returns a pointer to the layout object
Definition at line 187 of file window.cpp.
References layout.
Referenced by TitleWidget::dropEvent(), TitleWidget::exportLargeImages(), TitleWidget::exportSmallWebGallery(), TitleWidget::loadAlbum(), TitleWidget::newAlbum(), TitleWidget::removeSelectedPhotoDesc(), TitleWidget::revertPhotos(), TitleWidget::saveAlbum(), TitleWidget::saveAsAlbum(), TitleWidget::setAlbumImage(), TitleWidget::setSubalbumImage(), TitleWidget::storeAnnotations(), and TitleWidget::unsetSubalbumImage().
{ return layout; }
StatusWidget * Window::getStatus | ( | ) |
returns a pointer to the status widget
Definition at line 192 of file window.cpp.
References status.
Referenced by SubalbumWidget::addImageAction(), EditingInterface::adjustGrain(), EditingInterface::applyEffect(), EditingInterface::colorBalance(), EditingInterface::crop(), EditingInterface::enhanceContrast(), TitleWidget::exportLargeImages(), TitleWidget::exportSmallWebGallery(), EditingInterface::finishCorrectTilt(), TitleWidget::loadAlbum(), EditingInterface::removeRedeye(), EditingInterface::revertCurrentPhoto(), SubalbumWidget::rotate270ImageAction(), SubalbumWidget::rotate90ImageAction(), EditingInterface::rotateFlip(), TitleWidget::saveAlbum(), TitleWidget::saveAsAlbum(), and EditingInterface::tuneLevels().
{ return status; }
TitleWidget * Window::getTitle | ( | ) |
returns a pointer to the title widget
Definition at line 182 of file window.cpp.
References title.
Referenced by SubalbumWidget::addImageAction(), SubalbumsWidget::createAction(), SubalbumsWidget::deleteAction(), SubalbumsWidget::handleSelectionAttempt(), LayoutWidget::photoStateChangedEvent(), SubalbumsWidget::refreshCollectionsList(), SubalbumWidget::removeImageAction(), SubalbumsWidget::reorder(), SubalbumWidget::rotate270ImageAction(), and SubalbumWidget::rotate90ImageAction().
{ return title; }
void Window::hideEvent | ( | QHideEvent * | ) | [protected] |
Definition at line 339 of file window.cpp.
References title, and TitleWidget::windowStateChanged().
{ //update menu entries as per window state change title->windowStateChanged( false ); }
void Window::refresh | ( | ) |
refreshes the layout
Definition at line 197 of file window.cpp.
References layout, and LayoutWidget::refresh().
Referenced by TitleWidget::refresh().
void Window::showEvent | ( | QShowEvent * | ) | [protected] |
Definition at line 345 of file window.cpp.
References title, and TitleWidget::windowStateChanged().
{ //update menu entries as per window state change title->windowStateChanged( true ); }
void Window::startSlideshow | ( | bool | startAtBeginning | ) | [private] |
utility function used by above, actually started slideshow
Configuration* Window::config [private] |
Configuration settings.
Definition at line 100 of file window.h.
Referenced by closeEvent(), getConfig(), Window(), and ~Window().
QGridLayout* Window::grid [private] |
LayoutWidget* Window::layout [private] |
Layout includes subalbums listing and particular subalbum layout.
Definition at line 109 of file window.h.
Referenced by getLayout(), refresh(), and Window().
QPixmap* Window::photoInfo |
QPixmap * Window::shadowB |
Definition at line 63 of file window.h.
Referenced by PhotoPreviewWidget::paintItem(), and Window().
QPixmap* Window::shadowBL |
Definition at line 63 of file window.h.
Referenced by PhotoPreviewWidget::paintItem(), and Window().
QPixmap * Window::shadowBR |
Definition at line 63 of file window.h.
Referenced by PhotoPreviewWidget::paintItem(), and Window().
QPixmap * Window::shadowR |
Definition at line 63 of file window.h.
Referenced by PhotoPreviewWidget::paintItem(), and Window().
QPixmap * Window::shadowTR |
Definition at line 63 of file window.h.
Referenced by PhotoPreviewWidget::paintItem(), and Window().
StatusWidget* Window::status [private] |
Status widget either displays a status message or progress bar.
Definition at line 112 of file window.h.
Referenced by getStatus(), and Window().
TitleWidget* Window::title [private] |
Title widget cont ains menu's, album information and Album Shaper icon.
Definition at line 106 of file window.h.
Referenced by closeEvent(), event(), getTitle(), hideEvent(), showEvent(), Window(), and ~Window().