[Digikam-devel] extragear/graphics/digikam/imageplugins/coreplugin
Gilles Caulier
caulier.gilles at gmail.com
Sun Jul 8 21:29:27 BST 2007
SVN commit 685418 by cgilles:
digiKam from trunk : Port to KDE4 image editor Ratio Crop Tool.
Note: core image plugin is now fully ported to KDE4.
CCMAIL: digikam-devel at kde.org
M +2 -2 CMakeLists.txt
M +8 -12 imageplugin_core.cpp
M +24 -22 ratiocrop/imageeffect_ratiocrop.cpp
--- trunk/extragear/graphics/digikam/imageplugins/coreplugin/CMakeLists.txt #685417:685418
@@ -55,8 +55,8 @@
${CMAKE_SOURCE_DIR}/digikam/imageplugins/coreplugin/sharpnesseditor/refocus.cpp
${CMAKE_SOURCE_DIR}/digikam/imageplugins/coreplugin/sharpnesseditor/unsharp.cpp
${CMAKE_SOURCE_DIR}/digikam/imageplugins/coreplugin/sharpnesseditor/imageeffect_sharpen.cpp
-# ${CMAKE_SOURCE_DIR}/digikam/imageplugins/coreplugin/ratiocrop/imageselectionwidget.cpp
-# ${CMAKE_SOURCE_DIR}/digikam/imageplugins/coreplugin/ratiocrop/imageeffect_ratiocrop.cpp
+ ${CMAKE_SOURCE_DIR}/digikam/imageplugins/coreplugin/ratiocrop/imageselectionwidget.cpp
+ ${CMAKE_SOURCE_DIR}/digikam/imageplugins/coreplugin/ratiocrop/imageeffect_ratiocrop.cpp
)
KDE4_AUTOMOC(${digikamimageplugin_core_PART_SRCS})
--- trunk/extragear/graphics/digikam/imageplugins/coreplugin/imageplugin_core.cpp #685417:685418
@@ -89,7 +89,6 @@
connect(m_HSLAction, SIGNAL(triggered(bool) ),
this, SLOT(slotHSL()));
-
// NOTE: Photoshop 7 use CTRL+B.
m_RGBAction = new KAction(KIcon("adjustrgb"), i18n("Color Balance..."), this);
m_RGBAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_B));
@@ -126,7 +125,6 @@
connect(m_colorManagementAction, SIGNAL(triggered(bool) ),
this, SLOT(slotColorManagement()));
-
//-------------------------------
// Filters menu actions.
@@ -137,11 +135,12 @@
//-------------------------------
// Transform menu actions.
-/*
- m_aspectRatioCropAction = new KAction(i18n("Aspect Ratio Crop..."), "ratiocrop", 0,
- this, SLOT(slotRatioCrop()),
- actionCollection(), "implugcore_ratiocrop");
-*/
+
+ m_aspectRatioCropAction = new KAction(KIcon("ratiocrop"), i18n("Aspect Ratio Crop..."), this);
+ actionCollection()->addAction("implugcore_ratiocrop", m_aspectRatioCropAction );
+ connect(m_aspectRatioCropAction, SIGNAL(triggered(bool) ),
+ this, SLOT(slotRatioCrop()));
+
//-------------------------------
// Init. menu actions.
@@ -172,10 +171,7 @@
m_colorManagementAction->setEnabled(enable);
m_HSLAction->setEnabled(enable);
m_sharpenAction->setEnabled(enable);
-
-/*
m_aspectRatioCropAction->setEnabled(enable);
- */
}
void ImagePlugin_Core::slotInvert()
@@ -305,6 +301,6 @@
void ImagePlugin_Core::slotRatioCrop()
{
-/* DigikamImagesPluginCore::ImageEffect_RatioCrop dlg(parentWidget());
- dlg.exec();*/
+ DigikamImagesPluginCore::ImageEffect_RatioCrop dlg(parentWidget());
+ dlg.exec();
}
--- trunk/extragear/graphics/digikam/imageplugins/coreplugin/ratiocrop/imageeffect_ratiocrop.cpp #685417:685418
@@ -200,7 +200,7 @@
m_guideLinesCB->addItem( i18n("Harmonious Triangles") );
m_guideLinesCB->addItem( i18n("Golden Mean") );
m_guideLinesCB->addItem( i18n("None") );
- m_guideLinesCB->setCurrentItem(3);
+ m_guideLinesCB->setCurrentIndex(3);
m_guideLinesCB->setWhatsThis( i18n("<p>With this option, you can display guide lines "
"which help you to compose your photograph."));
@@ -224,7 +224,9 @@
m_colorGuideLabel = new QLabel(i18n("Color and width:"), compositionGuide);
m_guideColorBt = new KColorButton( QColor( 250, 250, 255 ), compositionGuide );
- m_guideSize = new QSpinBox( 1, 5, 1, compositionGuide);
+ m_guideSize = new QSpinBox(compositionGuide);
+ m_guideSize->setRange(1, 5);
+ m_guideSize->setSingleStep(1);
m_guideColorBt->setWhatsThis( i18n("<p>Set here the color used to draw composition guides."));
m_guideSize->setWhatsThis( i18n("<p>Set here the width in pixels used to draw composition guides."));
@@ -368,7 +370,7 @@
KConfigGroup group = config->group("aspectratiocrop Tool Dialog");
// No guide lines per default.
- m_guideLinesCB->setCurrentItem( group.readEntry("Guide Lines Type",
+ m_guideLinesCB->setCurrentIndex( group.readEntry("Guide Lines Type",
(int)ImageSelectionWidget::GuideNone) );
m_goldenSectionBox->setChecked( group.readEntry("Golden Section", true) );
m_goldenSpiralSectionBox->setChecked( group.readEntry("Golden Spiral Section", false) );
@@ -378,7 +380,7 @@
m_flipVerBox->setChecked( group.readEntry("Golden Flip Vertical", false) );
m_guideColorBt->setColor(group.readEntry("Guide Color", defaultGuideColor));
m_guideSize->setValue(group.readEntry("Guide Width", 1));
- m_imageSelectionWidget->slotGuideLines(m_guideLinesCB->currentItem());
+ m_imageSelectionWidget->slotGuideLines(m_guideLinesCB->currentIndex());
m_imageSelectionWidget->slotChangeGuideColor(m_guideColorBt->color());
if (w > h)
@@ -386,17 +388,17 @@
m_xInput->setValue( group.readEntry("Hor.Oriented Custom Aspect Ratio Xpos", 50) );
m_yInput->setValue( group.readEntry("Hor.Oriented Custom Aspect Ratio Ypos", 50) );
- m_ratioCB->setCurrentItem( group.readEntry("Hor.Oriented Aspect Ratio",
+ m_ratioCB->setCurrentIndex( group.readEntry("Hor.Oriented Aspect Ratio",
(int)ImageSelectionWidget::RATIO03X04) );
m_customRatioNInput->setValue( group.readEntry("Hor.Oriented Custom Aspect Ratio Num", 1) );
m_customRatioDInput->setValue( group.readEntry("Hor.Oriented Custom Aspect Ratio Den", 1) );
- applyRatioChanges(m_ratioCB->currentItem());
+ applyRatioChanges(m_ratioCB->currentIndex());
- m_orientCB->setCurrentItem( group.readEntry("Hor.Oriented Aspect Ratio Orientation",
+ m_orientCB->setCurrentIndex( group.readEntry("Hor.Oriented Aspect Ratio Orientation",
(int)ImageSelectionWidget::Landscape) );
- if ( m_ratioCB->currentItem() == ImageSelectionWidget::RATIONONE )
+ if ( m_ratioCB->currentIndex() == ImageSelectionWidget::RATIONONE )
{
m_widthInput->setValue( group.readEntry("Hor.Oriented Custom Aspect Ratio Width", 800) );
m_heightInput->setValue( group.readEntry("Hor.Oriented Custom Aspect Ratio Height", 600) );
@@ -407,24 +409,24 @@
m_heightInput->setValue( group.readEntry("Hor.Oriented Custom Aspect Ratio Height", 600) );
}
- m_imageSelectionWidget->setSelectionOrientation(m_orientCB->currentItem());
+ m_imageSelectionWidget->setSelectionOrientation(m_orientCB->currentIndex());
}
else
{
m_xInput->setValue( group.readEntry("Ver.Oriented Custom Aspect Ratio Xpos", 50) );
m_yInput->setValue( group.readEntry("Ver.Oriented Custom Aspect Ratio Ypos", 50) );
- m_ratioCB->setCurrentItem( group.readEntry("Ver.Oriented Aspect Ratio",
+ m_ratioCB->setCurrentIndex( group.readEntry("Ver.Oriented Aspect Ratio",
(int)ImageSelectionWidget::RATIO03X04) );
m_customRatioNInput->setValue( group.readEntry("Ver.Oriented Custom Aspect Ratio Num", 1) );
m_customRatioDInput->setValue( group.readEntry("Ver.Oriented Custom Aspect Ratio Den", 1) );
- applyRatioChanges(m_ratioCB->currentItem());
+ applyRatioChanges(m_ratioCB->currentIndex());
- m_orientCB->setCurrentItem( group.readEntry("Ver.Oriented Aspect Ratio Orientation",
+ m_orientCB->setCurrentIndex( group.readEntry("Ver.Oriented Aspect Ratio Orientation",
(int)ImageSelectionWidget::Portrait) );
- if ( m_ratioCB->currentItem() == ImageSelectionWidget::RATIONONE )
+ if ( m_ratioCB->currentIndex() == ImageSelectionWidget::RATIONONE )
{
m_widthInput->setValue( group.readEntry("Ver.Oriented Custom Aspect Ratio Width", 800) );
m_heightInput->setValue( group.readEntry("Ver.Oriented Custom Aspect Ratio Height", 600) );
@@ -435,7 +437,7 @@
m_heightInput->setValue( group.readEntry("Ver.Oriented Custom Aspect Ratio Height", 600) );
}
- m_imageSelectionWidget->setSelectionOrientation(m_orientCB->currentItem());
+ m_imageSelectionWidget->setSelectionOrientation(m_orientCB->currentIndex());
}
m_autoOrientation->setChecked( group.readEntry("Auto Orientation", false) );
@@ -453,8 +455,8 @@
if (w > h)
{
- group.writeEntry( "Hor.Oriented Aspect Ratio", m_ratioCB->currentItem() );
- group.writeEntry( "Hor.Oriented Aspect Ratio Orientation", m_orientCB->currentItem() );
+ group.writeEntry( "Hor.Oriented Aspect Ratio", m_ratioCB->currentIndex() );
+ group.writeEntry( "Hor.Oriented Aspect Ratio Orientation", m_orientCB->currentIndex() );
group.writeEntry( "Hor.Oriented Custom Aspect Ratio Num", m_customRatioNInput->value() );
group.writeEntry( "Hor.Oriented Custom Aspect Ratio Den", m_customRatioDInput->value() );
@@ -465,8 +467,8 @@
}
else
{
- group.writeEntry( "Ver.Oriented Aspect Ratio", m_ratioCB->currentItem() );
- group.writeEntry( "Ver.Oriented Aspect Ratio Orientation", m_orientCB->currentItem() );
+ group.writeEntry( "Ver.Oriented Aspect Ratio", m_ratioCB->currentIndex() );
+ group.writeEntry( "Ver.Oriented Aspect Ratio Orientation", m_orientCB->currentIndex() );
group.writeEntry( "Ver.Oriented Custom Aspect Ratio Num", m_customRatioNInput->value() );
group.writeEntry( "Ver.Oriented Custom Aspect Ratio Den", m_customRatioDInput->value() );
@@ -477,7 +479,7 @@
}
group.writeEntry( "Auto Orientation", m_autoOrientation->isChecked() );
- group.writeEntry( "Guide Lines Type", m_guideLinesCB->currentItem() );
+ group.writeEntry( "Guide Lines Type", m_guideLinesCB->currentIndex() );
group.writeEntry( "Golden Section", m_goldenSectionBox->isChecked() );
group.writeEntry( "Golden Spiral Section", m_goldenSpiralSectionBox->isChecked() );
group.writeEntry( "Golden Spiral", m_goldenSpiralBox->isChecked() );
@@ -556,7 +558,7 @@
void ImageEffect_RatioCrop::slotSelectionOrientationChanged(int newOrientation)
{
- m_orientCB->setCurrentItem(newOrientation);
+ m_orientCB->setCurrentIndex(newOrientation);
}
void ImageEffect_RatioCrop::slotXChanged(int x)
@@ -700,7 +702,7 @@
void ImageEffect_RatioCrop::slotGoldenGuideTypeChanged(void)
{
- slotGuideTypeChanged(m_guideLinesCB->currentItem());
+ slotGuideTypeChanged(m_guideLinesCB->currentIndex());
}
void ImageEffect_RatioCrop::slotCustomRatioChanged(void)
@@ -724,7 +726,7 @@
bool a = iface->originalHasAlpha();
bool sb = iface->originalSixteenBit();
- QRect normalizedRegion = currentRegion.normalize();
+ QRect normalizedRegion = currentRegion.normalized();
if (normalizedRegion.right() > w) normalizedRegion.setRight(w);
if (normalizedRegion.bottom() > h) normalizedRegion.setBottom(h);
More information about the Digikam-devel
mailing list