From a63f3af6a44380611f9d5cc5db4ec98e053d8734 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Mon, 6 Apr 2020 16:37:34 +0100 Subject: [PATCH] Add Ultracode to Qt frontend --- backend_qt/qzint.cpp | 33 +++++++++++++++++++++++++++++++-- frontend_qt/mainwindow.cpp | 3 ++- frontend_qt/mainwindow.h | 3 ++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp index 65d386f1..e22b5b44 100644 --- a/backend_qt/qzint.cpp +++ b/backend_qt/qzint.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * Copyright (C) 2008 by BogDan Vatra * * bogdan@licentia.eu * - * Copyright (C) 2010-2017 Robin Stuart * + * Copyright (C) 2010-2020 Robin Stuart * * * * 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 * @@ -333,7 +333,36 @@ namespace Zint { // Plot rectangles rect = m_zintSymbol->vector->rectangles; while (rect) { - painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(m_fgColor)); + if (rect->colour == -1) { + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(m_fgColor)); + } else { + switch(rect->colour) { + case 0: // White + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::white)); + break; + case 1: // Cyan + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::cyan)); + break; + case 2: // Blue + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::blue)); + break; + case 3: // Magenta + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::magenta)); + break; + case 4: // Red + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::red)); + break; + case 5: // Yellow + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::yellow)); + break; + case 6: // Green + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::green)); + break; + default: + painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::black)); + break; + } + } rect = rect->next; } diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index f97586e3..183fcc85 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by BogDan Vatra * - * Copyright (C) 2009-2019 by Robin Stuart * + * Copyright (C) 2009-2020 by Robin Stuart * * * * 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 * @@ -107,6 +107,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "Telepen", "Telepen Numeric", "UK Plessey", + "Ultracode", "UPNQR", "Universal Product Code (UPC-A)", "Universal Product Code (UPC-E)", diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index 0da976d4..f1c67601 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008 by BogDan Vatra * - * Copyright (C) 2009-2019 by Robin Stuart * + * Copyright (C) 2009-2020 by Robin Stuart * * * * 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 * @@ -102,6 +102,7 @@ public: TELEPEN = 32, TELEPEN_NUM = 87, PLESSEY = 86, + ULTRA = 144, UPNQR = 143, UPCA = 34, UPCE = 37,