2008-07-19 02:48:31 +12:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2008 by BogDan Vatra *
|
|
|
|
* bogdan@licentia.eu *
|
2021-05-26 07:42:26 +12:00
|
|
|
* Copyright (C) 2010-2021 Robin Stuart *
|
2008-07-19 02:48:31 +12:00
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
***************************************************************************/
|
2020-06-05 05:45:25 +12:00
|
|
|
/* vim: set ts=4 sw=4 et : */
|
2008-07-19 02:48:31 +12:00
|
|
|
|
2021-09-06 08:52:00 +12:00
|
|
|
#ifndef QZINT_H
|
|
|
|
#define QZINT_H
|
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
#include <QColor>
|
2008-09-18 05:36:08 +12:00
|
|
|
#include <QPainter>
|
2008-07-19 02:48:31 +12:00
|
|
|
#include "zint.h"
|
|
|
|
|
|
|
|
namespace Zint
|
|
|
|
{
|
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
class QZint : public QObject
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2020-10-01 00:19:12 +13:00
|
|
|
Q_OBJECT
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
public:
|
2021-09-06 08:52:00 +12:00
|
|
|
enum AspectRatioMode{ IgnoreAspectRatio = 0, KeepAspectRatio = 1, CenterBarCode = 2 }; /* Legacy - not used */
|
2008-07-19 02:48:31 +12:00
|
|
|
|
|
|
|
public:
|
2020-06-05 05:45:25 +12:00
|
|
|
QZint();
|
|
|
|
~QZint();
|
2008-07-19 02:48:31 +12:00
|
|
|
|
2021-09-06 08:52:00 +12:00
|
|
|
int symbol() const; /* Symbology */
|
2020-06-05 05:45:25 +12:00
|
|
|
void setSymbol(int symbol);
|
|
|
|
|
|
|
|
int inputMode() const;
|
|
|
|
void setInputMode(int input_mode);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QString text() const;
|
2021-09-06 08:52:00 +12:00
|
|
|
void setText(const QString& text);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QString primaryMessage() const;
|
2021-09-06 08:52:00 +12:00
|
|
|
void setPrimaryMessage(const QString& primaryMessage);
|
2020-06-05 05:45:25 +12:00
|
|
|
|
2021-06-20 00:11:23 +12:00
|
|
|
float height() const;
|
|
|
|
void setHeight(float height);
|
2020-06-05 05:45:25 +12:00
|
|
|
|
|
|
|
int option2() const;
|
|
|
|
void setOption2(int option);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2020-11-28 01:54:44 +13:00
|
|
|
int option3() const;
|
2020-06-05 05:45:25 +12:00
|
|
|
void setOption3(int option);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
float scale() const;
|
|
|
|
void setScale(float scale);
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
bool dotty() const;
|
|
|
|
void setDotty(bool botty);
|
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
void setDotSize(float dot_size);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QColor fgColor() const;
|
2021-09-06 08:52:00 +12:00
|
|
|
void setFgColor(const QColor& fgColor);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
QColor bgColor() const;
|
2021-09-06 08:52:00 +12:00
|
|
|
void setBgColor(const QColor& bgColor);
|
2008-07-19 02:48:31 +12:00
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
void setCMYK(bool cmyk);
|
|
|
|
|
|
|
|
int borderType() const;
|
|
|
|
void setBorderType(int borderTypeIndex);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2017-09-11 03:03:09 +12:00
|
|
|
int borderWidth() const;
|
2020-06-05 05:45:25 +12:00
|
|
|
void setBorderWidth(int boderWidth);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2020-12-20 06:13:35 +13:00
|
|
|
int option1() const;
|
|
|
|
void setOption1(int option_1);
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
void setWhitespace(int whitespace);
|
2009-05-20 02:04:49 +12:00
|
|
|
|
2021-05-26 07:42:26 +12:00
|
|
|
void setVWhitespace(int vwhitespace);
|
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
void setFontSetting(int fontSettingIndex);
|
|
|
|
|
|
|
|
void setShowText(bool show);
|
2008-11-04 02:31:23 +13:00
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
void setTargetSize(int width, int height);
|
2008-09-18 05:36:08 +12:00
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
void setGSSep(bool gssep);
|
2009-05-03 18:35:18 +12:00
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
int rotateAngle() const;
|
|
|
|
void setRotateAngle(int rotateIndex);
|
|
|
|
|
|
|
|
void setECI(int ECIIndex);
|
|
|
|
|
2021-05-15 23:23:46 +12:00
|
|
|
void setGS1Parens(bool gs1parens);
|
|
|
|
|
2021-07-14 04:39:03 +12:00
|
|
|
void setGS1NoCheck(bool gs1nocheck);
|
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
void setReaderInit(bool reader_init);
|
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
void setDebug(bool debug);
|
2009-05-20 02:04:49 +12:00
|
|
|
|
2021-09-06 08:52:00 +12:00
|
|
|
/* Legacy property getters/setters */
|
2021-06-25 05:31:08 +12:00
|
|
|
void setWidth(int width); /* option_1 */
|
|
|
|
int width() const;
|
|
|
|
void setSecurityLevel(int securityLevel); /* option_2 */
|
|
|
|
int securityLevel() const;
|
|
|
|
void setPdf417CodeWords(int pdf417CodeWords); /* no op */
|
|
|
|
int pdf417CodeWords() const;
|
|
|
|
void setHideText(bool hide); /* setShowText(!hide) */
|
|
|
|
|
2021-09-06 08:52:00 +12:00
|
|
|
/* Test capabilities - ZBarcode_Cap() */
|
2020-10-01 00:19:12 +13:00
|
|
|
bool hasHRT(int symbology = 0) const;
|
|
|
|
bool isExtendable(int symbology = 0) const;
|
|
|
|
bool supportsECI(int symbology = 0) const;
|
2021-05-15 23:23:46 +12:00
|
|
|
bool supportsGS1(int symbology = 0) const;
|
2020-10-01 00:19:12 +13:00
|
|
|
bool isFixedRatio(int symbology = 0) const;
|
|
|
|
bool isDotty(int symbology = 0) const;
|
|
|
|
bool supportsReaderInit(int symbology = 0) const;
|
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
int getError() const;
|
2008-07-19 02:48:31 +12:00
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
QString error_message() const;
|
2009-05-20 02:04:49 +12:00
|
|
|
|
2021-09-06 08:52:00 +12:00
|
|
|
const QString& lastError() const;
|
2020-06-05 05:45:25 +12:00
|
|
|
bool hasErrors() const;
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2020-06-05 05:45:25 +12:00
|
|
|
bool save_to_file(QString filename);
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2021-09-06 08:52:00 +12:00
|
|
|
/* Note: legacy argument `mode` is not used */
|
|
|
|
void render(QPainter& painter, const QRectF& paintRect, AspectRatioMode mode = IgnoreAspectRatio);
|
2020-11-23 00:29:45 +13:00
|
|
|
|
|
|
|
int getVersion() const;
|
2009-07-08 07:10:22 +12:00
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
signals:
|
|
|
|
void encoded();
|
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
private:
|
2020-06-05 05:45:25 +12:00
|
|
|
void resetSymbol();
|
|
|
|
void encode();
|
2020-10-01 00:19:12 +13:00
|
|
|
static Qt::GlobalColor colourToQtColor(int colour);
|
2008-07-19 02:48:31 +12:00
|
|
|
|
|
|
|
private:
|
2020-06-05 05:45:25 +12:00
|
|
|
int m_symbol;
|
|
|
|
QString m_text;
|
|
|
|
QString m_primaryMessage;
|
2021-06-20 00:11:23 +12:00
|
|
|
float m_height;
|
2020-10-01 00:19:12 +13:00
|
|
|
int m_borderType;
|
2020-06-05 05:45:25 +12:00
|
|
|
int m_borderWidth;
|
2020-10-01 00:19:12 +13:00
|
|
|
int m_fontSetting;
|
2020-06-05 05:45:25 +12:00
|
|
|
int m_option_2;
|
2020-12-20 06:13:35 +13:00
|
|
|
int m_option_1;
|
2020-06-05 05:45:25 +12:00
|
|
|
int m_input_mode;
|
|
|
|
QColor m_fgColor;
|
|
|
|
QColor m_bgColor;
|
2020-10-01 00:19:12 +13:00
|
|
|
bool m_cmyk;
|
2020-06-05 05:45:25 +12:00
|
|
|
QString m_lastError;
|
|
|
|
int m_error;
|
|
|
|
int m_whitespace;
|
2021-05-26 07:42:26 +12:00
|
|
|
int m_vwhitespace;
|
2020-06-05 05:45:25 +12:00
|
|
|
zint_symbol * m_zintSymbol;
|
|
|
|
float m_scale;
|
|
|
|
int m_option_3;
|
2020-10-01 00:19:12 +13:00
|
|
|
bool m_show_hrt;
|
|
|
|
int m_eci;
|
|
|
|
int m_rotate_angle;
|
|
|
|
bool m_dotty;
|
2017-09-11 03:03:09 +12:00
|
|
|
float m_dot_size;
|
|
|
|
int target_size_horiz;
|
|
|
|
int target_size_vert;
|
2021-05-15 23:23:46 +12:00
|
|
|
bool m_gs1parens;
|
2021-07-14 04:39:03 +12:00
|
|
|
bool m_gs1nocheck;
|
2020-06-05 05:45:25 +12:00
|
|
|
bool m_gssep;
|
2020-10-01 00:19:12 +13:00
|
|
|
bool m_reader_init;
|
2020-06-05 05:45:25 +12:00
|
|
|
bool m_debug;
|
2008-07-19 02:48:31 +12:00
|
|
|
};
|
2021-09-06 08:52:00 +12:00
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
2017-10-24 08:37:52 +13:00
|
|
|
|
2021-09-06 08:52:00 +12:00
|
|
|
#endif /* QZINT_H */
|