mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -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()
|
bool ComicDB::isDir()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -105,7 +110,18 @@ QString ComicDB::toTXT()
|
|||||||
if(!info.notes.isNull())
|
if(!info.notes.isNull())
|
||||||
txt.append(QString("notes:%1\r\n").arg(info.notes.toString()));
|
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
|
QString ComicDB::getFileName() const
|
||||||
|
@ -122,14 +122,16 @@ private:
|
|||||||
|
|
||||||
class ComicDB : public LibraryItem
|
class ComicDB : public LibraryItem
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ComicDB();
|
ComicDB();
|
||||||
|
ComicDB(const ComicDB & comicDB);
|
||||||
|
|
||||||
bool isDir();
|
bool isDir();
|
||||||
|
|
||||||
bool _hasCover;
|
bool _hasCover;
|
||||||
|
|
||||||
bool hasCover() {return _hasCover;};
|
bool hasCover() {return _hasCover;}
|
||||||
|
|
||||||
//return comic file name
|
//return comic file name
|
||||||
QString getFileName() const;
|
QString getFileName() const;
|
||||||
@ -147,12 +149,13 @@ public:
|
|||||||
|
|
||||||
ComicInfo info;
|
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 &, const ComicDB &);
|
||||||
friend QDataStream &operator>>(QDataStream &, ComicDB &);
|
friend QDataStream &operator>>(QDataStream &, ComicDB &);
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(ComicDB);
|
Q_DECLARE_METATYPE(ComicDB)
|
||||||
|
|
||||||
#endif
|
#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 knownParent;
|
||||||
bool knownId;
|
bool knownId;
|
||||||
|
|
||||||
Folder():knownParent(false), knownId(false){};
|
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(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(QString fn, QString fp):knownParent(false), knownId(false){name = fn; path = fp;}
|
||||||
void setId(qulonglong sid){id = sid;knownId = true;};
|
Folder(const Folder &folder);
|
||||||
void setFather(qulonglong pid){parentId = pid;knownParent = true;};
|
Folder &operator =(const Folder & other);
|
||||||
bool isDir() {return true;};
|
void setId(qulonglong sid){id = sid;knownId = true;}
|
||||||
bool isFinished() const {return finished;};
|
void setFather(qulonglong pid){parentId = pid;knownParent = true;}
|
||||||
bool isCompleted() const {return completed;};
|
bool isDir() {return true;}
|
||||||
void setFinished(bool b) {finished = b;};
|
bool isFinished() const {return finished;}
|
||||||
void setCompleted(bool b) {completed = b;};
|
bool isCompleted() const {return completed;}
|
||||||
|
void setFinished(bool b) {finished = b;}
|
||||||
|
void setCompleted(bool b) {completed = b;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool finished;
|
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>
|
#include <QObject>
|
||||||
|
|
||||||
class LibraryItem
|
class LibraryItem : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
virtual bool isDir() = 0;
|
virtual bool isDir() = 0;
|
||||||
|
LibraryItem & operator=(const LibraryItem & other);
|
||||||
QString name;
|
QString name;
|
||||||
QString path;
|
QString path;
|
||||||
qulonglong parentId;
|
qulonglong parentId;
|
||||||
qulonglong id;
|
qulonglong id;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user