Create label based on new label dialog.
This commit is contained in:
@@ -38,6 +38,25 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
NewLabelDialog newDialog( window );
|
NewLabelDialog newDialog( window );
|
||||||
newDialog.exec();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
setupUi( this );
|
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 );
|
pageSizeIsoRadio->setChecked( true );
|
||||||
|
|
||||||
QList<libglabels::Template*> tmplates = libglabels::Db::templates();
|
QList<libglabels::Template*> tmplates = libglabels::Db::templates();
|
||||||
@@ -68,8 +69,25 @@ namespace glabels
|
|||||||
connect( createButton, SIGNAL(clicked()), this, SLOT(createButtonClicked()) );
|
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
|
/// Search Entry Text Changed Slot
|
||||||
///
|
///
|
||||||
void NewLabelDialog::searchEntryTextChanged( const QString &text )
|
void NewLabelDialog::searchEntryTextChanged( const QString &text )
|
||||||
@@ -193,12 +211,6 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
void NewLabelDialog::createButtonClicked()
|
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();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ namespace glabels
|
|||||||
NewLabelDialog( QWidget *parent );
|
NewLabelDialog( QWidget *parent );
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// Accessors
|
||||||
|
/////////////////////////////////
|
||||||
|
const libglabels::Template* tmplate() const;
|
||||||
|
bool rotate() const;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Slots
|
// Slots
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user