selection bugs at import and delete fixed
This commit is contained in:
parent
f866de1137
commit
50809e7a7c
7 changed files with 55 additions and 12 deletions
|
@ -58,8 +58,15 @@ ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *cre
|
||||||
|
|
||||||
ProfileInterface::~ProfileInterface()
|
ProfileInterface::~ProfileInterface()
|
||||||
{
|
{
|
||||||
|
foreach(ProfileWidget *widget, widgets.keys())
|
||||||
|
{
|
||||||
|
widgets.remove(widget);
|
||||||
|
widget->deleteLater();
|
||||||
|
delete widget;
|
||||||
|
}
|
||||||
foreach(SavegameData *savegame, savegames)
|
foreach(SavegameData *savegame, savegames)
|
||||||
{
|
{
|
||||||
|
savegames.removeAll(savegame);
|
||||||
savegame->deleteLater();
|
savegame->deleteLater();
|
||||||
delete savegame;
|
delete savegame;
|
||||||
}
|
}
|
||||||
|
@ -69,12 +76,6 @@ ProfileInterface::~ProfileInterface()
|
||||||
picture->deleteLater();
|
picture->deleteLater();
|
||||||
delete picture;
|
delete picture;
|
||||||
}
|
}
|
||||||
foreach(ProfileWidget *widget, widgets.keys())
|
|
||||||
{
|
|
||||||
widgets.remove(widget);
|
|
||||||
widget->deleteLater();
|
|
||||||
delete widget;
|
|
||||||
}
|
|
||||||
profileLoader->deleteLater();
|
profileLoader->deleteLater();
|
||||||
delete profileLoader;
|
delete profileLoader;
|
||||||
delete ui;
|
delete ui;
|
||||||
|
@ -104,6 +105,7 @@ void ProfileInterface::on_savegameLoaded(SavegameData *savegame, QString savegam
|
||||||
ui->vlSavegame->addWidget(sgdWidget);
|
ui->vlSavegame->addWidget(sgdWidget);
|
||||||
widgets[sgdWidget] = "SavegameWidget";
|
widgets[sgdWidget] = "SavegameWidget";
|
||||||
savegames.append(savegame);
|
savegames.append(savegame);
|
||||||
|
if (selectedWidgts != 0) { sgdWidget->setSelectionMode(true); }
|
||||||
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(on_savegameDeleted()));
|
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(on_savegameDeleted()));
|
||||||
QObject::connect(sgdWidget, SIGNAL(widgetSelected()), this, SLOT(on_profileWidgetSelected()));
|
QObject::connect(sgdWidget, SIGNAL(widgetSelected()), this, SLOT(on_profileWidgetSelected()));
|
||||||
QObject::connect(sgdWidget, SIGNAL(widgetDeselected()), this, SLOT(on_profileWidgetDeselected()));
|
QObject::connect(sgdWidget, SIGNAL(widgetDeselected()), this, SLOT(on_profileWidgetDeselected()));
|
||||||
|
@ -116,6 +118,7 @@ void ProfileInterface::on_pictureLoaded(SnapmaticPicture *picture, QString pictu
|
||||||
ui->vlSnapmatic->addWidget(picWidget);
|
ui->vlSnapmatic->addWidget(picWidget);
|
||||||
widgets[picWidget] = "SnapmaticWidget";
|
widgets[picWidget] = "SnapmaticWidget";
|
||||||
pictures.append(picture);
|
pictures.append(picture);
|
||||||
|
if (selectedWidgts != 0) { picWidget->setSelectionMode(true); }
|
||||||
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(on_pictureDeleted()));
|
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(on_pictureDeleted()));
|
||||||
QObject::connect(picWidget, SIGNAL(widgetSelected()), this, SLOT(on_profileWidgetSelected()));
|
QObject::connect(picWidget, SIGNAL(widgetSelected()), this, SLOT(on_profileWidgetSelected()));
|
||||||
QObject::connect(picWidget, SIGNAL(widgetDeselected()), this, SLOT(on_profileWidgetDeselected()));
|
QObject::connect(picWidget, SIGNAL(widgetDeselected()), this, SLOT(on_profileWidgetDeselected()));
|
||||||
|
@ -140,17 +143,21 @@ void ProfileInterface::on_profileLoaded()
|
||||||
void ProfileInterface::on_savegameDeleted()
|
void ProfileInterface::on_savegameDeleted()
|
||||||
{
|
{
|
||||||
SavegameWidget *sgdWidget = (SavegameWidget*)sender();
|
SavegameWidget *sgdWidget = (SavegameWidget*)sender();
|
||||||
widgets.remove(sgdWidget);
|
SavegameData *savegame = sgdWidget->getSavegame();
|
||||||
sgdWidget->deleteLater();
|
if (sgdWidget->isSelected()) { sgdWidget->setChecked(false); }
|
||||||
delete sgdWidget;
|
sgdWidget->close();
|
||||||
|
savegames.removeAll(savegame);
|
||||||
|
delete savegame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::on_pictureDeleted()
|
void ProfileInterface::on_pictureDeleted()
|
||||||
{
|
{
|
||||||
SnapmaticWidget *picWidget = (SnapmaticWidget*)sender();
|
SnapmaticWidget *picWidget = (SnapmaticWidget*)sender();
|
||||||
widgets.remove(picWidget);
|
SnapmaticPicture *picture = picWidget->getPicture();
|
||||||
picWidget->deleteLater();
|
if (picWidget->isSelected()) { picWidget->setChecked(false); }
|
||||||
delete picWidget;
|
picWidget->close();
|
||||||
|
pictures.removeAll(picture);
|
||||||
|
delete picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::on_cmdCloseProfile_clicked()
|
void ProfileInterface::on_cmdCloseProfile_clicked()
|
||||||
|
|
|
@ -24,6 +24,16 @@ ProfileWidget::ProfileWidget(QWidget *parent) : QWidget(parent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfileWidget::~ProfileWidget()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProfileWidget::isSelected()
|
||||||
|
{
|
||||||
|
qDebug() << "ProfileWidget got used without overwrite";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileWidget::setSelectionMode(bool selectionMode)
|
void ProfileWidget::setSelectionMode(bool selectionMode)
|
||||||
{
|
{
|
||||||
qDebug() << "ProfileWidget got used without overwrite, result:" << selectionMode;
|
qDebug() << "ProfileWidget got used without overwrite, result:" << selectionMode;
|
||||||
|
|
|
@ -27,6 +27,8 @@ class ProfileWidget : public QWidget
|
||||||
public:
|
public:
|
||||||
explicit ProfileWidget(QWidget *parent = 0);
|
explicit ProfileWidget(QWidget *parent = 0);
|
||||||
virtual void setSelectionMode(bool selectionMode);
|
virtual void setSelectionMode(bool selectionMode);
|
||||||
|
virtual bool isSelected();
|
||||||
|
~ProfileWidget();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,17 @@ void SavegameWidget::on_cbSelected_stateChanged(int arg1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SavegameWidget::isSelected()
|
||||||
|
{
|
||||||
|
return ui->cbSelected->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
void SavegameWidget::setSelectionMode(bool selectionMode)
|
void SavegameWidget::setSelectionMode(bool selectionMode)
|
||||||
{
|
{
|
||||||
ui->cbSelected->setVisible(selectionMode);
|
ui->cbSelected->setVisible(selectionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SavegameData* SavegameWidget::getSavegame()
|
||||||
|
{
|
||||||
|
return sgdata;
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,8 @@ public:
|
||||||
void setSavegameData(SavegameData *savegame, QString savegamePath);
|
void setSavegameData(SavegameData *savegame, QString savegamePath);
|
||||||
void setSelectionMode(bool selectionMode);
|
void setSelectionMode(bool selectionMode);
|
||||||
void setChecked(bool isChecked);
|
void setChecked(bool isChecked);
|
||||||
|
SavegameData* getSavegame();
|
||||||
|
bool isSelected();
|
||||||
~SavegameWidget();
|
~SavegameWidget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -155,7 +155,17 @@ void SnapmaticWidget::on_cbSelected_stateChanged(int arg1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SnapmaticWidget::isSelected()
|
||||||
|
{
|
||||||
|
return ui->cbSelected->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::setSelectionMode(bool selectionMode)
|
void SnapmaticWidget::setSelectionMode(bool selectionMode)
|
||||||
{
|
{
|
||||||
ui->cbSelected->setVisible(selectionMode);
|
ui->cbSelected->setVisible(selectionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SnapmaticPicture* SnapmaticWidget::getPicture()
|
||||||
|
{
|
||||||
|
return smpic;
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ public:
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath);
|
void setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath);
|
||||||
void setSelectionMode(bool selectionMode);
|
void setSelectionMode(bool selectionMode);
|
||||||
void setChecked(bool isChecked);
|
void setChecked(bool isChecked);
|
||||||
|
bool isSelected();
|
||||||
|
SnapmaticPicture *getPicture();
|
||||||
~SnapmaticWidget();
|
~SnapmaticWidget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
Loading…
Reference in a new issue