More issues with code style.

This commit is contained in:
Roman Telezhynskyi 2020-04-23 15:42:36 +03:00
parent 222db34589
commit a4e01d514b
3 changed files with 20 additions and 13 deletions

View file

@ -91,8 +91,8 @@ void VPuzzleLayout::SetLayoutSize(qreal width, qreal height)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutSizeConverted(qreal width, qreal height) void VPuzzleLayout::SetLayoutSizeConverted(qreal width, qreal height)
{ {
m_size.setWidth(UnitConvertor(width, m_unit,Unit::Px)); m_size.setWidth(UnitConvertor(width, m_unit, Unit::Px));
m_size.setHeight(UnitConvertor(height, m_unit,Unit::Px)); m_size.setHeight(UnitConvertor(height, m_unit, Unit::Px));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -105,8 +105,8 @@ void VPuzzleLayout::SetLayoutSize(const QSizeF &size)
void VPuzzleLayout::SetLayoutSizeConverted(const QSizeF &size) void VPuzzleLayout::SetLayoutSizeConverted(const QSizeF &size)
{ {
m_size = QSizeF( m_size = QSizeF(
UnitConvertor(size.width(), m_unit,Unit::Px), UnitConvertor(size.width(), m_unit, Unit::Px),
UnitConvertor(size.height(), m_unit,Unit::Px) UnitConvertor(size.height(), m_unit, Unit::Px)
); );
} }
@ -204,7 +204,6 @@ qreal VPuzzleLayout::GetPiecesGapConverted() const
return UnitConvertor(m_piecesGap, Unit::Px, m_unit); return UnitConvertor(m_piecesGap, Unit::Px, m_unit);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetWarningSuperpositionOfPieces(bool state) void VPuzzleLayout::SetWarningSuperpositionOfPieces(bool state)
{ {

View file

@ -84,7 +84,8 @@ void VPuzzleLayoutFileReader::ReadLayout(VPuzzleLayout *layout)
{ {
Q_ASSERT(isStartElement() && name() == QString("layout")); Q_ASSERT(isStartElement() && name() == QString("layout"));
while (readNextStartElement()) { while (readNextStartElement())
{
if (name() == QString("properties")) if (name() == QString("properties"))
{ {
ReadProperties(layout); ReadProperties(layout);
@ -105,7 +106,8 @@ void VPuzzleLayoutFileReader::ReadProperties(VPuzzleLayout *layout)
{ {
Q_ASSERT(isStartElement() && name() == QString("properties")); Q_ASSERT(isStartElement() && name() == QString("properties"));
while (readNextStartElement()) { while (readNextStartElement())
{
qDebug(name().toString().toLatin1()); qDebug(name().toString().toLatin1());
if (name() == QString("unit")) if (name() == QString("unit"))
@ -185,7 +187,8 @@ void VPuzzleLayoutFileReader::ReadTiles(VPuzzleLayout *layout)
// attribs.value("visible"); // TODO // attribs.value("visible"); // TODO
// attribs.value("matchingMarks"); // TODO // attribs.value("matchingMarks"); // TODO
while (readNextStartElement()) { while (readNextStartElement())
{
if (name() == QString("size")) if (name() == QString("size"))
{ {
QSizeF size = ReadSize(); QSizeF size = ReadSize();
@ -213,7 +216,8 @@ void VPuzzleLayoutFileReader::ReadLayers(VPuzzleLayout *layout)
{ {
Q_ASSERT(isStartElement() && name() == QString("layers")); Q_ASSERT(isStartElement() && name() == QString("layers"));
while (readNextStartElement()) { while (readNextStartElement())
{
if (name() == QString("unplacedPiecesLayer")) if (name() == QString("unplacedPiecesLayer"))
{ {
ReadLayer(layout->GetUnplacedPiecesLayer()); ReadLayer(layout->GetUnplacedPiecesLayer());
@ -240,7 +244,8 @@ void VPuzzleLayoutFileReader::ReadLayer(VPuzzleLayer *layer)
layer->SetName(attribs.value("name").toString()); layer->SetName(attribs.value("name").toString());
layer->SetIsVisible(attribs.value("visible") == "true"); layer->SetIsVisible(attribs.value("visible") == "true");
while (readNextStartElement()) { while (readNextStartElement())
{
if (name() == QString("piece")) if (name() == QString("piece"))
{ {
VPuzzlePiece *piece = new VPuzzlePiece(); VPuzzlePiece *piece = new VPuzzlePiece();
@ -263,7 +268,8 @@ void VPuzzleLayoutFileReader::ReadPiece(VPuzzlePiece *piece)
// TODO read the attributes // TODO read the attributes
while (readNextStartElement()) { while (readNextStartElement())
{
if (name() == QString("...")) if (name() == QString("..."))
{ {
// TODO // TODO

View file

@ -195,12 +195,14 @@ void VPuzzleLayoutFileWriter::WriteSize(QSizeF size)
{ {
// maybe not necessary to test this, the writer should "stupidly write", the application should take care of these tests // maybe not necessary to test this, the writer should "stupidly write", the application should take care of these tests
qreal width = size.width(); qreal width = size.width();
if(width < 0) { if(width < 0)
{
width = 0; width = 0;
} }
qreal length = size.height(); qreal length = size.height();
if(length < 0) { if(length < 0)
{
length = 0; length = 0;
} }