Commit fb0c18ce authored by Casper Boemann's avatar Casper Boemann

playing a little with the resolution dialogs


svn path=/trunk/koffice/; revision=608274
parent b5cef9bd
<ui version="4.0" stdsetdef="1" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>WdgResolution</class>
<widget class="QWidget" name="WdgResolution" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>487</width>
<height>265</height>
</rect>
</property>
<property name="windowTitle" >
<string>Image Resolution</string>
</property>
<layout class="QGridLayout" >
<item rowspan="1" row="1" column="0" colspan="2" >
<widget class="QGroupBox" name="grpSize" >
<property name="title" >
<string>Print Size</string>
</property>
<layout class="QGridLayout" >
<item row="1" column="0" >
<widget class="QLabel" name="lblHeight" >
<property name="text" >
<string>Height:</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="lblWidth" >
<property name="text" >
<string>Width:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KIntNumInput" name="intWidth" >
<property name="suffix" >
<string> "</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KIntNumInput" name="intHeight" >
<property name="suffix" >
<string> "</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item rowspan="1" row="0" column="0" colspan="2" >
<widget class="QGroupBox" name="grpResolution" >
<property name="title" >
<string>Image Resolution</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="lblScreen" >
<property name="text" >
<string>Screen resolution:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="lblScreenResolution" >
<property name="frameShape" >
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="text" >
<string>100</string>
</property>
<property name="alignment" >
<set>Qt::AlignVCenter|Qt::AlignRight</set>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="lblYResolution" >
<property name="text" >
<string>Image Y resolution:</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="lblImageXRes" >
<property name="text" >
<string>Image X resolution:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KIntNumInput" name="intXRes" >
<property name="suffix" >
<string> dpi</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="KIntNumInput" name="intYRes" >
<property name="suffix" >
<string> dpi</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<customwidgets>
<customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
</ui>
......@@ -30,6 +30,7 @@
#include "KoColorSpace.h"
#include "KoID.h"
#include "KoColor.h"
#include <KoUnit.h>
#include "kis_doc2.h"
#include "kis_meta_registry.h"
......@@ -44,10 +45,15 @@ KisCustomImageWidget::KisCustomImageWidget(QWidget *parent, KisDoc2 *doc, qint32
txtName->setText(imageName);
intWidth->setValue(defWidth);
intHeight->setValue(defHeight);
doubleWidth->setValue(defWidth);
doubleHeight->setValue(defHeight);
doubleResolution->setValue(resolution);
cmbWidthUnit->addItem( i18n("Pixels") );
cmbWidthUnit->addItems( KoUnit::listOfUnitName() );
cmbHeightUnit->addItem( i18n("Pixels") );
cmbHeightUnit->addItems( KoUnit::listOfUnitName() );
cmbColorSpaces->setIDList(KisMetaRegistry::instance()->csRegistry()->listKeys());
cmbColorSpaces->setCurrent(defColorSpaceName);
......@@ -65,7 +71,27 @@ void KisCustomImageWidget::buttonClicked() {
QColor qc(cmbColor->color());
m_doc->newImage(txtName->text(), (qint32)intWidth->value(), (qint32)intHeight->value(), cs, KoColor(qc, cs), txtDescription->toPlainText(), doubleResolution->value());
qint32 width, height;
double resolution;
resolution = doubleResolution->value() / 72.0; // internal resolution is in pixels per pt
switch(cmbWidthUnit->currentIndex())
{
case 0:
width = int(doubleWidth->value());
break;
case 1:
width = int(doubleWidth->value());
break;
case 2:
width = int(doubleWidth->value());
break;
case 3:
width = int(doubleWidth->value());
break;
}
m_doc->newImage(txtName->text(), width, height, cs, KoColor(qc, cs), txtDescription->toPlainText(), resolution);
KisImageSP img = m_doc->currentImage();
if (img) {
......
......@@ -61,8 +61,8 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageSP image, QWidget *parent,
m_page->m_createButton->hide();
KisConfig cfg;
m_page->intWidth->setValue(image->width());
m_page->intHeight->setValue(image->height());
m_page->doubleWidth->setValue(image->width());
m_page->doubleHeight->setValue(image->height());
m_page->doubleResolution->setValue(image->xRes()); // XXX: separate values for x & y?
......@@ -108,12 +108,12 @@ KisDlgImageProperties::~KisDlgImageProperties()
int KisDlgImageProperties::imageWidth()
{
return m_page->intWidth->value();
return m_page->doubleWidth->value();
}
int KisDlgImageProperties::imageHeight()
{
return m_page->intHeight->value();
return m_page->doubleHeight->value();
}
int KisDlgImageProperties::opacity()
......
<ui version="4.0" >
<class>WdgResolution</class>
<widget class="QWidget" name="WdgResolution" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>465</width>
<height>182</height>
</rect>
</property>
<property name="windowTitle" >
<string>Image Resolution</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lblWidth" >
<property name="text" >
<string>Width:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblHeight" >
<property name="text" >
<string>Height:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lblImageXRes" >
<property name="text" >
<string>X resolution:</string>
</property>
</widget>
</item>
<item>
<widget class="KDoubleSpinBox" name="doubleResolution" />
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lblYResolution" >
<property name="text" >
<string>Y resolution:</string>
</property>
</widget>
</item>
<item>
<widget class="KDoubleSpinBox" name="doubleResolution_2" />
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lblYResolution_3" >
<property name="text" >
<string>Resolution:</string>
</property>
</widget>
</item>
<item>
<widget class="KDoubleSpinBox" name="doubleResolution_5" />
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<customwidgets>
<customwidget>
<class>KDoubleSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
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