Month and DayOfWeek names

master
const an teen 2021-12-26 05:08:31 -05:00
parent 138b5f35e1
commit 43383cd70b
1 changed files with 17 additions and 2 deletions

View File

@ -950,7 +950,14 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath, bool isHead
std::sort(folderNameS.begin(), folderNameS.end());
for (const auto &f: folderNameS) {
QString onePoint = HTML_PAYLOAD_LIST_POINT_FOLDER;
replaceTag(onePoint, "POINT_CONTENT", f);
bool yearIsOk {false};
bool monthIsOk {false};
QDate dateOfMonth (year.toInt(&yearIsOk), f.toInt(&monthIsOk), 1);
QString nameOfMonth;
if (yearIsOk and monthIsOk) {
nameOfMonth = QLocale().standaloneMonthName(dateOfMonth.month());
}
replaceTag(onePoint, "POINT_CONTENT", f + " (" + nameOfMonth + ")");
replaceTag(onePoint, "POINT_LINK", "/"+server+"/"+channel+"/"+year+"/"+f);
payloadBlock += onePoint;
}
@ -972,7 +979,15 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath, bool isHead
std::sort(fileNameS.begin(), fileNameS.end());
for (const auto &a: fileNameS) {
QString onePoint = HTML_PAYLOAD_LIST_POINT_MESSAGE;
replaceTag(onePoint, "POINT_CONTENT", a);
bool yearIsOk {false};
bool monthIsOk {false};
bool dayIsOk {false};
QDate dateOfDay (year.toInt(&yearIsOk), month.toInt(&monthIsOk), a.toInt(&dayIsOk));
QString nameOfDay;
if (yearIsOk and monthIsOk and dayIsOk) {
nameOfDay = QLocale().standaloneDayName(dateOfDay.dayOfWeek());
}
replaceTag(onePoint, "POINT_CONTENT", a + " (" + nameOfDay + ")");
replaceTag(onePoint, "POINT_LINK", "/"+server+"/"+channel+"/"+year+"/"+month+"/"+a);
payloadBlock += onePoint;
}