dialog_->reverseCB->setChecked(pp.reverse_order);
- QRadioButton * button;
- switch (pp.which_pages) {
- case PrinterParams::ALL: button = dialog_->allRB; break;
- case PrinterParams::ODD: button = dialog_->oddRB; break;
- case PrinterParams::EVEN: button = dialog_->evenRB; break;
- }
- button->setChecked(true);
-
- // hmmm... maybe a bit weird but maybe not
- // we might just be remembering the last
- // time this was printed.
- if (!pp.from_page.empty()) {
- dialog_->fromED->setText(pp.from_page.c_str());
-
- dialog_->toED->setText("");
- if (pp.to_page)
- dialog_->toED->setText(tostr(pp.to_page).c_str());
- } else {
- dialog_->fromED->setText("");
- dialog_->toED->setText("");
+ dialog_->copiesSB->setValue(pp.count_copies);
+
+ dialog_->oddCB->setChecked(pp.odd_pages);
+ dialog_->evenCB->setChecked(pp.even_pages);
+
+ if (pp.all_pages) {
+ dialog_->allRB->setChecked(true);
+ return;
}
- dialog_->copiesSB->setValue(pp.count_copies);
+ dialog_->rangeRB->setChecked(true);
+
+ QString s;
+ s.setNum(pp.from_page);
+ dialog_->fromED->setText(s);
+ s.setNum(pp.to_page);
+ dialog_->toED->setText(s);
}
void QPrint::apply()
{
- PrinterParams::WhichPages wp;
-
- if (dialog_->allRB->isChecked())
- wp = PrinterParams::ALL;
- else if (dialog_->oddRB->isChecked())
- wp = PrinterParams::ODD;
- else
- wp = PrinterParams::EVEN;
-
- string from;
- int to(0);
- if (!dialog_->fromED->text().isEmpty()) {
- // we have at least one page requested
- from = dialog_->fromED->text().latin1();
- if (!dialog_->toED->text().isEmpty())
- to = strToInt(dialog_->toED->text().latin1());
- }
-
PrinterParams::Target t = PrinterParams::PRINTER;
if (dialog_->fileRB->isChecked())
t = PrinterParams::FILE;
PrinterParams const pp(t,
dialog_->printerED->text().latin1(),
dialog_->fileED->text().latin1(),
- wp, from, to,
- dialog_->reverseCB->isChecked(),
- !dialog_->collateCB->isChecked(),
- strToInt(dialog_->copiesSB->text().latin1()));
+ dialog_->allRB->isChecked(),
+ dialog_->fromED->text().toUInt(),
+ dialog_->toED->text().toUInt(),
+ dialog_->oddCB->isChecked(),
+ dialog_->evenCB->isChecked(),
+ dialog_->copiesSB->text().toUInt(),
+ dialog_->collateCB->isChecked(),
+ dialog_->reverseCB->isChecked());
controller().params() = pp;
}
<rect>
<x>0</x>
<y>0</y>
- <width>327</width>
- <height>342</height>
+ <width>225</width>
+ <height>395</height>
</rect>
</property>
<property stdset="1">
</property>
<property stdset="1">
<name>spacing</name>
- <number>3</number>
+ <number>6</number>
</property>
- <widget row="0" column="0" >
- <class>QRadioButton</class>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>printerRB</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>P&rinter</string>
+ <cstring>fileED</cstring>
</property>
<property stdset="1">
- <name>checked</name>
+ <name>enabled</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
- <string>Send output to the printer</string>
+ <string>Send output to a file</string>
</property>
</widget>
- <widget row="1" column="0" >
+ <widget row="2" column="1" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>browsePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Browse ...</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer15</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget row="0" column="0" >
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
- <cstring>fileRB</cstring>
+ <cstring>printerRB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>&File</string>
+ <string>P&rinter</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
</property>
<property>
<name>toolTip</name>
- <string>Send output to a file</string>
+ <string>Send output to the printer</string>
</property>
</widget>
<widget row="0" column="1" >
<string>Send output to the given printer</string>
</property>
</widget>
- <widget row="1" column="1" >
- <class>QLineEdit</class>
+ <widget row="1" column="0" >
+ <class>QRadioButton</class>
<property stdset="1">
<name>name</name>
- <cstring>fileED</cstring>
+ <cstring>fileRB</cstring>
</property>
<property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
+ <name>text</name>
+ <string>&File</string>
</property>
<property>
<name>toolTip</name>
<string>Send output to a file</string>
</property>
</widget>
- <widget row="1" column="2" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>browsePB</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&Browse ...</string>
- </property>
- </widget>
</grid>
</widget>
<widget>
<property>
<name>layoutSpacing</name>
</property>
- <grid>
+ <vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
<name>spacing</name>
<number>6</number>
</property>
- <widget row="0" column="0" >
- <class>QRadioButton</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>allRB</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&All</string>
- </property>
- <property stdset="1">
- <name>checked</name>
- <bool>true</bool>
- </property>
- <property>
- <name>toolTip</name>
- <string>Print all pages</string>
- </property>
+ <cstring>Layout3</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="1" column="1" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fromED</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Page number to print from</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>toLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&to</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>toED</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>toED</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Page number to print to</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rangeRB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Fro&m</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Print all pages</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>allRB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&All</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Print all pages</string>
+ </property>
+ </widget>
+ </grid>
</widget>
- <widget row="1" column="0" >
- <class>QRadioButton</class>
+ <widget>
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>oddRB</cstring>
+ <cstring>oddCB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>&Odd</string>
- </property>
- <property>
- <name>toolTip</name>
- <string>Print odd pages only</string>
- </property>
- </widget>
- <widget row="2" column="0" >
- <class>QRadioButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>evenRB</cstring>
+ <string>Print &odd-numbered pages</string>
</property>
<property stdset="1">
- <name>text</name>
- <string>&Even</string>
- </property>
- <property>
- <name>toolTip</name>
- <string>Print even pages only</string>
+ <name>checked</name>
+ <bool>true</bool>
</property>
</widget>
- <widget row="3" column="2" >
- <class>QLabel</class>
+ <widget>
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>toPageL</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
+ <cstring>evenCB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>&Last page:</string>
- </property>
- <property>
- <name>buddy</name>
- <cstring>toED</cstring>
- </property>
- </widget>
- <widget row="4" column="2" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>toED</cstring>
+ <string>Print &even-numbered pages</string>
</property>
<property stdset="1">
- <name>enabled</name>
+ <name>checked</name>
<bool>true</bool>
</property>
- <property>
- <name>toolTip</name>
- <string>Page number to print to</string>
- </property>
</widget>
- <widget row="0" column="2" >
+ <widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<string>Print in reverse order</string>
</property>
</widget>
- <widget row="4" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>fromED</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property>
- <name>toolTip</name>
- <string>Page number to print from</string>
- </property>
- </widget>
- <widget row="4" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>rangeLA</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Ran&ge</string>
- </property>
- <property>
- <name>buddy</name>
- <cstring>fromED</cstring>
- </property>
- <property>
- <name>toolTip</name>
- <string>Set a range of pages to print</string>
- </property>
- </widget>
- <widget row="3" column="1" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>fromPageL</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&Starting range:</string>
- </property>
- <property>
- <name>buddy</name>
- <cstring>fromED</cstring>
- </property>
- </widget>
- </grid>
+ </vbox>
</widget>
<widget>
<class>QGroupBox</class>
<receiver>QPrintDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
- <connection>
- <sender>oddRB</sender>
- <signal>toggled(bool)</signal>
- <receiver>QPrintDialogBase</receiver>
- <slot>change_adaptor()</slot>
- </connection>
- <connection>
- <sender>evenRB</sender>
- <signal>toggled(bool)</signal>
- <receiver>QPrintDialogBase</receiver>
- <slot>change_adaptor()</slot>
- </connection>
<connection>
<sender>reverseCB</sender>
<signal>toggled(bool)</signal>
<receiver>QPrintDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
+ <connection>
+ <sender>rangeRB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>fromED</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>rangeRB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>toED</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
<slot access="protected">browseClicked()</slot>
<slot access="public">change_adaptor()</slot>
<slot access="public">copiesChanged(int)</slot>
<tabstop>fileED</tabstop>
<tabstop>browsePB</tabstop>
<tabstop>allRB</tabstop>
- <tabstop>oddRB</tabstop>
- <tabstop>evenRB</tabstop>
<tabstop>fromED</tabstop>
<tabstop>toED</tabstop>
<tabstop>reverseCB</tabstop>