diff --git a/YACReader/bookmarks_dialog.cpp b/YACReader/bookmarks_dialog.cpp index 2c91f50f..aebfd574 100644 --- a/YACReader/bookmarks_dialog.cpp +++ b/YACReader/bookmarks_dialog.cpp @@ -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); @@ -161,17 +161,17 @@ void BookmarksDialog::keyPressEvent(QKeyEvent *event) /* void BookmarksDialog::show() { - QDialog::show(); - disconnect(animation,SIGNAL(finished()),this,SLOT(close())); - animation->setStartValue(0); - animation->setEndValue(1); - animation->start(); + QDialog::show(); + disconnect(animation,SIGNAL(finished()),this,SLOT(close())); + animation->setStartValue(0); + animation->setEndValue(1); + animation->start(); } void BookmarksDialog::hide() { - connect(animation,SIGNAL(finished()),this,SLOT(close())); - animation->setStartValue(1); - animation->setEndValue(0); - animation->start(); + connect(animation,SIGNAL(finished()),this,SLOT(close())); + animation->setStartValue(1); + animation->setEndValue(0); + animation->start(); }*/ diff --git a/YACReader/bookmarks_dialog.h b/YACReader/bookmarks_dialog.h index 97b075bc..a440b895 100644 --- a/YACReader/bookmarks_dialog.h +++ b/YACReader/bookmarks_dialog.h @@ -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); diff --git a/YACReader/configuration.cpp b/YACReader/configuration.cpp index 7fa04ca9..d45e945b 100644 --- a/YACReader/configuration.cpp +++ b/YACReader/configuration.cpp @@ -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(); } diff --git a/YACReader/configuration.h b/YACReader/configuration.h index b74d18c1..a1024621 100644 --- a/YACReader/configuration.h +++ b/YACReader/configuration.h @@ -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(settings->value(FITMODE, YACReader::FitMode::FullPage).toInt()); } void setFitMode(YACReader::FitMode fitMode) { settings->setValue(FITMODE, static_cast(fitMode)); } - //openRecent + // openRecent int getOpenRecentSize() { return settings->value("recentSize", 25).toInt(); } QStringList openRecentList() { return settings->value("recentFiles").toStringList(); } void updateOpenRecentList(QString path); diff --git a/YACReader/goto_flow.cpp b/YACReader/goto_flow.cpp index a596ac6f..97a8f4e0 100644 --- a/YACReader/goto_flow.cpp +++ b/YACReader/goto_flow.cpp @@ -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(); } } @@ -129,9 +129,9 @@ void GoToFlow::reset() { updateTimer->stop(); /*imagesLoaded.clear(); - numImagesLoaded = 0; - imagesReady.clear(); - rawImages.clear();*/ + numImagesLoaded = 0; + imagesReady.clear(); + rawImages.clear();*/ ready = false; } @@ -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); diff --git a/YACReader/goto_flow.h b/YACReader/goto_flow.h index efc9f52e..60664d42 100644 --- a/YACReader/goto_flow.h +++ b/YACReader/goto_flow.h @@ -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 imagesLoaded; @@ -66,7 +66,7 @@ public slots: }; //----------------------------------------------------------------------------- -//PageLoader +// PageLoader //----------------------------------------------------------------------------- class PageLoader : public QThread { diff --git a/YACReader/goto_flow_gl.h b/YACReader/goto_flow_gl.h index 683fcd00..e5d07a5c 100644 --- a/YACReader/goto_flow_gl.h +++ b/YACReader/goto_flow_gl.h @@ -31,7 +31,7 @@ private: YACReaderPageFlowGL *flow; void keyPressEvent(QKeyEvent *event) override; void resizeEvent(QResizeEvent *event) override; - //Comic * comic; + // Comic * comic; QSize imageSize; }; diff --git a/YACReader/goto_flow_toolbar.cpp b/YACReader/goto_flow_toolbar.cpp index 3561d0a9..183f7dc9 100644 --- a/YACReader/goto_flow_toolbar.cpp +++ b/YACReader/goto_flow_toolbar.cpp @@ -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); diff --git a/YACReader/goto_flow_widget.cpp b/YACReader/goto_flow_widget.cpp index b3178948..123472f4 100644 --- a/YACReader/goto_flow_widget.cpp +++ b/YACReader/goto_flow_widget.cpp @@ -19,7 +19,7 @@ GoToFlowWidget::GoToFlowWidget(QWidget *parent) setLayout(mainLayout); - //toolBar->installEventFilter(this); + // toolBar->installEventFilter(this); } GoToFlowWidget::~GoToFlowWidget() { } @@ -65,14 +65,14 @@ void GoToFlowWidget::updateSize() /*bool GoToFlowWidget::eventFilter(QObject * target, QEvent * event) { - if(event->type() == QEvent::KeyPress) - { - QKeyEvent * e = static_cast(event); - if(e->key()==Qt::Key_S || e->key() == Qt::Key_Space) - { - this->keyPressEvent(e); - return true; - } - } - return QWidget::eventFilter(target,event); + if(event->type() == QEvent::KeyPress) + { + QKeyEvent * e = static_cast(event); + if(e->key()==Qt::Key_S || e->key() == Qt::Key_Space) + { + this->keyPressEvent(e); + return true; + } + } + return QWidget::eventFilter(target,event); }*/ diff --git a/YACReader/goto_flow_widget.h b/YACReader/goto_flow_widget.h index 2104513d..03130fa7 100644 --- a/YACReader/goto_flow_widget.h +++ b/YACReader/goto_flow_widget.h @@ -36,7 +36,7 @@ signals: protected: void keyPressEvent(QKeyEvent *event) override; - //bool eventFilter(QObject *, QEvent *); + // bool eventFilter(QObject *, QEvent *); }; #endif diff --git a/YACReader/magnifying_glass.cpp b/YACReader/magnifying_glass.cpp index a7c9492b..49e3dab4 100644 --- a/YACReader/magnifying_glass.cpp +++ b/YACReader/magnifying_glass.cpp @@ -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(width() * zoomLevel); int zoomHeight = static_cast(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(); diff --git a/YACReader/main.cpp b/YACReader/main.cpp index 7a76640b..b11fec0c 100644 --- a/YACReader/main.cpp +++ b/YACReader/main.cpp @@ -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(); diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index f07f5e69..c00c8216 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -40,33 +40,33 @@ class MacToolBarSeparator : public QWidget { public: - MacToolBarSeparator(QWidget * parent =0) - :QWidget(parent) - { - setFixedWidth(2); - } + MacToolBarSeparator(QWidget * parent =0) + :QWidget(parent) + { + setFixedWidth(2); + } - void paintEvent(QPaintEvent *event) - { - Q_UNUSED(event); - QPainter painter(this); + void paintEvent(QPaintEvent *event) + { + Q_UNUSED(event); + QPainter painter(this); - QLinearGradient lG(0,0,0,height()); + QLinearGradient lG(0,0,0,height()); - lG.setColorAt(0,QColor(128,128,128,0)); - lG.setColorAt(0.5,QColor(128,128,128,255)); - lG.setColorAt(1,QColor(128,128,128,0)); + lG.setColorAt(0,QColor(128,128,128,0)); + lG.setColorAt(0.5,QColor(128,128,128,255)); + lG.setColorAt(1,QColor(128,128,128,0)); - painter.fillRect(0,0,1,height(),lG); + painter.fillRect(0,0,1,height(),lG); - QLinearGradient lG2(1,0,1,height()); + QLinearGradient lG2(1,0,1,height()); - lG2.setColorAt(0,QColor(220,220,220,0)); - lG2.setColorAt(0.5,QColor(220,220,220,255)); - lG2.setColorAt(1,QColor(220,220,220,0)); + lG2.setColorAt(0,QColor(220,220,220,0)); + lG2.setColorAt(0.5,QColor(220,220,220,255)); + lG2.setColorAt(1,QColor(220,220,220,0)); - painter.fillRect(1,0,1,height(),lG2); - } + painter.fillRect(1,0,1,height(),lG2); + } }; #endif*/ @@ -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 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,26 +1567,26 @@ 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)) - { - QMessageBox::critical(NULL,tr("Saving error log file...."),tr("There was a problem saving YACReader error log file. Please, check if you have enough permissions in the YACReader root folder.")); - } - else - { - QTextStream txtS(&f); - txtS << "METHOD : MainWindowViewer::getSiblingComics" << '\n'; - txtS << "ERROR : current comic not found in its own path" << '\n'; - txtS << path << '\n'; - txtS << currentComic << '\n'; - txtS << "Comic list count : " + list.count() << '\n'; - foreach(QString s, list){ - txtS << s << '\n'; - } - f.close(); - }*/ + if(!f.open(QIODevice::WriteOnly)) + { + QMessageBox::critical(NULL,tr("Saving error log file...."),tr("There was a problem saving YACReader error log file. Please, check if you have enough permissions in the YACReader root folder.")); + } + else + { + QTextStream txtS(&f); + txtS << "METHOD : MainWindowViewer::getSiblingComics" << '\n'; + txtS << "ERROR : current comic not found in its own path" << '\n'; + txtS << path << '\n'; + txtS << currentComic << '\n'; + txtS << "Comic list count : " + list.count() << '\n'; + foreach(QString s, list){ + txtS << s << '\n'; + } + f.close(); + }*/ } previousComicPath = nextComicPath = ""; @@ -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)); diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index 2113cd50..f2edee90 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -78,29 +78,29 @@ public slots: void toggleFitToWidthSlider(); /*void viewComic(); - void prev(); - void next(); - void updatePage();*/ + void prev(); + void next(); + 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; diff --git a/YACReader/notifications_label_widget.cpp b/YACReader/notifications_label_widget.cpp index 405cd0c4..4e601d83 100644 --- a/YACReader/notifications_label_widget.cpp +++ b/YACReader/notifications_label_widget.cpp @@ -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 diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index 0b9cf1d7..8ba99c40 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -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()); - //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; } diff --git a/YACReader/options_dialog.h b/YACReader/options_dialog.h index 3c278b74..d1af00b4 100644 --- a/YACReader/options_dialog.h +++ b/YACReader/options_dialog.h @@ -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 diff --git a/YACReader/page_label_widget.cpp b/YACReader/page_label_widget.cpp index 7182fec0..bab7106e 100644 --- a/YACReader/page_label_widget.cpp +++ b/YACReader/page_label_widget.cpp @@ -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(); diff --git a/YACReader/render.cpp b/YACReader/render.cpp index a63054d9..9139c504 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -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; @@ -213,15 +213,15 @@ BrightnessFilter::BrightnessFilter(int l) QImage BrightnessFilter::setFilter(const QImage &image) { /*int width = image.width(); - int height = image.height(); - QImage result(width,height,image.format()); + int height = image.height(); + QImage result(width,height,image.format()); - for(int j=0;j hist(256,0); + QVector hist(256,0); - for(int j=0;j 1; i--) - { - new_count += hist[i]; - percentage = new_count/count; - next_percentage = (new_count+hist[i-1])/count; - if(fabs (percentage - 0.006) < fabs (next_percentage - 0.006)) - { - max = i-1; - break; - } - } - QColor c; - int range = max - min; - for(int j=0;j 1; i--) + { + new_count += hist[i]; + percentage = new_count/count; + next_percentage = (new_count+hist[i-1])/count; + if(fabs (percentage - 0.006) < fabs (next_percentage - 0.006)) + { + max = i-1; + break; + } + } + QColor c; + int range = max - min; + for(int j=0;jgetRawData()->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(); } } diff --git a/YACReader/render.h b/YACReader/render.h index 6cf3bb6c..09835588 100644 --- a/YACReader/render.h +++ b/YACReader/render.h @@ -109,20 +109,20 @@ signals: /*class DoublePageRender : public PageRender { - Q_OBJECT + Q_OBJECT public: - DoublePageRender(Render * render, int firstPage, const QByteArray & firstPageData,const QByteArray & secondPageData, QImage * page,unsigned int degrees=0, QVector filters = QVector()); + DoublePageRender(Render * render, int firstPage, const QByteArray & firstPageData,const QByteArray & secondPageData, QImage * page,unsigned int degrees=0, QVector filters = QVector()); private: - int numPage; - QByteArray data; - QByteArray data2; - QImage * page; - unsigned int degrees; - QVector filters; - void run(); - Render * render; + int numPage; + QByteArray data; + QByteArray data2; + QImage * page; + unsigned int degrees; + QVector filters; + void run(); + Render * render; signals: - void pageReady(int); + void pageReady(int); }; */ @@ -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; diff --git a/YACReader/shortcuts_dialog.cpp b/YACReader/shortcuts_dialog.cpp index c7ad87de..af960c92 100644 --- a/YACReader/shortcuts_dialog.cpp +++ b/YACReader/shortcuts_dialog.cpp @@ -32,7 +32,7 @@ ShortcutsDialog::ShortcutsDialog(QWidget *parent) //"

General functions:


O : Open comic
Esc : Exit

" shortcuts->setReadOnly(true); shortcutsLayout->addWidget(shortcuts); - //shortcutsLayout->addWidget(shortcuts2); + // shortcutsLayout->addWidget(shortcuts2); shortcutsLayout->setSpacing(0); mainLayout->addLayout(shortcutsLayout); mainLayout->addLayout(bottomLayout); diff --git a/YACReader/translator.cpp b/YACReader/translator.cpp index 5dbc7df2..f35ddfc0 100644 --- a/YACReader/translator.cpp +++ b/YACReader/translator.cpp @@ -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); diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 3bb3563a..8e4a743e 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -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::of(&Render::errorOpening), this, QOverload::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) @@ -592,8 +592,8 @@ void Viewer::keyPressEvent(QKeyEvent *event) QKeySequence key(_key); /*if(goToFlow->isVisible() && event->key()!=Qt::Key_S) - QCoreApplication::sendEvent(goToFlow,event); - else*/ + QCoreApplication::sendEvent(goToFlow,event); + else*/ if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_ACTION_Y)) { posByStep = height() / numScrollSteps; @@ -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 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(); diff --git a/YACReader/viewer.h b/YACReader/viewer.h index 858c2772..f7aab2ed 100644 --- a/YACReader/viewer.h +++ b/YACReader/viewer.h @@ -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 - //! Comic - //Comic * comic; + //! Image properties + //! 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: diff --git a/YACReader/yacreader_local_client.cpp b/YACReader/yacreader_local_client.cpp index e3effc32..d845d67e 100644 --- a/YACReader/yacreader_local_client.cpp +++ b/YACReader/yacreader_local_client.cpp @@ -13,16 +13,16 @@ 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)));*/ + this, SLOT(displayError(QLocalSocket::LocalSocketError)));*/ } 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()); diff --git a/YACReaderLibrary/add_label_dialog.cpp b/YACReaderLibrary/add_label_dialog.cpp index 0ae4594c..215e91ae 100644 --- a/YACReaderLibrary/add_label_dialog.cpp +++ b/YACReaderLibrary/add_label_dialog.cpp @@ -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); diff --git a/YACReaderLibrary/add_library_dialog.cpp b/YACReaderLibrary/add_library_dialog.cpp index 66054961..13e10694 100644 --- a/YACReaderLibrary/add_library_dialog.cpp +++ b/YACReaderLibrary/add_library_dialog.cpp @@ -68,7 +68,7 @@ void AddLibraryDialog::setupUI() void AddLibraryDialog::add() { - //accept->setEnabled(false); + // accept->setEnabled(false); emit(addLibrary(QDir::cleanPath(path->text()), nameEdit->text())); } diff --git a/YACReaderLibrary/classic_comics_view.cpp b/YACReaderLibrary/classic_comics_view.cpp index 6dbce64f..c10cebb9 100644 --- a/YACReaderLibrary/classic_comics_view.cpp +++ b/YACReaderLibrary/classic_comics_view.cpp @@ -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(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; } diff --git a/YACReaderLibrary/classic_comics_view.h b/YACReaderLibrary/classic_comics_view.h index 87122dc7..98bb02ef 100644 --- a/YACReaderLibrary/classic_comics_view.h +++ b/YACReaderLibrary/classic_comics_view.h @@ -42,7 +42,7 @@ public slots: void saveSplitterStatus(); void applyModelChanges(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &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); diff --git a/YACReaderLibrary/comic_files_manager.cpp b/YACReaderLibrary/comic_files_manager.cpp index 9f225be1..091e36fa 100644 --- a/YACReaderLibrary/comic_files_manager.cpp +++ b/YACReaderLibrary/comic_files_manager.cpp @@ -36,7 +36,7 @@ QList> ComicFilesManager::getDroppedFiles(const QList(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.... } } diff --git a/YACReaderLibrary/comic_files_manager.h b/YACReaderLibrary/comic_files_manager.h index 3333341d..ae39c23d 100644 --- a/YACReaderLibrary/comic_files_manager.h +++ b/YACReaderLibrary/comic_files_manager.h @@ -6,7 +6,7 @@ #include #include -//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(); diff --git a/YACReaderLibrary/comic_flow.cpp b/YACReaderLibrary/comic_flow.cpp index 7077c376..4f56afd8 100644 --- a/YACReaderLibrary/comic_flow.cpp +++ b/YACReaderLibrary/comic_flow.cpp @@ -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]; diff --git a/YACReaderLibrary/comic_flow.h b/YACReaderLibrary/comic_flow.h index a7f0627f..4eaea255 100644 --- a/YACReaderLibrary/comic_flow.h +++ b/YACReaderLibrary/comic_flow.h @@ -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 newOrder); diff --git a/YACReaderLibrary/comic_flow_widget.cpp b/YACReaderLibrary/comic_flow_widget.cpp index c33db9be..e515e8f3 100644 --- a/YACReaderLibrary/comic_flow_widget.cpp +++ b/YACReaderLibrary/comic_flow_widget.cpp @@ -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 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()); @@ -323,7 +323,7 @@ void ComicFlowWidgetGL::updateConfig(QSettings *settings) flow->setMaxAngle(settings->value(MAX_ANGLE).toInt()); /* flow->setVisibility(settings->value("visibilityDistance").toInt()); - flow->setLightStrenght(settings->value("lightStrength").toInt())*/ + flow->setLightStrenght(settings->value("lightStrength").toInt())*/ ; } @@ -337,14 +337,14 @@ void ComicFlowWidgetGL::resortCovers(QList 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);} diff --git a/YACReaderLibrary/comic_flow_widget.h b/YACReaderLibrary/comic_flow_widget.h index 69cdf291..4d822272 100644 --- a/YACReaderLibrary/comic_flow_widget.h +++ b/YACReaderLibrary/comic_flow_widget.h @@ -103,7 +103,7 @@ public: void updateConfig(QSettings *settings) override; void remove(int cover) override; void resortCovers(QList newOrder) override; - //public slots: + // public slots: // void setCF_RX(int value); // //the Y Rotation of the Coverflow // void setCF_RY(int value); diff --git a/YACReaderLibrary/comic_vine/api_key_dialog.cpp b/YACReaderLibrary/comic_vine/api_key_dialog.cpp index 678cedac..ae063da4 100644 --- a/YACReaderLibrary/comic_vine/api_key_dialog.cpp +++ b/YACReaderLibrary/comic_vine/api_key_dialog.cpp @@ -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 here")); @@ -57,7 +57,7 @@ ApiKeyDialog::~ApiKeyDialog() void ApiKeyDialog::enableAccept(const QString &text) { - //TODO key validation + // TODO key validation acceptButton->setEnabled(!text.isEmpty()); } diff --git a/YACReaderLibrary/comic_vine/comic_vine_client.cpp b/YACReaderLibrary/comic_vine/comic_vine_client.cpp index d53291f0..10bae8fe 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_client.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_client.cpp @@ -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); diff --git a/YACReaderLibrary/comic_vine/comic_vine_client.h b/YACReaderLibrary/comic_vine/comic_vine_client.h index 8b7f1152..6b36806e 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_client.h +++ b/YACReaderLibrary/comic_vine/comic_vine_client.h @@ -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); diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp index 511c0243..fd8a1130 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp @@ -151,7 +151,7 @@ void ComicVineDialog::goNext() } else if (content->currentWidget() == sortVolumeComicsWidget) { showLoading(); - //ComicDB-ComicVineID + // ComicDB-ComicVineID QList> 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> &matchingInfo QList 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 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); } diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.h b/YACReaderLibrary/comic_vine/comic_vine_dialog.h index 7e4291cc..f2531b0a 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.h +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.h @@ -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; diff --git a/YACReaderLibrary/comic_vine/model/local_comic_list_model.cpp b/YACReaderLibrary/comic_vine/model/local_comic_list_model.cpp index 7ae45af8..d6874f90 100644 --- a/YACReaderLibrary/comic_vine/model/local_comic_list_model.cpp +++ b/YACReaderLibrary/comic_vine/model/local_comic_list_model.cpp @@ -13,7 +13,7 @@ void LocalComicListModel::load(QList &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 diff --git a/YACReaderLibrary/comic_vine/model/local_comic_list_model.h b/YACReaderLibrary/comic_vine/model/local_comic_list_model.h index d3835f0b..14baff98 100644 --- a/YACReaderLibrary/comic_vine/model/local_comic_list_model.h +++ b/YACReaderLibrary/comic_vine/model/local_comic_list_model.h @@ -13,7 +13,7 @@ public: void load(QList &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; diff --git a/YACReaderLibrary/comic_vine/model/volume_comics_model.cpp b/YACReaderLibrary/comic_vine/model/volume_comics_model.cpp index f490454c..a67f1211 100644 --- a/YACReaderLibrary/comic_vine/model/volume_comics_model.cpp +++ b/YACReaderLibrary/comic_vine/model/volume_comics_model.cpp @@ -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); diff --git a/YACReaderLibrary/comic_vine/model/volume_comics_model.h b/YACReaderLibrary/comic_vine/model/volume_comics_model.h index 3e893ba9..aee4bfc3 100644 --- a/YACReaderLibrary/comic_vine/model/volume_comics_model.h +++ b/YACReaderLibrary/comic_vine/model/volume_comics_model.h @@ -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; diff --git a/YACReaderLibrary/comic_vine/model/volumes_model.cpp b/YACReaderLibrary/comic_vine/model/volumes_model.cpp index 9161a0e4..ae8de88c 100644 --- a/YACReaderLibrary/comic_vine/model/volumes_model.cpp +++ b/YACReaderLibrary/comic_vine/model/volumes_model.cpp @@ -10,7 +10,7 @@ VolumesModel::VolumesModel(QObject *parent) VolumesModel::~VolumesModel() { - //std::for_each(_data.begin(), _data.end(), [](QList * ptr) { delete ptr; }); + // std::for_each(_data.begin(), _data.end(), [](QList * 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 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); diff --git a/YACReaderLibrary/comic_vine/model/volumes_model.h b/YACReaderLibrary/comic_vine/model/volumes_model.h index 654e4fdc..69f2fbe8 100644 --- a/YACReaderLibrary/comic_vine/model/volumes_model.h +++ b/YACReaderLibrary/comic_vine/model/volumes_model.h @@ -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; diff --git a/YACReaderLibrary/comic_vine/scraper_tableview.cpp b/YACReaderLibrary/comic_vine/scraper_tableview.cpp index 4aaf7da9..08f23296 100644 --- a/YACReaderLibrary/comic_vine/scraper_tableview.cpp +++ b/YACReaderLibrary/comic_vine/scraper_tableview.cpp @@ -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); diff --git a/YACReaderLibrary/comic_vine/search_single_comic.cpp b/YACReaderLibrary/comic_vine/search_single_comic.cpp index 18efe1d5..de11a586 100644 --- a/YACReaderLibrary/comic_vine/search_single_comic.cpp +++ b/YACReaderLibrary/comic_vine/search_single_comic.cpp @@ -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; } diff --git a/YACReaderLibrary/comic_vine/select_comic.cpp b/YACReaderLibrary/comic_vine/select_comic.cpp index f2947938..68b568e6 100644 --- a/YACReaderLibrary/comic_vine/select_comic.cpp +++ b/YACReaderLibrary/comic_vine/select_comic.cpp @@ -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")); diff --git a/YACReaderLibrary/comic_vine/select_volume.cpp b/YACReaderLibrary/comic_vine/select_volume.cpp index 1a6bd61a..0282208b 100644 --- a/YACReaderLibrary/comic_vine/select_volume.cpp +++ b/YACReaderLibrary/comic_vine/select_volume.cpp @@ -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); diff --git a/YACReaderLibrary/comic_vine/sort_volume_comics.cpp b/YACReaderLibrary/comic_vine/sort_volume_comics.cpp index e9166c3e..3b3e2fba 100644 --- a/YACReaderLibrary/comic_vine/sort_volume_comics.cpp +++ b/YACReaderLibrary/comic_vine/sort_volume_comics.cpp @@ -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 &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> 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(c, id)); } diff --git a/YACReaderLibrary/comics_remover.cpp b/YACReaderLibrary/comics_remover.cpp index 8c6fb9c6..7cf0aa77 100644 --- a/YACReaderLibrary/comics_remover.cpp +++ b/YACReaderLibrary/comics_remover.cpp @@ -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(); diff --git a/YACReaderLibrary/comics_view.cpp b/YACReaderLibrary/comics_view.cpp index 0fa9940d..3f3146eb 100644 --- a/YACReaderLibrary/comics_view.cpp +++ b/YACReaderLibrary/comics_view.cpp @@ -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(); diff --git a/YACReaderLibrary/comics_view.h b/YACReaderLibrary/comics_view.h index cee4c6ab..12f780a7 100644 --- a/YACReaderLibrary/comics_view.h +++ b/YACReaderLibrary/comics_view.h @@ -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>); void moveComicsToCurrentFolder(QList>); protected: ComicModel *model; - //Drop to import + // Drop to import void dragEnterEvent(QDragEnterEvent *event) override; void dropEvent(QDropEvent *event) override; diff --git a/YACReaderLibrary/create_library_dialog.cpp b/YACReaderLibrary/create_library_dialog.cpp index c805493e..2c49d272 100644 --- a/YACReaderLibrary/create_library_dialog.cpp +++ b/YACReaderLibrary/create_library_dialog.cpp @@ -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); diff --git a/YACReaderLibrary/db/comic_item.h b/YACReaderLibrary/db/comic_item.h index 4745abd6..ae7da704 100644 --- a/YACReaderLibrary/db/comic_item.h +++ b/YACReaderLibrary/db/comic_item.h @@ -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 itemData; }; diff --git a/YACReaderLibrary/db/comic_model.cpp b/YACReaderLibrary/db/comic_model.cpp index c15d09d2..53cf16f4 100644 --- a/YACReaderLibrary/db/comic_model.cpp +++ b/YACReaderLibrary/db/comic_model.cpp @@ -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 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 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 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); @@ -246,17 +246,17 @@ QVariant ComicModel::data(const QModelIndex &index, int role) const return QVariant(); /*if (index.column() == TableModel::Rating && role == Qt::DecorationRole) - { - TableItem *item = static_cast(index.internalPointer()); - return QPixmap(QString(":/images/rating%1.png").arg(item->data(index.column()).toInt())); - }*/ + { + TableItem *item = static_cast(index.internalPointer()); + return QPixmap(QString(":/images/rating%1.png").arg(item->data(index.column()).toInt())); + }*/ if (role == Qt::DecorationRole) { return QVariant(); } 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(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 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 ComicModel::getReadList() } return readList; } -//TODO untested, this method is no longer used +// TODO untested, this method is no longer used QVector ComicModel::setAllComicsRead(YACReaderComicReadStatus read) { return setComicsRead(persistentIndexList(), read); @@ -742,7 +742,7 @@ QList ComicModel::getComics(QList list) } return comics; } -//TODO +// TODO QVector ComicModel::setComicsRead(QList 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 ComicModel::getIndexesFromIds(const QList &comicIds) { QList 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); diff --git a/YACReaderLibrary/db/comic_model.h b/YACReaderLibrary/db/comic_model.h index fe628311..508503de 100644 --- a/YACReaderLibrary/db/comic_model.h +++ b/YACReaderLibrary/db/comic_model.h @@ -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 getReadList(); QVector setAllComicsRead(YACReaderComicReadStatus readStatus); QList getComics(QList list); //--> recupera la información común a los comics seleccionados QList getAllComics(); QModelIndex getIndexFromId(quint64 id); QList getIndexesFromIds(const QList &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 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 list); -->inserta la información común para los comics seleccionados QVector setComicsRead(QList list, YACReaderComicReadStatus read); void setComicsManga(QList list, bool isManga); qint64 asignNumbers(QList 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); diff --git a/YACReaderLibrary/db/comic_query_result_processor.cpp b/YACReaderLibrary/db/comic_query_result_processor.cpp index d00ddebb..e154f159 100644 --- a/YACReaderLibrary/db/comic_query_result_processor.cpp +++ b/YACReaderLibrary/db/comic_query_result_processor.cpp @@ -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(); diff --git a/YACReaderLibrary/db/data_base_management.cpp b/YACReaderLibrary/db/data_base_management.cpp index c77db70c..8c9d545e 100644 --- a/YACReaderLibrary/db/data_base_management.cpp +++ b/YACReaderLibrary/db/data_base_management.cpp @@ -53,12 +53,12 @@ DataBaseManagement::DataBaseManagement() /*TreeModel * DataBaseManagement::newTreeModel(QString path) { - //la consulta se ejecuta... - QSqlQuery selectQuery(loadDatabase(path)); - selectQuery.setForwardOnly(true); - selectQuery.exec("select * from folder order by parentId,name"); - //selectQuery.finish(); - return new TreeModel(selectQuery); + //la consulta se ejecuta... + QSqlQuery selectQuery(loadDatabase(path)); + selectQuery.setForwardOnly(true); + selectQuery.exec("select * from folder order by parentId,name"); + //selectQuery.finish(); + return new TreeModel(selectQuery); }*/ QSqlDatabase DataBaseManagement::createDatabase(QString name, QString path) @@ -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() diff --git a/YACReaderLibrary/db/data_base_management.h b/YACReaderLibrary/db/data_base_management.h index 3eac4a40..1654d734 100644 --- a/YACReaderLibrary/db/data_base_management.h +++ b/YACReaderLibrary/db/data_base_management.h @@ -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); }; diff --git a/YACReaderLibrary/db/folder_item.cpp b/YACReaderLibrary/db/folder_item.cpp index 661a4604..9444d3fd 100644 --- a/YACReaderLibrary/db/folder_item.cpp +++ b/YACReaderLibrary/db/folder_item.cpp @@ -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� disponible, sino el nombre del fichero..... + QString nameLast = last->data(1).toString(); // TODO usar info name si est� disponible, sino el nombre del fichero..... QString nameCurrent = item->data(1).toString(); QList::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�s + if (!naturalSortLessThanCI(nameCurrent, nameLast)) // si se ha encontrado un elemento menor que current, se inserta justo despu�s childItems.insert(++i, item); else childItems.insert(i, item); } - //childItems.append(item); + // childItems.append(item); } FolderItem *FolderItem::child(int row) diff --git a/YACReaderLibrary/db/folder_model.cpp b/YACReaderLibrary/db/folder_model.cpp index 6b04360c..e362f5f1 100644 --- a/YACReaderLibrary/db/folder_model.cpp +++ b/YACReaderLibrary/db/folder_model.cpp @@ -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�z no necesite tener informaci�n + // lo m�s probable es que el nodo ra�z no necesite tener informaci�n QList 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�z + // inicializar el nodo ra�z QList 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�n que soporta sqlit 2^64 - //el diccionario permitir� encontrar cualquier nodo del �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�n que soporta sqlit 2^64 + // el diccionario permitir� encontrar cualquier nodo del �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�n de hijos se hace de forma ordenada + // la inserci�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�n de hijos se hace de forma ordenada + // la inserci�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(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 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 *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; diff --git a/YACReaderLibrary/db/folder_model.h b/YACReaderLibrary/db/folder_model.h index 419f9df8..8a045906 100644 --- a/YACReaderLibrary/db/folder_model.h +++ b/YACReaderLibrary/db/folder_model.h @@ -27,7 +27,7 @@ public: protected: FolderItem *rootItem; - QMap filteredItems; //relación entre folders + QMap 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 items; //relación entre folders + FolderItem *rootItem; // el árbol + QMap items; // relación entre folders QString _databasePath; }; diff --git a/YACReaderLibrary/db/folder_query_result_processor.cpp b/YACReaderLibrary/db/folder_query_result_processor.cpp index 3cbde454..eafeacf6 100644 --- a/YACReaderLibrary/db/folder_query_result_processor.cpp +++ b/YACReaderLibrary/db/folder_query_result_processor.cpp @@ -12,7 +12,7 @@ #include #include -//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�z + // inicializar el nodo ra�z QList rootData; rootData << "root"; rootItem = new FolderItem(rootData); @@ -97,7 +97,7 @@ void YACReader::FolderQueryResultProcessor::setupFilteredModelData(QSqlQuery &sq QMap *filteredItems = new QMap(); - //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 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�tico en la vista + // es necesario conocer las coordenadas de origen para poder realizar scroll autom�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 �l y todos los padres hasta el nodo ra�z + else // si el padre a�n no se ha a�adido, hay que a�adirlo a �l y todos los padres hasta el nodo ra�z { - //comprobamos con esta variable si el �ltimo de los padres (antes del nodo ra�z) ya exist�a en el modelo + // comprobamos con esta variable si el �ltimo de los padres (antes del nodo ra�z) ya exist�a en el modelo bool parentPreviousInserted = false; - //mientras no se alcance el nodo ra�z se procesan todos los padres (de abajo a arriba) + // mientras no se alcance el nodo ra�z se procesan todos los padres (de abajo a arriba) while (parentId != ROOT) { - //el padre no estaba en el modelo filtrado, as� que se rescata del modelo original + // el padre no estaba en el modelo filtrado, as� 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� 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� 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�a sido previamente insertado como hijo, se a�ade como tal + // si el nodo es hijo de 1 y no hab�a sido previamente insertado como hijo, se a�ade como tal if (!parentPreviousInserted) { filteredItems->value(ROOT)->appendChild(item); } else { diff --git a/YACReaderLibrary/db/query_lexer.cpp b/YACReaderLibrary/db/query_lexer.cpp index 832b4978..7b317cdc 100644 --- a/YACReaderLibrary/db/query_lexer.cpp +++ b/YACReaderLibrary/db/query_lexer.cpp @@ -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); } diff --git a/YACReaderLibrary/db/query_parser.cpp b/YACReaderLibrary/db/query_parser.cpp index 25cf71ae..2015fd73 100644 --- a/YACReaderLibrary/db/query_parser.cpp +++ b/YACReaderLibrary/db/query_parser.cpp @@ -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(); } diff --git a/YACReaderLibrary/db/reading_list_item.cpp b/YACReaderLibrary/db/reading_list_item.cpp index 53bf7199..eaec184b 100644 --- a/YACReaderLibrary/db/reading_list_item.cpp +++ b/YACReaderLibrary/db/reading_list_item.cpp @@ -134,12 +134,12 @@ ReadingListItem::ReadingListItem(const QList &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())) diff --git a/YACReaderLibrary/db/reading_list_item.h b/YACReaderLibrary/db/reading_list_item.h index 612bc6cf..58af7483 100644 --- a/YACReaderLibrary/db/reading_list_item.h +++ b/YACReaderLibrary/db/reading_list_item.h @@ -6,7 +6,7 @@ #include "yacreader_global_gui.h" #include "reading_list_model.h" -//TODO add propper constructors, using QList is not safe +// TODO add propper constructors, using QList is not safe class ListItem { diff --git a/YACReaderLibrary/db/reading_list_model.cpp b/YACReaderLibrary/db/reading_list_model.cpp index 5f301257..d731fcd3 100644 --- a/YACReaderLibrary/db/reading_list_model.cpp +++ b/YACReaderLibrary/db/reading_list_model.cpp @@ -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(parent.internalPointer()); @@ -108,7 +108,7 @@ Qt::ItemFlags ReadingListModel::flags(const QModelIndex &index) const return {}; if (typeid(*item) == typeid(ReadingListItem) && static_cast(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(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> 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> 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(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(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 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() << "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,18 +652,18 @@ void ReadingListModel::setupLabels(QSqlDatabase &db) void ReadingListModel::setupReadingLists(QSqlDatabase &db) { - //setup root item + // setup root item rootItem = new ReadingListItem(QList() << "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 - // ReadingListItem * node1; - // rootItem->appendChild(node1 = new ReadingListItem(QList() /*<< 0*/ << "My reading list" << "atr")); - // rootItem->appendChild(new ReadingListItem(QList() /*<< 0*/ << "X timeline" << "atr")); + // TEST + // ReadingListItem * node1; + // rootItem->appendChild(node1 = new ReadingListItem(QList() /*<< 0*/ << "My reading list" << "atr")); + // rootItem->appendChild(new ReadingListItem(QList() /*<< 0*/ << "X timeline" << "atr")); // node1->appendChild(new ReadingListItem(QList() /*<< 0*/ << "sublist" << "atr",node1)); } @@ -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 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; diff --git a/YACReaderLibrary/db/reading_list_model.h b/YACReaderLibrary/db/reading_list_model.h index 71d66b92..1a743f87 100644 --- a/YACReaderLibrary/db/reading_list_model.h +++ b/YACReaderLibrary/db/reading_list_model.h @@ -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 specialLists; - //Label + // Label QList labels; - //Reading lists + // Reading lists ReadingListItem *rootItem; // - QMap items; //lists relationship + QMap items; // lists relationship - //separators + // separators ReadingListSeparatorItem *separator1; ReadingListSeparatorItem *separator2; diff --git a/YACReaderLibrary/db_helper.cpp b/YACReaderLibrary/db_helper.cpp index 13c632cc..b5679440 100644 --- a/YACReaderLibrary/db_helper.cpp +++ b/YACReaderLibrary/db_helper.cpp @@ -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 DBHelper::getFavorites(qulonglong libraryId) connectionName = db.connectionName(); } - //TODO ? + // TODO ? QSqlDatabase::removeDatabase(connectionName); return list; @@ -314,7 +314,7 @@ QList DBHelper::getReading(qulonglong libraryId) } connectionName = db.connectionName(); } - //TODO ? + // TODO ? QSqlDatabase::removeDatabase(connectionName); return list; @@ -353,7 +353,7 @@ QList DBHelper::getReadingLists(qulonglong libraryId) } connectionName = db.connectionName(); } - //TODO ? + // TODO ? QSqlDatabase::removeDatabase(connectionName); return list; @@ -435,14 +435,14 @@ QList 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 &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 &comicsList, QSqlDatabase &db) { db.transaction(); @@ -506,7 +506,7 @@ void DBHelper::deleteComicsFromReading(const QList &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 &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> DBHelper::updateFromRemoteClient(const QMap 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 &comicsList, qulon db.commit(); } -//queries +// queries QList DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDatabase &db, bool sort) { QList 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 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 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 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 DBHelper::getSortedComicsFromParent(qulonglong parentId, QSqlData } }); - //selectQuery.finish(); + // selectQuery.finish(); return list; } QList DBHelper::getComicsFromParent(qulonglong parentId, QSqlDatabase &db, bool sort) @@ -1432,7 +1432,7 @@ QList