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:
@ -8,8 +8,8 @@
|
||||
#include <QtQuick>
|
||||
#include <QQuickWidget>
|
||||
|
||||
ComicsView::ComicsView(QWidget *parent) :
|
||||
QWidget(parent),model(NULL),comicDB(nullptr)
|
||||
ComicsView::ComicsView(QWidget *parent)
|
||||
: QWidget(parent), model(NULL), comicDB(nullptr)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
@ -23,11 +23,12 @@ void ComicsView::updateInfoForIndex(int index)
|
||||
{
|
||||
QQmlContext *ctxt = view->rootContext();
|
||||
|
||||
if(comicDB != nullptr) delete comicDB;
|
||||
if (comicDB != nullptr)
|
||||
delete comicDB;
|
||||
|
||||
comicDB = new ComicDB(model->getComic(this->model->index(index, 0)));
|
||||
ComicInfo *comicInfo = &(comicDB->info);
|
||||
comicInfo->isFavorite = model->isFavorite(model->index(index,0));
|
||||
comicInfo->isFavorite = model->isFavorite(model->index(index, 0));
|
||||
|
||||
ctxt->setContextProperty("comic", comicDB);
|
||||
ctxt->setContextProperty("comicInfo", comicInfo);
|
||||
@ -37,49 +38,41 @@ void ComicsView::updateInfoForIndex(int index)
|
||||
|
||||
void ComicsView::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if(model->canDropMimeData(event->mimeData(),event->proposedAction(),0,0,QModelIndex()))
|
||||
if (model->canDropMimeData(event->mimeData(), event->proposedAction(), 0, 0, QModelIndex()))
|
||||
event->acceptProposedAction();
|
||||
else
|
||||
{
|
||||
QLOG_TRACE() << "dragEnterEvent";
|
||||
QList<QUrl> urlList;
|
||||
else {
|
||||
QLOG_TRACE() << "dragEnterEvent";
|
||||
QList<QUrl> urlList;
|
||||
|
||||
if (event->mimeData()->hasUrls() && event->dropAction() == Qt::CopyAction)
|
||||
{
|
||||
urlList = event->mimeData()->urls();
|
||||
QString currentPath;
|
||||
foreach (QUrl url, urlList)
|
||||
{
|
||||
//comics or folders are accepted, folders' content is validate in dropEvent (avoid any lag before droping)
|
||||
currentPath = url.toLocalFile();
|
||||
if(Comic::fileIsComic(currentPath) || QFileInfo(currentPath).isDir())
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
return;
|
||||
if (event->mimeData()->hasUrls() && event->dropAction() == Qt::CopyAction) {
|
||||
urlList = event->mimeData()->urls();
|
||||
QString currentPath;
|
||||
foreach (QUrl url, urlList) {
|
||||
//comics or folders are accepted, folders' content is validate in dropEvent (avoid any lag before droping)
|
||||
currentPath = url.toLocalFile();
|
||||
if (Comic::fileIsComic(currentPath) || QFileInfo(currentPath).isDir()) {
|
||||
event->acceptProposedAction();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ComicsView::dropEvent(QDropEvent *event)
|
||||
{
|
||||
QLOG_DEBUG() << "drop" << event->dropAction();
|
||||
|
||||
bool validAction = event->dropAction() == Qt::CopyAction;// || event->dropAction() & Qt::MoveAction; TODO move
|
||||
bool validAction = event->dropAction() == Qt::CopyAction; // || event->dropAction() & Qt::MoveAction; TODO move
|
||||
|
||||
if(event->mimeData()->hasUrls() && validAction)
|
||||
{
|
||||
if (event->mimeData()->hasUrls() && validAction) {
|
||||
|
||||
QList<QPair<QString, QString> > droppedFiles = ComicFilesManager::getDroppedFiles(event->mimeData()->urls());
|
||||
QList<QPair<QString, QString>> droppedFiles = ComicFilesManager::getDroppedFiles(event->mimeData()->urls());
|
||||
|
||||
if(event->dropAction() == Qt::CopyAction)
|
||||
{
|
||||
if (event->dropAction() == Qt::CopyAction) {
|
||||
QLOG_DEBUG() << "copy :" << droppedFiles;
|
||||
emit copyComicsToCurrentFolder(droppedFiles);
|
||||
}
|
||||
else if(event->dropAction() & Qt::MoveAction)
|
||||
{
|
||||
} else if (event->dropAction() & Qt::MoveAction) {
|
||||
QLOG_DEBUG() << "move :" << droppedFiles;
|
||||
emit moveComicsToCurrentFolder(droppedFiles);
|
||||
}
|
||||
|
Reference in New Issue
Block a user