[Digikam-devel] extragear/graphics/digikam/imageplugins/border
Gilles Caulier
caulier.gilles at gmail.com
Thu Jul 5 10:09:35 BST 2007
SVN commit 683761 by cgilles:
digiKam from trunk: complete KDE4 port of Border imageplugin
CCMAIL: digikam-devel at kde.org
M +11 -18 CMakeLists.txt
M +3 -3 border.cpp
M +3 -3 border.h
M +44 -49 imageeffect_border.cpp
M +1 -3 imageeffect_border.h
M +3 -2 imageplugin_border.cpp
M +1 -3 imageplugin_border.h
--- trunk/extragear/graphics/digikam/imageplugins/border/CMakeLists.txt #683760:683761
@@ -1,25 +1,18 @@
-add_subdirectory( patterns )
+ADD_SUBDIRECTORY( patterns )
-include_directories( ${CMAKE_SOURCE_DIR}/digikam/utilities/imageeditor/editor ${CMAKE_SOURCE_DIR}/digikam/utilities/imageeditor/canvas ${CMAKE_SOURCE_DIR}/digikam/libs/histogram ${CMAKE_SOURCE_DIR}/digikam/libs/levels ${CMAKE_SOURCE_DIR}/digikam/libs/curves ${CMAKE_SOURCE_DIR}/digikam/libs/whitebalance ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/common ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/iccprofiles ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/imageplugins ${CMAKE_SOURCE_DIR}/digikam/libs/dialogs ${CMAKE_SOURCE_DIR}/digikam/libs/dimg ${CMAKE_SOURCE_DIR}/digikam/libs/dmetadata ${CMAKE_SOURCE_DIR}/digikam/libs/dimg/filters ${CMAKE_SOURCE_DIR}/digikam/digikam )
+SET(digikamimageplugin_border_PART_SRCS imageplugin_border.cpp
+ imageeffect_border.cpp
+ border.cpp
+ )
+KDE4_AUTOMOC(${digikamimageplugin_border_PART_SRCS})
-########### next target ###############
+KDE4_ADD_PLUGIN(digikamimageplugin_border ${digikamimageplugin_border_PART_SRCS})
-set(digikamimageplugin_border_PART_SRCS imageplugin_border.cpp imageeffect_border.cpp border.cpp )
+TARGET_LINK_LIBRARIES(digikamimageplugin_border digikam)
+INSTALL(TARGETS digikamimageplugin_border DESTINATION ${PLUGIN_INSTALL_DIR})
-kde4_automoc(${digikamimageplugin_border_PART_SRCS})
-
-kde4_add_plugin(digikamimageplugin_border ${digikamimageplugin_border_PART_SRCS})
-
-target_link_libraries(digikamimageplugin_border digikam )
-
-install(TARGETS digikamimageplugin_border DESTINATION ${PLUGIN_INSTALL_DIR} )
-
-
-########### install files ###############
-
-install( FILES digikamimageplugin_border_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam )
-install( FILES digikamimageplugin_border.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
+INSTALL(FILES digikamimageplugin_border_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam)
+install(FILES digikamimageplugin_border.desktop DESTINATION ${SERVICES_INSTALL_DIR})
--- trunk/extragear/graphics/digikam/imageplugins/border/border.cpp #683760:683761
@@ -29,9 +29,9 @@
// Qt includes.
-#include <qpoint.h>
-#include <qregion.h>
-#include <q3pointarray.h>
+#include <Q3PointArray>
+#include <QPoint>
+#include <QRegion>
// Local includes.
--- trunk/extragear/graphics/digikam/imageplugins/border/border.h #683760:683761
@@ -27,9 +27,9 @@
// Qt includes.
-#include <qstring.h>
-#include <qcolor.h>
-#include <qimage.h>
+#include <QString>
+#include <QColor>
+#include <QImage>
// Digikam includes.
--- trunk/extragear/graphics/digikam/imageplugins/border/imageeffect_border.cpp #683760:683761
@@ -25,14 +25,11 @@
// Qt includes.
-#include <qlabel.h>
+#include <QLabel>
+#include <QComboBox>
+#include <QCheckBox>
+#include <QGridLayout>
-#include <qlayout.h>
-#include <qcombobox.h>
-#include <qcheckbox.h>
-//Added by qt3to4:
-#include <Q3GridLayout>
-
// KDE includes.
#include <kseparator.h>
@@ -89,33 +86,32 @@
// -------------------------------------------------------------
- QWidget *gboxSettings = new QWidget(this);
- setMainWidget(gboxSettings);
- Q3GridLayout* gridSettings = new Q3GridLayout(gboxSettings, 10, 2, spacingHint());
+ QWidget *gboxSettings = new QWidget(mainWidget());
+ QGridLayout* gridSettings = new QGridLayout(gboxSettings);
QLabel *label1 = new QLabel(i18n("Type:"), gboxSettings);
- m_borderType = new QComboBox( false, gboxSettings );
- m_borderType->insertItem( i18n("Solid") );
- // Niepce is Real name. This is the first guy in the world to have built a camera.
- m_borderType->insertItem( "Niepce" );
- m_borderType->insertItem( i18n("Beveled") );
- m_borderType->insertItem( i18n("Decorative Pine") );
- m_borderType->insertItem( i18n("Decorative Wood") );
- m_borderType->insertItem( i18n("Decorative Paper") );
- m_borderType->insertItem( i18n("Decorative Parquet") );
- m_borderType->insertItem( i18n("Decorative Ice") );
- m_borderType->insertItem( i18n("Decorative Leaf") );
- m_borderType->insertItem( i18n("Decorative Marble") );
- m_borderType->insertItem( i18n("Decorative Rain") );
- m_borderType->insertItem( i18n("Decorative Craters") );
- m_borderType->insertItem( i18n("Decorative Dried") );
- m_borderType->insertItem( i18n("Decorative Pink") );
- m_borderType->insertItem( i18n("Decorative Stone") );
- m_borderType->insertItem( i18n("Decorative Chalk") );
- m_borderType->insertItem( i18n("Decorative Granite") );
- m_borderType->insertItem( i18n("Decorative Rock") );
- m_borderType->insertItem( i18n("Decorative Wall") );
+ m_borderType = new QComboBox( gboxSettings );
+ m_borderType->addItem( i18n("Solid") );
+ // NOTE: Niepce is Real name. This is the first guy in the world to have built a camera.
+ m_borderType->addItem( "Niepce" );
+ m_borderType->addItem( i18n("Beveled") );
+ m_borderType->addItem( i18n("Decorative Pine") );
+ m_borderType->addItem( i18n("Decorative Wood") );
+ m_borderType->addItem( i18n("Decorative Paper") );
+ m_borderType->addItem( i18n("Decorative Parquet") );
+ m_borderType->addItem( i18n("Decorative Ice") );
+ m_borderType->addItem( i18n("Decorative Leaf") );
+ m_borderType->addItem( i18n("Decorative Marble") );
+ m_borderType->addItem( i18n("Decorative Rain") );
+ m_borderType->addItem( i18n("Decorative Craters") );
+ m_borderType->addItem( i18n("Decorative Dried") );
+ m_borderType->addItem( i18n("Decorative Pink") );
+ m_borderType->addItem( i18n("Decorative Stone") );
+ m_borderType->addItem( i18n("Decorative Chalk") );
+ m_borderType->addItem( i18n("Decorative Granite") );
+ m_borderType->addItem( i18n("Decorative Rock") );
+ m_borderType->addItem( i18n("Decorative Wall") );
m_borderType->setWhatsThis( i18n("<p>Select here the border type to add around the image."));
KSeparator *line1 = new KSeparator(Qt::Horizontal, gboxSettings);
@@ -125,9 +121,9 @@
m_preserveAspectRatio = new QCheckBox(gboxSettings);
m_preserveAspectRatio->setText(i18n("Preserve Aspect Ratio"));
m_preserveAspectRatio->setWhatsThis( i18n("Enable this option if you want to preserve aspect "
- "ratio of image. If enabled, the border width will be "
- "in percent of image size, else the border width will "
- "in pixels."));
+ "ratio of image. If enabled, the border width will be "
+ "in percent of image size, else the border width will "
+ "in pixels."));
m_labelBorderPercent = new QLabel(i18n("Width (%):"), gboxSettings);
m_borderPercent = new KIntNumInput(gboxSettings);
@@ -171,6 +167,8 @@
gridSettings->addMultiCellWidget(m_firstColorButton, 9, 9, 1, 2);
gridSettings->addMultiCellWidget(m_labelBackground, 10, 10, 0, 0);
gridSettings->addMultiCellWidget(m_secondColorButton, 10, 10, 1, 2);
+ gridSettings->setMargin(spacingHint());
+ gridSettings->setSpacing(spacingHint());
setUserAreaWidget(gboxSettings);
@@ -211,7 +209,7 @@
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group = config->group("border Tool Dialog");
- m_borderType->setCurrentItem(group.readEntry("Border Type",(int)Border::SolidBorder));
+ m_borderType->setCurrentIndex(group.readEntry("Border Type",(int)Border::SolidBorder));
m_borderPercent->setValue(group.readEntry("Border Percent", 10) );
m_borderWidth->setValue(group.readEntry("Border Width", 100) );
m_preserveAspectRatio->setChecked(group.readEntry("Preserve Aspect Ratio", true) );
@@ -236,7 +234,7 @@
m_secondColorButton->blockSignals(false);
m_preserveAspectRatio->blockSignals(false);
- slotBorderTypeChanged(m_borderType->currentItem());
+ slotBorderTypeChanged(m_borderType->currentIndex());
}
void ImageEffect_Border::writeUserSettings(void)
@@ -244,7 +242,7 @@
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group = config->group("border Tool Dialog");
- group.writeEntry("Border Type", m_borderType->currentItem());
+ group.writeEntry("Border Type", m_borderType->currentIndex());
group.writeEntry("Border Percent", m_borderPercent->value());
group.writeEntry("Border Width", m_borderWidth->value());
group.writeEntry("Preserve Aspect Ratio", m_preserveAspectRatio->isChecked());
@@ -269,7 +267,7 @@
m_secondColorButton->blockSignals(true);
m_preserveAspectRatio->blockSignals(true);
- m_borderType->setCurrentItem(Border::SolidBorder);
+ m_borderType->setCurrentIndex(Border::SolidBorder);
m_borderPercent->setValue(10);
m_borderWidth->setValue(100);
m_preserveAspectRatio->setChecked(true);
@@ -305,7 +303,7 @@
void ImageEffect_Border::slotColorForegroundChanged(const QColor &color)
{
- switch (m_borderType->currentItem())
+ switch (m_borderType->currentIndex())
{
case Border::SolidBorder:
m_solidColor = color;
@@ -344,7 +342,7 @@
void ImageEffect_Border::slotColorBackgroundChanged(const QColor &color)
{
- switch (m_borderType->currentItem())
+ switch (m_borderType->currentIndex())
{
case Border::SolidBorder:
m_solidColor = color;
@@ -461,10 +459,10 @@
iface->previewHasAlpha(), data);
delete [] data;
- int borderType = m_borderType->currentItem();
+ int borderType = m_borderType->currentIndex();
float ratio = (float)w/(float)orgWidth;
int borderWidth = (int)((float)m_borderWidth->value()*ratio);
- QString border = getBorderPath( m_borderType->currentItem() );
+ QString border = getBorderPath( m_borderType->currentIndex() );
if (m_preserveAspectRatio->isChecked())
{
@@ -503,10 +501,10 @@
m_firstColorButton->setEnabled(false);
m_secondColorButton->setEnabled(false);
- int borderType = m_borderType->currentItem();
+ int borderType = m_borderType->currentIndex();
int borderWidth = m_borderWidth->value();
float borderRatio = m_borderPercent->value()/100.0;
- QString border = getBorderPath( m_borderType->currentItem() );
+ QString border = getBorderPath( m_borderType->currentIndex() );
Digikam::ImageIface iface(0, 0);
int orgWidth = iface.originalWidth();
@@ -555,7 +553,7 @@
Digikam::DImg imDest( w, h, m_threadedFilter->getTargetImage().sixteenBit(),
m_threadedFilter->getTargetImage().hasAlpha() );
- imDest.fill( Digikam::DColor(paletteBackgroundColor().rgb(),
+ imDest.fill( Digikam::DColor(palette().color(QPalette::Background),
m_threadedFilter->getTargetImage().sixteenBit()) );
imDest.bitBltImage(&imTemp, (w-imTemp.width())/2, (h-imTemp.height())/2);
@@ -648,9 +646,7 @@
return QString();
}
- KGlobal::dirs()->addResourceType(pattern.ascii(), KGlobal::dirs()->kde_default("data") +
- "digikam/data");
- return (KGlobal::dirs()->findResourceDir(pattern.ascii(), pattern + ".png") + pattern + ".png" );
+ return (KStandardDirs::locate("data", QString("digikam/data/") + pattern + QString(".png")));
}
void ImageEffect_Border::slotPreserveAspectRatioToggled(bool b)
@@ -668,4 +664,3 @@
}
} // NameSpace DigikamBorderImagesPlugin
-
--- trunk/extragear/graphics/digikam/imageplugins/border/imageeffect_border.h #683760:683761
@@ -28,9 +28,7 @@
// Qt includes.
-#include <qstring.h>
-//Added by qt3to4:
-#include <QLabel>
+#include <QString>
// Digikam includes.
--- trunk/extragear/graphics/digikam/imageplugins/border/imageplugin_border.cpp #683760:683761
@@ -46,8 +46,10 @@
{
m_borderAction = new KAction(KIcon("bordertool"), i18n("Add Border..."), this);
actionCollection()->addAction("imageplugin_border", m_borderAction );
- connect(m_borderAction, SIGNAL(triggered(bool) ), SLOT(slotBorder()));
+ connect(m_borderAction, SIGNAL(triggered(bool)),
+ this, SLOT(slotBorder()));
+
setXMLFile("digikamimageplugin_border_ui.rc");
DDebug() << "ImagePlugin_Border plugin loaded" << endl;
@@ -67,4 +69,3 @@
DigikamBorderImagesPlugin::ImageEffect_Border dlg(parentWidget());
dlg.exec();
}
-
--- trunk/extragear/graphics/digikam/imageplugins/border/imageplugin_border.h #683760:683761
@@ -22,7 +22,6 @@
*
* ============================================================ */
-
#ifndef IMAGEPLUGIN_BORDER_H
#define IMAGEPLUGIN_BORDER_H
@@ -39,8 +38,7 @@
public:
- ImagePlugin_Border(QObject *parent,
- const QStringList &args);
+ ImagePlugin_Border(QObject *parent, const QStringList &args);
~ImagePlugin_Border();
void setEnabledActions(bool enable);
More information about the Digikam-devel
mailing list