mirror of
https://invent.kde.org/graphics/okular
synced 2024-06-30 22:54:24 +00:00
A collection of cppcheck fixes
This commit is contained in:
parent
465b9ff5ce
commit
bfc3e46f9c
|
@ -48,6 +48,7 @@ Document::Document()
|
||||||
: mDirectory(nullptr)
|
: mDirectory(nullptr)
|
||||||
, mUnrar(nullptr)
|
, mUnrar(nullptr)
|
||||||
, mArchive(nullptr)
|
, mArchive(nullptr)
|
||||||
|
, mArchiveDir(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ UnrarHelper::~UnrarHelper()
|
||||||
|
|
||||||
Unrar::Unrar()
|
Unrar::Unrar()
|
||||||
: QObject(nullptr)
|
: QObject(nullptr)
|
||||||
|
, mProcess(nullptr)
|
||||||
, mLoop(nullptr)
|
, mLoop(nullptr)
|
||||||
, mTempDir(nullptr)
|
, mTempDir(nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -542,7 +542,7 @@ void KDjVu::Private::fillBookmarksRecurse(QDomDocument &maindoc, QDomNode &curno
|
||||||
if (dest.at(0) == QLatin1Char('#')) {
|
if (dest.at(0) == QLatin1Char('#')) {
|
||||||
dest.remove(0, 1);
|
dest.remove(0, 1);
|
||||||
bool isNumber = false;
|
bool isNumber = false;
|
||||||
dest.toInt(&isNumber);
|
(void)dest.toInt(&isNumber);
|
||||||
if (isNumber) {
|
if (isNumber) {
|
||||||
// it might be an actual page number, but could also be a page label
|
// it might be an actual page number, but could also be a page label
|
||||||
// so resolve the number, and get the real page number
|
// so resolve the number, and get the real page number
|
||||||
|
|
|
@ -71,7 +71,7 @@ private:
|
||||||
class DocumentInfo;
|
class DocumentInfo;
|
||||||
DocumentInfo *mDocumentInfo;
|
DocumentInfo *mDocumentInfo;
|
||||||
|
|
||||||
int mSectionCounter;
|
int mSectionCounter = 0;
|
||||||
|
|
||||||
QMap<QString, QTextBlock> mSectionMap;
|
QMap<QString, QTextBlock> mSectionMap;
|
||||||
QMap<QString, QPair<int, int>> mLocalLinks;
|
QMap<QString, QPair<int, int>> mLocalLinks;
|
||||||
|
|
|
@ -258,7 +258,7 @@ QImage TIFFGenerator::image(Okular::PixmapRequest *request)
|
||||||
int reqwidth = request->width();
|
int reqwidth = request->width();
|
||||||
int reqheight = request->height();
|
int reqheight = request->height();
|
||||||
if (rotation % 2 == 1) {
|
if (rotation % 2 == 1) {
|
||||||
qSwap(reqwidth, reqheight);
|
std::swap(reqwidth, reqheight);
|
||||||
}
|
}
|
||||||
img = image.scaled(reqwidth, reqheight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
img = image.scaled(reqwidth, reqheight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
|
|
||||||
|
|
|
@ -686,7 +686,7 @@ static QString unicodeString(const QString &raw)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XpsPage::processGlyph(QPainter *painter, XpsRenderNode &node)
|
void XpsPage::processGlyph(QPainter *painter, const XpsRenderNode &node)
|
||||||
{
|
{
|
||||||
// TODO Currently ignored attributes: CaretStops, DeviceFontName, IsSideways, OpacityMask, Name, FixedPage.NavigateURI, xml:lang, x:key
|
// TODO Currently ignored attributes: CaretStops, DeviceFontName, IsSideways, OpacityMask, Name, FixedPage.NavigateURI, xml:lang, x:key
|
||||||
// TODO Indices is only partially implemented
|
// TODO Indices is only partially implemented
|
||||||
|
@ -893,7 +893,7 @@ void XpsPage::processImageBrush(XpsRenderNode &node)
|
||||||
node.data = QVariant::fromValue(brush);
|
node.data = QVariant::fromValue(brush);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XpsPage::processPath(QPainter *painter, XpsRenderNode &node)
|
void XpsPage::processPath(QPainter *painter, const XpsRenderNode &node)
|
||||||
{
|
{
|
||||||
// TODO Ignored attributes: Clip, OpacityMask, StrokeEndLineCap, StorkeStartLineCap, Name, FixedPage.NavigateURI, xml:lang, x:key, AutomationProperties.Name, AutomationProperties.HelpText, SnapsToDevicePixels
|
// TODO Ignored attributes: Clip, OpacityMask, StrokeEndLineCap, StorkeStartLineCap, Name, FixedPage.NavigateURI, xml:lang, x:key, AutomationProperties.Name, AutomationProperties.HelpText, SnapsToDevicePixels
|
||||||
// TODO Ignored child elements: RenderTransform, Clip, OpacityMask
|
// TODO Ignored child elements: RenderTransform, Clip, OpacityMask
|
||||||
|
@ -1172,7 +1172,7 @@ void XpsPage::processPathFigure(XpsRenderNode &node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XpsPage::processStartElement(QPainter *painter, XpsRenderNode &node)
|
void XpsPage::processStartElement(QPainter *painter, const XpsRenderNode &node)
|
||||||
{
|
{
|
||||||
if (node.name == QLatin1String("Canvas")) {
|
if (node.name == QLatin1String("Canvas")) {
|
||||||
painter->save();
|
painter->save();
|
||||||
|
@ -1982,7 +1982,7 @@ bool XpsGenerator::loadDocument(const QString &fileName, QVector<Okular::Page *>
|
||||||
int pagesVectorOffset = 0;
|
int pagesVectorOffset = 0;
|
||||||
|
|
||||||
for (int docNum = 0; docNum < m_xpsFile->numDocuments(); ++docNum) {
|
for (int docNum = 0; docNum < m_xpsFile->numDocuments(); ++docNum) {
|
||||||
XpsDocument *doc = m_xpsFile->document(docNum);
|
const XpsDocument *doc = m_xpsFile->document(docNum);
|
||||||
for (int pageNum = 0; pageNum < doc->numPages(); ++pageNum) {
|
for (int pageNum = 0; pageNum < doc->numPages(); ++pageNum) {
|
||||||
QSizeF pageSize = doc->page(pageNum)->size();
|
QSizeF pageSize = doc->page(pageNum)->size();
|
||||||
pagesVector[pagesVectorOffset] = new Okular::Page(pagesVectorOffset, pageSize.width(), pageSize.height(), Okular::Rotation0);
|
pagesVector[pagesVectorOffset] = new Okular::Page(pagesVectorOffset, pageSize.width(), pageSize.height(), Okular::Rotation0);
|
||||||
|
|
|
@ -122,10 +122,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Methods for processing of different xml elements
|
// Methods for processing of different xml elements
|
||||||
void processStartElement(QPainter *painter, XpsRenderNode &node);
|
void processStartElement(QPainter *painter, const XpsRenderNode &node);
|
||||||
void processEndElement(QPainter *painter, XpsRenderNode &node);
|
void processEndElement(QPainter *painter, XpsRenderNode &node);
|
||||||
void processGlyph(QPainter *painter, XpsRenderNode &node);
|
void processGlyph(QPainter *painter, const XpsRenderNode &node);
|
||||||
void processPath(QPainter *painter, XpsRenderNode &node);
|
void processPath(QPainter *painter, const XpsRenderNode &node);
|
||||||
void processPathData(XpsRenderNode &node);
|
void processPathData(XpsRenderNode &node);
|
||||||
void processFill(XpsRenderNode &node);
|
void processFill(XpsRenderNode &node);
|
||||||
void processStroke(XpsRenderNode &node);
|
void processStroke(XpsRenderNode &node);
|
||||||
|
@ -142,7 +142,6 @@ private:
|
||||||
QString m_thumbnailFileName;
|
QString m_thumbnailFileName;
|
||||||
bool m_thumbnailMightBeAvailable;
|
bool m_thumbnailMightBeAvailable;
|
||||||
QImage m_thumbnail;
|
QImage m_thumbnail;
|
||||||
bool m_thumbnailIsLoaded;
|
|
||||||
|
|
||||||
QImage *m_pageImage;
|
QImage *m_pageImage;
|
||||||
bool m_pageIsRendered;
|
bool m_pageIsRendered;
|
||||||
|
|
|
@ -226,7 +226,7 @@ QVariant TOCModel::data(const QModelIndex &index, int role) const
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
|
|
||||||
TOCItem *lastHighlighted = d->currentPage.last();
|
const TOCItem *lastHighlighted = d->currentPage.last();
|
||||||
|
|
||||||
// in the mobile version our parent is not a QTreeView; embolden the last highlighted item
|
// in the mobile version our parent is not a QTreeView; embolden the last highlighted item
|
||||||
// TODO misusing parent() here, fix
|
// TODO misusing parent() here, fix
|
||||||
|
@ -449,7 +449,7 @@ QString TOCModel::externalFileNameForIndex(const QModelIndex &index) const
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
TOCItem *item = static_cast<TOCItem *>(index.internalPointer());
|
const TOCItem *item = static_cast<TOCItem *>(index.internalPointer());
|
||||||
return item->extFileName;
|
return item->extFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ Okular::DocumentViewport TOCModel::viewportForIndex(const QModelIndex &index) co
|
||||||
return Okular::DocumentViewport();
|
return Okular::DocumentViewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
TOCItem *item = static_cast<TOCItem *>(index.internalPointer());
|
const TOCItem *item = static_cast<TOCItem *>(index.internalPointer());
|
||||||
return item->viewport;
|
return item->viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ QString TOCModel::urlForIndex(const QModelIndex &index) const
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
TOCItem *item = static_cast<TOCItem *>(index.internalPointer());
|
const TOCItem *item = static_cast<TOCItem *>(index.internalPointer());
|
||||||
return item->url;
|
return item->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ struct RadioData {
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> ids;
|
QList<int> ids;
|
||||||
QButtonGroup *group;
|
QButtonGroup *group = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FormWidgetsController : public QObject
|
class FormWidgetsController : public QObject
|
||||||
|
|
|
@ -78,7 +78,8 @@
|
||||||
// a frame contains a pointer to the page object, its geometry and the
|
// a frame contains a pointer to the page object, its geometry and the
|
||||||
// transition effect to the next frame
|
// transition effect to the next frame
|
||||||
struct PresentationFrame {
|
struct PresentationFrame {
|
||||||
PresentationFrame() = default;
|
explicit PresentationFrame(const Okular::Page *_page)
|
||||||
|
: page(_page) {};
|
||||||
|
|
||||||
~PresentationFrame()
|
~PresentationFrame()
|
||||||
{
|
{
|
||||||
|
@ -335,8 +336,7 @@ void PresentationWidget::notifySetup(const QVector<Okular::Page *> &pageSet, int
|
||||||
// create the new frames
|
// create the new frames
|
||||||
float screenRatio = (float)m_height / (float)m_width;
|
float screenRatio = (float)m_height / (float)m_width;
|
||||||
for (const Okular::Page *page : pageSet) {
|
for (const Okular::Page *page : pageSet) {
|
||||||
PresentationFrame *frame = new PresentationFrame();
|
PresentationFrame *frame = new PresentationFrame(page);
|
||||||
frame->page = page;
|
|
||||||
const QList<Okular::Annotation *> annotations = page->annotations();
|
const QList<Okular::Annotation *> annotations = page->annotations();
|
||||||
for (Okular::Annotation *a : annotations) {
|
for (Okular::Annotation *a : annotations) {
|
||||||
if (a->subType() == Okular::Annotation::AMovie) {
|
if (a->subType() == Okular::Annotation::AMovie) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user