mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Format code using clang-format
This commit is contained in:
@ -7,12 +7,12 @@
|
||||
|
||||
#include "comic.h"
|
||||
|
||||
ComicFilesManager::ComicFilesManager(QObject *parent) :
|
||||
QObject(parent), canceled(false)
|
||||
ComicFilesManager::ComicFilesManager(QObject *parent)
|
||||
: QObject(parent), canceled(false)
|
||||
{
|
||||
}
|
||||
|
||||
void ComicFilesManager::copyComicsTo(const QList<QPair<QString,QString> > &sourceComics, const QString &folderDest, const QModelIndex & dest)
|
||||
void ComicFilesManager::copyComicsTo(const QList<QPair<QString, QString>> &sourceComics, const QString &folderDest, const QModelIndex &dest)
|
||||
{
|
||||
comics = sourceComics;
|
||||
folder = folderDest;
|
||||
@ -20,7 +20,7 @@ void ComicFilesManager::copyComicsTo(const QList<QPair<QString,QString> > &sourc
|
||||
move = false;
|
||||
}
|
||||
|
||||
void ComicFilesManager::moveComicsTo(const QList<QPair<QString, QString> > &sourceComics, const QString &folderDest, const QModelIndex &dest)
|
||||
void ComicFilesManager::moveComicsTo(const QList<QPair<QString, QString>> &sourceComics, const QString &folderDest, const QModelIndex &dest)
|
||||
{
|
||||
comics = sourceComics;
|
||||
folder = folderDest;
|
||||
@ -28,27 +28,23 @@ void ComicFilesManager::moveComicsTo(const QList<QPair<QString, QString> > &sour
|
||||
move = true;
|
||||
}
|
||||
|
||||
QList<QPair<QString, QString> > ComicFilesManager::getDroppedFiles(const QList<QUrl> &urls)
|
||||
QList<QPair<QString, QString>> ComicFilesManager::getDroppedFiles(const QList<QUrl> &urls)
|
||||
{
|
||||
QList<QPair<QString,QString> > dropedFiles;
|
||||
QList<QPair<QString, QString>> dropedFiles;
|
||||
|
||||
QString currentPath;
|
||||
foreach(QUrl url, urls)
|
||||
{
|
||||
foreach (QUrl url, urls) {
|
||||
currentPath = url.toLocalFile();
|
||||
if(currentPath.endsWith('/'))
|
||||
currentPath = currentPath.remove(currentPath.length()-1,1); //QTBUG-35896 QUrl.toLocalFile inconsistency.
|
||||
if(Comic::fileIsComic(currentPath))
|
||||
dropedFiles << QPair<QString, QString>(currentPath,"/");
|
||||
else
|
||||
{
|
||||
if (currentPath.endsWith('/'))
|
||||
currentPath = currentPath.remove(currentPath.length() - 1, 1); //QTBUG-35896 QUrl.toLocalFile inconsistency.
|
||||
if (Comic::fileIsComic(currentPath))
|
||||
dropedFiles << QPair<QString, QString>(currentPath, "/");
|
||||
else {
|
||||
QLOG_DEBUG() << "XXXXXXXXXXXX :" << currentPath;
|
||||
QFileInfo info(currentPath);
|
||||
if(info.isDir())
|
||||
{
|
||||
QLOG_DEBUG() << "origin path prior to absoluteFilePath : " << info.absolutePath();
|
||||
foreach(QString comicPath, Comic::findValidComicFilesInFolder(info.absoluteFilePath()))
|
||||
{
|
||||
if (info.isDir()) {
|
||||
QLOG_DEBUG() << "origin path prior to absoluteFilePath : " << info.absolutePath();
|
||||
foreach (QString comicPath, Comic::findValidComicFilesInFolder(info.absoluteFilePath())) {
|
||||
QFileInfo comicInfo(comicPath);
|
||||
QString path = comicInfo.absolutePath();
|
||||
QLOG_DEBUG() << "comic path : " << comicPath;
|
||||
@ -65,14 +61,13 @@ QList<QPair<QString, QString> > ComicFilesManager::getDroppedFiles(const QList<Q
|
||||
|
||||
void ComicFilesManager::process()
|
||||
{
|
||||
int i=0;
|
||||
int i = 0;
|
||||
bool successProcesingFiles = false;
|
||||
QPair<QString, QString> source;
|
||||
foreach (source, comics) {
|
||||
|
||||
if(canceled)
|
||||
{
|
||||
if(successProcesingFiles)
|
||||
if (canceled) {
|
||||
if (successProcesingFiles)
|
||||
emit success(folderDestinationModelIndex);
|
||||
emit finished();
|
||||
|
||||
@ -80,14 +75,12 @@ void ComicFilesManager::process()
|
||||
}
|
||||
|
||||
QFileInfo info(source.first);
|
||||
QString destPath = QDir::cleanPath(folder+'/'+source.second);
|
||||
QString destPath = QDir::cleanPath(folder + '/' + source.second);
|
||||
QLOG_DEBUG() << "crear : " << destPath;
|
||||
QDir().mkpath(destPath);
|
||||
if(QFile::copy(source.first, QDir::cleanPath(destPath+'/'+info.fileName())))
|
||||
{
|
||||
if (QFile::copy(source.first, QDir::cleanPath(destPath + '/' + info.fileName()))) {
|
||||
successProcesingFiles = true;
|
||||
if(move)
|
||||
{
|
||||
if (move) {
|
||||
QFile::remove(source.first); //TODO: remove the whole path....
|
||||
}
|
||||
}
|
||||
@ -96,7 +89,7 @@ void ComicFilesManager::process()
|
||||
emit progress(i);
|
||||
}
|
||||
|
||||
if(successProcesingFiles)
|
||||
if (successProcesingFiles)
|
||||
emit success(folderDestinationModelIndex);
|
||||
emit finished();
|
||||
}
|
||||
|
Reference in New Issue
Block a user