mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 02:54:46 -04:00
Add .gitattributes rules for text and binary handling
This commit is contained in:
@ -1,103 +1,103 @@
|
||||
#include <QStringList>
|
||||
|
||||
#include "folder_item.h"
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
FolderItem::FolderItem(const QList<QVariant> &data, FolderItem *parent)
|
||||
{
|
||||
parentItem = parent;
|
||||
itemData = data;
|
||||
}
|
||||
|
||||
FolderItem::~FolderItem()
|
||||
{
|
||||
qDeleteAll(childItems);
|
||||
}
|
||||
|
||||
void FolderItem::appendChild(FolderItem *item)
|
||||
{
|
||||
item->parentItem = this;
|
||||
|
||||
if(childItems.isEmpty())
|
||||
childItems.append(item);
|
||||
else
|
||||
{
|
||||
FolderItem * last = childItems.back();
|
||||
QString nameLast = last->data(1).toString(); //TODO usar info name si est<73> disponible, sino el nombre del fichero.....
|
||||
QString nameCurrent = item->data(1).toString();
|
||||
QList<FolderItem *>::iterator i;
|
||||
i = childItems.end();
|
||||
i--;
|
||||
while (naturalSortLessThanCI(nameCurrent,nameLast) && i != childItems.begin())
|
||||
{
|
||||
i--;
|
||||
nameLast = (*i)->data(1).toString();
|
||||
}
|
||||
if(!naturalSortLessThanCI(nameCurrent,nameLast)) //si se ha encontrado un elemento menor que current, se inserta justo despu<70>s
|
||||
childItems.insert(++i,item);
|
||||
else
|
||||
childItems.insert(i,item);
|
||||
|
||||
}
|
||||
|
||||
//childItems.append(item);
|
||||
}
|
||||
|
||||
FolderItem *FolderItem::child(int row)
|
||||
{
|
||||
return childItems.value(row);
|
||||
}
|
||||
|
||||
int FolderItem::childCount() const
|
||||
{
|
||||
return childItems.count();
|
||||
}
|
||||
|
||||
int FolderItem::columnCount() const
|
||||
{
|
||||
return itemData.count();
|
||||
}
|
||||
|
||||
QVariant FolderItem::data(int column) const
|
||||
{
|
||||
return itemData.value(column);
|
||||
}
|
||||
|
||||
void FolderItem::setData(int column, const QVariant & value)
|
||||
{
|
||||
itemData[column] = value;
|
||||
}
|
||||
|
||||
void FolderItem::removeChild(int childIndex)
|
||||
{
|
||||
childItems.removeAt(childIndex);
|
||||
}
|
||||
|
||||
void FolderItem::clearChildren()
|
||||
{
|
||||
qDeleteAll(childItems);
|
||||
childItems.clear();
|
||||
}
|
||||
|
||||
QList<FolderItem *> FolderItem::children()
|
||||
{
|
||||
return childItems;
|
||||
}
|
||||
|
||||
FolderItem *FolderItem::parent()
|
||||
{
|
||||
return parentItem;
|
||||
}
|
||||
|
||||
int FolderItem::row() const
|
||||
{
|
||||
if (parentItem)
|
||||
return parentItem->childItems.indexOf(const_cast<FolderItem*>(this));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<QVariant> FolderItem::getData() const
|
||||
{
|
||||
return itemData;
|
||||
}
|
||||
#include <QStringList>
|
||||
|
||||
#include "folder_item.h"
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
FolderItem::FolderItem(const QList<QVariant> &data, FolderItem *parent)
|
||||
{
|
||||
parentItem = parent;
|
||||
itemData = data;
|
||||
}
|
||||
|
||||
FolderItem::~FolderItem()
|
||||
{
|
||||
qDeleteAll(childItems);
|
||||
}
|
||||
|
||||
void FolderItem::appendChild(FolderItem *item)
|
||||
{
|
||||
item->parentItem = this;
|
||||
|
||||
if(childItems.isEmpty())
|
||||
childItems.append(item);
|
||||
else
|
||||
{
|
||||
FolderItem * last = childItems.back();
|
||||
QString nameLast = last->data(1).toString(); //TODO usar info name si est<73> disponible, sino el nombre del fichero.....
|
||||
QString nameCurrent = item->data(1).toString();
|
||||
QList<FolderItem *>::iterator i;
|
||||
i = childItems.end();
|
||||
i--;
|
||||
while (naturalSortLessThanCI(nameCurrent,nameLast) && i != childItems.begin())
|
||||
{
|
||||
i--;
|
||||
nameLast = (*i)->data(1).toString();
|
||||
}
|
||||
if(!naturalSortLessThanCI(nameCurrent,nameLast)) //si se ha encontrado un elemento menor que current, se inserta justo despu<70>s
|
||||
childItems.insert(++i,item);
|
||||
else
|
||||
childItems.insert(i,item);
|
||||
|
||||
}
|
||||
|
||||
//childItems.append(item);
|
||||
}
|
||||
|
||||
FolderItem *FolderItem::child(int row)
|
||||
{
|
||||
return childItems.value(row);
|
||||
}
|
||||
|
||||
int FolderItem::childCount() const
|
||||
{
|
||||
return childItems.count();
|
||||
}
|
||||
|
||||
int FolderItem::columnCount() const
|
||||
{
|
||||
return itemData.count();
|
||||
}
|
||||
|
||||
QVariant FolderItem::data(int column) const
|
||||
{
|
||||
return itemData.value(column);
|
||||
}
|
||||
|
||||
void FolderItem::setData(int column, const QVariant & value)
|
||||
{
|
||||
itemData[column] = value;
|
||||
}
|
||||
|
||||
void FolderItem::removeChild(int childIndex)
|
||||
{
|
||||
childItems.removeAt(childIndex);
|
||||
}
|
||||
|
||||
void FolderItem::clearChildren()
|
||||
{
|
||||
qDeleteAll(childItems);
|
||||
childItems.clear();
|
||||
}
|
||||
|
||||
QList<FolderItem *> FolderItem::children()
|
||||
{
|
||||
return childItems;
|
||||
}
|
||||
|
||||
FolderItem *FolderItem::parent()
|
||||
{
|
||||
return parentItem;
|
||||
}
|
||||
|
||||
int FolderItem::row() const
|
||||
{
|
||||
if (parentItem)
|
||||
return parentItem->childItems.indexOf(const_cast<FolderItem*>(this));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<QVariant> FolderItem::getData() const
|
||||
{
|
||||
return itemData;
|
||||
}
|
||||
|
Reference in New Issue
Block a user