Printing: refactor the print options class

-Remove unneeded parameter to member variable
-Check if template_options struct is valid

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Gehad elrobey 2015-07-05 06:28:23 +02:00 committed by Lubomir I. Ivanov
parent 605e1e2d93
commit a70cea95e8
2 changed files with 5 additions and 5 deletions

View file

@ -8,15 +8,15 @@ PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt, stru
ui.setupUi(this);
if (parent)
setParent(parent);
if (!printOpt)
if (!printOpt || !templateOpt)
return;
setup(printOpt);
templateOptions = templateOpt;
printOptions = printOpt;
setup();
}
void PrintOptions::setup(struct print_options *printOpt)
void PrintOptions::setup()
{
printOptions = printOpt;
// print type radio buttons
switch (printOptions->type) {
case print_options::DIVELIST:

View file

@ -27,7 +27,7 @@ class PrintOptions : public QWidget {
public:
explicit PrintOptions(QWidget *parent, struct print_options *printOpt, struct template_options *templateOpt);
void setup(struct print_options *printOpt);
void setup();
private:
Ui::PrintOptions ui;