File indexing completed on 2025-01-26 04:10:33

0001 /*
0002  *  dlg_shearimage.cc - part of KimageShop^WKrayon^WKrita
0003  *
0004  *  SPDX-FileCopyrightText: 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
0005  *
0006  *  SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #include "dlg_shearimage.h"
0010 
0011 #include <math.h>
0012 
0013 #include <klocalizedstring.h>
0014 #include <kis_debug.h>
0015 
0016 DlgShearImage::DlgShearImage(QWidget *  parent,
0017                              const char * name)
0018         : KoDialog(parent)
0019 {
0020     setCaption(i18n("Shear Image"));
0021     setButtons(Ok | Cancel);
0022     setDefaultButton(Ok);
0023     setObjectName(name);
0024 
0025     m_lock = false;
0026 
0027     m_page = new WdgShearImage(this);
0028     Q_CHECK_PTR(m_page);
0029     m_page->layout()->setMargin(0);
0030     m_page->setObjectName("shear_image");
0031     
0032     m_page->shearAngleX->setDecimals(0);
0033     m_page->shearAngleX->setRange(-45, 45);
0034     m_page->shearAngleX->setWrapping(false);
0035     m_page->shearAngleX->setFlipOptionsMode(KisAngleSelector::FlipOptionsMode_NoFlipOptions);
0036     m_page->shearAngleY->setDecimals(0);
0037     m_page->shearAngleY->setRange(-45, 45);
0038     m_page->shearAngleY->setWrapping(false);
0039     m_page->shearAngleY->setFlipOptionsMode(KisAngleSelector::FlipOptionsMode_NoFlipOptions);
0040 
0041     setMainWidget(m_page);
0042     resize(m_page->sizeHint());
0043 
0044     connect(this, SIGNAL(okClicked()),
0045             this, SLOT(okClicked()));
0046 
0047 }
0048 
0049 DlgShearImage::~DlgShearImage()
0050 {
0051     delete m_page;
0052 }
0053 
0054 void DlgShearImage::setAngleX(quint32 angle)
0055 {
0056     m_page->shearAngleX->setAngle(angle);
0057     m_oldAngle = angle;
0058 
0059 }
0060 
0061 void DlgShearImage::setAngleY(quint32 angle)
0062 {
0063     m_page->shearAngleY->setAngle(angle);
0064     m_oldAngle = angle;
0065 
0066 }
0067 
0068 qint32 DlgShearImage::angleX()
0069 {
0070     return static_cast<qint32>(m_page->shearAngleX->angle());
0071 }
0072 
0073 qint32 DlgShearImage::angleY()
0074 {
0075     return static_cast<qint32>(m_page->shearAngleY->angle());
0076 }
0077 
0078 // SLOTS
0079 
0080 void DlgShearImage::okClicked()
0081 {
0082     accept();
0083 }
0084