Hooked up print view controls.
This commit is contained in:
@@ -163,6 +163,7 @@ namespace glabels
|
||||
|
||||
printCropMarks( painter );
|
||||
|
||||
qDebug() << "ipage = " << iPage << ", iStart = " << iStart << ", iEnd = " << iEnd;
|
||||
for ( int i = iStart; i < iEnd; i++ )
|
||||
{
|
||||
painter->save();
|
||||
|
||||
+65
-6
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "LabelModel.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
@@ -30,7 +32,7 @@ namespace glabels
|
||||
/// Constructor
|
||||
///
|
||||
PrintView::PrintView( QWidget *parent )
|
||||
: QWidget(parent)
|
||||
: QWidget(parent), mModel(0), mBlocked(false)
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
@@ -43,15 +45,19 @@ namespace glabels
|
||||
///
|
||||
void PrintView::setModel( LabelModel* model )
|
||||
{
|
||||
mModel = model;
|
||||
mRenderer.setModel( model );
|
||||
mRenderer.setNLabels( model->frame()->nLabels() );
|
||||
int nLabelsPerPage = model->frame()->nLabels();
|
||||
|
||||
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()) );
|
||||
|
||||
onLabelSizeChanged();
|
||||
onLabelChanged();
|
||||
onFormChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -72,5 +78,58 @@ namespace glabels
|
||||
{
|
||||
preview->update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// Form changed handler
|
||||
///
|
||||
void PrintView::onFormChanged()
|
||||
{
|
||||
if ( !mBlocked )
|
||||
{
|
||||
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.setNLabels( copiesSheetsSpin->value()*nLabelsPerPage );
|
||||
mRenderer.setStartLabel( 0 );
|
||||
copiesFromSpin->setValue( 1 );
|
||||
copiesToSpin->setValue( nLabelsPerPage );
|
||||
}
|
||||
else
|
||||
{
|
||||
mRenderer.setNLabels( copiesToSpin->value() - copiesFromSpin->value() + 1 );
|
||||
mRenderer.setStartLabel( copiesFromSpin->value() - 1 );
|
||||
copiesSheetsSpin->setValue( 1 );
|
||||
}
|
||||
|
||||
mRenderer.setPrintOutlines( printOutlinesCheck->isChecked() );
|
||||
mRenderer.setPrintCropMarks( printCropMarksCheck->isChecked() );
|
||||
mRenderer.setPrintReverse( printReverseCheck->isChecked() );
|
||||
|
||||
pageSpin->setRange( 1, mRenderer.nPages() );
|
||||
nPagesLabel->setText( QString::number( mRenderer.nPages() ) );
|
||||
|
||||
mRenderer.setIPage( pageSpin->value() - 1 );
|
||||
|
||||
preview->update();
|
||||
|
||||
mBlocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Print Button Clicked handler
|
||||
///
|
||||
void PrintView::onPrintButtonClicked()
|
||||
{
|
||||
qDebug() << "Print!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-1
@@ -57,15 +57,19 @@ namespace glabels
|
||||
private slots:
|
||||
void onLabelChanged();
|
||||
void onLabelSizeChanged();
|
||||
void onFormChanged();
|
||||
void onPrintButtonClicked();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
LabelModel* mModel;
|
||||
LabelModel* mModel;
|
||||
PageRenderer mRenderer;
|
||||
|
||||
bool mBlocked;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+268
-7
@@ -203,14 +203,21 @@
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="copiesLabelsCombo">
|
||||
<widget class="QRadioButton" name="copiesLabelsRadio">
|
||||
<property name="text">
|
||||
<string>Labels from:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="copiesFromSpin"/>
|
||||
<widget class="QSpinBox" name="copiesFromSpin">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
@@ -220,7 +227,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="copiesToSpin"/>
|
||||
<widget class="QSpinBox" name="copiesToSpin">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -231,10 +245,17 @@
|
||||
<property name="text">
|
||||
<string>Sheets:</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="copiesSheetsSpin"/>
|
||||
<widget class="QSpinBox" name="copiesSheetsSpin">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
@@ -301,7 +322,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="mergeStartSpin"/>
|
||||
<widget class="QSpinBox" name="mergeStartSpin">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
@@ -335,7 +360,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="mergeCopiesSpin"/>
|
||||
<widget class="QSpinBox" name="mergeCopiesSpin">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>96</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
@@ -468,5 +500,234 @@
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>printButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onPrintButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>45</x>
|
||||
<y>56</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>4</x>
|
||||
<y>50</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>copiesSheetsRadio</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>copiesSheetsSpin</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>114</x>
|
||||
<y>199</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>141</x>
|
||||
<y>205</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>copiesLabelsRadio</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>copiesFromSpin</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>68</x>
|
||||
<y>239</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>172</x>
|
||||
<y>236</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>copiesLabelsRadio</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>copiesToSpin</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>143</x>
|
||||
<y>239</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>266</x>
|
||||
<y>236</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>copiesSheetsSpin</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>159</x>
|
||||
<y>194</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>8</x>
|
||||
<y>184</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>copiesFromSpin</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>186</x>
|
||||
<y>243</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>3</x>
|
||||
<y>236</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>copiesToSpin</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>282</x>
|
||||
<y>241</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>4</x>
|
||||
<y>268</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>mergeStartSpin</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>170</x>
|
||||
<y>317</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>4</x>
|
||||
<y>309</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>mergeCopiesSpin</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>126</x>
|
||||
<y>347</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>2</x>
|
||||
<y>341</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>printOutlinesCheck</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>87</x>
|
||||
<y>407</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>2</x>
|
||||
<y>409</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>printCropMarksCheck</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>57</x>
|
||||
<y>436</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>6</x>
|
||||
<y>445</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>printReverseCheck</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>61</x>
|
||||
<y>466</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>6</x>
|
||||
<y>485</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pageSpin</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>569</x>
|
||||
<y>536</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1</x>
|
||||
<y>532</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>copiesSheetsRadio</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>PrintView</receiver>
|
||||
<slot>onFormChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>55</x>
|
||||
<y>207</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>3</x>
|
||||
<y>213</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onPrintButtonClicked()</slot>
|
||||
<slot>onFormChanged()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user