File indexing completed on 2025-01-19 03:51:13

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2004-11-28
0007  * Description : a digiKam image editor tool to process image
0008  *               free rotation.
0009  *
0010  * SPDX-FileCopyrightText: 2004-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2009-2010 by Andi Clemens <andi dot clemens at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_EDITOR_FREE_ROTATION_TOOL_H
0018 #define DIGIKAM_EDITOR_FREE_ROTATION_TOOL_H
0019 
0020 // Local includes
0021 
0022 #include "editortool.h"
0023 
0024 class QPixmap;
0025 class QString;
0026 
0027 using namespace Digikam;
0028 
0029 namespace DigikamEditorFreeRotationToolPlugin
0030 {
0031 
0032 class FreeRotationTool : public EditorToolThreaded
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037 
0038     explicit FreeRotationTool(QObject* const parent);
0039     ~FreeRotationTool()         override;
0040 
0041 public Q_SLOTS:
0042 
0043     void slotAutoAdjustP1Clicked();
0044     void slotAutoAdjustP2Clicked();
0045     void slotAutoAdjustClicked();
0046 
0047 private Q_SLOTS:
0048 
0049     void slotResetSettings()    override;
0050     void slotColorGuideChanged();
0051 
0052 private:
0053 
0054     void readSettings()         override;
0055     void writeSettings()        override;
0056     void preparePreview()       override;
0057     void prepareFinal()         override;
0058     void setPreviewImage()      override;
0059     void setFinalImage()        override;
0060 
0061     QString centerString(const QString& str, int maxLength = -1)         const;
0062     QString repeatString(const QString& str, int times)                  const;
0063     QPixmap generateBtnPixmap(const QString& label, const QColor& color) const;
0064     QString generateButtonLabel(const QPoint& p)                         const;
0065     double  calculateAutoAngle()                                         const;
0066     bool    pointIsValid(const QPoint& p)                                const;
0067     void    setPointInvalid(QPoint& p);
0068     void    updatePoints();
0069     void    resetPoints();
0070 
0071 private:
0072 
0073     class Private;
0074     Private* const d;
0075 };
0076 
0077 } // namespace DigikamEditorFreeRotationToolPlugin
0078 
0079 #endif // DIGIKAM_EDITOR_FREE_ROTATION_TOOL_H