2017-04-27 20:26:05 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-07-09 15:37:53 +03:00
|
|
|
#ifndef PRINTOPTIONS_H
|
|
|
|
#define PRINTOPTIONS_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2013-10-03 11:54:24 -07:00
|
|
|
#include "ui_printoptions.h"
|
2013-07-09 15:37:53 +03:00
|
|
|
|
2015-05-30 13:27:14 +02:00
|
|
|
struct print_options {
|
|
|
|
enum print_type {
|
|
|
|
DIVELIST,
|
|
|
|
STATISTICS
|
|
|
|
} type;
|
2015-07-24 09:53:07 +02:00
|
|
|
QString p_template;
|
2015-05-30 13:27:14 +02:00
|
|
|
bool print_selected;
|
|
|
|
bool color_selected;
|
|
|
|
bool landscape;
|
2020-08-22 14:36:41 +02:00
|
|
|
int resolution;
|
2015-05-30 13:27:14 +02:00
|
|
|
};
|
|
|
|
|
2015-07-05 07:26:39 +02:00
|
|
|
struct template_options {
|
|
|
|
int font_index;
|
|
|
|
int color_palette_index;
|
2015-08-11 22:50:27 +02:00
|
|
|
int border_width;
|
2015-07-05 07:26:39 +02:00
|
|
|
double font_size;
|
|
|
|
double line_spacing;
|
2015-07-12 05:00:03 +02:00
|
|
|
struct color_palette_struct {
|
|
|
|
QColor color1;
|
|
|
|
QColor color2;
|
|
|
|
QColor color3;
|
|
|
|
QColor color4;
|
|
|
|
QColor color5;
|
2015-08-07 09:54:09 +02:00
|
|
|
QColor color6;
|
2015-07-12 05:00:03 +02:00
|
|
|
bool operator!=(const color_palette_struct &other) const {
|
|
|
|
return other.color1 != color1
|
|
|
|
|| other.color2 != color2
|
|
|
|
|| other.color3 != color3
|
|
|
|
|| other.color4 != color4
|
2015-08-07 09:54:09 +02:00
|
|
|
|| other.color5 != color5
|
|
|
|
|| other.color6 != color6;
|
2015-07-12 05:00:03 +02:00
|
|
|
}
|
|
|
|
} color_palette;
|
2015-07-11 01:06:43 +02:00
|
|
|
bool operator!=(const template_options &other) const {
|
|
|
|
return other.font_index != font_index
|
|
|
|
|| other.color_palette_index != color_palette_index
|
|
|
|
|| other.font_size != font_size
|
2015-07-12 05:00:03 +02:00
|
|
|
|| other.line_spacing != line_spacing
|
2017-03-06 18:41:54 +02:00
|
|
|
|| other.border_width != border_width
|
2015-07-12 05:00:03 +02:00
|
|
|
|| other.color_palette != color_palette;
|
2015-07-11 01:06:43 +02:00
|
|
|
}
|
2015-07-12 05:00:03 +02:00
|
|
|
};
|
|
|
|
|
2015-07-28 10:48:29 -07:00
|
|
|
extern template_options::color_palette_struct ssrf_colors, almond_colors, blueshades_colors, custom_colors;
|
2015-07-05 07:26:39 +02:00
|
|
|
|
2015-07-26 19:57:57 +02:00
|
|
|
enum color_palette {
|
2015-07-28 10:48:29 -07:00
|
|
|
SSRF_COLORS,
|
2015-07-26 19:57:57 +02:00
|
|
|
ALMOND,
|
|
|
|
BLUESHADES,
|
|
|
|
CUSTOM
|
|
|
|
};
|
|
|
|
|
2013-07-09 15:37:53 +03:00
|
|
|
// should be based on a custom QPrintDialog class
|
|
|
|
class PrintOptions : public QWidget {
|
2014-02-27 20:09:57 -08:00
|
|
|
Q_OBJECT
|
2013-07-09 15:37:53 +03:00
|
|
|
|
|
|
|
public:
|
2020-12-12 13:28:36 +01:00
|
|
|
explicit PrintOptions(QWidget *parent, print_options &printOpt, template_options &templateOpt);
|
2015-07-05 06:28:23 +02:00
|
|
|
void setup();
|
2015-07-26 14:59:59 +02:00
|
|
|
QString getSelectedTemplate();
|
2013-07-09 15:37:53 +03:00
|
|
|
|
|
|
|
private:
|
2013-10-03 11:54:25 -07:00
|
|
|
Ui::PrintOptions ui;
|
2020-12-12 13:28:36 +01:00
|
|
|
print_options &printOptions;
|
|
|
|
template_options &templateOptions;
|
2013-07-10 10:54:25 +03:00
|
|
|
bool hasSetupSlots;
|
2017-11-23 16:40:05 +02:00
|
|
|
QString lastImportExportTemplate;
|
2015-08-21 18:07:30 +02:00
|
|
|
void setupTemplates();
|
2013-07-09 23:43:21 +03:00
|
|
|
|
2014-02-27 20:09:57 -08:00
|
|
|
private
|
|
|
|
slots:
|
2013-07-10 10:54:25 +03:00
|
|
|
void printInColorClicked(bool check);
|
|
|
|
void printSelectedClicked(bool check);
|
2015-08-12 00:57:19 +02:00
|
|
|
void on_radioStatisticsPrint_toggled(bool check);
|
|
|
|
void on_radioDiveListPrint_toggled(bool check);
|
2015-06-11 20:13:10 +02:00
|
|
|
void on_printTemplate_currentIndexChanged(int index);
|
2015-06-26 04:21:31 +02:00
|
|
|
void on_editButton_clicked();
|
2015-07-28 09:05:58 +02:00
|
|
|
void on_importButton_clicked();
|
|
|
|
void on_exportButton_clicked();
|
|
|
|
void on_deleteButton_clicked();
|
2013-07-09 15:37:53 +03:00
|
|
|
};
|
|
|
|
|
2014-02-11 19:14:46 +01:00
|
|
|
#endif // PRINTOPTIONS_H
|