mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
merged
This commit is contained in:
commit
cdcbba5991
@ -43,15 +43,20 @@ QList<LibraryItem *> DBHelper::getFolderSubfoldersFromLibrary(qulonglong library
|
||||
return list;
|
||||
}
|
||||
QList<LibraryItem *> DBHelper::getFolderComicsFromLibrary(qulonglong libraryId, qulonglong folderId)
|
||||
{
|
||||
return DBHelper::getFolderComicsFromLibrary(libraryId, folderId, false);
|
||||
}
|
||||
|
||||
QList<LibraryItem *> DBHelper::getFolderComicsFromLibrary(qulonglong libraryId, qulonglong folderId, bool sort)
|
||||
{
|
||||
QString libraryPath = DBHelper::getLibraries().getPath(libraryId);
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(libraryPath+"/.yacreaderlibrary");
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(libraryPath+"/.yacreaderlibrary");
|
||||
|
||||
QList<LibraryItem *> list = DBHelper::getComicsFromParent(folderId,db,false);
|
||||
QList<LibraryItem *> list = DBHelper::getComicsFromParent(folderId,db,sort);
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(libraryPath);
|
||||
return list;
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(libraryPath);
|
||||
return list;
|
||||
}
|
||||
qulonglong DBHelper::getParentFromComicFolderId(qulonglong libraryId, qulonglong id)
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
static YACReaderLibraries getLibraries();
|
||||
static QList<LibraryItem *> getFolderSubfoldersFromLibrary(qulonglong libraryId, qulonglong folderId);
|
||||
static QList<LibraryItem *> getFolderComicsFromLibrary(qulonglong libraryId, qulonglong folderId);
|
||||
static QList<LibraryItem *> getFolderComicsFromLibrary(qulonglong libraryId, qulonglong folderId, bool sort);
|
||||
static qulonglong getParentFromComicFolderId(qulonglong libraryId, qulonglong id);
|
||||
static ComicDB getComicInfo(qulonglong libraryId, qulonglong id);
|
||||
static QList<ComicDB> getSiblings(qulonglong libraryId, qulonglong parentId);
|
||||
|
@ -82,7 +82,7 @@ void ComicController::service(HttpRequest& request, HttpResponse& response)
|
||||
response.writeText(QString("libraryId:%1\r\n").arg(libraryId));
|
||||
if(remoteComic) //send previous and next comics id
|
||||
{
|
||||
QList<LibraryItem *> siblings = DBHelper::getFolderComicsFromLibrary(libraryId, comic.parentId);
|
||||
QList<LibraryItem *> siblings = DBHelper::getFolderComicsFromLibrary(libraryId, comic.parentId, true);
|
||||
bool found = false;
|
||||
int i;
|
||||
for(i = 0; i < siblings.length(); i++)
|
||||
|
@ -13,12 +13,16 @@
|
||||
#include "startup.h"
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//192.168 (most comon local subnet for ips are always put first)
|
||||
//IPs are sorted using natoral sorting
|
||||
bool ipComparator(const QString & ip1, const QString & ip2)
|
||||
{
|
||||
if(ip1.startsWith("192.168") && ip2.startsWith("192.168"))
|
||||
return ip1 < ip2;
|
||||
return naturalSortLessThanCI(ip1, ip2);
|
||||
|
||||
if(ip1.startsWith("192.168"))
|
||||
return true;
|
||||
@ -26,7 +30,7 @@ bool ipComparator(const QString & ip1, const QString & ip2)
|
||||
if(ip2.startsWith("192.168"))
|
||||
return false;
|
||||
|
||||
return ip1 < ip2;
|
||||
return naturalSortLessThanCI(ip1, ip2);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WIN32
|
||||
|
Loading…
x
Reference in New Issue
Block a user