mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 02:54:46 -04:00
Format code using clang-format
This commit is contained in:
@ -6,9 +6,8 @@
|
||||
#include "QsLog.h"
|
||||
|
||||
ListItem::ListItem(const QList<QVariant> &data)
|
||||
:itemData(data)
|
||||
: itemData(data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int ListItem::columnCount()
|
||||
@ -29,15 +28,13 @@ qulonglong ListItem::getId() const
|
||||
//------------------------------------------------------
|
||||
|
||||
SpecialListItem::SpecialListItem(const QList<QVariant> &data)
|
||||
:ListItem(data)
|
||||
: ListItem(data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QIcon SpecialListItem::getIcon() const
|
||||
{
|
||||
if(itemData.count()>Id)
|
||||
{
|
||||
if (itemData.count() > Id) {
|
||||
QString id = itemData.at(Id).toString();
|
||||
return YACReader::noHighlightedIcon(QString(":/images/lists/default_%1.png").arg(id));
|
||||
}
|
||||
@ -49,8 +46,7 @@ QIcon SpecialListItem::getIcon() const
|
||||
|
||||
ReadingListModel::TypeSpecialList SpecialListItem::getType() const
|
||||
{
|
||||
if(itemData.count()>Id)
|
||||
{
|
||||
if (itemData.count() > Id) {
|
||||
int id = itemData.at(Id).toInt();
|
||||
return (ReadingListModel::TypeSpecialList)id;
|
||||
}
|
||||
@ -63,15 +59,13 @@ ReadingListModel::TypeSpecialList SpecialListItem::getType() const
|
||||
//------------------------------------------------------
|
||||
|
||||
LabelItem::LabelItem(const QList<QVariant> &data)
|
||||
:ListItem(data)
|
||||
: ListItem(data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QIcon LabelItem::getIcon() const
|
||||
{
|
||||
if(itemData.count()>Color)
|
||||
{
|
||||
if (itemData.count() > Color) {
|
||||
QString color = itemData.at(Color).toString();
|
||||
return YACReader::noHighlightedIcon(QString(":/images/lists/label_%1.png").arg(color).toLower());
|
||||
}
|
||||
@ -83,8 +77,7 @@ QIcon LabelItem::getIcon() const
|
||||
|
||||
YACReader::LabelColors LabelItem::colorid() const
|
||||
{
|
||||
if(itemData.count()>Ordering)
|
||||
{
|
||||
if (itemData.count() > Ordering) {
|
||||
return YACReader::LabelColors(itemData.at(Ordering).toInt());
|
||||
}
|
||||
|
||||
@ -95,8 +88,7 @@ YACReader::LabelColors LabelItem::colorid() const
|
||||
|
||||
QString LabelItem::name() const
|
||||
{
|
||||
if(itemData.count()>Name)
|
||||
{
|
||||
if (itemData.count() > Name) {
|
||||
return itemData.at(Name).toString();
|
||||
}
|
||||
|
||||
@ -107,16 +99,14 @@ QString LabelItem::name() const
|
||||
|
||||
void LabelItem::setName(const QString &name)
|
||||
{
|
||||
if(itemData.count()>Name)
|
||||
{
|
||||
if (itemData.count() > Name) {
|
||||
itemData[Name] = name;
|
||||
}
|
||||
}
|
||||
|
||||
qulonglong LabelItem::getId() const
|
||||
{
|
||||
if(itemData.count()>Id)
|
||||
{
|
||||
if (itemData.count() > Id) {
|
||||
return YACReader::LabelColors(itemData.at(Id).toULongLong());
|
||||
}
|
||||
|
||||
@ -128,14 +118,13 @@ qulonglong LabelItem::getId() const
|
||||
//------------------------------------------------------
|
||||
|
||||
ReadingListItem::ReadingListItem(const QList<QVariant> &data, ReadingListItem *p)
|
||||
:ListItem(data), parent(p)
|
||||
: ListItem(data), parent(p)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QIcon ReadingListItem::getIcon() const
|
||||
{
|
||||
if(parent->getId() == 0)
|
||||
if (parent->getId() == 0)
|
||||
return YACReader::noHighlightedIcon(":/images/lists/list.png"); //top level list
|
||||
else
|
||||
#ifdef Q_OS_MAC
|
||||
@ -160,23 +149,20 @@ void ReadingListItem::appendChild(ReadingListItem *item)
|
||||
{
|
||||
item->parent = this;
|
||||
|
||||
if(childItems.isEmpty())
|
||||
if (childItems.isEmpty())
|
||||
childItems.append(item);
|
||||
else
|
||||
{
|
||||
if(item->parent->getId()==0) //sort by name, top level child
|
||||
else {
|
||||
if (item->parent->getId() == 0) //sort by name, top level child
|
||||
{
|
||||
int i= 0;
|
||||
while(i<childItems.length() && naturalSortLessThanCI(childItems.at(i)->name(),item->name()))
|
||||
int i = 0;
|
||||
while (i < childItems.length() && naturalSortLessThanCI(childItems.at(i)->name(), item->name()))
|
||||
i++;
|
||||
childItems.insert(i,item);
|
||||
}
|
||||
else
|
||||
{
|
||||
int i= 0;
|
||||
while(i<childItems.length() && (childItems.at(i)->getOrdering()<item->getOrdering()))
|
||||
childItems.insert(i, item);
|
||||
} else {
|
||||
int i = 0;
|
||||
while (i < childItems.length() && (childItems.at(i)->getOrdering() < item->getOrdering()))
|
||||
i++;
|
||||
childItems.insert(i,item);
|
||||
childItems.insert(i, item);
|
||||
}
|
||||
|
||||
/*ReadingListItem * last = childItems.back();
|
||||
@ -194,9 +180,7 @@ void ReadingListItem::appendChild(ReadingListItem *item)
|
||||
childItems.insert(++i,item);
|
||||
else
|
||||
childItems.insert(i,item);*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ReadingListItem::appendChild(ReadingListItem *item, int pos)
|
||||
@ -211,7 +195,7 @@ void ReadingListItem::removeChild(ReadingListItem *item)
|
||||
|
||||
qulonglong ReadingListItem::getId() const
|
||||
{
|
||||
if(itemData.count()>Id)
|
||||
if (itemData.count() > Id)
|
||||
return itemData.at(Id).toULongLong();
|
||||
|
||||
QLOG_WARN() << "Name for reading list item not available";
|
||||
@ -221,7 +205,7 @@ qulonglong ReadingListItem::getId() const
|
||||
|
||||
QString ReadingListItem::name() const
|
||||
{
|
||||
if(itemData.count()>Name)
|
||||
if (itemData.count() > Name)
|
||||
return itemData.at(Name).toString();
|
||||
|
||||
QLOG_WARN() << "Name for reading list item not available";
|
||||
@ -231,13 +215,13 @@ QString ReadingListItem::name() const
|
||||
|
||||
void ReadingListItem::setName(const QString &name)
|
||||
{
|
||||
if(itemData.count()>Name)
|
||||
if (itemData.count() > Name)
|
||||
itemData[Name] = name;
|
||||
}
|
||||
|
||||
int ReadingListItem::getOrdering() const
|
||||
{
|
||||
if(itemData.count()>Ordering)
|
||||
if (itemData.count() > Ordering)
|
||||
return itemData[Ordering].toInt();
|
||||
|
||||
QLOG_WARN() << "Ordering for Item not available";
|
||||
@ -246,7 +230,7 @@ int ReadingListItem::getOrdering() const
|
||||
|
||||
void ReadingListItem::setOrdering(const int ordering)
|
||||
{
|
||||
if(itemData.count()>Ordering)
|
||||
if (itemData.count() > Ordering)
|
||||
itemData[Ordering] = ordering;
|
||||
}
|
||||
|
||||
@ -258,16 +242,14 @@ QList<ReadingListItem *> ReadingListItem::children()
|
||||
int ReadingListItem::row() const
|
||||
{
|
||||
if (parent)
|
||||
return parent->childItems.indexOf(const_cast<ReadingListItem*>(this));
|
||||
return parent->childItems.indexOf(const_cast<ReadingListItem *>(this));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ReadingListSeparatorItem::ReadingListSeparatorItem()
|
||||
:ListItem(QList<QVariant>())
|
||||
: ListItem(QList<QVariant>())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QIcon ReadingListSeparatorItem::getIcon() const
|
||||
|
Reference in New Issue
Block a user