2 Commits

Author SHA1 Message Date
061215b756 Version bump dependencies
All checks were successful
Build ptprnt / build (push) Successful in 3m25s
2025-10-13 21:42:16 +02:00
2d37f6fcfb cli-parser-cleanup (#15)
All checks were successful
Build ptprnt / build (push) Successful in 3m50s
Reviewed-on: moritz/ptouch-prnt#15
2025-10-13 19:23:27 +00:00
28 changed files with 110 additions and 119 deletions

View File

@@ -88,6 +88,7 @@
}, },
"clangd.onConfigChanged": "restart", "clangd.onConfigChanged": "restart",
"cSpell.words": [ "cSpell.words": [
"fakelabel",
"fontsize", "fontsize",
"halign", "halign",
"libusb", "libusb",

View File

@@ -23,10 +23,10 @@
#include <spdlog/sinks/stdout_color_sinks.h> #include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include "PrinterDriverFactory.hpp"
#include "cli/CliParser.hpp" #include "cli/CliParser.hpp"
#include "cli/interface/ICliParser.hpp" #include "cli/interface/ICliParser.hpp"
#include "constants.hpp" #include "constants.hpp"
#include "core/PrinterDriverFactory.hpp"
#include "core/PrinterService.hpp" #include "core/PrinterService.hpp"
#include "core/interface/IPrinterService.hpp" #include "core/interface/IPrinterService.hpp"
#include "graphics/LabelBuilder.hpp" #include "graphics/LabelBuilder.hpp"

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2024-2025 Moritz Martinius Copyright (C) 2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2024-2025 Moritz Martinius Copyright (C) 2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -21,7 +21,7 @@
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include "PrinterDriverFactory.hpp" #include "core/PrinterDriverFactory.hpp"
namespace ptprnt::core { namespace ptprnt::core {

View File

@@ -23,9 +23,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "../printers/interface/IPrinterDriver.hpp"
#include "interface/IPrinterService.hpp" #include "interface/IPrinterService.hpp"
#include "../libusbwrap/UsbDeviceFactory.hpp" #include "libusbwrap/UsbDeviceFactory.hpp"
#include "printers/interface/IPrinterDriver.hpp"
namespace ptprnt::core { namespace ptprnt::core {

View File

@@ -23,8 +23,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "../../printers/interface/IPrinterDriver.hpp" #include "graphics/interface/ILabel.hpp"
#include "../../graphics/interface/ILabel.hpp" #include "printers/interface/IPrinterDriver.hpp"
namespace ptprnt::core { namespace ptprnt::core {

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023-2025 Moritz Martinius Copyright (C) 2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023-2025 Moritz Martinius Copyright (C) 2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2024-2025 Moritz Martinius Copyright (C) 2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023-2024 Moritz Martinius Copyright (C) 2023-2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023-2024 Moritz Martinius Copyright (C) 2023-2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023-2024 Moritz Martinius Copyright (C) 2023-2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023 Moritz Martinius Copyright (C) 2023-2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023-2024 Moritz Martinius Copyright (C) 2023-2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023 Moritz Martinius Copyright (C) 2023-2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2022-2023 Moritz Martinius Copyright (C) 2022-2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,34 +1,34 @@
ptprnt_hpps = files ( ptprnt_hpps = files(
'libusbwrap/interface/IUsbDeviceFactory.hpp', 'cli/CliParser.hpp',
'libusbwrap/interface/IUsbDevice.hpp', 'core/PrinterDriverFactory.hpp',
'libusbwrap/UsbDeviceFactory.hpp', 'core/PrinterService.hpp',
'libusbwrap/LibUsbTypes.hpp',
'libusbwrap/UsbDevice.hpp',
'interface/IPrinterDriver.hpp',
'interface/IPrinterTypes.hpp',
'printers/P700Printer.hpp',
'printers/FakePrinter.hpp',
'PtouchPrint.hpp',
'PrinterDriverFactory.hpp',
'graphics/Bitmap.hpp', 'graphics/Bitmap.hpp',
'graphics/Label.hpp', 'graphics/Label.hpp',
'graphics/LabelBuilder.hpp', 'graphics/LabelBuilder.hpp',
'graphics/Monochrome.hpp', 'graphics/Monochrome.hpp',
'cli/CliParser.hpp', 'libusbwrap/LibUsbTypes.hpp',
'core/PrinterService.hpp' 'libusbwrap/UsbDevice.hpp',
'libusbwrap/UsbDeviceFactory.hpp',
'libusbwrap/interface/IUsbDevice.hpp',
'libusbwrap/interface/IUsbDeviceFactory.hpp',
'printers/FakePrinter.hpp',
'printers/P700Printer.hpp',
'printers/interface/IPrinterDriver.hpp',
'printers/interface/IPrinterTypes.hpp',
'PtouchPrint.hpp',
) )
ptprnt_srcs = files ( ptprnt_srcs = files(
'PtouchPrint.cpp', 'cli/CliParser.cpp',
'PrinterDriverFactory.cpp', 'core/PrinterDriverFactory.cpp',
'printers/P700Printer.cpp', 'core/PrinterService.cpp',
'printers/FakePrinter.cpp', 'graphics/Bitmap.cpp',
'graphics/Label.cpp', 'graphics/Label.cpp',
'graphics/LabelBuilder.cpp', 'graphics/LabelBuilder.cpp',
'graphics/Bitmap.cpp',
'graphics/Monochrome.cpp', 'graphics/Monochrome.cpp',
'libusbwrap/UsbDeviceFactory.cpp',
'libusbwrap/UsbDevice.cpp', 'libusbwrap/UsbDevice.cpp',
'cli/CliParser.cpp', 'libusbwrap/UsbDeviceFactory.cpp',
'core/PrinterService.cpp' 'printers/FakePrinter.cpp',
'printers/P700Printer.cpp',
'PtouchPrint.cpp',
) )

View File

@@ -19,27 +19,25 @@
#include "FakePrinter.hpp" #include "FakePrinter.hpp"
#include <spdlog/spdlog.h>
#include <cairo.h> #include <cairo.h>
#include <spdlog/spdlog.h>
#include <cstdint>
#include <stdexcept>
#include <vector>
#include <chrono> #include <chrono>
#include <cstdint>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <stdexcept>
#include <vector>
#include "../graphics/Monochrome.hpp" #include "graphics/Monochrome.hpp"
namespace ptprnt::printer { namespace ptprnt::printer {
const PrinterInfo FakePrinter::mInfo = { const PrinterInfo FakePrinter::mInfo = {.driverName = "FakePrinter",
.driverName = "FakePrinter",
.name = "Virtual Test Printer", .name = "Virtual Test Printer",
.version = "v1.0", .version = "v1.0",
.usbId{0x0000, 0x0000}, // No USB ID - virtual printer created explicitly .usbId{0x0000, 0x0000}, // No USB ID - virtual printer created explicitly
.pixelLines = 128 .pixelLines = 128};
};
const std::string_view FakePrinter::getDriverName() { const std::string_view FakePrinter::getDriverName() {
return mInfo.driverName; return mInfo.driverName;
@@ -94,8 +92,8 @@ bool FakePrinter::printMonochromeData(const graphics::MonochromeData& data) {
auto printed = simulatePrinting(data); auto printed = simulatePrinting(data);
mLastPrint = std::make_unique<graphics::Bitmap<graphics::ALPHA8>>(std::move(printed)); mLastPrint = std::make_unique<graphics::Bitmap<graphics::ALPHA8>>(std::move(printed));
spdlog::info("FakePrinter: Successfully 'printed' label ({}x{} pixels)", spdlog::info("FakePrinter: Successfully 'printed' label ({}x{} pixels)", mLastPrint->getWidth(),
mLastPrint->getWidth(), mLastPrint->getHeight()); mLastPrint->getHeight());
// Save to timestamped PNG file // Save to timestamped PNG file
std::string filename = generateTimestampedFilename(); std::string filename = generateTimestampedFilename();
@@ -120,7 +118,8 @@ bool FakePrinter::printLabel(const std::unique_ptr<graphics::ILabel> label) {
// Transform to portrait orientation for printing // Transform to portrait orientation for printing
monoData.transformTo(graphics::Orientation::PORTRAIT); monoData.transformTo(graphics::Orientation::PORTRAIT);
spdlog::debug("FakePrinter: Label surface is {}x{}, transformed to portrait", label->getWidth(), label->getHeight()); spdlog::debug("FakePrinter: Label surface is {}x{}, transformed to portrait", label->getWidth(),
label->getHeight());
return printMonochromeData(monoData); return printMonochromeData(monoData);
} }
@@ -177,8 +176,8 @@ graphics::Bitmap<graphics::ALPHA8> FakePrinter::simulatePrinting(const graphics:
// Set the pixels in the result bitmap // Set the pixels in the result bitmap
result.setPixels(pixels); result.setPixels(pixels);
spdlog::debug("FakePrinter: Simulation complete, reconstructed {}x{} bitmap", spdlog::debug("FakePrinter: Simulation complete, reconstructed {}x{} bitmap", result.getWidth(),
result.getWidth(), result.getHeight()); result.getHeight());
return result; return result;
} }
@@ -218,13 +217,8 @@ bool FakePrinter::saveBitmapToPng(const graphics::Bitmap<graphics::ALPHA8>& bitm
// Create Cairo surface // Create Cairo surface
int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width); int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width);
cairo_surface_t* surface = cairo_image_surface_create_for_data( cairo_surface_t* surface = cairo_image_surface_create_for_data(reinterpret_cast<unsigned char*>(argbPixels.data()),
reinterpret_cast<unsigned char*>(argbPixels.data()), CAIRO_FORMAT_ARGB32, width, height, stride);
CAIRO_FORMAT_ARGB32,
width,
height,
stride
);
if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
spdlog::error("FakePrinter: Failed to create Cairo surface: {}", spdlog::error("FakePrinter: Failed to create Cairo surface: {}",
@@ -253,9 +247,7 @@ std::string FakePrinter::generateTimestampedFilename() const {
// Format: fakelabel_YYYYMMDD_HHMMSS.png // Format: fakelabel_YYYYMMDD_HHMMSS.png
std::stringstream ss; std::stringstream ss;
ss << "fakelabel_" ss << "fakelabel_" << std::put_time(std::localtime(&time), "%Y%m%d_%H%M%S") << ".png";
<< std::put_time(std::localtime(&time), "%Y%m%d_%H%M%S")
<< ".png";
return ss.str(); return ss.str();
} }

View File

@@ -19,15 +19,15 @@
#pragma once #pragma once
#include <cstdint>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <cstdint>
#include "graphics/Bitmap.hpp"
#include "interface/IPrinterDriver.hpp" #include "interface/IPrinterDriver.hpp"
#include "interface/IPrinterTypes.hpp" #include "interface/IPrinterTypes.hpp"
#include "../libusbwrap/LibUsbTypes.hpp" #include "libusbwrap/LibUsbTypes.hpp"
#include "../libusbwrap/interface/IUsbDevice.hpp" #include "libusbwrap/interface/IUsbDevice.hpp"
#include "../graphics/Bitmap.hpp"
namespace ptprnt::printer { namespace ptprnt::printer {

View File

@@ -28,9 +28,9 @@
#include <thread> #include <thread>
#include <vector> #include <vector>
#include "../graphics/Bitmap.hpp" #include "graphics/Bitmap.hpp"
#include "../graphics/Monochrome.hpp" #include "graphics/Monochrome.hpp"
#include "../libusbwrap/LibUsbTypes.hpp" #include "libusbwrap/LibUsbTypes.hpp"
#include "spdlog/fmt/bin_to_hex.h" #include "spdlog/fmt/bin_to_hex.h"
namespace ptprnt::printer { namespace ptprnt::printer {

View File

@@ -27,8 +27,8 @@
#include "interface/IPrinterDriver.hpp" #include "interface/IPrinterDriver.hpp"
#include "interface/IPrinterTypes.hpp" #include "interface/IPrinterTypes.hpp"
#include "../libusbwrap/LibUsbTypes.hpp" #include "libusbwrap/LibUsbTypes.hpp"
#include "../libusbwrap/interface/IUsbDevice.hpp" #include "libusbwrap/interface/IUsbDevice.hpp"
namespace ptprnt::printer { namespace ptprnt::printer {
namespace p700::commands { namespace p700::commands {

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023-2025 Moritz Martinius Copyright (C) 2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -22,11 +22,11 @@
#include <memory> #include <memory>
#include <string_view> #include <string_view>
#include "../../graphics/Bitmap.hpp"
#include "../../graphics/Monochrome.hpp"
#include "../../graphics/interface/ILabel.hpp"
#include "../../libusbwrap/interface/IUsbDevice.hpp"
#include "IPrinterTypes.hpp" #include "IPrinterTypes.hpp"
#include "graphics/Bitmap.hpp"
#include "graphics/Monochrome.hpp"
#include "graphics/interface/ILabel.hpp"
#include "libusbwrap/interface/IUsbDevice.hpp"
namespace ptprnt { namespace ptprnt {
class IPrinterDriver { class IPrinterDriver {

View File

@@ -1,6 +1,6 @@
/* /*
ptrnt - print labels on linux ptrnt - print labels on linux
Copyright (C) 2023-2024 Moritz Martinius Copyright (C) 2025 Moritz Martinius
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -20,7 +20,6 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <string>
#include <string_view> #include <string_view>
#include <vector> #include <vector>

View File

View File

@@ -1,9 +1,10 @@
[wrap-file] [wrap-file]
directory = CLI11-2.3.2 directory = CLI11-2.5.0
source_url = https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.3.2.tar.gz source_url = https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.5.0.tar.gz
source_filename = CLI11-2.3.2.tar.gz source_filename = CLI11-2.5.0.tar.gz
source_hash = aac0ab42108131ac5d3344a9db0fdf25c4db652296641955720a4fbe52334e22 source_hash = 17e02b4cddc2fa348e5dbdbb582c59a3486fa2b2433e70a0c3bacb871334fd55
wrapdb_version = 2.3.2-1 source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cli11_2.5.0-2/CLI11-2.5.0.tar.gz
wrapdb_version = 2.5.0-2
[provide] [provide]
cli11 = CLI11_dep dependency_names = CLI11

View File

@@ -1,13 +1,13 @@
[wrap-file] [wrap-file]
directory = googletest-1.14.0 directory = googletest-1.17.0
source_url = https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz source_url = https://github.com/google/googletest/archive/refs/tags/v1.17.0.tar.gz
source_filename = gtest-1.14.0.tar.gz source_filename = googletest-1.17.0.tar.gz
source_hash = 8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7 source_hash = 65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c
patch_filename = gtest_1.14.0-1_patch.zip patch_filename = gtest_1.17.0-4_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.14.0-1/get_patch patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.17.0-4/get_patch
patch_hash = 2e693c7d3f9370a7aa6dac802bada0874d3198ad4cfdf75647b818f691182b50 patch_hash = 3abf7662d09db706453a5b064a1e914678c74b9d9b0b19382747ca561d0d8750
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.14.0-1/gtest-1.14.0.tar.gz source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.17.0-4/googletest-1.17.0.tar.gz
wrapdb_version = 1.14.0-1 wrapdb_version = 1.17.0-4
[provide] [provide]
gtest = gtest_dep gtest = gtest_dep

View File

@@ -36,5 +36,3 @@ foreach test : tests
), ),
) )
endforeach endforeach