mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Make the classes generated by uic be real members of our classes
This means we don't have to new/delete them, which is a waste of overhead. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f0f76056ac
commit
8e81d3f100
22 changed files with 563 additions and 572 deletions
|
@ -2,10 +2,9 @@
|
|||
#include "../display.h"
|
||||
|
||||
PrintOptions::PrintOptions(QWidget *parent, struct options *printOpt)
|
||||
: ui( new Ui::PrintOptions())
|
||||
{
|
||||
hasSetupSlots = false;
|
||||
ui->setupUi(this);
|
||||
ui.setupUi(this);
|
||||
if (parent)
|
||||
setParent(parent);
|
||||
if (!printOpt)
|
||||
|
@ -17,48 +16,48 @@ void PrintOptions::setup(struct options *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);
|
||||
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
|
||||
switch (printOptions->type) {
|
||||
case options::PRETTY:
|
||||
ui->radioSixDives->setChecked(true);
|
||||
ui.radioSixDives->setChecked(true);
|
||||
break;
|
||||
case options::TWOPERPAGE:
|
||||
ui->radioTwoDives->setChecked(true);
|
||||
ui.radioTwoDives->setChecked(true);
|
||||
break;
|
||||
case options::TABLE:
|
||||
ui->radioTablePrint->setChecked(true);
|
||||
ui.radioTablePrint->setChecked(true);
|
||||
break;
|
||||
}
|
||||
// general print option checkboxes
|
||||
if (printOptions->color_selected)
|
||||
ui->printInColor->setChecked(true);
|
||||
ui.printInColor->setChecked(true);
|
||||
if (printOptions->print_selected)
|
||||
ui->printSelected->setChecked(true);
|
||||
ui.printSelected->setChecked(true);
|
||||
// ordering
|
||||
if (printOptions->notes_up)
|
||||
ui->notesOnTop->setChecked(true);
|
||||
ui.notesOnTop->setChecked(true);
|
||||
else
|
||||
ui->profileOnTop->setChecked(true);
|
||||
ui.profileOnTop->setChecked(true);
|
||||
|
||||
// connect slots only once
|
||||
if (hasSetupSlots)
|
||||
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.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->radioTwoDives, SIGNAL(clicked(bool)), this, SLOT(radioTwoDivesClicked(bool)));
|
||||
connect(ui->radioTablePrint, SIGNAL(clicked(bool)), this, SLOT(radioTablePrintClicked(bool)));
|
||||
connect(ui.radioSixDives, SIGNAL(clicked(bool)), this, SLOT(radioSixDivesClicked(bool)));
|
||||
connect(ui.radioTwoDives, SIGNAL(clicked(bool)), this, SLOT(radioTwoDivesClicked(bool)));
|
||||
connect(ui.radioTablePrint, SIGNAL(clicked(bool)), this, SLOT(radioTablePrintClicked(bool)));
|
||||
|
||||
connect(ui->printInColor, SIGNAL(clicked(bool)), this, SLOT(printInColorClicked(bool)));
|
||||
connect(ui->printSelected, SIGNAL(clicked(bool)), this, SLOT(printSelectedClicked(bool)));
|
||||
connect(ui.printInColor, SIGNAL(clicked(bool)), this, SLOT(printInColorClicked(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)));
|
||||
connect(ui.notesOnTop, SIGNAL(clicked(bool)), this, SLOT(notesOnTopClicked(bool)));
|
||||
connect(ui.profileOnTop, SIGNAL(clicked(bool)), this, SLOT(profileOnTopClicked(bool)));
|
||||
hasSetupSlots = true;
|
||||
}
|
||||
|
||||
|
@ -77,19 +76,19 @@ QString PrintOptions::formatSliderValueText(int value)
|
|||
|
||||
void PrintOptions::sliderPHeightMoved(int value)
|
||||
{
|
||||
ui->valuePHeight->setText(formatSliderValueText(value));
|
||||
ui.valuePHeight->setText(formatSliderValueText(value));
|
||||
printOptions->profile_height = value;
|
||||
}
|
||||
|
||||
void PrintOptions::sliderOHeightMoved(int value)
|
||||
{
|
||||
ui->valueOHeight->setText(formatSliderValueText(value));
|
||||
ui.valueOHeight->setText(formatSliderValueText(value));
|
||||
printOptions->notes_height = value;
|
||||
}
|
||||
|
||||
void PrintOptions::sliderNHeightMoved(int value)
|
||||
{
|
||||
ui->valueNHeight->setText(formatSliderValueText(value));
|
||||
ui.valueNHeight->setText(formatSliderValueText(value));
|
||||
printOptions->tanks_height = value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue