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();
|
SavegameWidget *sgdWidget = new SavegameWidget();
|
||||||
sgdWidget->setSavegameData(savegame, savegamePath);
|
sgdWidget->setSavegameData(savegame, savegamePath);
|
||||||
ui->vlSavegame->addWidget(sgdWidget);
|
widgets[sgdWidget] = "SGD" + QFileInfo(savegamePath).fileName();
|
||||||
widgets[sgdWidget] = "SavegameWidget";
|
|
||||||
savegames.append(savegame);
|
savegames.append(savegame);
|
||||||
if (selectedWidgts != 0) { sgdWidget->setSelectionMode(true); }
|
if (selectedWidgts != 0) { sgdWidget->setSelectionMode(true); }
|
||||||
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(savegameDeleted()));
|
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);
|
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, threadDB);
|
||||||
picWidget->setSnapmaticPicture(picture, picturePath);
|
picWidget->setSnapmaticPicture(picture, picturePath);
|
||||||
ui->vlSnapmatic->addWidget(picWidget);
|
widgets[picWidget] = "PIC" + picture->getPictureSortStr();
|
||||||
widgets[picWidget] = "SnapmaticWidget";
|
|
||||||
pictures.append(picture);
|
pictures.append(picture);
|
||||||
if (selectedWidgts != 0) { picWidget->setSelectionMode(true); }
|
if (selectedWidgts != 0) { picWidget->setSelectionMode(true); }
|
||||||
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(pictureDeleted()));
|
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(pictureDeleted()));
|
||||||
|
@ -145,6 +143,20 @@ void ProfileInterface::loadingProgress(int value, int maximum)
|
||||||
|
|
||||||
void ProfileInterface::profileLoaded_p()
|
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);
|
saSpacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
ui->saProfileContent->layout()->addItem(saSpacerItem);
|
ui->saProfileContent->layout()->addItem(saSpacerItem);
|
||||||
ui->swProfile->setCurrentWidget(ui->pageProfile);
|
ui->swProfile->setCurrentWidget(ui->pageProfile);
|
||||||
|
@ -418,11 +430,11 @@ void ProfileInterface::exportSelected()
|
||||||
{
|
{
|
||||||
if (widget->isSelected())
|
if (widget->isSelected())
|
||||||
{
|
{
|
||||||
if (widgets[widget] == "SnapmaticWidget")
|
if (widget->getWidgetType() == "SnapmaticWidget")
|
||||||
{
|
{
|
||||||
exportPictures++;
|
exportPictures++;
|
||||||
}
|
}
|
||||||
else if (widgets[widget] == "SavegameWidgets")
|
else if (widget->getWidgetType() == "SavegameWidgets")
|
||||||
{
|
{
|
||||||
exportSavegames++;
|
exportSavegames++;
|
||||||
}
|
}
|
||||||
|
@ -537,7 +549,7 @@ void ProfileInterface::deleteSelected()
|
||||||
{
|
{
|
||||||
if (widget->isSelected())
|
if (widget->isSelected())
|
||||||
{
|
{
|
||||||
if (widgets[widget] == "SnapmaticWidget")
|
if (widget->getWidgetType() == "SnapmaticWidget")
|
||||||
{
|
{
|
||||||
SnapmaticWidget *picWidget = (SnapmaticWidget*)widget;
|
SnapmaticWidget *picWidget = (SnapmaticWidget*)widget;
|
||||||
SnapmaticPicture *picture = picWidget->getPicture();
|
SnapmaticPicture *picture = picWidget->getPicture();
|
||||||
|
@ -547,7 +559,7 @@ void ProfileInterface::deleteSelected()
|
||||||
pictureDeleted_f(picWidget);
|
pictureDeleted_f(picWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (widgets[widget] == "SavegameWidget")
|
else if (widget->getWidgetType() == "SavegameWidget")
|
||||||
{
|
{
|
||||||
SavegameWidget *sgdWidget = (SavegameWidget*)widget;
|
SavegameWidget *sgdWidget = (SavegameWidget*)widget;
|
||||||
SavegameData *savegame = sgdWidget->getSavegame();
|
SavegameData *savegame = sgdWidget->getSavegame();
|
||||||
|
|
|
@ -43,3 +43,9 @@ void ProfileWidget::setSelectionMode(bool selectionMode)
|
||||||
{
|
{
|
||||||
qDebug() << "ProfileWidget::setSelectionMode got used without overwrite, result:" << 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 setSelectionMode(bool selectionMode);
|
||||||
virtual void setSelected(bool isSelected);
|
virtual void setSelected(bool isSelected);
|
||||||
virtual bool isSelected();
|
virtual bool isSelected();
|
||||||
|
virtual QString getWidgetType();
|
||||||
~ProfileWidget();
|
~ProfileWidget();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -224,3 +224,8 @@ SavegameData* SavegameWidget::getSavegame()
|
||||||
{
|
{
|
||||||
return sgdata;
|
return sgdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SavegameWidget::getWidgetType()
|
||||||
|
{
|
||||||
|
return "SavegameWidget";
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
void setSelectionMode(bool selectionMode);
|
void setSelectionMode(bool selectionMode);
|
||||||
void setSelected(bool isSelected);
|
void setSelected(bool isSelected);
|
||||||
SavegameData* getSavegame();
|
SavegameData* getSavegame();
|
||||||
|
QString getWidgetType();
|
||||||
bool isSelected();
|
bool isSelected();
|
||||||
~SavegameWidget();
|
~SavegameWidget();
|
||||||
|
|
||||||
|
|
|
@ -233,3 +233,8 @@ SnapmaticPicture* SnapmaticWidget::getPicture()
|
||||||
{
|
{
|
||||||
return smpic;
|
return smpic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SnapmaticWidget::getWidgetType()
|
||||||
|
{
|
||||||
|
return "SnapmaticWidget";
|
||||||
|
}
|
||||||
|
|
|
@ -41,8 +41,9 @@ public:
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath);
|
void setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath);
|
||||||
void setSelectionMode(bool selectionMode);
|
void setSelectionMode(bool selectionMode);
|
||||||
void setSelected(bool isSelected);
|
void setSelected(bool isSelected);
|
||||||
bool isSelected();
|
|
||||||
SnapmaticPicture *getPicture();
|
SnapmaticPicture *getPicture();
|
||||||
|
QString getWidgetType();
|
||||||
|
bool isSelected();
|
||||||
~SnapmaticWidget();
|
~SnapmaticWidget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
Loading…
Reference in a new issue