diff --git a/glabels/PageRenderer.cpp b/glabels/PageRenderer.cpp index d1e0f41..63722f3 100644 --- a/glabels/PageRenderer.cpp +++ b/glabels/PageRenderer.cpp @@ -95,6 +95,12 @@ void PageRenderer::setIPage( int iPage ) } +int PageRenderer::nItems() const +{ + return mLastLabel - mStartLabel; +} + + int PageRenderer::nPages() const { return mNPages; diff --git a/glabels/PageRenderer.h b/glabels/PageRenderer.h index 30a946d..ee6fc55 100644 --- a/glabels/PageRenderer.h +++ b/glabels/PageRenderer.h @@ -57,6 +57,7 @@ public: void setPrintCropMarks( bool printCropMarksFlag ); void setPrintReverse( bool printReverseFlag ); void setIPage( int iPage ); + int nItems() const; int nPages() const; QRectF pageRect() const; void printPage( QPainter* painter ) const; diff --git a/glabels/PrintView.cpp b/glabels/PrintView.cpp index a27c172..1c7af1d 100644 --- a/glabels/PrintView.cpp +++ b/glabels/PrintView.cpp @@ -55,10 +55,6 @@ void PrintView::setModel( LabelModel* model ) { mModel = model; - // TODO set visibility based on merge selection - copiesBox->setVisible( true ); - mergeBox->setVisible( false ); - connect( mModel, SIGNAL(sizeChanged()), this, SLOT(onLabelSizeChanged()) ); connect( mModel, SIGNAL(changed()), this, SLOT(onLabelChanged()) ); @@ -72,16 +68,7 @@ void PrintView::setModel( LabelModel* model ) /// void PrintView::onLabelSizeChanged() { - int nLabelsPerPage = mModel->frame()->nLabels(); - copiesFromSpin->setRange( 1, nLabelsPerPage ); - copiesToSpin->setRange( copiesFromSpin->value(), nLabelsPerPage ); - if ( copiesSheetsRadio->isChecked() ) - { - mRenderer.setNCopies( copiesSheetsSpin->value()*nLabelsPerPage ); - mRenderer.setStartLabel( 0 ); - copiesFromSpin->setValue( 1 ); - copiesToSpin->setValue( nLabelsPerPage ); - } + copiesStartSpin->setRange( 1, mModel->frame()->nLabels() ); preview->setModel( mModel ); mRenderer.setModel( mModel ); @@ -106,24 +93,10 @@ void PrintView::onFormChanged() { mBlocked = true; - int nLabelsPerPage = mModel->frame()->nLabels(); - copiesFromSpin->setRange( 1, nLabelsPerPage ); - copiesToSpin->setRange( copiesFromSpin->value(), nLabelsPerPage ); - - // TODO select between simple and merge - if ( copiesSheetsRadio->isChecked() ) - { - mRenderer.setNCopies( copiesSheetsSpin->value()*nLabelsPerPage ); - mRenderer.setStartLabel( 0 ); - copiesFromSpin->setValue( 1 ); - copiesToSpin->setValue( nLabelsPerPage ); - } - else - { - mRenderer.setNCopies( copiesToSpin->value() - copiesFromSpin->value() + 1 ); - mRenderer.setStartLabel( copiesFromSpin->value() - 1 ); - copiesSheetsSpin->setValue( 1 ); - } + mRenderer.setNCopies( copiesSpin->value() ); + mRenderer.setStartLabel( copiesStartSpin->value() - 1 ); + copiesDescriptionLabel->setText( tr("(Will print a total of %1 items on %2 pages.)") + .arg(mRenderer.nItems()).arg(mRenderer.nPages()) ); mRenderer.setPrintOutlines( printOutlinesCheck->isChecked() ); mRenderer.setPrintCropMarks( printCropMarksCheck->isChecked() ); diff --git a/glabels/ui/PrintView.ui b/glabels/ui/PrintView.ui index c4f82fe..0d4a764 100644 --- a/glabels/ui/PrintView.ui +++ b/glabels/ui/PrintView.ui @@ -131,172 +131,7 @@ Copies - - - - - - - - 0 - 0 - - - - Labels from: - - - - - - - false - - - 1 - - - - - - - to: - - - - - - - false - - - 1 - - - - - - - - - - - Sheets: - - - true - - - - - - - 1 - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 40 - 20 - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 10 - 20 - - - - - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - 350 - 16777215 - - - - Merge options - - - - - - - Start on label: - - - - - - - 1 - - - - - - - on 1st sheet - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 40 - 20 - - - - - - @@ -307,7 +142,7 @@ - + 1 @@ -334,6 +169,54 @@ + + + + (Will print a total of xx items on nn pages.) + + + + + + + + + Start on position: + + + + + + + 1 + + + + + + + on 1st page + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 40 + 20 + + + + + + @@ -480,103 +363,7 @@ - copiesSheetsRadio - toggled(bool) - copiesSheetsSpin - setEnabled(bool) - - - 114 - 199 - - - 141 - 205 - - - - - copiesLabelsRadio - toggled(bool) - copiesFromSpin - setEnabled(bool) - - - 68 - 239 - - - 172 - 236 - - - - - copiesLabelsRadio - toggled(bool) - copiesToSpin - setEnabled(bool) - - - 143 - 239 - - - 266 - 236 - - - - - copiesSheetsSpin - valueChanged(int) - PrintView - onFormChanged() - - - 159 - 194 - - - 8 - 184 - - - - - copiesFromSpin - valueChanged(int) - PrintView - onFormChanged() - - - 186 - 243 - - - 3 - 236 - - - - - copiesToSpin - valueChanged(int) - PrintView - onFormChanged() - - - 282 - 241 - - - 4 - 268 - - - - - mergeStartSpin + copiesStartSpin valueChanged(int) PrintView onFormChanged() @@ -592,7 +379,7 @@ - mergeCopiesSpin + copiesSpin valueChanged(int) PrintView onFormChanged() @@ -671,22 +458,6 @@ - - copiesSheetsRadio - toggled(bool) - PrintView - onFormChanged() - - - 55 - 207 - - - 3 - 213 - - - onPrintButtonClicked()