/*
 * Copyright (C) 2025 UBports Foundation
 *
 * Authors:
 *    Alfred Neumayer <dev.beidl@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 3, as published
 * by the Free Software Foundation.
 *
 * This library 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 Lesser 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/>.
 */

#include "printinghelper.h"
#include <QtDebug>
#include <glib.h>

PrintingHelper::PrintingHelper(QObject *parent) : QObject(parent)
{
    // Display a setup screen on Ubuntu Touch, should CUPS not already be installed
    bool cupsViaSnap = false;
    const auto distro_id = std::string(g_get_os_info("ID"));
    const auto distro_variant = std::string(g_get_os_info("VARIANT_ID"));
    qDebug() << "Distribution:" << QString::fromStdString(distro_id)
                                << QString::fromStdString(distro_variant);
    if (distro_id == "ubuntu" && distro_variant == "touch") {
        cupsViaSnap = true;
    }

    this->m_useCupsSnap = cupsViaSnap;
}

bool PrintingHelper::useCupsSnap()
{
    return this->m_useCupsSnap;
}

