Create label based on new label dialog.

This commit is contained in:
Jim Evins
2015-08-11 10:50:24 -04:00
parent ca345cdede
commit 9bebf921b2
3 changed files with 45 additions and 7 deletions
+19
View File
@@ -38,6 +38,25 @@ namespace glabels
{
NewLabelDialog newDialog( window );
newDialog.exec();
const libglabels::Template* tmplate = newDialog.tmplate();
if ( tmplate )
{
LabelModel* label = new LabelModel();
label->setTmplate( tmplate );
label->setRotate( newDialog.rotate() );
if ( window->isEmpty() )
{
window->setModel( label );
}
else
{
MainWindow *newWindow = new MainWindow();
newWindow->setModel( label );
newWindow->show();
}
}
}
+19 -7
View File
@@ -36,7 +36,8 @@ namespace glabels
{
setupUi( this );
// TODO: Set default based on locale
// TODO: Set default based on locale and/or saved preferences
// Perhaps move to checkboxes
pageSizeIsoRadio->setChecked( true );
QList<libglabels::Template*> tmplates = libglabels::Db::templates();
@@ -68,8 +69,25 @@ namespace glabels
connect( createButton, SIGNAL(clicked()), this, SLOT(createButtonClicked()) );
}
///
/// Get selected template
///
const libglabels::Template* NewLabelDialog::tmplate() const
{
return templatePicker->selectedTemplate();
}
///
/// Get rotation selection
///
bool NewLabelDialog::rotate() const
{
return orientationRotatedRadio->isChecked();
}
///
/// Search Entry Text Changed Slot
///
void NewLabelDialog::searchEntryTextChanged( const QString &text )
@@ -193,12 +211,6 @@ namespace glabels
///
void NewLabelDialog::createButtonClicked()
{
const libglabels::Template *tmplate = templatePicker->selectedTemplate();
std::cout << "TODO: create new label, template = '" << qPrintable(tmplate->name())
<< "', rotate = " << orientationRotatedRadio->isChecked()
<< std::endl;
close();
}
+7
View File
@@ -42,6 +42,13 @@ namespace glabels
NewLabelDialog( QWidget *parent );
/////////////////////////////////
// Accessors
/////////////////////////////////
const libglabels::Template* tmplate() const;
bool rotate() const;
/////////////////////////////////
// Slots
/////////////////////////////////