This commit is contained in:
Felix Kauselmann 2015-05-22 17:29:19 +02:00
parent de49a17f85
commit 5b70ebeaad
8 changed files with 133 additions and 85 deletions

View File

@ -72,6 +72,7 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
connect(tableView, SIGNAL(comicRated(int,QModelIndex)), this, SIGNAL(comicRated(int,QModelIndex)));
connect(comicFlow, SIGNAL(selected(uint)), this, SIGNAL(selected(uint)));
connect(tableView->horizontalHeader(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveTableHeadersStatus()));
connect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(saveTableHeadersStatus()));
connect(comicFlow, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(requestedViewContextMenu(QPoint)));
connect(tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(requestedItemContextMenu(QPoint)));
layout->addWidget(sVertical);
@ -83,8 +84,10 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
sVertical->setCollapsible(1,false);
#endif
settingsMutex.lock();
if(settings->contains(COMICS_VIEW_FLOW_SPLITTER_STATUS))
sVertical->restoreState(settings->value(COMICS_VIEW_FLOW_SPLITTER_STATUS).toByteArray());
settingsMutex.unlock();
}
void ClassicComicsView::setToolBar(QToolBar *toolBar)
@ -120,6 +123,9 @@ void ClassicComicsView::setModel(ComicModel *model)
tableView->horizontalHeader()->setMovable(true);
#endif
//TODO parametrizar la configuración de las columnas
settingsMutex.lock();
if(!settings->contains(COMICS_VIEW_HEADERS))
{
for(int i = 0;i<tableView->horizontalHeader()->count();i++)
tableView->horizontalHeader()->hideSection(i);
@ -131,11 +137,16 @@ void ClassicComicsView::setModel(ComicModel *model)
tableView->horizontalHeader()->showSection(ComicModel::ReadColumn);
tableView->horizontalHeader()->showSection(ComicModel::CurrentPage);
tableView->horizontalHeader()->showSection(ComicModel::Rating);
}
settingsMutex.unlock();
//debido a un bug, qt4 no es capaz de ajustar el ancho teniendo en cuenta todas la filas (no sólo las visibles)
//así que se ecala la primera vez y después se deja el control al usuario.
//if(!settings->contains(COMICS_VIEW_HEADERS))
settingsMutex.lock();
if(!settings->contains(COMICS_VIEW_HEADERS))
tableView->resizeColumnsToContents();
settingsMutex.unlock();
tableView->horizontalHeader()->setStretchLastSection(true);
QStringList paths = model->getPaths(model->getCurrentPath());//TODO ComicsView: get currentpath from somewhere currentPath());
@ -270,8 +281,10 @@ void ClassicComicsView::saveTableHeadersStatus()
void ClassicComicsView::saveSplitterStatus()
{
settingsMutex.lock();
if(!searching)
settings->setValue(COMICS_VIEW_FLOW_SPLITTER_STATUS, sVertical->saveState());
settingsMutex.unlock();
}
void ClassicComicsView::applyModelChanges(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)

View File

@ -169,10 +169,12 @@ void SortVolumeComics::moveDownCL()
QList<QModelIndex> selection = tableFiles->selectionModel()->selectedIndexes();
if(selection.count() > 0)
{
localComicsModel->moveSelectionDown(selection);
selection = tableFiles->selectionModel()->selectedIndexes();
tableFiles->scrollTo(selection.last());
}
}
void SortVolumeComics::moveUpIL()

View File

@ -47,7 +47,7 @@ bool ComicModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, i
return data->formats().contains(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat);
}
//TODO: optimize this method
//TODO: optimize this method (seriously)
bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
@ -118,9 +118,26 @@ bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int
QLOG_INFO() << newSorting;
if(!beginMoveRows(parent,currentIndexes.first(),currentIndexes.last(),parent,row))
return false;
_data = resortedData;
int tempRow = row;
foreach(qulonglong id, comicIds)
{
int i = 0;
foreach (ComicItem *item, _data) {
if(item->data(Id) == id)
{
beginMoveRows(parent,i,i,parent,tempRow);
_data.removeAll(item);
_data.insert(tempRow++, item);
endMoveRows();
break;
}
i++;
}
}
/*if(!beginMoveRows(parent,currentIndexes.first(),currentIndexes.last(),parent,row))
return false;*/
_data = resortedData; //TODO No longer needed
//TODO emit signals
@ -145,7 +162,7 @@ bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int
QSqlDatabase::removeDatabase(_databasePath);
endMoveRows();
//endMoveRows();
emit resortedIndexes(newSorting);
int destSelectedIndex = row<0?_data.length():row;

View File

@ -339,6 +339,12 @@ Rectangle {
currentIndex: 0
cacheBuffer: 0
footer: Rectangle { //fix for the scroll issue, TODO find what causes the issue (some times the bottoms cells are hidden for the toolbar, no full scroll)
height : 25
width : parent.width
color : backgroundColor
}
move: Transition {
NumberAnimation { properties: "x,y"; duration: 250 }
}

View File

@ -155,6 +155,8 @@ void FolderController::service(HttpRequest& request, HttpResponse& response)
t.setVariable(QString("path%1.name").arg(i-1),DBHelper::getFolderName(libraryId,foldersPath[i].first));
}
if(folderContent.length() > 0)
{
t.loop("element",numFoldersAtCurrentPage);
int i = 0;
while(i<numFoldersAtCurrentPage)
@ -224,6 +226,10 @@ void FolderController::service(HttpRequest& request, HttpResponse& response)
}
i++;
}
} else
{
t.loop("element",0);
}
if(numPages > 1)
{

View File

@ -14,7 +14,7 @@ HttpSessionStore::HttpSessionStore(QSettings* settings, QObject* parent)
connect(&cleanupTimer,SIGNAL(timeout()),this,SLOT(timerEvent()));
cleanupTimer.start(60000);
cookieName=settings->value("cookieName","sessionid").toByteArray();
expirationTime=settings->value("expirationTime",86400000).toInt();
expirationTime=settings->value("expirationTime",864000000).toInt();
qDebug("HttpSessionStore: Sessions expire after %i milliseconds",expirationTime);
}
@ -90,7 +90,9 @@ void HttpSessionStore::timerEvent() {
++i;
HttpSession session=prev.value();
qint64 lastAccess=session.getLastAccess();
if (now-lastAccess>expirationTime) {
if (now-lastAccess>expirationTime) { //TODO cleaning up will cause current opened comic to be deleted, so clients won't be able to download it
//If the cleaning occurs in the midle of a download it going to cause issues
//Temporal fix: use a big expirationTime = 10 days
qDebug("HttpSessionStore: session %s expired",session.getId().data());
sessions.erase(prev);
}

View File

@ -5,7 +5,7 @@ body{
/* libraries */
#contentLibraries{
width: 300px;
width: 400px;
border: 1px solid #C6C6C6;
background-color: white;
margin-left: auto;
@ -36,7 +36,7 @@ body{
#contentLibraries .library-link
{
width: 211px;
width: 311px;
height: 28px;
border: none;
padding: 11px 0 0 0px;
@ -47,6 +47,7 @@ body{
font-size: 16px;
text-decoration: none;
color: #525252 ;
overflow: hidden;
}
#contentLibraries a

View File

@ -35,7 +35,7 @@ body{
#contentLibraries .library-link
{
width: 211px;
width: 65%;
height: 28px;
border: none;
padding: 11px 0 0 0px;
@ -46,6 +46,7 @@ body{
font-size: 16px;
text-decoration: none;
color: #525252 ;
overflow: hidden;
}
#contentLibraries a