File indexing completed on 2025-03-09 03:50:36
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2004-12-06 0007 * Description : digiKam image editor Ratio Crop tool 0008 * 0009 * SPDX-FileCopyrightText: 2007 by Jaromir Malenko <malenko at email dot cz> 0010 * SPDX-FileCopyrightText: 2008 by Roberto Castagnola <roberto dot castagnola at gmail dot com> 0011 * SPDX-FileCopyrightText: 2004-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_EDITOR_RATIO_CROP_TOOL_H 0018 #define DIGIKAM_EDITOR_RATIO_CROP_TOOL_H 0019 0020 // Qt includes 0021 0022 #include <QRect> 0023 0024 // Local includes 0025 0026 #include "editortool.h" 0027 0028 using namespace Digikam; 0029 0030 namespace DigikamEditorRatioCropToolPlugin 0031 { 0032 0033 class RatioCropTool : public EditorTool 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 0039 explicit RatioCropTool(QObject* const parent); 0040 ~RatioCropTool() override; 0041 0042 private: 0043 0044 void readSettings() override; 0045 void writeSettings() override; 0046 0047 void finalRendering() override; 0048 void updateCropInfo(); 0049 void applyRatioChanges(int a); 0050 void blockWidgetSignals(bool b); 0051 void setRatioCBText(int orientation); 0052 void setInputRange(const QRect& rect); 0053 void setBackgroundColor(const QColor& bg) override; 0054 QRect getNormalizedRegion() const; 0055 0056 private Q_SLOTS: 0057 0058 void slotMaxAspectRatio(); 0059 void slotResetSelection(); 0060 void slotResetSettings() override; 0061 0062 void slotCenterWidth(); 0063 void slotCenterHeight(); 0064 void slotXChanged(int x); 0065 void slotYChanged(int y); 0066 void slotWidthChanged(int w); 0067 void slotHeightChanged(int h); 0068 void slotCustomRatioChanged(); 0069 void slotCustomNRatioChanged(int a); 0070 void slotCustomDRatioChanged(int a); 0071 void slotPreciseCropChanged(bool a); 0072 void slotOrientChanged(int o); 0073 void slotAutoOrientChanged(bool a); 0074 void slotRatioChanged(int a); 0075 void slotSelectionChanged(const QRect&); 0076 void slotSelectionOrientationChanged(int); 0077 void slotGuideTypeChanged(int t); 0078 void slotGoldenGuideTypeChanged(); 0079 0080 private: 0081 0082 class Private; 0083 Private* const d; 0084 }; 0085 0086 } // namespace DigikamEditorRatioCropToolPlugin 0087 0088 #endif // DIGIKAM_EDITOR_RATIO_CROP_TOOL_H