From 8477ffbfba2f15edb9f87e9336e2c4599000c32a Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 25 Sep 2024 12:16:30 -0500 Subject: Moving forward. --- src/bookmouse_old.cpp | 106 -------------------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 src/bookmouse_old.cpp (limited to 'src/bookmouse_old.cpp') diff --git a/src/bookmouse_old.cpp b/src/bookmouse_old.cpp deleted file mode 100644 index 9ba09c4..0000000 --- a/src/bookmouse_old.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "bookmouse.hpp" -#include "main_window.hpp" - -namespace bookmouse { - -Bookmouse::Bookmouse() -{ - m_layout = new QVBoxLayout(); - - m_layout->addWidget(&m_pageLeft); - m_layout->addWidget(&m_pageRight); - - setLayout(m_layout); -} - -void Bookmouse::setArchive(Archive* archive) { - if (archive == m_archive) { - return; - } - delete(m_archive); - m_archive = archive; - m_pageNumber = 0; - setPages(); -} - -void Bookmouse::next() { - auto numPages = m_archive->numPages(); - size_t increment = 1; - if (m_pageLayout != PageLayout::Single) { - increment = 2; - } - if ((m_pageNumber + increment) >= numPages) - { - return; - } - m_pageNumber += increment; - setPages(); -} - -void Bookmouse::back() { - auto numPages = m_archive->numPages(); - size_t decrement = 1; - if (m_pageLayout != PageLayout::Single) { - decrement = 2; - } - if (m_pageNumber < decrement) - { - m_pageNumber = 0; - decrement = 0; - } - m_pageNumber -= decrement; - setPages(); -} - -void Bookmouse::setPages() { - m_pageLeft.setPixmap(QPixmap()); - m_pageRight.setPixmap(QPixmap()); - - switch (m_pageLayout) - { - case PageLayout::Dual: - return setPagesDual(); - case PageLayout::Manga: - return setPagesManga(); - case PageLayout::Single: - default: - return setPagesNormal(); - } -} - -void Bookmouse::setPagesNormal() { - auto page1 = m_archive->getPage(m_pageNumber); - auto& label1 = m_pageLeft; - - if (page1.isOkay()) { - label1.setPixmap(QPixmap::fromImage(page1.getOkay())); - } -} - -void Bookmouse::setPagesDual() { - auto& label1 = m_pageLeft; - auto& label2 = m_pageRight; - setPages(label1, label2); -} - -void Bookmouse::setPagesManga() { - auto& label1 = m_pageRight; - auto& label2 = m_pageLeft; - setPages(label1, label2); -} - -void Bookmouse::setPages(QLabel& label1, QLabel& label2) { - auto page1 = m_archive->getPage(m_pageNumber); - auto page2 = m_archive->getPage(m_pageNumber + 1); - - if (page1.isOkay()) { - label1.setPixmap(QPixmap::fromImage(page1.getOkay())); - } - - - if (page2.isOkay()) { - label2.setPixmap(QPixmap::fromImage(page1.getOkay())); - } -} - -} // namespace bookmouse -- cgit v1.2.3