mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 13:04:28 -04:00
eliminado el focusrect en macos para los elementos de navegaci?n y b?squeda de folders
corregido grave BUG en library_creator (udpate) corregido tablemodel (solo se eliminar filas si se puede borrar el fichero)
This commit is contained in:
@ -435,9 +435,9 @@ QModelIndex TableModel::getIndexFromId(quint64 id)
|
|||||||
return index(i,0);
|
return index(i,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableModel::startTransaction(int first, int last)
|
void TableModel::startTransaction()
|
||||||
{
|
{
|
||||||
beginRemoveRows(QModelIndex(),first,last);
|
|
||||||
dbTransaction = DataBaseManagement::loadDatabase(_databasePath);
|
dbTransaction = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
dbTransaction.transaction();
|
dbTransaction.transaction();
|
||||||
}
|
}
|
||||||
@ -448,7 +448,7 @@ void TableModel::finishTransaction()
|
|||||||
dbTransaction.close();
|
dbTransaction.close();
|
||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
|
|
||||||
endRemoveRows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableModel::removeInTransaction(int row)
|
void TableModel::removeInTransaction(int row)
|
||||||
@ -456,10 +456,12 @@ void TableModel::removeInTransaction(int row)
|
|||||||
ComicDB c = DBHelper::loadComic(_data.at(row)->data(ID).toULongLong(),dbTransaction);
|
ComicDB c = DBHelper::loadComic(_data.at(row)->data(ID).toULongLong(),dbTransaction);
|
||||||
|
|
||||||
DBHelper::removeFromDB(&c,dbTransaction);
|
DBHelper::removeFromDB(&c,dbTransaction);
|
||||||
|
beginRemoveRows(QModelIndex(),row,row);
|
||||||
removeRow(row);
|
removeRow(row);
|
||||||
delete _data.at(row);
|
delete _data.at(row);
|
||||||
_data.removeAt(row);
|
_data.removeAt(row);
|
||||||
|
|
||||||
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableModel::remove(ComicDB * comic, int row)
|
void TableModel::remove(ComicDB * comic, int row)
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void remove(int row);
|
void remove(int row);
|
||||||
void startTransaction(int first, int last);
|
void startTransaction();
|
||||||
void finishTransaction();
|
void finishTransaction();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -256,13 +256,38 @@ void LibraryCreator::update(QDir dirS)
|
|||||||
QFileInfo fileInfoS = listS.at(i);
|
QFileInfo fileInfoS = listS.at(i);
|
||||||
if(fileInfoS.isDir()) //create folder
|
if(fileInfoS.isDir()) //create folder
|
||||||
{
|
{
|
||||||
_currentPathFolders.append(Folder(fileInfoS.fileName(),QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source))); //folder actual no est<73> en la BD
|
#ifdef Q_OS_MAC
|
||||||
|
QStringList src = _source.split("/");
|
||||||
|
QString filePath = fileInfoS.absoluteFilePath();
|
||||||
|
QStringList fp = filePath.split("/");
|
||||||
|
for(int i = 0; i< src.count();i++)
|
||||||
|
{
|
||||||
|
fp.removeFirst();
|
||||||
|
}
|
||||||
|
QString path = "/" + fp.join("/");
|
||||||
|
#else
|
||||||
|
QString path = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source);
|
||||||
|
#endif
|
||||||
|
_currentPathFolders.append(Folder(fileInfoS.fileName(),path)); //folder actual no est<73> en la BD
|
||||||
create(QDir(fileInfoS.absoluteFilePath()));
|
create(QDir(fileInfoS.absoluteFilePath()));
|
||||||
_currentPathFolders.pop_back();
|
_currentPathFolders.pop_back();
|
||||||
}
|
}
|
||||||
else //create comic
|
else //create comic
|
||||||
{
|
{
|
||||||
insertComic(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source),fileInfoS);
|
#ifdef Q_OS_MAC
|
||||||
|
QStringList src = _source.split("/");
|
||||||
|
QString filePath = fileInfoS.absoluteFilePath();
|
||||||
|
QStringList fp = filePath.split("/");
|
||||||
|
for(int i = 0; i< src.count();i++)
|
||||||
|
{
|
||||||
|
fp.removeFirst();
|
||||||
|
}
|
||||||
|
QString path = "/" + fp.join("/");
|
||||||
|
#else
|
||||||
|
|
||||||
|
QString path = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source);
|
||||||
|
#endif
|
||||||
|
insertComic(path,fileInfoS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
@ -289,7 +314,19 @@ void LibraryCreator::update(QDir dirS)
|
|||||||
{
|
{
|
||||||
if(nameS!="/.yacreaderlibrary")
|
if(nameS!="/.yacreaderlibrary")
|
||||||
{
|
{
|
||||||
_currentPathFolders.append(Folder(fileInfoS.fileName(),QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source)));
|
#ifdef Q_OS_MAC
|
||||||
|
QStringList src = _source.split("/");
|
||||||
|
QString filePath = fileInfoS.absoluteFilePath();
|
||||||
|
QStringList fp = filePath.split("/");
|
||||||
|
for(int i = 0; i< src.count();i++)
|
||||||
|
{
|
||||||
|
fp.removeFirst();
|
||||||
|
}
|
||||||
|
QString path = "/" + fp.join("/");
|
||||||
|
#else
|
||||||
|
QString path = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source);
|
||||||
|
#endif
|
||||||
|
_currentPathFolders.append(Folder(fileInfoS.fileName(),path));
|
||||||
create(QDir(fileInfoS.absoluteFilePath()));
|
create(QDir(fileInfoS.absoluteFilePath()));
|
||||||
_currentPathFolders.pop_back();
|
_currentPathFolders.pop_back();
|
||||||
}
|
}
|
||||||
@ -310,7 +347,19 @@ void LibraryCreator::update(QDir dirS)
|
|||||||
{
|
{
|
||||||
if(nameS!="/.yacreaderlibrary") //skip .yacreaderlibrary folder
|
if(nameS!="/.yacreaderlibrary") //skip .yacreaderlibrary folder
|
||||||
{
|
{
|
||||||
_currentPathFolders.append(Folder(fileInfoS.fileName(),QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source)));
|
#ifdef Q_OS_MAC
|
||||||
|
QStringList src = _source.split("/");
|
||||||
|
QString filePath = fileInfoS.absoluteFilePath();
|
||||||
|
QStringList fp = filePath.split("/");
|
||||||
|
for(int i = 0; i< src.count();i++)
|
||||||
|
{
|
||||||
|
fp.removeFirst();
|
||||||
|
}
|
||||||
|
QString path = "/" + fp.join("/");
|
||||||
|
#else
|
||||||
|
QString path = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source);
|
||||||
|
#endif
|
||||||
|
_currentPathFolders.append(Folder(fileInfoS.fileName(),path));
|
||||||
create(QDir(fileInfoS.absoluteFilePath()));
|
create(QDir(fileInfoS.absoluteFilePath()));
|
||||||
_currentPathFolders.pop_back();
|
_currentPathFolders.pop_back();
|
||||||
}
|
}
|
||||||
@ -328,7 +377,19 @@ void LibraryCreator::update(QDir dirS)
|
|||||||
int comparation = QString::localeAwareCompare(nameS,nameD);
|
int comparation = QString::localeAwareCompare(nameS,nameD);
|
||||||
if(comparation < 0) //create new thumbnail
|
if(comparation < 0) //create new thumbnail
|
||||||
{
|
{
|
||||||
insertComic(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source),fileInfoS);
|
#ifdef Q_OS_MAC
|
||||||
|
QStringList src = _source.split("/");
|
||||||
|
QString filePath = fileInfoS.absoluteFilePath();
|
||||||
|
QStringList fp = filePath.split("/");
|
||||||
|
for(int i = 0; i< src.count();i++)
|
||||||
|
{
|
||||||
|
fp.removeFirst();
|
||||||
|
}
|
||||||
|
QString path = "/" + fp.join("/");
|
||||||
|
#else
|
||||||
|
QString path = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source);
|
||||||
|
#endif
|
||||||
|
insertComic(path,fileInfoS);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -176,10 +176,12 @@ void LibraryWindow::doLayout()
|
|||||||
foldersView->header()->hide();
|
foldersView->header()->hide();
|
||||||
foldersView->setUniformRowHeights(true);
|
foldersView->setUniformRowHeights(true);
|
||||||
foldersView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
foldersView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
foldersView->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||||
|
|
||||||
sideBar = new QWidget;
|
sideBar = new QWidget;
|
||||||
QVBoxLayout * l = new QVBoxLayout;
|
QVBoxLayout * l = new QVBoxLayout;
|
||||||
selectedLibrary = new QComboBox;
|
selectedLibrary = new QComboBox;
|
||||||
|
selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||||
l->setContentsMargins(sHorizontal->handleWidth(),0,0,0);
|
l->setContentsMargins(sHorizontal->handleWidth(),0,0,0);
|
||||||
|
|
||||||
YACReaderTitledToolBar * librariesTitle = new YACReaderTitledToolBar(tr("Libraries"));
|
YACReaderTitledToolBar * librariesTitle = new YACReaderTitledToolBar(tr("Libraries"));
|
||||||
@ -200,6 +202,7 @@ void LibraryWindow::doLayout()
|
|||||||
|
|
||||||
QHBoxLayout * filter = new QHBoxLayout;
|
QHBoxLayout * filter = new QHBoxLayout;
|
||||||
filter->addWidget(foldersFilter = new YACReaderSearchLineEdit());
|
filter->addWidget(foldersFilter = new YACReaderSearchLineEdit());
|
||||||
|
foldersFilter->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||||
foldersFilter->setPlaceholderText(tr("Search folders and comics"));
|
foldersFilter->setPlaceholderText(tr("Search folders and comics"));
|
||||||
previousFilter = "";
|
previousFilter = "";
|
||||||
|
|
||||||
@ -1464,7 +1467,7 @@ void LibraryWindow::deleteComics()
|
|||||||
ComicsRemover * remover = new ComicsRemover(indexList,paths);
|
ComicsRemover * remover = new ComicsRemover(indexList,paths);
|
||||||
|
|
||||||
//comicView->showDeleteProgress();
|
//comicView->showDeleteProgress();
|
||||||
dmCV->startTransaction(indexList.first().row(),indexList.last().row());
|
dmCV->startTransaction();
|
||||||
|
|
||||||
connect(remover, SIGNAL(remove(int)), dmCV, SLOT(remove(int)));
|
connect(remover, SIGNAL(remove(int)), dmCV, SLOT(remove(int)));
|
||||||
connect(remover, SIGNAL(remove(int)), comicFlow, SLOT(remove(int)));
|
connect(remover, SIGNAL(remove(int)), comicFlow, SLOT(remove(int)));
|
||||||
|
Reference in New Issue
Block a user