mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Added copy constructors and operator= to folder and comicdb, LibraryItem has to be a QObject, and QObject disables copy.
This commit is contained in:
parent
7ed4c27c01
commit
2149af25b1
@ -11,6 +11,11 @@ ComicDB::ComicDB()
|
||||
|
||||
}
|
||||
|
||||
ComicDB::ComicDB(const ComicDB &comicDB)
|
||||
{
|
||||
operator=(comicDB);
|
||||
}
|
||||
|
||||
bool ComicDB::isDir()
|
||||
{
|
||||
return false;
|
||||
@ -105,7 +110,18 @@ QString ComicDB::toTXT()
|
||||
if(!info.notes.isNull())
|
||||
txt.append(QString("notes:%1\r\n").arg(info.notes.toString()));
|
||||
|
||||
return txt;
|
||||
return txt;
|
||||
}
|
||||
|
||||
ComicDB &ComicDB::operator=(const ComicDB &other)
|
||||
{
|
||||
LibraryItem::operator =(other);
|
||||
|
||||
this->_hasCover = other._hasCover;
|
||||
|
||||
this->info = other.info;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
QString ComicDB::getFileName() const
|
||||
|
@ -122,14 +122,16 @@ private:
|
||||
|
||||
class ComicDB : public LibraryItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ComicDB();
|
||||
ComicDB(const ComicDB & comicDB);
|
||||
|
||||
bool isDir();
|
||||
|
||||
bool _hasCover;
|
||||
|
||||
bool hasCover() {return _hasCover;};
|
||||
bool hasCover() {return _hasCover;}
|
||||
|
||||
//return comic file name
|
||||
QString getFileName() const;
|
||||
@ -147,12 +149,13 @@ public:
|
||||
|
||||
ComicInfo info;
|
||||
|
||||
bool operator==(const ComicDB & other){return id == other.id;};
|
||||
ComicDB & operator=(const ComicDB & other);
|
||||
bool operator==(const ComicDB & other){return id == other.id;}
|
||||
|
||||
friend QDataStream &operator<<(QDataStream &, const ComicDB &);
|
||||
friend QDataStream &operator>>(QDataStream &, ComicDB &);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ComicDB);
|
||||
Q_DECLARE_METATYPE(ComicDB)
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,19 @@
|
||||
|
||||
#include "folder.h"
|
||||
|
||||
Folder::Folder(const Folder &folder)
|
||||
{
|
||||
operator=(folder);
|
||||
}
|
||||
|
||||
Folder &Folder::operator =(const Folder &other)
|
||||
{
|
||||
LibraryItem::operator =(other);
|
||||
|
||||
this->knownParent = other.knownParent;
|
||||
this->knownId = other.knownId;
|
||||
this->finished = other.finished;
|
||||
this->completed = other.completed;
|
||||
|
||||
return *this;
|
||||
}
|
@ -11,16 +11,18 @@ public:
|
||||
bool knownParent;
|
||||
bool knownId;
|
||||
|
||||
Folder():knownParent(false), knownId(false){};
|
||||
Folder(qulonglong sid, qulonglong pid,QString fn, QString fp):knownParent(true), knownId(true){id = sid; parentId = pid;name = fn; path = fp;};
|
||||
Folder(QString fn, QString fp):knownParent(false), knownId(false){name = fn; path = fp;};
|
||||
void setId(qulonglong sid){id = sid;knownId = true;};
|
||||
void setFather(qulonglong pid){parentId = pid;knownParent = true;};
|
||||
bool isDir() {return true;};
|
||||
bool isFinished() const {return finished;};
|
||||
bool isCompleted() const {return completed;};
|
||||
void setFinished(bool b) {finished = b;};
|
||||
void setCompleted(bool b) {completed = b;};
|
||||
Folder():knownParent(false), knownId(false){}
|
||||
Folder(qulonglong sid, qulonglong pid,QString fn, QString fp):knownParent(true), knownId(true){id = sid; parentId = pid;name = fn; path = fp;}
|
||||
Folder(QString fn, QString fp):knownParent(false), knownId(false){name = fn; path = fp;}
|
||||
Folder(const Folder &folder);
|
||||
Folder &operator =(const Folder & other);
|
||||
void setId(qulonglong sid){id = sid;knownId = true;}
|
||||
void setFather(qulonglong pid){parentId = pid;knownParent = true;}
|
||||
bool isDir() {return true;}
|
||||
bool isFinished() const {return finished;}
|
||||
bool isCompleted() const {return completed;}
|
||||
void setFinished(bool b) {finished = b;}
|
||||
void setCompleted(bool b) {completed = b;}
|
||||
|
||||
private:
|
||||
bool finished;
|
||||
|
@ -0,0 +1,12 @@
|
||||
|
||||
#include "library_item.h"
|
||||
|
||||
LibraryItem &LibraryItem::operator=(const LibraryItem &other)
|
||||
{
|
||||
this->name = other.name;
|
||||
this->path = other.path;
|
||||
this->parentId = other.parentId;
|
||||
this->id = other.id;
|
||||
|
||||
return *this;
|
||||
}
|
@ -3,14 +3,16 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class LibraryItem
|
||||
class LibraryItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual bool isDir() = 0;
|
||||
LibraryItem & operator=(const LibraryItem & other);
|
||||
QString name;
|
||||
QString path;
|
||||
qulonglong parentId;
|
||||
qulonglong id;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user