added getWidgetType() to ProfileWidgets, sorting content by date+id
This commit is contained in:
parent
4d9b0a8711
commit
030767127c
7 changed files with 40 additions and 9 deletions
|
@ -110,8 +110,7 @@ void ProfileInterface::savegameLoaded(SavegameData *savegame, QString savegamePa
|
|||
{
|
||||
SavegameWidget *sgdWidget = new SavegameWidget();
|
||||
sgdWidget->setSavegameData(savegame, savegamePath);
|
||||
ui->vlSavegame->addWidget(sgdWidget);
|
||||
widgets[sgdWidget] = "SavegameWidget";
|
||||
widgets[sgdWidget] = "SGD" + QFileInfo(savegamePath).fileName();
|
||||
savegames.append(savegame);
|
||||
if (selectedWidgts != 0) { sgdWidget->setSelectionMode(true); }
|
||||
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(savegameDeleted()));
|
||||
|
@ -125,8 +124,7 @@ void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, QString pictureP
|
|||
{
|
||||
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, threadDB);
|
||||
picWidget->setSnapmaticPicture(picture, picturePath);
|
||||
ui->vlSnapmatic->addWidget(picWidget);
|
||||
widgets[picWidget] = "SnapmaticWidget";
|
||||
widgets[picWidget] = "PIC" + picture->getPictureSortStr();
|
||||
pictures.append(picture);
|
||||
if (selectedWidgts != 0) { picWidget->setSelectionMode(true); }
|
||||
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(pictureDeleted()));
|
||||
|
@ -145,6 +143,20 @@ void ProfileInterface::loadingProgress(int value, int maximum)
|
|||
|
||||
void ProfileInterface::profileLoaded_p()
|
||||
{
|
||||
QStringList widgetsKeyList = widgets.values();
|
||||
qSort(widgetsKeyList.begin(), widgetsKeyList.end());
|
||||
foreach(QString widgetKey, widgetsKeyList)
|
||||
{
|
||||
ProfileWidget *widget = widgets.key(widgetKey);
|
||||
if (widget->getWidgetType() == "SnapmaticWidget")
|
||||
{
|
||||
ui->vlSnapmatic->insertWidget(0, widget);
|
||||
}
|
||||
else if (widget->getWidgetType() == "SavegameWidget")
|
||||
{
|
||||
ui->vlSavegame->addWidget(widget);
|
||||
}
|
||||
}
|
||||
saSpacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
ui->saProfileContent->layout()->addItem(saSpacerItem);
|
||||
ui->swProfile->setCurrentWidget(ui->pageProfile);
|
||||
|
@ -418,11 +430,11 @@ void ProfileInterface::exportSelected()
|
|||
{
|
||||
if (widget->isSelected())
|
||||
{
|
||||
if (widgets[widget] == "SnapmaticWidget")
|
||||
if (widget->getWidgetType() == "SnapmaticWidget")
|
||||
{
|
||||
exportPictures++;
|
||||
}
|
||||
else if (widgets[widget] == "SavegameWidgets")
|
||||
else if (widget->getWidgetType() == "SavegameWidgets")
|
||||
{
|
||||
exportSavegames++;
|
||||
}
|
||||
|
@ -537,7 +549,7 @@ void ProfileInterface::deleteSelected()
|
|||
{
|
||||
if (widget->isSelected())
|
||||
{
|
||||
if (widgets[widget] == "SnapmaticWidget")
|
||||
if (widget->getWidgetType() == "SnapmaticWidget")
|
||||
{
|
||||
SnapmaticWidget *picWidget = (SnapmaticWidget*)widget;
|
||||
SnapmaticPicture *picture = picWidget->getPicture();
|
||||
|
@ -547,7 +559,7 @@ void ProfileInterface::deleteSelected()
|
|||
pictureDeleted_f(picWidget);
|
||||
}
|
||||
}
|
||||
else if (widgets[widget] == "SavegameWidget")
|
||||
else if (widget->getWidgetType() == "SavegameWidget")
|
||||
{
|
||||
SavegameWidget *sgdWidget = (SavegameWidget*)widget;
|
||||
SavegameData *savegame = sgdWidget->getSavegame();
|
||||
|
|
|
@ -43,3 +43,9 @@ void ProfileWidget::setSelectionMode(bool selectionMode)
|
|||
{
|
||||
qDebug() << "ProfileWidget::setSelectionMode got used without overwrite, result:" << selectionMode;
|
||||
}
|
||||
|
||||
QString ProfileWidget::getWidgetType()
|
||||
{
|
||||
qDebug() << "ProfileWidget::getWidgetType got used without overwrite";
|
||||
return "ProfileWidget";
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
virtual void setSelectionMode(bool selectionMode);
|
||||
virtual void setSelected(bool isSelected);
|
||||
virtual bool isSelected();
|
||||
virtual QString getWidgetType();
|
||||
~ProfileWidget();
|
||||
|
||||
signals:
|
||||
|
|
|
@ -224,3 +224,8 @@ SavegameData* SavegameWidget::getSavegame()
|
|||
{
|
||||
return sgdata;
|
||||
}
|
||||
|
||||
QString SavegameWidget::getWidgetType()
|
||||
{
|
||||
return "SavegameWidget";
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
void setSelectionMode(bool selectionMode);
|
||||
void setSelected(bool isSelected);
|
||||
SavegameData* getSavegame();
|
||||
QString getWidgetType();
|
||||
bool isSelected();
|
||||
~SavegameWidget();
|
||||
|
||||
|
|
|
@ -233,3 +233,8 @@ SnapmaticPicture* SnapmaticWidget::getPicture()
|
|||
{
|
||||
return smpic;
|
||||
}
|
||||
|
||||
QString SnapmaticWidget::getWidgetType()
|
||||
{
|
||||
return "SnapmaticWidget";
|
||||
}
|
||||
|
|
|
@ -41,8 +41,9 @@ public:
|
|||
void setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath);
|
||||
void setSelectionMode(bool selectionMode);
|
||||
void setSelected(bool isSelected);
|
||||
bool isSelected();
|
||||
SnapmaticPicture *getPicture();
|
||||
QString getWidgetType();
|
||||
bool isSelected();
|
||||
~SnapmaticWidget();
|
||||
|
||||
private slots:
|
||||
|
|
Loading…
Reference in a new issue