print layout
This commit is contained in:
+220
@@ -0,0 +1,220 @@
|
||||
#include "clayout.h"
|
||||
#include "ui_clayout.h"
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <QPageSize>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
cLayout::cLayout(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::cLayout),
|
||||
m_initializing(true)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
for(int id = 0;id < QPageSize::LastPageSize;id++)
|
||||
ui->m_lpPageSize->addItem(QPageSize::name(static_cast<QPageSize::PageSizeId>(id)), QVariant::fromValue(static_cast<QPageSize::PageSizeId>(id)));
|
||||
|
||||
ui->m_lpUnit->addItem("Millimeter", QVariant::fromValue(QPageSize::Millimeter));
|
||||
ui->m_lpUnit->addItem("Point", QVariant::fromValue(QPageSize::Point));
|
||||
ui->m_lpUnit->addItem("Inch", QVariant::fromValue(QPageSize::Inch));
|
||||
ui->m_lpUnit->addItem("Pica", QVariant::fromValue(QPageSize::Pica));
|
||||
ui->m_lpUnit->addItem("Didot", QVariant::fromValue(QPageSize::Didot));
|
||||
ui->m_lpUnit->addItem("Cicero", QVariant::fromValue(QPageSize::Cicero));
|
||||
|
||||
connect(ui->m_lpPageSize, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &cLayout::onPageSizeChanged);
|
||||
connect(ui->m_lpUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &cLayout::onUnitChanged);
|
||||
connect(ui->m_lpBorderAllTheSame, &QCheckBox::stateChanged, this, &cLayout::onAllTheSameChanged);
|
||||
connect(ui->m_lpTilesH, QOverload<int>::of(&QSpinBox::valueChanged), this, &cLayout::onTileHChanged);
|
||||
connect(ui->m_lpTilesV, QOverload<int>::of(&QSpinBox::valueChanged), this, &cLayout::onTileVChanged);
|
||||
connect(ui->m_lpBorderTop, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderTopChanged);
|
||||
connect(ui->m_lpBorderLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderLeftChanged);
|
||||
connect(ui->m_lpBorderRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderRightChanged);
|
||||
connect(ui->m_lpBorderBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderBottomChanged);
|
||||
connect(ui->m_lpGutterWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onGutterChanged);
|
||||
|
||||
m_initializing = false;
|
||||
}
|
||||
|
||||
cLayout::~cLayout()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cLayout::onPageSizeChanged(int /*index*/)
|
||||
{
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::onUnitChanged(int /*index*/)
|
||||
{
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::onAllTheSameChanged(int /*state*/)
|
||||
{
|
||||
if(ui->m_lpBorderAllTheSame->isChecked())
|
||||
{
|
||||
disconnect(ui->m_lpBorderLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderLeftChanged);
|
||||
disconnect(ui->m_lpBorderRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderRightChanged);
|
||||
disconnect(ui->m_lpBorderBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderBottomChanged);
|
||||
|
||||
ui->m_lpBorderLeft->setValue(ui->m_lpBorderTop->value());
|
||||
ui->m_lpBorderRight->setValue(ui->m_lpBorderTop->value());
|
||||
ui->m_lpBorderBottom->setValue(ui->m_lpBorderTop->value());
|
||||
|
||||
ui->m_lpBorderLeft->setEnabled(false);
|
||||
ui->m_lpBorderRight->setEnabled(false);
|
||||
ui->m_lpBorderBottom->setEnabled(false);
|
||||
|
||||
redrawPreview();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_lpBorderLeft->setEnabled(true);
|
||||
ui->m_lpBorderRight->setEnabled(true);
|
||||
ui->m_lpBorderBottom->setEnabled(true);
|
||||
|
||||
connect(ui->m_lpBorderLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderLeftChanged);
|
||||
connect(ui->m_lpBorderRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderRightChanged);
|
||||
connect(ui->m_lpBorderBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &cLayout::onBorderBottomChanged);
|
||||
}
|
||||
}
|
||||
|
||||
void cLayout::onTileHChanged(int /*value*/)
|
||||
{
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::onTileVChanged(int /*value*/)
|
||||
{
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::onBorderTopChanged(double /*value*/)
|
||||
{
|
||||
if(ui->m_lpBorderAllTheSame->isChecked())
|
||||
{
|
||||
ui->m_lpBorderLeft->setValue(ui->m_lpBorderTop->value());
|
||||
ui->m_lpBorderRight->setValue(ui->m_lpBorderTop->value());
|
||||
ui->m_lpBorderBottom->setValue(ui->m_lpBorderTop->value());
|
||||
}
|
||||
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::onBorderLeftChanged(double /*value*/)
|
||||
{
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::onBorderRightChanged(double /*value*/)
|
||||
{
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::onBorderBottomChanged(double /*value*/)
|
||||
{
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::onGutterChanged(double /*value*/)
|
||||
{
|
||||
redrawPreview();
|
||||
}
|
||||
|
||||
void cLayout::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
if(!m_initializing)
|
||||
redrawPreview();
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
void cLayout::redrawPreview()
|
||||
{
|
||||
QSize widgetSize = ui->m_lpLayoutPreview->size();
|
||||
QPageSize pageSize(ui->m_lpPageSize->currentData().value<QPageSize::PageSizeId>());
|
||||
QSizeF size = pageSize.size(ui->m_lpUnit->currentData().value<QPageSize::Unit>());
|
||||
qreal pageWidth = size.width();
|
||||
qreal pageHeight = size.height();
|
||||
qreal borderTop = ui->m_lpBorderTop->value();
|
||||
qreal borderLeft = ui->m_lpBorderLeft->value();
|
||||
qreal borderRight = ui->m_lpBorderRight->value();
|
||||
qreal borderBottom = ui->m_lpBorderBottom->value();
|
||||
qreal gutter = ui->m_lpGutterWidth->value();
|
||||
qreal tilesH = static_cast<qreal>(ui->m_lpTilesH->value());
|
||||
qreal tilesV = static_cast<qreal>(ui->m_lpTilesV->value());
|
||||
qreal scaleFactor = static_cast<qreal>(widgetSize.width()-10) / pageWidth;
|
||||
qreal tmp = static_cast<qreal>(widgetSize.height()-10) / pageHeight;
|
||||
|
||||
QString unit;
|
||||
|
||||
switch(ui->m_lpUnit->currentData().value<QPageSize::Unit>())
|
||||
{
|
||||
case QPageSize::Millimeter:
|
||||
unit = tr("Millimeter");
|
||||
break;
|
||||
case QPageSize::Point:
|
||||
unit = tr("Point(s)");
|
||||
break;
|
||||
case QPageSize::Inch:
|
||||
unit = tr("Inch");
|
||||
break;
|
||||
case QPageSize::Pica:
|
||||
unit = tr("Pica");
|
||||
break;
|
||||
case QPageSize::Didot:
|
||||
unit = tr("Didot");
|
||||
break;
|
||||
case QPageSize::Cicero:
|
||||
unit = tr("Cicero");
|
||||
break;
|
||||
}
|
||||
|
||||
ui->m_lpPaperSizeText->setText(QString::number(pageWidth) + " " + unit + " x " + QString::number(pageHeight) + " " + unit);
|
||||
|
||||
ui->m_lpBorderTop->setSuffix(QString(" ") + unit);
|
||||
ui->m_lpBorderLeft->setSuffix(QString(" ") + unit);
|
||||
ui->m_lpBorderRight->setSuffix(QString(" ") + unit);
|
||||
ui->m_lpBorderBottom->setSuffix(QString(" ") + unit);
|
||||
ui->m_lpGutterWidth->setSuffix(QString(" ") + unit);
|
||||
|
||||
if(tmp < scaleFactor)
|
||||
scaleFactor = tmp;
|
||||
|
||||
QPixmap pixmap(scale(size, scaleFactor));
|
||||
pixmap.fill(Qt::white);
|
||||
QPainter painter(&pixmap);
|
||||
|
||||
QRectF rect;
|
||||
qreal rectW = (pageWidth-borderLeft-borderRight-gutter*(tilesH-1)) / tilesH;
|
||||
qreal rectH = (pageHeight-borderTop-borderBottom-gutter*(tilesV-1)) / tilesV;
|
||||
|
||||
// borderTop = scale(borderTop, scaleFactor);
|
||||
// borderLeft = scale(borderLeft, scaleFactor);
|
||||
|
||||
painter.setPen(Qt::black);
|
||||
|
||||
for(qreal x = 0;x < tilesH;x++)
|
||||
{
|
||||
for(qreal y = 0;y < tilesV;y++)
|
||||
{
|
||||
qreal t = borderTop+y*(rectH+gutter);
|
||||
qreal l = borderLeft+x*(rectW+gutter);
|
||||
|
||||
rect.setTopLeft(scale(QPointF(l, t), scaleFactor));
|
||||
rect.setSize(scale(QSizeF(rectW, rectH), scaleFactor));
|
||||
// rect.setTopLeft(QPoint(borderLeft+x*(rectW+gutter), borderTop+y*(rectH+gutter)));
|
||||
// rect.setSize(QSizeF(rectW, rectH));
|
||||
painter.drawRect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
ui->m_lpLayoutPreview->setPixmap(pixmap);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*!
|
||||
\file clayout.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CLAYOUT_H
|
||||
#define CLAYOUT_H
|
||||
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class cLayout;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cLayout clayout.h "clayout.h"
|
||||
*/
|
||||
class cLayout : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cLayout
|
||||
\param parent
|
||||
*/
|
||||
explicit cLayout(QWidget *parent = nullptr);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn ~cLayout
|
||||
*/
|
||||
~cLayout();
|
||||
|
||||
private:
|
||||
Ui::cLayout* ui; /*!< TODO: describe */
|
||||
bool m_initializing; /*!< TODO: describe */
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn redrawPreview
|
||||
*/
|
||||
void redrawPreview();
|
||||
|
||||
private slots:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onPageSizeChanged
|
||||
\param index
|
||||
*/
|
||||
void onPageSizeChanged(int index);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onUnitChanged
|
||||
\param index
|
||||
*/
|
||||
void onUnitChanged(int index);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onAllTheSameChanged
|
||||
\param state
|
||||
*/
|
||||
void onAllTheSameChanged(int state);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onTileHChanged
|
||||
\param value
|
||||
*/
|
||||
void onTileHChanged(int value);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onTileVChanged
|
||||
\param value
|
||||
*/
|
||||
void onTileVChanged(int value);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onBorderTopChanged
|
||||
\param value
|
||||
*/
|
||||
void onBorderTopChanged(double value);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onBorderLeftChanged
|
||||
\param value
|
||||
*/
|
||||
void onBorderLeftChanged(double value);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onBorderRightChanged
|
||||
\param value
|
||||
*/
|
||||
void onBorderRightChanged(double value);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onBorderBottomChanged
|
||||
\param value
|
||||
*/
|
||||
void onBorderBottomChanged(double value);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onGutterChanged
|
||||
\param value
|
||||
*/
|
||||
void onGutterChanged(double value);
|
||||
|
||||
protected:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn resizeEvent
|
||||
\param event
|
||||
*/
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // CLAYOUT_H
|
||||
+362
@@ -0,0 +1,362 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>cLayout</class>
|
||||
<widget class="QWidget" name="cLayout">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>493</width>
|
||||
<height>440</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_7" columnstretch="0,1,0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Unit:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Paper Size:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_lpPageSize"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="m_lpPaperSizeText">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Paper Size:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_lpUnit"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Tiles</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="m_lpTilesH">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Horizontal:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_lpTilesV">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Vertical:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Border</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Left:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Right:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QDoubleSpinBox" name="m_lpBorderRight">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QDoubleSpinBox" name="m_lpBorderTop">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Top:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_lpBorderLeft">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QDoubleSpinBox" name="m_lpBorderBottom">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Bottom:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_lpBorderAllTheSame">
|
||||
<property name="text">
|
||||
<string>all the same</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Gutter</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Gutter Width:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="m_lpGutterWidth">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpLayoutPreview">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+5
-2
@@ -81,10 +81,13 @@ void cMainWindow::initUI()
|
||||
m_lpSelectedListModel = new QStandardItemModel(0, 0);
|
||||
ui->m_lpSelectedList->setModel(m_lpSelectedListModel);
|
||||
|
||||
m_lpFileBrowser = new cFileBrowser(m_lpProgressBar, &m_imageFormats, ui->m_lpSelectedList, m_lpSelectedListModel, this);
|
||||
m_lpFileBrowser = new cFileBrowser(m_lpProgressBar, &m_imageFormats, ui->m_lpSelectedList, m_lpSelectedListModel, this);
|
||||
ui->m_lpMainTab->addTab(m_lpFileBrowser, "Files");
|
||||
|
||||
m_lpPrint = new cPrint(m_lpProgressBar, ui->m_lpSelectedList, m_lpSelectedListModel, this);
|
||||
m_lpLayout = new cLayout(this);
|
||||
ui->m_lpMainTab->addTab(m_lpLayout, "Layout");
|
||||
|
||||
m_lpPrint = new cPrint(m_lpProgressBar, ui->m_lpSelectedList, m_lpSelectedListModel, this);
|
||||
ui->m_lpMainTab->addTab(m_lpPrint, "Print");
|
||||
|
||||
if(!settings.value("main/maximized").toBool())
|
||||
|
||||
+3
-1
@@ -11,6 +11,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "cfilebrowser.h"
|
||||
#include "clayout.h"
|
||||
#include "cprint.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
@@ -42,11 +43,12 @@ public:
|
||||
~cMainWindow();
|
||||
|
||||
private:
|
||||
Ui::cMainWindow* ui; /*!< TODO: describe */
|
||||
Ui::cMainWindow* ui; /*!< TODO: describe */
|
||||
cSplashScreen* m_lpSplashScreen; /*!< TODO: describe */
|
||||
QProgressBar* m_lpProgressBar; /*!< TODO: describe */
|
||||
|
||||
cFileBrowser* m_lpFileBrowser; /*!< TODO: describe */
|
||||
cLayout* m_lpLayout; /*!< TODO: describe */
|
||||
cPrint* m_lpPrint; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpSelectedListModel; /*!< TODO: describe */
|
||||
|
||||
|
||||
+30
-1
@@ -1,6 +1,5 @@
|
||||
/*!
|
||||
\file common.cpp
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@@ -68,3 +67,33 @@ QString userDir()
|
||||
{
|
||||
return(QDir::homePath() + QDir::separator() + ".picturePrint" + QDir::separator());
|
||||
}
|
||||
|
||||
int scale(int v, qreal s)
|
||||
{
|
||||
return(static_cast<int>(static_cast<qreal>(v)*s));
|
||||
}
|
||||
|
||||
qreal scale(qreal v, qreal s)
|
||||
{
|
||||
return(v*s);
|
||||
}
|
||||
|
||||
QSize scale(const QSize& size, qreal s)
|
||||
{
|
||||
return(QSize(scale(size.width(), s), scale(size.height(), s)));
|
||||
}
|
||||
|
||||
QSize scale(const QSizeF& size, qreal s)
|
||||
{
|
||||
return(QSize(scale(size.width(), s), scale(size.height(), s)));
|
||||
}
|
||||
|
||||
QPoint scale(const QPoint& point, qreal s)
|
||||
{
|
||||
return(QPoint(scale(point.x(), s), scale(point.y(), s)));
|
||||
}
|
||||
|
||||
QPoint scale(const QPointF& point, qreal s)
|
||||
{
|
||||
return(QPoint(scale(point.x(), s), scale(point.y(), s)));
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
/*!
|
||||
\file common.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
|
||||
#include <QSize>
|
||||
#include <QSizeF>
|
||||
#include <QPoint>
|
||||
#include <QPointF>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
@@ -25,7 +29,6 @@
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class tagIMAGEFORMAT common.h "common.h"
|
||||
*/
|
||||
typedef struct tagIMAGEFORMAT
|
||||
@@ -37,14 +40,12 @@ typedef struct tagIMAGEFORMAT
|
||||
bool write; /*!< TODO: describe */
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\typedef IMAGEFORMAT*/
|
||||
} IMAGEFORMAT;
|
||||
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn generateReadList
|
||||
\param imageFormats
|
||||
\return QStringList
|
||||
@@ -52,7 +53,6 @@ typedef struct tagIMAGEFORMAT
|
||||
QStringList generateReadList(const QList<IMAGEFORMAT>& imageFormats);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn generateWriteList
|
||||
\param imageFormats
|
||||
\return QStringList
|
||||
@@ -61,7 +61,6 @@ QStringList generateWriteList(const QList<IMAGEFORMAT>& imageFormats);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn blob2Image
|
||||
\param ba
|
||||
\return QImage
|
||||
@@ -69,7 +68,6 @@ QStringList generateWriteList(const QList<IMAGEFORMAT>& imageFormats);
|
||||
QImage blob2Image(const QByteArray& ba);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn image2Blob
|
||||
\param image
|
||||
\return QByteArray
|
||||
@@ -78,11 +76,17 @@ QByteArray image2Blob(const QImage& image);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn userDir
|
||||
\return QString
|
||||
*/
|
||||
QString userDir();
|
||||
|
||||
int scale(int v, qreal s);
|
||||
qreal scale(qreal v, qreal s);
|
||||
QSize scale(const QSize& size, qreal s);
|
||||
QSize scale(const QSizeF& size, qreal s);
|
||||
QPoint scale(const QPoint& point, qreal s);
|
||||
QPoint scale(const QPointF& point, qreal s);
|
||||
|
||||
|
||||
#endif // COMMON_H
|
||||
|
||||
@@ -49,6 +49,7 @@ SOURCES += \
|
||||
cfilebrowser.cpp \
|
||||
cfileviewer.cpp \
|
||||
cimage.cpp \
|
||||
clayout.cpp \
|
||||
common.cpp \
|
||||
cprint.cpp \
|
||||
csplashscreen.cpp \
|
||||
@@ -60,6 +61,7 @@ HEADERS += \
|
||||
cfilebrowser.h \
|
||||
cfileviewer.h \
|
||||
cimage.h \
|
||||
clayout.h \
|
||||
cmainwindow.h \
|
||||
common.h \
|
||||
cprint.h \
|
||||
@@ -68,6 +70,7 @@ HEADERS += \
|
||||
FORMS += \
|
||||
cfilebrowser.ui \
|
||||
cfileviewer.ui \
|
||||
clayout.ui \
|
||||
cmainwindow.ui \
|
||||
cprint.ui
|
||||
|
||||
|
||||
Reference in New Issue
Block a user