Print: remove the height sliders from the PrintOptions class

These were hidden and we don't really support them because
our print layouting is not that flexible in Qt!

Note: printoptions.ui is now converted to UNIX line breaks.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2014-07-18 11:43:15 +03:00 committed by Dirk Hohndel
parent 3e669481f6
commit 6e4ebe3c54
3 changed files with 219 additions and 457 deletions

View file

@ -14,18 +14,7 @@ PrintOptions::PrintOptions(QWidget *parent, struct options *printOpt)
void PrintOptions::setup(struct options *printOpt) void PrintOptions::setup(struct options *printOpt)
{ {
/* these options are not supported ATM and we hide them.
* basically the entire PrintDialog class needs re-implementation, so that
* the paper size, DPI and all other options are displayed in one dialog.
* this way we can print directly or do an optional preview first.
*/
ui.sizingHeights->setVisible(false);
printOptions = printOpt; printOptions = printOpt;
// layout height sliders
initSliderWithLabel(ui.sliderPHeight, ui.valuePHeight, printOptions->profile_height);
initSliderWithLabel(ui.sliderOHeight, ui.valueOHeight, printOptions->notes_height);
initSliderWithLabel(ui.sliderNHeight, ui.valueNHeight, printOptions->tanks_height);
// print type radio buttons // print type radio buttons
switch (printOptions->type) { switch (printOptions->type) {
case options::PRETTY: case options::PRETTY:
@ -52,9 +41,6 @@ void PrintOptions::setup(struct options *printOpt)
// connect slots only once // connect slots only once
if (hasSetupSlots) if (hasSetupSlots)
return; return;
connect(ui.sliderPHeight, SIGNAL(sliderMoved(int)), this, SLOT(sliderPHeightMoved(int)));
connect(ui.sliderOHeight, SIGNAL(sliderMoved(int)), this, SLOT(sliderOHeightMoved(int)));
connect(ui.sliderNHeight, SIGNAL(sliderMoved(int)), this, SLOT(sliderNHeightMoved(int)));
connect(ui.radioSixDives, SIGNAL(clicked(bool)), this, SLOT(radioSixDivesClicked(bool))); connect(ui.radioSixDives, SIGNAL(clicked(bool)), this, SLOT(radioSixDivesClicked(bool)));
connect(ui.radioTwoDives, SIGNAL(clicked(bool)), this, SLOT(radioTwoDivesClicked(bool))); connect(ui.radioTwoDives, SIGNAL(clicked(bool)), this, SLOT(radioTwoDivesClicked(bool)));
@ -68,37 +54,6 @@ void PrintOptions::setup(struct options *printOpt)
hasSetupSlots = true; hasSetupSlots = true;
} }
// layout height sliders
void PrintOptions::initSliderWithLabel(QSlider *slider, QLabel *label, int value)
{
slider->setValue(value);
label->setText(formatSliderValueText(value));
}
QString PrintOptions::formatSliderValueText(int value)
{
QString str = QString("%1%").arg(QString::number(value));
return str;
}
void PrintOptions::sliderPHeightMoved(int value)
{
ui.valuePHeight->setText(formatSliderValueText(value));
printOptions->profile_height = value;
}
void PrintOptions::sliderOHeightMoved(int value)
{
ui.valueOHeight->setText(formatSliderValueText(value));
printOptions->notes_height = value;
}
void PrintOptions::sliderNHeightMoved(int value)
{
ui.valueNHeight->setText(formatSliderValueText(value));
printOptions->tanks_height = value;
}
// print type radio buttons // print type radio buttons
void PrintOptions::radioSixDivesClicked(bool check) void PrintOptions::radioSixDivesClicked(bool check)
{ {

View file

@ -15,17 +15,11 @@ public:
private: private:
Ui::PrintOptions ui; Ui::PrintOptions ui;
void setLabelFromSlider(QSlider *slider, QLabel *label);
void initSliderWithLabel(QSlider *slider, QLabel *label, int value);
QString formatSliderValueText(int value);
struct options *printOptions; struct options *printOptions;
bool hasSetupSlots; bool hasSetupSlots;
private private
slots: slots:
void sliderPHeightMoved(int value);
void sliderOHeightMoved(int value);
void sliderNHeightMoved(int value);
void radioSixDivesClicked(bool check); void radioSixDivesClicked(bool check);
void radioTwoDivesClicked(bool check); void radioTwoDivesClicked(bool check);
void radioTablePrintClicked(bool check); void radioTablePrintClicked(bool check);

View file

@ -1,408 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>PrintOptions</class> <class>PrintOptions</class>
<widget class="QWidget" name="PrintOptions"> <widget class="QWidget" name="PrintOptions">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>511</width> <width>511</width>
<height>448</height> <height>308</height>
</rect> </rect>
</property> </property>
<widget class="QGroupBox" name="printOptions"> <widget class="QGroupBox" name="printOptions">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>70</y> <y>70</y>
<width>489</width> <width>489</width>
<height>81</height>
</rect>
</property>
<property name="title">
<string>Print options</string>
</property>
<widget class="QCheckBox" name="printSelected">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>461</width>
<height>18</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Print only selected dives</string>
</property>
</widget>
<widget class="QCheckBox" name="printInColor">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>461</width>
<height>18</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Print in color</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="printType">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>489</width>
<height>51</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Print type</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget_2">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>491</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="layoutPrintType">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>15</number>
</property>
<property name="rightMargin">
<number>15</number>
</property>
<item>
<widget class="QRadioButton" name="radioSixDives">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>6 dives per page</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioTwoDives">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>2 dives per page</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioTablePrint">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Table print</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="ordering">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>489</width>
<height>81</height> <height>81</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
<string>Ordering</string> <string>Print options</string>
</property> </property>
<widget class="QRadioButton" name="profileOnTop"> <widget class="QCheckBox" name="printSelected">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>30</y> <y>30</y>
<width>461</width> <width>461</width>
<height>18</height> <height>18</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Profile on top</string> <string>Print only selected dives</string>
</property> </property>
<property name="checked"> </widget>
<bool>true</bool> <widget class="QCheckBox" name="printInColor">
</property> <property name="geometry">
</widget> <rect>
<widget class="QRadioButton" name="notesOnTop"> <x>10</x>
<property name="geometry"> <y>50</y>
<rect> <width>461</width>
<x>10</x> <height>18</height>
<y>50</y> </rect>
<width>461</width> </property>
<height>18</height> <property name="sizePolicy">
</rect> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
</property> <horstretch>0</horstretch>
<property name="sizePolicy"> <verstretch>0</verstretch>
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> </sizepolicy>
<horstretch>0</horstretch> </property>
<verstretch>0</verstretch> <property name="text">
</sizepolicy> <string>Print in color</string>
</property> </property>
<property name="text"> </widget>
<string>Notes on top</string> </widget>
</property> <widget class="QGroupBox" name="printType">
<property name="checked"> <property name="geometry">
<bool>false</bool> <rect>
</property> <x>10</x>
</widget> <y>10</y>
</widget> <width>489</width>
<widget class="QGroupBox" name="sizingHeights"> <height>51</height>
<property name="geometry"> </rect>
<rect> </property>
<x>10</x> <property name="sizePolicy">
<y>250</y> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<width>489</width> <horstretch>0</horstretch>
<height>141</height> <verstretch>0</verstretch>
</rect> </sizepolicy>
</property> </property>
<property name="title"> <property name="baseSize">
<string>Sizing heights (% of layout)</string> <size>
</property> <width>0</width>
<widget class="QSlider" name="sliderPHeight"> <height>0</height>
<property name="geometry"> </size>
<rect> </property>
<x>260</x> <property name="title">
<y>30</y> <string>Print type</string>
<width>211</width> </property>
<height>20</height> <widget class="QWidget" name="horizontalLayoutWidget_2">
</rect> <property name="geometry">
</property> <rect>
<property name="minimum"> <x>0</x>
<number>43</number> <y>20</y>
</property> <width>491</width>
<property name="maximum"> <height>31</height>
<number>85</number> </rect>
</property> </property>
<property name="orientation"> <layout class="QHBoxLayout" name="layoutPrintType">
<enum>Qt::Horizontal</enum> <property name="sizeConstraint">
</property> <enum>QLayout::SetDefaultConstraint</enum>
</widget> </property>
<widget class="QLabel" name="labelPHeight"> <property name="leftMargin">
<property name="geometry"> <number>15</number>
<rect> </property>
<x>10</x> <property name="rightMargin">
<y>30</y> <number>15</number>
<width>201</width> </property>
<height>20</height> <item>
</rect> <widget class="QRadioButton" name="radioSixDives">
</property> <property name="sizePolicy">
<property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch>
<horstretch>0</horstretch> <verstretch>0</verstretch>
<verstretch>0</verstretch> </sizepolicy>
</sizepolicy> </property>
</property> <property name="text">
<property name="text"> <string>6 dives per page</string>
<string>Profile height (43% - 85%)</string> </property>
</property> <property name="checked">
<property name="alignment"> <bool>true</bool>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property>
</property> </widget>
</widget> </item>
<widget class="QLabel" name="labelOHeight"> <item>
<property name="geometry"> <widget class="QRadioButton" name="radioTwoDives">
<rect> <property name="sizePolicy">
<x>10</x> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<y>70</y> <horstretch>0</horstretch>
<width>201</width> <verstretch>0</verstretch>
<height>20</height> </sizepolicy>
</rect> </property>
</property> <property name="text">
<property name="sizePolicy"> <string>2 dives per page</string>
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> </property>
<horstretch>0</horstretch> </widget>
<verstretch>0</verstretch> </item>
</sizepolicy> <item>
</property> <widget class="QRadioButton" name="radioTablePrint">
<property name="text"> <property name="sizePolicy">
<string>Other data height (8% - 17%)</string> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
</property> <horstretch>0</horstretch>
<property name="alignment"> <verstretch>0</verstretch>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </sizepolicy>
</property> </property>
</widget> <property name="text">
<widget class="QSlider" name="sliderOHeight"> <string>Table print</string>
<property name="geometry"> </property>
<rect> </widget>
<x>260</x> </item>
<y>70</y> </layout>
<width>211</width> </widget>
<height>20</height> </widget>
</rect> <widget class="QGroupBox" name="ordering">
</property> <property name="geometry">
<property name="minimum"> <rect>
<number>8</number> <x>10</x>
</property> <y>160</y>
<property name="maximum"> <width>489</width>
<number>17</number> <height>81</height>
</property> </rect>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> <property name="title">
</property> <string>Ordering</string>
</widget> </property>
<widget class="QSlider" name="sliderNHeight"> <widget class="QRadioButton" name="profileOnTop">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>260</x> <x>10</x>
<y>110</y> <y>30</y>
<width>211</width> <width>461</width>
<height>20</height> <height>18</height>
</rect> </rect>
</property> </property>
<property name="maximum"> <property name="sizePolicy">
<number>52</number> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
</property> <horstretch>0</horstretch>
<property name="orientation"> <verstretch>0</verstretch>
<enum>Qt::Horizontal</enum> </sizepolicy>
</property> </property>
</widget> <property name="text">
<widget class="QLabel" name="labelNHeight"> <string>Profile on top</string>
<property name="geometry"> </property>
<rect> <property name="checked">
<x>10</x> <bool>true</bool>
<y>110</y> </property>
<width>201</width> </widget>
<height>20</height> <widget class="QRadioButton" name="notesOnTop">
</rect> <property name="geometry">
</property> <rect>
<property name="sizePolicy"> <x>10</x>
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <y>50</y>
<horstretch>0</horstretch> <width>461</width>
<verstretch>0</verstretch> <height>18</height>
</sizepolicy> </rect>
</property> </property>
<property name="layoutDirection"> <property name="sizePolicy">
<enum>Qt::LeftToRight</enum> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
</property> <horstretch>0</horstretch>
<property name="text"> <verstretch>0</verstretch>
<string>Notes height (0% - 52%)</string> </sizepolicy>
</property> </property>
<property name="alignment"> <property name="text">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <string>Notes on top</string>
</property> </property>
</widget> <property name="checked">
<widget class="QLabel" name="valuePHeight"> <bool>false</bool>
<property name="geometry"> </property>
<rect> </widget>
<x>220</x> </widget>
<y>30</y> </widget>
<width>31</width> <tabstops>
<height>20</height> <tabstop>radioSixDives</tabstop>
</rect> <tabstop>radioTwoDives</tabstop>
</property> <tabstop>radioTablePrint</tabstop>
<property name="text"> <tabstop>printSelected</tabstop>
<string>0</string> <tabstop>printInColor</tabstop>
</property> <tabstop>profileOnTop</tabstop>
<property name="alignment"> <tabstop>notesOnTop</tabstop>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </tabstops>
</property> <resources/>
</widget> <connections/>
<widget class="QLabel" name="valueOHeight"> </ui>
<property name="geometry">
<rect>
<x>220</x>
<y>70</y>
<width>31</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="valueNHeight">
<property name="geometry">
<rect>
<x>220</x>
<y>110</y>
<width>31</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</widget>
</widget>
<tabstops>
<tabstop>radioSixDives</tabstop>
<tabstop>radioTwoDives</tabstop>
<tabstop>radioTablePrint</tabstop>
<tabstop>printSelected</tabstop>
<tabstop>printInColor</tabstop>
<tabstop>profileOnTop</tabstop>
<tabstop>notesOnTop</tabstop>
<tabstop>sliderPHeight</tabstop>
<tabstop>sliderOHeight</tabstop>
<tabstop>sliderNHeight</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>