diff options
author | Michele Calgaro <[email protected]> | 2021-05-23 20:48:35 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2021-05-29 15:17:38 +0900 |
commit | d63c9d696eb6e2539528b99afc21f4086c9defe3 (patch) | |
tree | b3bfc97a66431a12cdd8f9379c0072673ede43df /chalk/plugins/viewplugins/dropshadow/dlg_dropshadow.cpp | |
parent | 5363fe3c36504c37bdc6dcfafd5f71daeae251e8 (diff) | |
download | koffice-d63c9d696eb6e2539528b99afc21f4086c9defe3.tar.gz koffice-d63c9d696eb6e2539528b99afc21f4086c9defe3.zip |
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <[email protected]>
(cherry picked from commit 8b78a8791bc539bcffe7159f9d9714d577cb3d7d)
Diffstat (limited to 'chalk/plugins/viewplugins/dropshadow/dlg_dropshadow.cpp')
-rw-r--r-- | chalk/plugins/viewplugins/dropshadow/dlg_dropshadow.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/chalk/plugins/viewplugins/dropshadow/dlg_dropshadow.cpp b/chalk/plugins/viewplugins/dropshadow/dlg_dropshadow.cpp new file mode 100644 index 00000000..c82bbbad --- /dev/null +++ b/chalk/plugins/viewplugins/dropshadow/dlg_dropshadow.cpp @@ -0,0 +1,117 @@ +/* + * dlg_dropshadow.cpp - part of KimageShop^WKrayon^WChalk + * + * Copyright (c) 2005 Michael Thaler <[email protected]> + * Copyright (c) 2006 Cyrille Berger <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <tqbutton.h> +#include <tqbuttongroup.h> +#include <tqcheckbox.h> +#include <tqcolor.h> +#include <tqcombobox.h> +#include <tqlabel.h> +#include <tqradiobutton.h> +#include <tqslider.h> + +#include <kcolorbutton.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <tdelocale.h> +#include <knuminput.h> + +#include "dlg_dropshadow.h" +#include "wdg_dropshadow.h" + +DlgDropshadow::DlgDropshadow( const TQString & /*imageCS*/, + const TQString & /*layerCS*/, + TQWidget * parent, + const char * name) + : super (parent, name, true, i18n("Drop Shadow"), Ok | Cancel, Ok) +{ + m_page = new WdgDropshadow(this, "dropshadow"); + TQ_CHECK_PTR(m_page); + setMainWidget(m_page); + resize(m_page->sizeHint()); + + TDEConfig * cfg = TDEGlobal::config(); + m_page->xOffsetSpinBox->setValue( cfg->readNumEntry("dropshadow_x", 8) ); + m_page->yOffsetSpinBox->setValue( cfg->readNumEntry("dropshadow_y", 8) ); + m_page->blurRadiusSpinBox->setValue( cfg->readNumEntry("dropshadow_blurRadius", 5) ); + TQColor black(0,0,0); + m_page->shadowColorButton->setColor( cfg->readColorEntry("dropshadow_color", &black) ); + m_page->opacitySlider->setValue( cfg->readNumEntry("dropshadow_opacity", 80 ) ); + m_page->opacitySpinBox->setValue( cfg->readNumEntry("dropshadow_opacity", 80 ) ); + m_page->allowResizingCheckBox->setChecked( cfg->readBoolEntry("dropshadow_resizing", true ) ); + + connect(this, TQT_SIGNAL(okClicked()), + this, TQT_SLOT(okClicked())); +} + +DlgDropshadow::~DlgDropshadow() +{ + delete m_page; +} + +TQ_INT32 DlgDropshadow::getXOffset() +{ + return m_page->xOffsetSpinBox->value(); +} + +TQ_INT32 DlgDropshadow::getYOffset() +{ + return m_page->yOffsetSpinBox->value(); +} + +TQ_INT32 DlgDropshadow::getBlurRadius() +{ + return m_page->blurRadiusSpinBox->value(); +} + +TQ_UINT8 DlgDropshadow::getShadowOpacity() +{ + double opacity = (double)m_page->opacitySpinBox->value(); + //convert percent to a 8 bit opacity value + return (TQ_UINT8)(opacity / 100 * 255); +} + +TQColor DlgDropshadow::getShadowColor() +{ + return m_page->shadowColorButton->color(); +} + +bool DlgDropshadow::allowResizingChecked() +{ + return m_page->allowResizingCheckBox->isChecked(); +} + +// SLOTS + +void DlgDropshadow::okClicked() +{ + TDEConfig * cfg = TDEGlobal::config(); + cfg->writeEntry("dropshadow_x", m_page->xOffsetSpinBox->value()); + cfg->writeEntry("dropshadow_y", m_page->yOffsetSpinBox->value()); + cfg->writeEntry("dropshadow_blurRadius", m_page->blurRadiusSpinBox->value()); + cfg->writeEntry("dropshadow_color", m_page->shadowColorButton->color()); + cfg->writeEntry("dropshadow_opacity", m_page->opacitySpinBox->value()); + cfg->writeEntry("dropshadow_resizing", m_page->allowResizingCheckBox->isChecked()); + + accept(); +} + +#include "dlg_dropshadow.moc" |