mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Printing: add statistics templates to the dialog
Show the existing templates based on the print type selected by the user. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
This commit is contained in:
parent
77c81b299b
commit
6a692495c0
2 changed files with 43 additions and 15 deletions
|
@ -31,21 +31,7 @@ void PrintOptions::setup()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert existing templates in the UI and select the current template
|
setupTemplates();
|
||||||
qSort(grantlee_templates);
|
|
||||||
int current_index = 0, index = 0;
|
|
||||||
for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) {
|
|
||||||
if ((*i).compare(printOptions->p_template) == 0) {
|
|
||||||
current_index = index;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
ui.printTemplate->clear();
|
|
||||||
for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) {
|
|
||||||
ui.printTemplate->addItem((*i).split('.')[0], QVariant::fromValue(*i));
|
|
||||||
}
|
|
||||||
ui.printTemplate->setCurrentIndex(current_index);
|
|
||||||
|
|
||||||
// general print option checkboxes
|
// general print option checkboxes
|
||||||
if (printOptions->color_selected)
|
if (printOptions->color_selected)
|
||||||
|
@ -63,6 +49,43 @@ void PrintOptions::setup()
|
||||||
hasSetupSlots = true;
|
hasSetupSlots = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintOptions::setupTemplates()
|
||||||
|
{
|
||||||
|
if (printOptions->type == print_options::DIVELIST) {
|
||||||
|
// insert dive list templates in the UI and select the current template
|
||||||
|
qSort(grantlee_templates);
|
||||||
|
int current_index = 0, index = 0;
|
||||||
|
for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) {
|
||||||
|
if ((*i).compare(printOptions->p_template) == 0) {
|
||||||
|
current_index = index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
ui.printTemplate->clear();
|
||||||
|
for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) {
|
||||||
|
ui.printTemplate->addItem((*i).split('.')[0], QVariant::fromValue(*i));
|
||||||
|
}
|
||||||
|
ui.printTemplate->setCurrentIndex(current_index);
|
||||||
|
} else if (printOptions->type == print_options::STATISTICS) {
|
||||||
|
// insert statistics templates in the UI and select the current template
|
||||||
|
qSort(grantlee_statistics_templates);
|
||||||
|
int current_index = 0, index = 0;
|
||||||
|
for (QList<QString>::iterator i = grantlee_statistics_templates.begin(); i != grantlee_statistics_templates.end(); ++i) {
|
||||||
|
if ((*i).compare(printOptions->p_template) == 0) {
|
||||||
|
current_index = index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
ui.printTemplate->clear();
|
||||||
|
for (QList<QString>::iterator i = grantlee_statistics_templates.begin(); i != grantlee_statistics_templates.end(); ++i) {
|
||||||
|
ui.printTemplate->addItem((*i).split('.')[0], QVariant::fromValue(*i));
|
||||||
|
}
|
||||||
|
ui.printTemplate->setCurrentIndex(current_index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// print type radio buttons
|
// print type radio buttons
|
||||||
void PrintOptions::on_radioDiveListPrint_toggled(bool check)
|
void PrintOptions::on_radioDiveListPrint_toggled(bool check)
|
||||||
{
|
{
|
||||||
|
@ -79,6 +102,8 @@ void PrintOptions::on_radioDiveListPrint_toggled(bool check)
|
||||||
ui.exportButton->setEnabled(true);
|
ui.exportButton->setEnabled(true);
|
||||||
ui.importButton->setEnabled(true);
|
ui.importButton->setEnabled(true);
|
||||||
ui.printTemplate->setEnabled(true);
|
ui.printTemplate->setEnabled(true);
|
||||||
|
|
||||||
|
setupTemplates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +122,8 @@ void PrintOptions::on_radioStatisticsPrint_toggled(bool check)
|
||||||
ui.exportButton->setEnabled(false);
|
ui.exportButton->setEnabled(false);
|
||||||
ui.importButton->setEnabled(false);
|
ui.importButton->setEnabled(false);
|
||||||
ui.printTemplate->setEnabled(false);
|
ui.printTemplate->setEnabled(false);
|
||||||
|
|
||||||
|
setupTemplates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ private:
|
||||||
struct print_options *printOptions;
|
struct print_options *printOptions;
|
||||||
struct template_options *templateOptions;
|
struct template_options *templateOptions;
|
||||||
bool hasSetupSlots;
|
bool hasSetupSlots;
|
||||||
|
void setupTemplates();
|
||||||
|
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
|
|
Loading…
Add table
Reference in a new issue