Commit becdc7c4 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Revert the two last commits

f9841b0f and e0f45add

They break the windows build, which shows there's something defenitely
fishy going on with the current code, but oh well, someone with more
time needs to figure out a proper solution
parent f9841b0f
Pipeline #40414 passed with stage
in 10 minutes and 49 seconds
......@@ -163,10 +163,6 @@ if(BUILD_COVERAGE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wweak-vtables")
endif()
add_subdirectory( ui )
if(BUILD_DESKTOP)
add_subdirectory( shell )
......@@ -228,7 +224,6 @@ set(okularcore_SRCS
core/script/event.cpp
core/synctex/synctex_parser.c
core/synctex/synctex_parser_utils.c
interfaces/interfaces.cpp
)
qt5_add_resources(okularcore_SRCS
core/script/builtin.qrc
......
......@@ -27,7 +27,10 @@ public:
{
}
virtual ~ActionPrivate();
virtual ~ActionPrivate()
{
qDeleteAll(m_nextActions);
}
ActionPrivate(const ActionPrivate &) = delete;
ActionPrivate &operator=(const ActionPrivate &) = delete;
......@@ -36,11 +39,6 @@ public:
QVector<Action *> m_nextActions;
};
Okular::ActionPrivate::~ActionPrivate()
{
qDeleteAll(m_nextActions);
}
Action::Action(ActionPrivate &dd)
: d_ptr(&dd)
{
......@@ -100,15 +98,11 @@ public:
{
}
~GotoActionPrivate() override;
QString m_extFileName;
DocumentViewport m_vp;
QString m_dest;
};
Okular::GotoActionPrivate::~GotoActionPrivate() = default;
GotoAction::GotoAction(const QString &fileName, const DocumentViewport &viewport)
: Action(*new GotoActionPrivate(fileName, viewport))
{
......@@ -170,14 +164,10 @@ public:
{
}
~ExecuteActionPrivate() override;
QString m_fileName;
QString m_parameters;
};
ExecuteActionPrivate::~ExecuteActionPrivate() = default;
ExecuteAction::ExecuteAction(const QString &file, const QString &parameters)
: Action(*new ExecuteActionPrivate(file, parameters))
{
......@@ -221,13 +211,9 @@ public:
{
}
~BrowseActionPrivate() override;
QUrl m_url;
};
BrowseActionPrivate::~BrowseActionPrivate() = default;
BrowseAction::BrowseAction(const QUrl &url)
: Action(*new BrowseActionPrivate(url))
{
......@@ -270,13 +256,9 @@ public:
{
}
~DocumentActionPrivate() override;
DocumentAction::DocumentActionType m_type;
};
DocumentActionPrivate::~DocumentActionPrivate() = default;
DocumentAction::DocumentAction(enum DocumentActionType documentActionType)
: Action(*new DocumentActionPrivate(documentActionType))
{
......@@ -345,7 +327,10 @@ public:
{
}
~SoundActionPrivate() override;
~SoundActionPrivate() override
{
delete m_sound;
}
double m_volume;
bool m_sync : 1;
......@@ -354,11 +339,6 @@ public:
Okular::Sound *m_sound;
};
SoundActionPrivate::~SoundActionPrivate()
{
delete m_sound;
}
SoundAction::SoundAction(double volume, bool sync, bool repeat, bool mix, Okular::Sound *sound)
: Action(*new SoundActionPrivate(volume, sync, repeat, mix, sound))
{
......@@ -420,14 +400,10 @@ public:
{
}
~ScriptActionPrivate() override;
ScriptType m_scriptType;
QString m_script;
};
ScriptActionPrivate::~ScriptActionPrivate() = default;
ScriptAction::ScriptAction(enum ScriptType type, const QString &script)
: Action(*new ScriptActionPrivate(type, script))
{
......@@ -477,14 +453,10 @@ public:
{
}
~MovieActionPrivate() override;
MovieAction::OperationType m_operation;
MovieAnnotation *m_annotation;
};
MovieActionPrivate::~MovieActionPrivate() = default;
MovieAction::MovieAction(OperationType operation)
: Action(*new MovieActionPrivate(operation))
{
......@@ -537,8 +509,6 @@ public:
{
}
~RenditionActionPrivate() override;
RenditionAction::OperationType m_operation;
Okular::Movie *m_movie;
ScriptType m_scriptType;
......@@ -546,8 +516,6 @@ public:
ScreenAnnotation *m_annotation;
};
RenditionActionPrivate::~RenditionActionPrivate() = default;
RenditionAction::RenditionAction(OperationType operation, Okular::Movie *movie, enum ScriptType scriptType, const QString &script)
: Action(*new RenditionActionPrivate(operation, movie, scriptType, script))
{
......
......@@ -56,8 +56,6 @@ Okular::NormalizedRect buildBoundingRectangleForButtons(const QList<Okular::Form
return boundingRect;
}
OkularUndoCommand::~OkularUndoCommand() = default;
AddAnnotationCommand::AddAnnotationCommand(Okular::DocumentPrivate *docPriv, Okular::Annotation *annotation, int pageNumber)
: m_docPriv(docPriv)
, m_annotation(annotation)
......
......@@ -31,7 +31,6 @@ class Page;
class OkularUndoCommand : public QUndoCommand
{
public:
~OkularUndoCommand() override;
virtual bool refreshInternalPageReferences(const QVector<Okular::Page *> &newPagesVector) = 0;
};
......
......@@ -126,8 +126,6 @@ public:
{
}
~FormFieldButtonPrivate() override;
Q_DECLARE_PUBLIC(FormFieldButton)
void setValue(const QString &v) override
......@@ -143,8 +141,6 @@ public:
}
};
FormFieldButtonPrivate::~FormFieldButtonPrivate() = default;
FormFieldButton::FormFieldButton()
: FormField(*new FormFieldButtonPrivate())
{
......@@ -170,8 +166,6 @@ public:
{
}
~FormFieldTextPrivate() override;
Q_DECLARE_PUBLIC(FormFieldText)
void setValue(const QString &v) override
......@@ -187,8 +181,6 @@ public:
}
};
FormFieldTextPrivate::~FormFieldTextPrivate() = default;
FormFieldText::FormFieldText()
: FormField(*new FormFieldTextPrivate())
{
......@@ -235,8 +227,6 @@ public:
{
}
~FormFieldChoicePrivate() override;
Q_DECLARE_PUBLIC(FormFieldChoice)
void setValue(const QString &v) override
......@@ -269,8 +259,6 @@ public:
QMap<QString, QString> exportValues;
};
FormFieldChoicePrivate::~FormFieldChoicePrivate() = default;
FormFieldChoice::FormFieldChoice()
: FormField(*new FormFieldChoicePrivate())
{
......@@ -333,8 +321,6 @@ public:
{
}
~FormFieldSignaturePrivate() override;
Q_DECLARE_PUBLIC(FormFieldSignature)
void setValue(const QString &v) override
......@@ -348,8 +334,6 @@ public:
}
};
FormFieldSignaturePrivate::~FormFieldSignaturePrivate() = default;
FormFieldSignature::FormFieldSignature()
: FormField(*new FormFieldSignaturePrivate())
{
......
......@@ -72,8 +72,6 @@ Q_DECLARE_METATYPE(const Poppler::LinkOCGState *)
static const int defaultPageWidth = 595;
static const int defaultPageHeight = 842;
PDFEmbeddedFile::~PDFEmbeddedFile() = default;
class PDFOptionsPage : public Okular::PrintOptionsWidget
{
Q_OBJECT
......
......@@ -22,8 +22,6 @@ public:
{
}
~PDFEmbeddedFile() override;
QString name() const override
{
return ef->name();
......
......@@ -45,7 +45,9 @@ public:
/**
* Destroys the config interface.
*/
virtual ~ConfigInterface();
virtual ~ConfigInterface()
{
}
ConfigInterface(const ConfigInterface &) = delete;
ConfigInterface &operator=(const ConfigInterface &) = delete;
......
......@@ -46,7 +46,9 @@ public:
/**
* Destroys the gui interface.
*/
~GuiInterface() override;
~GuiInterface() override
{
}
GuiInterface(const GuiInterface &) = delete;
GuiInterface &operator=(const GuiInterface &) = delete;
......
......@@ -46,7 +46,9 @@ public:
/**
* Destroys the printer interface.
*/
virtual ~PrintInterface();
virtual ~PrintInterface()
{
}
PrintInterface(const PrintInterface &) = delete;
PrintInterface &operator=(const PrintInterface &) = delete;
......
......@@ -55,7 +55,9 @@ public:
/**
* Destroys the save interface.
*/
virtual ~SaveInterface();
virtual ~SaveInterface()
{
}
SaveInterface(const SaveInterface &) = delete;
SaveInterface &operator=(const SaveInterface &) = delete;
......
......@@ -34,7 +34,9 @@ public:
ViewerInterface()
{
}
virtual ~ViewerInterface();
virtual ~ViewerInterface()
{
}
ViewerInterface(const ViewerInterface &) = delete;
ViewerInterface &operator=(const ViewerInterface &) = delete;
......
/***************************************************************************
* Copyright (C) 2020 by Albert Astals Cid <aacid@kde.org> *
* Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -7,14 +7,54 @@
* (at your option) any later version. *
***************************************************************************/
#include "configinterface.h"
#include "guiinterface.h"
#include "printinterface.h"
#include "saveinterface.h"
#include "viewerinterface.h"
Okular::ConfigInterface::~ConfigInterface() = default;
Okular::GuiInterface::~GuiInterface() = default;
Okular::PrintInterface::~PrintInterface() = default;
Okular::SaveInterface::~SaveInterface() = default;
Okular::ViewerInterface::~ViewerInterface() = default;
#ifndef _KDOCUMENTVIEWER_H_
#define _KDOCUMENTVIEWER_H_
#include "okularpart_export.h"
#include <QStringList>
class QUrl;
/**
* @short Abstract interface for a document viewer
*
* This interface describes the basic functions of a document viewer.
*/
class OKULARPART_EXPORT KDocumentViewer
{
public:
KDocumentViewer()
{
}
virtual ~KDocumentViewer()
{
}
KDocumentViewer(const KDocumentViewer &) = delete;
KDocumentViewer &operator=(const KDocumentViewer &) = delete;
/**
* Open the document at the specified @p url at page @p page.
*/
virtual bool openDocument(const QUrl &url, uint page) = 0;
/**
* Change to @p page the currently shown page.
*/
virtual void goToPage(uint page) = 0;
/**
* Start the presentation mode.
*/
virtual void startPresentation() = 0;
/**
* Return a list with the supported mimetypes.
*/
virtual QStringList supportedMimeTypes() const = 0;
};
Q_DECLARE_INTERFACE(KDocumentViewer, "org.kde.kdocumentviewer/0.1")
#endif
......@@ -977,6 +977,18 @@ Part::~Part()
#endif
}
bool Part::openDocument(const QUrl &url, uint page)
{
Okular::DocumentViewport vp(page - 1);
vp.rePos.enabled = true;
vp.rePos.normalizedX = 0;
vp.rePos.normalizedY = 0;
vp.rePos.pos = Okular::DocumentViewport::TopLeft;
if (vp.isValid())
m_document->setNextDocumentViewport(vp);
return openUrl(url);
}
void Part::startPresentation()
{
m_cliPresentation = true;
......
......@@ -35,6 +35,7 @@
#include "core/document.h"
#include "core/observer.h"
#include "interfaces/viewerinterface.h"
#include "kdocumentviewer.h"
#include "okularpart_export.h"
......@@ -108,10 +109,11 @@ enum EmbedMode {
* @author Wilco Greven <greven@kde.org>
* @version 0.2
*/
class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::DocumentObserver, public Okular::ViewerInterface
class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::DocumentObserver, public KDocumentViewer, public Okular::ViewerInterface
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.okular")
Q_INTERFACES(KDocumentViewer)
Q_INTERFACES(Okular::ViewerInterface)
friend class PartTest;
......@@ -134,8 +136,9 @@ public:
void notifyViewportChanged(bool smoothMove) override;
void notifyPageChanged(int page, int flags) override;
Q_INVOKABLE void startPresentation();
Q_INVOKABLE QStringList supportedMimeTypes() const;
bool openDocument(const QUrl &url, uint page) override;
void startPresentation() override;
QStringList supportedMimeTypes() const override;
QUrl realUrl() const;
......@@ -149,7 +152,7 @@ public:
Q_INVOKABLE bool activateTabIfAlreadyOpenFile() const;
public Q_SLOTS: // dbus
Q_SCRIPTABLE Q_NOREPLY void goToPage(uint page);
Q_SCRIPTABLE Q_NOREPLY void goToPage(uint page) override;
Q_SCRIPTABLE Q_NOREPLY void openDocument(const QString &doc);
Q_SCRIPTABLE uint pages();
Q_SCRIPTABLE uint currentPage();
......
......@@ -56,6 +56,7 @@
// local includes
#include "../interfaces/viewerinterface.h"
#include "kdocumentviewer.h"
#include "shellutils.h"
static const char *shouldShowMenuBarComingFromFullScreen = "shouldShowMenuBarComingFromFullScreen";
......@@ -423,7 +424,9 @@ void Shell::fileOpen()
// button is clicked
const int activeTab = m_tabWidget->currentIndex();
if (!m_fileformatsscanned) {
QMetaObject::invokeMethod(m_tabs[activeTab].part, "supportedMimeTypes", Q_RETURN_ARG(QStringList, m_fileformats));
const KDocumentViewer *const doc = qobject_cast<KDocumentViewer *>(m_tabs[activeTab].part);
if (doc)
m_fileformats = doc->supportedMimeTypes();
if (m_fileformats.isEmpty())
m_fileformats = fileFormats();
......@@ -697,9 +700,10 @@ void Shell::openNewTab(const QUrl &url, const QString &serializedOptions)
void Shell::applyOptionsToPart(QObject *part, const QString &serializedOptions)
{
KDocumentViewer *const doc = qobject_cast<KDocumentViewer *>(part);
const QString find = ShellUtils::find(serializedOptions);
if (ShellUtils::startInPresentation(serializedOptions))
QMetaObject::invokeMethod(part, "startPresentation");
doc->startPresentation();
if (ShellUtils::showPrintDialog(serializedOptions))
QMetaObject::invokeMethod(part, "enableStartWithPrint");
if (ShellUtils::showPrintDialogAndExit(serializedOptions))
......
......@@ -51,8 +51,6 @@ public:
setData(0, PageItemDelegate::PageRole, QString::number(m_viewport.pageNumber + 1));
}
~BookmarkItem() override;
BookmarkItem(const BookmarkItem &) = delete;
BookmarkItem &operator=(const BookmarkItem &) = delete;
......@@ -95,8 +93,6 @@ private:
Okular::DocumentViewport m_viewport;
};
BookmarkItem::~BookmarkItem() = default;
class FileItem : public QTreeWidgetItem
{
public:
......@@ -109,8 +105,6 @@ public:
setData(0, UrlRole, QVariant::fromValue(url));
}
~FileItem() override;
FileItem(const FileItem &) = delete;
FileItem &operator=(const FileItem &) = delete;
......@@ -124,8 +118,6 @@ public:
}
};
FileItem::~FileItem() = default;
BookmarkList::BookmarkList(Okular::Document *document, QWidget *parent)
: QWidget(parent)
, m_document(document)
......
......@@ -44,8 +44,6 @@ protected:
{
}
~ColorActionIconEngine() override;
ColorActionIconEngine(const ColorActionIconEngine &) = delete;
ColorActionIconEngine &operator=(const ColorActionIconEngine &) = delete;
......@@ -93,8 +91,6 @@ protected:
};
};
ColorAction::ColorActionIconEngine::~ColorActionIconEngine() = default;
DrawingToolActions::DrawingToolActions(KActionCollection *parent)
: QObject(parent)
{
......
......@@ -73,8 +73,6 @@ public:
pixmap = GuiUtils::loadStamp(hoverIconName, size);
}
~PickPointEngine() override;
QRect event(EventType type, Button button, Modifiers modifiers, double nX, double nY, double xScale, double yScale, const Okular::Page *page) override
{
xscale = xScale;
......@@ -311,8 +309,6 @@ private:
bool m_block;
};
PickPointEngine::~PickPointEngine() = default;
/** @short PolyLineEngine */
class PolyLineEngine : public AnnotatorEngine
{
......@@ -334,8 +330,6 @@ public:
numofpoints = -1;
}
~PolyLineEngine() override;
static Okular::NormalizedPoint constrainAngle(const Okular::NormalizedPoint &p1, double x, double y, double xScale, double yScale, double angleIncrement)
{
// given the normalized point (x, y), return the closest point such that the line segment from p1 forms an angle
......@@ -490,8 +484,6 @@ private:
int numofpoints;
};
PolyLineEngine::~PolyLineEngine() = default;
/** @short TextSelectorEngine */
class TextSelectorEngine : public AnnotatorEngine
{
......@@ -503,8 +495,6 @@ public:
// parse engine specific attributes
}
~TextSelectorEngine() override;
QRect event(EventType type, Button button, Modifiers /*modifiers*/, double nX, double nY, double xScale, double yScale, const Okular::Page * /*page*/) override
{
// only proceed if pressing left button
......@@ -630,8 +620,6 @@ private:
QRect rect;
};
TextSelectorEngine::~TextSelectorEngine() = default;
/** @short AnnotationTools*/
class AnnotationTools
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment