| 1 | /* |
| 2 | * Copyright (C) 2020 Damir Porobic <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | #include "KImageAnnotatorAdapter.h" |
| 21 | |
| 22 | KImageAnnotatorAdapter::KImageAnnotatorAdapter() : |
| 23 | mKImageAnnotator(new KImageAnnotator) |
| 24 | { |
| 25 | connect(mKImageAnnotator, &KImageAnnotator::imageChanged, this, &KImageAnnotatorAdapter::imageChanged); |
| 26 | connect(mKImageAnnotator, &KImageAnnotator::currentTabChanged, this, &KImageAnnotatorAdapter::currentTabChanged); |
| 27 | connect(mKImageAnnotator, &KImageAnnotator::tabCloseRequested, this, &KImageAnnotatorAdapter::tabCloseRequested); |
| 28 | connect(mKImageAnnotator, &KImageAnnotator::tabMoved, this, &KImageAnnotatorAdapter::tabMoved); |
| 29 | connect(mKImageAnnotator, &KImageAnnotator::tabContextMenuOpened, this, &KImageAnnotatorAdapter::tabContextMenuOpened); |
| 30 | } |
| 31 | |
| 32 | KImageAnnotatorAdapter::~KImageAnnotatorAdapter() |
| 33 | { |
| 34 | delete mKImageAnnotator; |
| 35 | } |
| 36 | |
| 37 | QImage KImageAnnotatorAdapter::image() const |
| 38 | { |
| 39 | return mKImageAnnotator->image(); |
| 40 | } |
| 41 | |
| 42 | QImage KImageAnnotatorAdapter::imageAt(int index) const |
| 43 | { |
| 44 | return mKImageAnnotator->imageAt(index); |
| 45 | } |
| 46 | |
| 47 | QAction *KImageAnnotatorAdapter::undoAction() |
| 48 | { |
| 49 | return mKImageAnnotator->undoAction(); |
| 50 | } |
| 51 | |
| 52 | QAction *KImageAnnotatorAdapter::redoAction() |
| 53 | { |
| 54 | return mKImageAnnotator->redoAction(); |
| 55 | } |
| 56 | |
| 57 | QSize KImageAnnotatorAdapter::sizeHint() const |
| 58 | { |
| 59 | return mKImageAnnotator->sizeHint(); |
| 60 | } |
| 61 | |
| 62 | void KImageAnnotatorAdapter::showAnnotator() |
| 63 | { |
| 64 | mKImageAnnotator->showAnnotator(); |
| 65 | } |
| 66 | |
| 67 | void KImageAnnotatorAdapter::showCropper() |
| 68 | { |
| 69 | mKImageAnnotator->showCropper(); |
| 70 | } |
| 71 | |
| 72 | void KImageAnnotatorAdapter::showScaler() |
| 73 | { |
| 74 | mKImageAnnotator->showScaler(); |
| 75 | } |
| 76 | |
| 77 | void KImageAnnotatorAdapter::setSettingsCollapsed(bool isCollapsed) |
| 78 | { |
| 79 | mKImageAnnotator->setSettingsCollapsed(isCollapsed); |
| 80 | } |
| 81 | |
| 82 | void KImageAnnotatorAdapter::hide() |
| 83 | { |
| 84 | mKImageAnnotator->hide(); |
| 85 | } |
| 86 | |
| 87 | void KImageAnnotatorAdapter::close() |
| 88 | { |
| 89 | mKImageAnnotator->close(); |
| 90 | } |
| 91 | |
| 92 | bool KImageAnnotatorAdapter::isVisible() const |
| 93 | { |
| 94 | return mKImageAnnotator->isVisible(); |
| 95 | } |
| 96 | |
| 97 | QWidget *KImageAnnotatorAdapter::widget() const |
| 98 | { |
| 99 | return mKImageAnnotator; |
| 100 | } |
| 101 | |
| 102 | void KImageAnnotatorAdapter::loadImage(const QPixmap &pixmap) |
| 103 | { |
| 104 | mKImageAnnotator->loadImage(pixmap); |
| 105 | } |
| 106 | |
| 107 | int KImageAnnotatorAdapter::addTab(const QPixmap &pixmap, const QString &title, const QString &toolTip) |
| 108 | { |
| 109 | return mKImageAnnotator->addTab(pixmap, title, toolTip); |
| 110 | } |
| 111 | |
| 112 | void KImageAnnotatorAdapter::updateTabInfo(int index, const QString &title, const QString &toolTip) |
| 113 | { |
| 114 | mKImageAnnotator->updateTabInfo(index, title, toolTip); |
| 115 | } |
| 116 | |
| 117 | void KImageAnnotatorAdapter::insertImageItem(const QPointF &position, const QPixmap &pixmap) |
| 118 | { |
| 119 | mKImageAnnotator->insertImageItem(position, pixmap); |
| 120 | } |
| 121 | |
| 122 | void KImageAnnotatorAdapter::setSmoothPathEnabled(bool enabled) |
| 123 | { |
| 124 | mKImageAnnotator->setSmoothPathEnabled(enabled); |
| 125 | } |
| 126 | |
| 127 | void KImageAnnotatorAdapter::setSaveToolSelection(bool enabled) |
| 128 | { |
| 129 | mKImageAnnotator->setSaveToolSelection(enabled); |
| 130 | } |
| 131 | |
| 132 | void KImageAnnotatorAdapter::setSmoothFactor(int factor) |
| 133 | { |
| 134 | mKImageAnnotator->setSmoothFactor(factor); |
| 135 | } |
| 136 | |
| 137 | void KImageAnnotatorAdapter::setSwitchToSelectToolAfterDrawingItem(bool enabled) |
| 138 | { |
| 139 | mKImageAnnotator->setSwitchToSelectToolAfterDrawingItem(enabled); |
| 140 | } |
| 141 | |
| 142 | void KImageAnnotatorAdapter::setSelectItemAfterDrawing(bool enabled) |
| 143 | { |
| 144 | mKImageAnnotator->setSelectItemAfterDrawing(enabled); |
| 145 | } |
| 146 | |
| 147 | void KImageAnnotatorAdapter::setNumberToolSeedChangeUpdatesAllItems(bool enabled) |
| 148 | { |
| 149 | mKImageAnnotator->setNumberToolSeedChangeUpdatesAllItems(enabled); |
| 150 | } |
| 151 | |
| 152 | void KImageAnnotatorAdapter::setTabBarAutoHide(bool enabled) |
| 153 | { |
| 154 | mKImageAnnotator->setTabBarAutoHide(enabled); |
| 155 | } |
| 156 | |
| 157 | void KImageAnnotatorAdapter::removeTab(int index) |
| 158 | { |
| 159 | mKImageAnnotator->removeTab(index); |
| 160 | } |
| 161 | |
| 162 | void KImageAnnotatorAdapter::setStickers(const QStringList &stickerPaths, bool keepDefault) |
| 163 | { |
| 164 | mKImageAnnotator->setStickers(stickerPaths, keepDefault); |
| 165 | } |
| 166 | |
| 167 | void KImageAnnotatorAdapter::addTabContextMenuActions(const QList<QAction *> &actions) |
| 168 | { |
| 169 | mKImageAnnotator->addTabContextMenuActions(actions); |
| 170 | } |
| 171 | |
| 172 | void KImageAnnotatorAdapter::showCanvasModifier() |
| 173 | { |
| 174 | mKImageAnnotator->showCanvasModifier(); |
| 175 | } |
| 176 | |
| 177 | void KImageAnnotatorAdapter::showRotator() |
| 178 | { |
| 179 | mKImageAnnotator->showRotator(); |
| 180 | } |
| 181 | |
| 182 | void KImageAnnotatorAdapter::showCutter() |
| 183 | { |
| 184 | mKImageAnnotator->showCutter(); |
| 185 | } |
| 186 | |
| 187 | void KImageAnnotatorAdapter::setCanvasColor(const QColor &color) |
| 188 | { |
| 189 | mKImageAnnotator->setCanvasColor(color); |
| 190 | } |
| 191 | |
| 192 | void KImageAnnotatorAdapter::setControlsWidgetVisible(bool isVisible) |
| 193 | { |
| 194 | mKImageAnnotator->setControlsWidgetVisible(isVisible); |
| 195 | } |