/*
ptrnt - print labels on linux
Copyright (C) 2023 Moritz Martinius
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 .
*/
#pragma once
#include
#include
#include
#include "constants.hpp"
#include "interface/IPrinterDriver.hpp"
#include "libusbwrap/UsbDeviceFactory.hpp"
namespace ptprnt {
enum class CliCmdType { None = 0, Text = 1, FontSize = 2, Font = 3, VAlign = 4, HAlign = 5 };
using CliCmd = std::pair;
class PtouchPrint {
public:
PtouchPrint(const char* versionString);
~PtouchPrint() = default;
// This is basically a singelton application class, no need to copy or move
PtouchPrint(const PtouchPrint&) = delete;
PtouchPrint& operator=(const PtouchPrint&) = delete;
PtouchPrint(PtouchPrint&&) = delete;
PtouchPrint& operator=(PtouchPrint&&) = delete;
int init(int argc, char** argv);
int run();
private:
// methods
void setupLogger(spdlog::level::level_enum lvl);
void setupCliParser();
unsigned int getCompatiblePrinters();
// member variables
CLI::App mApp{ptprnt::APP_DESC};
libusbwrap::UsbDeviceFactory mUsbDeviceFactory{};
std::vector> mCompatiblePrinters{};
std::vector> mDetectedPrinters{};
std::vector mCommands{};
std::string mVersionString = "";
// CLI flags
bool mVerboseFlag = false;
};
} // namespace ptprnt