mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-03-23 15:50:37 +01:00
Differentiate between created date / updated date in save preview
still only shows most recent date, this just changes the text
This commit is contained in:
parent
d0f1024f95
commit
057435baa6
@ -1637,7 +1637,8 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
|
||||
std::string tempUsername = objDocument["Username"].asString();
|
||||
std::string tempName = objDocument["Name"].asString();
|
||||
std::string tempDescription = objDocument["Description"].asString();
|
||||
int tempDate = objDocument["Date"].asInt();
|
||||
int tempCreatedDate = objDocument["DateCreated"].asInt();
|
||||
int tempUpdatedDate = objDocument["Date"].asInt();
|
||||
bool tempPublished = objDocument["Published"].asBool();
|
||||
bool tempFavourite = objDocument["Favourite"].asBool();
|
||||
int tempComments = objDocument["Comments"].asInt();
|
||||
@ -1649,9 +1650,9 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
|
||||
for (Json::UInt j = 0; j < tagsArray.size(); j++)
|
||||
tempTags.push_back(tagsArray[j].asString());
|
||||
|
||||
SaveInfo * tempSave = new SaveInfo(tempID, tempDate, tempScoreUp, tempScoreDown,
|
||||
tempMyScore, tempUsername, tempName, tempDescription,
|
||||
tempPublished, tempTags);
|
||||
SaveInfo * tempSave = new SaveInfo(tempID, tempCreatedDate, tempUpdatedDate, tempScoreUp,
|
||||
tempScoreDown, tempMyScore, tempUsername, tempName,
|
||||
tempDescription, tempPublished, tempTags);
|
||||
tempSave->Comments = tempComments;
|
||||
tempSave->Favourite = tempFavourite;
|
||||
tempSave->Views = tempViews;
|
||||
@ -1700,7 +1701,8 @@ RequestBroker::Request * Client::GetSaveAsync(int saveID, int saveDate)
|
||||
std::string tempUsername = objDocument["Username"].asString();
|
||||
std::string tempName = objDocument["Name"].asString();
|
||||
std::string tempDescription = objDocument["Description"].asString();
|
||||
int tempDate = objDocument["Date"].asInt();
|
||||
int tempCreatedDate = objDocument["DateCreated"].asInt();
|
||||
int tempUpdatedDate = objDocument["Date"].asInt();
|
||||
bool tempPublished = objDocument["Published"].asBool();
|
||||
bool tempFavourite = objDocument["Favourite"].asBool();
|
||||
int tempComments = objDocument["Comments"].asInt();
|
||||
@ -1712,9 +1714,9 @@ RequestBroker::Request * Client::GetSaveAsync(int saveID, int saveDate)
|
||||
for (Json::UInt j = 0; j < tagsArray.size(); j++)
|
||||
tempTags.push_back(tagsArray[j].asString());
|
||||
|
||||
SaveInfo * tempSave = new SaveInfo(tempID, tempDate, tempScoreUp, tempScoreDown,
|
||||
tempMyScore, tempUsername, tempName, tempDescription,
|
||||
tempPublished, tempTags);
|
||||
SaveInfo * tempSave = new SaveInfo(tempID, tempCreatedDate, tempUpdatedDate, tempScoreUp,
|
||||
tempScoreDown, tempMyScore, tempUsername, tempName,
|
||||
tempDescription, tempPublished, tempTags);
|
||||
tempSave->Comments = tempComments;
|
||||
tempSave->Favourite = tempFavourite;
|
||||
tempSave->Views = tempViews;
|
||||
@ -1874,14 +1876,15 @@ std::vector<SaveInfo*> * Client::SearchSaves(int start, int count, std::string q
|
||||
for (Json::UInt j = 0; j < savesArray.size(); j++)
|
||||
{
|
||||
int tempID = savesArray[j]["ID"].asInt();
|
||||
int tempDate = savesArray[j]["Date"].asInt();
|
||||
int tempCreatedDate = savesArray[j]["Created"].asInt();
|
||||
int tempUpdatedDate = savesArray[j]["Updated"].asInt();
|
||||
int tempScoreUp = savesArray[j]["ScoreUp"].asInt();
|
||||
int tempScoreDown = savesArray[j]["ScoreDown"].asInt();
|
||||
std::string tempUsername = savesArray[j]["Username"].asString();
|
||||
std::string tempName = savesArray[j]["Name"].asString();
|
||||
int tempVersion = savesArray[j]["Version"].asInt();
|
||||
bool tempPublished = savesArray[j]["Published"].asBool();
|
||||
SaveInfo * tempSaveInfo = new SaveInfo(tempID, tempDate, tempScoreUp, tempScoreDown, tempUsername, tempName);
|
||||
SaveInfo * tempSaveInfo = new SaveInfo(tempID, tempCreatedDate, tempUpdatedDate, tempScoreUp, tempScoreDown, tempUsername, tempName);
|
||||
tempSaveInfo->Version = tempVersion;
|
||||
tempSaveInfo->SetPublished(tempPublished);
|
||||
saveArray->push_back(tempSaveInfo);
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
SaveInfo::SaveInfo(SaveInfo & save):
|
||||
id(save.id),
|
||||
date(save.date),
|
||||
createdDate(save.createdDate),
|
||||
updatedDate(save.updatedDate),
|
||||
votesUp(save.votesUp),
|
||||
votesDown(save.votesDown),
|
||||
vote(save.vote),
|
||||
@ -25,9 +26,10 @@ SaveInfo::SaveInfo(SaveInfo & save):
|
||||
gameSave = new GameSave(*save.gameSave);
|
||||
}
|
||||
|
||||
SaveInfo::SaveInfo(int _id, int _date, int _votesUp, int _votesDown, std::string _userName, std::string _name):
|
||||
SaveInfo::SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, int _votesDown, std::string _userName, std::string _name):
|
||||
id(_id),
|
||||
date(_date),
|
||||
createdDate(_createdDate),
|
||||
updatedDate(_updatedDate),
|
||||
votesUp(_votesUp),
|
||||
votesDown(_votesDown),
|
||||
vote(0),
|
||||
@ -45,9 +47,10 @@ SaveInfo::SaveInfo(int _id, int _date, int _votesUp, int _votesDown, std::string
|
||||
|
||||
}
|
||||
|
||||
SaveInfo::SaveInfo(int _id, int date_, int _votesUp, int _votesDown, int _vote, std::string _userName, std::string _name, std::string description_, bool published_, std::list<std::string> tags_):
|
||||
SaveInfo::SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, int _votesDown, int _vote, std::string _userName, std::string _name, std::string description_, bool published_, std::list<std::string> tags_):
|
||||
id(_id),
|
||||
date(date_),
|
||||
createdDate(_createdDate),
|
||||
updatedDate(_updatedDate),
|
||||
votesUp(_votesUp),
|
||||
votesDown(_votesDown),
|
||||
vote(_vote),
|
||||
|
@ -14,7 +14,8 @@ class SaveInfo
|
||||
private:
|
||||
public:
|
||||
int id;
|
||||
int date;
|
||||
int createdDate;
|
||||
int updatedDate;
|
||||
int votesUp, votesDown;
|
||||
int vote;
|
||||
bool Favourite;
|
||||
@ -33,9 +34,9 @@ public:
|
||||
|
||||
SaveInfo(SaveInfo & save);
|
||||
|
||||
SaveInfo(int _id, int _date, int _votesUp, int _votesDown, std::string _userName, std::string _name);
|
||||
SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, int _votesDown, std::string _userName, std::string _name);
|
||||
|
||||
SaveInfo(int _id, int date_, int _votesUp, int _votesDown, int _vote, std::string _userName, std::string _name, std::string description_, bool published_, std::list<std::string> tags);
|
||||
SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, int _votesDown, int _vote, std::string _userName, std::string _name, std::string description_, bool published_, std::list<std::string> tags);
|
||||
|
||||
~SaveInfo();
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ void GameController::OpenSaveWindow()
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
|
||||
SaveInfo tempSave(0, 0, 0, 0, 0, gameModel->GetUser().Username, "");
|
||||
tempSave.SetGameSave(gameSave);
|
||||
new ServerSaveActivity(tempSave, new SaveUploadedCallback(this));
|
||||
}
|
||||
@ -1440,7 +1440,7 @@ void GameController::SaveAsCurrent()
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
|
||||
SaveInfo tempSave(0, 0, 0, 0, 0, gameModel->GetUser().Username, "");
|
||||
tempSave.SetGameSave(gameSave);
|
||||
new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
|
||||
}
|
||||
|
@ -213,7 +213,8 @@ bool PreviewModel::ParseSaveInfo(char * saveInfoResponse)
|
||||
std::string tempUsername = objDocument["Username"].asString();
|
||||
std::string tempName = objDocument["Name"].asString();
|
||||
std::string tempDescription = objDocument["Description"].asString();
|
||||
int tempDate = objDocument["Date"].asInt();
|
||||
int tempCreatedDate = objDocument["DateCreated"].asInt();
|
||||
int tempUpdatedDate = objDocument["Date"].asInt();
|
||||
bool tempPublished = objDocument["Published"].asBool();
|
||||
bool tempFavourite = objDocument["Favourite"].asBool();
|
||||
int tempComments = objDocument["Comments"].asInt();
|
||||
@ -225,9 +226,9 @@ bool PreviewModel::ParseSaveInfo(char * saveInfoResponse)
|
||||
for (Json::UInt j = 0; j < tagsArray.size(); j++)
|
||||
tempTags.push_back(tagsArray[j].asString());
|
||||
|
||||
saveInfo = new SaveInfo(tempID, tempDate, tempScoreUp, tempScoreDown,
|
||||
tempMyScore, tempUsername, tempName, tempDescription,
|
||||
tempPublished, tempTags);
|
||||
saveInfo = new SaveInfo(tempID, tempCreatedDate, tempUpdatedDate, tempScoreUp,
|
||||
tempScoreDown, tempMyScore, tempUsername, tempName,
|
||||
tempDescription, tempPublished, tempTags);
|
||||
saveInfo->Comments = tempComments;
|
||||
saveInfo->Favourite = tempFavourite;
|
||||
saveInfo->Views = tempViews;
|
||||
|
@ -497,13 +497,19 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender)
|
||||
votesUp = save->votesUp;
|
||||
votesDown = save->votesDown;
|
||||
saveNameLabel->SetText(save->name);
|
||||
if(showAvatars) {
|
||||
std::string dateType;
|
||||
if (save->updatedDate == save->createdDate)
|
||||
dateType = "Created:";
|
||||
else
|
||||
dateType = "Updated:";
|
||||
if (showAvatars)
|
||||
{
|
||||
avatarButton->SetUsername(save->userName);
|
||||
authorDateLabel->SetText("\bw" + save->userName + " \bgDate:\bw " + format::UnixtimeToDateMini(save->date));
|
||||
authorDateLabel->SetText("\bw" + save->userName + " \bg" + dateType + " \bw" + format::UnixtimeToDateMini(save->updatedDate));
|
||||
}
|
||||
else
|
||||
{
|
||||
authorDateLabel->SetText("\bgAuthor:\bw " + save->userName + " \bgDate:\bw " + format::UnixtimeToDateMini(save->date));
|
||||
authorDateLabel->SetText("\bgAuthor:\bw " + save->userName + " \bg" + dateType + " \bw" + format::UnixtimeToDateMini(save->updatedDate));
|
||||
}
|
||||
if (Client::Ref().GetAuthUser().ID && save->userName == Client::Ref().GetAuthUser().Username)
|
||||
userIsAuthor = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user