#include <saveDialog.h>
Inheritance diagram for SaveDialog:
Definition at line 31 of file saveDialog.h.
Signals | |
void | dialogClosed () |
Public Member Functions | |
SaveDialog (QString actionMessage, QString defaultPath, QString defaultTheme, QWidget *parent=0, const char *name=0) | |
QString | getTheme () |
QString | getPath () |
Static Public Member Functions | |
bool | selectThemeAndPath (QString titleMessage, QString defaultPath, QString &theme, QString &path) |
bool | themeAvailable (QString theme) |
Private Slots | |
void | updatePreview () |
void | save () |
void | cancel () |
void | prevScreenShot () |
void | nextScreenShot () |
void | browse () |
Private Attributes | |
QFrame * | locationFrame |
QFrame * | themeSelectionFrame |
QFrame * | themePreviewFrame |
QFrame * | buttonsFrame |
QGridLayout * | locationGrid |
QGridLayout * | themeSelectionGrid |
QGridLayout * | themePreviewGrid |
QGridLayout * | mainGrid |
QGridLayout * | buttonsGrid |
QLabel * | locationLabel |
QLabel * | themeScreenShot |
QLabel * | themePreviewLabel |
QLabel * | themesLabel |
QLabel * | screenShotLabel |
QLineEdit * | locationVal |
QListBox * | themesList |
QTextBrowser * | themeFeatures |
QPushButton * | saveButton |
QPushButton * | cancelButton |
QPushButton * | themeScreenPrev |
QPushButton * | themeScreenNext |
QPushButton * | browseButton |
int | previewNum |
int | numPreviews |
|
Definition at line 30 of file saveDialog.cpp. References browse(), browseButton, buttonsFrame, buttonsGrid, cancel(), cancelButton, IMAGE_PATH, locationFrame, locationGrid, locationLabel, locationVal, mainGrid, nextScreenShot(), prevScreenShot(), save(), saveButton, screenShotLabel, themeFeatures, themePreviewFrame, themePreviewGrid, themePreviewLabel, THEMES_PATH, themeScreenNext, themeScreenPrev, themeScreenShot, themeSelectionFrame, themeSelectionGrid, themesLabel, themesList, updatePreview(), and WIDGET_SPACING. Referenced by selectThemeAndPath(). 00034 : 00035 QDialog(parent,name) 00036 { 00037 //set window title 00038 setCaption( actionMessage ); 00039 00040 //set the background of the widget to be white 00041 // setPaletteBackgroundColor( QColor(255, 255, 255) ); 00042 00043 QFont textFont( "Times", 12, QFont::Bold ); 00044 00045 //create location frame and widgets 00046 locationFrame = new QFrame( this ); 00047 locationLabel = new QLabel( tr("Save to:"), locationFrame ); 00048 locationLabel->setFont( textFont ); 00049 locationVal = new QLineEdit( locationFrame ); 00050 locationVal->setText( defaultPath ); 00051 locationVal->setFont( textFont ); 00052 browseButton = new QPushButton( locationFrame ); 00053 browseButton->setPixmap( QPixmap(QString(IMAGE_PATH)+"buttonIcons/browse.png") ); 00054 browseButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00055 QToolTip::add( browseButton, tr("Browse to save destination") ); 00056 connect( browseButton, SIGNAL(clicked()), SLOT(browse()) ); 00057 locationGrid = new QGridLayout( locationFrame, 1, 3, 0 ); 00058 locationGrid->addWidget( locationLabel, 0, 0 ); 00059 locationGrid->addWidget( locationVal, 0, 1 ); 00060 locationGrid->addWidget( browseButton, 0, 2); 00061 locationGrid->setColStretch( 1, 1 ); 00062 locationGrid->setSpacing(WIDGET_SPACING); 00063 00064 //create theme selection frame and widgets 00065 themeSelectionFrame = new QFrame( this ); 00066 themesLabel = new QLabel( tr("Themes:"), themeSelectionFrame ); 00067 themesLabel->setFont( textFont ); 00068 themesList = new QListBox( themeSelectionFrame ); 00069 QToolTip::add( themesList, tr("Select theme for saving album") ); 00070 QDir localDir( THEMES_PATH ); 00071 QStringList list = localDir.entryList( QDir::Dirs ); 00072 bool itemsAdded = false; 00073 QStringList::Iterator file; 00074 for ( file = list.begin(); file != list.end(); ++file ) 00075 { 00076 if(localDir.exists( QString(*file) + "/theme.xsl" )) 00077 { 00078 themesList->insertItem( *file ); 00079 itemsAdded = true; 00080 } 00081 } 00082 00083 //attempt to select default theme passed in, if not found select first theme in list 00084 bool themeFound = false; 00085 uint i=0; 00086 for(i=0; i<themesList->count(); i++) 00087 { 00088 if(themesList->text(i) == defaultTheme ) 00089 { 00090 themeFound = true; 00091 themesList->setCurrentItem( i ); 00092 break; 00093 } 00094 } 00095 if(!themeFound && itemsAdded ) 00096 { 00097 themesList->setCurrentItem( 0 ); 00098 } 00099 00100 connect( themesList, SIGNAL( highlighted(int) ), this, SLOT( updatePreview() ) ); 00101 00102 themeSelectionGrid = new QGridLayout( themeSelectionFrame, 2, 1, 0 ); 00103 themeSelectionGrid->addWidget( themesLabel, 0, 0 ); 00104 themeSelectionGrid->addWidget( themesList, 1, 0 ); 00105 00106 //create theme preview frame and widgets 00107 themePreviewFrame = new QFrame( this ); 00108 themePreviewLabel = new QLabel( tr("Theme Preview:"), themePreviewFrame ); 00109 themePreviewLabel->setFont( textFont ); 00110 themeScreenShot = new QLabel( themePreviewFrame ); 00111 screenShotLabel = new QLabel( themePreviewFrame ); 00112 screenShotLabel->setFont( textFont ); 00113 themeScreenPrev = new QPushButton( themePreviewFrame ); 00114 themeScreenPrev->setPixmap( QPixmap(QString(IMAGE_PATH)+"buttonIcons/previous.png") ); 00115 themeScreenPrev->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00116 QToolTip::add( themeScreenPrev, tr("View previous theme screenshot") ); 00117 connect( themeScreenPrev, SIGNAL(clicked()), SLOT(prevScreenShot()) ); 00118 themeScreenNext = new QPushButton( themePreviewFrame ); 00119 themeScreenNext->setPixmap( QPixmap(QString(IMAGE_PATH)+"buttonIcons/next.png") ); 00120 themeScreenNext->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00121 QToolTip::add( themeScreenNext, tr("View next theme screenshot") ); 00122 connect( themeScreenNext, SIGNAL(clicked()), SLOT(nextScreenShot()) ); 00123 themeFeatures = new QTextBrowser( themePreviewFrame ); 00124 themeFeatures->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 00125 themeFeatures->mimeSourceFactory()->setFilePath( QStringList(THEMES_PATH) ); 00126 updatePreview(); 00127 00128 themePreviewGrid = new QGridLayout( themePreviewFrame, 5, 5, 0); 00129 themePreviewGrid->addWidget( themePreviewLabel, 0, 0 ); 00130 themePreviewGrid->addMultiCellWidget( themeScreenShot, 1, 1, 0, 4 ); 00131 themePreviewGrid->addMultiCellWidget( screenShotLabel, 2, 2, 0, 4, Qt::AlignCenter ); 00132 themePreviewGrid->setColStretch( 0, 1 ); 00133 themePreviewGrid->addWidget( themeScreenPrev, 3, 1 ); 00134 themePreviewGrid->addColSpacing( 2, 10 ); 00135 themePreviewGrid->addWidget( themeScreenNext, 3, 3 ); 00136 themePreviewGrid->setColStretch( 4, 1 ); 00137 themePreviewGrid->addMultiCellWidget( themeFeatures, 4, 4, 0, 4 ); 00138 00139 //create buttons frame and widgets 00140 buttonsFrame = new QFrame( this ); 00141 saveButton = new QPushButton( 00142 //PLATFORM_SPECIFIC_CODE 00143 #ifndef Q_OS_MACX 00144 QPixmap(QString(IMAGE_PATH)+"buttonIcons/save.png"), 00145 #endif 00146 tr("Save"), buttonsFrame ); 00147 saveButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00148 saveButton->setDefault(true); 00149 connect( saveButton, SIGNAL(clicked()), SLOT(save()) ); 00150 cancelButton = new QPushButton( 00151 //PLATFORM_SPECIFIC_CODE 00152 #ifndef Q_OS_MACX 00153 QPixmap(QString(IMAGE_PATH)+"buttonIcons/button_cancel.png"), 00154 #endif 00155 tr("Cancel"), buttonsFrame 00156 ); 00157 cancelButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00158 connect( cancelButton, SIGNAL(clicked()), SLOT(cancel()) ); 00159 buttonsGrid = new QGridLayout( buttonsFrame, 1, 5, 0 ); 00160 buttonsGrid->setColStretch( 0, 1 ); 00161 buttonsGrid->addWidget( saveButton, 0, 1 ); 00162 buttonsGrid->addColSpacing( 2, 10 ); 00163 buttonsGrid->addWidget( cancelButton, 0, 3 ); 00164 buttonsGrid->setColStretch( 4, 1 ); 00165 00166 //place top level frames in grid 00167 mainGrid = new QGridLayout( this, 3, 2, 0); 00168 mainGrid->addWidget( themeSelectionFrame, 0, 0 ); 00169 mainGrid->addWidget( themePreviewFrame, 0, 1 ); 00170 mainGrid->addMultiCellWidget( locationFrame, 1, 1, 0, 1 ); 00171 mainGrid->addMultiCellWidget( buttonsFrame, 2, 2, 0, 1 ); 00172 00173 //allow image and description region of select theme to expand to fit window 00174 mainGrid->setColStretch( 1, 1 ); 00175 mainGrid->setRowStretch( 1, 1 ); 00176 mainGrid->setMargin(WIDGET_SPACING); 00177 mainGrid->setSpacing(WIDGET_SPACING); 00178 00179 //set window to not be resizeable 00180 this->show(); 00181 setFixedSize(size()); 00182 } //==============================================
|
|
Definition at line 259 of file saveDialog.cpp. References locationVal. Referenced by SaveDialog(). 00260 { 00261 //get directory from user 00262 QString dirName = QFileDialog::getSaveFileName( locationVal->text(), 00263 NULL, this, NULL, "Save as" ); 00264 00265 if(!dirName.isNull()) 00266 locationVal->setText( dirName ); 00267 }
|
|
Definition at line 228 of file saveDialog.cpp. Referenced by SaveDialog(). 00229 { 00230 reject(); 00231 }
|
|
|
|
Definition at line 274 of file saveDialog.cpp. References locationVal. Referenced by selectThemeAndPath(). 00275 { 00276 return locationVal->text(); 00277 }
|
|
Definition at line 269 of file saveDialog.cpp. References themesList. Referenced by selectThemeAndPath(). 00270 { 00271 return themesList->currentText(); 00272 }
|
|
Definition at line 246 of file saveDialog.cpp. References numPreviews, previewNum, screenShotLabel, THEMES_PATH, themeScreenNext, themeScreenPrev, themeScreenShot, and themesList. Referenced by SaveDialog(). 00247 { 00248 previewNum++; 00249 themeScreenPrev->setEnabled(true); 00250 if(previewNum == numPreviews) 00251 { 00252 themeScreenNext->setEnabled(false); 00253 } 00254 00255 screenShotLabel->setText( QString( tr("Screenshot") ) + QString( " %1/%2").arg(previewNum).arg(numPreviews) ); 00256 themeScreenShot->setPixmap( QPixmap( QString(THEMES_PATH + themesList->currentText() + "/preview%1.png").arg(previewNum) ) ); 00257 }
|
|
Definition at line 233 of file saveDialog.cpp. References numPreviews, previewNum, screenShotLabel, THEMES_PATH, themeScreenNext, themeScreenPrev, themeScreenShot, and themesList. Referenced by SaveDialog(). 00234 { 00235 previewNum--; 00236 themeScreenNext->setEnabled(true); 00237 if(previewNum == 1) 00238 { 00239 themeScreenPrev->setEnabled(false); 00240 } 00241 00242 screenShotLabel->setText( QString( tr("Screenshot") ) + QString( " %1/%2").arg(previewNum).arg(numPreviews) ); 00243 themeScreenShot->setPixmap( QPixmap( QString(THEMES_PATH + themesList->currentText() + "/preview%1.png").arg(previewNum) ) ); 00244 }
|
|
Definition at line 223 of file saveDialog.cpp. Referenced by SaveDialog(). 00224 { 00225 accept(); 00226 }
|
|
Definition at line 279 of file saveDialog.cpp. References getPath(), getTheme(), and SaveDialog(). Referenced by TitleWidget::saveAsAlbum(). 00283 { 00284 SaveDialog* dlg = new SaveDialog( titleMessage, defaultPath, theme ); 00285 if( dlg->exec() == QDialog::Accepted ) 00286 { 00287 theme = dlg->getTheme(); 00288 path = dlg->getPath(); 00289 delete dlg; 00290 return true; 00291 } 00292 else 00293 { 00294 delete dlg; 00295 return false; 00296 } 00297 }
|
|
Definition at line 299 of file saveDialog.cpp. References THEMES_PATH. Referenced by TitleWidget::exportSmallWebGallery(), and TitleWidget::saveAlbum(). 00300 { 00301 //walk through the themes directory searching 00302 //for a directory with the name of the theme 00303 //that also has a theme.xsl file inside it 00304 QDir localDir( THEMES_PATH ); 00305 QStringList list = localDir.entryList( QDir::Dirs ); 00306 QStringList::Iterator file; 00307 for ( file = list.begin(); file != list.end(); ++file ) 00308 { 00309 if(localDir.exists( QString(*file) + "/theme.xsl") && 00310 QString(*file) == theme) 00311 return true; 00312 } 00313 //theme not found 00314 return false; 00315 }
|
|
Definition at line 184 of file saveDialog.cpp. References IMAGE_PATH, numPreviews, previewNum, screenShotLabel, themeFeatures, THEMES_PATH, themeScreenNext, themeScreenPrev, themeScreenShot, and themesList. Referenced by SaveDialog(). 00185 { 00186 previewNum = 1; 00187 int i=1; 00188 QDir localDir( THEMES_PATH ); 00189 while( localDir.exists( QString( themesList->currentText() + "/preview%1.png").arg(i) ) ) 00190 { 00191 i++; 00192 } 00193 numPreviews = i-1; 00194 00195 //update theme description if provided 00196 if(localDir.exists( themesList->currentText() + "/description.html" )) 00197 { 00198 themeFeatures->setSource( themesList->currentText() + "/description.html" ); 00199 } 00200 00201 //update preview image to provide one or default otherwise 00202 if(localDir.exists( themesList->currentText() + "/preview1.png") ) 00203 { 00204 screenShotLabel->setText( QString( tr("Screenshot") ) + QString( " %1/%2").arg(previewNum).arg(numPreviews) ); 00205 themeScreenShot->setPixmap( QPixmap(THEMES_PATH + themesList->currentText() + "/preview1.png") ); 00206 themeScreenPrev->setEnabled(false); 00207 00208 if(previewNum == numPreviews) 00209 themeScreenNext->setEnabled(false); 00210 else 00211 themeScreenNext->setEnabled(true); 00212 } 00213 else 00214 { 00215 screenShotLabel->setText( "" ); 00216 themeScreenShot->setPixmap( QPixmap(QString(IMAGE_PATH)+"miscImages/themePreview.png") ); 00217 themeScreenPrev->setEnabled(false); 00218 themeScreenNext->setEnabled(false); 00219 } 00220 00221 }
|
|
Definition at line 66 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 60 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 61 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 66 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 60 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 61 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 62 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 63 of file saveDialog.h. Referenced by browse(), getPath(), and SaveDialog(). |
|
Definition at line 61 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 68 of file saveDialog.h. Referenced by nextScreenShot(), prevScreenShot(), and updatePreview(). |
|
Definition at line 67 of file saveDialog.h. Referenced by nextScreenShot(), prevScreenShot(), and updatePreview(). |
|
Definition at line 66 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 62 of file saveDialog.h. Referenced by nextScreenShot(), prevScreenShot(), SaveDialog(), and updatePreview(). |
|
Definition at line 65 of file saveDialog.h. Referenced by SaveDialog(), and updatePreview(). |
|
Definition at line 60 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 61 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 62 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 66 of file saveDialog.h. Referenced by nextScreenShot(), prevScreenShot(), SaveDialog(), and updatePreview(). |
|
Definition at line 66 of file saveDialog.h. Referenced by nextScreenShot(), prevScreenShot(), SaveDialog(), and updatePreview(). |
|
Definition at line 62 of file saveDialog.h. Referenced by nextScreenShot(), prevScreenShot(), SaveDialog(), and updatePreview(). |
|
Definition at line 60 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 61 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 62 of file saveDialog.h. Referenced by SaveDialog(). |
|
Definition at line 64 of file saveDialog.h. Referenced by getTheme(), nextScreenShot(), prevScreenShot(), SaveDialog(), and updatePreview(). |