Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalization of the MVP #83

Merged
merged 11 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/app/seamly2d/core/vtooloptionspropertybrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,14 @@ void VToolOptionsPropertyBrowser::itemClicked(QGraphicsItem *item)
{
if (item != nullptr)
{
if (item->type() == QGraphicsItem::UserType + static_cast<int>(Tool::BackgroundImage))
if (item->isEnabled()==false)
{
return;
}

if (item->isEnabled()==false)
if(item->type() == QGraphicsItem::UserType + static_cast<int>(Tool::BackgroundImage))
{
return;
item = nullptr;
}
}

Expand Down
18 changes: 8 additions & 10 deletions src/app/seamly2d/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,11 +1688,9 @@ void MainWindow::addImage(DraftImage image)
{
image.width = image.pixmap.width();
image.height = image.pixmap.height();
image.xScale = 100;
image.yScale = 100;
}

ImageItem *item = new ImageItem(image);
ImageItem *item = new ImageItem(doc, image);
doc->addBackgroundImage(image.id, item);
draftScene->addItem(item);
//Need error dialog
Expand Down Expand Up @@ -1796,8 +1794,6 @@ void MainWindow::updateImage(DraftImage image)
qCDebug(vMainWindow, "YPos = %f", image.yPos);
qCDebug(vMainWindow, "Width = %f", image.width);
qCDebug(vMainWindow, "Height = %f", image.height);
qCDebug(vMainWindow, "XScale = %f", image.xScale);
qCDebug(vMainWindow, "YScale = %f", image.yScale);
qCDebug(vMainWindow, "lock Image Aspect = %s", image.aspectLocked ? "True" : "False");
qCDebug(vMainWindow, "Units = %d", static_cast<int>(image.units));
qCDebug(vMainWindow, "Rotation = %f", image.rotation);
Expand All @@ -1816,11 +1812,12 @@ void MainWindow::updateImage(DraftImage image)
//---------------------------------------------------------------------------------------------------------------------
QString MainWindow::getImageFilename()
{
const QString filter = tr("PNG") + QLatin1String(" (*.png);;") +
tr("JPG") + QLatin1String(" (*.jpg);;") +
tr("SVG") + QLatin1String(" (*.svg);;") +
tr("BMP") + QLatin1String(" (*.bmp);;") +
tr("TIF") + QLatin1String(" (*.tf)");
const QString filter = tr("Images") + QLatin1String(" (*.bmp *.jpg *.png *.svg *.tf);;") +
"BMP" + QLatin1String(" (*.bmp);;") +
"JPG" + QLatin1String(" (*.jpg);;") +
"PNG" + QLatin1String(" (*.png);;") +
"SVG" + QLatin1String(" (*.svg);;") +
"TIF" + QLatin1String(" (*.tf)");

const QString path = qApp->Seamly2DSettings()->getImageFilePath();

Expand Down Expand Up @@ -4401,6 +4398,7 @@ void MainWindow::Clear()
#endif
CleanLayout();
pieceList.clear(); // don't move to CleanLayout()
doc->clearBackgroundImageMap();
qApp->getUndoStack()->clear();
toolProperties->clearPropertyBrowser();
toolProperties->itemClicked(nullptr);
Expand Down
13 changes: 9 additions & 4 deletions src/libs/ifc/xml/vabstractpattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3130,25 +3130,30 @@ QString VAbstractPattern::useGroupLineWeight(quint32 toolId, QString weight)
}


QMap<qint32, ImageItem *> VAbstractPattern::getBackgroundImageMap()
QMap<qint32, ImageItem *> VAbstractPattern::getBackgroundImageMap()
{
return m_imageMap;
}


void VAbstractPattern::addBackgroundImage(qint32 id, ImageItem *item)
void VAbstractPattern::addBackgroundImage(qint32 id, ImageItem *item)
{
m_imageMap.insert(id, item);
}


void VAbstractPattern::removeBackgroundImage(qint32 id)
void VAbstractPattern::removeBackgroundImage(qint32 id)
{
m_imageMap.remove(id);
}


ImageItem* VAbstractPattern::getBackgroundImage(qint32 id)
ImageItem* VAbstractPattern::getBackgroundImage(qint32 id)
{
return m_imageMap.value(id);
}

void VAbstractPattern::clearBackgroundImageMap()
{
m_imageMap.clear();
}
1 change: 1 addition & 0 deletions src/libs/ifc/xml/vabstractpattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class VAbstractPattern : public QObject, public VDomDocument
ImageItem * getBackgroundImage(qint32 id);
void addBackgroundImage(qint32 id, ImageItem *item);
void removeBackgroundImage(qint32 id);
void clearBackgroundImageMap();

QMap<GHeights, bool> GetGradationHeights() const;
void SetGradationHeights(const QMap<GHeights, bool> &options);
Expand Down
Loading