mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 00:53:24 +00:00
Printing: Edit the print options widget
Remove obsolete code and add new customizable print code to the options dialog. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
912606e1c7
commit
a0b8eed612
4 changed files with 58 additions and 108 deletions
|
@ -40,7 +40,9 @@ struct print_options {
|
||||||
PRETTY,
|
PRETTY,
|
||||||
TABLE,
|
TABLE,
|
||||||
TWOPERPAGE,
|
TWOPERPAGE,
|
||||||
ONEPERPAGE
|
ONEPERPAGE,
|
||||||
|
DIVELIST,
|
||||||
|
STATISTICS
|
||||||
} type;
|
} type;
|
||||||
bool print_selected;
|
bool print_selected;
|
||||||
bool color_selected;
|
bool color_selected;
|
||||||
|
|
|
@ -17,66 +17,53 @@ void PrintOptions::setup(struct print_options *printOpt)
|
||||||
printOptions = printOpt;
|
printOptions = printOpt;
|
||||||
// print type radio buttons
|
// print type radio buttons
|
||||||
switch (printOptions->type) {
|
switch (printOptions->type) {
|
||||||
case print_options::PRETTY:
|
case print_options::DIVELIST:
|
||||||
ui.radioSixDives->setChecked(true);
|
ui.radioDiveListPrint->setChecked(true);
|
||||||
break;
|
|
||||||
case print_options::TWOPERPAGE:
|
|
||||||
ui.radioTwoDives->setChecked(true);
|
|
||||||
break;
|
|
||||||
case print_options::ONEPERPAGE:
|
|
||||||
ui.radioOneDive->setChecked(true);
|
|
||||||
break;
|
break;
|
||||||
case print_options::TABLE:
|
case print_options::TABLE:
|
||||||
ui.radioTablePrint->setChecked(true);
|
ui.radioTablePrint->setChecked(true);
|
||||||
break;
|
break;
|
||||||
|
case print_options::STATISTICS:
|
||||||
|
ui.radioStatisticsPrint->setChecked(true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// general print option checkboxes
|
// general print option checkboxes
|
||||||
if (printOptions->color_selected)
|
if (printOptions->color_selected)
|
||||||
ui.printInColor->setChecked(true);
|
ui.printInColor->setChecked(true);
|
||||||
if (printOptions->print_selected)
|
if (printOptions->print_selected)
|
||||||
ui.printSelected->setChecked(true);
|
ui.printSelected->setChecked(true);
|
||||||
// ordering
|
|
||||||
if (printOptions->notes_up)
|
|
||||||
ui.notesOnTop->setChecked(true);
|
|
||||||
else
|
|
||||||
ui.profileOnTop->setChecked(true);
|
|
||||||
|
|
||||||
// connect slots only once
|
// connect slots only once
|
||||||
if (hasSetupSlots)
|
if (hasSetupSlots)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
connect(ui.radioSixDives, SIGNAL(clicked(bool)), this, SLOT(radioSixDivesClicked(bool)));
|
|
||||||
connect(ui.radioTwoDives, SIGNAL(clicked(bool)), this, SLOT(radioTwoDivesClicked(bool)));
|
|
||||||
connect(ui.radioOneDive, SIGNAL(clicked(bool)), this, SLOT(radioOneDiveClicked(bool)));
|
|
||||||
connect(ui.radioTablePrint, SIGNAL(clicked(bool)), this, SLOT(radioTablePrintClicked(bool)));
|
|
||||||
|
|
||||||
connect(ui.printInColor, SIGNAL(clicked(bool)), this, SLOT(printInColorClicked(bool)));
|
connect(ui.printInColor, SIGNAL(clicked(bool)), this, SLOT(printInColorClicked(bool)));
|
||||||
connect(ui.printSelected, SIGNAL(clicked(bool)), this, SLOT(printSelectedClicked(bool)));
|
connect(ui.printSelected, SIGNAL(clicked(bool)), this, SLOT(printSelectedClicked(bool)));
|
||||||
|
|
||||||
connect(ui.notesOnTop, SIGNAL(clicked(bool)), this, SLOT(notesOnTopClicked(bool)));
|
|
||||||
connect(ui.profileOnTop, SIGNAL(clicked(bool)), this, SLOT(profileOnTopClicked(bool)));
|
|
||||||
hasSetupSlots = true;
|
hasSetupSlots = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// print type radio buttons
|
// print type radio buttons
|
||||||
void PrintOptions::radioSixDivesClicked(bool check)
|
void PrintOptions::on_radioDiveListPrint_clicked(bool check)
|
||||||
{
|
{
|
||||||
printOptions->type = print_options::PRETTY;
|
if (check) {
|
||||||
|
printOptions->type = print_options::DIVELIST;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintOptions::radioTwoDivesClicked(bool check)
|
void PrintOptions::on_radioTablePrint_clicked(bool check)
|
||||||
{
|
{
|
||||||
printOptions->type = print_options::TWOPERPAGE;
|
if (check) {
|
||||||
|
printOptions->type = print_options::TABLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintOptions::radioOneDiveClicked(bool check)
|
void PrintOptions::on_radioStatisticsPrint_clicked(bool check)
|
||||||
{
|
{
|
||||||
printOptions->type = print_options::ONEPERPAGE;
|
if (check) {
|
||||||
}
|
printOptions->type = print_options::STATISTICS;
|
||||||
|
}
|
||||||
void PrintOptions::radioTablePrintClicked(bool check)
|
|
||||||
{
|
|
||||||
printOptions->type = print_options::TABLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// general print option checkboxes
|
// general print option checkboxes
|
||||||
|
@ -89,14 +76,3 @@ void PrintOptions::printSelectedClicked(bool check)
|
||||||
{
|
{
|
||||||
printOptions->print_selected = check;
|
printOptions->print_selected = check;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ordering
|
|
||||||
void PrintOptions::notesOnTopClicked(bool check)
|
|
||||||
{
|
|
||||||
printOptions->notes_up = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintOptions::profileOnTopClicked(bool check)
|
|
||||||
{
|
|
||||||
printOptions->notes_up = false;
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,14 +20,11 @@ private:
|
||||||
|
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
void radioSixDivesClicked(bool check);
|
|
||||||
void radioTwoDivesClicked(bool check);
|
|
||||||
void radioOneDiveClicked(bool check);
|
|
||||||
void radioTablePrintClicked(bool check);
|
|
||||||
void printInColorClicked(bool check);
|
void printInColorClicked(bool check);
|
||||||
void printSelectedClicked(bool check);
|
void printSelectedClicked(bool check);
|
||||||
void notesOnTopClicked(bool check);
|
void on_radioStatisticsPrint_clicked(bool check);
|
||||||
void profileOnTopClicked(bool check);
|
void on_radioTablePrint_clicked(bool check);
|
||||||
|
void on_radioDiveListPrint_clicked(bool check);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PRINTOPTIONS_H
|
#endif // PRINTOPTIONS_H
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="radioSixDives">
|
<widget class="QRadioButton" name="radioDiveListPrint">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&6 dives per page</string>
|
<string>&Dive list Print</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -46,32 +46,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QRadioButton" name="radioOneDive">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&1 dive per page</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
|
||||||
<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 row="0" column="2">
|
|
||||||
<widget class="QRadioButton" name="radioTablePrint">
|
<widget class="QRadioButton" name="radioTablePrint">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
@ -80,7 +54,20 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Table print</string>
|
<string>&Table Print</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QRadioButton" name="radioStatisticsPrint">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Statistics Print</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -136,40 +123,30 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="ordering">
|
<widget class="QGroupBox" name="template_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Ordering</string>
|
<string>Template</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="profileOnTop">
|
<widget class="QComboBox" name="printTemplate">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<property name="text">
|
||||||
<horstretch>0</horstretch>
|
<string>2 Dives per page</string>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
</item>
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Prof&ile on top</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="notesOnTop">
|
<widget class="QPushButton" name="editButton">
|
||||||
<property name="sizePolicy">
|
<property name="maximumSize">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<size>
|
||||||
<horstretch>0</horstretch>
|
<width>106</width>
|
||||||
<verstretch>0</verstretch>
|
<height>26</height>
|
||||||
</sizepolicy>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Notes on top</string>
|
<string>Edit</string>
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -179,12 +156,10 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>radioSixDives</tabstop>
|
<tabstop>radioDiveListPrint</tabstop>
|
||||||
<tabstop>radioTwoDives</tabstop>
|
<tabstop>radioStatisticsPrint</tabstop>
|
||||||
<tabstop>printSelected</tabstop>
|
<tabstop>printSelected</tabstop>
|
||||||
<tabstop>printInColor</tabstop>
|
<tabstop>printInColor</tabstop>
|
||||||
<tabstop>profileOnTop</tabstop>
|
|
||||||
<tabstop>notesOnTop</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue