/* ============================================================ * The rekonq project * ============================================================ * SPDX-License-Identifier: GPL-3.0-only * Copyright (C) 2022 aqua * ============================================================ */ #include "rview_fake.h" #include "ui_rview_fake.h" #include RekonqView_fake::RekonqView_fake(QWidget *parent) : RekonqView(QUrl(), parent), ui(new Ui::RekonqView_fake) { ui->setupUi(this); connect(ui->progress, &QSlider::valueChanged, this, [this](int value) { switch (value) { case 1: emit loadStarted(); spdlog::debug("RekonqView_fake loadStarted"); break; case 0: case 100: emit loadFinished(); spdlog::debug("RekonqView_fake loadFinished"); break; default: emit loadProgress(value); break; } }); connect(ui->setTitle, &QToolButton::clicked, this, [this]() { emit titleChanged(ui->title->text()); }); connect(ui->setUrl, &QToolButton::clicked, this, [this]() { emit urlChanged(QUrl(ui->url->text())); }); } RekonqView_fake::~RekonqView_fake() { delete ui; } void RekonqView_fake::load(const QUrl &url) { ui->url->setText(url.toString()); spdlog::debug("{} url={}", __PRETTY_FUNCTION__, qUtf8Printable(url.toString())); } int RekonqView_fake::progress() const { spdlog::debug("{} -> {}", __PRETTY_FUNCTION__, ui->progress->value()); return ui->progress->value(); } QIcon RekonqView_fake::icon() const { spdlog::debug("{} -> empty QIcon", __PRETTY_FUNCTION__); return {}; } QString RekonqView_fake::title() const { spdlog::debug("{} -> {}", __PRETTY_FUNCTION__, qUtf8Printable(ui->title->text())); return ui->title->text(); } QUrl RekonqView_fake::url() const { spdlog::debug("{} -> {}", __PRETTY_FUNCTION__, qUtf8Printable(ui->url->text())); return {ui->url->text()}; }