Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some compiler warnings #196

Merged
merged 6 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions YACReader/main_window_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ void MainWindowViewer::openFolderFromPath(QString pathDir, QString atFileName)
d.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware);
QStringList list = d.entryList();

qSort(list.begin(), list.end(), naturalSortLessThanCI);
std::sort(list.begin(), list.end(), naturalSortLessThanCI);
int i = 0;
foreach (QString path, list) {
if (path.endsWith(atFileName))
Expand Down Expand Up @@ -1560,8 +1560,7 @@ void MainWindowViewer::getSiblingComics(QString path, QString currentComic)
#endif
d.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware);
QStringList list = d.entryList();
qSort(list.begin(), list.end(), naturalSortLessThanCI);
//std::sort(list.begin(),list.end(),naturalSortLessThanCI);
std::sort(list.begin(), list.end(), naturalSortLessThanCI);
int index = list.indexOf(currentComic);
if (index == -1) //comic not found
{
Expand Down
2 changes: 1 addition & 1 deletion YACReaderLibrary/db/comic_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ QVariant ComicModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags ComicModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return {};
if (index.column() == ComicModel::Rating)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
Expand Down
9 changes: 5 additions & 4 deletions YACReaderLibrary/db/folder_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include <QtGui>

#include <algorithm>

#ifdef Q_OS_MAC
#include <QFileIconProvider>
QIcon finishedFolderIcon;
Expand Down Expand Up @@ -142,7 +144,7 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags FolderModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return {};

return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled;
}
Expand Down Expand Up @@ -413,8 +415,7 @@ QStringList FolderModel::getSubfoldersNames(const QModelIndex &mi)
}
QSqlDatabase::removeDatabase(connectionName);

//TODO sort result))
qSort(result.begin(), result.end(), naturalSortLessThanCI);
std::sort(result.begin(), result.end(), naturalSortLessThanCI);
return result;
}

Expand Down Expand Up @@ -624,5 +625,5 @@ void FolderModelProxy::clear()

filteredItems.clear();

QSortFilterProxyModel::clear();
QSortFilterProxyModel::invalidate();
}
4 changes: 2 additions & 2 deletions YACReaderLibrary/db/reading_list_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ QVariant ReadingListModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags ReadingListModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return {};

auto item = static_cast<ListItem *>(index.internalPointer());
if (typeid(*item) == typeid(ReadingListSeparatorItem))
return 0;
return {};

if (typeid(*item) == typeid(ReadingListItem) && static_cast<ReadingListItem *>(item)->parent->getId() != 0)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled; //only sublists are dragable
Expand Down
5 changes: 3 additions & 2 deletions YACReaderLibrary/db_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <QSqlRecord>
#include <QSqlQuery>

#include <algorithm>
#include <limits>

#include "reading_list.h"
Expand Down Expand Up @@ -165,8 +166,8 @@ QString DBHelper::getFolderName(qulonglong libraryId, qulonglong id)
}
QList<QString> DBHelper::getLibrariesNames()
{
QStringList names = getLibraries().getNames();
qSort(names.begin(), names.end(), naturalSortLessThanCI);
auto names = getLibraries().getNames();
std::sort(names.begin(), names.end(), naturalSortLessThanCI);
return names;
}
QString DBHelper::getLibraryName(int id)
Expand Down
1 change: 0 additions & 1 deletion YACReaderLibrary/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<file>../images/comic_vine/previousPage.png</file>
<file>../images/comic_vine/radioChecked.png</file>
<file>../images/comic_vine/radioUnchecked.png</file>
<file>../images/comic_vine/radioUnchecked.png</file>
<file>../images/comic_vine/rowDown.png</file>
<file>../images/comic_vine/rowUp.png</file>
<file>../images/comic_vine/upArrow.png</file>
Expand Down
10 changes: 5 additions & 5 deletions YACReaderLibrary/library_creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ void LibraryCreator::update(QDir dirS)
dirS.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware);
QFileInfoList listSFiles = dirS.entryInfoList();

qSort(listSFolders.begin(), listSFolders.end(), naturalSortLessThanCIFileInfo);
qSort(listSFiles.begin(), listSFiles.end(), naturalSortLessThanCIFileInfo);
std::sort(listSFolders.begin(), listSFolders.end(), naturalSortLessThanCIFileInfo);
std::sort(listSFiles.begin(), listSFiles.end(), naturalSortLessThanCIFileInfo);

QFileInfoList listS;
listS.append(listSFolders);
Expand All @@ -351,8 +351,8 @@ void LibraryCreator::update(QDir dirS)
//QLOG_TRACE() << "END Getting info from DB" << dirS.absolutePath();

QList<LibraryItem *> listD;
qSort(folders.begin(), folders.end(), naturalSortLessThanCILibraryItem);
qSort(comics.begin(), comics.end(), naturalSortLessThanCILibraryItem);
std::sort(folders.begin(), folders.end(), naturalSortLessThanCILibraryItem);
std::sort(comics.begin(), comics.end(), naturalSortLessThanCILibraryItem);
listD.append(folders);
listD.append(comics);
//QLOG_DEBUG() << "---------------------------------------------------------";
Expand Down Expand Up @@ -651,7 +651,7 @@ void ThumbnailCreator::create()
if (_coverPage > _numPages) {
_coverPage = 1;
}
qSort(fileNames.begin(), fileNames.end(), naturalSortLessThanCI);
std::sort(fileNames.begin(), fileNames.end(), naturalSortLessThanCI);
int index = order.indexOf(fileNames.at(_coverPage - 1));

if (_target == "") {
Expand Down
3 changes: 2 additions & 1 deletion YACReaderLibrary/library_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <QSettings>
#include <QHeaderView>

#include <algorithm>
#include <iterator>
#include <typeinfo>
#include <thread>
Expand Down Expand Up @@ -2494,7 +2495,7 @@ QModelIndexList LibraryWindow::getSelectedComics()
//avoid selection.count()==0 forcing selection in comicsView
QModelIndexList selection = comicsViewsManager->comicsView->selectionModel()->selectedRows();
QLOG_TRACE() << "selection count " << selection.length();
qSort(selection.begin(), selection.end(), lessThanModelIndexRow);
std::sort(selection.begin(), selection.end(), lessThanModelIndexRow);

if (selection.count() == 0) {
comicsViewsManager->comicsView->selectIndex(0);
Expand Down
6 changes: 4 additions & 2 deletions YACReaderLibrary/server/controllers/v1/foldercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "QsLog.h"

#include <algorithm>

using stefanfrings::HttpRequest;
using stefanfrings::HttpResponse;
using stefanfrings::HttpSession;
Expand Down Expand Up @@ -79,7 +81,7 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)

folderContent.append(folderComics);

qSort(folderContent.begin(), folderContent.end(), LibraryItemSorter());
std::sort(folderContent.begin(), folderContent.end(), LibraryItemSorter());
folderComics.clear();

//qulonglong backId = DBHelper::getParentFromComicFolderId(libraryName,folderId);
Expand Down Expand Up @@ -265,7 +267,7 @@ void FolderController::service(HttpRequest &request, HttpResponse &response)
if (index.length() > 1) {
t.setCondition("alphaIndex", true);

qSort(index.begin(), index.end(), naturalSortLessThanCI);
std::sort(index.begin(), index.end(), naturalSortLessThanCI);
t.loop("index", index.length());
int i = 0;
int count = 0;
Expand Down
2 changes: 1 addition & 1 deletion common/gl/yacreader_flow_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ struct Preset pressetYACReaderFlowDownConfig = {
};
/*Constructor*/
YACReaderFlowGL::YACReaderFlowGL(QWidget *parent, struct Preset p)
: QOpenGLWidget(/*QOpenGLWidget migration QGLFormat(QGL::SampleBuffers),*/ parent), numObjects(0), lazyPopulateObjects(-1), defaultTexture(nullptr), hasBeenInitialized(false), bUseVSync(false), flowRightToLeft(false)
: QOpenGLWidget(/*QOpenGLWidget migration QGLFormat(QGL::SampleBuffers),*/ parent), numObjects(0), lazyPopulateObjects(-1), hasBeenInitialized(false), bUseVSync(false), flowRightToLeft(false)
{
updateCount = 0;
config = p;
Expand Down
6 changes: 3 additions & 3 deletions common/gl/yacreader_flow_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ class YACReaderFlowGL : public QOpenGLWidget, public ScrollManagement
int updateCount;
int fontSize;

QOpenGLTexture *defaultTexture;
QOpenGLTexture *markTexture;
QOpenGLTexture *readingTexture;
QOpenGLTexture *defaultTexture = nullptr;
QOpenGLTexture *markTexture = nullptr;
QOpenGLTexture *readingTexture = nullptr;
void initializeGL();
void paintGL();
void timerEvent(QTimerEvent *);
Expand Down
2 changes: 1 addition & 1 deletion shortcuts_management/actions_shortcuts_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ QModelIndex ActionsShortcutsModel::index(int row, int column, const QModelIndex
Qt::ItemFlags ActionsShortcutsModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return {};
if (index.column() == KEYS)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
Expand Down