From 8ae63e562af907d0645f46dad943ebee57236528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 24 Aug 2013 17:41:16 +0200 Subject: [PATCH] fixed lots of warnings --- YACReader/bookmarks.cpp | 1 + YACReader/comic.cpp | 13 +- YACReader/comic.h | 2 +- YACReader/configuration.cpp | 4 +- YACReader/configuration.h | 4 +- YACReader/goto_flow.cpp | 3 +- YACReader/goto_flow.h | 2 +- YACReader/goto_flow_gl.cpp | 2 +- YACReader/goto_flow_widget.h | 2 + YACReader/magnifying_glass.cpp | 15 +- YACReader/main_window_viewer.cpp | 2 + YACReader/render.cpp | 14 +- YACReader/translator.cpp | 3 +- YACReader/viewer.cpp | 2 + YACReader/width_slider.cpp | 2 +- YACReader/yacreader_local_client.cpp | 6 +- YACReaderLibrary/comic_flow.h | 2 +- YACReaderLibrary/comic_flow_widget.cpp | 1 + YACReaderLibrary/db/data_base_management.cpp | 8 +- YACReaderLibrary/db/tablemodel.cpp | 165 +++++++-------- YACReaderLibrary/db/tablemodel.h | 20 +- YACReaderLibrary/db_helper.cpp | 2 + YACReaderLibrary/import_library_dialog.cpp | 3 +- YACReaderLibrary/import_widget.cpp | 4 +- YACReaderLibrary/library_creator.cpp | 1 - YACReaderLibrary/library_window.cpp | 9 +- YACReaderLibrary/library_window.h | 2 + YACReaderLibrary/options_dialog.h | 2 +- .../server/controllers/errorcontroller.cpp | 1 + .../server/controllers/foldercontroller.cpp | 6 +- .../server/lib/bfHttpServer/httpsession.cpp | 198 +++++++++--------- YACReaderLibrary/yacreader_local_server.cpp | 6 +- common/check_new_version.cpp | 6 +- common/pictureflow.cpp | 6 +- common/pictureflow.h | 2 + common/yacreader_flow_gl.cpp | 10 +- common/yacreader_flow_gl.h | 2 +- common/yacreader_global.h | 4 + compressed_archive/compressed_archive.cpp | 2 +- compressed_archive/extract_callbacks.h | 4 +- custom_widgets/yacreader_busy_widget.cpp | 7 +- .../yacreader_library_list_widget.cpp | 1 + custom_widgets/yacreader_sidebar.cpp | 2 +- .../yacreader_spin_slider_widget.cpp | 2 + custom_widgets/yacreader_table_view.cpp | 14 +- 45 files changed, 315 insertions(+), 254 deletions(-) diff --git a/YACReader/bookmarks.cpp b/YACReader/bookmarks.cpp index e0fbf2cd..3edf920b 100644 --- a/YACReader/bookmarks.cpp +++ b/YACReader/bookmarks.cpp @@ -146,6 +146,7 @@ void BookmarksList::save() void BookmarksList::deleteOldest(int num) { + Q_UNUSED(num) QString comic; QDateTime date(QDate(10000,1,1));//TODO MAX_DATE?? for(QMap::const_iterator itr=list.begin();itr!=list.end();itr++) diff --git a/YACReader/comic.cpp b/YACReader/comic.cpp index d3b4212c..a80135b9 100644 --- a/YACReader/comic.cpp +++ b/YACReader/comic.cpp @@ -91,6 +91,12 @@ QPixmap * Comic::operator[](unsigned int index) p->loadFromData(_pages[index]); return p; }*/ +bool Comic::load(const QString & path, const ComicDB & comic) +{ + Q_UNUSED(path); + Q_UNUSED(comic); + return false; +}; //----------------------------------------------------------------------------- bool Comic::loaded() { @@ -287,12 +293,13 @@ void FileComic::fileExtracted(int index, const QByteArray & rawData) void FileComic::crcError(int index) { - emit errorOpening(tr("CRC error: some of the pages will not be displayed correctly")); + emit errorOpening(tr("CRC error on page (%1): some of the pages will not be displayed correctly").arg(index)); } //TODO: comprobar que si se produce uno de estos errores, la carga del cómic es irrecuperable void FileComic::unknownError(int index) { + Q_UNUSED(index) //emit errorOpening(tr("Unknown error opening the file")); //emit errorOpening(); } @@ -312,7 +319,7 @@ QList > FileComic::getSections(int & sectionIndex) int sectionCount = 0; QVector section; int idx = 0; - int realIdx; + unsigned int realIdx; foreach(quint32 i, sortedIndexes) { @@ -427,8 +434,6 @@ void FileComic::process() _cfi=0; qSort(_fileNames.begin(),_fileNames.end(), naturalSortLessThanCI); - int index = 0; - int sortedIndex = 0; if(_firstPage == -1) _firstPage = bm->getLastPage(); diff --git a/YACReader/comic.h b/YACReader/comic.h index fbdca482..1d944a07 100644 --- a/YACReader/comic.h +++ b/YACReader/comic.h @@ -49,7 +49,7 @@ class ComicDB; void setup(); //Load pages from file virtual bool load(const QString & path, int atPage = -1) = 0; - virtual bool load(const QString & path, const ComicDB & comic){return false;}; + virtual bool load(const QString & path, const ComicDB & comic); /*void loadFromFile(const QString & pathFile); void loadFromDir(const QString & pathDir); diff --git a/YACReader/configuration.cpp b/YACReader/configuration.cpp index 58810d63..40bbbfea 100644 --- a/YACReader/configuration.cpp +++ b/YACReader/configuration.cpp @@ -13,10 +13,10 @@ Configuration::Configuration() //load("/YACReader.conf"); } -Configuration::Configuration(const Configuration & conf) +/*Configuration::Configuration(const Configuration & conf) { //nothing -} +}*/ void Configuration::load(QSettings * settings) { diff --git a/YACReader/configuration.h b/YACReader/configuration.h index a8a5e79f..fd0c53ba 100644 --- a/YACReader/configuration.h +++ b/YACReader/configuration.h @@ -12,6 +12,8 @@ #define CONF_FILE_PATH "." #define SLIDE_ASPECT_RATIO 1.585 +using namespace YACReader; + class Configuration : public QObject { Q_OBJECT @@ -37,7 +39,7 @@ QColor backgroundColor; Configuration(); - Configuration(const Configuration & conf); + //Configuration(const Configuration & conf); void load(const QString & path = CONF_FILE_PATH); diff --git a/YACReader/goto_flow.cpp b/YACReader/goto_flow.cpp index 854490c1..512f943f 100644 --- a/YACReader/goto_flow.cpp +++ b/YACReader/goto_flow.cpp @@ -228,8 +228,7 @@ void GoToFlow::updateSize() //TODO : fix. it doesn't work. void GoToFlow::updateConfig(QSettings * settings) { - - + Q_UNUSED(settings) } //----------------------------------------------------------------------------- //SlideInitializer diff --git a/YACReader/goto_flow.h b/YACReader/goto_flow.h index 96793772..26e07565 100644 --- a/YACReader/goto_flow.h +++ b/YACReader/goto_flow.h @@ -39,7 +39,7 @@ private: QVector imagesLoaded; QVector imagesSetted; - uint numImagesLoaded; + int numImagesLoaded; QVector imagesReady; QVector rawImages; QTimer* updateTimer; diff --git a/YACReader/goto_flow_gl.cpp b/YACReader/goto_flow_gl.cpp index fd587032..210e1600 100644 --- a/YACReader/goto_flow_gl.cpp +++ b/YACReader/goto_flow_gl.cpp @@ -14,7 +14,7 @@ GoToFlowGL::GoToFlowGL(QWidget* parent, FlowType flowType) :GoToFlowWidget(parent) { - + Q_UNUSED(flowType) flow = new YACReaderPageFlowGL(this); flow->setShowMarks(false); diff --git a/YACReader/goto_flow_widget.h b/YACReader/goto_flow_widget.h index 68972144..78debdd5 100644 --- a/YACReader/goto_flow_widget.h +++ b/YACReader/goto_flow_widget.h @@ -5,6 +5,8 @@ #include #include "yacreader_global.h" +using namespace YACReader; + class QSettings; class GoToFlowDecorationBar; class GoToFlowToolBar; diff --git a/YACReader/magnifying_glass.cpp b/YACReader/magnifying_glass.cpp index e5a61776..3751c038 100644 --- a/YACReader/magnifying_glass.cpp +++ b/YACReader/magnifying_glass.cpp @@ -27,6 +27,7 @@ void MagnifyingGlass::setup(const QSize & size) void MagnifyingGlass::mouseMoveEvent(QMouseEvent * event) { updateImage(); + event->accept(); } void MagnifyingGlass::updateImage(int x, int y) @@ -191,20 +192,20 @@ void MagnifyingGlass::wheelEvent(QWheelEvent * event) } void MagnifyingGlass::zoomIn() { - if(zoomLevel>0.2) - zoomLevel -= 0.025; + if(zoomLevel>0.2f) + zoomLevel -= 0.025f; } void MagnifyingGlass::zoomOut() { - if(zoomLevel<0.9) - zoomLevel += 0.025; + if(zoomLevel<0.9f) + zoomLevel += 0.025f; } void MagnifyingGlass::sizeUp() { Viewer * p = (Viewer *)parent(); - if(width()<(p->width()*0.90)) + if(width()<(p->width()*0.90f)) resize(width()+30,height()+15); } @@ -217,7 +218,7 @@ void MagnifyingGlass::sizeDown() void MagnifyingGlass::heightUp() { Viewer * p = (Viewer *)parent(); - if(height()<(p->height()*0.90)) + if(height()<(p->height()*0.90f)) resize(width(),height()+15); } @@ -230,7 +231,7 @@ void MagnifyingGlass::heightDown() void MagnifyingGlass::widthUp() { Viewer * p = (Viewer *)parent(); - if(width()<(p->width()*0.90)) + if(width()<(p->width()*0.90f)) resize(width()+30,height()); } diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 50310f33..52caa782 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -881,6 +881,8 @@ void MainWindowViewer::newVersion() void MainWindowViewer::closeEvent ( QCloseEvent * event ) { + Q_UNUSED(event) + if(isClient) sendComic(); diff --git a/YACReader/render.cpp b/YACReader/render.cpp index 43274a56..88468adc 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -523,7 +523,7 @@ void Render::render() if(doublePage) { if(pagesReady[currentIndex] && pagesReady[qMin(currentIndex+1,(int)comic->numPages()-1)]) - if(currentIndex+1 > comic->numPages()-1) + if(currentIndex+1 > (int)comic->numPages()-1) pageRenders[currentPageBufferedIndex] = new DoublePageRender(this,currentIndex,comic->getRawData()->at(currentIndex),QByteArray(),buffer[currentPageBufferedIndex],imageRotation,filters); else pageRenders[currentPageBufferedIndex] = new DoublePageRender(this,currentIndex,comic->getRawData()->at(currentIndex),comic->getRawData()->at(currentIndex+1),buffer[currentPageBufferedIndex],imageRotation,filters); @@ -577,7 +577,7 @@ QPixmap * Render::getCurrentPage() void Render::setRotation(int degrees) { - + Q_UNUSED(degrees) } void Render::setComic(Comic * c) @@ -728,7 +728,7 @@ void Render::nextPage() if(doublePage) { nextPage = currentIndex; - if(currentIndex+2numPages()) + if(currentIndex+2<(int)comic->numPages()) { nextPage = currentIndex+2; if(currentIndex != nextPage) @@ -941,7 +941,7 @@ void Render::fillBuffer() { for(int i = 1; i <= qMax(numLeftPages,numRightPages); i++) { - if ((currentIndex+i < comic->numPages()) && + if ((currentIndex+i < (int)comic->numPages()) && buffer[currentPageBufferedIndex+i]->isNull() && i <= numRightPages && pageRenders[currentPageBufferedIndex+i]==0 && @@ -969,13 +969,13 @@ void Render::fillBufferDoublePage() { for(int i = 1; i <= qMax(numLeftPages,numRightPages); i++) { - if ((currentIndex+2*i < comic->numPages()) && + if ((currentIndex+2*i < (int)comic->numPages()) && buffer[currentPageBufferedIndex+i]->isNull() && i <= numRightPages && pageRenders[currentPageBufferedIndex+i]==0 && (pagesReady[currentIndex+2*i] && pagesReady[qMin(currentIndex+(2*i)+1,(int)comic->numPages()-1)])) //preload next pages { - if(currentIndex+(2*i)+1 > comic->numPages()-1) + if(currentIndex+(2*i)+1 > (int)comic->numPages()-1) pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(this,currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),QByteArray(),buffer[currentPageBufferedIndex+i],imageRotation,filters); else pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(this,currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),comic->getRawData()->at(currentIndex+(2*i)+1),buffer[currentPageBufferedIndex+i],imageRotation,filters); @@ -1033,7 +1033,7 @@ void Render::doublePageSwitch() QString Render::getCurrentPagesInformation() { QString s = QString::number(currentIndex+1); - if (doublePage && (currentIndex+1 < comic->numPages())) + if (doublePage && (currentIndex+1 < (int)comic->numPages())) s += "-"+QString::number(currentIndex+2); s += "/"+QString::number(comic->numPages()); return s; diff --git a/YACReader/translator.cpp b/YACReader/translator.cpp index a2745510..94747f40 100644 --- a/YACReader/translator.cpp +++ b/YACReader/translator.cpp @@ -304,13 +304,14 @@ void YACReaderTranslator::mousePressEvent(QMouseEvent *event) void YACReaderTranslator::mouseReleaseEvent(QMouseEvent *event) { drag = false; + event->accept(); } void YACReaderTranslator::mouseMoveEvent(QMouseEvent * event) { if(drag) this->move(QPoint(mapToParent(event->pos())-click)); - + event->accept(); } //--------------------------------------------------------------------------- diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index a7d97bf1..dbc86c2a 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -787,11 +787,13 @@ void Viewer::mousePressEvent ( QMouseEvent * event ) yDragOrigin = event->y(); xDragOrigin = event->x(); setCursor(Qt::ClosedHandCursor); + event->accept(); } void Viewer::mouseReleaseEvent ( QMouseEvent * event ) { drag = false; setCursor(Qt::OpenHandCursor); + event->accept(); } void Viewer::updateFitToWidthRatio(float ratio) diff --git a/YACReader/width_slider.cpp b/YACReader/width_slider.cpp index 8b1716bf..0ffbf101 100644 --- a/YACReader/width_slider.cpp +++ b/YACReader/width_slider.cpp @@ -7,7 +7,7 @@ #include "configuration.h" YACReaderSliderAction::YACReaderSliderAction (QWidget * parent) - :QWidgetAction (0) { + :QWidgetAction (parent) { QWidget* pWidget = new QWidget (NULL); QHBoxLayout* pLayout = new QHBoxLayout(); diff --git a/YACReader/yacreader_local_client.cpp b/YACReader/yacreader_local_client.cpp index 9ef353ff..731849d9 100644 --- a/YACReader/yacreader_local_client.cpp +++ b/YACReader/yacreader_local_client.cpp @@ -4,6 +4,8 @@ #include +using namespace YACReader; + YACReaderLocalClient::YACReaderLocalClient(QObject *parent) : QObject(parent) { @@ -30,7 +32,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB & comic, QDataStream out(&block, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_8); out << (quint16)0; - out << (quint8)YACReaderIPCMessages::RequestComicInfo; + out << (quint8)YACReader::RequestComicInfo; out << libraryId; out << comic; out.device()->seek(0); @@ -87,7 +89,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB & comic) QDataStream out(&block, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_8); out << (quint16)0; - out << (quint8)YACReaderIPCMessages::SendComicInfo; + out << (quint8)YACReader::SendComicInfo; out << libraryId; out << comic; out.device()->seek(0); diff --git a/YACReaderLibrary/comic_flow.h b/YACReaderLibrary/comic_flow.h index a8529d52..7d173550 100644 --- a/YACReaderLibrary/comic_flow.h +++ b/YACReaderLibrary/comic_flow.h @@ -34,7 +34,7 @@ private: QStringList imageFiles; QVector imagesLoaded; QVector imagesSetted; - uint numImagesLoaded; + int numImagesLoaded; QTimer* updateTimer; ImageLoader* worker; virtual void wheelEvent(QWheelEvent * event); diff --git a/YACReaderLibrary/comic_flow_widget.cpp b/YACReaderLibrary/comic_flow_widget.cpp index 89ccd547..9b523d57 100644 --- a/YACReaderLibrary/comic_flow_widget.cpp +++ b/YACReaderLibrary/comic_flow_widget.cpp @@ -247,6 +247,7 @@ void ComicFlowWidgetGL::keyPressEvent(QKeyEvent* event) void ComicFlowWidgetGL::paintEvent(QPaintEvent *event) { //flow->paintEvent(event); + ComicFlowWidget::paintEvent(event); } void ComicFlowWidgetGL::mousePressEvent(QMouseEvent* event) { diff --git a/YACReaderLibrary/db/data_base_management.cpp b/YACReaderLibrary/db/data_base_management.cpp index 1dcac348..4cf89ac3 100644 --- a/YACReaderLibrary/db/data_base_management.cpp +++ b/YACReaderLibrary/db/data_base_management.cpp @@ -602,7 +602,9 @@ ComicsInfoExporter::ComicsInfoExporter() void ComicsInfoExporter::exportComicsInfo(QSqlDatabase & source, QSqlDatabase & dest) { - + Q_UNUSED(source) + Q_UNUSED(dest) + //TODO check this method } void ComicsInfoExporter::run() @@ -619,7 +621,9 @@ ComicsInfoImporter::ComicsInfoImporter() void ComicsInfoImporter::importComicsInfo(QSqlDatabase & source, QSqlDatabase & dest) { - + Q_UNUSED(source) + Q_UNUSED(dest) + //TODO check this method } void ComicsInfoImporter::run() diff --git a/YACReaderLibrary/db/tablemodel.cpp b/YACReaderLibrary/db/tablemodel.cpp index 18c8762b..e6e408ec 100644 --- a/YACReaderLibrary/db/tablemodel.cpp +++ b/YACReaderLibrary/db/tablemodel.cpp @@ -10,21 +10,7 @@ #include "db_helper.h" //ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read -enum Columns { - Number = 0, - Title = 1, - FileName = 2, - NumPages = 3, - Id = 4, - Parent_Id = 5, - Path = 6, - Hash = 7, - ReadColumn = 8, - IsBis = 9, - CurrentPage = 10, - Rating = 11, - HasBeenOpened = 12 -}; + TableModel::TableModel(QObject *parent) @@ -52,6 +38,7 @@ TableModel::~TableModel() //! [2] int TableModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent) if(_data.isEmpty()) return 0; return _data.first()->columnCount(); @@ -64,7 +51,7 @@ QVariant TableModel::data(const QModelIndex &index, int role) const if (!index.isValid()) return QVariant(); - /*if (index.column() == Columns::Rating && role == Qt::DecorationRole) + /*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())); @@ -79,13 +66,13 @@ QVariant TableModel::data(const QModelIndex &index, int role) const { switch(index.column())//TODO obtener esto de la query { - case 0: + case TableModel::Number: return QVariant(Qt::AlignRight | Qt::AlignVCenter); - case 3: + case TableModel::NumPages: return QVariant(Qt::AlignRight | Qt::AlignVCenter); - case 7: + case TableModel::Hash: return QVariant(Qt::AlignRight | Qt::AlignVCenter); - case Columns::CurrentPage: + case TableModel::CurrentPage: return QVariant(Qt::AlignRight | Qt::AlignVCenter); default: return QVariant(Qt::AlignLeft | Qt::AlignVCenter); @@ -97,14 +84,14 @@ QVariant TableModel::data(const QModelIndex &index, int role) const return QVariant(); TableItem *item = static_cast(index.internalPointer()); - if(index.column() == Columns::Hash) + if(index.column() == TableModel::Hash) return QString::number(item->data(index.column()).toString().right(item->data(index.column()).toString().length()-40).toInt()/1024.0/1024.0,'f',2)+"Mb"; - if(index.column() == Columns::ReadColumn) - return (item->data(Columns::CurrentPage).toInt()==item->data(Columns::NumPages).toInt() || item->data(Columns::ReadColumn).toBool())?QVariant(tr("yes")):QVariant(tr("no")); - if(index.column() == Columns::CurrentPage) - return item->data(Columns::HasBeenOpened).toBool()?item->data(index.column()):QVariant("-"); + if(index.column() == TableModel::ReadColumn) + return (item->data(TableModel::CurrentPage).toInt()==item->data(TableModel::NumPages).toInt() || item->data(TableModel::ReadColumn).toBool())?QVariant(tr("yes")):QVariant(tr("no")); + if(index.column() == TableModel::CurrentPage) + return item->data(TableModel::HasBeenOpened).toBool()?item->data(index.column()):QVariant("-"); - if (index.column() == Columns::Rating) + if (index.column() == TableModel::Rating) return QVariant(); return item->data(index.column()); @@ -116,7 +103,7 @@ Qt::ItemFlags TableModel::flags(const QModelIndex &index) const { if (!index.isValid()) return 0; - if(index.column() == Columns::Rating) + if(index.column() == TableModel::Rating) return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable; return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -130,21 +117,21 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation, { switch(section)//TODO obtener esto de la query { - case 0: + case TableModel::Number: return QVariant(QString("#")); - case 1: + case TableModel::Title: return QVariant(QString(tr("Title"))); - case 2: + case TableModel::FileName: return QVariant(QString(tr("File Name"))); - case 3: + case TableModel::NumPages: return QVariant(QString(tr("Pages"))); - case 7: + case TableModel::Hash: return QVariant(QString(tr("Size"))); - case 8: + case TableModel::ReadColumn: return QVariant(QString(tr("Read"))); - case Columns::CurrentPage: + case TableModel::CurrentPage: return QVariant(QString(tr("Current Page"))); - case Columns::Rating: + case TableModel::Rating: return QVariant(QString(tr("Rating"))); } } @@ -153,13 +140,13 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation, { switch(section)//TODO obtener esto de la query { - case 0: + case TableModel::Number: return QVariant(Qt::AlignRight | Qt::AlignVCenter); - case 3: + case TableModel::NumPages: return QVariant(Qt::AlignRight | Qt::AlignVCenter); - case 7: + case TableModel::Hash: return QVariant(Qt::AlignRight | Qt::AlignVCenter); - case Columns::CurrentPage: + case TableModel::CurrentPage: return QVariant(Qt::AlignRight | Qt::AlignVCenter); default: return QVariant(Qt::AlignLeft | Qt::AlignVCenter); @@ -169,7 +156,7 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation, if(orientation == Qt::Vertical && role == Qt::DecorationRole) { - QString fileName = _data.value(section)->data(Columns::FileName).toString(); + QString fileName = _data.value(section)->data(TableModel::FileName).toString(); QFileInfo fi(fileName); QString ext = fi.suffix(); @@ -212,14 +199,14 @@ QModelIndex TableModel::index(int row, int column, const QModelIndex &parent) //! [7] QModelIndex TableModel::parent(const QModelIndex &index) const { - return QModelIndex(); + Q_UNUSED(index) + return QModelIndex(); } //! [7] //! [8] int TableModel::rowCount(const QModelIndex &parent) const { - TreeItem *parentItem; if (parent.column() > 0) return 0; @@ -237,7 +224,7 @@ QStringList TableModel::getPaths(const QString & _source) QList::ConstIterator itr; for(itr = _data.constBegin();itr != _data.constEnd();itr++) { - QString hash = (*itr)->data(Columns::Hash).toString(); + QString hash = (*itr)->data(TableModel::Hash).toString(); paths << source+ hash +".jpg"; } @@ -280,7 +267,7 @@ void TableModel::setupModelData(unsigned long long int folderId,const QString & QString TableModel::getComicPath(QModelIndex mi) { if(mi.isValid()) - return _data.at(mi.row())->data(Columns::Path).toString(); + return _data.at(mi.row())->data(TableModel::Path).toString(); return ""; } #define NUMBER_MAX 99999999 @@ -301,16 +288,16 @@ void TableModel::setupModelData(QSqlQuery &sqlquery) else { TableItem * last = _data.back(); - QString nameLast = last->data(Columns::FileName).toString(); - QString nameCurrent = currentItem->data(Columns::FileName).toString(); + QString nameLast = last->data(TableModel::FileName).toString(); + QString nameCurrent = currentItem->data(TableModel::FileName).toString(); int numberLast,numberCurrent; numberLast = numberCurrent = NUMBER_MAX; //TODO change by std limit - if(!last->data(Columns::Number).isNull()) - numberLast = last->data(Columns::Number).toInt(); + if(!last->data(TableModel::Number).isNull()) + numberLast = last->data(TableModel::Number).toInt(); - if(!currentItem->data(Columns::Number).isNull()) - numberCurrent = currentItem->data(Columns::Number).toInt(); + if(!currentItem->data(TableModel::Number).isNull()) + numberCurrent = currentItem->data(TableModel::Number).toInt(); QList::iterator i; i = _data.end(); @@ -323,8 +310,8 @@ void TableModel::setupModelData(QSqlQuery &sqlquery) i--; numberLast = NUMBER_MAX; //TODO change by std limit - if(!(*i)->data(Columns::Number).isNull()) - numberLast = (*i)->data(Columns::Number).toInt(); + if(!(*i)->data(TableModel::Number).isNull()) + numberLast = (*i)->data(TableModel::Number).toInt(); } } else @@ -332,11 +319,11 @@ void TableModel::setupModelData(QSqlQuery &sqlquery) while ((lessThan = naturalSortLessThanCI(nameCurrent,nameLast)) && i != _data.begin() && numberLast == 99999999) { i--; - nameLast = (*i)->data(Columns::FileName).toString(); + nameLast = (*i)->data(TableModel::FileName).toString(); numberLast = NUMBER_MAX; //TODO change by std limit - if(!(*i)->data(Columns::Number).isNull()) - numberLast = (*i)->data(Columns::Number).toInt(); + if(!(*i)->data(TableModel::Number).isNull()) + numberLast = (*i)->data(TableModel::Number).toInt(); } } @@ -345,7 +332,7 @@ void TableModel::setupModelData(QSqlQuery &sqlquery) if(numberCurrent != NUMBER_MAX) { if(numberCurrent == numberLast) - if(currentItem->data(Columns::IsBis).toBool()) + if(currentItem->data(TableModel::IsBis).toBool()) { _data.insert(++i,currentItem); } @@ -369,7 +356,7 @@ void TableModel::setupModelData(QSqlQuery &sqlquery) ComicDB TableModel::getComic(const QModelIndex & mi) { QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath); - ComicDB c = DBHelper::loadComic(_data.at(mi.row())->data(Columns::Id).toULongLong(),db); + ComicDB c = DBHelper::loadComic(_data.at(mi.row())->data(TableModel::Id).toULongLong(),db); db.close(); QSqlDatabase::removeDatabase(_databasePath); @@ -379,7 +366,7 @@ ComicDB TableModel::getComic(const QModelIndex & mi) ComicDB TableModel::_getComic(const QModelIndex & mi) { QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath); - ComicDB c = DBHelper::loadComic(_data.at(mi.row())->data(Columns::Id).toULongLong(),db); + ComicDB c = DBHelper::loadComic(_data.at(mi.row())->data(TableModel::Id).toULongLong(),db); db.close(); QSqlDatabase::removeDatabase(_databasePath); @@ -393,14 +380,14 @@ QVector TableModel::getReadList() QVector readList(numComics); for(int i=0;idata(Columns::ReadColumn).toBool()) - readList[i] = YACReaderComicReadStatus::Read; - else if (_data.value(i)->data(Columns::CurrentPage).toInt() == _data.value(i)->data(Columns::NumPages).toInt()) - readList[i] = YACReaderComicReadStatus::Read; - else if (_data.value(i)->data(Columns::HasBeenOpened).toBool()) - readList[i] = YACReaderComicReadStatus::Opened; + if(_data.value(i)->data(TableModel::ReadColumn).toBool()) + readList[i] = YACReader::Read; + else if (_data.value(i)->data(TableModel::CurrentPage).toInt() == _data.value(i)->data(TableModel::NumPages).toInt()) + readList[i] = YACReader::Read; + else if (_data.value(i)->data(TableModel::HasBeenOpened).toBool()) + readList[i] = YACReader::Opened; else - readList[i] = YACReaderComicReadStatus::Unread; + readList[i] = YACReader::Unread; } return readList; } @@ -414,17 +401,17 @@ QVector TableModel::setAllComicsRead(YACReaderComicRea for(int i=0;isetData(Columns::ReadColumn,QVariant(true)); - ComicDB c = DBHelper::loadComic(_data.value(i)->data(Columns::Id).toULongLong(),db); + _data.value(i)->setData(TableModel::ReadColumn,QVariant(true)); + ComicDB c = DBHelper::loadComic(_data.value(i)->data(TableModel::Id).toULongLong(),db); c.info.read = true; DBHelper::update(&(c.info),db); } - if(read == YACReaderComicReadStatus::Unread) + if(read == YACReader::Unread) { - _data.value(i)->setData(Columns::ReadColumn,QVariant(false)); - ComicDB c = DBHelper::loadComic(_data.value(i)->data(Columns::Id).toULongLong(),db); + _data.value(i)->setData(TableModel::ReadColumn,QVariant(false)); + ComicDB c = DBHelper::loadComic(_data.value(i)->data(TableModel::Id).toULongLong(),db); c.info.read = false; DBHelper::update(&(c.info),db); } @@ -433,7 +420,7 @@ QVector TableModel::setAllComicsRead(YACReaderComicRea db.close(); QSqlDatabase::removeDatabase(_databasePath); - emit dataChanged(index(0,Columns::ReadColumn),index(numComics-1,Columns::ReadColumn)); + emit dataChanged(index(0,TableModel::ReadColumn),index(numComics-1,TableModel::ReadColumn)); return readList; } @@ -447,7 +434,7 @@ QList TableModel::getAllComics() int numComics = _data.count(); for(int i=0;idata(Columns::Id).toULongLong(),db)); + comics.append(DBHelper::loadComic(_data.value(i)->data(TableModel::Id).toULongLong(),db)); } db.commit(); @@ -480,17 +467,17 @@ QVector TableModel::setComicsRead(QList l db.transaction(); foreach (QModelIndex mi, list) { - if(read == YACReaderComicReadStatus::Read) + if(read == YACReader::Read) { - _data.value(mi.row())->setData(Columns::ReadColumn, QVariant(true)); - ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(Columns::Id).toULongLong(),db); + _data.value(mi.row())->setData(TableModel::ReadColumn, QVariant(true)); + ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(TableModel::Id).toULongLong(),db); c.info.read = true; DBHelper::update(&(c.info),db); } - if(read == YACReaderComicReadStatus::Unread) + if(read == YACReader::Unread) { - _data.value(mi.row())->setData(Columns::ReadColumn, QVariant(false)); - ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(Columns::Id).toULongLong(),db); + _data.value(mi.row())->setData(TableModel::ReadColumn, QVariant(false)); + ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(TableModel::Id).toULongLong(),db); c.info.read = false; DBHelper::update(&(c.info),db); } @@ -499,7 +486,7 @@ QVector TableModel::setComicsRead(QList l db.close(); QSqlDatabase::removeDatabase(_databasePath); - emit dataChanged(index(list.first().row(),Columns::ReadColumn),index(list.last().row(),Columns::ReadColumn)); + emit dataChanged(index(list.first().row(),TableModel::ReadColumn),index(list.last().row(),TableModel::ReadColumn)); return getReadList(); } @@ -507,11 +494,11 @@ qint64 TableModel::asignNumbers(QList list,int startingNumber) { QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath); db.transaction(); - qint64 idFirst = _data.value(list[0].row())->data(Columns::Id).toULongLong(); + qint64 idFirst = _data.value(list[0].row())->data(TableModel::Id).toULongLong(); int i = 0; foreach (QModelIndex mi, list) { - ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(Columns::Id).toULongLong(),db); + ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(TableModel::Id).toULongLong(),db); c.info.setNumber(startingNumber+i); c.info.edited = true; DBHelper::update(&(c.info),db); @@ -532,7 +519,7 @@ QModelIndex TableModel::getIndexFromId(quint64 id) int i=0; for(itr = _data.constBegin();itr != _data.constEnd();itr++) { - if((*itr)->data(Columns::Id).toULongLong() == id) + if((*itr)->data(TableModel::Id).toULongLong() == id) break; i++; } @@ -558,7 +545,7 @@ void TableModel::finishTransaction() void TableModel::removeInTransaction(int row) { - ComicDB c = DBHelper::loadComic(_data.at(row)->data(Columns::Id).toULongLong(),dbTransaction); + ComicDB c = DBHelper::loadComic(_data.at(row)->data(TableModel::Id).toULongLong(),dbTransaction); DBHelper::removeFromDB(&c,dbTransaction); beginRemoveRows(QModelIndex(),row,row); @@ -601,18 +588,18 @@ void TableModel::reload(const ComicDB & comic) bool found = false; foreach(TableItem * item,_data) { - if(item->data(Columns::Id).toULongLong() == comic.id) + if(item->data(TableModel::Id).toULongLong() == comic.id) { found = true; - item->setData(Columns::CurrentPage,comic.info.currentPage); - item->setData(Columns::HasBeenOpened,true); + item->setData(TableModel::CurrentPage,comic.info.currentPage); + item->setData(TableModel::HasBeenOpened,true); break; } row++; } if(found) - emit dataChanged(index(row,Columns::CurrentPage),index(row,Columns::CurrentPage)); + emit dataChanged(index(row,TableModel::CurrentPage),index(row,TableModel::CurrentPage)); } void TableModel::updateRating(int rating, QModelIndex mi) @@ -623,7 +610,7 @@ void TableModel::updateRating(int rating, QModelIndex mi) //TODO optimize update comic.info.rating = rating; - _data[mi.row()]->setData(Columns::Rating,rating); + _data[mi.row()]->setData(TableModel::Rating,rating); DBHelper::update(&(comic.info),db); emit dataChanged(mi,mi); diff --git a/YACReaderLibrary/db/tablemodel.h b/YACReaderLibrary/db/tablemodel.h index 46bbac21..8b268fb4 100644 --- a/YACReaderLibrary/db/tablemodel.h +++ b/YACReaderLibrary/db/tablemodel.h @@ -13,6 +13,8 @@ class ComicDB; class TableItem; +using namespace YACReader; + //! [0] class TableModel : public QAbstractItemModel { @@ -22,8 +24,7 @@ public: TableModel(QObject *parent = 0); TableModel( QSqlQuery &sqlquery, QObject *parent = 0); ~TableModel(); - - + QVariant data(const QModelIndex &index, int role) const; Qt::ItemFlags flags(const QModelIndex &index) const; QVariant headerData(int section, Qt::Orientation orientation, @@ -54,6 +55,21 @@ public: void removeInTransaction(int row); void reload(const ComicDB & comic); + enum Columns { + Number = 0, + Title = 1, + FileName = 2, + NumPages = 3, + Id = 4, + Parent_Id = 5, + Path = 6, + Hash = 7, + ReadColumn = 8, + IsBis = 9, + CurrentPage = 10, + Rating = 11, + HasBeenOpened = 12 +}; public slots: void remove(int row); void startTransaction(); diff --git a/YACReaderLibrary/db_helper.cpp b/YACReaderLibrary/db_helper.cpp index 46f87f49..315dc857 100644 --- a/YACReaderLibrary/db_helper.cpp +++ b/YACReaderLibrary/db_helper.cpp @@ -184,6 +184,8 @@ void DBHelper::removeFromDB(ComicDB * comic, QSqlDatabase & db) //updates void DBHelper::update(ComicDB * comic, QSqlDatabase & db) { + Q_UNUSED(comic) + Q_UNUSED(db) //do nothing } diff --git a/YACReaderLibrary/import_library_dialog.cpp b/YACReaderLibrary/import_library_dialog.cpp index f68e02d6..d3514537 100644 --- a/YACReaderLibrary/import_library_dialog.cpp +++ b/YACReaderLibrary/import_library_dialog.cpp @@ -4,7 +4,7 @@ #include #include #include - +#include ImportLibraryDialog::ImportLibraryDialog(QWidget * parent) :QDialog(parent),progressCount(0) @@ -153,4 +153,5 @@ void ImportLibraryDialog::close() void ImportLibraryDialog::closeEvent ( QCloseEvent * e ) { close(); + e->accept(); } diff --git a/YACReaderLibrary/import_widget.cpp b/YACReaderLibrary/import_widget.cpp index 0193f4ec..12c00f96 100644 --- a/YACReaderLibrary/import_widget.cpp +++ b/YACReaderLibrary/import_widget.cpp @@ -281,7 +281,7 @@ void ImportWidget::finishedUpdatingCover() void ImportWidget::newCover(const QPixmap & image) { - + Q_UNUSED(image) } static int i = 1; static int previousWidth = 10; @@ -348,7 +348,7 @@ void ImportWidget::clear() currentComicLabel->setText("..."); - i = 0; + this->i = 0; } void ImportWidget::setImportLook() diff --git a/YACReaderLibrary/library_creator.cpp b/YACReaderLibrary/library_creator.cpp index 3420920a..26a3b7c3 100644 --- a/YACReaderLibrary/library_creator.cpp +++ b/YACReaderLibrary/library_creator.cpp @@ -226,7 +226,6 @@ void LibraryCreator::update(QDir dirS) int lenghtS = listS.size(); int lenghtD = listD.size(); - int maxLenght = qMax(lenghtS,lenghtD); bool updated; int i,j; diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 88fdf2c0..abbf5aef 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1035,7 +1035,7 @@ void LibraryWindow::setCurrentComicsStatusReaded(YACReaderComicReadStatus readSt void LibraryWindow::setCurrentComicReaded() { - this->setCurrentComicsStatusReaded(YACReaderComicReadStatus::Read); + this->setCurrentComicsStatusReaded(YACReader::Read); } void LibraryWindow::setCurrentComicOpened() @@ -1045,18 +1045,18 @@ void LibraryWindow::setCurrentComicOpened() void LibraryWindow::setComicsReaded() { - comicFlow->setMarks(dmCV->setAllComicsRead(YACReaderComicReadStatus::Read)); + comicFlow->setMarks(dmCV->setAllComicsRead(YACReader::Read)); comicFlow->updateMarks(); } void LibraryWindow::setCurrentComicUnreaded() { - this->setCurrentComicsStatusReaded(YACReaderComicReadStatus::Unread); + this->setCurrentComicsStatusReaded(YACReader::Unread); } void LibraryWindow::setComicsUnreaded() { - comicFlow->setMarks(dmCV->setAllComicsRead(YACReaderComicReadStatus::Unread)); + comicFlow->setMarks(dmCV->setAllComicsRead(YACReader::Unread)); comicFlow->updateMarks(); } @@ -1523,6 +1523,7 @@ void LibraryWindow::closeEvent ( QCloseEvent * event ) { settings->setValue(MAIN_WINDOW_GEOMETRY, saveGeometry()); settings->setValue(COMICS_VIEW_HEADERS,comicView->horizontalHeader()->saveState()); + event->accept(); //settings->setValue(COMICS_VIEW_HEADERS_GEOMETRY,comicView->horizontalHeader()->saveGeometry()); } diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 9c4c2874..ed827576 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -50,6 +50,8 @@ class YACReaderTreeView; class YACReaderMainToolBar; #include "comic_db.h" +using namespace YACReader; + class LibraryWindow : public QMainWindow { Q_OBJECT diff --git a/YACReaderLibrary/options_dialog.h b/YACReaderLibrary/options_dialog.h index 85e9305d..d42a9ead 100644 --- a/YACReaderLibrary/options_dialog.h +++ b/YACReaderLibrary/options_dialog.h @@ -5,7 +5,7 @@ #include "yacreader_global.h" -extern FlowType flowType; +using namespace YACReader; class OptionsDialog : public YACReaderOptionsDialog { diff --git a/YACReaderLibrary/server/controllers/errorcontroller.cpp b/YACReaderLibrary/server/controllers/errorcontroller.cpp index 7fc21f44..4bff204b 100644 --- a/YACReaderLibrary/server/controllers/errorcontroller.cpp +++ b/YACReaderLibrary/server/controllers/errorcontroller.cpp @@ -10,6 +10,7 @@ ErrorController::ErrorController(int errorCode) void ErrorController::service(HttpRequest& request, HttpResponse& response) { + Q_UNUSED(request) switch(error) { case 300: diff --git a/YACReaderLibrary/server/controllers/foldercontroller.cpp b/YACReaderLibrary/server/controllers/foldercontroller.cpp index e29123f3..d8ef8591 100644 --- a/YACReaderLibrary/server/controllers/foldercontroller.cpp +++ b/YACReaderLibrary/server/controllers/foldercontroller.cpp @@ -119,10 +119,10 @@ void FolderController::service(HttpRequest& request, HttpResponse& response) int elementsPerPage = 18; int numFolders = folderContent.length(); - int numComics = folderComics.length(); + //int numComics = folderComics.length(); int totalLength = folderContent.length() + folderComics.length(); - int numFolderPages = numFolders / elementsPerPage + ((numFolders%elementsPerPage)>0?1:0); +// int numFolderPages = numFolders / elementsPerPage + ((numFolders%elementsPerPage)>0?1:0); int numPages = totalLength / elementsPerPage + ((totalLength%elementsPerPage)>0?1:0); //response.writeText(QString("Number of pages : %1
").arg(numPages)); @@ -237,7 +237,7 @@ void FolderController::service(HttpRequest& request, HttpResponse& response) firstChar = QString((*itr)->name[0]).toUpper(); firstChar = firstChar.normalized(QString::NormalizationForm_D).at(0);//TODO _D or _KD?? bool ok; - int dec = firstChar.toInt(&ok, 10); + /*int dec = */firstChar.toInt(&ok, 10); if(ok) firstChar = "#"; //response.writeText(QString("%1 - %2
").arg((*itr)->name).arg(xyz)); diff --git a/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp b/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp index aedef1dc..499e6eb4 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp +++ b/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp @@ -9,154 +9,154 @@ HttpSession::HttpSession(bool canStore) { - if (canStore) { - dataPtr=new HttpSessionData(); - dataPtr->refCount=1; - dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch(); - dataPtr->id=QUuid::createUuid().toString().toAscii(); + if (canStore) { + dataPtr=new HttpSessionData(); + dataPtr->refCount=1; + dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch(); + dataPtr->id=QUuid::createUuid().toString().toAscii(); dataPtr->yacreaderSessionData.comic = 0; dataPtr->yacreaderSessionData.comicId = 0; #ifdef SUPERVERBOSE - qDebug("HttpSession: created new session data with id %s",dataPtr->id.data()); + qDebug("HttpSession: created new session data with id %s",dataPtr->id.data()); #endif - } - else { - dataPtr=0; - } + } + else { + dataPtr=0; + } } HttpSession::HttpSession(const HttpSession& other) { - dataPtr=other.dataPtr; - if (dataPtr) { - dataPtr->lock.lockForWrite(); - dataPtr->refCount++; + dataPtr=other.dataPtr; + if (dataPtr) { + dataPtr->lock.lockForWrite(); + dataPtr->refCount++; #ifdef SUPERVERBOSE - qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount); + qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount); #endif - dataPtr->lock.unlock(); - } + dataPtr->lock.unlock(); + } } HttpSession& HttpSession::operator= (const HttpSession& other) { - HttpSessionData* oldPtr=dataPtr; - dataPtr=other.dataPtr; - if (dataPtr) { - dataPtr->lock.lockForWrite(); - dataPtr->refCount++; + HttpSessionData* oldPtr=dataPtr; + dataPtr=other.dataPtr; + if (dataPtr) { + dataPtr->lock.lockForWrite(); + dataPtr->refCount++; #ifdef SUPERVERBOSE - qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount); + qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount); #endif - dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch(); - dataPtr->lock.unlock(); - } - if (oldPtr) { - int refCount; - oldPtr->lock.lockForRead(); - refCount=oldPtr->refCount--; + dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch(); + dataPtr->lock.unlock(); + } + if (oldPtr) { + int refCount; + oldPtr->lock.lockForRead(); + refCount=oldPtr->refCount--; #ifdef SUPERVERBOSE - qDebug("HttpSession: refCount of %s is %i",oldPtr->id.data(),oldPtr->refCount); + qDebug("HttpSession: refCount of %s is %i",oldPtr->id.data(),oldPtr->refCount); #endif - oldPtr->lock.unlock(); - if (refCount==0) { - delete oldPtr; - } - } - return *this; + oldPtr->lock.unlock(); + if (refCount==0) { + delete oldPtr; + } + } + return *this; } HttpSession::~HttpSession() { - if (dataPtr) { - int refCount; - dataPtr->lock.lockForRead(); - refCount=--dataPtr->refCount; + if (dataPtr) { + int refCount; + dataPtr->lock.lockForRead(); + refCount=--dataPtr->refCount; #ifdef SUPERVERBOSE - qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount); + qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount); #endif - dataPtr->lock.unlock(); - if (refCount==0) { - qDebug("HttpSession: deleting data"); - delete dataPtr; - } - } + dataPtr->lock.unlock(); + if (refCount==0) { + qDebug("HttpSession: deleting data"); + delete dataPtr; + } + } } QByteArray HttpSession::getId() const { - if (dataPtr) { - return dataPtr->id; - } - else { - return QByteArray(); - } + if (dataPtr) { + return dataPtr->id; + } + else { + return QByteArray(); + } } bool HttpSession::isNull() const { - return dataPtr==0; + return dataPtr==0; } void HttpSession::set(const QByteArray& key, const QVariant& value) { - if (dataPtr) { - dataPtr->lock.lockForWrite(); - dataPtr->values.insert(key,value); - dataPtr->lock.unlock(); - } + if (dataPtr) { + dataPtr->lock.lockForWrite(); + dataPtr->values.insert(key,value); + dataPtr->lock.unlock(); + } } void HttpSession::remove(const QByteArray& key) { - if (dataPtr) { - dataPtr->lock.lockForWrite(); - dataPtr->values.remove(key); - dataPtr->lock.unlock(); - } + if (dataPtr) { + dataPtr->lock.lockForWrite(); + dataPtr->values.remove(key); + dataPtr->lock.unlock(); + } } QVariant HttpSession::get(const QByteArray& key) const { - QVariant value; - if (dataPtr) { - dataPtr->lock.lockForRead(); - value=dataPtr->values.value(key); - dataPtr->lock.unlock(); - } - return value; + QVariant value; + if (dataPtr) { + dataPtr->lock.lockForRead(); + value=dataPtr->values.value(key); + dataPtr->lock.unlock(); + } + return value; } bool HttpSession::contains(const QByteArray& key) const { - bool found=false; - if (dataPtr) { - dataPtr->lock.lockForRead(); - found=dataPtr->values.contains(key); - dataPtr->lock.unlock(); - } - return found; + bool found=false; + if (dataPtr) { + dataPtr->lock.lockForRead(); + found=dataPtr->values.contains(key); + dataPtr->lock.unlock(); + } + return found; } QMap HttpSession::getAll() const { - QMap values; - if (dataPtr) { - dataPtr->lock.lockForRead(); - values=dataPtr->values; - dataPtr->lock.unlock(); - } - return values; + QMap values; + if (dataPtr) { + dataPtr->lock.lockForRead(); + values=dataPtr->values; + dataPtr->lock.unlock(); + } + return values; } qint64 HttpSession::getLastAccess() const { - qint64 value=0; - if (dataPtr) { - dataPtr->lock.lockForRead(); - value=dataPtr->lastAccess; - dataPtr->lock.unlock(); - } - return value; + qint64 value=0; + if (dataPtr) { + dataPtr->lock.lockForRead(); + value=dataPtr->lastAccess; + dataPtr->lock.unlock(); + } + return value; } void HttpSession::setLastAccess() { - if (dataPtr) { - dataPtr->lock.lockForRead(); - dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch(); - dataPtr->lock.unlock(); - } + if (dataPtr) { + dataPtr->lock.lockForRead(); + dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch(); + dataPtr->lock.unlock(); + } } //AÑADIDO @@ -292,6 +292,7 @@ int HttpSession::popPage() { if(dataPtr && !(dataPtr->yacreaderSessionData.navigationPath.isEmpty())) return dataPtr->yacreaderSessionData.navigationPath.pop(); + return 0; } void HttpSession::pushPage(int page) @@ -304,4 +305,5 @@ int HttpSession::topPage() { if(dataPtr) return dataPtr->yacreaderSessionData.navigationPath.top(); + return 0; } \ No newline at end of file diff --git a/YACReaderLibrary/yacreader_local_server.cpp b/YACReaderLibrary/yacreader_local_server.cpp index 6eea0691..82789fa7 100644 --- a/YACReaderLibrary/yacreader_local_server.cpp +++ b/YACReaderLibrary/yacreader_local_server.cpp @@ -8,6 +8,8 @@ #include "comic_db.h" +using namespace YACReader; + YACReaderLocalServer::YACReaderLocalServer(QObject *parent) : QObject(parent) { @@ -90,7 +92,7 @@ void YACReaderClientConnectionWorker::run() switch (msgType) { - case YACReaderIPCMessages::RequestComicInfo: + case YACReader::RequestComicInfo: { QList siblings; getComicInfo(libraryId,comic,siblings); @@ -119,7 +121,7 @@ void YACReaderClientConnectionWorker::run() } break; } - case YACReaderIPCMessages::SendComicInfo: + case YACReader::SendComicInfo: { updateComic(libraryId,comic); //clientConnection->disconnectFromServer(); diff --git a/common/check_new_version.cpp b/common/check_new_version.cpp index a240a5d1..86fb3b76 100644 --- a/common/check_new_version.cpp +++ b/common/check_new_version.cpp @@ -67,7 +67,7 @@ void HttpVersionChecker::run() } void HttpVersionChecker::readResponseHeader(const QHttpResponseHeader &responseHeader) { - + Q_UNUSED(responseHeader) } void HttpVersionChecker::read(const QHttpResponseHeader &){ @@ -76,12 +76,14 @@ void HttpVersionChecker::read(const QHttpResponseHeader &){ void HttpVersionChecker::httpRequestFinished(int requestId, bool error) { + Q_UNUSED(requestId) #ifdef QT_DEBUG QString response("YACReader-5.0.0 win32.exe"); #else QString response(content); #endif - checkNewVersion(response); + if(!error) + checkNewVersion(response); exit(); } diff --git a/common/pictureflow.cpp b/common/pictureflow.cpp index ead06483..52c6dd45 100644 --- a/common/pictureflow.cpp +++ b/common/pictureflow.cpp @@ -825,7 +825,7 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1, PFreal ys = slide.cy - state->slideWidth * sdy/2; PFreal dist = distance * PFREAL_ONE; - int xi = qMax((PFreal)0, (w*PFREAL_ONE/2) + fdiv(xs*h, dist+ys) >> PFREAL_SHIFT); + int xi = qMax((PFreal)0, ((w*PFREAL_ONE/2) + fdiv(xs*h, dist+ys)) >> PFREAL_SHIFT); if(xi >= w) return rect; @@ -1076,7 +1076,7 @@ void PictureFlow::addSlide(const QImage& image) d->state->slideImages.resize(c+1); d->state->slideImages[c] = new QImage(image); d->state->marks.resize(c+1); - d->state->marks[c] = YACReaderComicReadStatus::Unread; + d->state->marks[c] = YACReader::Unread; triggerRender(); } @@ -1361,7 +1361,7 @@ void PictureFlow::updateMarks() void PictureFlow::unmarkSlide(int index) { if(indexstate->marks.size()) - d->state->marks[index] = YACReaderComicReadStatus::Unread; + d->state->marks[index] = YACReader::Unread; } void PictureFlow::setMarks(const QVector & m) diff --git a/common/pictureflow.h b/common/pictureflow.h index 28c05307..b12b0b25 100644 --- a/common/pictureflow.h +++ b/common/pictureflow.h @@ -32,6 +32,8 @@ class PictureFlowPrivate; +using namespace YACReader; + /*! Class PictureFlow implements an image show widget with animation effect like Apple's CoverFlow (in iTunes and iPod). Images are arranged in form diff --git a/common/yacreader_flow_gl.cpp b/common/yacreader_flow_gl.cpp index 339190d0..a2114af2 100644 --- a/common/yacreader_flow_gl.cpp +++ b/common/yacreader_flow_gl.cpp @@ -637,6 +637,7 @@ void YACReaderFlowGL::updatePositions() void YACReaderFlowGL::insert(char *name, GLuint Tex, float x, float y,int item) { + Q_UNUSED(name) //set a new entry if(item == -1){ @@ -660,7 +661,7 @@ void YACReaderFlowGL::insert(char *name, GLuint Tex, float x, float y,int item) cfImages[item].width = x; cfImages[item].height = y; cfImages[item].index = item; - strcpy(cfImages[item].name,name); + //strcpy(cfImages[item].name,name); } void YACReaderFlowGL::remove(int item) @@ -691,10 +692,11 @@ CFImage YACReaderFlowGL::getCurrentSelected() void YACReaderFlowGL::replace(char *name, GLuint Tex, float x, float y,int item) { + Q_UNUSED(name) cfImages[item].img = Tex; cfImages[item].width = x; cfImages[item].height = y; - strcpy(cfImages[item].name,name); + //strcpy(cfImages[item].name,name); loaded[item]=true; } @@ -875,6 +877,7 @@ void YACReaderFlowGL::setMarks(QVector marks) } void YACReaderFlowGL::setMarkImage(QImage & image) { + Q_UNUSED(image); //qué pasa la primera vez?? //deleteTexture(markTexture); //markTexture = bindTexture(image,GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption); @@ -885,10 +888,11 @@ void YACReaderFlowGL::markSlide(int index, YACReaderComicReadStatus status) } void YACReaderFlowGL::unmarkSlide(int index) { - marks[index] = YACReaderComicReadStatus::Unread; + marks[index] = YACReader::Unread; } void YACReaderFlowGL::setSlideSize(QSize size) { + Q_UNUSED(size); //TODO calcular el tamaño del widget } void YACReaderFlowGL::clear() diff --git a/common/yacreader_flow_gl.h b/common/yacreader_flow_gl.h index 37b62e4c..44eb7c5b 100644 --- a/common/yacreader_flow_gl.h +++ b/common/yacreader_flow_gl.h @@ -37,7 +37,7 @@ struct RVect{ //the cover info struct struct CFImage{ GLuint img; - char name[256]; + //char name[256]; float width; float height; diff --git a/common/yacreader_global.h b/common/yacreader_global.h index d9925cc5..5d05be64 100644 --- a/common/yacreader_global.h +++ b/common/yacreader_global.h @@ -50,6 +50,8 @@ #define YACREADERLIBRARY_GUID "ea343ff3-2005-4865-b212-7fa7c43999b8" +namespace YACReader +{ enum FlowType { @@ -74,5 +76,7 @@ Opened = 2 }; +} + #endif diff --git a/compressed_archive/compressed_archive.cpp b/compressed_archive/compressed_archive.cpp index eea41f0d..72679655 100644 --- a/compressed_archive/compressed_archive.cpp +++ b/compressed_archive/compressed_archive.cpp @@ -79,7 +79,7 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) for(unsigned int i=0;icreateObjectFunc(&supportedFileFormats[i], &IID_InArchive, (void **)&szInterface->archive) != S_OK) continue; diff --git a/compressed_archive/extract_callbacks.h b/compressed_archive/extract_callbacks.h index 4da494c9..f74867f0 100644 --- a/compressed_archive/extract_callbacks.h +++ b/compressed_archive/extract_callbacks.h @@ -98,6 +98,7 @@ void CArchiveExtractCallback::Init(IInArchive *archiveHandler, const UString &di { NumErrors = 0; _archiveHandler = archiveHandler; + directoryPath;//unused } STDMETHODIMP CArchiveExtractCallback::SetTotal(UInt64 /* size */) @@ -133,7 +134,8 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, } _filePath = fullPath; } - + + askExtractMode;//unused //if (askExtractMode != NArchive::NExtract::NAskMode::kExtract) //return S_OK; diff --git a/custom_widgets/yacreader_busy_widget.cpp b/custom_widgets/yacreader_busy_widget.cpp index 72d512af..94e93718 100644 --- a/custom_widgets/yacreader_busy_widget.cpp +++ b/custom_widgets/yacreader_busy_widget.cpp @@ -17,9 +17,10 @@ YACReaderBusyWidget::YACReaderBusyWidget(QWidget *parent) void YACReaderBusyWidget::paintEvent(QPaintEvent * event) { - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - painter.drawPixmap(0,0,width(),height(),QPixmap(":/images/busy_background.png")); + Q_UNUSED(event); + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.drawPixmap(0,0,width(),height(),QPixmap(":/images/busy_background.png")); } BusyIndicator::BusyIndicator(QWidget *parent) : diff --git a/custom_widgets/yacreader_library_list_widget.cpp b/custom_widgets/yacreader_library_list_widget.cpp index 040c0fef..727b418a 100644 --- a/custom_widgets/yacreader_library_list_widget.cpp +++ b/custom_widgets/yacreader_library_list_widget.cpp @@ -46,6 +46,7 @@ int YACReaderLibraryListWidget::findText(QString text) if(librariesList.at(i)->name == text) return i; } + return -1; } void YACReaderLibraryListWidget::setCurrentIndex(int index) { diff --git a/custom_widgets/yacreader_sidebar.cpp b/custom_widgets/yacreader_sidebar.cpp index cb496ace..280fcc99 100644 --- a/custom_widgets/yacreader_sidebar.cpp +++ b/custom_widgets/yacreader_sidebar.cpp @@ -95,7 +95,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) : void YACReaderSideBar::paintEvent(QPaintEvent * event) { - + Q_UNUSED(event) #ifdef Q_OS_MAC QPainter painter(this); diff --git a/custom_widgets/yacreader_spin_slider_widget.cpp b/custom_widgets/yacreader_spin_slider_widget.cpp index a6a360f0..56e8a9dd 100644 --- a/custom_widgets/yacreader_spin_slider_widget.cpp +++ b/custom_widgets/yacreader_spin_slider_widget.cpp @@ -35,12 +35,14 @@ YACReaderSpinSliderWidget::YACReaderSpinSliderWidget(QWidget * parent,bool strec } void YACReaderSpinSliderWidget::valueWillChange(int v) { + Q_UNUSED(v) if(tracking) emit valueChanged(spinBox->value()); } void YACReaderSpinSliderWidget::valueWillChangeFromSpinBox(int v) { + Q_UNUSED(v) if(!tracking && !slider->isSliderDown()) emit valueChanged(spinBox->value()); } diff --git a/custom_widgets/yacreader_table_view.cpp b/custom_widgets/yacreader_table_view.cpp index 9272d4b0..05e6b832 100644 --- a/custom_widgets/yacreader_table_view.cpp +++ b/custom_widgets/yacreader_table_view.cpp @@ -111,6 +111,7 @@ void YACReaderTableView::mousePressEvent(QMouseEvent * event) void YACReaderTableView::leaveEvent(QEvent * event) { closeRatingEditor(); + event->accept(); } void YACReaderTableView::closeRatingEditor() @@ -194,6 +195,7 @@ void YACReaderRatingDelegate::paint(QPainter *painter, const QStyleOptionViewIte QSize YACReaderRatingDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { + Q_UNUSED(option) int rating = ((TableItem *)index.internalPointer())->data(11).toInt(); StarRating starRating(rating); return starRating.sizeHint(); @@ -203,6 +205,8 @@ QWidget *YACReaderRatingDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { + Q_UNUSED(option) + Q_UNUSED(index) StarEditor *editor = new StarEditor(parent); connect(editor, SIGNAL(editingFinished()), this, SLOT(sendCloseEditor())); @@ -254,8 +258,8 @@ StarRating::StarRating(int starCount, int maxStarCount) double pi = 3.14159265359; double angle = 3.14159265359 / numVertex; - float rOuter = 0.3; - float rInner = 0.15; + float rOuter = 0.3f; + float rInner = 0.15f; for (int i = 0; i < 2 * numVertex; i++) { double r = (i & 1) == 0 ? rOuter : rInner; @@ -275,6 +279,7 @@ QSize StarRating::sizeHint() const void StarRating::paint(QPainter *painter, const QRect &rect, const QPalette &palette, EditMode mode) const { + Q_UNUSED(palette) painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); @@ -306,7 +311,9 @@ void StarRating::paint(QPainter *painter, const QRect &rect, void StarRating::paintSelected(QPainter *painter, const QRect &rect, const QPalette &palette, EditMode mode, QColor color) const { - painter->save(); + Q_UNUSED(palette) + Q_UNUSED(mode) + painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); painter->setPen(Qt::NoPen); @@ -365,6 +372,7 @@ void StarEditor::paintEvent(QPaintEvent *) void StarEditor::mouseMoveEvent(QMouseEvent *event) { + Q_UNUSED(event) /*int star = starAtPosition(event->x()); if (star != myStarRating.starCount() && star != -1) {