file handler fix, deleting snapmatic pictures added

This commit is contained in:
Rafael 2016-03-28 15:24:09 +02:00
parent 517f446d12
commit 2c6a0fa2a5
7 changed files with 82 additions and 6 deletions

View file

@ -55,11 +55,13 @@ ProfileInterface::~ProfileInterface()
}
foreach(SnapmaticPicture *picture, pictures)
{
pictures.removeAll(picture);
picture->deleteLater();
delete picture;
}
foreach(QWidget *widget, widgets)
{
widgets.removeAll(widget);
widget->deleteLater();
delete widget;
}
@ -101,6 +103,7 @@ void ProfileInterface::on_pictureLoaded(SnapmaticPicture *picture, QString pictu
ui->vlSnapmatic->addWidget(picWidget);
widgets.append(picWidget);
pictures.append(picture);
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(on_pictureDeleted()));
}
void ProfileInterface::on_loadingProgress(int value, int maximum)
@ -118,6 +121,14 @@ void ProfileInterface::on_profileLoaded()
ui->cmdCloseProfile->setEnabled(true);
}
void ProfileInterface::on_pictureDeleted()
{
SnapmaticWidget *picWidget = (SnapmaticWidget*)sender();
widgets.removeAll(picWidget);
picWidget->deleteLater();
delete picWidget;
}
void ProfileInterface::on_cmdCloseProfile_clicked()
{
emit profileClosed();