Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

window.cpp

Go to the documentation of this file.
00001 //==============================================
00002 //  copyright            : (C) 2003 by Will Stokes
00003 //==============================================
00004 //  This program is free software; you can redistribute it 
00005 //  and/or modify it under the terms of the GNU General 
00006 //  Public License as published by the Free Software 
00007 //  Foundation; either version 2 of the License, or  
00008 //  (at your option) any later version.         
00009 //
00010 //  As a special exception, Will Stokes gives permission to 
00011 //  link this program with Qt non-commercial edition, and 
00012 //  distribute the resulting executable, without including the 
00013 //  source code for the Qt non-commercial edition in the 
00014 //  source distribution. 
00015 //==============================================
00016 
00017 //Systemwide includes
00018 #include <qlayout.h>
00019 #include <qpixmap.h>
00020 
00021 //Projectwide includes
00022 #include "window.h"
00023 #include "titleWidget.h"
00024 #include "layoutWidget.h"
00025 #include "statusWidget.h"
00026 #include "questionDialog.h"
00027 #include "../config.h"
00028 #include "../backend/album.h"
00029 
00030 //==============================================
00031 Window::Window( QWidget* parent,
00032                 const char* name ) : 
00033                 QWidget(parent,name)
00034 {
00035   title  = new TitleWidget (this, "title");
00036   layout = new LayoutWidget(this, "layout");
00037   status = new StatusWidget(this, "status");
00038   
00039   //create new grid and add widgets
00040   grid = new QGridLayout( this, 3, 1, 0);
00041   grid->addWidget( title,  0, 0 );
00042   grid->addWidget( layout, 1, 0 );
00043   grid->addWidget( status, 2, 0 );
00044 
00045   //set the layout widget to take up all remaining space
00046   grid->setRowStretch( 1, 1 );
00047 
00048   //set the background of the widget to be white
00049   setPaletteBackgroundColor( QColor(255, 255, 255) );
00050   
00051   //create and set application icon
00052   applicationIcon = new QPixmap(QString(IMAGE_PATH)+"albumShaperIcon.png");
00053   setIcon( *applicationIcon );
00054   
00055   setCaption( tr("Album Shaper"));
00056 }
00057 //==============================================
00058 TitleWidget* Window::getTitle()
00059 {
00060   return title;
00061 }
00062 //==============================================
00063 LayoutWidget* Window::getLayout()
00064 {
00065   return layout;
00066 }
00067 //==============================================
00068 StatusWidget* Window::getStatus()
00069 {
00070   return status;
00071 }
00072 //==============================================
00073 void Window::refresh()
00074 {
00075   layout->refresh();
00076 }
00077 //==============================================
00078 void Window::closeEvent( QCloseEvent* e)
00079 {
00080   //check if unsaved modifications exist, warn user they
00081   //will lose these if they quit now
00082   if(title->getAlbum()->albumModified() )
00083   {
00084     QuestionDialog sure( tr("Quit without saving?"),
00085                        tr("You have unsaved work. Are you sure you want to quit without saving?"),
00086                        "warning.png",
00087                        this );
00088     if(sure.exec())  
00089       e->accept();
00090     else
00091       e->ignore();
00092   }
00093   else
00094   {
00095     e->accept();
00096   }
00097 }
00098 //==============================================

Generated on Thu Nov 13 00:10:54 2003 for AlbumShaper by doxygen 1.3.4