mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
initial commit for deck repository tab
This commit is contained in:
parent
c0e64f3f42
commit
f31405743e
12 changed files with 1047 additions and 10 deletions
|
|
@ -187,6 +187,7 @@ void Response_DeckList::File::writeElement(QXmlStreamWriter *xml)
|
|||
xml->writeStartElement("file");
|
||||
xml->writeAttribute("name", name);
|
||||
xml->writeAttribute("id", QString::number(id));
|
||||
xml->writeAttribute("upload_time", QString::number(uploadTime.toTime_t()));
|
||||
xml->writeEndElement();
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +208,7 @@ bool Response_DeckList::Directory::readElement(QXmlStreamReader *xml)
|
|||
currentItem = new Directory(xml->attributes().value("name").toString());
|
||||
append(currentItem);
|
||||
} else if (xml->isStartElement() && (xml->name() == "file")) {
|
||||
currentItem = new File(xml->attributes().value("name").toString(), xml->attributes().value("id").toString().toInt());
|
||||
currentItem = new File(xml->attributes().value("name").toString(), xml->attributes().value("id").toString().toInt(), QDateTime::fromTime_t(xml->attributes().value("upload_time").toString().toUInt()));
|
||||
append(currentItem);
|
||||
} else if (xml->isEndElement() && (xml->name() == "directory"))
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
#include "protocol_item_ids.h"
|
||||
#include "protocol_datastructures.h"
|
||||
|
||||
|
|
@ -180,10 +181,13 @@ public:
|
|||
virtual void writeElement(QXmlStreamWriter *xml) = 0;
|
||||
};
|
||||
class File : public TreeItem {
|
||||
private:
|
||||
QDateTime uploadTime;
|
||||
public:
|
||||
File(const QString &_name, int _id) : TreeItem(_name, _id) { }
|
||||
File(const QString &_name, int _id, QDateTime _uploadTime) : TreeItem(_name, _id), uploadTime(_uploadTime) { }
|
||||
bool readElement(QXmlStreamReader *xml);
|
||||
void writeElement(QXmlStreamWriter *xml);
|
||||
QDateTime getUploadTime() const { return uploadTime; }
|
||||
};
|
||||
class Directory : public TreeItem, public QList<TreeItem *> {
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue