clang-format

This commit is contained in:
Luis Ángel San Martín
2021-10-18 21:56:52 +02:00
parent 78e0c522d2
commit 5aa02a19bb
190 changed files with 2286 additions and 2286 deletions

View File

@ -14,12 +14,12 @@ BookmarksDialog::BookmarksDialog(QWidget *parent)
{
setModal(true);
//animation = new QPropertyAnimation(this,"windowOpacity");
//animation->setDuration(150);
// animation = new QPropertyAnimation(this,"windowOpacity");
// animation->setDuration(150);
auto layout = new QHBoxLayout();
//bookmarks
// bookmarks
auto bookmarksL = new QGridLayout();
pages.push_back(new QLabel(tr("Lastest Page")));
@ -43,7 +43,7 @@ BookmarksDialog::BookmarksDialog(QWidget *parent)
QLabel *l = new QLabel();
l->setFixedSize(coverSize);
l->setScaledContents(false);
//l->setPixmap(QPixmap(":/images/notCover.png"));
// l->setPixmap(QPixmap(":/images/notCover.png"));
l->installEventFilter(this);
images.push_back(l);
}
@ -54,7 +54,7 @@ BookmarksDialog::BookmarksDialog(QWidget *parent)
for (int i = 0; i < 3; i++)
bookmarksL->addWidget(images.at(i + 1), 1, i, Qt::AlignCenter);
//last page
// last page
auto lp = new QGridLayout();
lp->addWidget(pages.at(0), 0, 0, Qt::AlignCenter);
lp->addWidget(images.at(0), 1, 0, Qt::AlignCenter);

View File

@ -28,15 +28,15 @@ protected:
bool eventFilter(QObject *obj, QEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
//QPropertyAnimation * animation;
// QPropertyAnimation * animation;
public:
BookmarksDialog(QWidget *parent = nullptr);
public slots:
void setBookmarks(const Bookmarks &bookmarks);
//void show();
//void hide();
// void show();
// void hide();
signals:
void goToPage(unsigned int page);

View File

@ -22,7 +22,7 @@ void Configuration::load(QSettings *settings)
{
this->settings = settings;
//TODO set defaults
// TODO set defaults
if (!settings->contains(PATH))
settings->setValue(PATH, ".");
if (!settings->contains(GO_TO_FLOW_SIZE))
@ -53,7 +53,7 @@ void Configuration::updateOpenRecentList(QString path)
QStringList list = openRecentList();
list.removeAll(path);
list.prepend(path);
//TODO: Make list lenght configurable
// TODO: Make list lenght configurable
while (list.length() > getOpenRecentSize()) {
list.removeLast();
}

View File

@ -41,11 +41,11 @@ public:
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat(); }
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL, zl); }
//Unified enum based fitmode
// Unified enum based fitmode
YACReader::FitMode getFitMode() { return static_cast<YACReader::FitMode>(settings->value(FITMODE, YACReader::FitMode::FullPage).toInt()); }
void setFitMode(YACReader::FitMode fitMode) { settings->setValue(FITMODE, static_cast<int>(fitMode)); }
//openRecent
// openRecent
int getOpenRecentSize() { return settings->value("recentSize", 25).toInt(); }
QStringList openRecentList() { return settings->value("recentFiles").toStringList(); }
void updateOpenRecentList(QString path);

View File

@ -90,7 +90,7 @@ void GoToFlow::centerSlide(int slide)
flow->setCenterIndex(slide);
if (ready) // load images if pages are loaded.
{
//worker->reset(); //BUG FIXED : image didn't load if worker was working
// worker->reset(); //BUG FIXED : image didn't load if worker was working
preload();
}
}
@ -145,7 +145,7 @@ void GoToFlow::setImageReady(int index, const QByteArray &image)
void GoToFlow::preload()
{
if (numImagesLoaded < imagesLoaded.size())
updateTimer->start(30); //TODO comprobar rendimiento, antes era 70
updateTimer->start(30); // TODO comprobar rendimiento, antes era 70
}
void GoToFlow::updateImageData()
@ -162,7 +162,7 @@ void GoToFlow::updateImageData()
imagesSetted[idx] = true;
numImagesLoaded++;
rawImages[idx].clear();
; //release memory
; // release memory
imagesLoaded[idx] = true;
}
}
@ -180,7 +180,7 @@ void GoToFlow::updateImageData()
for (int c = 0; c < 2 * COUNT + 1; c++) {
int i = indexes[c];
if ((i >= 0) && (i < flow->slideCount()))
if (!imagesLoaded[i] && imagesReady[i]) //slide(i).isNull())
if (!imagesLoaded[i] && imagesReady[i]) // slide(i).isNull())
{
// schedule thumbnail generation
@ -223,7 +223,7 @@ void GoToFlow::setFlowRightToLeft(bool b)
}
//-----------------------------------------------------------------------------
//PageLoader
// PageLoader
//-----------------------------------------------------------------------------
PageLoader::PageLoader(QMutex *m)
@ -233,8 +233,8 @@ PageLoader::PageLoader(QMutex *m)
PageLoader::~PageLoader()
{
//TODO this destructor never runs. If it is ever called, it will hang, because
//the implementation is broken due to the absolutely endless loop in run().
// TODO this destructor never runs. If it is ever called, it will hang, because
// the implementation is broken due to the absolutely endless loop in run().
mutex->lock();
condition.wakeOne();
mutex->unlock();
@ -250,7 +250,7 @@ void PageLoader::generate(int index, QSize size, const QByteArray &rImage)
{
mutex->lock();
this->idx = index;
//this->img = QImage();
// this->img = QImage();
this->size = size;
this->rawImage = rImage;
mutex->unlock();
@ -272,7 +272,7 @@ void PageLoader::run()
// copy necessary data
mutex->lock();
this->working = true;
//int idx = this->idx;
// int idx = this->idx;
QImage image;
image.loadFromData(this->rawImage);

View File

@ -33,11 +33,11 @@ class GoToFlow : public GoToFlowWidget
public:
GoToFlow(QWidget *parent = nullptr, FlowType flowType = CoverFlowLike);
~GoToFlow() override;
bool ready; //comic is ready for read.
bool ready; // comic is ready for read.
private:
YACReaderFlow *flow;
void keyPressEvent(QKeyEvent *event) override;
//Comic * comic;
// Comic * comic;
QSize imageSize;
QVector<bool> imagesLoaded;
@ -66,7 +66,7 @@ public slots:
};
//-----------------------------------------------------------------------------
//PageLoader
// PageLoader
//-----------------------------------------------------------------------------
class PageLoader : public QThread
{

View File

@ -31,7 +31,7 @@ private:
YACReaderPageFlowGL *flow;
void keyPressEvent(QKeyEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
//Comic * comic;
// Comic * comic;
QSize imageSize;
};

View File

@ -7,7 +7,7 @@
GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
: QStackedWidget(parent)
{
//elementos interactivos
// elementos interactivos
auto normal = new QWidget(this); // container widget
auto quickNavi = new QWidget(this); // container widget
addWidget(normal);
@ -44,17 +44,17 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
edit->setStyleSheet("QLineEdit {border: 1px solid #77000000; background: #55000000; color: white; padding: 3px 5px 5px 5px; margin: 13px 5px 12px 5px; font-weight:bold}");
edit->setFixedSize(54, 50);
edit->setAttribute(Qt::WA_MacShowFocusRect, false);
//edit->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
//edit->resize(QSize(54,50));
// edit->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
// edit->resize(QSize(54,50));
edit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
//edit->setAutoFillBackground(false);
// edit->setAutoFillBackground(false);
connect(edit, &QLineEdit::returnPressed, this, &GoToFlowToolBar::goTo);
QString centerButtonCSS = "QPushButton {background-image: url(:/images/imgCenterSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
"QPushButton:focus { border: none; outline: none;}"
"QPushButton:pressed {background-image: url(:/images/imgCenterSlidePressed.png); width: 100%; height:100%; background-repeat: none; border: none;} ";
centerButton = new QPushButton(this);
//centerButton->setIcon(QIcon(":/images/center.png"));
// centerButton->setIcon(QIcon(":/images/center.png"));
centerButton->setStyleSheet(centerButtonCSS);
centerButton->setFixedSize(26, 50);
centerButton->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
@ -64,7 +64,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
"QPushButton:focus { border: none; outline: none;}"
"QPushButton:pressed {background-image: url(:/images/imgGoToSlidePressed.png); width: 100%; height:100%; background-repeat: none; border: none;} ";
goToButton = new QPushButton(this);
//goToButton->setIcon(QIcon(":/images/goto.png"));
// goToButton->setIcon(QIcon(":/images/goto.png"));
goToButton->setStyleSheet(goToButtonCSS);
goToButton->setFixedSize(32, 50);
goToButton->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);

View File

@ -19,7 +19,7 @@ GoToFlowWidget::GoToFlowWidget(QWidget *parent)
setLayout(mainLayout);
//toolBar->installEventFilter(this);
// toolBar->installEventFilter(this);
}
GoToFlowWidget::~GoToFlowWidget() { }

View File

@ -36,7 +36,7 @@ signals:
protected:
void keyPressEvent(QKeyEvent *event) override;
//bool eventFilter(QObject *, QEvent *);
// bool eventFilter(QObject *, QEvent *);
};
#endif

View File

@ -33,7 +33,7 @@ void MagnifyingGlass::mouseMoveEvent(QMouseEvent *event)
void MagnifyingGlass::updateImage(int x, int y)
{
//image section augmented
// image section augmented
int zoomWidth = static_cast<int>(width() * zoomLevel);
int zoomHeight = static_cast<int>(height() * zoomLevel);
auto p = (Viewer *)parent();
@ -52,7 +52,7 @@ void MagnifyingGlass::updateImage(int x, int y)
int yOffset = 0;
int zw = zoomWidth;
int zh = zoomHeight;
//int wOffset,hOffset=0;
// int wOffset,hOffset=0;
bool outImage = false;
if (xp < 0) {
xOffset = -xp;
@ -93,7 +93,7 @@ void MagnifyingGlass::updateImage(int x, int y)
int yOffset = 0;
int zw = zoomWidth;
int zh = zoomHeight;
//int wOffset,hOffset=0;
// int wOffset,hOffset=0;
bool outImage = false;
if (xp < 0) {
xOffset = -xp;
@ -142,28 +142,28 @@ void MagnifyingGlass::updateImage()
void MagnifyingGlass::wheelEvent(QWheelEvent *event)
{
switch (event->modifiers()) {
//size
// size
case Qt::NoModifier:
if (event->delta() < 0)
sizeUp();
else
sizeDown();
break;
//size height
// size height
case Qt::ControlModifier:
if (event->delta() < 0)
heightUp();
else
heightDown();
break;
//size width
// size width
case Qt::AltModifier:
if (event->delta() < 0)
widthUp();
else
widthDown();
break;
//zoom level
// zoom level
case Qt::ShiftModifier:
if (event->delta() < 0)
zoomIn();

View File

@ -189,7 +189,7 @@ int main(int argc, char *argv[])
if (parser.isSet(readingListId)) {
source = OpenComicSource { OpenComicSource::ReadingList, parser.value(readingListId).toULongLong() };
} else {
source = OpenComicSource { OpenComicSource::Folder, 33 }; //Folder is not needed to get the comic information, the comid id points to a unique comic
source = OpenComicSource { OpenComicSource::Folder, 33 }; // Folder is not needed to get the comic information, the comid id points to a unique comic
}
mwv->open(arglist.at(0), parser.value(comicId).toULongLong(), parser.value(libraryId).toULongLong(), source);
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
int ret = app.exec();
delete mwv;
//Configuration::getConfiguration().save();
// Configuration::getConfiguration().save();
YACReader::exitCheck(ret);
#ifdef Q_OS_WIN
logger.shutDownLoggerThread();

View File

@ -91,7 +91,7 @@ MainWindowViewer::~MainWindowViewer()
delete viewer;
delete had;
//delete sliderAction;
// delete sliderAction;
delete openAction;
delete openFolderAction;
delete openLatestComicAction;
@ -136,13 +136,13 @@ void MainWindowViewer::loadConfiguration()
void MainWindowViewer::setupUI()
{
//setUnifiedTitleAndToolBarOnMac(true);
// setUnifiedTitleAndToolBarOnMac(true);
viewer = new Viewer(this);
connect(viewer, &Viewer::reset, this, &MainWindowViewer::processReset);
//detected end of comic
// detected end of comic
connect(viewer, &Viewer::openNextComic, this, &MainWindowViewer::openNextComic);
//detected start of comic
// detected start of comic
connect(viewer, &Viewer::openPreviousComic, this, &MainWindowViewer::openPreviousComic);
setCentralWidget(viewer);
@ -157,7 +157,7 @@ void MainWindowViewer::setupUI()
resize(QSize(width, height));
}
had = new HelpAboutDialog(this); //TODO load data
had = new HelpAboutDialog(this); // TODO load data
had->loadAboutInformation(":/files/about.html");
had->loadHelp(":/files/helpYACReader.html");
@ -169,7 +169,7 @@ void MainWindowViewer::setupUI()
connect(optionsDialog, &OptionsDialog::changedImageOptions, viewer, &Viewer::updatePage);
optionsDialog->restoreOptions(settings);
//shortcutsDialog = new ShortcutsDialog(this);
// shortcutsDialog = new ShortcutsDialog(this);
editShortcutsDialog = new EditShortcutsDialog(this);
connect(optionsDialog, &YACReaderOptionsDialog::editShortcuts, editShortcutsDialog, &QWidget::show);
@ -184,10 +184,10 @@ void MainWindowViewer::setupUI()
viewer->setFocusPolicy(Qt::StrongFocus);
//if(Configuration::getConfiguration().getAlwaysOnTop())
// if(Configuration::getConfiguration().getAlwaysOnTop())
//{
// setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
//}
// }
previousWindowFlags = windowFlags();
previousPos = pos();
@ -249,7 +249,7 @@ void MainWindowViewer::createActions()
connect(openLatestComicAction, &QAction::triggered, this, &MainWindowViewer::openLatestComic);
QAction *recentFileAction = nullptr;
//TODO: Replace limit with a configurable value
// TODO: Replace limit with a configurable value
for (int i = 0; i < Configuration::getConfiguration().getOpenRecentSize(); i++) {
recentFileAction = new QAction(this);
recentFileAction->setVisible(false);
@ -305,10 +305,10 @@ void MainWindowViewer::createActions()
adjustHeightAction = new QAction(tr("Fit Height"), this);
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
//adjustWidth->setCheckable(true);
// adjustWidth->setCheckable(true);
adjustHeightAction->setDisabled(true);
adjustHeightAction->setToolTip(tr("Fit image to height"));
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
// adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
adjustHeightAction->setData(ADJUST_HEIGHT_ACTION_Y);
adjustHeightAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_HEIGHT_ACTION_Y));
adjustHeightAction->setCheckable(true);
@ -316,10 +316,10 @@ void MainWindowViewer::createActions()
adjustWidthAction = new QAction(tr("Fit Width"), this);
adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
//adjustWidth->setCheckable(true);
// adjustWidth->setCheckable(true);
adjustWidthAction->setDisabled(true);
adjustWidthAction->setToolTip(tr("Fit image to width"));
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
// adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
adjustWidthAction->setData(ADJUST_WIDTH_ACTION_Y);
adjustWidthAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_WIDTH_ACTION_Y));
adjustWidthAction->setCheckable(true);
@ -342,7 +342,7 @@ void MainWindowViewer::createActions()
fitToPageAction->setCheckable(true);
connect(fitToPageAction, &QAction::triggered, this, &MainWindowViewer::fitToPageSwitch);
//fit modes have to be exclusive and checkable
// fit modes have to be exclusive and checkable
auto fitModes = new QActionGroup(this);
fitModes->addAction(adjustHeightAction);
fitModes->addAction(adjustWidthAction);
@ -412,7 +412,7 @@ void MainWindowViewer::createActions()
doublePageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_PAGE_ACTION_Y));
connect(doublePageAction, &QAction::triggered, viewer, &Viewer::doublePageSwitch);
//inversed pictures mode
// inversed pictures mode
doubleMangaPageAction = new QAction(tr("Double page manga mode"), this);
doubleMangaPageAction->setToolTip(tr("Reverse reading order in double page mode"));
doubleMangaPageAction->setIcon(QIcon(":/images/viewer_toolbar/doubleMangaPage.png"));
@ -479,7 +479,7 @@ void MainWindowViewer::createActions()
showShorcutsAction->setIcon(QIcon(":/images/viewer_toolbar/shortcuts.png"));
showShorcutsAction->setData(SHOW_SHORCUTS_ACTION_Y);
showShorcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_SHORCUTS_ACTION_Y));
//connect(showShorcutsAction, SIGNAL(triggered()),shortcutsDialog,SLOT(show()));
// connect(showShorcutsAction, SIGNAL(triggered()),shortcutsDialog,SLOT(show()));
connect(showShorcutsAction, &QAction::triggered, editShortcutsDialog, &QWidget::show);
showInfoAction = new QAction(tr("Show Info"), this);
@ -497,13 +497,13 @@ void MainWindowViewer::createActions()
showDictionaryAction = new QAction(tr("Show Dictionary"), this);
showDictionaryAction->setIcon(QIcon(":/images/viewer_toolbar/translator.png"));
//showDictionaryAction->setCheckable(true);
// showDictionaryAction->setCheckable(true);
showDictionaryAction->setDisabled(true);
showDictionaryAction->setData(SHOW_DICTIONARY_ACTION_Y);
showDictionaryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_DICTIONARY_ACTION_Y));
connect(showDictionaryAction, &QAction::triggered, viewer, &Viewer::translatorSwitch);
//deprecated
// deprecated
alwaysOnTopAction = new QAction(tr("Always on top"), this);
alwaysOnTopAction->setIcon(QIcon(":/images/alwaysOnTop.png"));
alwaysOnTopAction->setCheckable(true);
@ -535,7 +535,7 @@ void MainWindowViewer::createToolBars()
#endif
#ifdef Q_OS_MAC
//comicToolBar->setIconSize(QSize(16,16));
// comicToolBar->setIconSize(QSize(16,16));
#else
comicToolBar->setIconSize(QSize(18, 18));
comicToolBar->setStyleSheet("QToolBar{border:none;}");
@ -617,7 +617,7 @@ void MainWindowViewer::createToolBars()
comicToolBar->addAction(showShorcutsAction);
comicToolBar->addAction(optionsAction);
comicToolBar->addAction(helpAboutAction);
//comicToolBar->addAction(closeAction);
// comicToolBar->addAction(closeAction);
#ifndef Q_OS_MAC
comicToolBar->setMovable(false);
@ -668,13 +668,13 @@ void MainWindowViewer::createToolBars()
viewer->setContextMenuPolicy(Qt::ActionsContextMenu);
//MacOSX app menus
// MacOSX app menus
#ifdef Q_OS_MAC
auto menuBar = this->menuBar();
//about / preferences
//TODO
// about / preferences
// TODO
//file
// file
auto fileMenu = new QMenu(tr("File"));
fileMenu->addAction(newInstanceAction);
@ -741,14 +741,14 @@ void MainWindowViewer::createToolBars()
menuBar->addMenu(windowMenu);
menuBar->addMenu(helpMenu);
//tool bar
//QMenu * toolbarMenu = new QMenu(tr("Toolbar"));
//toolbarMenu->addAction();
//TODO
// tool bar
// QMenu * toolbarMenu = new QMenu(tr("Toolbar"));
// toolbarMenu->addAction();
// TODO
//menu->addMenu(toolbarMenu);
// menu->addMenu(toolbarMenu);
//attach toolbar
// attach toolbar
comicToolBar->attachToWindow(this->windowHandle());
@ -759,7 +759,7 @@ void MainWindowViewer::refreshRecentFilesActionList()
{
QStringList recentFilePaths = Configuration::getConfiguration().openRecentList();
//TODO: Replace limit with something configurable
// TODO: Replace limit with something configurable
int iteration = (recentFilePaths.size() < Configuration::getConfiguration().getOpenRecentSize())
? recentFilePaths.size()
: Configuration::getConfiguration().getOpenRecentSize();
@ -876,7 +876,7 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId, Open
} else {
isClient = false;
QMessageBox::information(this, "Connection Error", "Unable to connect to YACReaderLibrary");
//error
// error
}
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
@ -886,11 +886,11 @@ void MainWindowViewer::openComicFromPath(QString pathFile)
{
doubleMangaPageAction->setChecked(Configuration::getConfiguration().getDoubleMangaPage());
openComic(pathFile);
isClient = false; //this method is used for direct openings
isClient = false; // this method is used for direct openings
updatePrevNextActions(!previousComicPath.isEmpty(), !nextComicPath.isEmpty());
}
//isClient shouldn't be modified when a siblinig comic is opened
// isClient shouldn't be modified when a siblinig comic is opened
void MainWindowViewer::openSiblingComic(QString pathFile)
{
openComic(pathFile);
@ -923,7 +923,7 @@ void MainWindowViewer::openFolder()
void MainWindowViewer::openFolderFromPath(QString pathDir)
{
currentDirectory = pathDir; //TODO ??
currentDirectory = pathDir; // TODO ??
QFileInfo fi(pathDir);
getSiblingComics(fi.absolutePath(), fi.fileName());
@ -938,7 +938,7 @@ void MainWindowViewer::openFolderFromPath(QString pathDir)
void MainWindowViewer::openFolderFromPath(QString pathDir, QString atFileName)
{
currentDirectory = pathDir; //TODO ??
currentDirectory = pathDir; // TODO ??
QFileInfo fi(pathDir);
getSiblingComics(fi.absolutePath(), fi.fileName());
@ -988,7 +988,7 @@ void MainWindowViewer::enableActions()
adjustHeightAction->setDisabled(false);
adjustWidthAction->setDisabled(false);
goToPageAction->setDisabled(false);
//alwaysOnTopAction->setDisabled(false);
// alwaysOnTopAction->setDisabled(false);
leftRotationAction->setDisabled(false);
rightRotationAction->setDisabled(false);
showMagnifyingGlassAction->setDisabled(false);
@ -1001,9 +1001,9 @@ void MainWindowViewer::enableActions()
increasePageZoomAction->setDisabled(false);
decreasePageZoomAction->setDisabled(false);
resetZoomAction->setDisabled(false);
//setBookmark->setDisabled(false);
// setBookmark->setDisabled(false);
showBookmarksAction->setDisabled(false);
showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited
showInfoAction->setDisabled(false); // TODO enable goTo and showInfo (or update) when numPages emited
showDictionaryAction->setDisabled(false);
showFlowAction->setDisabled(false);
@ -1020,7 +1020,7 @@ void MainWindowViewer::disableActions()
adjustHeightAction->setDisabled(true);
adjustWidthAction->setDisabled(true);
goToPageAction->setDisabled(true);
//alwaysOnTopAction->setDisabled(true);
// alwaysOnTopAction->setDisabled(true);
leftRotationAction->setDisabled(true);
rightRotationAction->setDisabled(true);
showMagnifyingGlassAction->setDisabled(true);
@ -1034,7 +1034,7 @@ void MainWindowViewer::disableActions()
resetZoomAction->setDisabled(true);
setBookmarkAction->setDisabled(true);
showBookmarksAction->setDisabled(true);
showInfoAction->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
showInfoAction->setDisabled(true); // TODO enable goTo and showInfo (or update) when numPages emited
openComicOnTheLeftAction->setDisabled(true);
openComicOnTheRightAction->setDisabled(true);
showDictionaryAction->setDisabled(true);
@ -1043,7 +1043,7 @@ void MainWindowViewer::disableActions()
void MainWindowViewer::keyPressEvent(QKeyEvent *event)
{
//TODO remove unused keys
// TODO remove unused keys
int _key = event->key();
Qt::KeyboardModifiers modifiers = event->modifiers();
@ -1083,7 +1083,7 @@ void MainWindowViewer::toggleFullScreen()
Configuration::getConfiguration().setFullScreen(fullscreen = !fullscreen);
}
#ifdef Q_OS_WIN //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
#ifdef Q_OS_WIN // fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
void MainWindowViewer::toFullScreen()
{
@ -1091,7 +1091,7 @@ void MainWindowViewer::toFullScreen()
hideToolBars();
viewer->hide();
viewer->fullscreen = true; //TODO, change by the right use of windowState();
viewer->fullscreen = true; // TODO, change by the right use of windowState();
previousWindowFlags = windowFlags();
previousPos = pos();
@ -1114,10 +1114,10 @@ void MainWindowViewer::toFullScreen()
void MainWindowViewer::toNormal()
{
//show all
// show all
viewer->hide();
viewer->fullscreen = false; //TODO, change by the right use of windowState();
//viewer->hideMagnifyingGlass();
viewer->fullscreen = false; // TODO, change by the right use of windowState();
// viewer->hideMagnifyingGlass();
setWindowFlags(previousWindowFlags);
move(previousPos);
@ -1141,7 +1141,7 @@ void MainWindowViewer::toFullScreen()
hideToolBars();
viewer->hide();
viewer->fullscreen = true; //TODO, change by the right use of windowState();
viewer->fullscreen = true; // TODO, change by the right use of windowState();
setWindowState(Qt::WindowFullScreen);
viewer->show();
if (viewer->magnifyingGlassIsVisible())
@ -1150,10 +1150,10 @@ void MainWindowViewer::toFullScreen()
void MainWindowViewer::toNormal()
{
//show all
// show all
viewer->hide();
viewer->fullscreen = false; //TODO, change by the right use of windowState();
//viewer->hideMagnifyingGlass();
viewer->fullscreen = false; // TODO, change by the right use of windowState();
// viewer->hideMagnifyingGlass();
if (fromMaximized)
showMaximized();
else
@ -1178,7 +1178,7 @@ void MainWindowViewer::toggleToolBars()
}
void MainWindowViewer::hideToolBars()
{
//hide all
// hide all
this->comicToolBar->hide();
toolbars = false;
}
@ -1203,11 +1203,11 @@ void MainWindowViewer::fitToHeight()
void MainWindowViewer::toggleWidthHeight()
{
//Only switch to "Fit to height" when we're in "Fit to width"
// Only switch to "Fit to height" when we're in "Fit to width"
if (Configuration::getConfiguration().getFitMode() == YACReader::FitMode::ToWidth) {
adjustHeightAction->trigger();
}
//Default to "Fit to width" in all other cases
// Default to "Fit to width" in all other cases
else {
adjustWidthAction->trigger();
}
@ -1246,7 +1246,7 @@ void MainWindowViewer::processReset()
void MainWindowViewer::setUpShortcutsManagement()
{
//actions holder
// actions holder
auto orphanActions = new QObject;
QList<QAction *> allActions;
@ -1262,7 +1262,7 @@ void MainWindowViewer::setUpShortcutsManagement()
allActions << tmpList;
//keys without actions (General)
// keys without actions (General)
QAction *toggleFullScreenAction = new QAction(tr("Toggle fullscreen mode"), orphanActions);
toggleFullScreenAction->setData(TOGGLE_FULL_SCREEN_ACTION_Y);
toggleFullScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_FULL_SCREEN_ACTION_Y));
@ -1290,7 +1290,7 @@ void MainWindowViewer::setUpShortcutsManagement()
allActions << tmpList;
//keys without actions (MGlass)
// keys without actions (MGlass)
auto sizeUpMglassAction = new QAction(tr("Size up magnifying glass"), orphanActions);
sizeUpMglassAction->setData(SIZE_UP_MGLASS_ACTION_Y);
sizeUpMglassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y));
@ -1317,7 +1317,7 @@ void MainWindowViewer::setUpShortcutsManagement()
allActions << tmpList;
//keys without actions
// keys without actions
auto toggleFitToScreenAction = new QAction(tr("Toggle between fit to width and fit to height"), orphanActions);
toggleFitToScreenAction->setData(CHANGE_FIT_ACTION_Y);
toggleFitToScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(CHANGE_FIT_ACTION_Y));
@ -1489,7 +1489,7 @@ void MainWindowViewer::openPreviousComic()
if (currentIndex == -1)
return;
if (currentIndex - 1 >= 0 && currentIndex - 1 < siblingComics.count()) {
siblingComics[currentIndex] = currentComicDB; //updated
siblingComics[currentIndex] = currentComicDB; // updated
currentComicDB = siblingComics.at(currentIndex - 1);
open(currentDirectory + currentComicDB.path, currentComicDB, siblingComics);
}
@ -1509,7 +1509,7 @@ void MainWindowViewer::openNextComic()
if (currentIndex == -1)
return;
if (currentIndex + 1 > 0 && currentIndex + 1 < siblingComics.count()) {
siblingComics[currentIndex] = currentComicDB; //updated
siblingComics[currentIndex] = currentComicDB; // updated
currentComicDB = siblingComics.at(currentIndex + 1);
open(currentDirectory + currentComicDB.path, currentComicDB, siblingComics);
}
@ -1567,7 +1567,7 @@ void MainWindowViewer::getSiblingComics(QString path, QString currentComic)
QStringList list = d.entryList();
std::sort(list.begin(), list.end(), naturalSortLessThanCI);
int index = list.indexOf(currentComic);
if (index == -1) //comic not found
if (index == -1) // comic not found
{
/*QFile f(QCoreApplication::applicationDirPath()+"/errorLog.txt");
if(!f.open(QIODevice::WriteOnly))
@ -1615,7 +1615,7 @@ void MainWindowViewer::dropEvent(QDropEvent *event)
info.setFile(fName); // information about file
if (info.isFile()) {
QStringList imageSuffixs = Comic::getSupportedImageLiteralFormats();
if (imageSuffixs.contains(info.suffix())) //image dropped
if (imageSuffixs.contains(info.suffix())) // image dropped
openFolderFromPath(info.absoluteDir().absolutePath(), info.fileName());
else
openComicFromPath(fName); // if is file, setText
@ -1640,7 +1640,7 @@ void MainWindowViewer::dragEnterEvent(QDragEnterEvent *event)
void MainWindowViewer::alwaysOnTopSwitch()
{
if (!Configuration::getConfiguration().getAlwaysOnTop()) {
setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); //always on top
setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); // always on top
show();
} else {
setWindowFlags(this->windowFlags() ^ (Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint));

View File

@ -83,24 +83,24 @@ public slots:
void updatePage();*/
private:
//!State
//! State
bool fullscreen;
bool toolbars;
bool alwaysOnTop;
bool fromMaximized;
//QTBUG-41883
// QTBUG-41883
QSize _size;
QPoint _pos;
QString currentDirectory;
QString currentDirectoryImgDest;
//!Widgets
//! Widgets
Viewer *viewer;
//GoToDialog * goToDialog;
// GoToDialog * goToDialog;
OptionsDialog *optionsDialog;
HelpAboutDialog *had;
//ShortcutsDialog * shortcutsDialog;
// ShortcutsDialog * shortcutsDialog;
EditShortcutsDialog *editShortcutsDialog;
//! ToolBars
@ -113,7 +113,7 @@ private:
//! Actions
QAction *openAction;
#ifdef Q_OS_MAC
QAction *newInstanceAction; //needed in macos
QAction *newInstanceAction; // needed in macos
#endif
QAction *openFolderAction;
QAction *openLatestComicAction;
@ -166,7 +166,7 @@ private:
//! Manejadores de evento:
void keyPressEvent(QKeyEvent *event) override;
//void resizeEvent(QResizeEvent * event);
// void resizeEvent(QResizeEvent * event);
void mouseDoubleClickEvent(QMouseEvent *event) override;
void dropEvent(QDropEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
@ -180,7 +180,7 @@ private:
quint64 libraryId;
OpenComicSource source;
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
// fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
Qt::WindowFlags previousWindowFlags;
QPoint previousPos;
QSize previousSize;

View File

@ -28,7 +28,7 @@ NotificationsLabelWidget::NotificationsLabelWidget(QWidget *parent)
textLabel->setFixedSize(200, 120);
//TODO check if the effects still be broken in OSX yet
// TODO check if the effects still be broken in OSX yet
#ifndef Q_OS_MAC
this->setGraphicsEffect(effect);
#endif

View File

@ -36,7 +36,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
auto layoutImage = new QGridLayout();
QGroupBox *slideSizeBox = new QGroupBox(tr("\"Go to flow\" size"));
//slideSizeLabel = new QLabel(,this);
// slideSizeLabel = new QLabel(,this);
slideSize = new QSlider(this);
slideSize->setMinimum(125);
slideSize->setMaximum(350);
@ -66,33 +66,33 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(colorDialog, &QColorDialog::colorSelected, this, &OptionsDialog::updateColor);
QGroupBox *colorBox = new QGroupBox(tr("Background color"));
//backgroundColor->setMinimumWidth(100);
// backgroundColor->setMinimumWidth(100);
colorSelection->addWidget(backgroundColor);
colorSelection->addWidget(selectBackgroundColorButton = new QPushButton(tr("Choose")));
colorSelection->setStretchFactor(backgroundColor, 1);
colorSelection->setStretchFactor(selectBackgroundColorButton, 0);
//colorSelection->addStretch();
// colorSelection->addStretch();
connect(selectBackgroundColorButton, &QAbstractButton::clicked, colorDialog, &QWidget::show);
colorBox->setLayout(colorSelection);
brightnessS = new YACReaderSpinSliderWidget(this, true);
brightnessS->setRange(0, 100);
//brightnessS->setText(tr("Brightness"));
// brightnessS->setText(tr("Brightness"));
brightnessS->setTracking(false);
connect(brightnessS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::brightnessChanged);
contrastS = new YACReaderSpinSliderWidget(this, true);
contrastS->setRange(0, 250);
//contrastS->setText(tr("Contrast"));
// contrastS->setText(tr("Contrast"));
contrastS->setTracking(false);
connect(contrastS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::contrastChanged);
gammaS = new YACReaderSpinSliderWidget(this, true);
gammaS->setRange(0, 250);
//gammaS->setText(tr("Gamma"));
// gammaS->setText(tr("Gamma"));
gammaS->setTracking(false);
connect(gammaS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::gammaChanged);
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
// connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
quickNavi = new QCheckBox(tr("Quick Navigation Mode"));
disableShowOnMouseOver = new QCheckBox(tr("Disable mouse over activation"));
@ -105,7 +105,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
layoutGeneral->addWidget(pathBox);
layoutGeneral->addWidget(slideSizeBox);
//layoutGeneral->addWidget(fitBox);
// layoutGeneral->addWidget(fitBox);
layoutGeneral->addWidget(colorBox);
layoutGeneral->addWidget(shortcutsBox);
layoutGeneral->addStretch();
@ -174,12 +174,12 @@ OptionsDialog::OptionsDialog(QWidget *parent)
setLayout(layout);
//disable vSyncCheck
// disable vSyncCheck
#ifndef NO_OPENGL
gl->vSyncCheck->hide();
#endif
//restoreOptions(); //load options
//resize(400,0);
// restoreOptions(); //load options
// resize(400,0);
setModal(true);
setWindowTitle(tr("Options"));
@ -209,7 +209,7 @@ void OptionsDialog::saveOptions()
settings->setValue(PATH, pathEdit->text());
settings->setValue(BACKGROUND_COLOR, colorDialog->currentColor());
//settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
// settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
settings->setValue(QUICK_NAVI_MODE, quickNavi->isChecked());
settings->setValue(DISABLE_MOUSE_OVER_GOTO_FLOW, disableShowOnMouseOver->isChecked());
@ -239,7 +239,7 @@ void OptionsDialog::restoreOptions(QSettings *settings)
pathEdit->setText(settings->value(PATH).toString());
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
// fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
quickNavi->setChecked(settings->value(QUICK_NAVI_MODE).toBool());
disableShowOnMouseOver->setChecked(settings->value(DISABLE_MOUSE_OVER_GOTO_FLOW).toBool());
@ -270,7 +270,7 @@ void OptionsDialog::brightnessChanged(int value)
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
settings.setValue(BRIGHTNESS, value);
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
//emit(changedImageOptions());
// emit(changedImageOptions());
}
void OptionsDialog::contrastChanged(int value)
@ -278,7 +278,7 @@ void OptionsDialog::contrastChanged(int value)
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
settings.setValue(CONTRAST, value);
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
///emit(changedImageOptions());
/// emit(changedImageOptions());
}
void OptionsDialog::gammaChanged(int value)
@ -286,7 +286,7 @@ void OptionsDialog::gammaChanged(int value)
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
settings.setValue(GAMMA, value);
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
//emit(changedImageOptions());
// emit(changedImageOptions());
}
void OptionsDialog::resetImageConfig()
@ -299,16 +299,16 @@ void OptionsDialog::resetImageConfig()
settings.setValue(CONTRAST, 100);
settings.setValue(GAMMA, 100);
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
//emit(changedImageOptions());
// emit(changedImageOptions());
}
void OptionsDialog::show()
{
//TODO solucionar el tema de las settings, esto sólo debería aparecer en una única línea de código
// TODO solucionar el tema de las settings, esto sólo debería aparecer en una única línea de código
QSettings *s = new QSettings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
//fitToWidthRatioS->disconnect();
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
//connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
// fitToWidthRatioS->disconnect();
// fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
// connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
QDialog::show();
delete s;
}

View File

@ -20,7 +20,7 @@ public:
OptionsDialog(QWidget *parent = nullptr);
private:
//QLabel * pathLabel;
// QLabel * pathLabel;
QLineEdit *pathEdit;
QPushButton *pathFindButton;
QCheckBox *quickNavi;
@ -32,11 +32,11 @@ private:
QLabel *zoomLevel;
//QLabel * slideSizeLabel;
// QLabel * slideSizeLabel;
QSlider *slideSize;
//QLabel * fitToWidthRatioLabel;
//QSlider * fitToWidthRatioS;
// QLabel * fitToWidthRatioLabel;
// QSlider * fitToWidthRatioS;
QLabel *backgroundColor;
QPushButton *selectBackgroundColorButton;
@ -54,7 +54,7 @@ public slots:
void restoreOptions(QSettings *settings) override;
void findFolder();
void updateColor(const QColor &color);
//void fitToWidthRatio(int value);
// void fitToWidthRatio(int value);
void brightnessChanged(int value);
void contrastChanged(int value);
void gammaChanged(int value);
@ -66,7 +66,7 @@ signals:
void changedOptions();
void changedImageOptions();
void changedFilters(int brightness, int contrast, int gamma);
//void fitToWidthRatioChanged(float ratio);
// void fitToWidthRatioChanged(float ratio);
};
#endif

View File

@ -50,7 +50,7 @@ void PageLabelWidget::show()
}
QWidget::show();
//connect(animation,SIGNAL(finished()),this,SLOT(QWidget::hide()));
// connect(animation,SIGNAL(finished()),this,SLOT(QWidget::hide()));
animation->disconnect();
animation->setStartValue(QPoint((parent->geometry().size().width() - this->width()), -this->height()));
@ -66,7 +66,7 @@ void PageLabelWidget::hide()
if (parent == nullptr) {
return;
}
//connect(animation,SIGNAL(finished()),this,SLOT(setHidden()));
// connect(animation,SIGNAL(finished()),this,SLOT(setHidden()));
animation->setStartValue(QPoint((parent->geometry().size().width() - this->width()), 0));
animation->setEndValue(QPoint((parent->geometry().size().width() - this->width()), -this->height()));
animation->start();

View File

@ -151,8 +151,8 @@ QImage MeanNoiseReductionFilter::setFilter(const QImage &image)
}
}
result.setPixel(i, j, QColor(r / neighborghoodSize, g / neighborghoodSize, b / neighborghoodSize).rgb());
//qDebug((QString::number(redChannel.at(4))+" "+QString::number(greenChannel.at(4))+" "+QString::number(blueChannel.at(4))).toAscii());
//qDebug((QString::number(redChannel.size())+" "+QString::number(greenChannel.size())+" "+QString::number(blueChannel.size())).toAscii());
// qDebug((QString::number(redChannel.at(4))+" "+QString::number(greenChannel.at(4))+" "+QString::number(blueChannel.at(4))).toAscii());
// qDebug((QString::number(redChannel.size())+" "+QString::number(greenChannel.size())+" "+QString::number(blueChannel.size())).toAscii());
}
}
return result;
@ -393,13 +393,13 @@ Render::~Render()
delete pr;
}
//TODO move to share_ptr
// TODO move to share_ptr
foreach (ImageFilter *filter, filters)
delete filter;
}
//Este método se encarga de forzar el renderizado de las páginas.
//Actualiza el buffer según es necesario.
//si la pagina actual no está renderizada, se lanza un hilo que la renderize (double or single page mode) y se emite una señal que indica que se está renderizando.
// Este método se encarga de forzar el renderizado de las páginas.
// Actualiza el buffer según es necesario.
// si la pagina actual no está renderizada, se lanza un hilo que la renderize (double or single page mode) y se emite una señal que indica que se está renderizando.
void Render::render()
{
updateBuffer();
@ -408,29 +408,29 @@ void Render::render()
if (pagesReady[currentIndex]) {
pageRenders[currentPageBufferedIndex] = new PageRender(this, currentIndex, comic->getRawData()->at(currentIndex), buffer[currentPageBufferedIndex], imageRotation, filters);
} else
//las páginas no están listas, y se están cargando en el cómic
emit processingPage(); //para evitar confusiones esta señal debería llamarse de otra forma
// las páginas no están listas, y se están cargando en el cómic
emit processingPage(); // para evitar confusiones esta señal debería llamarse de otra forma
//si se ha creado un hilo para renderizar la página actual, se arranca
// si se ha creado un hilo para renderizar la página actual, se arranca
if (pageRenders[currentPageBufferedIndex] != 0) {
//se conecta la señal pageReady del hilo, con el SLOT prepareAvailablePage
// se conecta la señal pageReady del hilo, con el SLOT prepareAvailablePage
connect(pageRenders[currentPageBufferedIndex], &PageRender::pageReady, this, &Render::prepareAvailablePage);
//se emite la señal de procesando, debido a que los hilos se arrancan aquí
// se emite la señal de procesando, debido a que los hilos se arrancan aquí
if (filters.size() > 0)
emit processingPage();
pageRenders[currentPageBufferedIndex]->start();
pageRenders[currentPageBufferedIndex]->setPriority(QThread::TimeCriticalPriority);
} else
//en qué caso sería necesario hacer esto??? //TODO: IMPORTANTE, puede que no sea necesario.
// en qué caso sería necesario hacer esto??? //TODO: IMPORTANTE, puede que no sea necesario.
emit processingPage();
} else
//no hay ninguna página lista para ser renderizada, es necesario esperar.
// no hay ninguna página lista para ser renderizada, es necesario esperar.
emit processingPage();
} else
// la página actual está lista
{
//emit currentPageReady();
//make prepareAvailablePage the only function that emits currentPageReady()
// emit currentPageReady();
// make prepareAvailablePage the only function that emits currentPageReady()
prepareAvailablePage(currentIndex);
}
fillBuffer();
@ -567,7 +567,7 @@ bool Render::currentPageIsDoublePage()
bool Render::nextPageIsDoublePage()
{
//this function is not used right now
// this function is not used right now
if (buffer[currentPageBufferedIndex + 2]->isNull() || buffer[currentPageBufferedIndex + 3]->isNull()) {
return false;
}
@ -629,7 +629,7 @@ void Render::prepareAvailablePage(int page)
emit currentPageReady();
}
} else {
//check for last page in double page mode
// check for last page in double page mode
if ((currentIndex == page) && (currentIndex + 1) >= (int)comic->numPages()) {
emit currentPageReady();
} else if ((currentIndex == page && !buffer[currentPageBufferedIndex + 1]->isNull()) ||
@ -658,7 +658,7 @@ void Render::load(const QString &path, int atPage)
//-----------------------------------------------------------------------------
void Render::load(const QString &path, const ComicDB &comicDB)
{
//TODO prepare filters
// TODO prepare filters
for (int i = 0; i < filters.count(); i++) {
if (typeid(*filters[i]) == typeid(BrightnessFilter)) {
if (comicDB.info.brightness == -1)
@ -700,7 +700,7 @@ void Render::createComic(const QString &path)
}
comic = FactoryComic::newComic(path);
if (comic == nullptr) //archivo no encontrado o no válido
if (comic == nullptr) // archivo no encontrado o no válido
{
emit errorOpening();
reset();
@ -721,8 +721,8 @@ void Render::createComic(const QString &path)
connect(comic, &Comic::bookmarksUpdated, this, &Render::bookmarksUpdated, Qt::QueuedConnection);
//connect(comic,SIGNAL(isLast()),this,SIGNAL(isLast()));
//connect(comic,SIGNAL(isCover()),this,SIGNAL(isCover()));
// connect(comic,SIGNAL(isLast()),this,SIGNAL(isLast()));
// connect(comic,SIGNAL(isCover()),this,SIGNAL(isCover()));
pagesReady.clear();
}
@ -770,13 +770,13 @@ void Render::reset()
loadedComic = false;
invalidate();
}
//si se solicita la siguiente página, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
//la página sólo se renderiza, si realmente ha cambiado.
// si se solicita la siguiente página, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
// la página sólo se renderiza, si realmente ha cambiado.
void Render::nextPage()
{
int nextPage; //indica cuál será la próxima página
int nextPage; // indica cuál será la próxima página
nextPage = comic->nextPage();
//se fuerza renderizado si la página ha cambiado
// se fuerza renderizado si la página ha cambiado
if (currentIndex != nextPage) {
previousIndex = currentIndex;
currentIndex = nextPage;
@ -805,14 +805,14 @@ void Render::nextDoublePage()
}
}
//si se solicita la página anterior, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
//la página sólo se renderiza, si realmente ha cambiado.
// si se solicita la página anterior, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
// la página sólo se renderiza, si realmente ha cambiado.
void Render::previousPage()
{
int previousPage; //indica cuál será la próxima página
int previousPage; // indica cuál será la próxima página
previousPage = comic->previousPage();
//se fuerza renderizado si la página ha cambiado
// se fuerza renderizado si la página ha cambiado
if (currentIndex != previousPage) {
previousIndex = currentIndex;
currentIndex = previousPage;
@ -825,7 +825,7 @@ void Render::previousPage()
void Render::previousDoublePage()
{
int previousPage; //indica cuál será la próxima página
int previousPage; // indica cuál será la próxima página
previousPage = qMax(currentIndex - 2, 0);
if (currentIndex != previousPage) {
comic->setIndex(previousPage);
@ -867,7 +867,7 @@ void Render::pageRawDataReady(int page)
for (int i = 0; i < pagesEmited.size(); i++) {
if (pagesEmited.at(i) >= pagesReady.size()) {
pagesEmited.clear();
return; //Oooops, something went wrong
return; // Oooops, something went wrong
}
pagesReady[pagesEmited.at(i)] = true;
@ -884,7 +884,7 @@ void Render::pageRawDataReady(int page)
}
}
//sólo se renderiza la página, si ha habido un cambio de página
// sólo se renderiza la página, si ha habido un cambio de página
void Render::goTo(int index)
{
@ -911,19 +911,19 @@ void Render::rotateLeft()
reload();
}
//Actualiza el buffer, añadiendo las imágenes (vacías) necesarias para su posterior renderizado y
//eliminado aquellas que ya no sean necesarias. También libera los hilos (no estoy seguro de que sea responsabilidad suya)
//Calcula el número de nuevas páginas que hay que buferear y si debe hacerlo por la izquierda o la derecha (según sea el sentido de la lectura)
// Actualiza el buffer, añadiendo las imágenes (vacías) necesarias para su posterior renderizado y
// eliminado aquellas que ya no sean necesarias. También libera los hilos (no estoy seguro de que sea responsabilidad suya)
// Calcula el número de nuevas páginas que hay que buferear y si debe hacerlo por la izquierda o la derecha (según sea el sentido de la lectura)
void Render::updateBuffer()
{
QMutexLocker locker(&mutex);
int windowSize = currentIndex - previousIndex;
if (windowSize > 0) //add pages to right pages and remove on the left
if (windowSize > 0) // add pages to right pages and remove on the left
{
windowSize = qMin(windowSize, buffer.size());
for (int i = 0; i < windowSize; i++) {
//renders
// renders
PageRender *pr = pageRenders.front();
pageRenders.pop_front();
if (pr != nullptr) {
@ -932,20 +932,20 @@ void Render::updateBuffer()
}
pageRenders.push_back(0);
//images
// images
if (buffer.front() != 0)
delete buffer.front();
buffer.pop_front();
buffer.push_back(new QImage());
}
} else //add pages to left pages and remove on the right
} else // add pages to left pages and remove on the right
{
if (windowSize < 0) {
windowSize = -windowSize;
windowSize = qMin(windowSize, buffer.size());
for (int i = 0; i < windowSize; i++) {
//renders
// renders
PageRender *pr = pageRenders.back();
pageRenders.pop_back();
if (pr != nullptr) {
@ -954,7 +954,7 @@ void Render::updateBuffer()
}
pageRenders.push_front(0);
//images
// images
buffer.push_front(new QImage());
QImage *p = buffer.back();
if (p != nullptr)
@ -977,7 +977,7 @@ void Render::fillBuffer()
buffer[currentPageBufferedIndex + i]->isNull() &&
i <= numRightPages &&
pageRenders[currentPageBufferedIndex + i] == 0 &&
pagesReady[currentIndex + i]) //preload next pages
pagesReady[currentIndex + i]) // preload next pages
{
pageRenders[currentPageBufferedIndex + i] = new PageRender(this, currentIndex + i, comic->getRawData()->at(currentIndex + i), buffer[currentPageBufferedIndex + i], imageRotation, filters);
connect(pageRenders[currentPageBufferedIndex + i], &PageRender::pageReady, this, &Render::prepareAvailablePage);
@ -988,7 +988,7 @@ void Render::fillBuffer()
buffer[currentPageBufferedIndex - i]->isNull() &&
i <= numLeftPages &&
pageRenders[currentPageBufferedIndex - i] == 0 &&
pagesReady[currentIndex - i]) //preload previous pages
pagesReady[currentIndex - i]) // preload previous pages
{
pageRenders[currentPageBufferedIndex - i] = new PageRender(this, currentIndex - i, comic->getRawData()->at(currentIndex - i), buffer[currentPageBufferedIndex - i], imageRotation, filters);
connect(pageRenders[currentPageBufferedIndex - i], &PageRender::pageReady, this, &Render::prepareAvailablePage);
@ -997,8 +997,8 @@ void Render::fillBuffer()
}
}
//Método que debe ser llamado cada vez que la estructura del buffer se vuelve inconsistente con el modo de lectura actual.
//se terminan todos los hilos en ejecución y se libera la memoria (de hilos e imágenes)
// Método que debe ser llamado cada vez que la estructura del buffer se vuelve inconsistente con el modo de lectura actual.
// se terminan todos los hilos en ejecución y se libera la memoria (de hilos e imágenes)
void Render::invalidate()
{
for (int i = 0; i < pageRenders.size(); i++) {
@ -1019,7 +1019,7 @@ void Render::doublePageSwitch()
{
doublePage = !doublePage;
if (comic) {
//invalidate();
// invalidate();
update();
}
}
@ -1028,7 +1028,7 @@ void Render::setManga(bool manga)
{
doubleMangaPage = manga;
if (comic && doublePage) {
//invalidate();
// invalidate();
update();
}
}
@ -1037,7 +1037,7 @@ void Render::doubleMangaPageSwitch()
{
doubleMangaPage = !doubleMangaPage;
if (comic && doublePage) {
//invalidate();
// invalidate();
update();
}
}

View File

@ -179,7 +179,7 @@ public slots:
void reload();
void updateFilters(int brightness, int contrast, int gamma);
Bookmarks *getBookmarks();
//sets the firt page to render
// sets the firt page to render
void renderAt(int page);
signals:
@ -205,7 +205,7 @@ private:
bool doubleMangaPage;
int previousIndex;
int currentIndex;
//QPixmap * currentPage;
// QPixmap * currentPage;
int currentPageBufferedIndex;
int numLeftPages;
int numRightPages;

View File

@ -32,7 +32,7 @@ ShortcutsDialog::ShortcutsDialog(QWidget *parent)
//"<p><b>General functions:</b><hr/><b>O</b> : Open comic<br/><b>Esc</b> : Exit</p>"
shortcuts->setReadOnly(true);
shortcutsLayout->addWidget(shortcuts);
//shortcutsLayout->addWidget(shortcuts2);
// shortcutsLayout->addWidget(shortcuts2);
shortcutsLayout->setSpacing(0);
mainLayout->addLayout(shortcutsLayout);
mainLayout->addLayout(bottomLayout);

View File

@ -56,7 +56,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
auto layout = new QVBoxLayout(this);
//TITLE BAR
// TITLE BAR
auto titleBar = new QHBoxLayout();
auto close = new QPushButton(QIcon(QPixmap(":/images/close.png")), "");
close->setFlat(true);
@ -73,7 +73,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
layout->addLayout(titleBar);
//INPUT TEXT
// INPUT TEXT
text = new QTextEdit(this);
text->setMinimumHeight(110);
text->setMaximumHeight(110);
@ -81,7 +81,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
layout->addWidget(text);
text->setStyleSheet("QTextEdit{border:none;background:#2a2a2a;color:white; font-size:12px; padding:6px;}" + scrollBarStyle);
//COMBOBOXES
// COMBOBOXES
auto combos = new QHBoxLayout();
from = new QComboBox(this);
to = new QComboBox(this);
@ -112,7 +112,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
layout->addSpacing(12);
layout->addLayout(combos);
//RESULTS
// RESULTS
auto resultsTitleLayout = new QHBoxLayout();
resultsTitle = new QLabel(tr("Translation"));
resultsTitle->setStyleSheet("QLabel {font-family:Arial;font-size:14px;color:#e3e3e3;}");
@ -136,7 +136,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
layout->addStretch();
//CLEAR BUTTON
// CLEAR BUTTON
clearButton = new QPushButton(tr("clear"));
layout->addWidget(clearButton, 0, Qt::AlignRight);
clearButton->setMinimumWidth(95);
@ -162,7 +162,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
connect(speakButton, &QAbstractButton::pressed, this, &YACReaderTranslator::play);
connect(clearButton, &QAbstractButton::pressed, this, &YACReaderTranslator::clear);
//multimedia/phonon
// multimedia/phonon
#if QT_VERSION >= 0x050000
player = new QMediaPlayer;
#else
@ -289,7 +289,7 @@ void YACReaderTranslator::populateCombos()
void YACReaderTranslator::play()
{
//QMessageBox::question(this,"xxx",ttsSource.toString());
// QMessageBox::question(this,"xxx",ttsSource.toString());
#if QT_VERSION >= 0x050000
player->setMedia(ttsSource);

View File

@ -45,10 +45,10 @@ Viewer::Viewer(QWidget *parent)
translatorAnimation->setDuration(150);
translatorXPos = -10000;
translator->move(-translator->width(), 10);
//current comic page
// current comic page
content = new QLabel(this);
configureContent(tr("Press 'O' to open comic."));
//scroll area configuration
// scroll area configuration
setBackgroundRole(QPalette::Dark);
setWidget(content);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -71,7 +71,7 @@ Viewer::Viewer(QWidget *parent)
QSettings *settings = new QSettings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
//CONFIG GOTO_FLOW--------------------------------------------------------
// CONFIG GOTO_FLOW--------------------------------------------------------
#ifndef NO_OPENGL
OpenGLChecker openGLChecker;
@ -113,7 +113,7 @@ Viewer::Viewer(QWidget *parent)
setMouseTracking(true);
//animations
// animations
verticalScroller = new QPropertyAnimation(verticalScrollBar(), "sliderPosition");
connect(verticalScroller, &QVariantAnimation::valueChanged, this, &Viewer::backgroundChanges);
horizontalScroller = new QPropertyAnimation(horizontalScrollBar(), "sliderPosition");
@ -151,27 +151,27 @@ Viewer::~Viewer()
void Viewer::createConnections()
{
//magnifyingGlass (update mg after a background change
// magnifyingGlass (update mg after a background change
connect(this, &Viewer::backgroundChanges, mglass, QOverload<>::of(&MagnifyingGlass::updateImage));
//goToDialog
// goToDialog
connect(goToDialog, &GoToDialog::goToPage, this, &Viewer::goTo);
//goToFlow goTo
// goToFlow goTo
connect(goToFlow, &GoToFlowWidget::goToPage, this, &Viewer::goTo);
//current time
// current time
auto t = new QTimer(this);
connect(t, &QTimer::timeout, this, &Viewer::updateInformation);
t->start(1000);
//hide cursor
// hide cursor
connect(hideCursorTimer, &QTimer::timeout, this, &Viewer::hideCursor);
//bookmarks
// bookmarks
connect(bd, &BookmarksDialog::goToPage, this, &Viewer::goTo);
//render
// render
connect(render, QOverload<>::of(&Render::errorOpening), this, &Viewer::resetContent);
connect(render, QOverload<>::of(&Render::errorOpening), this, QOverload<>::of(&Viewer::showMessageErrorOpening));
connect(render, QOverload<QString>::of(&Render::errorOpening), this, QOverload<QString>::of(&Viewer::showMessageErrorOpening));
@ -190,16 +190,16 @@ void Viewer::createConnections()
connect(render, &Render::bookmarksUpdated, this, &Viewer::setBookmarks);
}
//Deprecated
// Deprecated
void Viewer::prepareForOpening()
{
if (render->hasLoadedComic())
save();
//bd->setBookmarks(*bm);
// bd->setBookmarks(*bm);
goToFlow->reset();
//render->update();
// render->update();
verticalScrollBar()->setSliderPosition(verticalScrollBar()->minimum());
@ -225,7 +225,7 @@ void Viewer::open(QString pathFile, const ComicDB &comic)
void Viewer::showMessageErrorOpening()
{
QMessageBox::critical(this, tr("Not found"), tr("Comic not found"));
//resetContent(); --> not needed
// resetContent(); --> not needed
}
void Viewer::showMessageErrorOpening(QString message)
@ -286,7 +286,7 @@ void Viewer::showGoToDialog()
}
void Viewer::goTo(unsigned int page)
{
direction = 1; //in "go to" direction is always fordward
direction = 1; // in "go to" direction is always fordward
render->goTo(page);
}
@ -330,7 +330,7 @@ void Viewer::updatePage()
void Viewer::updateContentSize()
{
//there is an image to resize
// there is an image to resize
if (currentPage != nullptr && !currentPage->isNull()) {
QSize pagefit = currentPage->size();
bool stretchImages = Configuration::getConfiguration().getEnlargeImages();
@ -350,7 +350,7 @@ void Viewer::updateContentSize()
}
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
break;
//if everything fails showing the full page is a good idea
// if everything fails showing the full page is a good idea
case YACReader::FitMode::FullPage:
default:
pagefit.scale(size(), Qt::KeepAspectRatio);
@ -360,11 +360,11 @@ void Viewer::updateContentSize()
if (zoom != 100) {
pagefit.scale(floor(pagefit.width() * zoom / 100.0f), 0, Qt::KeepAspectRatioByExpanding);
}
//apply scaling
// apply scaling
content->resize(pagefit);
//TODO: updtateContentSize should only scale the pixmap once
if (devicePixelRatio() > 1) //only in retina display
// TODO: updtateContentSize should only scale the pixmap once
if (devicePixelRatio() > 1) // only in retina display
{
QPixmap page = currentPage->scaled(content->width() * devicePixelRatio(), content->height() * devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
page.setDevicePixelRatio(devicePixelRatio());
@ -373,7 +373,7 @@ void Viewer::updateContentSize()
emit backgroundChanges();
}
content->update(); //TODO, it shouldn't be neccesary
content->update(); // TODO, it shouldn't be neccesary
}
void Viewer::increaseZoomFactor()
@ -399,13 +399,13 @@ void Viewer::decreaseZoomFactor()
int Viewer::getZoomFactor()
{
//this function is a placeholder for future refactoring work
// this function is a placeholder for future refactoring work
return zoom;
}
void Viewer::setZoomFactor(int z)
{
//this function is mostly used to reset the zoom after a fitmode switch
// this function is mostly used to reset the zoom after a fitmode switch
if (z > 500)
zoom = 500;
else if (z < 30)
@ -746,9 +746,9 @@ void Viewer::mouseMoveEvent(QMouseEvent *event)
if (Configuration::getConfiguration().getDisableShowOnMouseOver() == false) {
if (goToFlow->isVisible()) {
QPoint gtfPos = goToFlow->mapFrom(this, event->pos());
if (gtfPos.y() < 0 || gtfPos.x() < 0 || gtfPos.x() > goToFlow->width()) //TODO this extra check is for Mavericks (mouseMove over goToFlowGL seems to be broken)
if (gtfPos.y() < 0 || gtfPos.x() < 0 || gtfPos.x() > goToFlow->width()) // TODO this extra check is for Mavericks (mouseMove over goToFlowGL seems to be broken)
animateHideGoToFlow();
//goToFlow->hide();
// goToFlow->hide();
} else {
int umbral = (width() - goToFlow->width()) / 2;
if ((event->y() > height() - 15) && (event->x() > umbral) && (event->x() < width() - umbral)) {
@ -802,10 +802,10 @@ void Viewer::hideMagnifyingGlass()
void Viewer::informationSwitch()
{
information ? informationLabel->hide() : informationLabel->show();
//informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
// informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
information = !information;
Configuration::getConfiguration().setShowInformation(information);
//TODO it shouldn't be neccesary
// TODO it shouldn't be neccesary
informationLabel->adjustSize();
informationLabel->update();
}
@ -815,7 +815,7 @@ void Viewer::updateInformation()
if (render->hasLoadedComic()) {
informationLabel->setText(render->getCurrentPagesInformation() + " - " + QTime::currentTime().toString("HH:mm"));
informationLabel->adjustSize();
informationLabel->update(); //TODO it shouldn't be neccesary
informationLabel->update(); // TODO it shouldn't be neccesary
}
}
@ -871,7 +871,7 @@ void Viewer::moveCursoToGoToFlow()
return;
}
//Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
// Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
int y = goToFlow->pos().y();
int x1 = goToFlow->pos().x();
int x2 = x1 + goToFlow->width();
@ -899,14 +899,14 @@ void Viewer::rotateRight()
render->rotateRight();
}
//TODO
// TODO
void Viewer::setBookmark(bool set)
{
render->setBookmark();
if (set) //add bookmark
if (set) // add bookmark
{
render->setBookmark();
} else //remove bookmark
} else // remove bookmark
{
render->removeBookmark();
}
@ -979,7 +979,7 @@ void Viewer::configureContent(QString msg)
content->setFont(QFont("courier new", 12));
content->adjustSize();
setFocus(Qt::ShortcutFocusReason);
//emit showingText();
// emit showingText();
}
void Viewer::hideCursor()
@ -1083,7 +1083,7 @@ void Viewer::updateConfig(QSettings *settings)
setPalette(palette);
}
//deprecated
// deprecated
void Viewer::updateImageOptions()
{
render->reload();
@ -1110,7 +1110,7 @@ void Viewer::showIsCoverMessage()
emit(openPreviousComic());
}
shouldOpenNext = false; //single page comic
shouldOpenNext = false; // single page comic
}
void Viewer::showIsLastMessage()
@ -1124,7 +1124,7 @@ void Viewer::showIsLastMessage()
emit(openNextComic());
}
shouldOpenPrevious = false; //single page comic
shouldOpenPrevious = false; // single page comic
}
unsigned int Viewer::getIndex()
@ -1140,7 +1140,7 @@ int Viewer::getCurrentPageNumber()
void Viewer::updateComic(ComicDB &comic)
{
if (render->hasLoadedComic()) {
//set currentPage
// set currentPage
if (!doublePage || (doublePage && render->currentPageIsDoublePage() == false)) {
comic.info.currentPage = render->getIndex() + 1;
} else {
@ -1148,7 +1148,7 @@ void Viewer::updateComic(ComicDB &comic)
comic.info.currentPage = std::min(render->numPages(), render->getIndex() + 1);
}
}
//set bookmarks
// set bookmarks
Bookmarks *boomarks = render->getBookmarks();
QList<int> boomarksList = boomarks->getBookmarkPages();
int numBookmarks = boomarksList.size();
@ -1158,8 +1158,8 @@ void Viewer::updateComic(ComicDB &comic)
comic.info.bookmark2 = boomarksList[1];
if (numBookmarks > 2)
comic.info.bookmark3 = boomarksList[2];
//set filters
//TODO: avoid use settings for this...
// set filters
// TODO: avoid use settings for this...
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
int brightness = settings.value(BRIGHTNESS, 0).toInt();
int contrast = settings.value(CONTRAST, 100).toInt();

View File

@ -36,7 +36,7 @@ class Viewer : public QScrollArea, public ScrollManagement
{
Q_OBJECT
public:
bool fullscreen; //TODO, change by the right use of windowState();
bool fullscreen; // TODO, change by the right use of windowState();
public slots:
void increaseZoomFactor();
void decreaseZoomFactor();
@ -98,7 +98,7 @@ public slots:
void showMessageErrorOpening(QString);
void processCRCError(QString message);
void setBookmarks();
//deprecated
// deprecated
void updateImageOptions();
void updateFilters(int brightness, int contrast, int gamma);
void showIsCoverMessage();
@ -115,7 +115,7 @@ private:
int zoom;
PageLabelWidget *informationLabel;
//QTimer * scroller;
// QTimer * scroller;
QPropertyAnimation *verticalScroller;
QPropertyAnimation *horizontalScroller;
QParallelAnimationGroup *groupScroller;
@ -124,9 +124,9 @@ private:
GoToFlowWidget *goToFlow;
QPropertyAnimation *showGoToFlowAnimation;
GoToDialog *goToDialog;
//!Image properties
//! Image properties
//! Comic
//Comic * comic;
// Comic * comic;
int index;
QPixmap *currentPage;
BookmarksDialog *bd;
@ -137,7 +137,7 @@ private:
bool drag;
int numScrollSteps;
//!Widgets
//! Widgets
QLabel *content;
YACReaderTranslator *translator;
@ -153,7 +153,7 @@ private:
bool shouldOpenPrevious;
private:
//!Magnifying glass
//! Magnifying glass
MagnifyingGlass *mglass;
bool magnifyingGlassShowed;
bool restoreMagnifyingGlass;
@ -166,7 +166,7 @@ private:
void moveAction(const QKeySequence &key);
//!ZigzagScroll
//! ZigzagScroll
enum scrollDirection { UP,
DOWN,
LEFT,
@ -179,9 +179,9 @@ public:
Viewer(QWidget *parent = nullptr);
~Viewer();
const QPixmap *pixmap();
//Comic * getComic(){return comic;}
// Comic * getComic(){return comic;}
const BookmarksDialog *getBookmarksDialog() { return bd; }
//returns the current index starting in 1 [1,nPages]
// returns the current index starting in 1 [1,nPages]
unsigned int getIndex();
void updateComic(ComicDB &comic);
signals:

View File

@ -13,7 +13,7 @@ YACReaderLocalClient::YACReaderLocalClient(QObject *parent)
{
localSocket = new QLocalSocket(this);
//connect(localSocket, SIGNAL(readyRead()), this, SLOT(readMessage()));
// connect(localSocket, SIGNAL(readyRead()), this, SLOT(readMessage()));
/*connect(socket, SIGNAL(error(QLocalSocket::LocalSocketError)),
this, SLOT(displayError(QLocalSocket::LocalSocketError)));*/
@ -22,7 +22,7 @@ YACReaderLocalClient::~YACReaderLocalClient()
{
delete localSocket;
}
//información de comic recibida...
// información de comic recibida...
void YACReaderLocalClient::readMessage()
{
}
@ -49,7 +49,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
while (written != block.size() && tries < 200) {
written += localSocket->write(block);
localSocket->flush();
if (written == previousWritten) //no bytes were written
if (written == previousWritten) // no bytes were written
tries++;
previousWritten = written;
}
@ -61,7 +61,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
localSocket->waitForBytesWritten(2000);
//QByteArray data;
// QByteArray data;
tries = 0;
int dataAvailable = 0;
QByteArray packageSize;
@ -70,7 +70,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
packageSize.append(localSocket->read(sizeof(quint32) - packageSize.size()));
localSocket->waitForReadyRead(100);
if (dataAvailable == packageSize.size()) {
tries++; //TODO apply 'tries' fix
tries++; // TODO apply 'tries' fix
}
dataAvailable = packageSize.size();
}
@ -79,7 +79,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
QLOG_ERROR() << "Requesting Comic Info : unable to read package size";
return false;
}
QDataStream sizeStream(packageSize); //localSocket->read(sizeof(quint32)));
QDataStream sizeStream(packageSize); // localSocket->read(sizeof(quint32)));
sizeStream.setVersion(QDataStream::Qt_4_8);
quint32 totalSize = 0;
sizeStream >> totalSize;
@ -119,7 +119,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB &comic)
{
localSocket->connectToServer(YACREADERLIBRARY_GUID);
if (localSocket->isOpen()) {
//QLOG_INFO() << "Connection opened for sending ComicInfo";
// QLOG_INFO() << "Connection opened for sending ComicInfo";
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_8);
@ -141,7 +141,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB &comic)
}
localSocket->waitForBytesWritten(2000);
localSocket->close();
//QLOG_INFO() << QString("Sending Comic Info : writen data (%1,%2)").arg(written).arg(block.size());
// QLOG_INFO() << QString("Sending Comic Info : writen data (%1,%2)").arg(written).arg(block.size());
if (tries == 100 && written != block.size()) {
emit finished();
QLOG_ERROR() << QString("Sending Comic Info : unable to write data (%1,%2)").arg(written).arg(block.size());
@ -160,7 +160,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB &comic, qulo
{
localSocket->connectToServer(YACREADERLIBRARY_GUID);
if (localSocket->isOpen()) {
//QLOG_INFO() << "Connection opened for sending ComicInfo";
// QLOG_INFO() << "Connection opened for sending ComicInfo";
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_8);
@ -183,7 +183,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB &comic, qulo
}
localSocket->waitForBytesWritten(2000);
localSocket->close();
//QLOG_INFO() << QString("Sending Comic Info : writen data (%1,%2)").arg(written).arg(block.size());
// QLOG_INFO() << QString("Sending Comic Info : writen data (%1,%2)").arg(written).arg(block.size());
if (tries == 100 && written != block.size()) {
emit finished();
QLOG_ERROR() << QString("Sending Comic Info : unable to write data (%1,%2)").arg(written).arg(block.size());

View File

@ -32,7 +32,7 @@ AddLabelDialog::AddLabelDialog(QWidget *parent)
setMinimumHeight(340);
//buttons
// buttons
acceptButton = new QPushButton(tr("accept"), this);
cancelButton = new QPushButton(tr("cancel"), this);
@ -46,7 +46,7 @@ AddLabelDialog::AddLabelDialog(QWidget *parent)
setLayout(layout);
//connections
// connections
connect(edit, &QLineEdit::textChanged, this, &AddLabelDialog::validateName);
connect(cancelButton, &QAbstractButton::clicked, this, &QWidget::close);
connect(acceptButton, &QAbstractButton::clicked, this, &QDialog::accept);

View File

@ -68,7 +68,7 @@ void AddLibraryDialog::setupUI()
void AddLibraryDialog::add()
{
//accept->setEnabled(false);
// accept->setEnabled(false);
emit(addLibrary(QDir::cleanPath(path->text()), nameEdit->text()));
}

View File

@ -13,11 +13,11 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
{
auto layout = new QHBoxLayout;
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
settings->beginGroup("libraryConfig");
//FLOW-----------------------------------------------------------------------
// FLOW-----------------------------------------------------------------------
//---------------------------------------------------------------------------
//FORCE_ANGLE is not used here, because ComicFlowWidgetGL will use OpenGL ES in the future
// FORCE_ANGLE is not used here, because ComicFlowWidgetGL will use OpenGL ES in the future
#ifndef NO_OPENGL
if ((settings->value(USE_OPEN_GL).toBool() == true))
comicFlow = new ComicFlowWidgetGL(0);
@ -35,8 +35,8 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
comicFlow->setContextMenuPolicy(Qt::CustomContextMenu);
//layout-----------------------------------------------
sVertical = new QSplitter(Qt::Vertical); //spliter derecha
// layout-----------------------------------------------
sVertical = new QSplitter(Qt::Vertical); // spliter derecha
stack = new QStackedWidget;
stack->addWidget(comicFlow);
@ -48,7 +48,7 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
auto comicsLayout = new QVBoxLayout;
comicsLayout->setSpacing(0);
comicsLayout->setContentsMargins(0, 0, 0, 0);
//TODO ComicsView:(set toolbar) comicsLayout->addWidget(editInfoToolBar);
// TODO ComicsView:(set toolbar) comicsLayout->addWidget(editInfoToolBar);
tableView = new YACReaderTableView;
tableView->verticalHeader()->hide();
@ -59,11 +59,11 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
tableView->setContextMenuPolicy(Qt::CustomContextMenu);
//config--------------------------------------------------
// config--------------------------------------------------
if (settings->contains(COMICS_VIEW_HEADERS))
tableView->horizontalHeader()->restoreState(settings->value(COMICS_VIEW_HEADERS).toByteArray());
//connections---------------------------------------------
// connections---------------------------------------------
connect(tableView, &QAbstractItemView::clicked, this, &ClassicComicsView::centerComicFlow);
connect(tableView, &QAbstractItemView::doubleClicked, this, &ClassicComicsView::selectedComicForOpening);
connect(comicFlow, &ComicFlowWidget::centerIndexChanged, this, &ClassicComicsView::updateTableView);
@ -85,7 +85,7 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
if (settings->contains(COMICS_VIEW_FLOW_SPLITTER_STATUS))
sVertical->restoreState(settings->value(COMICS_VIEW_FLOW_SPLITTER_STATUS).toByteArray());
//hide flow widgets
// hide flow widgets
hideFlowViewAction = new QAction(this);
hideFlowViewAction->setText(tr("Hide comic flow"));
hideFlowViewAction->setData(HIDE_COMIC_VIEW_ACTION_YL);
@ -114,7 +114,7 @@ void ClassicComicsView::hideComicFlow(bool hide)
}
}
//the toolbar has to be populated
// the toolbar has to be populated
void ClassicComicsView::setToolBar(QToolBar *toolBar)
{
static_cast<QVBoxLayout *>(comics->layout())->insertWidget(0, toolBar);
@ -135,7 +135,7 @@ void ClassicComicsView::setModel(ComicModel *model)
} else {
connect(model, &QAbstractItemModel::dataChanged, this, &ClassicComicsView::applyModelChanges, Qt::UniqueConnection);
connect(model, &QAbstractItemModel::rowsRemoved, this, &ClassicComicsView::removeItemsFromFlow, Qt::UniqueConnection);
//TODO: Missing method resortCovers?
// TODO: Missing method resortCovers?
connect(model, &ComicModel::resortedIndexes, comicFlow, &ComicFlowWidget::resortCovers, Qt::UniqueConnection);
connect(model, &ComicModel::newSelectedIndex, this, &ClassicComicsView::setCurrentIndex, Qt::UniqueConnection);
@ -149,7 +149,7 @@ void ClassicComicsView::setModel(ComicModel *model)
#else
tableView->horizontalHeader()->setMovable(true);
#endif
//TODO parametrizar la configuración de las columnas
// TODO parametrizar la configuración de las columnas
/*if(!settings->contains(COMICS_VIEW_HEADERS))
{*/
for (int i = 0; i < tableView->horizontalHeader()->count(); i++)
@ -159,20 +159,20 @@ void ClassicComicsView::setModel(ComicModel *model)
tableView->horizontalHeader()->showSection(ComicModel::Title);
tableView->horizontalHeader()->showSection(ComicModel::FileName);
tableView->horizontalHeader()->showSection(ComicModel::NumPages);
tableView->horizontalHeader()->showSection(ComicModel::Hash); //Size is part of the Hash...TODO add Columns::Size to Columns
tableView->horizontalHeader()->showSection(ComicModel::Hash); // Size is part of the Hash...TODO add Columns::Size to Columns
tableView->horizontalHeader()->showSection(ComicModel::ReadColumn);
tableView->horizontalHeader()->showSection(ComicModel::CurrentPage);
tableView->horizontalHeader()->showSection(ComicModel::Rating);
//}
//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))
// 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))
QStringList paths = model->getPaths(model->getCurrentPath()); //TODO ComicsView: get currentpath from somewhere currentPath());
QStringList paths = model->getPaths(model->getCurrentPath()); // TODO ComicsView: get currentpath from somewhere currentPath());
comicFlow->setImagePaths(paths);
comicFlow->setMarks(model->getReadList());
//comicFlow->setFocus(Qt::OtherFocusReason);
// comicFlow->setFocus(Qt::OtherFocusReason);
if (settings->contains(COMICS_VIEW_HEADERS))
tableView->horizontalHeader()->restoreState(settings->value(COMICS_VIEW_HEADERS).toByteArray());
@ -212,7 +212,7 @@ void ClassicComicsView::toFullScreen()
comicFlow->setCenterIndex(comicFlow->centerIndex());
comics->hide();
//showFullScreen() //parent windows
// showFullScreen() //parent windows
comicFlow->show();
comicFlow->setFocus(Qt::OtherFocusReason);
@ -246,7 +246,7 @@ void ClassicComicsView::enableFilterMode(bool enabled)
previousSplitterStatus.clear();
}
//sVertical->setCollapsible(0,!enabled);
// sVertical->setCollapsible(0,!enabled);
searching = enabled;
}

View File

@ -42,7 +42,7 @@ public slots:
void saveSplitterStatus();
void applyModelChanges(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
void removeItemsFromFlow(const QModelIndex &parent, int from, int to);
//ComicsView
// ComicsView
void setShowMarks(bool show) override;
void selectAll() override;
void selectedComicForOpening(const QModelIndex &mi);

View File

@ -36,7 +36,7 @@ QList<QPair<QString, QString>> ComicFilesManager::getDroppedFiles(const QList<QU
foreach (QUrl url, urls) {
currentPath = url.toLocalFile();
if (currentPath.endsWith('/'))
currentPath = currentPath.remove(currentPath.length() - 1, 1); //QTBUG-35896 QUrl.toLocalFile inconsistency.
currentPath = currentPath.remove(currentPath.length() - 1, 1); // QTBUG-35896 QUrl.toLocalFile inconsistency.
if (Comic::fileIsComic(currentPath))
dropedFiles << QPair<QString, QString>(currentPath, "/");
else {
@ -71,7 +71,7 @@ void ComicFilesManager::process()
emit success(folderDestinationModelIndex);
emit finished();
return; //TODO rollback?
return; // TODO rollback?
}
QFileInfo info(source.first);
@ -81,7 +81,7 @@ void ComicFilesManager::process()
if (QFile::copy(source.first, QDir::cleanPath(destPath + '/' + info.fileName()))) {
successProcesingFiles = true;
if (move) {
QFile::remove(source.first); //TODO: remove the whole path....
QFile::remove(source.first); // TODO: remove the whole path....
}
}

View File

@ -6,7 +6,7 @@
#include <QPair>
#include <QModelIndex>
//this class is intended to work in background, just use moveToThread and process to start working
// this class is intended to work in background, just use moveToThread and process to start working
class ComicFilesManager : public QObject
{
Q_OBJECT
@ -19,7 +19,7 @@ signals:
void currentComic(QString);
void progress(int);
void finished();
void success(QModelIndex); //at least one comics has been copied or moved
void success(QModelIndex); // at least one comics has been copied or moved
public slots:
void process();
void cancel();

View File

@ -30,7 +30,7 @@ void ComicFlow::setImagePaths(const QStringList &paths)
imagesSetted.fill(false, imageFiles.size());
// populate with empty images
QImage img; //TODO remove
QImage img; // TODO remove
QString s;
for (int i = 0; i < (int)imageFiles.size(); i++) {
addSlide(img);
@ -49,7 +49,7 @@ void ComicFlow::setImagePaths(const QStringList &paths)
void ComicFlow::preload()
{
if (numImagesLoaded < imagesLoaded.size())
updateTimer.start(30); //TODO comprobar rendimiento, originalmente era 70
updateTimer.start(30); // TODO comprobar rendimiento, originalmente era 70
}
void ComicFlow::updateImageData()
@ -83,7 +83,7 @@ void ComicFlow::updateImageData()
for (int c = 0; c < 2 * COUNT + 1; c++) {
int i = indexes[c];
if ((i >= 0) && (i < slideCount()))
if (!imagesLoaded[i]) //slide(i).isNull())
if (!imagesLoaded[i]) // slide(i).isNull())
{
// schedule thumbnail generation
QString fname = imageFiles[i];

View File

@ -22,7 +22,7 @@ public:
~ComicFlow() override;
void setImagePaths(const QStringList &paths);
//bool eventFilter(QObject *target, QEvent *event);
// bool eventFilter(QObject *target, QEvent *event);
void keyPressEvent(QKeyEvent *event) override;
void removeSlide(int cover);
void resortCovers(QList<int> newOrder);

View File

@ -17,14 +17,14 @@ ComicFlowWidgetSW::ComicFlowWidgetSW(QWidget *parent)
l->addWidget(flow);
setLayout(l);
//TODO eleminar "padding"
// TODO eleminar "padding"
QPalette Pal(palette());
// set black background
Pal.setColor(QPalette::Background, Qt::black);
setAutoFillBackground(true);
setPalette(Pal);
//config
// config
QMatrix m;
m.rotate(-90);
m.scale(-1, 1);
@ -146,7 +146,7 @@ void ComicFlowWidgetSW::resortCovers(QList<int> newOrder)
#ifndef NO_OPENGL
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
///OpenGL ComicFlow
/// OpenGL ComicFlow
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@ -163,7 +163,7 @@ ComicFlowWidgetGL::ComicFlowWidgetGL(QWidget *parent)
l->setContentsMargins(0, 0, 0, 0);
setLayout(l);
//TODO eleminar "padding"
// TODO eleminar "padding"
QPalette Pal(palette());
// set black background
Pal.setColor(QPalette::Background, Qt::black);
@ -249,7 +249,7 @@ void ComicFlowWidgetGL::keyPressEvent(QKeyEvent *event)
}
void ComicFlowWidgetGL::paintEvent(QPaintEvent *event)
{
//flow->paintEvent(event);
// flow->paintEvent(event);
ComicFlowWidget::paintEvent(event);
}
void ComicFlowWidgetGL::mousePressEvent(QMouseEvent *event)
@ -308,7 +308,7 @@ void ComicFlowWidgetGL::updateConfig(QSettings *settings)
return;
}
//custom config
// custom config
flow->setCF_RX(settings->value(X_ROTATION).toInt());
flow->setCF_Y(settings->value(Y_POSITION).toInt());
@ -337,14 +337,14 @@ void ComicFlowWidgetGL::resortCovers(QList<int> newOrder)
flow->resortCovers(newOrder);
}
#endif
//void ComicFlowWidgetGL::setCF_RX(int value){ flow->setCF_RX(value);}
//void ComicFlowWidgetGL::setCF_RY(int value){ flow->setCF_RY(value);}
//void ComicFlowWidgetGL::setCF_RZ(int value){ flow->setCF_RZ(value);}
//void ComicFlowWidgetGL::setZoom(int zoom){ flow->setZoom(zoom);}
//void ComicFlowWidgetGL::setRotation(int angle){ flow->setRotation(angle);}
//void ComicFlowWidgetGL::setX_Distance(int distance){ flow->setX_Distance(distance);}
//void ComicFlowWidgetGL::setCenter_Distance(int distance){ flow->setCenter_Distance(distance);}
//void ComicFlowWidgetGL::setZ_Distance(int distance){ flow->setZ_Distance(distance);}
//void ComicFlowWidgetGL::setCF_Y(int value){ flow->setCF_Y(value);}
//void ComicFlowWidgetGL::setY_Distance(int value){ flow->setY_Distance(value);}
//void ComicFlowWidgetGL::setPreset(const Preset & p){ flow->setPreset(p);}
// void ComicFlowWidgetGL::setCF_RX(int value){ flow->setCF_RX(value);}
// void ComicFlowWidgetGL::setCF_RY(int value){ flow->setCF_RY(value);}
// void ComicFlowWidgetGL::setCF_RZ(int value){ flow->setCF_RZ(value);}
// void ComicFlowWidgetGL::setZoom(int zoom){ flow->setZoom(zoom);}
// void ComicFlowWidgetGL::setRotation(int angle){ flow->setRotation(angle);}
// void ComicFlowWidgetGL::setX_Distance(int distance){ flow->setX_Distance(distance);}
// void ComicFlowWidgetGL::setCenter_Distance(int distance){ flow->setCenter_Distance(distance);}
// void ComicFlowWidgetGL::setZ_Distance(int distance){ flow->setZ_Distance(distance);}
// void ComicFlowWidgetGL::setCF_Y(int value){ flow->setCF_Y(value);}
// void ComicFlowWidgetGL::setY_Distance(int value){ flow->setY_Distance(value);}
// void ComicFlowWidgetGL::setPreset(const Preset & p){ flow->setPreset(p);}

View File

@ -103,7 +103,7 @@ public:
void updateConfig(QSettings *settings) override;
void remove(int cover) override;
void resortCovers(QList<int> newOrder) override;
//public slots:
// public slots:
// void setCF_RX(int value);
// //the Y Rotation of the Coverflow
// void setCF_RY(int value);

View File

@ -15,7 +15,7 @@ ApiKeyDialog::ApiKeyDialog(QWidget *parent)
auto layout = new QVBoxLayout;
auto buttonsLayout = new QHBoxLayout;
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
settings->beginGroup("ComicVine");
QLabel *info = new QLabel(tr("Before you can connect to Comic Vine, you need your own API key. Please, get one free <a href=\"http://www.comicvine.com/api/\">here</a>"));
@ -57,7 +57,7 @@ ApiKeyDialog::~ApiKeyDialog()
void ApiKeyDialog::enableAccept(const QString &text)
{
//TODO key validation
// TODO key validation
acceptButton->setEnabled(!text.isEmpty());
}

View File

@ -3,54 +3,54 @@
#include "comic_vine_all_volume_comics_retriever.h"
//this is the API key used by YACReader to access Comic Vine
//please, do not use it in your own software, get one for free at Comic Vine
static const QString CV_API_KEY = "%CV_API_KEY%"; //get from settings
// this is the API key used by YACReader to access Comic Vine
// please, do not use it in your own software, get one for free at Comic Vine
static const QString CV_API_KEY = "%CV_API_KEY%"; // get from settings
static const QString CV_API_KEY_DEFAULT = "46680bebb358f1de690a5a365e15d325f9649f91";
static const QString CV_WEB_ADDRESS = "%CV_WEB_ADDRESS%"; //get from settings
static const QString CV_WEB_ADDRESS = "%CV_WEB_ADDRESS%"; // get from settings
//gets any volumen containing any comic matching 'query'
// gets any volumen containing any comic matching 'query'
static const QString CV_SEARCH = CV_WEB_ADDRESS + "/search/?api_key=" + CV_API_KEY +
"&format=json&limit=100&resources=volume"
"&field_list=name,start_year,publisher,id,image,count_of_issues,deck"
"&sort=name:asc"
"&query=%1&page=%2";
//http://www.comicvine.com/api/search/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json&limit=100&resources=volume&field_list=name,start_year,publisher,id,image,count_of_issues,deck&query=superman
// http://www.comicvine.com/api/search/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json&limit=100&resources=volume&field_list=name,start_year,publisher,id,image,count_of_issues,deck&query=superman
//gets the detail for a volume %1
// gets the detail for a volume %1
static const QString CV_SERIES_DETAIL = CV_WEB_ADDRESS + "/volume/4050-%1/?api_key=" + CV_API_KEY +
"&format=json&field_list=name,start_year,publisher,image,count_of_issues,id,description";
//gets info for comics in a volume id %1
// gets info for comics in a volume id %1
static const QString CV_COMICS_INFO = CV_WEB_ADDRESS + "/issues/?api_key=" + CV_API_KEY +
"&limit=1000&format=json&field_list=name,issue_number,id,image&filter=volume:%1"
"&sort=cover_date:asc" //sorting by cover_date, because comic vine doesn't use natural sorting (issue_number -> 1 10 11 ... 100 2 20 21....)
"&sort=cover_date:asc" // sorting by cover_date, because comic vine doesn't use natural sorting (issue_number -> 1 10 11 ... 100 2 20 21....)
"&offset=%2";
//"http://www.comicvine.com/api/issues/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json&field_list=name,issue_number,id,image&filter=volume:%1&page=%2
//gets id for comic number %2 in a volume id %1
// gets id for comic number %2 in a volume id %1
static const QString CV_COMIC_ID = CV_WEB_ADDRESS + "/issues/?api_key=" + CV_API_KEY +
"&format=json&field_list=name,issue_number,id,image"
"&filter=volume:%1,issue_number:%2";
//gets comic detail
// gets comic detail
static const QString CV_COMIC_DETAIL = CV_WEB_ADDRESS + "/issue/4000-%1/?api_key=" + CV_API_KEY + "&format=json";
//http://www.comicvine.com/api/issue/4000-%1/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json
// http://www.comicvine.com/api/issue/4000-%1/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&format=json
//gets comic cover URL
// gets comic cover URL
static const QString CV_COVER_URL = CV_WEB_ADDRESS + "/issue/4000-%1/?api_key=" + CV_API_KEY + "&format=json&field_list=image";
//gets comics matching name %1 and number %2
//http://comicvine.com/api/issues/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&limit=20&filter=name:super,issue_number:15
// gets comics matching name %1 and number %2
// http://comicvine.com/api/issues/?api_key=46680bebb358f1de690a5a365e15d325f9649f91&limit=20&filter=name:super,issue_number:15
//gets story arc detail
// gets story arc detail
static const QString CV_STORY_ARC_DETAIL = CV_WEB_ADDRESS + "/story_arc/4045-%1/?api_key=" + CV_API_KEY + "&format=json";
ComicVineClient::ComicVineClient(QObject *parent)
: QObject(parent)
{
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
settings->beginGroup("ComicVine");
baseURL = settings->value(COMIC_VINE_BASE_URL, "https://comicvine.gamespot.com/api").toString();
}
@ -60,7 +60,7 @@ ComicVineClient::~ComicVineClient()
delete settings;
}
//CV_SEARCH
// CV_SEARCH
void ComicVineClient::search(const QString &query, int page)
{
HttpWorker *search = new HttpWorker(QString(CV_SEARCH).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(query).arg(page));
@ -69,7 +69,7 @@ void ComicVineClient::search(const QString &query, int page)
connect(search, &QThread::finished, search, &QObject::deleteLater);
search->get();
}
//CV_SEARCH result
// CV_SEARCH result
void ComicVineClient::proccessVolumesSearchData(const QByteArray &data)
{
QString json(data);
@ -98,7 +98,7 @@ void ComicVineClient::proccessComicDetailData(const QByteArray &data)
emit finished();
}
//CV_SERIES_DETAIL
// CV_SERIES_DETAIL
void ComicVineClient::getSeriesDetail(const QString &id)
{
HttpWorker *search = new HttpWorker(QString(CV_SERIES_DETAIL).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(id));
@ -112,17 +112,17 @@ void ComicVineClient::getSeriesCover(const QString &url)
{
auto search = new HttpWorker(url);
connect(search, &HttpWorker::dataReady, this, &ComicVineClient::seriesCover);
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); //TODO
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); // TODO
connect(search, &QThread::finished, search, &QObject::deleteLater);
search->get();
}
//CV_COMIC_IDS
// CV_COMIC_IDS
void ComicVineClient::getVolumeComicsInfo(const QString &idVolume, int page)
{
HttpWorker *search = new HttpWorker(QString(CV_COMICS_INFO).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(idVolume).arg((page - 1) * 100)); //page doesn't work for search, using offset instead
HttpWorker *search = new HttpWorker(QString(CV_COMICS_INFO).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(idVolume).arg((page - 1) * 100)); // page doesn't work for search, using offset instead
connect(search, &HttpWorker::dataReady, this, &ComicVineClient::processVolumeComicsInfo);
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); //TODO
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); // TODO
connect(search, &QThread::finished, search, &QObject::deleteLater);
search->get();
}
@ -140,21 +140,21 @@ void ComicVineClient::getAllVolumeComicsInfo(const QString &idVolume)
comicsRetriever->getAllVolumeComics();
}
//CV_COMIC_ID
// CV_COMIC_ID
void ComicVineClient::getComicId(const QString &id, int comicNumber)
{
Q_UNUSED(id);
Q_UNUSED(comicNumber);
}
//CV_COMIC_DETAIL
// CV_COMIC_DETAIL
QByteArray ComicVineClient::getComicDetail(const QString &id, bool &outError, bool &outTimeout)
{
HttpWorker *search = new HttpWorker(QString(CV_COMIC_DETAIL).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(id));
//connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(proccessComicDetailData(const QByteArray &)));
//connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
//connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
// connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(proccessComicDetailData(const QByteArray &)));
// connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
// connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
search->get();
search->wait();
outError = !(search->wasValid());
@ -165,7 +165,7 @@ QByteArray ComicVineClient::getComicDetail(const QString &id, bool &outError, bo
return result;
}
//CV_COMIC_DETAIL
// CV_COMIC_DETAIL
void ComicVineClient::getComicDetailAsync(const QString &id)
{
HttpWorker *search = new HttpWorker(QString(CV_COMIC_DETAIL).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(id));
@ -176,14 +176,14 @@ void ComicVineClient::getComicDetailAsync(const QString &id)
search->get();
}
//CV_STORY_ARC_DETAIL
// CV_STORY_ARC_DETAIL
QByteArray ComicVineClient::getStoryArcDetail(const QString &id, bool &outError, bool &outTimeout)
{
HttpWorker *search = new HttpWorker(QString(CV_STORY_ARC_DETAIL).replace(CV_WEB_ADDRESS, baseURL).replace(CV_API_KEY, settings->value(COMIC_VINE_API_KEY, CV_API_KEY_DEFAULT).toString()).arg(id));
//connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(proccessComicDetailData(const QByteArray &)));
//connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
//connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
// connect(search,SIGNAL(dataReady(const QByteArray &)),this,SLOT(proccessComicDetailData(const QByteArray &)));
// connect(search,SIGNAL(timeout()),this,SIGNAL(timeOut()));
// connect(search,SIGNAL(finished()),search,SLOT(deleteLater()));
search->get();
search->wait();
outError = !(search->wasValid());
@ -198,12 +198,12 @@ void ComicVineClient::getComicCover(const QString &url)
{
auto search = new HttpWorker(url);
connect(search, &HttpWorker::dataReady, this, &ComicVineClient::comicCover);
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); //TODO
connect(search, &HttpWorker::timeout, this, &ComicVineClient::timeOut); // TODO
connect(search, &QThread::finished, search, &QObject::deleteLater);
search->get();
}
//CV_COVER_DETAIL
// CV_COVER_DETAIL
void ComicVineClient::getCoverURL(const QString &id)
{
Q_UNUSED(id);

View File

@ -15,8 +15,8 @@ public:
signals:
void searchResult(QString);
void seriesDetail(QString); //JSON
void comicDetail(QString); //JSON
void seriesDetail(QString); // JSON
void comicDetail(QString); // JSON
void seriesCover(const QByteArray &);
void comicCover(const QByteArray &);
void volumeComicsInfo(QString);

View File

@ -151,7 +151,7 @@ void ComicVineDialog::goNext()
} else if (content->currentWidget() == sortVolumeComicsWidget) {
showLoading();
//ComicDB-ComicVineID
// ComicDB-ComicVineID
QList<QPair<ComicDB, QString>> matchingInfo = sortVolumeComicsWidget->getMatchingInfo();
int count = selectVolumeWidget->getSelectedVolumeNumIssues();
QString publisher = selectVolumeWidget->getSelectedVolumePublisher();
@ -273,7 +273,7 @@ void ComicVineDialog::debugClientResults(const QString &string)
{
ResponseParser p;
p.loadJSONResponse(string);
//QMessageBox::information(0,"Result", QString("Number of results : %1").arg(p.getNumResults()));
// QMessageBox::information(0,"Result", QString("Number of results : %1").arg(p.getNumResults()));
if (p.responseError()) {
QMessageBox::critical(0, tr("Error connecting to ComicVine"), p.errorDescription());
goBack();
@ -433,15 +433,15 @@ void ComicVineDialog::getComicsInfo(QList<QPair<ComicDB, QString>> &matchingInfo
QList<ComicDB> comics;
foreach (p, matchingInfo) {
auto comicVineClient = new ComicVineClient;
//connect(comicVineClient,SIGNAL(searchResult(QString)),this,SLOT(debugClientResults(QString)));
//connect(comicVineClient,SIGNAL(timeOut()),this,SLOT(queryTimeOut()));
//connect(comicVineClient,SIGNAL(finished()),comicVineClient,SLOT(deleteLater()));
// connect(comicVineClient,SIGNAL(searchResult(QString)),this,SLOT(debugClientResults(QString)));
// connect(comicVineClient,SIGNAL(timeOut()),this,SLOT(queryTimeOut()));
// connect(comicVineClient,SIGNAL(finished()),comicVineClient,SLOT(deleteLater()));
bool error;
bool timeout;
QByteArray result = comicVineClient->getComicDetail(p.second, error, timeout); //TODO check timeOut or Connection error
QByteArray result = comicVineClient->getComicDetail(p.second, error, timeout); // TODO check timeOut or Connection error
if (error || timeout)
continue; //TODO
ComicDB comic = parseComicInfo(p.first, result, count, publisher); //TODO check result error
continue; // TODO
ComicDB comic = parseComicInfo(p.first, result, count, publisher); // TODO check result error
comic.info.comicVineID = p.second;
comics.push_back(comic);
@ -469,9 +469,9 @@ void ComicVineDialog::getComicInfo(const QString &comicId, int count, const QStr
auto comicVineClient = new ComicVineClient;
bool error;
bool timeout;
QByteArray result = comicVineClient->getComicDetail(comicId, error, timeout); //TODO check timeOut or Connection error
QByteArray result = comicVineClient->getComicDetail(comicId, error, timeout); // TODO check timeOut or Connection error
if (error || timeout) {
//TODO
// TODO
if (mode == SingleComic || currentIndex == (comics.count() - 1)) {
emit accepted();
} else {
@ -479,7 +479,7 @@ void ComicVineDialog::getComicInfo(const QString &comicId, int count, const QStr
}
}
ComicDB comic = parseComicInfo(comics[currentIndex], result, count, publisher); //TODO check result error
ComicDB comic = parseComicInfo(comics[currentIndex], result, count, publisher); // TODO check result error
comic.info.comicVineID = comicId;
setLoadingMessage(tr("Retrieving tags for : %1").arg(comics[currentIndex].getFileName()));
QString connectionName = "";
@ -512,7 +512,7 @@ ComicDB ComicVineDialog::parseComicInfo(ComicDB &comic, const QString &json, int
return comic;
}
int numResults = sc.value("number_of_total_results").toInt(); //fix to weird behaviour using hasNext
int numResults = sc.value("number_of_total_results").toInt(); // fix to weird behaviour using hasNext
if (numResults > 0) {
QVariantMap result = sc.value("results").toMap();
@ -665,7 +665,7 @@ QPair<QString, QString> ComicVineDialog::getArcNumberAndArcCount(const QString &
return qMakePair(QString(), QString());
}
int numResults = sc.value("number_of_total_results").toInt(); //fix to weird behaviour using hasNext
int numResults = sc.value("number_of_total_results").toInt(); // fix to weird behaviour using hasNext
if (numResults > 0) {
QVariantMap result = sc.value("results").toMap();
@ -779,7 +779,7 @@ void ComicVineDialog::getVolumeComicsInfo(const QString &vID, int /* page */)
void ComicVineDialog::launchSearchVolume()
{
showLoading(tr("Looking for volume..."));
//TODO: check if volume info is empty.
// TODO: check if volume info is empty.
searchVolume(searchVolumeWidget->getVolumeInfo());
}
@ -788,9 +788,9 @@ void ComicVineDialog::launchSearchComic()
showLoading(tr("Looking for comic..."));
QString volumeInfo = searchSingleComicWidget->getVolumeInfo();
//QString comicInfo = searchSingleComicWidget->getComicInfo();
//int comicNumber = searchSingleComicWidget->getComicNumber();
// QString comicInfo = searchSingleComicWidget->getComicInfo();
// int comicNumber = searchSingleComicWidget->getComicNumber();
//if(comicInfo.isEmpty() && comicNumber == -1)
// if(comicInfo.isEmpty() && comicNumber == -1)
searchVolume(volumeInfo);
}

View File

@ -19,7 +19,7 @@ class SelectComic;
class SelectVolume;
class SortVolumeComics;
//TODO this should use a QStateMachine
// TODO this should use a QStateMachine
//----------------------------------------
class ComicVineDialog : public QDialog
{
@ -41,7 +41,7 @@ protected slots:
void goNext();
void goBack();
void debugClientResults(const QString &string);
//show widget methods
// show widget methods
void showSeriesQuestion();
void showSearchSingleComic();
void showSearchVolume();
@ -71,9 +71,9 @@ private:
void toggleSkipButton();
enum ScraperMode {
SingleComic, //the scraper has been opened for a single comic
Volume, //the scraper is trying to get comics info for a whole volume
SingleComicInList //the scraper has been opened for a list of unrelated comics
SingleComic, // the scraper has been opened for a single comic
Volume, // the scraper is trying to get comics info for a whole volume
SingleComicInList // the scraper has been opened for a list of unrelated comics
};
enum ScraperStatus {
@ -100,7 +100,7 @@ private:
QPushButton *searchButton;
QPushButton *closeButton;
//stacked widgets
// stacked widgets
QStackedWidget *content;
QWidget *infoNotFound;

View File

@ -13,7 +13,7 @@ void LocalComicListModel::load(QList<ComicDB> &comics)
QModelIndex LocalComicListModel::parent(const QModelIndex &index) const
{
Q_UNUSED(index)
return QModelIndex(); //no parent
return QModelIndex(); // no parent
}
int LocalComicListModel::rowCount(const QModelIndex &parent) const
@ -40,7 +40,7 @@ QVariant LocalComicListModel::data(const QModelIndex &index, int role) const
return QVariant();
}
if (role == Qt::TextAlignmentRole) {
//TODO
// TODO
}
if (role != Qt::DisplayRole)
@ -48,10 +48,10 @@ QVariant LocalComicListModel::data(const QModelIndex &index, int role) const
int row = index.row();
//if(row < _data.count())
// if(row < _data.count())
return _data[row].getFileName();
//else
//return QVariant();
// else
// return QVariant();
}
Qt::ItemFlags LocalComicListModel::flags(const QModelIndex &index) const

View File

@ -13,7 +13,7 @@ public:
void load(QList<ComicDB> &comics);
//QAbstractItemModel methods
// QAbstractItemModel methods
QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent) const override;

View File

@ -54,7 +54,7 @@ void VolumeComicsModel::load(const QString &json)
QModelIndex VolumeComicsModel::parent(const QModelIndex &index) const
{
Q_UNUSED(index)
return QModelIndex(); //no parent
return QModelIndex(); // no parent
}
int VolumeComicsModel::rowCount(const QModelIndex &parent) const
@ -84,7 +84,7 @@ QVariant VolumeComicsModel::data(const QModelIndex &index, int role) const
return QVariant();
}
if (role == Qt::TextAlignmentRole) {
switch (column) //TODO obtener esto de la query
switch (column) // TODO obtener esto de la query
{
case ISSUE:
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
@ -112,7 +112,7 @@ Qt::ItemFlags VolumeComicsModel::flags(const QModelIndex &index) const
QVariant VolumeComicsModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) //TODO obtener esto de la query
switch (section) // TODO obtener esto de la query
{
case ISSUE:
return QVariant(QString("issue"));
@ -122,7 +122,7 @@ QVariant VolumeComicsModel::headerData(int section, Qt::Orientation orientation,
}
if (orientation == Qt::Horizontal && role == Qt::TextAlignmentRole) {
switch (section) //TODO obtener esto de la query
switch (section) // TODO obtener esto de la query
{
case ISSUE:
return QVariant(Qt::AlignRight | Qt::AlignVCenter);

View File

@ -9,7 +9,7 @@ class VolumeComicsModel : public JSONModel
public:
explicit VolumeComicsModel(QObject *parent = nullptr);
void load(const QString &json) override;
//void load(const QStringList & jsonList);
// void load(const QStringList & jsonList);
QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;

View File

@ -10,7 +10,7 @@ VolumesModel::VolumesModel(QObject *parent)
VolumesModel::~VolumesModel()
{
//std::for_each(_data.begin(), _data.end(), [](QList<QString> * ptr) { delete ptr; });
// std::for_each(_data.begin(), _data.end(), [](QList<QString> * ptr) { delete ptr; });
}
void VolumesModel::load(const QString &json)
@ -23,7 +23,7 @@ void VolumesModel::load(const QString &json)
return;
}
int numResults = sc.value("number_of_total_results").toInt(); //fix to weird behaviour using hasNext
int numResults = sc.value("number_of_total_results").toInt(); // fix to weird behaviour using hasNext
QListIterator<QVariant> it(sc.value("results").toList());
bool test;
QVariantMap resultsValue;
@ -48,7 +48,7 @@ void VolumesModel::load(const QString &json)
QModelIndex VolumesModel::parent(const QModelIndex &index) const
{
Q_UNUSED(index)
return QModelIndex(); //no parent
return QModelIndex(); // no parent
}
int VolumesModel::rowCount(const QModelIndex &parent) const
@ -110,7 +110,7 @@ QVariant VolumesModel::headerData(int section, Qt::Orientation orientation, int
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) //TODO obtener esto de la query
switch (section) // TODO obtener esto de la query
{
case SERIES:
return QVariant(QString("series"));
@ -124,7 +124,7 @@ QVariant VolumesModel::headerData(int section, Qt::Orientation orientation, int
}
if (orientation == Qt::Horizontal && role == Qt::TextAlignmentRole) {
switch (section) //TODO obtener esto de la query
switch (section) // TODO obtener esto de la query
{
case YEAR:
return QVariant(Qt::AlignRight | Qt::AlignVCenter);

View File

@ -9,10 +9,10 @@ class VolumesModel : public JSONModel
public:
explicit VolumesModel(QObject *parent = nullptr);
virtual ~VolumesModel();
//receive a valid json with a list of volumes
// receive a valid json with a list of volumes
void load(const QString &json) override;
//QAbstractItemModel methods
// QAbstractItemModel methods
QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent) const override;

View File

@ -39,12 +39,12 @@ ScraperTableView::ScraperTableView(QWidget *parent)
#else
horizontalHeader()->setClickable(false);
#endif
//comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
// comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
verticalHeader()->setDefaultSectionSize(24);
#if QT_VERSION >= 0x050000
verticalHeader()->setSectionsClickable(false); //TODO comportamiento anómalo
verticalHeader()->setSectionsClickable(false); // TODO comportamiento anómalo
#else
verticalHeader()->setClickable(false); //TODO comportamiento anómalo
verticalHeader()->setClickable(false); // TODO comportamiento anómalo
#endif
setCornerButtonEnabled(false);

View File

@ -10,24 +10,24 @@ SearchSingleComic::SearchSingleComic(QWidget *parent)
: QWidget(parent)
{
//QLabel * label = new QLabel(tr("Please provide some additional information. At least one field is needed."));
// QLabel * label = new QLabel(tr("Please provide some additional information. At least one field is needed."));
QLabel *label = new QLabel(tr("Please provide some additional information."));
label->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
//titleEdit = new ScraperLineEdit(tr("Title:"));
//numberEdit = new ScraperLineEdit(tr("Number:"));
// titleEdit = new ScraperLineEdit(tr("Title:"));
// numberEdit = new ScraperLineEdit(tr("Number:"));
volumeEdit = new ScraperLineEdit(tr("Series:"));
//numberEdit->setMaximumWidth(126);
// numberEdit->setMaximumWidth(126);
auto l = new QVBoxLayout;
//QHBoxLayout * hl = new QHBoxLayout;
//hl->addWidget(titleEdit);
//hl->addWidget(numberEdit);
// QHBoxLayout * hl = new QHBoxLayout;
// hl->addWidget(titleEdit);
// hl->addWidget(numberEdit);
l->addSpacing(35);
l->addWidget(label);
//l->addLayout(hl);
// l->addLayout(hl);
l->addWidget(volumeEdit);
l->addStretch();
@ -43,16 +43,16 @@ QString SearchSingleComic::getVolumeInfo()
QString SearchSingleComic::getComicInfo()
{
//return titleEdit->text();
// return titleEdit->text();
return "";
}
int SearchSingleComic::getComicNumber()
{
//QString numberText = numberEdit->text();
//if(numberText.isEmpty())
// QString numberText = numberEdit->text();
// if(numberText.isEmpty())
// return -1;
//return numberText.toInt();
// return numberText.toInt();
return 0;
}

View File

@ -23,7 +23,7 @@ SelectComic::SelectComic(QWidget *parent)
auto left = new QVBoxLayout;
auto content = new QGridLayout;
//widgets
// widgets
cover = new QLabel();
cover->setScaledContents(true);
cover->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
@ -32,7 +32,7 @@ SelectComic::SelectComic(QWidget *parent)
detailLabel = new ScraperScrollLabel(this);
tableComics = new ScraperTableView(this);
//connections
// connections
connect(tableComics, &QAbstractItemView::clicked, this, &SelectComic::loadComicInfo);
paginator->setCustomLabel(tr("comics"));

View File

@ -37,7 +37,7 @@ SelectVolume::SelectVolume(QWidget *parent)
auto left = new QVBoxLayout;
auto content = new QGridLayout;
//widgets
// widgets
cover = new QLabel();
cover->setScaledContents(true);
cover->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
@ -52,11 +52,11 @@ SelectVolume::SelectVolume(QWidget *parent)
#else
tableVolumes->horizontalHeader()->setClickable(true);
#endif
//tableVolumes->horizontalHeader()->setSortIndicatorShown(false);
// tableVolumes->horizontalHeader()->setSortIndicatorShown(false);
connect(tableVolumes->horizontalHeader(), &QHeaderView::sectionClicked,
[=](int index) { tableVolumes->horizontalHeader()->sortIndicatorSection() == index ? tableVolumes->sortByColumn(index, tableVolumes->horizontalHeader()->sortIndicatorOrder() == Qt::AscendingOrder ? Qt::DescendingOrder : Qt::AscendingOrder)
: tableVolumes->sortByColumn(index, Qt::AscendingOrder); });
//connections
// connections
connect(tableVolumes, &QAbstractItemView::clicked, this, &SelectVolume::loadVolumeInfo);
paginator->setCustomLabel(tr("volumes"));
@ -89,7 +89,7 @@ void SelectVolume::load(const QString &json, const QString &searchString)
{
auto tempM = new VolumesModel();
tempM->load(json);
//tableVolumes->setModel(tempM);
// tableVolumes->setModel(tempM);
proxyModel->setSourceModel(tempM);
tableVolumes->setModel(proxyModel);

View File

@ -27,15 +27,15 @@ SortVolumeComics::SortVolumeComics(QWidget *parent)
moveDownButtonCL = new ScrapperToolButton(ScrapperToolButton::RIGHT);
moveDownButtonCL->setIcon(QIcon(":/images/comic_vine/rowDown.png"));
moveDownButtonCL->setAutoRepeat(true);
//moveUpButtonIL = new ScrapperToolButton(ScrapperToolButton::LEFT);
//moveUpButtonIL->setIcon(QIcon(":/images/comic_vine/rowUp.png"));
//moveDownButtonIL = new ScrapperToolButton(ScrapperToolButton::RIGHT);
//moveDownButtonIL->setIcon(QIcon(":/images/comic_vine/rowDown.png"));
// moveUpButtonIL = new ScrapperToolButton(ScrapperToolButton::LEFT);
// moveUpButtonIL->setIcon(QIcon(":/images/comic_vine/rowUp.png"));
// moveDownButtonIL = new ScrapperToolButton(ScrapperToolButton::RIGHT);
// moveDownButtonIL->setIcon(QIcon(":/images/comic_vine/rowDown.png"));
connect(moveUpButtonCL, &QAbstractButton::clicked, this, &SortVolumeComics::moveUpCL);
connect(moveDownButtonCL, &QAbstractButton::clicked, this, &SortVolumeComics::moveDownCL);
//connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveUpIL()));
//connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveDownIL()));
// connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveUpIL()));
// connect(moveUpButtonIL,SIGNAL(clicked()),this,SLOT(moveDownIL()));
auto l = new QVBoxLayout;
auto content = new QGridLayout;
@ -47,13 +47,13 @@ SortVolumeComics::SortVolumeComics(QWidget *parent)
tableFiles->setSelectionBehavior(QAbstractItemView::SelectRows);
tableFiles->setSelectionMode(QAbstractItemView::ContiguousSelection);
//content->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop);
// content->addWidget(tableVolumes,0,Qt::AlignRight|Qt::AlignTop);
connect(tableVolumeComics->verticalScrollBar(), &QAbstractSlider::valueChanged, this, &SortVolumeComics::synchronizeScroll);
connect(tableFiles->verticalScrollBar(), &QAbstractSlider::valueChanged, this, &SortVolumeComics::synchronizeScroll);
//connect(tableVolumeComics, SIGNAL(pressed(QModelIndex)), tableFiles, SLOT(setCurrentIndex(QModelIndex)));
//connect(tableFiles, SIGNAL(pressed(QModelIndex)), tableVolumeComics, SLOT(setCurrentIndex(QModelIndex)));
// connect(tableVolumeComics, SIGNAL(pressed(QModelIndex)), tableFiles, SLOT(setCurrentIndex(QModelIndex)));
// connect(tableFiles, SIGNAL(pressed(QModelIndex)), tableVolumeComics, SLOT(setCurrentIndex(QModelIndex)));
paginator->setCustomLabel(tr("issues"));
paginator->setMinimumWidth(422);
@ -83,24 +83,24 @@ SortVolumeComics::SortVolumeComics(QWidget *parent)
setLayout(l);
setContentsMargins(0, 0, 0, 0);
//rows actions
// rows actions
QAction *removeItemFromList = new QAction(tr("remove selected comics"), this);
QAction *restoreAllItems = new QAction(tr("restore all removed comics"), this);
//QAction * restoreItems = new QAction(tr("restore removed comics"),this);
// QAction * restoreItems = new QAction(tr("restore removed comics"),this);
tableFiles->setContextMenuPolicy(Qt::ActionsContextMenu);
tableFiles->addAction(removeItemFromList);
tableFiles->addAction(restoreAllItems);
//tableFiles->addAction(restoreItems);
// tableFiles->addAction(restoreItems);
connect(removeItemFromList, &QAction::triggered, this, &SortVolumeComics::removeSelectedComics);
connect(restoreAllItems, &QAction::triggered, this, &SortVolumeComics::restoreAllComics);
//connect(restoreItems,SIGNAL(triggered()),this,SLOT(showRemovedComicsSelector()));
// connect(restoreItems,SIGNAL(triggered()),this,SLOT(showRemovedComicsSelector()));
}
void SortVolumeComics::setData(QList<ComicDB> &comics, const QString &json, const QString &vID)
{
//set up models
// set up models
localComicsModel = new LocalComicListModel;
localComicsModel->load(comics);
@ -127,7 +127,7 @@ void SortVolumeComics::synchronizeScroll(int pos)
{
void *senderObject = sender();
if (senderObject == 0) //invalid call
if (senderObject == 0) // invalid call
return;
QScrollBar *tableVolumeComicsScrollBar = tableVolumeComics->verticalScrollBar();
@ -203,7 +203,7 @@ QList<QPair<ComicDB, QString>> SortVolumeComics::getMatchingInfo()
QString id;
foreach (ComicDB c, comicList) {
id = volumeComicsModel->getComicId(index);
if (!c.getFileName().isEmpty() && !id.isEmpty()) //there is a valid comic, and valid comic ID
if (!c.getFileName().isEmpty() && !id.isEmpty()) // there is a valid comic, and valid comic ID
{
l.push_back(QPair<ComicDB, QString>(c, id));
}

View File

@ -50,7 +50,7 @@ void FoldersRemover::process()
QModelIndex mi = i.previous();
currentFolderPath = i2.previous();
QDir d(currentFolderPath);
if (d.removeRecursively() || !d.exists()) //the folder is in the DB but no in the drive...
if (d.removeRecursively() || !d.exists()) // the folder is in the DB but no in the drive...
emit remove(mi);
else
emit removeError();

View File

@ -48,7 +48,7 @@ void ComicsView::dragEnterEvent(QDragEnterEvent *event)
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)
// 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();

View File

@ -41,18 +41,18 @@ signals:
void openComic(const ComicDB &comic, const ComicModel::Mode mode);
void comicRated(int, QModelIndex);
//Context menus
// Context menus
void customContextMenuViewRequested(QPoint);
void customContextMenuItemRequested(QPoint);
//Drops
// Drops
void copyComicsToCurrentFolder(QList<QPair<QString, QString>>);
void moveComicsToCurrentFolder(QList<QPair<QString, QString>>);
protected:
ComicModel *model;
//Drop to import
// Drop to import
void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override;

View File

@ -37,22 +37,22 @@ void CreateLibraryDialog::setupUI()
auto content = new QGridLayout;
//QHBoxLayout *nameLayout = new QHBoxLayout;
// QHBoxLayout *nameLayout = new QHBoxLayout;
content->addWidget(nameLabel, 0, 0);
content->addWidget(nameEdit, 0, 1);
//QHBoxLayout *libraryLayout = new QHBoxLayout;
// QHBoxLayout *libraryLayout = new QHBoxLayout;
content->addWidget(textLabel, 1, 0);
content->addWidget(path, 1, 1);
content->addWidget(find, 1, 2);
content->setColumnMinimumWidth(2, 0); //TODO
content->setColumnMinimumWidth(2, 0); // TODO
auto bottomLayout = new QHBoxLayout;
bottomLayout->addWidget(message = new QLabel(tr("Create a library could take several minutes. You can stop the process and update the library later for completing the task.")));
message->setWordWrap(true);
//message->hide();
// message->hide();
bottomLayout->addStretch();
bottomLayout->addWidget(accept);
bottomLayout->addWidget(cancel);

View File

@ -15,8 +15,8 @@ public:
QVariant data(int column) const;
void setData(int column, const QVariant &value);
int row() const;
//unsigned long long int id; //TODO sustituir por una clase adecuada
//Comic comic;
// unsigned long long int id; //TODO sustituir por una clase adecuada
// Comic comic;
private:
QList<QVariant> itemData;
};

View File

@ -12,7 +12,7 @@
#include "query_parser.h"
#include "reading_list_model.h"
//ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read
// ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read
#include "QsLog.h"
ComicModel::ComicModel(QObject *parent)
@ -51,7 +51,7 @@ bool ComicModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, i
return data->formats().contains(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat);
}
//TODO: optimize this method (seriously)
// TODO: optimize this method (seriously)
bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
@ -78,7 +78,7 @@ bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int
std::sort(currentIndexes.begin(), currentIndexes.end());
QList<ComicItem *> resortedData;
if (currentIndexes.contains(row)) //no resorting
if (currentIndexes.contains(row)) // no resorting
return false;
ComicItem *destinationItem;
@ -147,7 +147,7 @@ bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int
}
}
//TODO fix selection
// TODO fix selection
QList<qulonglong> allComicIds;
foreach (ComicItem *item, _data) {
allComicIds << item->data(Id).toULongLong();
@ -172,7 +172,7 @@ bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int
}
QSqlDatabase::removeDatabase(connectionName);
//endMoveRows();
// endMoveRows();
emit resortedIndexes(newSorting);
int destSelectedIndex = row < 0 ? _data.length() : row;
@ -192,8 +192,8 @@ bool ComicModel::canBeResorted()
QMimeData *ComicModel::mimeData(const QModelIndexList &indexes) const
{
//custom model data
//application/yacreader-comics-ids + list of ids in a QByteArray
// custom model data
// application/yacreader-comics-ids + list of ids in a QByteArray
QList<qulonglong> ids;
foreach (QModelIndex index, indexes) {
QLOG_DEBUG() << "dragging : " << index.data(IdRole).toULongLong();
@ -202,7 +202,7 @@ QMimeData *ComicModel::mimeData(const QModelIndexList &indexes) const
QByteArray data;
QDataStream out(&data, QIODevice::WriteOnly);
out << ids; //serialize the list of identifiers
out << ids; // serialize the list of identifiers
auto mimeData = new QMimeData();
mimeData->setData(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat, data);
@ -256,7 +256,7 @@ QVariant ComicModel::data(const QModelIndex &index, int role) const
}
if (role == Qt::TextAlignmentRole) {
switch (index.column()) //TODO obtener esto de la query
switch (index.column()) // TODO obtener esto de la query
{
case ComicModel::Number:
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
@ -271,8 +271,8 @@ QVariant ComicModel::data(const QModelIndex &index, int role) const
}
}
//TODO check here if any view is asking for TableModel::Roles
//these roles will be used from QML/GridView
// TODO check here if any view is asking for TableModel::Roles
// these roles will be used from QML/GridView
auto item = static_cast<ComicItem *>(index.internalPointer());
@ -326,7 +326,7 @@ QVariant ComicModel::headerData(int section, Qt::Orientation orientation,
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) //TODO obtener esto de la query
switch (section) // TODO obtener esto de la query
{
case ComicModel::Number:
return QVariant(QString("#"));
@ -348,7 +348,7 @@ QVariant ComicModel::headerData(int section, Qt::Orientation orientation,
}
if (orientation == Qt::Horizontal && role == Qt::TextAlignmentRole) {
switch (section) //TODO obtener esto de la query
switch (section) // TODO obtener esto de la query
{
case ComicModel::Number:
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
@ -514,7 +514,7 @@ void ComicModel::setupReadingListModelData(unsigned long long parentReadingList,
while (subfolders.next())
ids << subfolders.record().value(0).toULongLong();
enableResorting = ids.length() == 1; //only resorting if no sublists exist
enableResorting = ids.length() == 1; // only resorting if no sublists exist
foreach (qulonglong id, ids) {
QSqlQuery selectQuery(db);
@ -526,7 +526,7 @@ void ComicModel::setupReadingListModelData(unsigned long long parentReadingList,
selectQuery.bindValue(":parentReadingList", id);
selectQuery.exec();
//TODO, extra information is needed (resorting)
// TODO, extra information is needed (resorting)
QList<ComicItem *> tempData = _data;
_data.clear();
@ -649,7 +649,7 @@ void ComicModel::setupModelData(QSqlQuery &sqlquery)
});
}
//comics are sorted by "ordering", the sorting is done in the sql query
// comics are sorted by "ordering", the sorting is done in the sql query
void ComicModel::setupModelDataForList(QSqlQuery &sqlquery)
{
int numColumns = sqlquery.record().count();
@ -707,7 +707,7 @@ QVector<YACReaderComicReadStatus> ComicModel::getReadList()
}
return readList;
}
//TODO untested, this method is no longer used
// TODO untested, this method is no longer used
QVector<YACReaderComicReadStatus> ComicModel::setAllComicsRead(YACReaderComicReadStatus read)
{
return setComicsRead(persistentIndexList(), read);
@ -742,7 +742,7 @@ QList<ComicDB> ComicModel::getComics(QList<QModelIndex> list)
}
return comics;
}
//TODO
// TODO
QVector<YACReaderComicReadStatus> ComicModel::setComicsRead(QList<QModelIndex> list, YACReaderComicReadStatus read)
{
QString connectionName = "";
@ -832,7 +832,7 @@ QModelIndex ComicModel::getIndexFromId(quint64 id)
return index(i, 0);
}
//TODO completely inefficiently
// TODO completely inefficiently
QList<QModelIndex> ComicModel::getIndexesFromIds(const QList<qulonglong> &comicIds)
{
QList<QModelIndex> comicsIndexes;
@ -1083,7 +1083,7 @@ void ComicModel::updateRating(int rating, QModelIndex mi)
QString connectionName = "";
{
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
//TODO optimize update
// TODO optimize update
comic.info.rating = rating;
_data[mi.row()]->setData(ComicModel::Rating, rating);

View File

@ -89,25 +89,25 @@ public:
void setupFavoritesModelData(const QString &databasePath);
void setupReadingModelData(const QString &databasePath);
//Métodos de conveniencia
// Métodos de conveniencia
QStringList getPaths(const QString &_source);
QString getComicPath(QModelIndex mi);
QString getCurrentPath() { return QString(_databasePath).remove("/.yacreaderlibrary"); }
ComicDB getComic(const QModelIndex &mi); //--> para la edición
//ComicDB getComic(int row);
// ComicDB getComic(int row);
QVector<YACReaderComicReadStatus> getReadList();
QVector<YACReaderComicReadStatus> setAllComicsRead(YACReaderComicReadStatus readStatus);
QList<ComicDB> getComics(QList<QModelIndex> list); //--> recupera la información común a los comics seleccionados
QList<ComicDB> getAllComics();
QModelIndex getIndexFromId(quint64 id);
QList<QModelIndex> getIndexesFromIds(const QList<qulonglong> &comicIds);
//setcomicInfo(QModelIndex & mi); --> inserta en la base datos
//setComicInfoForAllComics(); --> inserta la información común a todos los cómics de una sola vez.
//setComicInfoForSelectedComis(QList<QModelIndex> list); -->inserta la información común para los comics seleccionados
// setcomicInfo(QModelIndex & mi); --> inserta en la base datos
// setComicInfoForAllComics(); --> inserta la información común a todos los cómics de una sola vez.
// setComicInfoForSelectedComis(QList<QModelIndex> list); -->inserta la información común para los comics seleccionados
QVector<YACReaderComicReadStatus> setComicsRead(QList<QModelIndex> list, YACReaderComicReadStatus read);
void setComicsManga(QList<QModelIndex> list, bool isManga);
qint64 asignNumbers(QList<QModelIndex> list, int startingNumber);
//void remove(ComicDB * comic, int row);
// void remove(ComicDB * comic, int row);
void removeInTransaction(int row);
void reload(const ComicDB &comic);
void resetComicRating(const QModelIndex &mi);

View File

@ -62,7 +62,7 @@ void YACReader::ComicQueryResultProcessor::createModelData(const YACReader::Sear
break;
}
selectQuery.prepare(queryString.c_str());
selectQuery.bindValue(":limit", 500); //TODO, load this value from settings
selectQuery.bindValue(":limit", 500); // TODO, load this value from settings
result.bindValues(selectQuery);
selectQuery.exec();
@ -71,8 +71,8 @@ void YACReader::ComicQueryResultProcessor::createModelData(const YACReader::Sear
emit newData(data, databasePath);
} catch (const std::exception &e) {
//Do nothing, uncomplete search string will end here and it is part of how the QueryParser works
//I don't like the idea of using exceptions for this though
// Do nothing, uncomplete search string will end here and it is part of how the QueryParser works
// I don't like the idea of using exceptions for this though
}
connectionName = db.connectionName();

View File

@ -79,22 +79,22 @@ QSqlDatabase DataBaseManagement::createDatabase(QString dest)
{
QSqlQuery pragma("PRAGMA foreign_keys = ON", db);
//pragma.finish();
// pragma.finish();
DataBaseManagement::createTables(db);
QSqlQuery query("INSERT INTO folder (parentId, name, path) "
"VALUES (1,'root', '/')",
db);
}
//query.finish();
//db.close();
// query.finish();
// db.close();
return db;
}
QSqlDatabase DataBaseManagement::loadDatabase(QString path)
{
//TODO check path
// TODO check path
QString threadId = QString::number((long long)QThread::currentThreadId(), 16);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", path + threadId);
db.setDatabaseName(path + "/library.ydb");
@ -108,12 +108,12 @@ QSqlDatabase DataBaseManagement::loadDatabase(QString path)
QSqlDatabase DataBaseManagement::loadDatabaseFromFile(QString filePath)
{
//TODO check path
// TODO check path
QString threadId = QString::number((long long)QThread::currentThreadId(), 16);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", filePath + threadId);
db.setDatabaseName(filePath);
if (!db.open()) {
//se devuelve una base de datos vacía e inválida
// se devuelve una base de datos vacía e inválida
return QSqlDatabase();
}
@ -127,7 +127,7 @@ bool DataBaseManagement::createTables(QSqlDatabase &database)
bool success = true;
{
//COMIC INFO (representa la información de un cómic, cada cómic tendrá un idéntificador único formado por un hash sha1'de los primeros 512kb' + su tamaño en bytes)
// COMIC INFO (representa la información de un cómic, cada cómic tendrá un idéntificador único formado por un hash sha1'de los primeros 512kb' + su tamaño en bytes)
QSqlQuery queryComicInfo(database);
queryComicInfo.prepare("CREATE TABLE comic_info ("
"id INTEGER PRIMARY KEY,"
@ -154,11 +154,11 @@ bool DataBaseManagement::createTables(QSqlDatabase &database)
"letterer TEXT,"
"coverArtist TEXT,"
"date TEXT," //dd/mm/yyyy --> se mostrará en 3 campos diferentes
"date TEXT," // dd/mm/yyyy --> se mostrará en 3 campos diferentes
"publisher TEXT,"
"format TEXT,"
"color BOOLEAN,"
"ageRating BOOLEAN," //this is actually a string (TEXT), funny thing is that the current implementation works
"ageRating BOOLEAN," // this is actually a string (TEXT), funny thing is that the current implementation works
"synopsis TEXT,"
"characters TEXT,"
@ -167,7 +167,7 @@ bool DataBaseManagement::createTables(QSqlDatabase &database)
"hash TEXT UNIQUE NOT NULL,"
"edited BOOLEAN DEFAULT 0,"
"read BOOLEAN DEFAULT 0,"
//new 7.0 fields
// new 7.0 fields
"hasBeenOpened BOOLEAN DEFAULT 0,"
"rating INTEGER DEFAULT 0,"
@ -178,55 +178,55 @@ bool DataBaseManagement::createTables(QSqlDatabase &database)
"brightness INTEGER DEFAULT -1, "
"contrast INTEGER DEFAULT -1, "
"gamma INTEGER DEFAULT -1, "
//new 7.1 fields
// new 7.1 fields
"comicVineID TEXT,"
//new 9.5 fields
// new 9.5 fields
"lastTimeOpened INTEGER,"
"coverSizeRatio REAL,"
"originalCoverSize STRING," //h/w
//new 9.8 fields
"originalCoverSize STRING," // h/w
// new 9.8 fields
"manga BOOLEAN DEFAULT 0"
")");
success = success && queryComicInfo.exec();
//queryComicInfo.finish();
// queryComicInfo.finish();
//FOLDER (representa una carpeta en disco)
// FOLDER (representa una carpeta en disco)
QSqlQuery queryFolder(database);
queryFolder.prepare("CREATE TABLE folder ("
"id INTEGER PRIMARY KEY,"
"parentId INTEGER NOT NULL,"
"name TEXT NOT NULL,"
"path TEXT NOT NULL,"
//new 7.1 fields
"finished BOOLEAN DEFAULT 0," //reading
"completed BOOLEAN DEFAULT 1," //collecting
//new 9.5 fields
// new 7.1 fields
"finished BOOLEAN DEFAULT 0," // reading
"completed BOOLEAN DEFAULT 1," // collecting
// new 9.5 fields
"numChildren INTEGER,"
"firstChildHash TEXT,"
"customImage TEXT,"
//new 9.8 fields
// new 9.8 fields
"manga BOOLEAN DEFAULT 0,"
"FOREIGN KEY(parentId) REFERENCES folder(id) ON DELETE CASCADE)");
success = success && queryFolder.exec();
//COMIC (representa un cómic en disco, contiene el nombre de fichero)
// COMIC (representa un cómic en disco, contiene el nombre de fichero)
QSqlQuery queryComic(database);
queryComic.prepare("CREATE TABLE comic (id INTEGER PRIMARY KEY, parentId INTEGER NOT NULL, comicInfoId INTEGER NOT NULL, fileName TEXT NOT NULL, path TEXT, FOREIGN KEY(parentId) REFERENCES folder(id) ON DELETE CASCADE, FOREIGN KEY(comicInfoId) REFERENCES comic_info(id))");
success = success && queryComic.exec();
//queryComic.finish();
//DB INFO
// queryComic.finish();
// DB INFO
QSqlQuery queryDBInfo(database);
queryDBInfo.prepare("CREATE TABLE db_info (version TEXT NOT NULL)");
success = success && queryDBInfo.exec();
//queryDBInfo.finish();
// queryDBInfo.finish();
QSqlQuery query("INSERT INTO db_info (version) "
"VALUES ('" VERSION "')",
database);
//query.finish();
// query.finish();
//8.0> tables
// 8.0> tables
success = success && DataBaseManagement::createV8Tables(database);
}
@ -237,23 +237,23 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
{
bool success = true;
{
//8.0> tables
//LABEL
// 8.0> tables
// LABEL
QSqlQuery queryLabel(database);
success = success && queryLabel.exec("CREATE TABLE label (id INTEGER PRIMARY KEY, "
"name TEXT NOT NULL, "
"color TEXT NOT NULL, "
"ordering INTEGER NOT NULL); "); //order depends on the color
"ordering INTEGER NOT NULL); "); // order depends on the color
QSqlQuery queryIndexLabel(database);
success = success && queryIndexLabel.exec("CREATE INDEX label_ordering_index ON label (ordering)");
//COMIC LABEL
// COMIC LABEL
QSqlQuery queryComicLabel(database);
success = success && queryComicLabel.exec("CREATE TABLE comic_label ("
"comic_id INTEGER, "
"label_id INTEGER, "
"ordering INTEGER, " //TODO order????
"ordering INTEGER, " // TODO order????
"FOREIGN KEY(label_id) REFERENCES label(id) ON DELETE CASCADE, "
"FOREIGN KEY(comic_id) REFERENCES comic(id) ON DELETE CASCADE, "
"PRIMARY KEY(label_id, comic_id))");
@ -261,12 +261,12 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
QSqlQuery queryIndexComicLabel(database);
success = success && queryIndexComicLabel.exec("CREATE INDEX comic_label_ordering_index ON label (ordering)");
//READING LIST
// READING LIST
QSqlQuery queryReadingList(database);
success = success && queryReadingList.exec("CREATE TABLE reading_list ("
"id INTEGER PRIMARY KEY, "
"parentId INTEGER, "
"ordering INTEGER DEFAULT 0, " //only use it if the parentId is NULL
"ordering INTEGER DEFAULT 0, " // only use it if the parentId is NULL
"name TEXT NOT NULL, "
"finished BOOLEAN DEFAULT 0, "
"completed BOOLEAN DEFAULT 1, "
@ -276,7 +276,7 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
QSqlQuery queryIndexReadingList(database);
success = success && queryIndexReadingList.exec("CREATE INDEX reading_list_ordering_index ON label (ordering)");
//COMIC READING LIST
// COMIC READING LIST
QSqlQuery queryComicReadingList(database);
success = success && queryComicReadingList.exec("CREATE TABLE comic_reading_list ("
"reading_list_id INTEGER, "
@ -289,20 +289,20 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
QSqlQuery queryIndexComicReadingList(database);
success = success && queryIndexComicReadingList.exec("CREATE INDEX comic_reading_list_ordering_index ON label (ordering)");
//DEFAULT READING LISTS
// DEFAULT READING LISTS
QSqlQuery queryDefaultReadingList(database);
success = success && queryDefaultReadingList.exec("CREATE TABLE default_reading_list ("
"id INTEGER PRIMARY KEY, "
"name TEXT NOT NULL"
//TODO icon????
// TODO icon????
")");
//COMIC DEFAULT READING LISTS
// COMIC DEFAULT READING LISTS
QSqlQuery queryComicDefaultReadingList(database);
success = success && queryComicDefaultReadingList.exec("CREATE TABLE comic_default_reading_list ("
"comic_id INTEGER, "
"default_reading_list_id INTEGER, "
"ordering INTEGER, " //order????
"ordering INTEGER, " // order????
"FOREIGN KEY(default_reading_list_id) REFERENCES default_reading_list(id) ON DELETE CASCADE, "
"FOREIGN KEY(comic_id) REFERENCES comic(id) ON DELETE CASCADE,"
"PRIMARY KEY(default_reading_list_id, comic_id))");
@ -310,15 +310,15 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
QSqlQuery queryIndexComicDefaultReadingList(database);
success = success && queryIndexComicDefaultReadingList.exec("CREATE INDEX comic_default_reading_list_ordering_index ON label (ordering)");
//INSERT DEFAULT READING LISTS
// INSERT DEFAULT READING LISTS
QSqlQuery queryInsertDefaultReadingList(database);
//if(!queryInsertDefaultReadingList.prepare())
// if(!queryInsertDefaultReadingList.prepare())
//1 Favorites
//queryInsertDefaultReadingList.bindValue(":name", "Favorites");
// 1 Favorites
// queryInsertDefaultReadingList.bindValue(":name", "Favorites");
success = success && queryInsertDefaultReadingList.exec("INSERT INTO default_reading_list (name) VALUES (\"Favorites\")");
//Reading doesn't need its onw list
// Reading doesn't need its onw list
}
return success;
}
@ -377,7 +377,7 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
newInfo.exec();
destDB.transaction();
int cp;
while (newInfo.next()) //cada tupla deberá ser insertada o actualizada
while (newInfo.next()) // cada tupla deberá ser insertada o actualizada
{
QSqlQuery update(destDB);
update.prepare("UPDATE comic_info SET "
@ -558,7 +558,7 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
return b;
}
//TODO fix these bindings
// TODO fix these bindings
void DataBaseManagement::bindValuesFromRecord(const QSqlRecord &record, QSqlQuery &query)
{
bindString("title", record, query);
@ -613,13 +613,13 @@ bool DataBaseManagement::addColumns(const QString &tableName, const QStringList
foreach (QString columnDef, columnDefs) {
QSqlQuery alterTable(db);
alterTable.prepare(sql.arg(tableName).arg(columnDef));
//alterTableComicInfo.bindValue(":column_def",columnDef);
// alterTableComicInfo.bindValue(":column_def",columnDef);
bool exec = alterTable.exec();
returnValue = returnValue && exec;
if (!exec) {
QLOG_ERROR() << alterTable.lastError().text();
}
//returnValue = returnValue && (alterTable.numRowsAffected() > 0);
// returnValue = returnValue && (alterTable.numRowsAffected() > 0);
}
return returnValue;
@ -747,9 +747,9 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &path)
if (updateVersion.numRowsAffected() > 0)
returnValue = true;
if (pre7) //TODO: execute only if previous version was < 7.0
if (pre7) // TODO: execute only if previous version was < 7.0
{
//new 7.0 fields
// new 7.0 fields
QStringList columnDefs;
columnDefs << "hasBeenOpened BOOLEAN DEFAULT 0"
<< "rating INTEGER DEFAULT 0"
@ -764,7 +764,7 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &path)
bool successAddingColumns = addColumns("comic_info", columnDefs, db);
returnValue = returnValue && successAddingColumns;
}
//TODO update hasBeenOpened value
// TODO update hasBeenOpened value
if (pre7_1) {
{
@ -775,7 +775,7 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &path)
returnValue = returnValue && successAddingColumns;
}
{ //comic_info
{ // comic_info
QStringList columnDefs;
columnDefs << "comicVineID TEXT DEFAULT NULL";
bool successAddingColumns = addColumns("comic_info", columnDefs, db);
@ -789,9 +789,9 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &path)
}
if (pre9_5) {
{ //folder
{ // folder
QStringList columnDefs;
//a full library update is needed after updating the table
// a full library update is needed after updating the table
columnDefs << "numChildren INTEGER";
columnDefs << "firstChildHash TEXT";
columnDefs << "customImage TEXT";
@ -799,7 +799,7 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &path)
returnValue = returnValue && successAddingColumns;
}
{ //comic_info
{ // comic_info
QStringList columnDefs;
columnDefs << "lastTimeOpened INTEGER";
columnDefs << "coverSizeRatio REAL";
@ -812,7 +812,7 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &path)
returnValue = returnValue && successCreatingIndex;
}
//update folders info
// update folders info
{
DBHelper::updateChildrenInfo(db);
}
@ -843,13 +843,13 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &path)
}
if (pre9_8) {
{ //comic_info
{ // comic_info
QStringList columnDefs;
columnDefs << "manga BOOLEAN DEFAULT 0";
bool successAddingColumns = addColumns("comic_info", columnDefs, db);
returnValue = returnValue && successAddingColumns;
}
{ //folder
{ // folder
QStringList columnDefs;
columnDefs << "manga BOOLEAN DEFAULT 0";
bool successAddingColumns = addColumns("folder", columnDefs, db);
@ -864,7 +864,7 @@ bool DataBaseManagement::updateToCurrentVersion(const QString &path)
return returnValue;
}
//COMICS_INFO_EXPORTER
// COMICS_INFO_EXPORTER
ComicsInfoExporter::ComicsInfoExporter()
: QThread()
{
@ -874,14 +874,14 @@ void ComicsInfoExporter::exportComicsInfo(QSqlDatabase &source, QSqlDatabase &de
{
Q_UNUSED(source)
Q_UNUSED(dest)
//TODO check this method
// TODO check this method
}
void ComicsInfoExporter::run()
{
}
//COMICS_INFO_IMPORTER
// COMICS_INFO_IMPORTER
ComicsInfoImporter::ComicsInfoImporter()
: QThread()
{
@ -891,7 +891,7 @@ void ComicsInfoImporter::importComicsInfo(QSqlDatabase &source, QSqlDatabase &de
{
Q_UNUSED(source)
Q_UNUSED(dest)
//TODO check this method
// TODO check this method
}
void ComicsInfoImporter::run()

View File

@ -44,11 +44,11 @@ private:
public:
DataBaseManagement();
//TreeModel * newTreeModel(QString path);
//crea una base de datos y todas sus tablas
// TreeModel * newTreeModel(QString path);
// crea una base de datos y todas sus tablas
static QSqlDatabase createDatabase(QString name, QString path);
static QSqlDatabase createDatabase(QString dest);
//carga una base de datos desde la ruta path
// carga una base de datos desde la ruta path
static QSqlDatabase loadDatabase(QString path);
static QSqlDatabase loadDatabaseFromFile(QString path);
static bool createTables(QSqlDatabase &database);
@ -57,8 +57,8 @@ public:
static void exportComicsInfo(QString source, QString dest);
static bool importComicsInfo(QString source, QString dest);
static QString checkValidDB(const QString &fullPath); //retorna "" si la DB es inválida ó la versión si es válida.
static int compareVersions(const QString &v1, const QString v2); //retorna <0 si v1 < v2, 0 si v1 = v2 y >0 si v1 > v2
static QString checkValidDB(const QString &fullPath); // retorna "" si la DB es inválida ó la versión si es válida.
static int compareVersions(const QString &v1, const QString v2); // retorna <0 si v1 < v2, 0 si v1 = v2 y >0 si v1 > v2
static bool updateToCurrentVersion(const QString &path);
};

View File

@ -22,7 +22,7 @@ void FolderItem::appendChild(FolderItem *item)
childItems.append(item);
else {
FolderItem *last = childItems.back();
QString nameLast = last->data(1).toString(); //TODO usar info name si est<73> disponible, sino el nombre del fichero.....
QString nameLast = last->data(1).toString(); // TODO usar info name si est<73> disponible, sino el nombre del fichero.....
QString nameCurrent = item->data(1).toString();
QList<FolderItem *>::iterator i;
i = childItems.end();
@ -31,13 +31,13 @@ void FolderItem::appendChild(FolderItem *item)
i--;
nameLast = (*i)->data(1).toString();
}
if (!naturalSortLessThanCI(nameCurrent, nameLast)) //si se ha encontrado un elemento menor que current, se inserta justo despu<70>s
if (!naturalSortLessThanCI(nameCurrent, nameLast)) // si se ha encontrado un elemento menor que current, se inserta justo despu<70>s
childItems.insert(++i, item);
else
childItems.insert(i, item);
}
//childItems.append(item);
// childItems.append(item);
}
FolderItem *FolderItem::child(int row)

View File

@ -61,14 +61,14 @@ FolderModel::FolderModel(QObject *parent)
FolderModel::FolderModel(QSqlQuery &sqlquery, QObject *parent)
: QAbstractItemModel(parent), rootItem(0)
{
//lo m<>s probable es que el nodo ra<72>z no necesite tener informaci<63>n
// lo m<>s probable es que el nodo ra<72>z no necesite tener informaci<63>n
QList<QVariant> rootData;
rootData << "root"; //id 0, padre 0, title "root" (el id, y el id del padre van a ir en la clase TreeItem)
rootData << "root"; // id 0, padre 0, title "root" (el id, y el id del padre van a ir en la clase TreeItem)
rootItem = new FolderItem(rootData);
rootItem->id = ROOT;
rootItem->parentItem = 0;
setupModelData(sqlquery, rootItem);
//sqlquery.finish();
// sqlquery.finish();
}
FolderModel::~FolderModel()
@ -208,20 +208,20 @@ void FolderModel::setupModelData(QString path)
{
beginResetModel();
if (rootItem != 0)
delete rootItem; //TODO comprobar que se libera bien la memoria
delete rootItem; // TODO comprobar que se libera bien la memoria
rootItem = 0;
//inicializar el nodo ra<72>z
// inicializar el nodo ra<72>z
QList<QVariant> rootData;
rootData << "root"; //id 0, padre 0, title "root" (el id, y el id del padre van a ir en la clase TreeItem)
rootData << "root"; // id 0, padre 0, title "root" (el id, y el id del padre van a ir en la clase TreeItem)
rootItem = new FolderItem(rootData);
rootItem->id = ROOT;
rootItem->parentItem = 0;
//cargar la base de datos
// cargar la base de datos
_databasePath = path;
//crear la consulta
// crear la consulta
QString connectionName = "";
{
QSqlDatabase db = DataBaseManagement::loadDatabase(path);
@ -230,17 +230,17 @@ void FolderModel::setupModelData(QString path)
setupModelData(selectQuery, rootItem);
connectionName = db.connectionName();
}
//selectQuery.finish();
// selectQuery.finish();
QSqlDatabase::removeDatabase(connectionName);
endResetModel();
}
void FolderModel::setupModelData(QSqlQuery &sqlquery, FolderItem *parent)
{
//64 bits para la primary key, es decir la misma precisi<73>n que soporta sqlit 2^64
//el diccionario permitir<69> encontrar cualquier nodo del <20>rbol r<>pidamente, de forma que a<>adir un hijo a un padre sea O(1)
// 64 bits para la primary key, es decir la misma precisi<73>n que soporta sqlit 2^64
// el diccionario permitir<69> encontrar cualquier nodo del <20>rbol r<>pidamente, de forma que a<>adir un hijo a un padre sea O(1)
items.clear();
//se a<>ade el nodo 0
// se a<>ade el nodo 0
items.insert(parent->id, parent);
QSqlRecord record = sqlquery.record();
@ -264,11 +264,11 @@ void FolderModel::setupModelData(QSqlQuery &sqlquery, FolderItem *parent)
auto item = new FolderItem(data);
item->id = sqlquery.value(id).toULongLong();
//la inserci<63>n de hijos se hace de forma ordenada
// la inserci<63>n de hijos se hace de forma ordenada
FolderItem *parent = items.value(sqlquery.value(parentId).toULongLong());
//if(parent !=0) //TODO if parent==0 the parent of item was removed from the DB and delete on cascade didn't work, ERROR.
// if(parent !=0) //TODO if parent==0 the parent of item was removed from the DB and delete on cascade didn't work, ERROR.
parent->appendChild(item);
//se a<>ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
// se a<>ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
items.insert(item->id, item);
}
}
@ -298,11 +298,11 @@ void FolderModel::updateFolderModelData(QSqlQuery &sqlquery, FolderItem *parent)
auto item = new FolderItem(data);
item->id = sqlquery.value(id).toULongLong();
//la inserci<63>n de hijos se hace de forma ordenada
// la inserci<63>n de hijos se hace de forma ordenada
FolderItem *parent = items.value(sqlquery.value(parentId).toULongLong());
if (parent != 0) //TODO if parent==0 the parent of item was removed from the DB and delete on cascade didn't work, ERROR.
if (parent != 0) // TODO if parent==0 the parent of item was removed from the DB and delete on cascade didn't work, ERROR.
parent->appendChild(item);
//se a<>ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
// se a<>ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
items.insert(item->id, item);
}
}
@ -314,7 +314,7 @@ QString FolderModel::getDatabase()
QString FolderModel::getFolderPath(const QModelIndex &folder)
{
if (!folder.isValid()) //root folder
if (!folder.isValid()) // root folder
return "/";
return static_cast<FolderItem *>(folder.internalPointer())->data(FolderModel::Path).toString();
}
@ -425,7 +425,7 @@ void FolderModel::fetchMoreFromDB(const QModelIndex &parent)
else
item = rootItem;
//Remove all children
// Remove all children
if (item->childCount() > 0) {
beginRemoveRows(parent, 0, item->childCount() - 1);
item->clearChildren();
@ -453,14 +453,14 @@ void FolderModel::fetchMoreFromDB(const QModelIndex &parent)
selectQuery.exec();
if (!firstLevelUpdated) {
//NO size support
// NO size support
int numResults = 0;
while (selectQuery.next())
numResults++;
if (!selectQuery.seek(-1))
selectQuery.exec();
//END no size support
// END no size support
beginInsertRows(parent, 0, numResults - 1);
}
@ -513,17 +513,17 @@ QModelIndex FolderModel::addFolderAtParent(const QString &folderName, const QMod
QList<QVariant> data;
data << newFolder.name;
data << newFolder.path;
data << false; //finished
data << true; //completed
data << false; // finished
data << true; // completed
data << newFolder.isManga();
auto item = new FolderItem(data);
item->id = newFolder.id;
beginInsertRows(parent, 0, 0); //TODO calculate the destRow before inserting the new child
beginInsertRows(parent, 0, 0); // TODO calculate the destRow before inserting the new child
parentItem->appendChild(item);
destRow = parentItem->children().indexOf(item); //TODO optimize this, appendChild should return the index of the new item
destRow = parentItem->children().indexOf(item); // TODO optimize this, appendChild should return the index of the new item
items.insert(item->id, item);
endInsertRows();
@ -566,7 +566,7 @@ void FolderModel::updateFolderChildrenInfo(qulonglong folderId)
QSqlDatabase::removeDatabase(connectionName);
}
//PROXY
// PROXY
FolderModelProxy::FolderModelProxy(QObject *parent)
: QSortFilterProxyModel(parent), rootItem(0), filterEnabled(false)
@ -600,7 +600,7 @@ void FolderModelProxy::setFilterData(QMap<unsigned long long, FolderItem *> *fil
beginResetModel();
if (rootItem != 0)
delete rootItem; //TODO comprobar que se libera bien la memoria
delete rootItem; // TODO comprobar que se libera bien la memoria
rootItem = root;

View File

@ -27,7 +27,7 @@ public:
protected:
FolderItem *rootItem;
QMap<unsigned long long int, FolderItem *> filteredItems; //relación entre folders
QMap<unsigned long long int, FolderItem *> filteredItems; // relación entre folders
bool filterEnabled;
@ -46,7 +46,7 @@ public:
explicit FolderModel(QSqlQuery &sqlquery, QObject *parent = nullptr);
~FolderModel() override;
//QAbstractItemModel methods
// QAbstractItemModel methods
QVariant data(const QModelIndex &index, int role) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
QVariant headerData(int section, Qt::Orientation orientation,
@ -57,13 +57,13 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
//Convenience methods
// Convenience methods
void setupModelData(QString path);
QString getDatabase();
QString getFolderPath(const QModelIndex &folder);
//QModelIndex indexFromItem(FolderItem * item, int column);
// QModelIndex indexFromItem(FolderItem * item, int column);
//bool isFilterEnabled(){return filterEnabled;};
// bool isFilterEnabled(){return filterEnabled;};
void updateFolderCompletedStatus(const QModelIndexList &list, bool status);
void updateFolderFinishedStatus(const QModelIndexList &list, bool status);
@ -81,7 +81,7 @@ public:
Finished = 2,
Completed = 3,
Manga = 4
}; //id INTEGER PRIMARY KEY, parentId INTEGER NOT NULL, name TEXT NOT NULL, path TEXT NOT NULL
}; // id INTEGER PRIMARY KEY, parentId INTEGER NOT NULL, name TEXT NOT NULL, path TEXT NOT NULL
enum Roles {
FinishedRole = Qt::UserRole + 1,
@ -98,8 +98,8 @@ private:
void setupModelData(QSqlQuery &sqlquery, FolderItem *parent);
void updateFolderModelData(QSqlQuery &sqlquery, FolderItem *parent);
FolderItem *rootItem; //el árbol
QMap<unsigned long long int, FolderItem *> items; //relación entre folders
FolderItem *rootItem; // el árbol
QMap<unsigned long long int, FolderItem *> items; // relación entre folders
QString _databasePath;
};

View File

@ -12,7 +12,7 @@
#include <QSqlQuery>
#include <QSqlDatabase>
//Copy/pasted from "folder_model.cpp"
// Copy/pasted from "folder_model.cpp"
#define ROOT 1
YACReader::FolderQueryResultProcessor::FolderQueryResultProcessor(FolderModel *model)
@ -29,7 +29,7 @@ void YACReader::FolderQueryResultProcessor::createModelData(const YACReader::Sea
{
QSqlDatabase db = DataBaseManagement::loadDatabase(model->getDatabase());
QSqlQuery selectQuery(db); //TODO check
QSqlQuery selectQuery(db); // TODO check
if (!includeComics) {
selectQuery.prepare("select * from folder where id <> 1 and upper(name) like upper(:filter) order by parentId,name ");
selectQuery.bindValue(":filter", "%%" + filter + "%%");
@ -70,8 +70,8 @@ void YACReader::FolderQueryResultProcessor::createModelData(const YACReader::Sea
setupFilteredModelData(selectQuery);
} catch (const std::exception &e) {
//Do nothing, uncomplete search string will end here and it is part of how the QueryParser works
//I don't like the idea of using exceptions for this though
// Do nothing, uncomplete search string will end here and it is part of how the QueryParser works
// I don't like the idea of using exceptions for this though
}
}
@ -86,7 +86,7 @@ void YACReader::FolderQueryResultProcessor::setupFilteredModelData(QSqlQuery &sq
{
FolderItem *rootItem = 0;
//inicializar el nodo ra<72>z
// inicializar el nodo ra<72>z
QList<QVariant> rootData;
rootData << "root";
rootItem = new FolderItem(rootData);
@ -97,7 +97,7 @@ void YACReader::FolderQueryResultProcessor::setupFilteredModelData(QSqlQuery &sq
QMap<unsigned long long int, FolderItem *> *filteredItems = new QMap<unsigned long long int, FolderItem *>();
//add tree root node
// add tree root node
filteredItems->insert(parent->id, parent);
QSqlRecord record = sqlquery.record();
@ -108,8 +108,8 @@ void YACReader::FolderQueryResultProcessor::setupFilteredModelData(QSqlQuery &sq
int completed = record.indexOf("completed");
int parentIdIndex = record.indexOf("parentId");
while (sqlquery.next()) { //se procesan todos los folders que cumplen con el filtro
//datos de la base de datos
while (sqlquery.next()) { // se procesan todos los folders que cumplen con el filtro
// datos de la base de datos
QList<QVariant> data;
data << sqlquery.value(name).toString();
@ -120,52 +120,52 @@ void YACReader::FolderQueryResultProcessor::setupFilteredModelData(QSqlQuery &sq
auto item = new FolderItem(data);
item->id = sqlquery.value(0).toULongLong();
//id del padre
// id del padre
quint64 parentId = sqlquery.value(parentIdIndex).toULongLong();
//se a<>ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
// se a<>ade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
if (!filteredItems->contains(item->id))
filteredItems->insert(item->id, item);
//es necesario conocer las coordenadas de origen para poder realizar scroll autom<6F>tico en la vista
// es necesario conocer las coordenadas de origen para poder realizar scroll autom<6F>tico en la vista
item->originalItem = model->items.value(item->id);
//si el padre ya existe en el modelo, el item se a<>ade como hijo
// si el padre ya existe en el modelo, el item se a<>ade como hijo
if (filteredItems->contains(parentId))
filteredItems->value(parentId)->appendChild(item);
else //si el padre a<>n no se ha a<>adido, hay que a<>adirlo a <20>l y todos los padres hasta el nodo ra<72>z
else // si el padre a<>n no se ha a<>adido, hay que a<>adirlo a <20>l y todos los padres hasta el nodo ra<72>z
{
//comprobamos con esta variable si el <20>ltimo de los padres (antes del nodo ra<72>z) ya exist<73>a en el modelo
// comprobamos con esta variable si el <20>ltimo de los padres (antes del nodo ra<72>z) ya exist<73>a en el modelo
bool parentPreviousInserted = false;
//mientras no se alcance el nodo ra<72>z se procesan todos los padres (de abajo a arriba)
// mientras no se alcance el nodo ra<72>z se procesan todos los padres (de abajo a arriba)
while (parentId != ROOT) {
//el padre no estaba en el modelo filtrado, as<61> que se rescata del modelo original
// el padre no estaba en el modelo filtrado, as<61> que se rescata del modelo original
FolderItem *parentItem = model->items.value(parentId);
//se debe crear un nuevo nodo (para no compartir los hijos con el nodo original)
FolderItem *newparentItem = new FolderItem(parentItem->getData()); //padre que se a<>adir<69> a la estructura de directorios filtrados
// se debe crear un nuevo nodo (para no compartir los hijos con el nodo original)
FolderItem *newparentItem = new FolderItem(parentItem->getData()); // padre que se a<>adir<69> a la estructura de directorios filtrados
newparentItem->id = parentId;
newparentItem->originalItem = parentItem;
//si el modelo contiene al padre, se a<>ade el item actual como hijo
// si el modelo contiene al padre, se a<>ade el item actual como hijo
if (filteredItems->contains(parentId)) {
filteredItems->value(parentId)->appendChild(item);
parentPreviousInserted = true;
}
//sino se registra el nodo para poder encontrarlo con posterioridad y se a<>ade el item actual como hijo
// sino se registra el nodo para poder encontrarlo con posterioridad y se a<>ade el item actual como hijo
else {
newparentItem->appendChild(item);
filteredItems->insert(newparentItem->id, newparentItem);
parentPreviousInserted = false;
}
//variables de control del bucle, se avanza hacia el nodo padre
// variables de control del bucle, se avanza hacia el nodo padre
item = newparentItem;
parentId = parentItem->parentItem->id;
}
//si el nodo es hijo de 1 y no hab<61>a sido previamente insertado como hijo, se a<>ade como tal
// si el nodo es hijo de 1 y no hab<61>a sido previamente insertado como hijo, se a<>ade como tal
if (!parentPreviousInserted) {
filteredItems->value(ROOT)->appendChild(item);
} else {

View File

@ -66,7 +66,7 @@ Token QueryLexer::quotedWord()
return Token(Token::Type::quotedWord, input.substr(start, index - start));
}
//This should be a lexical error, but the grammar doesn't support it
// This should be a lexical error, but the grammar doesn't support it
return Token(Token::Type::eof);
}

View File

@ -113,7 +113,7 @@ std::string QueryParser::token(bool advance)
auto lexeme = currentToken.lexeme();
auto res = (tokenType() == Token::Type::quotedWord) ? currentToken.lexeme().substr(1, lexeme.size() - 2) : lexeme; //TODO process quotedWordDiferently?
auto res = (tokenType() == Token::Type::quotedWord) ? currentToken.lexeme().substr(1, lexeme.size() - 2) : lexeme; // TODO process quotedWordDiferently?
if (advance) {
this->advance();
}

View File

@ -134,12 +134,12 @@ ReadingListItem::ReadingListItem(const QList<QVariant> &data, ReadingListItem *p
QIcon ReadingListItem::getIcon() const
{
if (parent->getId() == 0)
return YACReader::noHighlightedIcon(":/images/lists/list.png"); //top level list
return YACReader::noHighlightedIcon(":/images/lists/list.png"); // top level list
else
#ifdef Q_OS_MAC
return QFileIconProvider().icon(QFileIconProvider::Folder);
#else
return YACReader::noHighlightedIcon(":/images/sidebar/folder.png"); //sublist
return YACReader::noHighlightedIcon(":/images/sidebar/folder.png"); // sublist
#endif
}
@ -153,7 +153,7 @@ ReadingListItem *ReadingListItem::child(int row)
return childItems.at(row);
}
//items are sorted by order
// items are sorted by order
void ReadingListItem::appendChild(ReadingListItem *item)
{
item->parent = this;
@ -161,7 +161,7 @@ void ReadingListItem::appendChild(ReadingListItem *item)
if (childItems.isEmpty())
childItems.append(item);
else {
if (item->parent->getId() == 0) //sort by name, top level child
if (item->parent->getId() == 0) // sort by name, top level child
{
int i = 0;
while (i < childItems.length() && naturalSortLessThanCI(childItems.at(i)->name(), item->name()))

View File

@ -6,7 +6,7 @@
#include "yacreader_global_gui.h"
#include "reading_list_model.h"
//TODO add propper constructors, using QList<QVariant> is not safe
// TODO add propper constructors, using QList<QVariant> is not safe
class ListItem
{

View File

@ -19,9 +19,9 @@ ReadingListModel::ReadingListModel(QObject *parent)
int ReadingListModel::rowCount(const QModelIndex &parent) const
{
if (!parent.isValid()) //TOP
if (!parent.isValid()) // TOP
{
int separatorsCount = 2; //labels.isEmpty()?1:2;
int separatorsCount = 2; // labels.isEmpty()?1:2;
return specialLists.count() + labels.count() + rootItem->childCount() + separatorsCount;
} else {
auto item = static_cast<ListItem *>(parent.internalPointer());
@ -108,7 +108,7 @@ Qt::ItemFlags ReadingListModel::flags(const QModelIndex &index) const
return {};
if (typeid(*item) == typeid(ReadingListItem) && static_cast<ReadingListItem *>(item)->parent->getId() != 0)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled; //only sublists are dragable
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled; // only sublists are dragable
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled;
}
@ -127,7 +127,7 @@ QModelIndex ReadingListModel::index(int row, int column, const QModelIndex &pare
return QModelIndex();
if (!parent.isValid()) {
int separatorsCount = 2; //labels.isEmpty()?1:2;
int separatorsCount = 2; // labels.isEmpty()?1:2;
if (rowIsSpecialList(row, parent))
return createIndex(row, column, specialLists.at(row));
@ -145,12 +145,12 @@ QModelIndex ReadingListModel::index(int row, int column, const QModelIndex &pare
if (rowIsReadingList(row, parent))
return createIndex(row, column, rootItem->child(row - (specialLists.count() + labels.count() + separatorsCount)));
} else //sublist
} else // sublist
{
ReadingListItem *parentItem;
if (!parent.isValid())
parentItem = rootItem; //this should be impossible
parentItem = rootItem; // this should be impossible
else
parentItem = static_cast<ReadingListItem *>(parent.internalPointer());
@ -191,12 +191,12 @@ bool ReadingListModel::canDropMimeData(const QMimeData *data, Qt::DropAction act
if (row == -1)
return false;
if (!parent.isValid()) //top level items
if (!parent.isValid()) // top level items
{
if (row == -1) //no list
if (row == -1) // no list
return false;
if (row == 1) //reading is just an smart list
if (row == 1) // reading is just an smart list
return false;
if (rowIsSeparator(row, parent))
@ -214,7 +214,7 @@ bool ReadingListModel::canDropMimeData(const QMimeData *data, Qt::DropAction act
QList<QPair<int, int>> sublistsRows;
QByteArray rawData = data->data(YACReader::YACReaderLibrarSubReadingListMimeDataFormat);
QDataStream in(&rawData, QIODevice::ReadOnly);
in >> sublistsRows; //deserialize the list of indentifiers
in >> sublistsRows; // deserialize the list of indentifiers
if (parent.row() != sublistsRows.at(0).second)
return false;
return data->formats().contains(YACReader::YACReaderLibrarSubReadingListMimeDataFormat);
@ -255,7 +255,7 @@ bool ReadingListModel::dropComics(const QMimeData *data, Qt::DropAction action,
parentDest = dest.parent();
if (rowIsSpecialList(dest.row(), parentDest)) {
if (dest.row() == 0) //add to favorites
if (dest.row() == 0) // add to favorites
{
QLOG_DEBUG() << "-------addComicsToFavorites : " << comicIds << " to " << dest.data(IDRole).toULongLong();
emit addComicsToFavorites(comicIds);
@ -286,7 +286,7 @@ bool ReadingListModel::dropSublist(const QMimeData *data, Qt::DropAction action,
QList<QPair<int, int>> sublistsRows;
QByteArray rawData = data->data(YACReader::YACReaderLibrarSubReadingListMimeDataFormat);
QDataStream in(&rawData, QIODevice::ReadOnly);
in >> sublistsRows; //deserialize the list of indentifiers
in >> sublistsRows; // deserialize the list of indentifiers
QLOG_DEBUG() << "dropped : " << sublistsRows;
@ -303,7 +303,7 @@ bool ReadingListModel::dropSublist(const QMimeData *data, Qt::DropAction action,
if (sourceRow == destRow)
return false;
//beginMoveRows(destParent,sourceRow,sourceRow,destParent,destRow);
// beginMoveRows(destParent,sourceRow,sourceRow,destParent,destRow);
auto parentItem = static_cast<ReadingListItem *>(destParent.internalPointer());
ReadingListItem *child = parentItem->child(sourceRow);
@ -311,7 +311,7 @@ bool ReadingListModel::dropSublist(const QMimeData *data, Qt::DropAction action,
parentItem->appendChild(child, destRow);
reorderingChildren(parentItem->children());
//endMoveRows();
// endMoveRows();
return true;
}
@ -322,7 +322,7 @@ QMimeData *ReadingListModel::mimeData(const QModelIndexList &indexes) const
if (indexes.length() == 0) {
QLOG_ERROR() << "mimeData requested: indexes is empty";
return new QMimeData(); //TODO what happens if 0 is returned?
return new QMimeData(); // TODO what happens if 0 is returned?
}
if (indexes.length() > 1) {
@ -337,7 +337,7 @@ QMimeData *ReadingListModel::mimeData(const QModelIndexList &indexes) const
QByteArray data;
QDataStream out(&data, QIODevice::WriteOnly);
out << rows; //serialize the list of identifiers
out << rows; // serialize the list of identifiers
auto mimeData = new QMimeData();
mimeData->setData(YACReader::YACReaderLibrarSubReadingListMimeDataFormat, data);
@ -354,17 +354,17 @@ void ReadingListModel::setupReadingListsData(QString path)
_databasePath = path;
QSqlDatabase db = DataBaseManagement::loadDatabase(path);
//setup special lists
// setup special lists
specialLists = setupSpecialLists(db);
//separator--------------------------------------------
// separator--------------------------------------------
//setup labels
// setup labels
setupLabels(db);
//separator--------------------------------------------
// separator--------------------------------------------
//setup reading list
// setup reading list
setupReadingLists(db);
endResetModel();
@ -391,7 +391,7 @@ void ReadingListModel::addReadingList(const QString &name)
QString connectionName = "";
{
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
beginInsertRows(QModelIndex(), 0, 0); //TODO calculate the right coordinates before inserting
beginInsertRows(QModelIndex(), 0, 0); // TODO calculate the right coordinates before inserting
qulonglong id = DBHelper::insertReadingList(name, db);
ReadingListItem *newItem;
@ -416,7 +416,7 @@ void ReadingListModel::addReadingListAt(const QString &name, const QModelIndex &
{
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
beginInsertRows(mi, 0, 0); //TODO calculate the right coordinates before inserting
beginInsertRows(mi, 0, 0); // TODO calculate the right coordinates before inserting
auto readingListParent = static_cast<ReadingListItem *>(mi.internalPointer());
qulonglong id = DBHelper::insertReadingSubList(name, mi.data(IDRole).toULongLong(), readingListParent->childCount(), db);
@ -488,8 +488,8 @@ void ReadingListModel::rename(const QModelIndex &mi, const QString &name)
DBHelper::renameList(item->getId(), name, db);
if (rli->parent->getId() != 0) {
//TODO
//move row depending on the name
// TODO
// move row depending on the name
} else
emit dataChanged(index(mi.row(), 0), index(mi.row(), 0));
} else if (typeid(*item) == typeid(LabelItem)) {
@ -609,7 +609,7 @@ QList<SpecialListItem *> ReadingListModel::setupSpecialLists(QSqlDatabase &db)
<< selectQuery.value(id));
}
//Reading after Favorites, Why? Because I want to :P
// Reading after Favorites, Why? Because I want to :P
list.insert(1, new SpecialListItem(QList<QVariant>() << "Reading" << 0));
return list;
@ -634,7 +634,7 @@ void ReadingListModel::setupLabels(QSqlDatabase &db)
<< selectQuery.value(ordering)));
}
//TEST
// TEST
// INSERT INTO label (name, color, ordering) VALUES ("Oh Oh", "red", 1);
// INSERT INTO label (name, color, ordering) VALUES ("lalala", "orange", 2);
@ -652,15 +652,15 @@ void ReadingListModel::setupLabels(QSqlDatabase &db)
void ReadingListModel::setupReadingLists(QSqlDatabase &db)
{
//setup root item
// setup root item
rootItem = new ReadingListItem(QList<QVariant>() << "ROOT" << 0 << true << false);
QSqlQuery selectQuery("select * from reading_list order by parentId IS NULL DESC", db);
//setup reading lists
// setup reading lists
setupReadingListsData(selectQuery, rootItem);
//TEST
// TEST
// ReadingListItem * node1;
// rootItem->appendChild(node1 = new ReadingListItem(QList<QVariant>() /*<< 0*/ << "My reading list" << "atr"));
// rootItem->appendChild(new ReadingListItem(QList<QVariant>() /*<< 0*/ << "X timeline" << "atr"));
@ -679,7 +679,7 @@ int ReadingListModel::addLabelIntoList(LabelItem *item)
i++;
if (i < labels.count()) {
if (labels.at(i)->colorid() == item->colorid()) //sort by name
if (labels.at(i)->colorid() == item->colorid()) // sort by name
{
while (i < labels.count() && labels.at(i)->colorid() == item->colorid() && naturalSortLessThanCI(labels.at(i)->name(), item->name()))
i++;
@ -720,7 +720,7 @@ void ReadingListModel::reorderingChildren(QList<ReadingListItem *> children)
bool ReadingListModel::rowIsSpecialList(int row, const QModelIndex &parent) const
{
if (parent.isValid())
return false; //by now no sublists in special list
return false; // by now no sublists in special list
if (row >= 0 && row < specialLists.count())
return true;
@ -731,7 +731,7 @@ bool ReadingListModel::rowIsSpecialList(int row, const QModelIndex &parent) cons
bool ReadingListModel::rowIsLabel(int row, const QModelIndex &parent) const
{
if (parent.isValid())
return false; //by now no sublists in labels
return false; // by now no sublists in labels
if (row > specialLists.count() && row <= specialLists.count() + labels.count())
return true;
@ -742,7 +742,7 @@ bool ReadingListModel::rowIsLabel(int row, const QModelIndex &parent) const
bool ReadingListModel::rowIsReadingList(int row, const QModelIndex &parent) const
{
if (parent.isValid())
return true; //only lists with sublists
return true; // only lists with sublists
int separatorsCount = labels.isEmpty() ? 1 : 2;
@ -755,7 +755,7 @@ bool ReadingListModel::rowIsReadingList(int row, const QModelIndex &parent) cons
bool ReadingListModel::rowIsSeparator(int row, const QModelIndex &parent) const
{
if (parent.isValid())
return false; //only separators at top level
return false; // only separators at top level
if (row == specialLists.count())
return true;

View File

@ -28,7 +28,7 @@ class ReadingListModel : public QAbstractItemModel
public:
explicit ReadingListModel(QObject *parent = nullptr);
//QAbstractItemModel methods
// QAbstractItemModel methods
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
@ -42,10 +42,10 @@ public:
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
QMimeData *mimeData(const QModelIndexList &indexes) const override;
//Convenience methods
// Convenience methods
void setupReadingListsData(QString path);
void addNewLabel(const QString &name, YACReader::LabelColors color);
void addReadingList(const QString &name); //top level reading list
void addReadingList(const QString &name); // top level reading list
void addReadingListAt(const QString &name, const QModelIndex &mi);
bool isEditable(const QModelIndex &mi);
bool isReadingList(const QModelIndex &mi);
@ -96,17 +96,17 @@ private:
bool dropComics(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
bool dropSublist(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
//Special lists
// Special lists
QList<SpecialListItem *> specialLists;
//Label
// Label
QList<LabelItem *> labels;
//Reading lists
// Reading lists
ReadingListItem *rootItem; //
QMap<unsigned long long int, ReadingListItem *> items; //lists relationship
QMap<unsigned long long int, ReadingListItem *> items; // lists relationship
//separators
// separators
ReadingListSeparatorItem *separator1;
ReadingListSeparatorItem *separator2;

View File

@ -25,7 +25,7 @@
#include "qnaturalsorting.h"
#include "QsLog.h"
//server
// server
YACReaderLibraries DBHelper::getLibraries()
{
@ -174,7 +174,7 @@ QString DBHelper::getFolderName(qulonglong libraryId, qulonglong id)
{
QSqlDatabase db = DataBaseManagement::loadDatabase(libraryPath + "/.yacreaderlibrary");
QSqlQuery selectQuery(db); //TODO check
QSqlQuery selectQuery(db); // TODO check
selectQuery.prepare("SELECT name FROM folder WHERE id = :id");
selectQuery.bindValue(":id", id);
selectQuery.exec();
@ -276,7 +276,7 @@ QList<ComicDB> DBHelper::getFavorites(qulonglong libraryId)
connectionName = db.connectionName();
}
//TODO ?
// TODO ?
QSqlDatabase::removeDatabase(connectionName);
return list;
@ -314,7 +314,7 @@ QList<ComicDB> DBHelper::getReading(qulonglong libraryId)
}
connectionName = db.connectionName();
}
//TODO ?
// TODO ?
QSqlDatabase::removeDatabase(connectionName);
return list;
@ -353,7 +353,7 @@ QList<ReadingList> DBHelper::getReadingLists(qulonglong libraryId)
}
connectionName = db.connectionName();
}
//TODO ?
// TODO ?
QSqlDatabase::removeDatabase(connectionName);
return list;
@ -435,14 +435,14 @@ QList<ComicDB> DBHelper::getReadingListFullContent(qulonglong libraryId, qulongl
connectionName = db.connectionName();
}
//TODO ?
// TODO ?
QSqlDatabase::removeDatabase(connectionName);
return list;
}
//objects management
//deletes
// objects management
// deletes
void DBHelper::removeFromDB(LibraryItem *item, QSqlDatabase &db)
{
if (item->isDir())
@ -497,7 +497,7 @@ void DBHelper::deleteComicsFromFavorites(const QList<ComicDB> &comicsList, QSqlD
db.commit();
}
//a.k.a set comics as unread by reverting the conditions used to load the comics -> void ComicModel::setupReadingModelData(const QString &databasePath)
// a.k.a set comics as unread by reverting the conditions used to load the comics -> void ComicModel::setupReadingModelData(const QString &databasePath)
void DBHelper::deleteComicsFromReading(const QList<ComicDB> &comicsList, QSqlDatabase &db)
{
db.transaction();
@ -506,7 +506,7 @@ void DBHelper::deleteComicsFromReading(const QList<ComicDB> &comicsList, QSqlDat
for (auto comic : comicsList) {
comic.info.hasBeenOpened = false;
comic.info.currentPage = 0; //update sets hasBeenOpened to true if currentPage > 0;
comic.info.currentPage = 0; // update sets hasBeenOpened to true if currentPage > 0;
DBHelper::update(&comic.info, db);
}
@ -550,12 +550,12 @@ void DBHelper::deleteComicsFromReadingList(const QList<ComicDB> &comicsList, qul
db.commit();
}
//updates
// updates
void DBHelper::update(ComicDB *comic, QSqlDatabase &db)
{
Q_UNUSED(comic)
Q_UNUSED(db)
//do nothing
// do nothing
}
void DBHelper::update(qulonglong libraryId, ComicInfo &comicInfo)
@ -612,7 +612,7 @@ void DBHelper::update(ComicInfo *comicInfo, QSqlDatabase &db)
"read = :read,"
"edited = :edited,"
//new 7.0 fields
// new 7.0 fields
"hasBeenOpened = :hasBeenOpened,"
"currentPage = :currentPage,"
@ -624,17 +624,17 @@ void DBHelper::update(ComicInfo *comicInfo, QSqlDatabase &db)
"gamma = :gamma,"
"rating = :rating,"
//new 7.1 fields
// new 7.1 fields
"comicVineID = :comicVineID,"
//new 9.5 fields
// new 9.5 fields
"lastTimeOpened = :lastTimeOpened,"
"coverSizeRatio = :coverSizeRatio,"
"originalCoverSize = :originalCoverSize,"
//--
//new 9.8 fields
// new 9.8 fields
"manga = :manga"
//--
" WHERE id = :id ");
@ -673,7 +673,7 @@ void DBHelper::update(ComicInfo *comicInfo, QSqlDatabase &db)
updateComicInfo.bindValue(":characters", comicInfo->characters);
updateComicInfo.bindValue(":notes", comicInfo->notes);
bool read = comicInfo->read || comicInfo->currentPage == comicInfo->numPages.toInt(); //if current page is the las page, the comic is read(completed)
bool read = comicInfo->read || comicInfo->currentPage == comicInfo->numPages.toInt(); // if current page is the las page, the comic is read(completed)
comicInfo->read = read;
updateComicInfo.bindValue(":read", read ? 1 : 0);
updateComicInfo.bindValue(":id", comicInfo->id);
@ -761,7 +761,7 @@ void DBHelper::updateChildrenInfo(qulonglong folderId, QSqlDatabase &db)
void DBHelper::updateChildrenInfo(QSqlDatabase &db)
{
QSqlQuery selectQuery(db); //TODO check
QSqlQuery selectQuery(db); // TODO check
selectQuery.prepare("SELECT id FROM folder");
selectQuery.exec();
@ -931,7 +931,7 @@ QMap<qulonglong, QList<ComicDB>> DBHelper::updateFromRemoteClient(const QMap<qul
if (comic.info.hash == comicInfo.hash) {
bool isMoreRecent = false;
//completion takes precedence over lastTimeOpened, if we just want to synchronize the lastest status we should use only lastTimeOpened
// completion takes precedence over lastTimeOpened, if we just want to synchronize the lastest status we should use only lastTimeOpened
if ((comic.info.currentPage > 1 && comic.info.currentPage > comicInfo.currentPage) || comic.info.hasBeenOpened || (comic.info.read && !comicInfo.read)) {
isMoreRecent = true;
}
@ -1140,7 +1140,7 @@ void DBHelper::reasignOrderToComicsInReadingList(qulonglong readingListId, QList
db.commit();
}
//inserts
// inserts
qulonglong DBHelper::insert(Folder *folder, QSqlDatabase &db)
{
QSqlQuery query(db);
@ -1169,7 +1169,7 @@ qulonglong DBHelper::insert(ComicDB *comic, QSqlDatabase &db, bool insertAllInfo
comic->_hasCover = false;
if (insertAllInfo) {
DBHelper::update(&(comic->info), db); //TODO use insert to insert all the info values, the common binding need to be extracted and shared between update and insert
DBHelper::update(&(comic->info), db); // TODO use insert to insert all the info values, the common binding need to be extracted and shared between update and insert
}
} else
comic->_hasCover = true;
@ -1291,12 +1291,12 @@ void DBHelper::insertComicsInReadingList(const QList<ComicDB> &comicsList, qulon
db.commit();
}
//queries
// queries
QList<LibraryItem *> DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDatabase &db, bool sort)
{
QList<LibraryItem *> list;
QSqlQuery selectQuery(db); //TODO check
QSqlQuery selectQuery(db); // TODO check
selectQuery.prepare("SELECT * FROM folder WHERE parentId = :parentId and id <> 1");
selectQuery.bindValue(":parentId", parentId);
selectQuery.exec();
@ -1312,7 +1312,7 @@ QList<LibraryItem *> DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDat
Folder *currentItem;
while (selectQuery.next()) {
//TODO sort by sort indicator and name
// TODO sort by sort indicator and name
currentItem = new Folder(selectQuery.value(id).toULongLong(), parentId, selectQuery.value(name).toString(), selectQuery.value(path).toString());
if (!selectQuery.value(numChildren).isNull() && selectQuery.value(numChildren).isValid())
@ -1335,7 +1335,7 @@ QList<LibraryItem *> DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDat
i--;
nameLast = (*i)->name;
}
if (lessThan >= 0) //si se ha encontrado un elemento menor que current, se inserta justo después
if (lessThan >= 0) // si se ha encontrado un elemento menor que current, se inserta justo después
list.insert(++i, currentItem);
else
list.insert(i, currentItem);
@ -1359,14 +1359,14 @@ QList<ComicDB> DBHelper::getSortedComicsFromParent(qulonglong parentId, QSqlData
QSqlRecord record = selectQuery.record();
int id = record.indexOf("id");
//int parentIdIndex = record.indexOf("parentId");
// int parentIdIndex = record.indexOf("parentId");
int fileName = record.indexOf("fileName");
int path = record.indexOf("path");
ComicDB currentItem;
while (selectQuery.next()) {
currentItem.id = selectQuery.value(id).toULongLong();
currentItem.parentId = parentId; //selectQuery.value(parentId).toULongLong();
currentItem.parentId = parentId; // selectQuery.value(parentId).toULongLong();
currentItem.name = selectQuery.value(fileName).toString();
currentItem.path = selectQuery.value(path).toString();
@ -1387,7 +1387,7 @@ QList<ComicDB> DBHelper::getSortedComicsFromParent(qulonglong parentId, QSqlData
}
});
//selectQuery.finish();
// selectQuery.finish();
return list;
}
QList<LibraryItem *> DBHelper::getComicsFromParent(qulonglong parentId, QSqlDatabase &db, bool sort)
@ -1432,7 +1432,7 @@ QList<Label> DBHelper::getLabels(qulonglong libraryId)
{
QSqlDatabase db = DataBaseManagement::loadDatabase(libraryPath + "/.yacreaderlibrary");
QSqlQuery selectQuery("SELECT * FROM label ORDER BY ordering,name", db); //TODO add some kind of
QSqlQuery selectQuery("SELECT * FROM label ORDER BY ordering,name", db); // TODO add some kind of
QSqlRecord record = selectQuery.record();
int name = record.indexOf("name");
@ -1453,7 +1453,7 @@ QList<Label> DBHelper::getLabels(qulonglong libraryId)
i++;
if (i < labels.count()) {
if (labels.at(i).getColorID() == item.getColorID()) //sort by name
if (labels.at(i).getColorID() == item.getColorID()) // sort by name
{
while (i < labels.count() && labels.at(i).getColorID() == item.getColorID() && naturalSortLessThanCI(labels.at(i).getName(), item.getName()))
i++;
@ -1492,7 +1492,7 @@ void DBHelper::updateFolderTreeManga(qulonglong id, QSqlDatabase &db, bool manga
updateComicInfo.exec();
QSqlQuery getSubFoldersQuery(db);
getSubFoldersQuery.prepare("SELECT id FROM folder WHERE parentId = :parentId AND id <> 1"); //do not select the root folder
getSubFoldersQuery.prepare("SELECT id FROM folder WHERE parentId = :parentId AND id <> 1"); // do not select the root folder
getSubFoldersQuery.bindValue(":parentId", id);
getSubFoldersQuery.exec();
@ -1503,7 +1503,7 @@ void DBHelper::updateFolderTreeManga(qulonglong id, QSqlDatabase &db, bool manga
}
}
//loads
// loads
Folder DBHelper::loadFolder(qulonglong id, QSqlDatabase &db)
{
Folder folder;
@ -1533,17 +1533,17 @@ Folder DBHelper::loadFolder(qulonglong id, QSqlDatabase &db)
folder.path = query.value(path).toString();
folder.knownId = true;
//new 7.1
// new 7.1
folder.setFinished(query.value(finished).toBool());
folder.setCompleted(query.value(completed).toBool());
//new 9.5
// new 9.5
if (!query.value(numChildren).isNull() && query.value(numChildren).isValid())
folder.setNumChildren(query.value(numChildren).toInt());
folder.setFirstChildHash(query.value(firstChildHash).toString());
folder.setCustomImage(query.value(customImage).toString());
//new 9.8
// new 9.8
folder.setManga(query.value(manga).toBool());
}
@ -1579,17 +1579,17 @@ Folder DBHelper::loadFolder(const QString &folderName, qulonglong parentId, QSql
folder.path = query.value(path).toString();
folder.knownId = true;
//new 7.1
// new 7.1
folder.setFinished(query.value(finished).toBool());
folder.setCompleted(query.value(completed).toBool());
//new 9.5
// new 9.5
if (!query.value(numChildren).isNull() && query.value(numChildren).isValid())
folder.setNumChildren(query.value(numChildren).toInt());
folder.setFirstChildHash(query.value(firstChildHash).toString());
folder.setCustomImage(query.value(customImage).toString());
//new 9.8
// new 9.8
folder.setManga(query.value(manga).toBool());
}
@ -1627,7 +1627,7 @@ ComicDB DBHelper::loadComic(QString cname, QString cpath, QString chash, QSqlDat
{
ComicDB comic;
//comic.parentId = cparentId;
// comic.parentId = cparentId;
comic.name = cname;
comic.path = cpath;
@ -1669,7 +1669,7 @@ ComicInfo DBHelper::getComicInfoFromQuery(QSqlQuery &query, const QString &idKey
int read = record.indexOf("read");
int edited = record.indexOf("edited");
//new 7.0 fields
// new 7.0 fields
int hasBeenOpened = record.indexOf("hasBeenOpened");
int currentPage = record.indexOf("currentPage");
int bookmark1 = record.indexOf("bookmark1");
@ -1729,7 +1729,7 @@ ComicInfo DBHelper::getComicInfoFromQuery(QSqlQuery &query, const QString &idKey
comicInfo.read = query.value(read).toBool();
comicInfo.edited = query.value(edited).toBool();
//new 7.0 fields
// new 7.0 fields
comicInfo.hasBeenOpened = query.value(hasBeenOpened).toBool();
comicInfo.currentPage = query.value(currentPage).toInt();
comicInfo.bookmark1 = query.value(bookmark1).toInt();
@ -1775,14 +1775,14 @@ ComicInfo DBHelper::getComicInfoFromQuery(QSqlQuery &query, const QString &idKey
comicInfo.comicVineID = query.value(comicVineID);
//new 9.5 fields
// new 9.5 fields
comicInfo.lastTimeOpened = query.value(lastTimeOpened);
comicInfo.coverSizeRatio = query.value(coverSizeRatio);
comicInfo.originalCoverSize = query.value(originalCoverSize);
//--
//new 9.8 fields
// new 9.8 fields
comicInfo.manga = query.value(manga);
//--
@ -1795,7 +1795,7 @@ QList<QString> DBHelper::loadSubfoldersNames(qulonglong folderId, QSqlDatabase &
{
QList<QString> result;
QSqlQuery selectQuery(db);
selectQuery.prepare("SELECT name FROM folder WHERE parentId = :parentId AND id <> 1"); //do not select the root folder
selectQuery.prepare("SELECT name FROM folder WHERE parentId = :parentId AND id <> 1"); // do not select the root folder
selectQuery.bindValue(":parentId", folderId);
selectQuery.exec();

View File

@ -20,7 +20,7 @@ class ReadingList;
class DBHelper
{
public:
//server
// server
static YACReaderLibraries getLibraries();
static QList<LibraryItem *> getFolderSubfoldersFromLibrary(qulonglong libraryId, qulonglong folderId);
static QList<LibraryItem *> getFolderComicsFromLibrary(qulonglong libraryId, qulonglong folderId);
@ -39,19 +39,19 @@ public:
static QList<ReadingList> getReadingLists(qulonglong libraryId);
static QList<ComicDB> getReadingListFullContent(qulonglong libraryId, qulonglong readingListId, bool getFullComicInfoFields = false);
//objects management
//deletes
// objects management
// deletes
static void removeFromDB(LibraryItem *item, QSqlDatabase &db);
static void removeFromDB(Folder *folder, QSqlDatabase &db);
static void removeFromDB(ComicDB *comic, QSqlDatabase &db);
static void removeLabelFromDB(qulonglong id, QSqlDatabase &db);
static void removeListFromDB(qulonglong id, QSqlDatabase &db);
//logic deletes
// logic deletes
static void deleteComicsFromFavorites(const QList<ComicDB> &comicsList, QSqlDatabase &db);
static void deleteComicsFromReading(const QList<ComicDB> &comicsList, QSqlDatabase &db);
static void deleteComicsFromLabel(const QList<ComicDB> &comicsList, qulonglong labelId, QSqlDatabase &db);
static void deleteComicsFromReadingList(const QList<ComicDB> &comicsList, qulonglong readingListId, QSqlDatabase &db);
//inserts
// inserts
static qulonglong insert(Folder *folder, QSqlDatabase &db);
static qulonglong insert(ComicDB *comic, QSqlDatabase &db, bool insertAllInfo);
static qulonglong insertLabel(const QString &name, YACReader::LabelColors color, QSqlDatabase &db);
@ -60,7 +60,7 @@ public:
static void insertComicsInFavorites(const QList<ComicDB> &comicsList, QSqlDatabase &db);
static void insertComicsInLabel(const QList<ComicDB> &comicsList, qulonglong labelId, QSqlDatabase &db);
static void insertComicsInReadingList(const QList<ComicDB> &comicsList, qulonglong readingListId, QSqlDatabase &db);
//updates
// updates
static void update(qulonglong libraryId, ComicInfo &comicInfo);
static void update(ComicDB *comics, QSqlDatabase &db);
static void update(ComicInfo *comicInfo, QSqlDatabase &db);
@ -90,7 +90,7 @@ public:
static void updateFolderTreeManga(qulonglong id, QSqlDatabase &db, bool manga);
//load
// load
static Folder loadFolder(qulonglong id, QSqlDatabase &db);
static Folder loadFolder(const QString &folderName, qulonglong parentId, QSqlDatabase &db);
static ComicDB loadComic(qulonglong id, QSqlDatabase &db);
@ -98,7 +98,7 @@ public:
static ComicInfo loadComicInfo(QString hash, QSqlDatabase &db);
static ComicInfo getComicInfoFromQuery(QSqlQuery &query, const QString &idKey = "id");
static QList<QString> loadSubfoldersNames(qulonglong folderId, QSqlDatabase &db);
//queries
// queries
static bool isFavoriteComic(qulonglong id, QSqlDatabase &db);
};

View File

@ -53,7 +53,7 @@ public:
painter->restore();
//TODO add mouse hover style ??
// TODO add mouse hover style ??
}
QSize sizeHint(const QStyleOptionViewItem &option,
@ -146,7 +146,7 @@ void EmptyFolderWidget::onItemClicked(const QModelIndex &mi)
emit subfolderSelected(parent, mi.row());
}
//TODO remove repeated code in drag & drop support....
// TODO remove repeated code in drag & drop support....
void EmptyFolderWidget::dragEnterEvent(QDragEnterEvent *event)
{
QList<QUrl> urlList;
@ -155,7 +155,7 @@ void EmptyFolderWidget::dragEnterEvent(QDragEnterEvent *event)
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)
// 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();

View File

@ -13,7 +13,7 @@ public:
signals:
void subfolderSelected(QModelIndex, int);
//Drops
// Drops
void copyComicsToCurrentFolder(QList<QPair<QString, QString>>);
void moveComicsToCurrentFolder(QList<QPair<QString, QString>>);
@ -26,7 +26,7 @@ protected:
QStringListModel *subfoldersModel;
QString backgroundColor;
//Drop to import
// Drop to import
void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override;
};

View File

@ -7,7 +7,7 @@ EmptyLabelWidget::EmptyLabelWidget(QWidget *parent)
iconLabel->setPixmap(QPixmap(":/images/empty_label.png"));
//titleLabel->setText(tr("This label doesn't contain comics yet") + QString("<p style='color:rgb(150,150,150);font-size:14px;font-weight:normal;'>%1</p>").arg(tr("Drag and drop folders and comics here")));
// titleLabel->setText(tr("This label doesn't contain comics yet") + QString("<p style='color:rgb(150,150,150);font-size:14px;font-weight:normal;'>%1</p>").arg(tr("Drag and drop folders and comics here")));
titleLabel->setText(tr("This label doesn't contain comics yet"));
}

View File

@ -31,7 +31,7 @@ ExportComicsInfoDialog::ExportComicsInfoDialog(QWidget *parent)
libraryLayout->addWidget(textLabel);
libraryLayout->addWidget(path);
libraryLayout->addWidget(find);
libraryLayout->setStretchFactor(find, 0); //TODO
libraryLayout->setStretchFactor(find, 0); // TODO
auto bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();

View File

@ -28,7 +28,7 @@ ExportLibraryDialog::ExportLibraryDialog(QWidget *parent)
libraryLayout->addWidget(textLabel);
libraryLayout->addWidget(path);
libraryLayout->addWidget(find);
libraryLayout->setStretchFactor(find, 0); //TODO
libraryLayout->setStretchFactor(find, 0); // TODO
auto bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();

View File

@ -14,20 +14,20 @@
#include "yacreader_comic_info_helper.h"
#include "current_comic_view_helper.h"
//values relative to visible cells
// values relative to visible cells
const unsigned int YACREADER_MIN_GRID_ZOOM_WIDTH = 156;
const unsigned int YACREADER_MAX_GRID_ZOOM_WIDTH = 312;
//GridView cells
// GridView cells
const unsigned int YACREADER_MIN_CELL_CUSTOM_HEIGHT = 295;
const unsigned int YACREADER_MIN_CELL_CUSTOM_WIDTH = 185;
//Covers
// Covers
const unsigned int YACREADER_MAX_COVER_HEIGHT = 236;
const unsigned int YACREADER_MIN_COVER_WIDTH = YACREADER_MIN_GRID_ZOOM_WIDTH;
//visible cells (realCell in qml), grid cells size is used to create faux inner margings
const unsigned int YACREADER_MIN_ITEM_HEIGHT = YACREADER_MAX_COVER_HEIGHT + 51; //51 is the height of the bottom rectangle used for title and other info
// visible cells (realCell in qml), grid cells size is used to create faux inner margings
const unsigned int YACREADER_MIN_ITEM_HEIGHT = YACREADER_MAX_COVER_HEIGHT + 51; // 51 is the height of the bottom rectangle used for title and other info
const unsigned int YACREADER_MIN_ITEM_WIDTH = YACREADER_MIN_COVER_WIDTH;
GridComicsView::GridComicsView(QWidget *parent)
@ -50,7 +50,7 @@ GridComicsView::GridComicsView(QWidget *parent)
}
});
//view->setFocusPolicy(Qt::TabFocus);
// view->setFocusPolicy(Qt::TabFocus);
selectionHelper = new YACReaderComicsSelectionHelper(this);
connect(selectionHelper, &YACReaderComicsSelectionHelper::selectionChanged, this, &GridComicsView::dummyUpdater);
@ -74,12 +74,12 @@ GridComicsView::GridComicsView(QWidget *parent)
ctxt->setContextProperty("borderColor", "#DBDBDB");
ctxt->setContextProperty("titleColor", "#121212");
ctxt->setContextProperty("textColor", "#636363");
//fonts settings
// fonts settings
ctxt->setContextProperty("fontSize", 11);
ctxt->setContextProperty("fontFamily", QApplication::font().family());
ctxt->setContextProperty("fontSpacing", 0.5);
//info - copy/pasted from info_comics_view TODO create helpers for setting the UI config
// info - copy/pasted from info_comics_view TODO create helpers for setting the UI config
ctxt->setContextProperty("infoBackgroundColor", "#FFFFFF");
ctxt->setContextProperty("topShadow", QUrl());
ctxt->setContextProperty("infoShadow", "info-shadow-light.png");
@ -105,7 +105,7 @@ GridComicsView::GridComicsView(QWidget *parent)
ctxt->setContextProperty("titleColor", "#FFFFFF");
ctxt->setContextProperty("textColor", "#A8A8A8");
ctxt->setContextProperty("dropShadow", false);
//fonts settings
// fonts settings
int fontSize = QApplication::font().pointSize();
if (fontSize == -1)
fontSize = QApplication::font().pixelSize();
@ -113,7 +113,7 @@ GridComicsView::GridComicsView(QWidget *parent)
ctxt->setContextProperty("fontFamily", QApplication::font().family());
ctxt->setContextProperty("fontSpacing", 0.5);
//info - copy/pasted from info_comics_view TODO create helpers for setting the UI config
// info - copy/pasted from info_comics_view TODO create helpers for setting the UI config
ctxt->setContextProperty("infoBackgroundColor", "#2E2E2E");
ctxt->setContextProperty("topShadow", "info-top-shadow.png");
ctxt->setContextProperty("infoShadow", "info-shadow.png");
@ -172,7 +172,7 @@ GridComicsView::GridComicsView(QWidget *parent)
showInfoAction->setChecked(showInfo);
connect(showInfoAction, &QAction::toggled, this, &GridComicsView::showInfo);
setShowMarks(true); //TODO save this in settings
setShowMarks(true); // TODO save this in settings
auto l = new QVBoxLayout;
l->addWidget(view);
@ -211,7 +211,7 @@ void GridComicsView::createCoverSizeSliderWidget()
horizontalLayout->setMargin(0);
coverSizeSliderWidget->setLayout(horizontalLayout);
//TODO add shortcuts (ctrl-+ and ctrl-- for zooming in out, + ctrl-0 for reseting the zoom)
// TODO add shortcuts (ctrl-+ and ctrl-- for zooming in out, + ctrl-0 for reseting the zoom)
connect(coverSizeSlider, &QAbstractSlider::valueChanged, this, &GridComicsView::setCoversSize);
@ -275,8 +275,8 @@ void GridComicsView::setModel(ComicModel *model)
updateInfoForIndex(0);
}
//If the currentComicView was hidden before showing it sometimes the scroll view doesn't show it
//this is a hacky solution...
// If the currentComicView was hidden before showing it sometimes the scroll view doesn't show it
// this is a hacky solution...
QTimer::singleShot(0, this, &GridComicsView::resetScroll);
}
@ -287,7 +287,7 @@ void GridComicsView::updateBackgroundConfig()
QQmlContext *ctxt = view->rootContext();
//backgroun image configuration
// backgroun image configuration
bool useBackgroundImage = settings->value(USE_BACKGROUND_IMAGE_IN_GRID_VIEW, true).toBool();
if (useBackgroundImage && this->model->rowCount() > 0) {
@ -467,7 +467,7 @@ void GridComicsView::setCurrentComicIfNeeded()
ctxt->setContextProperty("currentComic", &currentComic);
ctxt->setContextProperty("currentComicInfo", &(currentComic.info));
ctxt->setContextProperty("showCurrentComic", false);
//ctxt->setContextProperty("currentComic", nullptr);
// ctxt->setContextProperty("currentComic", nullptr);
}
}
@ -505,7 +505,7 @@ void GridComicsView::startDrag()
{
auto drag = new QDrag(this);
drag->setMimeData(model->mimeData(selectionHelper->selectedRows()));
drag->setPixmap(QPixmap(":/images/comics_view_toolbar/openInYACReader.png")); //TODO add better image
drag->setPixmap(QPixmap(":/images/comics_view_toolbar/openInYACReader.png")); // TODO add better image
/*Qt::DropAction dropAction =*/drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
}
@ -515,7 +515,7 @@ bool GridComicsView::canDropUrls(const QList<QUrl> &urls, Qt::DropAction action)
if (action == Qt::CopyAction) {
QString currentPath;
foreach (QUrl url, urls) {
//comics or folders are accepted, folders' content is validate in dropEvent (avoid any lag before droping)
// 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())
return true;
@ -531,7 +531,7 @@ bool GridComicsView::canDropFormats(const QString &formats)
void GridComicsView::droppedFiles(const QList<QUrl> &urls, Qt::DropAction action)
{
bool validAction = action == Qt::CopyAction; //TODO add move
bool validAction = action == Qt::CopyAction; // TODO add move
if (validAction) {
QList<QPair<QString, QString>> droppedFiles = ComicFilesManager::getDroppedFiles(urls);
@ -577,7 +577,7 @@ void GridComicsView::closeEvent(QCloseEvent *event)
event->accept();
ComicsView::closeEvent(event);
//save settings
// save settings
settings->setValue(COMICS_GRID_COVER_SIZES, coverSizeSlider->value());
settings->setValue(COMICS_GRID_SHOW_INFO, showInfoAction->isChecked());
settings->setValue(COMICS_GRID_INFO_WIDTH, infoWidth);

View File

@ -36,7 +36,7 @@ public:
void focusComicsNavigation(Qt::FocusReason reason) override;
public slots:
//ComicsView
// ComicsView
void setShowMarks(bool show) override;
void selectAll() override;
void selectIndex(int index) override;
@ -48,24 +48,24 @@ public slots:
protected slots:
void setCurrentIndex(int index);
//QML - double clicked item
// QML - double clicked item
void selectedItem(int index);
//QML - rating
// QML - rating
void rate(int index, int rating);
//QML - dragManager
// QML - dragManager
void startDrag();
//QML - dropManager
// QML - dropManager
bool canDropUrls(const QList<QUrl> &urls, Qt::DropAction action);
bool canDropFormats(const QString &formats);
void droppedFiles(const QList<QUrl> &urls, Qt::DropAction action);
void droppedComicsForResortingAt(const QString &data, int index);
//QML - context menu
// QML - context menu
void requestedContextMenu(const QPoint &point);
void setCoversSize(int width);
void dummyUpdater(); //TODO remove this
void dummyUpdater(); // TODO remove this
void setCurrentComicIfNeeded();

View File

@ -23,7 +23,7 @@ ImportComicsInfoDialog::ImportComicsInfoDialog(QWidget *parent)
cancel = new QPushButton(tr("Cancel"));
connect(cancel, &QAbstractButton::clicked, this, &ImportComicsInfoDialog::close);
//connect(cancel,SIGNAL(clicked()),this,SIGNAL(rejected()));
// connect(cancel,SIGNAL(clicked()),this,SIGNAL(rejected()));
find = new QPushButton(QIcon(":/images/find_folder.png"), "");
connect(find, &QAbstractButton::clicked, this, &ImportComicsInfoDialog::findPath);
@ -33,7 +33,7 @@ ImportComicsInfoDialog::ImportComicsInfoDialog(QWidget *parent)
libraryLayout->addWidget(textLabel);
libraryLayout->addWidget(path);
libraryLayout->addWidget(find);
libraryLayout->setStretchFactor(find, 0); //TODO
libraryLayout->setStretchFactor(find, 0); // TODO
progressBar = new QProgressBar(this);
progressBar->setMinimum(0);

View File

@ -33,7 +33,7 @@ void ImportLibraryDialog::setupUI()
cancel = new QPushButton(tr("Cancel"));
connect(cancel, &QAbstractButton::clicked, this, &ImportLibraryDialog::close);
//connect(cancel,SIGNAL(clicked()),this,SIGNAL(rejected()));
// connect(cancel,SIGNAL(clicked()),this,SIGNAL(rejected()));
find = new QPushButton(QIcon(":/images/find_folder.png"), "");
connect(find, &QAbstractButton::clicked, this, &ImportLibraryDialog::findPath);
@ -49,12 +49,12 @@ void ImportLibraryDialog::setupUI()
content->addWidget(textLabel, 1, 0);
content->addWidget(path, 1, 1);
content->addWidget(find, 1, 2);
content->setColumnStretch(2, 0); //TODO
content->setColumnStretch(2, 0); // TODO
content->addWidget(destLabel, 2, 0);
content->addWidget(destPath, 2, 1);
content->addWidget(findDest, 2, 2);
//destLayout->setStretchFactor(findDest,0); //TODO
// destLayout->setStretchFactor(findDest,0); //TODO
auto bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();
@ -69,7 +69,7 @@ void ImportLibraryDialog::setupUI()
auto mainLayout = new QVBoxLayout;
mainLayout->addLayout(content);
//mainLayout->addWidget(progress = new QLabel());
// mainLayout->addWidget(progress = new QLabel());
mainLayout->addStretch();
mainLayout->addWidget(progressBar);
mainLayout->addLayout(bottomLayout);

View File

@ -10,7 +10,7 @@
#include <QScrollBar>
#include <QGraphicsItemAnimation>
#include <QTimeLine>
//TODO: is QGLWidget needed here???
// TODO: is QGLWidget needed here???
//#include <QGLWidget>
#include <QTimer>
#include <QElapsedTimer>
@ -51,27 +51,27 @@ YACReaderActivityIndicatorWidget::YACReaderActivityIndicatorWidget(QWidget *pare
layout->setMargin(4);
layout->setSpacing(0);
//setFixedHeight(3);
//resize(579,3);
// setFixedHeight(3);
// resize(579,3);
glow->setGeometry(4, 4, glowLine.width(), glowLine.height());
//normal->setGeometry(0,1,579,1);
// normal->setGeometry(0,1,579,1);
auto effect = new QGraphicsOpacityEffect();
//effect->setOpacity(1.0);
// effect->setOpacity(1.0);
auto *animation = new QPropertyAnimation(effect, "opacity", this);
animation->setDuration(1000);
animation->setStartValue(1);
animation->setEndValue(0);
//animation->setEasingCurve(QEasingCurve::InQuint);
// animation->setEasingCurve(QEasingCurve::InQuint);
auto *animation2 = new QPropertyAnimation(effect, "opacity", this);
animation2->setDuration(1000);
animation2->setStartValue(0);
animation2->setEndValue(1);
//animation2->setEasingCurve(QEasingCurve::InQuint);
// animation2->setEasingCurve(QEasingCurve::InQuint);
glow->setGraphicsEffect(effect);
@ -115,7 +115,7 @@ ImportWidget::ImportWidget(QWidget *parent)
coversViewContainer->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum);
coversView = new QGraphicsView();
//coversView->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
// coversView->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
coversView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
coversView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
coversView->setMaximumHeight(300);
@ -199,12 +199,12 @@ ImportWidget::ImportWidget(QWidget *parent)
layout->addWidget(coversLabel, 0, Qt::AlignHCenter);
layout->addWidget(coversViewContainer);
//layout->addStretch();
// layout->addStretch();
layout->addWidget(currentComicLabel, 0, Qt::AlignHCenter);
layout->setContentsMargins(0, layout->contentsMargins().top(), 0, layout->contentsMargins().bottom());
connect(stop, &QAbstractButton::clicked, this, &ImportWidget::stop);
//connect(stop,SIGNAL(clicked()),this,SLOT(addCoverTest()));
// connect(stop,SIGNAL(clicked()),this,SLOT(addCoverTest()));
previousWidth = 0;
updatingCovers = false;
@ -219,7 +219,7 @@ void ImportWidget::newComic(const QString &path, const QString &coverPath)
currentComicLabel->setText("<font color=\"#565959\">" + path + "</font>");
if (((elapsedTimer->elapsed() >= 1100) || ((previousWidth < coversView->width()) && (elapsedTimer->elapsed() >= 500))) && scrollAnimation->state() != QAbstractAnimation::Running) //todo elapsed time
if (((elapsedTimer->elapsed() >= 1100) || ((previousWidth < coversView->width()) && (elapsedTimer->elapsed() >= 500))) && scrollAnimation->state() != QAbstractAnimation::Running) // todo elapsed time
{
updatingCovers = true;
elapsedTimer->start();
@ -236,7 +236,7 @@ void ImportWidget::newComic(const QString &path, const QString &coverPath)
foreach (QGraphicsItem *itemToRemove, coversScene->items()) {
auto last = dynamic_cast<QGraphicsPixmapItem *>(itemToRemove);
if ((last->pos().x() + last->pixmap().width()) < coversView->horizontalScrollBar()->value()) //TODO check this
if ((last->pos().x() + last->pixmap().width()) < coversView->horizontalScrollBar()->value()) // TODO check this
{
coversScene->removeItem(last);
delete last;
@ -307,7 +307,7 @@ void ImportWidget::clear()
{
previousWidth = 0;
//nos aseguramos de que las animaciones han finalizado antes de borrar
// nos aseguramos de que las animaciones han finalizado antes de borrar
QList<QGraphicsItem *> all = coversScene->items();
for (int i = 0; i < all.size(); i++) {
QGraphicsItem *gi = all[i];

View File

@ -29,7 +29,7 @@ InfoComicsView::InfoComicsView(QWidget *parent)
}
});
//container->setFocusPolicy(Qt::StrongFocus);
// container->setFocusPolicy(Qt::StrongFocus);
QQmlContext *ctxt = view->rootContext();
@ -230,7 +230,7 @@ bool InfoComicsView::canDropUrls(const QList<QUrl> &urls, Qt::DropAction action)
if (action == Qt::CopyAction) {
QString currentPath;
foreach (QUrl url, urls) {
//comics or folders are accepted, folders' content is validate in dropEvent (avoid any lag before droping)
// 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())
return true;
@ -241,7 +241,7 @@ bool InfoComicsView::canDropUrls(const QList<QUrl> &urls, Qt::DropAction action)
void InfoComicsView::droppedFiles(const QList<QUrl> &urls, Qt::DropAction action)
{
bool validAction = action == Qt::CopyAction; //TODO add move
bool validAction = action == Qt::CopyAction; // TODO add move
if (validAction) {
QList<QPair<QString, QString>> droppedFiles = ComicFilesManager::getDroppedFiles(urls);

View File

@ -18,7 +18,7 @@ InitialComicInfoExtractor::InitialComicInfoExtractor(QString fileSource, QString
void InitialComicInfoExtractor::extract()
{
QFileInfo fi(_fileSource);
if (!fi.exists()) //TODO: error file not found.
if (!fi.exists()) // TODO: error file not found.
{
_cover.load(":/images/notCover.png");
QLOG_WARN() << "Extracting cover: file not found " << _fileSource;
@ -30,9 +30,9 @@ void InitialComicInfoExtractor::extract()
MacOSXPDFComic *pdfComic = new MacOSXPDFComic();
if (!pdfComic->openComic(_fileSource)) {
delete pdfComic;
//QImage p;
//p.load(":/images/notCover.png");
//p.save(_target);
// QImage p;
// p.load(":/images/notCover.png");
// p.save(_target);
return;
}
#elif defined USE_PDFIUM
@ -47,15 +47,15 @@ void InitialComicInfoExtractor::extract()
if (!pdfComic) {
QLOG_WARN() << "Extracting cover: unable to open PDF file " << _fileSource;
//delete pdfComic; //TODO check if the delete is needed
// delete pdfComic; //TODO check if the delete is needed
pdfComic = 0;
//QImage p;
//p.load(":/images/notCover.png");
//p.save(_target);
// QImage p;
// p.load(":/images/notCover.png");
// p.save(_target);
return;
}
#if !defined USE_PDFKIT && !defined USE_PDFIUM
//poppler only, not mac
// poppler only, not mac
if (pdfComic->isLocked()) {
QLOG_WARN() << "Extracting cover: unable to open PDF file " << _fileSource;
delete pdfComic;
@ -65,7 +65,7 @@ void InitialComicInfoExtractor::extract()
_numPages = pdfComic->numPages();
if (_numPages >= _coverPage) {
#if defined Q_OS_MAC || defined USE_PDFIUM
QImage p = pdfComic->getPage(_coverPage - 1); //TODO check if the page is valid
QImage p = pdfComic->getPage(_coverPage - 1); // TODO check if the page is valid
#else
QImage p = pdfComic->page(_coverPage - 1)->renderToImage(72, 72);
#endif //
@ -73,7 +73,7 @@ void InitialComicInfoExtractor::extract()
_coverSize = QPair<int, int>(p.width(), p.height());
if (_target != "") {
QImage scaled;
if (p.width() > p.height()) //landscape??
if (p.width() > p.height()) // landscape??
{
scaled = p.scaledToWidth(640, Qt::SmoothTransformation);
} else {
@ -82,15 +82,15 @@ void InitialComicInfoExtractor::extract()
scaled.save(_target, 0, 75);
} else if (_target != "") {
QLOG_WARN() << "Extracting cover: requested cover index greater than numPages " << _fileSource;
//QImage p;
//p.load(":/images/notCover.png");
//p.save(_target);
// QImage p;
// p.load(":/images/notCover.png");
// p.save(_target);
}
delete pdfComic;
}
return;
}
#endif //NO_PDF
#endif // NO_PDF
if (crash) {
return;
@ -108,7 +108,7 @@ void InitialComicInfoExtractor::extract()
QList<QString> order = archive.getFileNames();
//Try to find embeded XML info (ComicRack or ComicTagger)
// Try to find embeded XML info (ComicRack or ComicTagger)
auto infoIndex = 0;
for (auto &fileName : order) {
@ -126,7 +126,7 @@ void InitialComicInfoExtractor::extract()
return;
}
//se filtran para obtener sólo los formatos soportados
// se filtran para obtener sólo los formatos soportados
QList<QString> fileNames = FileComic::filter(order);
_numPages = fileNames.size();
if (_numPages == 0) {
@ -152,7 +152,7 @@ void InitialComicInfoExtractor::extract()
if (p.loadFromData(archive.getRawDataAtIndex(index))) {
_coverSize = QPair<int, int>(p.width(), p.height());
QImage scaled;
if (p.width() > p.height()) //landscape??
if (p.width() > p.height()) // landscape??
{
scaled = p.scaledToWidth(640, Qt::SmoothTransformation);
} else {
@ -161,8 +161,8 @@ void InitialComicInfoExtractor::extract()
scaled.save(_target, 0, 75);
} else {
QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource;
//p.load(":/images/notCover.png");
//p.save(_target);
// p.load(":/images/notCover.png");
// p.save(_target);
}
}
}

View File

@ -56,12 +56,12 @@ void LibraryCreator::updateFolder(const QString &source, const QString &target,
relativeFolderPath = relativeFolderPath.remove(QDir::cleanPath(source));
if (relativeFolderPath.startsWith("/")) {
relativeFolderPath = relativeFolderPath.remove(0, 1); //remove firts '/'
relativeFolderPath = relativeFolderPath.remove(0, 1); // remove firts '/'
}
QStringList folders;
if (!relativeFolderPath.isEmpty()) //updating root
if (!relativeFolderPath.isEmpty()) // updating root
{
folders = relativeFolderPath.split('/');
}
@ -95,7 +95,7 @@ void LibraryCreator::processLibrary(const QString &source, const QString &target
_source = source;
_target = target;
if (DataBaseManagement::checkValidDB(target + "/library.ydb") == "") {
//se limpia el directorio ./yacreaderlibrary
// se limpia el directorio ./yacreaderlibrary
QDir d(target);
d.removeRecursively();
_mode = CREATOR;
@ -109,7 +109,7 @@ void LibraryCreator::run()
{
stopRunning = false;
#ifndef use_unarr
//check for 7z lib
// check for 7z lib
#if defined Q_OS_UNIX && !defined Q_OS_MAC
QLibrary *sevenzLib = new QLibrary(QString(LIBDIR) + "/p7zip/7z.so");
#else
@ -127,11 +127,11 @@ void LibraryCreator::run()
QLOG_INFO() << "Starting to create new library ( " << _source << "," << _target << ")";
_currentPathFolders.clear();
_currentPathFolders.append(Folder(1, 1, "root", "/"));
//se crean los directorios .yacreaderlibrary y .yacreaderlibrary/covers
// se crean los directorios .yacreaderlibrary y .yacreaderlibrary/covers
QDir dir;
dir.mkpath(_target + "/covers");
//se crea la base de datos .yacreaderlibrary/library.ydb
// se crea la base de datos .yacreaderlibrary/library.ydb
{
auto _database = DataBaseManagement::createDatabase("library", _target); //
_databaseConnection = _database.connectionName();
@ -145,7 +145,7 @@ void LibraryCreator::run()
/*QSqlQuery pragma("PRAGMA foreign_keys = ON",_database);*/
_database.transaction();
//se crea la librería
// se crea la librería
create(QDir(_source));
DBHelper::updateChildrenInfo(_database);
@ -196,7 +196,7 @@ void LibraryCreator::run()
QSqlDatabase::removeDatabase(_databaseConnection);
//si estabamos en modo creación, se está añadiendo una librería que ya existía y se ha actualizado antes de añadirse.
// si estabamos en modo creación, se está añadiendo una librería que ya existía y se ha actualizado antes de añadirse.
if (!partialUpdate) {
if (!creation) {
emit(updated());
@ -206,11 +206,11 @@ void LibraryCreator::run()
}
QLOG_INFO() << "Update library END";
}
//msleep(100);//TODO try to solve the problem with the udpate dialog (ya no se usa más...)
// msleep(100);//TODO try to solve the problem with the udpate dialog (ya no se usa más...)
if (partialUpdate) {
emit updatedCurrentFolder(folderDestinationModelIndex);
emit finished();
} else //TODO check this part!!
} else // TODO check this part!!
emit finished();
creation = false;
}
@ -221,7 +221,7 @@ void LibraryCreator::stop()
stopRunning = true;
}
//retorna el id del ultimo de los folders
// retorna el id del ultimo de los folders
qulonglong LibraryCreator::insertFolders()
{
auto _database = QSqlDatabase::database(_databaseConnection);
@ -232,7 +232,7 @@ qulonglong LibraryCreator::insertFolders()
if (!(i->knownId)) {
i->setFather(currentId);
i->setManga(currentParent.isManga());
currentId = DBHelper::insert(&(*i), _database); //insertFolder(currentId,*i);
currentId = DBHelper::insert(&(*i), _database); // insertFolder(currentId,*i);
i->setId(currentId);
} else {
currentId = i->id;
@ -266,10 +266,10 @@ void LibraryCreator::create(QDir dir)
#endif
if (fileInfo.isDir()) {
QLOG_TRACE() << "Parsing folder" << fileInfo.canonicalPath();
//se añade al path actual el folder, aún no se sabe si habrá que añadirlo a la base de datos
// se añade al path actual el folder, aún no se sabe si habrá que añadirlo a la base de datos
_currentPathFolders.append(Folder(fileInfo.fileName(), relativePath));
create(QDir(fileInfo.absoluteFilePath()));
//una vez importada la información del folder, se retira del path actual ya que no volverá a ser visitado
// una vez importada la información del folder, se retira del path actual ya que no volverá a ser visitado
_currentPathFolders.pop_back();
} else {
QLOG_TRACE() << "Parsing file" << fileInfo.filePath();
@ -286,14 +286,14 @@ bool LibraryCreator::checkCover(const QString &hash)
void LibraryCreator::insertComic(const QString &relativePath, const QFileInfo &fileInfo)
{
auto _database = QSqlDatabase::database(_databaseConnection);
//Se calcula el hash del cómic
// Se calcula el hash del cómic
QCryptographicHash crypto(QCryptographicHash::Sha1);
QFile file(fileInfo.absoluteFilePath());
file.open(QFile::ReadOnly);
crypto.addData(file.read(524288));
file.close();
//hash Sha1 del primer 0.5MB + filesize
// hash Sha1 del primer 0.5MB + filesize
QString hash = QString(crypto.result().toHex().constData()) + QString::number(fileInfo.size());
ComicDB comic = DBHelper::loadComic(fileInfo.fileName(), relativePath, hash, _database);
int numPages = 0;
@ -312,7 +312,7 @@ void LibraryCreator::insertComic(const QString &relativePath, const QFileInfo &f
}
if (numPages > 0 || exists) {
//en este punto sabemos que todos los folders que hay en _currentPath, deberían estar añadidos a la base de datos
// en este punto sabemos que todos los folders que hay en _currentPath, deberían estar añadidos a la base de datos
insertFolders();
bool parsed = YACReader::parseXMLIntoInfo(ie.getXMLInfoRawData(), comic.info);
@ -333,8 +333,8 @@ void LibraryCreator::insertComic(const QString &relativePath, const QFileInfo &f
void LibraryCreator::update(QDir dirS)
{
auto _database = QSqlDatabase::database(_databaseConnection);
//QLOG_TRACE() << "Updating" << dirS.absolutePath();
//QLOG_TRACE() << "Getting info from dir" << dirS.absolutePath();
// QLOG_TRACE() << "Updating" << dirS.absolutePath();
// QLOG_TRACE() << "Getting info from dir" << dirS.absolutePath();
dirS.setNameFilters(_nameFilter);
dirS.setFilter(QDir::AllDirs | QDir::NoDotAndDotDot);
dirS.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware);
@ -349,30 +349,30 @@ void LibraryCreator::update(QDir dirS)
QFileInfoList listS;
listS.append(listSFolders);
listS.append(listSFiles);
//QLOG_DEBUG() << "---------------------------------------------------------";
//foreach(QFileInfo info,listS)
// QLOG_DEBUG() << "---------------------------------------------------------";
// foreach(QFileInfo info,listS)
// QLOG_DEBUG() << info.fileName();
//QLOG_TRACE() << "END Getting info from dir" << dirS.absolutePath();
// QLOG_TRACE() << "END Getting info from dir" << dirS.absolutePath();
//QLOG_TRACE() << "Getting info from DB" << dirS.absolutePath();
// QLOG_TRACE() << "Getting info from DB" << dirS.absolutePath();
QList<LibraryItem *> folders = DBHelper::getFoldersFromParent(_currentPathFolders.last().id, _database);
QList<LibraryItem *> comics = DBHelper::getComicsFromParent(_currentPathFolders.last().id, _database);
//QLOG_TRACE() << "END Getting info from DB" << dirS.absolutePath();
// QLOG_TRACE() << "END Getting info from DB" << dirS.absolutePath();
QList<LibraryItem *> listD;
std::sort(folders.begin(), folders.end(), naturalSortLessThanCILibraryItem);
std::sort(comics.begin(), comics.end(), naturalSortLessThanCILibraryItem);
listD.append(folders);
listD.append(comics);
//QLOG_DEBUG() << "---------------------------------------------------------";
//foreach(LibraryItem * info,listD)
// QLOG_DEBUG() << "---------------------------------------------------------";
// foreach(LibraryItem * info,listD)
// QLOG_DEBUG() << info->name;
//QLOG_DEBUG() << "---------------------------------------------------------";
// QLOG_DEBUG() << "---------------------------------------------------------";
int lenghtS = listS.size();
int lenghtD = listD.size();
//QLOG_DEBUG() << "S len" << lenghtS << "D len" << lenghtD;
//QLOG_DEBUG() << "---------------------------------------------------------";
// QLOG_DEBUG() << "S len" << lenghtS << "D len" << lenghtD;
// QLOG_DEBUG() << "---------------------------------------------------------";
bool updated;
int i, j;
@ -380,10 +380,10 @@ void LibraryCreator::update(QDir dirS)
if (stopRunning)
return;
updated = false;
if (i >= lenghtS) //finished source files/dirs
if (i >= lenghtS) // finished source files/dirs
{
//QLOG_WARN() << "finished source files/dirs" << dirS.absolutePath();
//delete listD //from j
// QLOG_WARN() << "finished source files/dirs" << dirS.absolutePath();
// delete listD //from j
for (; j < lenghtD; j++) {
if (stopRunning)
return;
@ -391,15 +391,15 @@ void LibraryCreator::update(QDir dirS)
}
updated = true;
}
if (j >= lenghtD) //finished library files/dirs
if (j >= lenghtD) // finished library files/dirs
{
//QLOG_WARN() << "finished library files/dirs" << dirS.absolutePath();
//create listS //from i
// QLOG_WARN() << "finished library files/dirs" << dirS.absolutePath();
// create listS //from i
for (; i < lenghtS; i++) {
if (stopRunning)
return;
QFileInfo fileInfoS = listS.at(i);
if (fileInfoS.isDir()) //create folder
if (fileInfoS.isDir()) // create folder
{
#ifdef Q_OS_MAC
QStringList src = _source.split("/");
@ -412,10 +412,10 @@ void LibraryCreator::update(QDir dirS)
#else
QString path = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source);
#endif
_currentPathFolders.append(Folder(fileInfoS.fileName(), path)); //folder actual no está en la BD
_currentPathFolders.append(Folder(fileInfoS.fileName(), path)); // folder actual no está en la BD
create(QDir(fileInfoS.absoluteFilePath()));
_currentPathFolders.pop_back();
} else //create comic
} else // create comic
{
#ifdef Q_OS_MAC
QStringList src = _source.split("/");
@ -437,23 +437,23 @@ void LibraryCreator::update(QDir dirS)
if (!updated) {
QFileInfo fileInfoS = listS.at(i);
LibraryItem *fileInfoD = listD.at(j);
QString nameS = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(QDir::cleanPath(fileInfoS.absolutePath())); //remove source
QString nameS = QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(QDir::cleanPath(fileInfoS.absolutePath())); // remove source
QString nameD = "/" + fileInfoD->name;
int comparation = QString::localeAwareCompare(nameS, nameD);
if (fileInfoS.isDir() && fileInfoD->isDir())
if (comparation == 0) //same folder, update
if (comparation == 0) // same folder, update
{
_currentPathFolders.append(*static_cast<Folder *>(fileInfoD)); //fileInfoD conoce su padre y su id
_currentPathFolders.append(*static_cast<Folder *>(fileInfoD)); // fileInfoD conoce su padre y su id
update(QDir(fileInfoS.absoluteFilePath()));
_currentPathFolders.pop_back();
i++;
j++;
} else if (comparation < 0) //nameS doesn't exist on DB
} else if (comparation < 0) // nameS doesn't exist on DB
{
if (nameS != "/.yacreaderlibrary") {
//QLOG_WARN() << "dir source < dest" << nameS << nameD;
// QLOG_WARN() << "dir source < dest" << nameS << nameD;
#ifdef Q_OS_MAC
QStringList src = _source.split("/");
QString filePath = fileInfoS.absoluteFilePath();
@ -470,21 +470,21 @@ void LibraryCreator::update(QDir dirS)
_currentPathFolders.pop_back();
}
i++;
} else //nameD no longer available on Source folder...
} else // nameD no longer available on Source folder...
{
if (nameS != "/.yacreaderlibrary") {
//QLOG_WARN() << "dir source > dest" << nameS << nameD;
// QLOG_WARN() << "dir source > dest" << nameS << nameD;
DBHelper::removeFromDB(fileInfoD, _database);
j++;
} else
i++; //skip library directory
i++; // skip library directory
}
else // one of them(or both) is a file
if (fileInfoS.isDir()) //this folder doesn't exist on library
if (fileInfoS.isDir()) // this folder doesn't exist on library
{
if (nameS != "/.yacreaderlibrary") //skip .yacreaderlibrary folder
if (nameS != "/.yacreaderlibrary") // skip .yacreaderlibrary folder
{
//QLOG_WARN() << "one of them(or both) is a file" << nameS << nameD;
// QLOG_WARN() << "one of them(or both) is a file" << nameS << nameD;
#ifdef Q_OS_MAC
QStringList src = _source.split("/");
QString filePath = fileInfoS.absoluteFilePath();
@ -501,15 +501,15 @@ void LibraryCreator::update(QDir dirS)
_currentPathFolders.pop_back();
}
i++;
} else if (fileInfoD->isDir()) //delete this folder from library
} else if (fileInfoD->isDir()) // delete this folder from library
{
DBHelper::removeFromDB(fileInfoD, _database);
j++;
} else //both are files //BUG on windows (no case sensitive)
} else // both are files //BUG on windows (no case sensitive)
{
//nameD.remove(nameD.size()-4,4);
// nameD.remove(nameD.size()-4,4);
int comparation = QString::localeAwareCompare(nameS, nameD);
if (comparation < 0) //create new thumbnail
if (comparation < 0) // create new thumbnail
{
#ifdef Q_OS_MAC
QStringList src = _source.split("/");
@ -525,21 +525,21 @@ void LibraryCreator::update(QDir dirS)
insertComic(path, fileInfoS);
i++;
} else {
if (comparation > 0) //delete thumbnail
if (comparation > 0) // delete thumbnail
{
DBHelper::removeFromDB(fileInfoD, _database);
j++;
} else //same file
} else // same file
{
if (fileInfoS.isFile() && !fileInfoD->isDir()) {
//TODO comprobar fechas + tamaño
//if(fileInfoS.lastModified()>fileInfoD.lastModified())
// TODO comprobar fechas + tamaño
// if(fileInfoS.lastModified()>fileInfoD.lastModified())
//{
// dirD.mkpath(_target+(QDir::cleanPath(fileInfoS.absolutePath()).remove(_source)));
// emit(coverExtracted(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source)));
// ThumbnailCreator tc(QDir::cleanPath(fileInfoS.absoluteFilePath()),_target+(QDir::cleanPath(fileInfoS.absoluteFilePath()).remove(_source))+".jpg");
// tc.create();
//}
// }
}
i++;
j++;

View File

@ -32,25 +32,25 @@ private:
void processLibrary(const QString &source, const QString &target);
enum Mode { CREATOR,
UPDATER };
//atributos "globales" durante el proceso de creación y actualización
// atributos "globales" durante el proceso de creación y actualización
enum Mode _mode;
QString _source;
QString _target;
QString _sourceFolder; //used for partial updates
QString _sourceFolder; // used for partial updates
QStringList _nameFilter;
QString _databaseConnection;
QList<Folder> _currentPathFolders; //lista de folders en el orden en el que están siendo explorados, el último es el folder actual
//recursive method
QList<Folder> _currentPathFolders; // lista de folders en el orden en el que están siendo explorados, el último es el folder actual
// recursive method
void create(QDir currentDirectory);
void update(QDir currentDirectory);
void run() override;
qulonglong insertFolders(); //devuelve el id del último folder añadido (último en la ruta)
qulonglong insertFolders(); // devuelve el id del último folder añadido (último en la ruta)
bool checkCover(const QString &hash);
void insertComic(const QString &relativePath, const QFileInfo &fileInfo);
//qulonglong insertFolder(qulonglong parentId,const Folder & folder);
//qulonglong insertComic(const Comic & comic);
// qulonglong insertFolder(qulonglong parentId,const Folder & folder);
// qulonglong insertComic(const Comic & comic);
bool stopRunning;
//LibraryCreator está en modo creación si creation == true;
// LibraryCreator está en modo creación si creation == true;
bool creation;
bool partialUpdate;
QModelIndex folderDestinationModelIndex;

View File

@ -140,14 +140,14 @@ void LibraryWindow::afterLaunchTasks()
void LibraryWindow::createSettings()
{
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
settings->beginGroup("libraryConfig");
}
void LibraryWindow::setupOpenglSetting()
{
#ifndef NO_OPENGL
//FLOW-----------------------------------------------------------------------
// FLOW-----------------------------------------------------------------------
//---------------------------------------------------------------------------
OpenGLChecker openGLChecker;
@ -188,11 +188,11 @@ void LibraryWindow::setupUI()
setMinimumSize(800, 480);
//restore
// restore
if (settings->contains(MAIN_WINDOW_GEOMETRY))
restoreGeometry(settings->value(MAIN_WINDOW_GEOMETRY).toByteArray());
else
//if(settings->value(USE_OPEN_GL).toBool() == false)
// if(settings->value(USE_OPEN_GL).toBool() == false)
showMaximized();
trayIconController = new TrayIconController(settings, this);
@ -218,15 +218,15 @@ void LibraryWindow::setupUI()
void LibraryWindow::doLayout()
{
//LAYOUT ELEMENTS------------------------------------------------------------
auto sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal
// LAYOUT ELEMENTS------------------------------------------------------------
auto sHorizontal = new QSplitter(Qt::Horizontal); // spliter principal
#ifdef Q_OS_MAC
sHorizontal->setStyleSheet("QSplitter::handle{image:none;background-color:#B8B8B8;} QSplitter::handle:vertical {height:1px;}");
#else
sHorizontal->setStyleSheet("QSplitter::handle:vertical {height:4px;}");
#endif
//TOOLBARS-------------------------------------------------------------------
// TOOLBARS-------------------------------------------------------------------
//---------------------------------------------------------------------------
editInfoToolBar = new QToolBar();
editInfoToolBar->setStyleSheet("QToolBar {border: none;}");
@ -237,14 +237,14 @@ void LibraryWindow::doLayout()
libraryToolBar = new YACReaderMainToolBar(this);
#endif
//FOLDERS FILTER-------------------------------------------------------------
// FOLDERS FILTER-------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef Q_OS_MAC
//in MacOSX the searchEdit is created using the toolbar wrapper
// in MacOSX the searchEdit is created using the toolbar wrapper
searchEdit = new YACReaderSearchLineEdit();
#endif
//SIDEBAR--------------------------------------------------------------------
// SIDEBAR--------------------------------------------------------------------
//---------------------------------------------------------------------------
sideBar = new YACReaderSideBar;
@ -268,14 +268,14 @@ void LibraryWindow::doLayout()
foldersTitle->addAction(colapseAllNodesAction);
readingListsTitle->addAction(addReadingListAction);
//readingListsTitle->addSepartor();
// readingListsTitle->addSepartor();
readingListsTitle->addAction(addLabelAction);
//readingListsTitle->addSepartor();
// readingListsTitle->addSepartor();
readingListsTitle->addAction(renameListAction);
readingListsTitle->addAction(deleteReadingListAction);
readingListsTitle->addSpacing(3);
//FINAL LAYOUT-------------------------------------------------------------
// FINAL LAYOUT-------------------------------------------------------------
comicsViewsManager = new YACReaderComicsViewsManager(settings, this);
@ -301,9 +301,9 @@ void LibraryWindow::doLayout()
mainWidget = new QStackedWidget(this);
mainWidget->addWidget(sHorizontal);
setCentralWidget(mainWidget);
//FINAL LAYOUT-------------------------------------------------------------
// FINAL LAYOUT-------------------------------------------------------------
//OTHER----------------------------------------------------------------------
// OTHER----------------------------------------------------------------------
//---------------------------------------------------------------------------
noLibrariesWidget = new NoLibrariesWidget();
mainWidget->addWidget(noLibrariesWidget);
@ -314,7 +314,7 @@ void LibraryWindow::doLayout()
connect(noLibrariesWidget, &NoLibrariesWidget::createNewLibrary, this, &LibraryWindow::createLibrary);
connect(noLibrariesWidget, &NoLibrariesWidget::addExistingLibrary, this, &LibraryWindow::showAddLibrary);
//collapsible disabled in macosx (only temporaly)
// collapsible disabled in macosx (only temporaly)
#ifdef Q_OS_MAC
sHorizontal->setCollapsible(0, false);
#endif
@ -341,7 +341,7 @@ void LibraryWindow::doDialogs()
serverConfigDialog = new ServerConfigDialog(this);
#endif
had = new HelpAboutDialog(this); //TODO load data.
had = new HelpAboutDialog(this); // TODO load data.
QString sufix = QLocale::system().name();
if (QFile(":/files/about_" + sufix + ".html").exists())
had->loadAboutInformation(":/files/about_" + sufix + ".html");
@ -395,7 +395,7 @@ void LibraryWindow::setUpShortcutsManagement()
<< updateCurrentFolderAction);
allActions << tmpList;
editShortcutsDialog->addActionsGroup("Lists", QIcon(":/images/shortcuts_group_folders.png"), //TODO change icon
editShortcutsDialog->addActionsGroup("Lists", QIcon(":/images/shortcuts_group_folders.png"), // TODO change icon
tmpList = QList<QAction *>()
<< addReadingListAction
<< deleteReadingListAction
@ -447,18 +447,18 @@ void LibraryWindow::setUpShortcutsManagement()
void LibraryWindow::doModels()
{
//folders
// folders
foldersModel = new FolderModel(this);
foldersModelProxy = new FolderModelProxy(this);
folderQueryResultProcessor.reset(new FolderQueryResultProcessor(foldersModel));
//foldersModelProxy->setSourceModel(foldersModel);
//comics
// foldersModelProxy->setSourceModel(foldersModel);
// comics
comicsModel = new ComicModel(this);
//lists
// lists
listsModel = new ReadingListModel(this);
listsModelProxy = new ReadingListModelProxy(this);
//setSearchFilter(YACReader::NoModifiers, ""); //clear search filter
// setSearchFilter(YACReader::NoModifiers, ""); //clear search filter
}
void LibraryWindow::createActions()
@ -466,7 +466,7 @@ void LibraryWindow::createActions()
backAction = new QAction(this);
QIcon icoBackButton;
icoBackButton.addFile(":/images/main_toolbar/back.png", QSize(), QIcon::Normal);
//icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back_disabled.png"), QIcon::Disabled);
// icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back_disabled.png"), QIcon::Disabled);
backAction->setData(BACK_ACTION_YL);
backAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(BACK_ACTION_YL));
backAction->setIcon(icoBackButton);
@ -475,7 +475,7 @@ void LibraryWindow::createActions()
forwardAction = new QAction(this);
QIcon icoFordwardButton;
icoFordwardButton.addFile(":/images/main_toolbar/forward.png", QSize(), QIcon::Normal);
//icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward_disabled.png"), QIcon::Disabled);
// icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward_disabled.png"), QIcon::Disabled);
forwardAction->setData(FORWARD_ACTION_YL);
forwardAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(FORWARD_ACTION_YL));
forwardAction->setIcon(icoFordwardButton);
@ -667,7 +667,7 @@ void LibraryWindow::createActions()
toggleComicsViewAction->setData(TOGGLE_COMICS_VIEW_ACTION_YL);
toggleComicsViewAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_COMICS_VIEW_ACTION_YL));
toggleComicsViewAction->setIcon(icoViewsButton);
//socialAction = new QAction(this);
// socialAction = new QAction(this);
//----
@ -720,7 +720,7 @@ void LibraryWindow::createActions()
resetComicRatingAction->setData(RESET_COMIC_RATING_ACTION_YL);
resetComicRatingAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(RESET_COMIC_RATING_ACTION_YL));
//Edit comics actions------------------------------------------------------
// Edit comics actions------------------------------------------------------
selectAllComicsAction = new QAction(this);
selectAllComicsAction->setText(tr("Select all comics"));
selectAllComicsAction->setData(SELECT_ALL_COMICS_ACTION_YL);
@ -823,7 +823,7 @@ void LibraryWindow::createActions()
addToFavoritesAction->setToolTip(tr("Add selected comics to favorites list"));
addToFavoritesAction->setIcon(QIcon(":/images/lists/default_1.png"));
//actions not asigned to any widget
// actions not asigned to any widget
this->addAction(saveCoversToAction);
this->addAction(openContainingFolderAction);
this->addAction(updateCurrentFolderAction);
@ -838,16 +838,16 @@ void LibraryWindow::createActions()
this->addAction(toggleFullScreenAction);
#endif
//disable actions
// disable actions
disableAllActions();
}
void LibraryWindow::disableComicsActions(bool disabled)
{
//if there aren't comics, no fullscreen option will be available
// if there aren't comics, no fullscreen option will be available
#ifndef Q_OS_MAC
toggleFullScreenAction->setDisabled(disabled);
#endif
//edit toolbar
// edit toolbar
openComicAction->setDisabled(disabled);
editSelectedComicsAction->setDisabled(disabled);
selectAllComicsAction->setDisabled(disabled);
@ -856,11 +856,11 @@ void LibraryWindow::disableComicsActions(bool disabled)
setAsNonReadAction->setDisabled(disabled);
setNormalAction->setDisabled(disabled);
setMangaAction->setDisabled(disabled);
//setAllAsReadAction->setDisabled(disabled);
//setAllAsNonReadAction->setDisabled(disabled);
// setAllAsReadAction->setDisabled(disabled);
// setAllAsNonReadAction->setDisabled(disabled);
showHideMarksAction->setDisabled(disabled);
deleteComicsAction->setDisabled(disabled);
//context menu
// context menu
openContainingFolderComicAction->setDisabled(disabled);
resetComicRatingAction->setDisabled(disabled);
@ -877,7 +877,7 @@ void LibraryWindow::disableLibrariesActions(bool disabled)
importComicsInfoAction->setDisabled(disabled);
exportLibraryAction->setDisabled(disabled);
rescanLibraryForXMLInfoAction->setDisabled(disabled);
//importLibraryAction->setDisabled(disabled);
// importLibraryAction->setDisabled(disabled);
}
void LibraryWindow::disableNoUpdatedLibrariesActions(bool disabled)
@ -911,7 +911,7 @@ void LibraryWindow::createToolBars()
{
#ifdef Q_OS_MAC
//libraryToolBar->setIconSize(QSize(16,16)); //TODO make icon size dynamic
// libraryToolBar->setIconSize(QSize(16,16)); //TODO make icon size dynamic
libraryToolBar->addAction(backAction);
libraryToolBar->addAction(forwardAction);
@ -933,12 +933,12 @@ void LibraryWindow::createToolBars()
libraryToolBar->addStretch();
//Native toolbar search edit
//libraryToolBar->addWidget(searchEdit);
// Native toolbar search edit
// libraryToolBar->addWidget(searchEdit);
searchEdit = libraryToolBar->addSearchEdit();
//connect(libraryToolBar,SIGNAL(searchTextChanged(YACReader::SearchModifiers,QString)),this,SLOT(setSearchFilter(YACReader::SearchModifiers, QString)));
// connect(libraryToolBar,SIGNAL(searchTextChanged(YACReader::SearchModifiers,QString)),this,SLOT(setSearchFilter(YACReader::SearchModifiers, QString)));
//libraryToolBar->setMovable(false);
// libraryToolBar->setMovable(false);
libraryToolBar->attachToWindow(this->windowHandle());
@ -967,9 +967,9 @@ void LibraryWindow::createToolBars()
editInfoToolBar->addSeparator();
editInfoToolBar->addAction(setAsReadAction);
//editInfoToolBar->addAction(setAllAsReadAction);
// editInfoToolBar->addAction(setAllAsReadAction);
editInfoToolBar->addAction(setAsNonReadAction);
//editInfoToolBar->addAction(setAllAsNonReadAction);
// editInfoToolBar->addAction(setAllAsNonReadAction);
editInfoToolBar->addAction(showHideMarksAction);
@ -1021,13 +1021,13 @@ void LibraryWindow::createMenus()
selectedLibrary->addAction(exportLibraryAction);
selectedLibrary->addAction(importLibraryAction);
//MacOSX app menus
// MacOSX app menus
#ifdef Q_OS_MACX
QMenuBar *menu = this->menuBar();
//about / preferences
//TODO
// about / preferences
// TODO
//library
// library
QMenu *libraryMenu = new QMenu(tr("Library"));
libraryMenu->addAction(updateLibraryAction);
@ -1046,7 +1046,7 @@ void LibraryWindow::createMenus()
libraryMenu->addAction(exportLibraryAction);
libraryMenu->addAction(importLibraryAction);
//folder
// folder
QMenu *folderMenu = new QMenu(tr("Folder"));
folderMenu->addAction(openContainingFolderAction);
folderMenu->addAction(updateFolderAction);
@ -1060,7 +1060,7 @@ void LibraryWindow::createMenus()
foldersView->addAction(setFolderAsMangaAction);
foldersView->addAction(setFolderAsNormalAction);
//comic
// comic
QMenu *comicMenu = new QMenu(tr("Comic"));
comicMenu->addAction(openContainingFolderComicAction);
comicMenu->addSeparator();
@ -1074,40 +1074,40 @@ void LibraryWindow::createMenus()
void LibraryWindow::createConnections()
{
//history navigation
// history navigation
connect(backAction, &QAction::triggered, historyController, &YACReaderHistoryController::backward);
connect(forwardAction, &QAction::triggered, historyController, &YACReaderHistoryController::forward);
//--
connect(historyController, &YACReaderHistoryController::enabledBackward, backAction, &QAction::setEnabled);
connect(historyController, &YACReaderHistoryController::enabledForward, forwardAction, &QAction::setEnabled);
//connect(foldersView, SIGNAL(clicked(QModelIndex)), historyController, SLOT(updateHistory(QModelIndex)));
// connect(foldersView, SIGNAL(clicked(QModelIndex)), historyController, SLOT(updateHistory(QModelIndex)));
//libraryCreator connections
// libraryCreator connections
connect(createLibraryDialog, &CreateLibraryDialog::createLibrary, this, QOverload<QString, QString, QString>::of(&LibraryWindow::create));
connect(createLibraryDialog, &CreateLibraryDialog::libraryExists, this, &LibraryWindow::libraryAlreadyExists);
connect(importComicsInfoDialog, &QDialog::finished, this, &LibraryWindow::reloadCurrentLibrary);
//connect(libraryCreator,SIGNAL(coverExtracted(QString)),createLibraryDialog,SLOT(showCurrentFile(QString)));
//connect(libraryCreator,SIGNAL(coverExtracted(QString)),updateLibraryDialog,SLOT(showCurrentFile(QString)));
// connect(libraryCreator,SIGNAL(coverExtracted(QString)),createLibraryDialog,SLOT(showCurrentFile(QString)));
// connect(libraryCreator,SIGNAL(coverExtracted(QString)),updateLibraryDialog,SLOT(showCurrentFile(QString)));
connect(libraryCreator, &LibraryCreator::finished, this, &LibraryWindow::showRootWidget);
connect(libraryCreator, &LibraryCreator::updated, this, &LibraryWindow::reloadCurrentLibrary);
connect(libraryCreator, &LibraryCreator::created, this, &LibraryWindow::openLastCreated);
//connect(libraryCreator,SIGNAL(updatedCurrentFolder()), this, SLOT(showRootWidget()));
// connect(libraryCreator,SIGNAL(updatedCurrentFolder()), this, SLOT(showRootWidget()));
connect(libraryCreator, &LibraryCreator::updatedCurrentFolder, this, &LibraryWindow::reloadAfterCopyMove);
connect(libraryCreator, &LibraryCreator::comicAdded, importWidget, &ImportWidget::newComic);
//libraryCreator errors
// libraryCreator errors
connect(libraryCreator, &LibraryCreator::failedCreatingDB, this, &LibraryWindow::manageCreatingError);
connect(libraryCreator, SIGNAL(failedUpdatingDB(QString)), this, SLOT(manageUpdatingError(QString))); //TODO: implement failedUpdatingDB
connect(libraryCreator, SIGNAL(failedUpdatingDB(QString)), this, SLOT(manageUpdatingError(QString))); // TODO: implement failedUpdatingDB
connect(xmlInfoLibraryScanner, &QThread::finished, this, &LibraryWindow::showRootWidget);
connect(xmlInfoLibraryScanner, &QThread::finished, this, &LibraryWindow::reloadCurrentFolderComicsContent);
connect(xmlInfoLibraryScanner, &XMLInfoLibraryScanner::comicScanned, importWidget, &ImportWidget::newComic);
//new import widget
// new import widget
connect(importWidget, &ImportWidget::stop, this, &LibraryWindow::stopLibraryCreator);
connect(importWidget, &ImportWidget::stop, this, &LibraryWindow::stopXMLScanning);
//packageManager connections
// packageManager connections
connect(exportLibraryDialog, &ExportLibraryDialog::exportPath, this, &LibraryWindow::exportLibrary);
connect(exportLibraryDialog, &QDialog::rejected, packageManager, &PackageManager::cancel);
connect(packageManager, &PackageManager::exported, exportLibraryDialog, &ExportLibraryDialog::close);
@ -1118,30 +1118,30 @@ void LibraryWindow::createConnections()
connect(packageManager, &PackageManager::imported, importLibraryDialog, &QWidget::hide);
connect(packageManager, &PackageManager::imported, this, &LibraryWindow::openLastCreated);
//create and update dialogs
// create and update dialogs
connect(createLibraryDialog, &CreateLibraryDialog::cancelCreate, this, &LibraryWindow::cancelCreating);
//open existing library from dialog.
// open existing library from dialog.
connect(addLibraryDialog, &AddLibraryDialog::addLibrary, this, &LibraryWindow::openLibrary);
//load library when selected library changes
// load library when selected library changes
connect(selectedLibrary, &YACReaderLibraryListWidget::currentIndexChanged, this, &LibraryWindow::loadLibrary);
//rename library dialog
// rename library dialog
connect(renameLibraryDialog, &RenameLibraryDialog::renameLibrary, this, &LibraryWindow::rename);
//navigations between view modes (tree,list and flow)
//TODO connect(foldersView, SIGNAL(pressed(QModelIndex)), this, SLOT(updateFoldersViewConextMenu(QModelIndex)));
//connect(foldersView, SIGNAL(clicked(QModelIndex)), this, SLOT(loadCovers(QModelIndex)));
// navigations between view modes (tree,list and flow)
// TODO connect(foldersView, SIGNAL(pressed(QModelIndex)), this, SLOT(updateFoldersViewConextMenu(QModelIndex)));
// connect(foldersView, SIGNAL(clicked(QModelIndex)), this, SLOT(loadCovers(QModelIndex)));
//drops in folders view
// drops in folders view
connect(foldersView, QOverload<QList<QPair<QString, QString>>, QModelIndex>::of(&YACReaderFoldersView::copyComicsToFolder),
this, &LibraryWindow::copyAndImportComicsToFolder);
connect(foldersView, QOverload<QList<QPair<QString, QString>>, QModelIndex>::of(&YACReaderFoldersView::moveComicsToFolder),
this, &LibraryWindow::moveAndImportComicsToFolder);
connect(foldersView, &QWidget::customContextMenuRequested, this, &LibraryWindow::showFoldersContextMenu);
//actions
// actions
connect(createLibraryAction, &QAction::triggered, this, &LibraryWindow::createLibrary);
connect(exportLibraryAction, &QAction::triggered, exportLibraryDialog, &ExportLibraryDialog::open);
connect(importLibraryAction, &QAction::triggered, this, &LibraryWindow::importLibraryPackage);
@ -1151,22 +1151,22 @@ void LibraryWindow::createConnections()
connect(setAsNonReadAction, &QAction::triggered, this, &LibraryWindow::setCurrentComicUnreaded);
connect(setNormalAction, &QAction::triggered, this, &LibraryWindow::setSelectedComicsAsNormal);
connect(setMangaAction, &QAction::triggered, this, &LibraryWindow::setSelectedComicsAsManga);
//connect(setAllAsReadAction,SIGNAL(triggered()),this,SLOT(setComicsReaded()));
//connect(setAllAsNonReadAction,SIGNAL(triggered()),this,SLOT(setComicsUnreaded()));
// connect(setAllAsReadAction,SIGNAL(triggered()),this,SLOT(setComicsReaded()));
// connect(setAllAsNonReadAction,SIGNAL(triggered()),this,SLOT(setComicsUnreaded()));
//comicsInfoManagement
// comicsInfoManagement
connect(exportComicsInfoAction, &QAction::triggered, this, &LibraryWindow::showExportComicsInfo);
connect(importComicsInfoAction, &QAction::triggered, this, &LibraryWindow::showImportComicsInfo);
//properties & config
// properties & config
connect(propertiesDialog, &QDialog::accepted, navigationController, &YACReaderNavigationController::reselectCurrentSource);
//comic vine
// comic vine
connect(comicVineDialog, &QDialog::accepted, navigationController, &YACReaderNavigationController::reselectCurrentSource, Qt::QueuedConnection);
connect(updateLibraryAction, &QAction::triggered, this, &LibraryWindow::updateLibrary);
connect(renameLibraryAction, &QAction::triggered, this, &LibraryWindow::renameLibrary);
//connect(deleteLibraryAction,SIGNAL(triggered()),this,SLOT(deleteLibrary()));
// connect(deleteLibraryAction,SIGNAL(triggered()),this,SLOT(deleteLibrary()));
connect(removeLibraryAction, &QAction::triggered, this, &LibraryWindow::removeLibrary);
connect(rescanLibraryForXMLInfoAction, &QAction::triggered, this, &LibraryWindow::rescanLibraryForXMLInfo);
connect(openComicAction, &QAction::triggered, this, QOverload<>::of(&LibraryWindow::openComic));
@ -1187,7 +1187,7 @@ void LibraryWindow::createConnections()
connect(optionsDialog, &YACReaderOptionsDialog::optionsChanged, this, &LibraryWindow::reloadOptions);
connect(optionsDialog, &YACReaderOptionsDialog::editShortcuts, editShortcutsDialog, &QWidget::show);
//Search filter
// Search filter
#ifdef Q_OS_MAC
connect(searchEdit, &YACReaderMacOSXSearchLineEdit::filterChanged, this, &LibraryWindow::setSearchFilter);
#else
@ -1196,7 +1196,7 @@ void LibraryWindow::createConnections()
connect(&comicQueryResultProcessor, &ComicQueryResultProcessor::newData, this, &LibraryWindow::setComicSearchFilterData);
connect(folderQueryResultProcessor.get(), &FolderQueryResultProcessor::newData, this, &LibraryWindow::setFolderSearchFilterData);
//ContextMenus
// ContextMenus
connect(openContainingFolderComicAction, &QAction::triggered, this, &LibraryWindow::openContainingFolderComic);
connect(setFolderAsNotCompletedAction, &QAction::triggered, this, &LibraryWindow::setFolderAsNotCompleted);
connect(setFolderAsCompletedAction, &QAction::triggered, this, &LibraryWindow::setFolderAsCompleted);
@ -1208,9 +1208,9 @@ void LibraryWindow::createConnections()
connect(resetComicRatingAction, &QAction::triggered, this, &LibraryWindow::resetComicRating);
//connect(dm,SIGNAL(directoryLoaded(QString)),foldersView,SLOT(expandAll()));
//connect(dm,SIGNAL(directoryLoaded(QString)),this,SLOT(updateFoldersView(QString)));
//Comicts edition
// connect(dm,SIGNAL(directoryLoaded(QString)),foldersView,SLOT(expandAll()));
// connect(dm,SIGNAL(directoryLoaded(QString)),this,SLOT(updateFoldersView(QString)));
// Comicts edition
connect(editSelectedComicsAction, &QAction::triggered, this, &LibraryWindow::showProperties);
connect(asignOrderAction, &QAction::triggered, this, &LibraryWindow::asignNumbers);
@ -1218,11 +1218,11 @@ void LibraryWindow::createConnections()
connect(getInfoAction, &QAction::triggered, this, &LibraryWindow::showComicVineScraper);
//connect(socialAction,SIGNAL(triggered()),this,SLOT(showSocial()));
// connect(socialAction,SIGNAL(triggered()),this,SLOT(showSocial()));
//connect(comicsModel,SIGNAL(isEmpty()),this,SLOT(showEmptyFolderView()));
//connect(comicsModel,SIGNAL(searchNumResults(int)),this,SLOT(checkSearchNumResults(int)));
//connect(emptyFolderWidget,SIGNAL(subfolderSelected(QModelIndex,int)),this,SLOT(selectSubfolder(QModelIndex,int)));
// connect(comicsModel,SIGNAL(isEmpty()),this,SLOT(showEmptyFolderView()));
// connect(comicsModel,SIGNAL(searchNumResults(int)),this,SLOT(checkSearchNumResults(int)));
// connect(emptyFolderWidget,SIGNAL(subfolderSelected(QModelIndex,int)),this,SLOT(selectSubfolder(QModelIndex,int)));
connect(focusSearchLineAction, &QAction::triggered, searchEdit, [this] { searchEdit->setFocus(Qt::ShortcutFocusReason); });
connect(focusComicsViewAction, &QAction::triggered, comicsViewsManager, &YACReaderComicsViewsManager::focusComicsViewViaShortcut);
@ -1231,11 +1231,11 @@ void LibraryWindow::createConnections()
connect(quitAction, &QAction::triggered, this, &LibraryWindow::closeApp);
//update folders (partial updates)
// update folders (partial updates)
connect(updateCurrentFolderAction, &QAction::triggered, this, &LibraryWindow::updateCurrentFolder);
connect(updateFolderAction, &QAction::triggered, this, &LibraryWindow::updateCurrentFolder);
//lists
// lists
connect(addReadingListAction, &QAction::triggered, this, &LibraryWindow::addNewReadingList);
connect(deleteReadingListAction, &QAction::triggered, this, &LibraryWindow::deleteSelectedReadingList);
connect(addLabelAction, &QAction::triggered, this, &LibraryWindow::showAddNewLabelDialog);
@ -1248,10 +1248,10 @@ void LibraryWindow::createConnections()
connect(addToFavoritesAction, &QAction::triggered, this, &LibraryWindow::addSelectedComicsToFavorites);
//save covers
// save covers
connect(saveCoversToAction, &QAction::triggered, this, &LibraryWindow::saveSelectedCoversTo);
//upgrade library
// upgrade library
connect(this, &LibraryWindow::libraryUpgraded, this, &LibraryWindow::loadLibrary, Qt::QueuedConnection);
connect(this, &LibraryWindow::errorUpgradingLibrary, this, &LibraryWindow::showErrorUpgradingLibrary, Qt::QueuedConnection);
}
@ -1263,15 +1263,15 @@ void LibraryWindow::showErrorUpgradingLibrary(const QString &path)
void LibraryWindow::loadLibrary(const QString &name)
{
if (!libraries.isEmpty()) //si hay bibliotecas...
if (!libraries.isEmpty()) // si hay bibliotecas...
{
historyController->clear();
showRootWidget();
QString path = libraries.getPath(name) + "/.yacreaderlibrary";
QDir d; //TODO change this by static methods (utils class?? with delTree for example)
QDir d; // TODO change this by static methods (utils class?? with delTree for example)
QString dbVersion;
if (d.exists(path) && d.exists(path + "/library.ydb") && (dbVersion = DataBaseManagement::checkValidDB(path + "/library.ydb")) != "") //si existe en disco la biblioteca seleccionada, y es válida..
if (d.exists(path) && d.exists(path + "/library.ydb") && (dbVersion = DataBaseManagement::checkValidDB(path + "/library.ydb")) != "") // si existe en disco la biblioteca seleccionada, y es válida..
{
int comparation = DataBaseManagement::compareVersions(dbVersion, VERSION);
@ -1295,19 +1295,19 @@ void LibraryWindow::loadLibrary(const QString &name)
comicsViewsManager->comicsView->setModel(NULL);
foldersView->setModel(NULL);
listsView->setModel(NULL);
disableAllActions(); //TODO comprobar que se deben deshabilitar
//será possible renombrar y borrar estas bibliotecas
disableAllActions(); // TODO comprobar que se deben deshabilitar
// será possible renombrar y borrar estas bibliotecas
renameLibraryAction->setEnabled(true);
removeLibraryAction->setEnabled(true);
}
}
if (comparation == 0) //en caso de que la versión se igual que la actual
if (comparation == 0) // en caso de que la versión se igual que la actual
{
foldersModel->setupModelData(path);
foldersModelProxy->setSourceModel(foldersModel);
foldersView->setModel(foldersModelProxy);
foldersView->setCurrentIndex(QModelIndex()); //why is this necesary?? by default it seems that returns an arbitrary index.
foldersView->setCurrentIndex(QModelIndex()); // why is this necesary?? by default it seems that returns an arbitrary index.
listsModel->setupReadingListsData(path);
listsModelProxy->setSourceModel(listsModel);
@ -1320,7 +1320,7 @@ void LibraryWindow::loadLibrary(const QString &name)
d.setCurrent(libraries.getPath(name));
d.setFilter(QDir::AllDirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks | QDir::NoDotAndDotDot);
if (d.count() <= 1) //read only library
if (d.count() <= 1) // read only library
{
disableLibrariesActions(false);
updateLibraryAction->setDisabled(true);
@ -1333,7 +1333,7 @@ void LibraryWindow::loadLibrary(const QString &name)
#endif
importedCovers = true;
} else //librería normal abierta
} else // librería normal abierta
{
disableLibrariesActions(false);
importedCovers = false;
@ -1350,8 +1350,8 @@ void LibraryWindow::loadLibrary(const QString &name)
comicsViewsManager->comicsView->setModel(NULL);
foldersView->setModel(NULL);
listsView->setModel(NULL);
disableAllActions(); //TODO comprobar que se deben deshabilitar
//será possible renombrar y borrar estas bibliotecas
disableAllActions(); // TODO comprobar que se deben deshabilitar
// será possible renombrar y borrar estas bibliotecas
renameLibraryAction->setEnabled(true);
removeLibraryAction->setEnabled(true);
}
@ -1359,25 +1359,25 @@ void LibraryWindow::loadLibrary(const QString &name)
comicsViewsManager->comicsView->setModel(NULL);
foldersView->setModel(NULL);
listsView->setModel(NULL);
disableAllActions(); //TODO comprobar que se deben deshabilitar
disableAllActions(); // TODO comprobar que se deben deshabilitar
//si la librería no existe en disco, se ofrece al usuario la posibiliad de eliminarla
// si la librería no existe en disco, se ofrece al usuario la posibiliad de eliminarla
if (!d.exists(path)) {
QString currentLibrary = selectedLibrary->currentText();
if (QMessageBox::question(this, tr("Library not available"), tr("Library '%1' is no longer available. Do you want to remove it?").arg(currentLibrary), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
deleteCurrentLibrary();
}
//será possible renombrar y borrar estas bibliotecas
// será possible renombrar y borrar estas bibliotecas
renameLibraryAction->setEnabled(true);
removeLibraryAction->setEnabled(true);
} else //si existe el path, puede ser que la librería sea alguna versión pre-5.0 ó que esté corrupta o que no haya drivers sql
} else // si existe el path, puede ser que la librería sea alguna versión pre-5.0 ó que esté corrupta o que no haya drivers sql
{
if (d.exists(path + "/library.ydb")) {
QSqlDatabase db = DataBaseManagement::loadDatabase(path);
manageOpeningLibraryError(db.lastError().databaseText() + "-" + db.lastError().driverText());
//será possible renombrar y borrar estas bibliotecas
// será possible renombrar y borrar estas bibliotecas
renameLibraryAction->setEnabled(true);
removeLibraryAction->setEnabled(true);
} else {
@ -1386,17 +1386,17 @@ void LibraryWindow::loadLibrary(const QString &name)
if (QMessageBox::question(this, tr("Old library"), tr("Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now?").arg(currentLibrary), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
QDir d(path + "/.yacreaderlibrary");
d.removeRecursively();
//d.rmdir(path+"/.yacreaderlibrary");
// d.rmdir(path+"/.yacreaderlibrary");
createLibraryDialog->setDataAndStart(currentLibrary, path);
//create(path,path+"/.yacreaderlibrary",currentLibrary);
// create(path,path+"/.yacreaderlibrary",currentLibrary);
}
//será possible renombrar y borrar estas bibliotecas
// será possible renombrar y borrar estas bibliotecas
renameLibraryAction->setEnabled(true);
removeLibraryAction->setEnabled(true);
}
}
}
} else //en caso de que no exista ninguna biblioteca se desactivan los botones pertinentes
} else // en caso de que no exista ninguna biblioteca se desactivan los botones pertinentes
{
disableAllActions();
showNoLibrariesWidget();
@ -1583,8 +1583,8 @@ void LibraryWindow::addFolderToCurrentIndex()
tr("Folder name:"), QLineEdit::Normal,
"", &ok);
//chars not supported in a folder's name: / \ : * ? " < > |
QRegExp invalidChars("\\/\\:\\*\\?\\\"\\<\\>\\|\\\\"); //TODO this regexp is not properly written
// chars not supported in a folder's name: / \ : * ? " < > |
QRegExp invalidChars("\\/\\:\\*\\?\\\"\\<\\>\\|\\\\"); // TODO this regexp is not properly written
bool isValid = !newFolderName.contains(invalidChars);
if (ok && !newFolderName.isEmpty() && isValid) {
@ -1596,7 +1596,7 @@ void LibraryWindow::addFolderToCurrentIndex()
foldersView->setCurrentIndex(foldersModelProxy->mapFromSource(newIndex));
navigationController->loadFolderInfo(newIndex);
historyController->updateHistory(YACReaderLibrarySourceContainer(newIndex, YACReaderLibrarySourceContainer::Folder));
//a new folder is always an empty folder
// a new folder is always an empty folder
comicsViewsManager->showEmptyFolderView();
}
}
@ -1618,7 +1618,7 @@ void LibraryWindow::deleteSelectedFolder()
int ret = QMessageBox::question(this, tr("Delete folder"), tr("The selected folder and all its contents will be deleted from your disk. Are you sure?") + "\n\nFolder : " + folderPath, QMessageBox::Yes, QMessageBox::No);
if (ret == QMessageBox::Yes) {
//no folders multiselection by now
// no folders multiselection by now
QModelIndexList indexList;
indexList << currentIndex;
@ -1658,9 +1658,9 @@ void LibraryWindow::addNewReadingList()
"", &ok);
if (ok) {
if (selectedLists.isEmpty() || !listsModel->isReadingList(sourceMI))
listsModel->addReadingList(newListName); //top level
listsModel->addReadingList(newListName); // top level
else {
listsModel->addReadingListAt(newListName, sourceMI); //sublist
listsModel->addReadingListAt(newListName, sourceMI); // sublist
}
}
}
@ -1694,7 +1694,7 @@ void LibraryWindow::showAddNewLabelDialog()
}
}
//TODO implement editors in treeview
// TODO implement editors in treeview
void LibraryWindow::showRenameCurrentList()
{
QModelIndexList selectedLists = listsView->selectionModel()->selectedIndexes();
@ -1862,8 +1862,8 @@ void LibraryWindow::selectSubfolder(const QModelIndex &mi, int child)
navigationController->selectedFolder(dest);
}
//this methods is only using after deleting comics
//TODO broken window :)
// this methods is only using after deleting comics
// TODO broken window :)
void LibraryWindow::checkEmptyFolder()
{
if (comicsModel->rowCount() > 0 && !importedCovers) {
@ -1899,7 +1899,7 @@ void LibraryWindow::openComic(const ComicDB &comic, const ComicModel::Mode mode)
if (mode == ComicModel::ReadingList) {
source = OpenComicSource::Source::ReadingList;
} else if (mode == ComicModel::Reading) {
//TODO check where the comic was opened from the last time it was read
// TODO check where the comic was opened from the last time it was read
source = OpenComicSource::Source::Folder;
} else {
source = OpenComicSource::Source::Folder;
@ -1990,9 +1990,9 @@ void LibraryWindow::showAddLibrary()
void LibraryWindow::openLibrary(QString path, QString name)
{
if (!libraries.contains(name)) {
//TODO: fix bug, /a/b/c/.yacreaderlibrary/d/e
// TODO: fix bug, /a/b/c/.yacreaderlibrary/d/e
path.remove("/.yacreaderlibrary");
QDir d; //TODO change this by static methods (utils class?? with delTree for example)
QDir d; // TODO change this by static methods (utils class?? with delTree for example)
if (d.exists(path + "/.yacreaderlibrary")) {
_lastAdded = name;
_sourceLastAdded = path;
@ -2034,12 +2034,12 @@ void LibraryWindow::deleteCurrentLibrary()
QString path = libraries.getPath(selectedLibrary->currentText());
libraries.remove(selectedLibrary->currentText());
selectedLibrary->removeItem(selectedLibrary->currentIndex());
//selectedLibrary->setCurrentIndex(0);
// selectedLibrary->setCurrentIndex(0);
path = path + "/.yacreaderlibrary";
QDir d(path);
d.removeRecursively();
if (libraries.isEmpty()) //no more libraries available.
if (libraries.isEmpty()) // no more libraries available.
{
comicsViewsManager->comicsView->setModel(NULL);
foldersView->setModel(NULL);
@ -2062,8 +2062,8 @@ void LibraryWindow::removeLibrary()
if (ret == QMessageBox::Yes) {
libraries.remove(currentLibrary);
selectedLibrary->removeItem(selectedLibrary->currentIndex());
//selectedLibrary->setCurrentIndex(0);
if (libraries.isEmpty()) //no more libraries available.
// selectedLibrary->setCurrentIndex(0);
if (libraries.isEmpty()) // no more libraries available.
{
comicsViewsManager->comicsView->setModel(NULL);
foldersView->setModel(NULL);
@ -2083,14 +2083,14 @@ void LibraryWindow::renameLibrary()
renameLibraryDialog->open();
}
void LibraryWindow::rename(QString newName) //TODO replace
void LibraryWindow::rename(QString newName) // TODO replace
{
QString currentLibrary = selectedLibrary->currentText();
if (newName != currentLibrary) {
if (!libraries.contains(newName)) {
libraries.rename(currentLibrary, newName);
//selectedLibrary->removeItem(selectedLibrary->currentIndex());
//libraries.addLibrary(newName,path);
// selectedLibrary->removeItem(selectedLibrary->currentIndex());
// libraries.addLibrary(newName,path);
selectedLibrary->renameCurrentLibrary(newName);
libraries.save();
renameLibraryDialog->close();
@ -2103,7 +2103,7 @@ void LibraryWindow::rename(QString newName) //TODO replace
}
} else
renameLibraryDialog->close();
//selectedLibrary->setCurrentIndex(selectedLibrary->findText(newName));
// selectedLibrary->setCurrentIndex(selectedLibrary->findText(newName));
}
void LibraryWindow::rescanLibraryForXMLInfo()
@ -2139,7 +2139,7 @@ void LibraryWindow::setRootIndex()
{
if (!libraries.isEmpty()) {
QString path = libraries.getPath(selectedLibrary->currentText()) + "/.yacreaderlibrary";
QDir d; //TODO change this by static methods (utils class?? with delTree for example)
QDir d; // TODO change this by static methods (utils class?? with delTree for example)
if (d.exists(path)) {
navigationController->selectedFolder(QModelIndex());
} else {
@ -2156,7 +2156,7 @@ void LibraryWindow::toggleFullScreen()
fullscreen = !fullscreen;
}
#ifdef Q_OS_WIN //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
#ifdef Q_OS_WIN // fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
void LibraryWindow::toFullScreen()
{
fromMaximized = this->isMaximized();
@ -2240,7 +2240,7 @@ void LibraryWindow::setSearchFilter(const YACReader::SearchModifiers modifier, Q
if (!filter.isEmpty()) {
folderQueryResultProcessor->createModelData(modifier, filter, true);
comicQueryResultProcessor.createModelData(modifier, filter, foldersModel->getDatabase());
} else if (status == LibraryWindow::Searching) { //if no searching, then ignore this
} else if (status == LibraryWindow::Searching) { // if no searching, then ignore this
clearSearchFilter();
navigationController->loadPreviousStatus();
}
@ -2252,7 +2252,7 @@ void LibraryWindow::setComicSearchFilterData(QList<ComicItem *> *data, const QSt
comicsModel->setModelData(data, databasePath);
comicsViewsManager->comicsView->enableFilterMode(true);
comicsViewsManager->comicsView->setModel(comicsModel); //TODO, columns are messed up after ResetModel some times, this shouldn't be necesary
comicsViewsManager->comicsView->setModel(comicsModel); // TODO, columns are messed up after ResetModel some times, this shouldn't be necesary
if (comicsModel->rowCount() == 0) {
comicsViewsManager->showNoSearchResultsView();
@ -2283,7 +2283,7 @@ void LibraryWindow::showProperties()
QList<ComicDB> comics = comicsModel->getComics(indexList);
ComicDB c = comics[0];
_comicIdEdited = c.id; //static_cast<TableItem*>(indexList[0].internalPointer())->data(4).toULongLong();
_comicIdEdited = c.id; // static_cast<TableItem*>(indexList[0].internalPointer())->data(4).toULongLong();
propertiesDialog->databasePath = foldersModel->getDatabase();
propertiesDialog->basePath = currentPath();
@ -2294,7 +2294,7 @@ void LibraryWindow::showProperties()
void LibraryWindow::showComicVineScraper()
{
QSettings s(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
QSettings s(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
s.beginGroup("ComicVine");
if (!s.contains(COMIC_VINE_API_KEY)) {
@ -2302,13 +2302,13 @@ void LibraryWindow::showComicVineScraper()
d.exec();
}
//check if the api key was inserted
// check if the api key was inserted
if (s.contains(COMIC_VINE_API_KEY)) {
QModelIndexList indexList = getSelectedComics();
QList<ComicDB> comics = comicsModel->getComics(indexList);
ComicDB c = comics[0];
_comicIdEdited = c.id; //static_cast<TableItem*>(indexList[0].internalPointer())->data(4).toULongLong();
_comicIdEdited = c.id; // static_cast<TableItem*>(indexList[0].internalPointer())->data(4).toULongLong();
comicVineDialog->databasePath = foldersModel->getDatabase();
comicVineDialog->basePath = currentPath();
@ -2366,7 +2366,7 @@ void LibraryWindow::asignNumbers()
}
qint64 edited = comicsModel->asignNumbers(indexList, startingNumber);
//TODO add resorting without reloading
// TODO add resorting without reloading
navigationController->loadFolderInfo(foldersModelProxy->mapToSource(foldersView->currentIndex()));
const QModelIndex &mi = comicsModel->getIndexFromId(edited);
@ -2419,25 +2419,25 @@ void LibraryWindow::openContainingFolder()
void LibraryWindow::setFolderAsNotCompleted()
{
//foldersModel->updateFolderCompletedStatus(foldersView->selectionModel()->selectedRows(),false);
// foldersModel->updateFolderCompletedStatus(foldersView->selectionModel()->selectedRows(),false);
foldersModel->updateFolderCompletedStatus(QModelIndexList() << foldersModelProxy->mapToSource(foldersView->currentIndex()), false);
}
void LibraryWindow::setFolderAsCompleted()
{
//foldersModel->updateFolderCompletedStatus(foldersView->selectionModel()->selectedRows(),true);
// foldersModel->updateFolderCompletedStatus(foldersView->selectionModel()->selectedRows(),true);
foldersModel->updateFolderCompletedStatus(QModelIndexList() << foldersModelProxy->mapToSource(foldersView->currentIndex()), true);
}
void LibraryWindow::setFolderAsRead()
{
//foldersModel->updateFolderFinishedStatus(foldersView->selectionModel()->selectedRows(),true);
// foldersModel->updateFolderFinishedStatus(foldersView->selectionModel()->selectedRows(),true);
foldersModel->updateFolderFinishedStatus(QModelIndexList() << foldersModelProxy->mapToSource(foldersView->currentIndex()), true);
}
void LibraryWindow::setFolderAsUnread()
{
//foldersModel->updateFolderFinishedStatus(foldersView->selectionModel()->selectedRows(),false);
// foldersModel->updateFolderFinishedStatus(foldersView->selectionModel()->selectedRows(),false);
foldersModel->updateFolderFinishedStatus(QModelIndexList() << foldersModelProxy->mapToSource(foldersView->currentIndex()), false);
}
@ -2579,8 +2579,8 @@ bool lessThanModelIndexRow(const QModelIndex &m1, const QModelIndex &m2)
QModelIndexList LibraryWindow::getSelectedComics()
{
//se fuerza a que haya almenos una fila seleccionada TODO comprobar se se puede forzar a la tabla a que lo haga automáticamente
//avoid selection.count()==0 forcing selection in comicsView
// se fuerza a que haya almenos una fila seleccionada TODO comprobar se se puede forzar a la tabla a que lo haga automáticamente
// avoid selection.count()==0 forcing selection in comicsView
QModelIndexList selection = comicsViewsManager->comicsView->selectionModel()->selectedRows();
QLOG_TRACE() << "selection count " << selection.length();
std::sort(selection.begin(), selection.end(), lessThanModelIndexRow);
@ -2594,7 +2594,7 @@ QModelIndexList LibraryWindow::getSelectedComics()
void LibraryWindow::deleteComics()
{
//TODO
// TODO
if (!listsView->selectionModel()->selectedRows().isEmpty()) {
deleteComicsFromList();
} else {
@ -2678,7 +2678,7 @@ void LibraryWindow::showFoldersContextMenu(const QPoint &point)
bool isManga = sourceMI.data(FolderModel::MangaRole).toBool();
QMenu menu;
//QMenu * folderMenu = new QMenu(tr("Folder"));
// QMenu * folderMenu = new QMenu(tr("Folder"));
menu.addAction(openContainingFolderAction);
menu.addAction(updateFolderAction);
menu.addSeparator(); //-------------------------------

View File

@ -110,16 +110,16 @@ public:
PropertiesDialog *propertiesDialog;
ComicVineDialog *comicVineDialog;
EditShortcutsDialog *editShortcutsDialog;
//YACReaderSocialDialog * socialDialog;
// YACReaderSocialDialog * socialDialog;
bool fullscreen;
bool importedCovers; //if true, the library is read only (not updates,open comic or properties)
bool importedCovers; // if true, the library is read only (not updates,open comic or properties)
bool fromMaximized;
PackageManager *packageManager;
QSize slideSizeW;
QSize slideSizeF;
//search filter
// search filter
#ifdef Q_OS_MAC
YACReaderMacOSXSearchLineEdit *searchEdit;
#else
@ -141,7 +141,7 @@ public:
ComicModel *comicsModel;
ReadingListModel *listsModel;
ReadingListModelProxy *listsModelProxy;
//QStringList paths;
// QStringList paths;
YACReaderLibraries libraries;
QStackedWidget *mainWidget;
@ -177,9 +177,9 @@ public:
QAction *optionsAction;
QAction *serverConfigAction;
QAction *toggleComicsViewAction;
//QAction * socialAction;
// QAction * socialAction;
//tree actions
// tree actions
QAction *addFolderAction;
QAction *deleteFolderAction;
//--
@ -205,13 +205,13 @@ public:
QAction *setMangaAction;
QAction *setNormalAction;
//QAction * setAllAsReadAction;
//QAction * setAllAsNonReadAction;
// QAction * setAllAsReadAction;
// QAction * setAllAsNonReadAction;
QAction *showHideMarksAction;
QAction *getInfoAction; //comic vine
QAction *getInfoAction; // comic vine
QAction *resetComicRatingAction;
//edit info actions
// edit info actions
QAction *selectAllComicsAction;
QAction *editSelectedComicsAction;
QAction *asignOrderAction;
@ -228,7 +228,7 @@ public:
QAction *updateFolderAction;
QAction *updateCurrentFolderAction;
//reading lists actions
// reading lists actions
QAction *addReadingListAction;
QAction *deleteReadingListAction;
QAction *addLabelAction;
@ -255,9 +255,9 @@ public:
QString _lastAdded;
QString _sourceLastAdded;
//QModelIndex _rootIndex;
//QModelIndex _rootIndexCV;
//QModelIndex updateDestination;
// QModelIndex _rootIndex;
// QModelIndex _rootIndexCV;
// QModelIndex updateDestination;
quint64 _comicIdEdited;
@ -280,29 +280,29 @@ public:
void setUpShortcutsManagement();
void doModels();
//ACTIONS MANAGEMENT
// ACTIONS MANAGEMENT
void disableComicsActions(bool disabled);
void disableLibrariesActions(bool disabled);
void disableNoUpdatedLibrariesActions(bool disabled);
void disableFoldersActions(bool disabled);
void disableAllActions();
//void disableActions();
//void enableActions();
//void enableLibraryActions();
// void disableActions();
// void enableActions();
// void enableLibraryActions();
QString currentPath();
QString currentFolderPath();
//settings
// settings
QSettings *settings;
//navigation backward and forward
// navigation backward and forward
YACReaderHistoryController *historyController;
bool removeError;
//QTBUG-41883
// QTBUG-41883
QSize _size;
QPoint _pos;
@ -330,7 +330,7 @@ public slots:
void reloadCurrentLibrary();
void openLastCreated();
void updateLibrary();
//void deleteLibrary();
// void deleteLibrary();
void openContainingFolder();
void setFolderAsNotCompleted();
void setFolderAsCompleted();
@ -377,7 +377,7 @@ public slots:
void deleteComics();
void deleteComicsFromDisk();
void deleteComicsFromList();
//void showSocial();
// void showSocial();
void showFoldersContextMenu(const QPoint &point);
void libraryAlreadyExists(const QString &name);
void importLibraryPackage();
@ -393,7 +393,7 @@ public slots:
void copyAndImportComicsToFolder(const QList<QPair<QString, QString>> &comics, const QModelIndex &miFolder);
void moveAndImportComicsToFolder(const QList<QPair<QString, QString>> &comics, const QModelIndex &miFolder);
void processComicFiles(ComicFilesManager *comicFilesManager, QProgressDialog *progressDialog);
void updateCopyMoveFolderDestination(const QModelIndex &mi); //imports new comics from the current folder
void updateCopyMoveFolderDestination(const QModelIndex &mi); // imports new comics from the current folder
void updateCurrentFolder();
void updateFolder(const QModelIndex &miFolder);
QProgressDialog *newProgressDialog(const QString &label, int maxValue);
@ -424,7 +424,7 @@ public slots:
void afterLaunchTasks();
private:
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
// fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
Qt::WindowFlags previousWindowFlags;
QPoint previousPos;
QSize previousSize;

View File

@ -29,7 +29,7 @@
#define PICTUREFLOW_QT4 1
//Server interface
// Server interface
Startup *s;
using namespace QsLogging;
@ -226,7 +226,7 @@ int main(int argc, char **argv)
logSystemAndConfig();
if (YACReaderLocalServer::isRunning()) //only a single instance of YACReaderLibrary is allowed
if (YACReaderLocalServer::isRunning()) // only a single instance of YACReaderLibrary is allowed
{
QLOG_WARN() << "another instance of YACReaderLibrary is running";
#ifdef Q_OS_WIN
@ -254,7 +254,7 @@ int main(int argc, char **argv)
mw->connect(localServer, &YACReaderLocalServer::comicUpdated, mw, &LibraryWindow::updateComicsView, Qt::QueuedConnection);
//connections to localServer
// connections to localServer
// start as tray
if (!settings->value(START_TO_TRAY, false).toBool() || !settings->value(CLOSE_TO_TRAY, false).toBool()) {
@ -272,7 +272,7 @@ int main(int argc, char **argv)
YACReader::exitCheck(ret);
//shutdown
// shutdown
s->stop();
delete s;
localServer->close();

View File

@ -74,7 +74,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(apiKeyButton, &QAbstractButton::clicked, this, &OptionsDialog::editApiKey);
//grid view background config
// grid view background config
useBackgroundImageCheck = new QCheckBox(tr("Enable background image"));
opacityLabel = new QLabel(tr("Opacity level"));
@ -120,7 +120,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(backgroundImageBlurRadiusSlider, &QAbstractSlider::valueChanged, this, &OptionsDialog::backgroundImageBlurRadiusSliderChanged);
connect(useCurrentComicCoverCheck, &QCheckBox::clicked, this, &OptionsDialog::useCurrentComicCoverCheckClicked);
connect(resetButton, &QPushButton::clicked, this, &OptionsDialog::resetToDefaults);
//end grid view background config
// end grid view background config
connect(displayContinueReadingBannerCheck, &QCheckBox::clicked, this, [this]() {
this->settings->setValue(DISPLAY_CONTINUE_READING_IN_GRID_VIEW, this->displayContinueReadingBannerCheck->isChecked());
@ -150,8 +150,8 @@ OptionsDialog::OptionsDialog(QWidget *parent)
layout->addWidget(tabWidget);
layout->addLayout(buttons);
setLayout(layout);
//restoreOptions(settings); //load options
//resize(200,0);
// restoreOptions(settings); //load options
// resize(200,0);
setModal(true);
setWindowTitle(tr("Options"));

View File

@ -13,13 +13,13 @@ void PackageManager::createPackage(const QString &libraryPath, const QString &de
<< "-y"
<< "-ttar" << dest + ".clc" << libraryPath;
_7z = new QProcess();
//TODO: Missing slot for openingError!!!
// TODO: Missing slot for openingError!!!
connect(_7z, SIGNAL(error(QProcess::ProcessError)), this, SLOT(openingError(QProcess::ProcessError)));
connect(_7z, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &PackageManager::exported);
#if defined Q_OS_UNIX && !defined Q_OS_MAC
_7z->start("7z", attributes); //TODO: use 7z.so
_7z->start("7z", attributes); // TODO: use 7z.so
#else
_7z->start(QCoreApplication::applicationDirPath() + "/utils/7zip", attributes); //TODO: use 7z.dll
_7z->start(QCoreApplication::applicationDirPath() + "/utils/7zip", attributes); // TODO: use 7z.dll
#endif
}
@ -34,9 +34,9 @@ void PackageManager::extractPackage(const QString &packagePath, const QString &d
connect(_7z, SIGNAL(error(QProcess::ProcessError)), this, SLOT(openingError(QProcess::ProcessError)));
connect(_7z, SIGNAL(finished(int, QProcess::ExitStatus)), this, SIGNAL(imported()));
#if defined Q_OS_UNIX && !defined Q_OS_MAC
_7z->start("7z", attributes); //TODO: use 7z.so
_7z->start("7z", attributes); // TODO: use 7z.so
#else
_7z->start(QCoreApplication::applicationDirPath() + "/utils/7zip", attributes); //TODO: use 7z.dll
_7z->start(QCoreApplication::applicationDirPath() + "/utils/7zip", attributes); // TODO: use 7z.dll
#endif
}
@ -46,9 +46,9 @@ void PackageManager::cancel()
_7z->disconnect();
_7z->kill();
if (creating) {
//TODO remove dest+".clc"
// TODO remove dest+".clc"
} else {
//TODO fixed: is done by libraryWindow
// TODO fixed: is done by libraryWindow
}
}
}

View File

@ -38,7 +38,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent)
createTabBar();
mainLayout = new QGridLayout;
//mainLayout->addWidget(coverBox,0,0);
// mainLayout->addWidget(coverBox,0,0);
mainLayout->addWidget(tabBar, 0, 1);
mainLayout->setColumnStretch(1, 1);
/*mainLayout->addWidget(authorsBox,1,1);
@ -56,7 +56,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent)
int sHeight, sWidth;
sHeight = static_cast<int>(heightDesktopResolution * 0.65);
sWidth = static_cast<int>(sHeight * 1.4);
//setCover(QPixmap(":/images/notCover.png"));
// setCover(QPixmap(":/images/notCover.png"));
this->move(QPoint((widthDesktopResolution - sWidth) / 2, ((heightDesktopResolution - sHeight) - 40) / 2));
setModal(true);
@ -118,9 +118,9 @@ void PropertiesDialog::createCoverBox()
coverBox->move(0, 444 - 28);
layout->setContentsMargins(5, 4, 5, 0);
//busyIndicator = new YACReaderBusyWidget(this);
//busyIndicator->move((280-busyIndicator->width())/2,(444-busyIndicator->height()-28)/2);
//busyIndicator->hide();
// busyIndicator = new YACReaderBusyWidget(this);
// busyIndicator->move((280-busyIndicator->width())/2,(444-busyIndicator->height()-28)/2);
// busyIndicator->hide();
connect(showPreviousCoverPageButton, &QAbstractButton::clicked, this, &PropertiesDialog::loadPreviousCover);
connect(showNextCoverPageButton, &QAbstractButton::clicked, this, &PropertiesDialog::loadNextCover);
@ -130,7 +130,7 @@ QFrame *createLine()
{
QFrame *line = new QFrame();
line->setObjectName(QString::fromUtf8("line"));
//line->setGeometry(QRect(320, 150, 118, 3));
// line->setGeometry(QRect(320, 150, 118, 3));
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
@ -144,7 +144,7 @@ void PropertiesDialog::createGeneralInfoBox()
auto generalInfoLayout = new QFormLayout;
generalInfoLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
//generalInfoLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
// generalInfoLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
generalInfoLayout->addRow(tr("Title:"), title = new YACReaderFieldEdit());
auto number = new QHBoxLayout;
@ -181,8 +181,8 @@ void PropertiesDialog::createGeneralInfoBox()
generalInfoLayout->addRow(tr("Size:"), size = new QLabel("size"));
//generalInfoLayout->addRow(tr("Comic Vine link:"), comicVineLink = new QLabel("..."));
//generalInfoLayout->addRow(bottom);
// generalInfoLayout->addRow(tr("Comic Vine link:"), comicVineLink = new QLabel("..."));
// generalInfoLayout->addRow(bottom);
auto main = new QVBoxLayout;
main->addLayout(generalInfoLayout);
@ -199,7 +199,7 @@ void PropertiesDialog::createAuthorsBox()
auto authorsLayout = new QVBoxLayout;
//authorsLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
// authorsLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
auto h1 = new QHBoxLayout;
auto vl1 = new QVBoxLayout;
auto vr1 = new QVBoxLayout;
@ -209,8 +209,8 @@ void PropertiesDialog::createAuthorsBox()
vr1->addWidget(new QLabel(tr("Penciller(s):")));
vr1->addWidget(penciller = new YACReaderFieldPlainTextEdit());
h1->addLayout(vr1);
//authorsLayout->addRow(tr("Writer(s):"), new YACReaderFieldPlainTextEdit());
//authorsLayout->addRow(tr("Penciller(s):"), new YACReaderFieldPlainTextEdit());
// authorsLayout->addRow(tr("Writer(s):"), new YACReaderFieldPlainTextEdit());
// authorsLayout->addRow(tr("Penciller(s):"), new YACReaderFieldPlainTextEdit());
auto h2 = new QHBoxLayout;
auto vl2 = new QVBoxLayout;
auto vr2 = new QVBoxLayout;
@ -221,8 +221,8 @@ void PropertiesDialog::createAuthorsBox()
vr2->addWidget(colorist = new YACReaderFieldPlainTextEdit());
h2->addLayout(vr2);
//authorsLayout->addRow(tr("Inker(s):"), new YACReaderFieldPlainTextEdit());
//authorsLayout->addRow(tr("Colorist(s):"), new YACReaderFieldPlainTextEdit());
// authorsLayout->addRow(tr("Inker(s):"), new YACReaderFieldPlainTextEdit());
// authorsLayout->addRow(tr("Colorist(s):"), new YACReaderFieldPlainTextEdit());
auto h3 = new QHBoxLayout;
auto vl3 = new QVBoxLayout;
@ -233,8 +233,8 @@ void PropertiesDialog::createAuthorsBox()
vr3->addWidget(new QLabel(tr("Cover Artist(s):")));
vr3->addWidget(coverArtist = new YACReaderFieldPlainTextEdit());
h3->addLayout(vr3);
//authorsLayout->addRow(tr("Letterer(es):"), new YACReaderFieldPlainTextEdit());
//authorsLayout->addRow(tr("Cover Artist(s):"), new YACReaderFieldPlainTextEdit());
// authorsLayout->addRow(tr("Letterer(es):"), new YACReaderFieldPlainTextEdit());
// authorsLayout->addRow(tr("Cover Artist(s):"), new YACReaderFieldPlainTextEdit());
authorsLayout->addLayout(h1);
authorsLayout->addLayout(h2);
@ -298,9 +298,9 @@ void PropertiesDialog::createButtonBox()
closeButton = buttonBox->addButton(QDialogButtonBox::Close);
saveButton = buttonBox->addButton(QDialogButtonBox::Save);
//rotateWidgetsButton = buttonBox->addButton(tr("Rotate &Widgets"),QDialogButtonBox::ActionRole);
// rotateWidgetsButton = buttonBox->addButton(tr("Rotate &Widgets"),QDialogButtonBox::ActionRole);
//connect(rotateWidgetsButton, SIGNAL(clicked()), this, SLOT(rotateWidgets()));
// connect(rotateWidgetsButton, SIGNAL(clicked()), this, SLOT(rotateWidgets()));
connect(closeButton, &QAbstractButton::clicked, this, &QWidget::close);
connect(saveButton, &QAbstractButton::clicked, this, &PropertiesDialog::save);
}
@ -607,7 +607,7 @@ void PropertiesDialog::save()
{
QList<ComicDB>::iterator itr;
for (itr = comics.begin(); itr != comics.end(); itr++) {
//Comic & comic = comics[0];
// Comic & comic = comics[0];
bool edited = false;
if (title->isModified()) {
@ -814,8 +814,8 @@ void PropertiesDialog::paintEvent(QPaintEvent *event)
p.drawPixmap(0, 0, coverImage);
//QPixmap shadow(":/images/social_dialog/shadow.png");
//p.drawPixmap(280-shadow.width(),0,shadow.width(),444,shadow);
// QPixmap shadow(":/images/social_dialog/shadow.png");
// p.drawPixmap(280-shadow.width(),0,shadow.width(),444,shadow);
p.drawLine(279, 0, 279, 444);
if (comics.length() == 1)
p.fillRect(0, 444 - 28, 280, 28, QColor(0, 0, 0, 153));
@ -843,7 +843,7 @@ void PropertiesDialog::loadNextCover()
}
showPreviousCoverPageButton->setEnabled(true);
//busyIndicator->show();
// busyIndicator->show();
if (current + 1 != comics.at(0).info.coverPage)
coverChanged = true;
else
@ -866,7 +866,7 @@ void PropertiesDialog::loadPreviousCover()
}
showNextCoverPageButton->setEnabled(true);
//busyIndicator->show();
// busyIndicator->show();
if (current - 1 != comics.at(0).info.coverPage.toInt())
coverChanged = true;
else

View File

@ -15,7 +15,7 @@ class YACReaderFieldEdit;
class YACReaderFieldPlainTextEdit;
class QDialogButtonBox;
class QCheckBox;
//class YACReaderBusyWidget;
// class YACReaderBusyWidget;
class QToolButton;
#include "comic_db.h"
@ -25,7 +25,7 @@ class PropertiesDialog : public QDialog
Q_OBJECT
private:
QWidget *mainWidget;
//YACReaderBusyWidget * busyIndicator;
// YACReaderBusyWidget * busyIndicator;
QGridLayout *mainLayout;
@ -132,7 +132,7 @@ public slots:
void setComics(QList<ComicDB> comics);
void updateComics();
void save();
//Deprecated
// Deprecated
void setCover(const QPixmap &cover);
void setMultipleCover();
void setFilename(const QString &name);

View File

@ -53,7 +53,7 @@ void RenameLibraryDialog::setupUI()
void RenameLibraryDialog::rename()
{
//accept->setEnabled(false);
// accept->setEnabled(false);
emit(renameLibrary(newNameEdit->text()));
}
@ -68,6 +68,6 @@ void RenameLibraryDialog::nameSetted(const QString &text)
void RenameLibraryDialog::close()
{
newNameEdit->clear();
//accept->setEnabled(false);
// accept->setEnabled(false);
QDialog::close();
}

View File

@ -33,8 +33,8 @@ void ComicController::service(HttpRequest &request, HttpResponse &response)
bool remoteComic = path.endsWith("remote");
//TODO
//if(pathElements.size() == 6)
// TODO
// if(pathElements.size() == 6)
//{
// QString action = pathElements.at(5);
// if(!action.isEmpty() && (action == "close"))
@ -43,7 +43,7 @@ void ComicController::service(HttpRequest &request, HttpResponse &response)
// response.write("",true);
// return;
// }
//}
// }
YACReaderLibraries libraries = DBHelper::getLibraries();
@ -82,10 +82,10 @@ void ComicController::service(HttpRequest &request, HttpResponse &response)
}
response.setHeader("Content-Type", "text/plain; charset=utf-8");
//TODO this field is not used by the client!
// TODO this field is not used by the client!
response.write(QString("library:%1\r\n").arg(libraryName).toUtf8());
response.write(QString("libraryId:%1\r\n").arg(libraryId).toUtf8());
if (remoteComic) //send previous and next comics id
if (remoteComic) // send previous and next comics id
{
QList<LibraryItem *> siblings = DBHelper::getFolderComicsFromLibrary(libraryId, comic.parentId, true);
bool found = false;
@ -102,15 +102,15 @@ void ComicController::service(HttpRequest &request, HttpResponse &response)
if (i < siblings.length() - 1)
response.write(QString("nextComic:%1\r\n").arg(siblings.at(i + 1)->id).toUtf8());
} else {
//ERROR
// ERROR
}
qDeleteAll(siblings);
}
response.write(comic.toTXT().toUtf8(), true);
} else {
//delete comicFile;
// delete comicFile;
response.setStatus(404, "not found");
response.write("404 not found", true);
}
//response.write(t.toLatin1(),true);
// response.write(t.toLatin1(),true);
}

View File

@ -22,7 +22,7 @@ void ComicDownloadInfoController::service(HttpRequest &request, HttpResponse &re
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
//TODO: check if the comic wasn't found;
// TODO: check if the comic wasn't found;
response.write(QString("fileName:%1\r\n").arg(comic.getFileName()).toUtf8());
response.write(QString("fileSize:%1\r\n").arg(comic.getFileSize()).toUtf8(), true);
}

View File

@ -19,7 +19,7 @@ void CoverController::service(HttpRequest &request, HttpResponse &response)
response.setHeader("Content-Type", "image/jpeg");
response.setHeader("Connection", "close");
//response.setHeader("Content-Type", "plain/text; charset=ISO-8859-1");
// response.setHeader("Content-Type", "plain/text; charset=ISO-8859-1");
YACReaderLibraries libraries = DBHelper::getLibraries();
@ -30,12 +30,12 @@ void CoverController::service(HttpRequest &request, HttpResponse &response)
bool folderCover = request.getParameter("folderCover").length() > 0;
//response.writeText(path+"<br/>");
//response.writeText(libraryName+"<br/>");
//response.writeText(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName+"<br/>");
// response.writeText(path+"<br/>");
// response.writeText(libraryName+"<br/>");
// response.writeText(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName+"<br/>");
//QFile file(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName);
//if (file.exists()) {
// QFile file(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName);
// if (file.exists()) {
// if (file.open(QIODevice::ReadOnly))
// {
// qDebug("StaticFileController: Open file %s",qPrintable(file.fileName()));
@ -81,7 +81,7 @@ void CoverController::service(HttpRequest &request, HttpResponse &response)
destImg.save(&buffer, "JPG");
response.write(ba, true);
}
//DONE else, hay que devolver un 404
// DONE else, hay que devolver un 404
else {
response.setStatus(404, "not found");
response.write("404 not found", true);

View File

@ -27,7 +27,7 @@ FolderController::FolderController() { }
void FolderController::service(HttpRequest &request, HttpResponse &response)
{
QSettings *settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
QSettings *settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); // TODO unificar la creación del fichero de config con el servidor
settings->beginGroup("libraryConfig");
bool showlessInfoPerFolder = settings->value(REMOTE_BROWSE_PERFORMANCE_WORKAROUND, false).toBool();
@ -38,8 +38,8 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
response.setHeader("Content-Type", "text/html; charset=utf-8");
response.setHeader("Connection", "close");
//QString y = session.get("xxx").toString();
//response.writeText(QString("session xxx : %1 <br/>").arg(y));
// QString y = session.get("xxx").toString();
// response.writeText(QString("session xxx : %1 <br/>").arg(y));
Template t = Static::templateLoader->getTemplate("folder", request.getHeader("Accept-Language"));
t.enableWarnings();
@ -70,14 +70,14 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
QList<LibraryItem *> folderContent = DBHelper::getFolderSubfoldersFromLibrary(libraryId, folderId);
QList<LibraryItem *> folderComics = DBHelper::getFolderComicsFromLibrary(libraryId, folderId);
//response.writeText(libraryName);
// response.writeText(libraryName);
folderContent.append(folderComics);
std::sort(folderContent.begin(), folderContent.end(), LibraryItemSorter());
folderComics.clear();
//qulonglong backId = DBHelper::getParentFromComicFolderId(libraryName,folderId);
// qulonglong backId = DBHelper::getParentFromComicFolderId(libraryName,folderId);
int page = 0;
QByteArray p = request.getParameter("page");
@ -85,8 +85,8 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
page = p.toInt();
// /comicIdi/pagei/comicIdj/pagej/....../comicIdn/pagen
//QString currentPath = session.get("currentPath").toString();
//QStringList pathSize = currentPath.split("/").last().toInt;
// QString currentPath = session.get("currentPath").toString();
// QStringList pathSize = currentPath.split("/").last().toInt;
bool fromUp = false;
@ -94,7 +94,7 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
if (map.contains("up"))
fromUp = true;
//int upPage = 0;
// int upPage = 0;
if (folderId == 1) {
ySession->clearNavigationPath();
@ -103,7 +103,7 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
} else {
if (fromUp)
ySession->popNavigationItem();
else //drill down or direct access
else // drill down or direct access
{
QStack<QPair<qulonglong, quint32>> path = ySession->getNavigationPath();
bool found = false;
@ -135,13 +135,13 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
int elementsPerPage = 24;
int numFolders = folderContent.length();
//int numComics = folderComics.length();
// int numComics = folderComics.length();
int totalLength = folderContent.length() + folderComics.length();
// int numFolderPages = numFolders / elementsPerPage + ((numFolders%elementsPerPage)>0?1:0);
int numPages = totalLength / elementsPerPage + ((totalLength % elementsPerPage) > 0 ? 1 : 0);
//response.writeText(QString("Number of pages : %1 <br/>").arg(numPages));
// response.writeText(QString("Number of pages : %1 <br/>").arg(numPages));
if (page < 0)
page = 0;
@ -151,7 +151,7 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
int indexCurrentPage = page * elementsPerPage;
int numFoldersAtCurrentPage = qMax(0, qMin(numFolders - indexCurrentPage, elementsPerPage));
//PATH
// PATH
QStack<QPair<qulonglong, quint32>> foldersPath = ySession->getNavigationPath();
t.setVariable(QString("library.name"), libraryName);
t.setVariable(QString("library.url"), QString("/library/%1/folder/1").arg(libraryId));
@ -184,8 +184,8 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
t.setVariable(QString("element%1.browse").arg(i), QString("<a class =\"browseButton\" href=\"%1\">BROWSE</a>").arg(QString("/library/%1/folder/%2").arg(libraryId).arg(item->id)));
t.setVariable(QString("element%1.cover.browse").arg(i), QString("<a href=\"%1\">").arg(QString("/library/%1/folder/%2").arg(libraryId).arg(item->id)));
t.setVariable(QString("element%1.cover.browse.end").arg(i), "</a>");
//t.setVariable(QString("element%1.url").arg(i),"/library/"+libraryName+"/folder/"+QString("%1").arg(folderContent.at(i + (page*10))->id));
//t.setVariable(QString("element%1.downloadurl").arg(i),"/library/"+libraryName+"/folder/"+QString("%1/info").arg(folderContent.at(i + (page*elementsPerPage))->id));
// t.setVariable(QString("element%1.url").arg(i),"/library/"+libraryName+"/folder/"+QString("%1").arg(folderContent.at(i + (page*10))->id));
// t.setVariable(QString("element%1.downloadurl").arg(i),"/library/"+libraryName+"/folder/"+QString("%1/info").arg(folderContent.at(i + (page*elementsPerPage))->id));
t.setVariable(QString("element%1.download").arg(i), QString("<a onclick=\"this.innerHTML='IMPORTING';this.className='importedButton';\" class =\"importButton\" href=\"%1\">IMPORT</a>").arg("/library/" + QString::number(libraryId) + "/folder/" + QString("%1/info").arg(folderContent.at(i + (page * elementsPerPage))->id)));
t.setVariable(QString("element%1.read").arg(i), "");
@ -197,7 +197,7 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
t.setVariable(QString("element%1.class").arg(i), "cover");
const ComicDB *comic = (ComicDB *)item;
t.setVariable(QString("element%1.browse").arg(i), "");
//t.setVariable(QString("element%1.downloadurl").arg(i),"/library/"+libraryName+"/comic/"+QString("%1").arg(comic->id));
// t.setVariable(QString("element%1.downloadurl").arg(i),"/library/"+libraryName+"/comic/"+QString("%1").arg(comic->id));
if (!ySession->isComicOnDevice(comic->info.hash) && !ySession->isComicDownloaded(comic->info.hash))
t.setVariable(QString("element%1.download").arg(i), QString("<a onclick=\"this.innerHTML='IMPORTING';this.className='importedButton';\" class =\"importButton\" href=\"%1\">IMPORT</a>").arg("/library/" + QString::number(libraryId) + "/comic/" + QString("%1").arg(comic->id)));
else if (ySession->isComicOnDevice(comic->info.hash))
@ -205,7 +205,7 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
else
t.setVariable(QString("element%1.download").arg(i), QString("<div class=\"importedButton\">IMPORTING</div>"));
//t.setVariable(QString("element%1.image.url").arg(i),"/images/f.png");
// t.setVariable(QString("element%1.image.url").arg(i),"/images/f.png");
t.setVariable(QString("element%1.read").arg(i), QString("<a class =\"readButton\" href=\"%1\">READ</a>").arg("/library/" + QString::number(libraryId) + "/comic/" + QString("%1").arg(comic->id) + "/remote"));
@ -242,12 +242,12 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
int xyz = 1;
for (QList<LibraryItem *>::const_iterator itr = folderContent.constBegin(); itr != folderContent.constEnd(); itr++) {
firstChar = QString((*itr)->name[0]).toUpper();
firstChar = firstChar.normalized(QString::NormalizationForm_D).at(0); //TODO _D or _KD??
firstChar = firstChar.normalized(QString::NormalizationForm_D).at(0); // TODO _D or _KD??
bool ok;
/*int dec = */ firstChar.toInt(&ok, 10);
if (ok)
firstChar = "#";
//response.writeText(QString("%1 - %2 <br />").arg((*itr)->name).arg(xyz));
// response.writeText(QString("%1 - %2 <br />").arg((*itr)->name).arg(xyz));
if (indexCount.contains(firstChar))
indexCount.insert(firstChar, indexCount.value(firstChar) + 1);
else
@ -266,7 +266,7 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
int count = 0;
int indexPage = 0;
for (QList<QString>::const_iterator itr = index.constBegin(); itr != index.constEnd(); itr++) {
//response.writeText(QString("%1 - %2 <br />").arg(*itr).arg(count));
// response.writeText(QString("%1 - %2 <br />").arg(*itr).arg(count));
t.setVariable(QString("index%1.indexname").arg(i), *itr);
t.setVariable(QString("index%1.url").arg(i), QString("/library/%1/folder/%2?page=%3").arg(libraryId).arg(folderId).arg(indexPage));
i++;

View File

@ -25,14 +25,14 @@ void PageController::service(HttpRequest &request, HttpResponse &response)
QString path = QUrl::fromPercentEncoding(request.getPath()).toUtf8();
bool remote = path.endsWith("remote");
//QByteArray path2=request.getPath();
//qDebug("PageController: request to -> %s ",path2.data());
// QByteArray path2=request.getPath();
// qDebug("PageController: request to -> %s ",path2.data());
QStringList pathElements = path.split('/');
qulonglong comicId = pathElements.at(4).toULongLong();
unsigned int page = pathElements.at(6).toUInt();
//qDebug("lib name : %s",pathElements.at(2).data());
// qDebug("lib name : %s",pathElements.at(2).data());
Comic *comicFile;
qulonglong currentComicId;
@ -49,7 +49,7 @@ void PageController::service(HttpRequest &request, HttpResponse &response)
if (currentComicId != 0 && !QPointer<Comic>(comicFile).isNull()) {
if (comicId == currentComicId && page < comicFile->numPages()) {
if (comicFile->pageIsLoaded(page)) {
//qDebug("PageController: La página estaba cargada -> %s ",path.data());
// qDebug("PageController: La página estaba cargada -> %s ",path.data());
response.setHeader("Content-Type", "image/jpeg");
response.setHeader("Transfer-Encoding", "chunked");
QByteArray pageData = comicFile->getRawPage(page);
@ -59,22 +59,22 @@ void PageController::service(HttpRequest &request, HttpResponse &response)
int len = data.readRawData(buffer, 4096);
response.write(QByteArray(buffer, len));
}
//response.write(pageData,true);
// response.write(pageData,true);
response.write(QByteArray(), true);
} else {
//qDebug("PageController: La página NO estaba cargada 404 -> %s ",path.data());
response.setStatus(404, "not found"); //TODO qué mensaje enviar
// qDebug("PageController: La página NO estaba cargada 404 -> %s ",path.data());
response.setStatus(404, "not found"); // TODO qué mensaje enviar
response.write("404 not found", true);
}
} else {
if (comicId != currentComicId) {
//delete comicFile;
// delete comicFile;
if (remote)
ySession->dismissCurrentRemoteComic();
else
ySession->dismissCurrentComic();
}
response.setStatus(404, "not found"); //TODO qué mensaje enviar
response.setStatus(404, "not found"); // TODO qué mensaje enviar
response.write("404 not found", true);
}
} else {
@ -82,5 +82,5 @@ void PageController::service(HttpRequest &request, HttpResponse &response)
response.write("404 not found", true);
}
//response.write(t.toLatin1(),true);
// response.write(t.toLatin1(),true);
}

Some files were not shown because too many files have changed in this diff Show More