Commit ca5291d5 authored by Casper Boemann's avatar Casper Boemann

split properties dialog into it's own ui file and all

change the properties so size is no longer editable

svn path=/trunk/koffice/; revision=667647
parent 7cee0029
......@@ -125,17 +125,14 @@ void KisImageConvertTypeCommand::undo()
KisImagePropsCommand::KisImagePropsCommand(KisImageSP image, const QString& newName, const QString& newDescription,
KoColorSpace* newColorSpace, KoColorProfile* newProfile, double newResolution)
KoColorSpace* newColorSpace, KoColorProfile* newProfile)
: super(i18n("Property Changes"), image)
, m_newName(newName), m_newDescription(newDescription), m_newColorSpace(newColorSpace), m_newProfile(newProfile)
, m_newResolution(newResolution)
{
m_oldName = m_image->name();
m_oldDescription = m_image->description();
m_oldColorSpace = m_image->colorSpace();
m_oldProfile = m_image->profile();
m_oldXRes = m_image->xRes();
m_oldYRes = m_image->yRes();
}
void KisImagePropsCommand::redo()
......@@ -143,7 +140,6 @@ void KisImagePropsCommand::redo()
setUndo(false);
m_image->setName(m_newName);
m_image->setColorSpace(m_newColorSpace);
m_image->setResolution(m_newResolution, m_newResolution);
m_image->setDescription(m_newDescription);
m_image->setProfile(m_newProfile);
setUndo(true);
......@@ -154,7 +150,6 @@ void KisImagePropsCommand::undo()
setUndo(false);
m_image->setName(m_oldName);
m_image->setColorSpace(m_oldColorSpace);
m_image->setResolution(m_oldXRes, m_oldYRes);
m_image->setDescription(m_oldDescription);
m_image->setProfile(m_oldProfile);
setUndo(true);
......
......@@ -130,7 +130,7 @@ public:
* @param newResolution the new image resolution which will be used for xRes and yRes
*/
KisImagePropsCommand(KisImageSP image, const QString& newName, const QString& newDescription,
KoColorSpace* newColorSpace, KoColorProfile* newProfile, double newResolution);
KoColorSpace* newColorSpace, KoColorProfile* newProfile);
virtual ~KisImagePropsCommand() {}
virtual void redo();
......@@ -145,9 +145,6 @@ private:
KoColorSpace * m_oldColorSpace;
KoColorProfile* m_newProfile;
KoColorProfile* m_oldProfile;
double m_newResolution;
double m_oldXRes;
double m_oldYRes;
};
......
......@@ -444,8 +444,7 @@ template <class T> void KisTransformWorker::transformPass(KisPaintDevice *src, K
cs->setAlpha(data, 0, 1);
tmpSel[i] = 255;
}
else
{
else {
tmpSel[i] = 0;
}
++srcIt;
......
......@@ -149,6 +149,7 @@ kde4_add_ui_files(kritaui_LIB_SRCS
wdgcustompalette.ui
wdgtextbrush.ui
wdgnewimage.ui
wdgimageproperties.ui
)
kde4_add_library(kritaui SHARED ${kritaui_LIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/asm_scale.o )
......
......@@ -20,12 +20,22 @@
#define KIS_CUSTOM_IMAGE_WIDGET_H
#include "kis_global.h"
#include "kis_dlg_image_properties.h"
//#include "kis_dlg_image_properties.h"
#include "KoUnit.h"
#include "ui_wdgnewimage.h"
class KisDoc2;
class KoID;
class WdgNewImage : public QWidget, public Ui::WdgNewImage
{
Q_OBJECT
public:
WdgNewImage(QWidget *parent) : QWidget(parent) { setupUi(this); }
};
/**
* The 'Custom Document' widget in the Krita startup widget.
* This class embeds the image size and colorspace to allow the user to select the image properties
......
......@@ -51,7 +51,7 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageSP image, QWidget *parent,
setDefaultButton( Ok );
setObjectName(name);
setCaption(i18n("Image Properties"));
m_page = new WdgNewImage(this);
m_page = new WdgImageProperties(this);
m_image = image;
......@@ -62,10 +62,10 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageSP image, QWidget *parent,
m_page->m_createButton->hide();
KisConfig cfg;
m_page->doubleWidth->setValue(image->width());
m_page->doubleHeight->setValue(image->height());
m_page->lblWidthValue->setText(QString::number(image->width()));
m_page->lblHeightValue->setText(QString::number(image->height()));
m_page->doubleResolution->setValue(image->xRes()*72); // XXX: separate values for x & y?
m_page->lblResolutionValue->setText(KGlobal::locale()->formatNumber(image->xRes()*72, 2)); // XXX: separate values for x & y?
m_page->txtDescription->setText( m_image->description() );
......@@ -107,18 +107,6 @@ KisDlgImageProperties::~KisDlgImageProperties()
delete m_page;
}
int KisDlgImageProperties::imageWidth()
{
// XXX: adding explict cast
return static_cast<int>(m_page->doubleWidth->value());
}
int KisDlgImageProperties::imageHeight()
{
// XXX: adding explicit cast
return static_cast<int>(m_page->doubleHeight->value());
}
int KisDlgImageProperties::opacity()
{
return m_page->sliderOpacity->value();
......@@ -129,11 +117,6 @@ QString KisDlgImageProperties::imageName()
return m_page->txtName->text();
}
double KisDlgImageProperties::resolution()
{
return m_page->doubleResolution->value() / 72;
}
QString KisDlgImageProperties::description()
{
return m_page->txtDescription->toPlainText();
......@@ -159,7 +142,7 @@ KoColorProfile * KisDlgImageProperties::profile()
// XXX: Copy & paste from kis_dlg_create_img -- refactor to separate class
void KisDlgImageProperties::fillCmbProfiles(const KoID & s)
{
KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->get(s.id());
KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->value(s.id());
m_page->cmbProfile->clear();
if (csf) {
QList<KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor( csf );
......
......@@ -21,18 +21,18 @@
#include <kdialog.h>
#include <kis_types.h>
#include "ui_wdgnewimage.h"
#include "ui_wdgimageproperties.h"
class KoID;
class KoColorSpace;
class KoColorProfile;
class WdgNewImage : public QWidget, public Ui::WdgNewImage
class WdgImageProperties : public QWidget, public Ui::WdgImageProperties
{
Q_OBJECT
public:
WdgNewImage(QWidget *parent) : QWidget(parent) { setupUi(this); }
WdgImageProperties(QWidget *parent) : QWidget(parent) { setupUi(this); }
};
class KisDlgImageProperties : public KDialog {
......@@ -45,11 +45,8 @@ public:
const char *name = 0);
virtual ~KisDlgImageProperties();
int imageWidth();
int imageHeight();
int opacity();
QString imageName();
double resolution();
QString description();
KoColorSpace * colorSpace();
KoColorProfile * profile();
......@@ -60,7 +57,7 @@ private slots:
private:
WdgNewImage * m_page;
WdgImageProperties * m_page;
KisImageSP m_image;
};
......
......@@ -55,7 +55,7 @@ void KisImageManager::setup( KActionCollection * actionCollection )
actionCollection->addAction("insert_image_as_layer", action );
connect(action, SIGNAL(triggered()), this, SLOT(slotInsertImageAsLayer()));
action = new KAction(i18n("Image Properties..."), this);
action = new KAction(i18n("Properties..."), this);
actionCollection->addAction("img_properties", action );
connect(action, SIGNAL(triggered()), this, SLOT(slotImageProperties()));
}
......@@ -147,16 +147,10 @@ void KisImageManager::slotImageProperties()
KisDlgImageProperties dlg(img, m_view);
if (dlg.exec() == QDialog::Accepted) {
if (dlg.imageWidth() != img->width() ||
dlg.imageHeight() != img->height()) {
resizeCurrentImage(dlg.imageWidth(),
dlg.imageHeight());
}
qint32 opacity = dlg.opacity();
opacity = opacity * 255 / 100;
QUndoCommand* cmd = new KisImagePropsCommand(img, dlg.imageName(), dlg.description(),
dlg.colorSpace(), dlg.profile(), dlg.resolution());
dlg.colorSpace(), dlg.profile());
m_view->document()->addCommand(cmd);
}
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment