diff --git a/kdevplatform/interfaces/idocumentationprovider.h b/kdevplatform/interfaces/idocumentationprovider.h index 4532dafb7b..165abf092c 100644 --- a/kdevplatform/interfaces/idocumentationprovider.h +++ b/kdevplatform/interfaces/idocumentationprovider.h @@ -1,66 +1,66 @@ /* This file is part of KDevelop Copyright 2009 Aleix Pol This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KDEVPLATFORM_IDOCUMENTATIONPROVIDER_H #define KDEVPLATFORM_IDOCUMENTATIONPROVIDER_H #include "interfacesexport.h" #include "idocumentation.h" class QIcon; class QModelIndex; class QAbstractItemModel; namespace KDevelop { class Declaration; class KDEVPLATFORMINTERFACES_EXPORT IDocumentationProvider { public: virtual ~IDocumentationProvider(); /** @returns an IDocument instance for the specified declaration or a null pointer if none could be found.*/ virtual IDocumentation::Ptr documentationForDeclaration(KDevelop::Declaration* declaration) const = 0; /** @returns an instance of an interface to create an index for all the items provided by this class. * Should have all items at the same level */ virtual QAbstractItemModel* indexModel() const = 0; /** @returns the documentation information related to the index in the model. */ virtual IDocumentation::Ptr documentationForIndex(const QModelIndex& idx) const = 0; /** @returns some icon associated to the provider. */ virtual QIcon icon() const = 0; /** @returns a name to identify the provider to the user. */ virtual QString name() const = 0; /** @returns a documentation item where we can show some home page information such a context index. */ virtual IDocumentation::Ptr homePage() const = 0; Q_SIGNALS: - virtual void addHistory(const KDevelop::IDocumentation::Ptr& doc) const = 0; + virtual void addHistory(const KDevelop::IDocumentation::Ptr& doc) = 0; }; } Q_DECLARE_INTERFACE( KDevelop::IDocumentationProvider, "org.kdevelop.IDocumentationProvider") #endif diff --git a/kdevplatform/interfaces/idocumentationproviderprovider.h b/kdevplatform/interfaces/idocumentationproviderprovider.h index 7cc5cb9698..2c95fdfae4 100644 --- a/kdevplatform/interfaces/idocumentationproviderprovider.h +++ b/kdevplatform/interfaces/idocumentationproviderprovider.h @@ -1,47 +1,47 @@ /* This file is part of KDevelop Copyright 2010 Benjamin Port This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KDEVPLATFORM_IDOCUMENTATIONPROVIDERPROVIDER_H #define KDEVPLATFORM_IDOCUMENTATIONPROVIDERPROVIDER_H #include #include "interfacesexport.h" namespace KDevelop { class IDocumentationProvider; class KDEVPLATFORMINTERFACES_EXPORT IDocumentationProviderProvider { public: virtual ~IDocumentationProviderProvider(); /** @returns a list of providers provided by this class. */ virtual QList providers() = 0; Q_SIGNALS: - virtual void changedProvidersList() const=0; + virtual void changedProvidersList() = 0; }; } Q_DECLARE_INTERFACE( KDevelop::IDocumentationProviderProvider, "org.kdevelop.IDocumentationProviderProvider") #endif diff --git a/kdevplatform/interfaces/itestcontroller.h b/kdevplatform/interfaces/itestcontroller.h index 9a1eba6d06..c33afbb8b3 100644 --- a/kdevplatform/interfaces/itestcontroller.h +++ b/kdevplatform/interfaces/itestcontroller.h @@ -1,141 +1,141 @@ /* This file is part of KDevelop Copyright 2012 Miha Čančula This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KDEVPLATFORM_ITESTCONTROLLER_H #define KDEVPLATFORM_ITESTCONTROLLER_H #include "interfacesexport.h" #include #include #include #include class QStringList; namespace KDevelop { struct TestResult; class IProject; class ITestSuite; /** * The result of a single unit test run **/ struct KDEVPLATFORMINTERFACES_EXPORT TestResult { /** * Enumeration of possible test case results **/ enum TestCaseResult { NotRun, ///< The test case was not selected for running. Skipped, ///< The test case was skipped. Passed, ///< The test case was run and passed. Failed, ///< The test case was run and failed. ExpectedFail, ///< The test case was expected to fail, and did. UnexpectedPass, ///< The test case was expected to fail, but passed. Error, ///< There was an error while trying to run the test case. }; /** * The individual results of all test cases. **/ QHash testCaseResults; /** * The total result of the entire suite. * * This is usually the worst outcome of the individual test cases, * but can be different especially when dealing with errors. */ TestCaseResult suiteResult; }; class KDEVPLATFORMINTERFACES_EXPORT ITestController : public QObject { Q_OBJECT public: explicit ITestController(QObject* parent = nullptr); ~ITestController() override; /** * Add a new test suite. * * No ownership is taken, the caller stays responsible for the suite. * * If a suite with the same project and same name exists, the old one will be removed and deleted. */ virtual void addTestSuite(ITestSuite* suite) = 0; /** * Remove a test suite from the controller. * * This does not delete the test suite. */ virtual void removeTestSuite(ITestSuite* suite) = 0; /** * Returns the list of all known test suites. */ virtual QList testSuites() const = 0; /** * Find a test suite in @p project with @p name. */ virtual ITestSuite* findTestSuite(IProject* project, const QString& name) const = 0; /** * Return the list of all test suites in @p project. */ virtual QList testSuitesForProject(IProject* project) const = 0; /** * Notify the controller that a test run for @p suite was finished with result @p result */ virtual void notifyTestRunFinished(ITestSuite* suite, const KDevelop::TestResult& result) = 0; /** * Notify the controller that a test run for @p suite was started */ virtual void notifyTestRunStarted(KDevelop::ITestSuite* suite, const QStringList& test_cases) = 0; Q_SIGNALS: /** * Emitted whenever a new test suite gets added. */ - void testSuiteAdded(KDevelop::ITestSuite* suite) const; + void testSuiteAdded(KDevelop::ITestSuite* suite); /** * Emitted whenever a test suite gets removed. */ - void testSuiteRemoved(KDevelop::ITestSuite* suite) const; + void testSuiteRemoved(KDevelop::ITestSuite* suite); /** * Emitted after a test suite was run. */ - void testRunFinished(KDevelop::ITestSuite* suite, const KDevelop::TestResult& result) const; + void testRunFinished(KDevelop::ITestSuite* suite, const KDevelop::TestResult& result); /** * Emitted when a test suite starts. */ - void testRunStarted(KDevelop::ITestSuite* suite, const QStringList& test_cases) const; + void testRunStarted(KDevelop::ITestSuite* suite, const QStringList& test_cases); }; } Q_DECLARE_INTERFACE( KDevelop::ITestController, "org.kdevelop.ITestController") #endif // KDEVPLATFORM_ITESTCONTROLLER_H diff --git a/plugins/cmake/cmakedocumentation.h b/plugins/cmake/cmakedocumentation.h index 6fb53e3e39..8b7ceb435b 100644 --- a/plugins/cmake/cmakedocumentation.h +++ b/plugins/cmake/cmakedocumentation.h @@ -1,67 +1,67 @@ /* KDevelop CMake Support * * Copyright 2009 Aleix Pol * * 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 the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #ifndef CMAKEDOCUMENTATION_H #define CMAKEDOCUMENTATION_H #include #include #include #include #include "icmakedocumentation.h" namespace KDevelop { class Declaration; } class CMakeManager; class QUrl; class CMakeCommandsContents; class KDescendantsProxyModel; class CMakeDocumentation : public KDevelop::IPlugin, public ICMakeDocumentation { Q_OBJECT Q_INTERFACES( ICMakeDocumentation ) Q_INTERFACES( KDevelop::IDocumentationProvider ) public: explicit CMakeDocumentation( QObject* parent = nullptr, const QVariantList& args = QVariantList() ); KDevelop::IDocumentation::Ptr description(const QString& identifier, const QUrl &file) const override; KDevelop::IDocumentation::Ptr documentationForDeclaration(KDevelop::Declaration* declaration) const override; QVector names(Type t) const override; CMakeCommandsContents* model() const { return m_index; } QAbstractItemModel* indexModel() const override; KDevelop::IDocumentation::Ptr documentationForIndex(const QModelIndex& idx) const override; QIcon icon() const override; QString name() const override; KDevelop::IDocumentation::Ptr homePage() const override; QString descriptionForIdentifier(const QString& identifier, Type t) const; Q_SIGNALS: - void addHistory(const KDevelop::IDocumentation::Ptr& doc) const override; + void addHistory(const KDevelop::IDocumentation::Ptr& doc) override; private: CMakeCommandsContents* m_index; KDescendantsProxyModel* m_flatIndex; }; #endif // CMAKEDOCUMENTATION_H diff --git a/plugins/debuggercommon/midebugsession.h b/plugins/debuggercommon/midebugsession.h index 47ec406510..cdfb1b03d7 100644 --- a/plugins/debuggercommon/midebugsession.h +++ b/plugins/debuggercommon/midebugsession.h @@ -1,377 +1,377 @@ /* * Common code for debugger support * * Copyright 1999-2001 John Birch * Copyright 2001 by Bernd Gehrmann * Copyright 2007 Hamish Rodda * Copyright 2009 Niko Sams * Copyright 2016 Aetf * * 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 the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #ifndef MIDEBUGSESSION_H #define MIDEBUGSESSION_H #include #include "dbgglobal.h" #include "mibreakpointcontroller.h" #include "mi/mi.h" #include "mi/micommand.h" #include #include class IExecutePlugin; namespace KDevelop { class ILaunchConfiguration; class ProcessLineMaker; } namespace KDevMI { namespace MI { class CommandQueue; } class MIDebugger; class MIDebuggerPlugin; class MIVariable; class STTY; class MIDebugSession : public KDevelop::IDebugSession { Q_OBJECT public: explicit MIDebugSession(MIDebuggerPlugin *plugin = nullptr); ~MIDebugSession() override; Q_SIGNALS: /** * Emits when received standard output lines from inferior */ - void inferiorStdoutLines(const QStringList &lines) const; + void inferiorStdoutLines(const QStringList& lines); /** * Emits when received standard error lines from inferior */ - void inferiorStderrLines(const QStringList &lines) const; + void inferiorStderrLines(const QStringList& lines); - void inferiorStopped(const MI::AsyncRecord &r) const; + void inferiorStopped(const MI::AsyncRecord& r); - void inferiorRunning() const; + void inferiorRunning(); /** * Emits when received standard output from debugger for user commands */ - void debuggerUserCommandOutput(const QString &output) const; + void debuggerUserCommandOutput(const QString &output); /** * Emits when received standard output from debugger for internal commands */ - void debuggerInternalCommandOutput(const QString &output) const; + void debuggerInternalCommandOutput(const QString& output); /** * Emits when received internal output from debugger */ - void debuggerInternalOutput(const QString &output) const; + void debuggerInternalOutput(const QString& output) const; /** * Emits when received standard output from inferior's tty */ - void inferiorTtyStdout(const QByteArray &output) const; + void inferiorTtyStdout(const QByteArray& output); /** * Emits when received standard output from inferior's tty */ - void inferiorTtyStderr(const QByteArray &output) const; + void inferiorTtyStderr(const QByteArray& output); /** * Emits when the debugger instance state changes */ - void debuggerStateChanged(DBGStateFlags oldState, DBGStateFlags newState) const; + void debuggerStateChanged(DBGStateFlags oldState, DBGStateFlags newState); /** * Emits when there's message needed to be show to user. */ - void showMessage(const QString& message, int timeout) const; + void showMessage(const QString& message, int timeout); /** * Emits when the debugger console view need to be raised. */ - void raiseDebuggerConsoleViews() const; + void raiseDebuggerConsoleViews(); /** * Emits when need to reset */ - void reset() const; + void reset(); public: bool debuggerStateIsOn(DBGStateFlags state) const; DBGStateFlags debuggerState() const; bool hasCrashed() const; // BEGIN IDebugSession overrides public: DebuggerState state() const override; bool restartAvaliable() const override; MIBreakpointController * breakpointController() const override = 0; public Q_SLOTS: void restartDebugger() override; void stopDebugger() override; void interruptDebugger() override; void run() override; void runToCursor() override; void jumpToCursor() override; void stepOver() override; void stepIntoInstruction() override; void stepInto() override; void stepOverInstruction() override; void stepOut() override; // END IDebugSession overrides public Q_SLOTS: /** * Run currently executing program to the given \a url and \a line. */ void runUntil(const QUrl& url, int line); /** * Run currently executing program to the given \a address */ void runUntil(const QString& address); /** * Move the execution point of the currently executing program to the given \a url and \a line. */ void jumpTo(const QUrl& url, int line); /** * Move the execution point of the currently executing program to the given \a address. *Note: It can be really very dangerous, so use jumpTo instead. */ void jumpToMemoryAddress(const QString& address); /** * Start the debugger, and execute the inferior program specified by \a cfg. */ bool startDebugging(KDevelop::ILaunchConfiguration *cfg, IExecutePlugin *iexec); /** * Start the debugger, and examine the core file given by \a coreFile. */ bool examineCoreFile(const QUrl &debugee, const QUrl &coreFile); /** * Start the debugger, and attach to a currently running process with the given \a pid. */ bool attachToProcess(int pid); public: virtual MI::MICommand *createCommand(MI::CommandType type, const QString& arguments, MI::CommandFlags flags = {}) const; virtual MI::MICommand *createUserCommand(const QString &cmd) const; /** Adds a command to the end of queue of commands to be executed by debugger. The command will be actually sent to debugger only when replies from all previous commands are received and full processed. The literal command sent to debugger is obtained by calling cmd->cmdToSend. The call is made immediately before sending the command, so it's possible to use results of prior commands when computing the exact command to send. */ void addUserCommand(const QString &cmd); void addCommand(MI::MICommand* cmd); /** Same as above, but internally constructs MICommand using createCommand() */ void addCommand(MI::CommandType type, const QString& arguments = QString(), MI::CommandFlags flags = {}); void addCommand(MI::CommandType type, const QString& arguments, MI::MICommandHandler* handler, MI::CommandFlags flags = {}); void addCommand(MI::CommandType type, const QString& arguments, const MI::FunctionCommandHandler::Function& callback, MI::CommandFlags flags = {}); template void addCommand(MI::CommandType type, const QString& arguments, Handler* handler_this, void (Handler::* handler_method)(const MI::ResultRecord&), MI::CommandFlags flags = {}); QMap & variableMapping(); MIVariable* findVariableByVarobjName(const QString &varobjName) const; void markAllVariableDead(); protected Q_SLOTS: virtual void slotDebuggerReady(); virtual void slotDebuggerExited(bool abnormal, const QString &msg); virtual void slotInferiorStopped(const MI::AsyncRecord &r); /** * Triggered every time program begins/continues it's execution. */ virtual void slotInferiorRunning(); /** * Handle MI async notifications. */ virtual void processNotification(const MI::AsyncRecord &n); /** Default handler for errors. Tries to guess is the error message is telling that target is gone, if so, informs the user. Otherwise, shows a dialog box and reloads view state. */ virtual void defaultErrorHandler(const MI::ResultRecord &result); /** * Update session state when debugger state changes, and show messages */ virtual void handleDebuggerStateChange(DBGStateFlags oldState, DBGStateFlags newState); void handleNoInferior(const QString &msg); void handleInferiorFinished(const QString &msg); protected: void queueCmd(MI::MICommand *cmd); /** Try to execute next command in the queue. If GDB is not busy with previous command, and there's a command in the queue, sends it. */ void executeCmd(); void destroyCmds(); virtual void ensureDebuggerListening(); /** * Start the debugger instance */ bool startDebugger(KDevelop::ILaunchConfiguration *cfg); /** * MIDebugSession takes the ownership of the created instance. */ virtual MIDebugger *createDebugger() const = 0; /** * Initialize debugger and set default configurations. */ virtual void initializeDebugger() = 0; /** * Do per launch configuration. */ virtual void configInferior(KDevelop::ILaunchConfiguration *cfg, IExecutePlugin *iexec, const QString &executable) = 0; /** * Start the inferior program (either local or remote). */ virtual bool execInferior(KDevelop::ILaunchConfiguration *cfg, IExecutePlugin *iexec, const QString &executable) = 0; /** * Further config the debugger and load the core dump */ virtual bool loadCoreFile(KDevelop::ILaunchConfiguration *cfg, const QString &debugee, const QString &corefile) = 0; /** * Manipulate debugger instance state */ void setDebuggerStateOn(DBGStateFlags stateOn); void setDebuggerStateOff(DBGStateFlags stateOff); void setDebuggerState(DBGStateFlags newState); void debuggerStateChange(DBGStateFlags oldState, DBGStateFlags newState); /** * Manipulate the session state */ void setSessionState(DebuggerState state); void raiseEvent(event_t e) override; /** Called when there are no pending commands and 'm_stateReloadNeeded' is true. Also can be used to immediately reload program state. Issues commands to completely reload all program state shown to the user. */ void reloadProgramState(); void programNoApp(const QString &msg); void programFinished(const QString &msg); // FIXME: Whether let the debugger source init files when starting, // only used in unit test currently, potentially could be made a user // configurable option void setSourceInitFile(bool enable); private Q_SLOTS: void handleTargetAttach(const MI::ResultRecord& r); // Pops up a dialog box with some hopefully // detailed information about which state debugger // is in, which commands were sent and so on. void explainDebuggerStatus(); protected: KDevelop::ProcessLineMaker *m_procLineMaker; std::unique_ptr m_commandQueue; // Though the misleading class name, this is the session level state. // see m_debuggerState for debugger instance state DebuggerState m_sessionState; MIDebugger *m_debugger; DBGStateFlags m_debuggerState; bool m_stateReloadInProgress; bool m_stateReloadNeeded; std::unique_ptr m_tty; bool m_hasCrashed; bool m_sourceInitFile; // Map from GDB varobj name to MIVariable. QMap m_allVariables; MIDebuggerPlugin *m_plugin; }; template void MIDebugSession::addCommand(MI::CommandType type, const QString& arguments, Handler* handler_this, void (Handler::* handler_method)(const MI::ResultRecord&), MI::CommandFlags flags) { auto cmd = createCommand(type, arguments, flags); cmd->setHandler(handler_this, handler_method); queueCmd(cmd); } } // end of namespace KDevMI #endif // MIDEBUGSESSION_H diff --git a/plugins/manpage/manpageplugin.h b/plugins/manpage/manpageplugin.h index 75f59f42a6..8d20444ee8 100644 --- a/plugins/manpage/manpageplugin.h +++ b/plugins/manpage/manpageplugin.h @@ -1,61 +1,61 @@ /* This file is part of KDevelop Copyright 2010 Yannick Motta Copyright 2010 Benjamin Port This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MANPAGEPLUGIN_H #define MANPAGEPLUGIN_H #include "manpagemodel.h" #include #include #include #include class ManPageDocumentation; class ManPagePlugin : public KDevelop::IPlugin, public KDevelop::IDocumentationProvider { Q_OBJECT Q_INTERFACES( KDevelop::IDocumentationProvider ) public: explicit ManPagePlugin(QObject *parent, const QVariantList & args= QVariantList()); ~ManPagePlugin() override; KDevelop::IDocumentation::Ptr documentationForDeclaration (KDevelop::Declaration* dec) const override; QAbstractItemModel* indexModel() const override; KDevelop::IDocumentation::Ptr documentationForIndex(const QModelIndex& index) const override; QIcon icon() const override; QString name() const override; KDevelop::IDocumentation::Ptr homePage() const override; void deleteProgressBar(); ManPageModel* model() const; QProgressBar* progressBar() const; Q_SIGNALS: - void addHistory(const KDevelop::IDocumentation::Ptr& doc ) const override; + void addHistory(const KDevelop::IDocumentation::Ptr& doc) override; private: KDevelop::IDocumentation::Ptr documentationForIdentifier(const QString& identifier) const; ManPageModel *m_model; }; #endif // MANPAGEPLUGIN_H diff --git a/plugins/qthelp/qthelpplugin.h b/plugins/qthelp/qthelpplugin.h index 9c76abd406..4d43d7ee63 100644 --- a/plugins/qthelp/qthelpplugin.h +++ b/plugins/qthelp/qthelpplugin.h @@ -1,64 +1,64 @@ /* This file is part of KDevelop Copyright 2009 Aleix Pol Copyright 2010 Benjamin Port This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef QTHELPPLUGIN_H #define QTHELPPLUGIN_H #include #include class QtHelpProvider; class QtHelpQtDoc; class QtHelpDocumentation; class QtHelpPlugin : public KDevelop::IPlugin, public KDevelop::IDocumentationProviderProvider { Q_OBJECT Q_INTERFACES( KDevelop::IDocumentationProviderProvider ) public: QtHelpPlugin(QObject *parent, const QVariantList & args); ~QtHelpPlugin() override; static QtHelpPlugin *self() { return s_plugin; } QList providers() override; QList qtHelpProviderLoaded(); bool isQtHelpQtDocLoaded() const; bool isQtHelpAvailable() const; int configPages() const override; KDevelop::ConfigPage* configPage(int number, QWidget* parent) override; public Q_SLOTS: void readConfig(); Q_SIGNALS: - void changedProvidersList() const override; + void changedProvidersList() override; private: void loadQtDocumentation(bool loadQtDoc); void searchHelpDirectory(QStringList& pathList, QStringList& nameList, QStringList& iconList, const QString& searchDir); void loadQtHelpProvider(const QStringList& pathList, const QStringList& nameList, const QStringList& iconList); static QtHelpPlugin *s_plugin; QList m_qtHelpProviders; QtHelpQtDoc* m_qtDoc; bool m_loadSystemQtDoc; }; #endif // QTHELPPLUGIN_H diff --git a/plugins/qthelp/qthelpproviderabstract.cpp b/plugins/qthelp/qthelpproviderabstract.cpp index f2cc413ef8..014d1c13cc 100644 --- a/plugins/qthelp/qthelpproviderabstract.cpp +++ b/plugins/qthelp/qthelpproviderabstract.cpp @@ -1,117 +1,117 @@ /* This file is part of KDevelop Copyright 2009 Aleix Pol Copyright 2009 David Nolden Copyright 2010 Benjamin Port This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "qthelpprovider.h" #include #include #include #include #include #include #include #include "qthelpnetwork.h" #include "qthelpdocumentation.h" #include "debug.h" using namespace KDevelop; QtHelpProviderAbstract::QtHelpProviderAbstract(QObject *parent, const QString &collectionFileName, const QVariantList &args) : QObject(parent) , m_engine(QStandardPaths::writableLocation(QStandardPaths::DataLocation)+'/'+collectionFileName) , m_nam(new HelpNetworkAccessManager(&m_engine, this)) { Q_UNUSED(args); if( !m_engine.setupData() ) { qCWarning(QTHELP) << "Couldn't setup QtHelp Collection file"; } } QtHelpProviderAbstract::~QtHelpProviderAbstract() { } IDocumentation::Ptr QtHelpProviderAbstract::documentationForDeclaration(Declaration* dec) const { QtHelpDocumentation::s_provider = const_cast(this); if (dec) { static const IndexedString qmlJs("QML/JS"); QString id; { DUChainReadLocker lock; id = dec->qualifiedIdentifier().toString(RemoveTemplateInformation); if (dec->topContext()->parsingEnvironmentFile()->language() == qmlJs && !id.isEmpty()) id = QLatin1String("QML.") + id; } if (!id.isEmpty()) { QMap links = m_engine.linksForIdentifier(id); if(!links.isEmpty()) return IDocumentation::Ptr(new QtHelpDocumentation(id, links)); } } return {}; } QAbstractItemModel* QtHelpProviderAbstract::indexModel() const { QtHelpDocumentation::s_provider = const_cast(this); return m_engine.indexModel(); } IDocumentation::Ptr QtHelpProviderAbstract::documentationForIndex(const QModelIndex& idx) const { QtHelpDocumentation::s_provider = const_cast(this); QString name=idx.data(Qt::DisplayRole).toString(); return IDocumentation::Ptr(new QtHelpDocumentation(name, m_engine.indexModel()->linksForKeyword(name))); } -void QtHelpProviderAbstract::jumpedTo(const QUrl& newUrl) const +void QtHelpProviderAbstract::jumpedTo(const QUrl& newUrl) { - QtHelpDocumentation::s_provider = const_cast(this); + QtHelpDocumentation::s_provider = this; QMap info; info.insert(newUrl.toString(), newUrl); IDocumentation::Ptr doc(new QtHelpDocumentation(newUrl.toString(), info)); emit addHistory(doc); } IDocumentation::Ptr QtHelpProviderAbstract::homePage() const { QtHelpDocumentation::s_provider = const_cast(this); return IDocumentation::Ptr(new HomeDocumentation); } bool QtHelpProviderAbstract::isValid() const { return !m_engine.registeredDocumentations().isEmpty(); } HelpNetworkAccessManager * QtHelpProviderAbstract::networkAccess() const { return m_nam; } diff --git a/plugins/qthelp/qthelpproviderabstract.h b/plugins/qthelp/qthelpproviderabstract.h index 10dad0b87c..1382f5ee44 100644 --- a/plugins/qthelp/qthelpproviderabstract.h +++ b/plugins/qthelp/qthelpproviderabstract.h @@ -1,61 +1,61 @@ /* This file is part of KDevelop Copyright 2009 Aleix Pol Copyright 2009 David Nolden Copyright 2010 Benjamin Port This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef QTHELPPROVIDERABSTRACT_H #define QTHELPPROVIDERABSTRACT_H #include #include #include #include class HelpNetworkAccessManager; class QtHelpProviderAbstract : public QObject, public KDevelop::IDocumentationProvider { Q_OBJECT Q_INTERFACES( KDevelop::IDocumentationProvider ) public: QtHelpProviderAbstract(QObject *parent, const QString &collectionFileName, const QVariantList & args); virtual ~QtHelpProviderAbstract(); KDevelop::IDocumentation::Ptr documentationForDeclaration (KDevelop::Declaration*) const override; KDevelop::IDocumentation::Ptr documentationForIndex(const QModelIndex& idx) const override; QAbstractItemModel* indexModel() const override; KDevelop::IDocumentation::Ptr homePage() const override; /// @return False in case we failed to load any documentation files, else true bool isValid() const; QHelpEngine* engine() { return &m_engine; } HelpNetworkAccessManager* networkAccess() const; public Q_SLOTS: - void jumpedTo(const QUrl& newUrl) const; + void jumpedTo(const QUrl& newUrl); Q_SIGNALS: - void addHistory(const KDevelop::IDocumentation::Ptr& doc) const override; + void addHistory(const KDevelop::IDocumentation::Ptr& doc) override; protected: QHelpEngine m_engine; HelpNetworkAccessManager* const m_nam; }; #endif // QTHELPPROVIDERABSTRACT_H