diff --git a/CMakeLists.txt b/CMakeLists.txt index 1acdca94ac..6a590ddb8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,160 +1,161 @@ cmake_minimum_required(VERSION 2.8.12) # KDevelop version set(KDEVELOP_VERSION_MAJOR 5) set(KDEVELOP_VERSION_MINOR 1) set(KDEVELOP_VERSION_PATCH 40) set( KDEVELOP_VERSION "${KDEVELOP_VERSION_MAJOR}.${KDEVELOP_VERSION_MINOR}.${KDEVELOP_VERSION_PATCH}" ) project(KDevelop) # we need some parts of the ECM CMake helpers find_package (ECM 5.14.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${KDevelop_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) include(KDECompilerSettings NO_POLICY_SCOPE) # needs to be first, as set policies influence following macros include(ECMOptionalAddSubdirectory) include(ECMInstallIcons) include(ECMAddAppIcon) include(ECMSetupVersion) include(ECMAddTests) include(ECMMarkNonGuiExecutable) include(ECMGenerateHeaders) include(ECMPackageConfigHelpers) include(ECMQtDeclareLoggingCategory) include(CTest) include(GenerateExportHeader) include(CMakePackageConfigHelpers) include(FeatureSummary) include(WriteBasicConfigVersionFile) include(CheckFunctionExists) include(KDEInstallDirs) include(KDECMakeSettings) set(QT_MIN_VERSION "5.4.0") find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Widgets Concurrent Quick QuickWidgets Test) set(KF5_DEP_VERSION "5.15.0") # we need KCrash::initialize find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS Config Declarative DocTools IconThemes I18n ItemModels ItemViews JobWidgets KCMUtils KIO NewStuff NotifyConfig Parts Service TextEditor ThreadWeaver XmlGui WindowSystem Crash ) find_package(KF5SysGuard) set_package_properties(KF5SysGuard PROPERTIES PURPOSE "Framework for process listing. Required for the 'Attach to Process' feature" ) find_package(KDevelop-PG-Qt 1.90.90) set_package_properties(KDevelop-PG-Qt PROPERTIES PURPOSE "KDevelop parser generator library. Required for the QMake Builder/Manager plugin." ) find_package(KDevPlatform ${KDEVELOP_VERSION} REQUIRED) find_package(SharedMimeInfo REQUIRED) add_definitions( -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050400 + -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS ) # Turn off missing-field-initializers warning to avoid noise from false positives with empty {} # See discussion: http://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html check_cxx_compiler_flag(-Wno-missing-field-initializers HAVE_MFI_FLAG) check_cxx_compiler_flag(-Werror=undefined-bool-conversion HAVE_UBC_FLAG) check_cxx_compiler_flag(-Werror=tautological-undefined-compare HAVE_TUC_FLAG) if (HAVE_MFI_FLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers") endif() if (HAVE_UBC_FLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=undefined-bool-conversion") endif() if (HAVE_TUC_FLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=tautological-undefined-compare") endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdocumentation") endif() include_directories(${KDevelop_SOURCE_DIR} ${KDevelop_BINARY_DIR} ) string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug" OR CMAKE_BUILD_TYPE_TOLOWER STREQUAL "") set(COMPILER_OPTIMIZATIONS_DISABLED TRUE) else() set(COMPILER_OPTIMIZATIONS_DISABLED FALSE) endif() # create config.h configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) add_subdirectory(pics) add_subdirectory(app) add_subdirectory(analyzers) add_subdirectory(formatters) add_subdirectory(languages) add_subdirectory(projectbuilders) add_subdirectory(projectmanagers) add_subdirectory(debuggers) add_subdirectory(app_templates) add_subdirectory(documentation) add_subdirectory(kdeintegration) add_subdirectory(utils) add_subdirectory(file_templates) add_subdirectory(providers) add_subdirectory(runtimes) add_subdirectory(shortcuts) add_subdirectory(doc) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDevelop") ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KDevelopConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) ecm_setup_version(${KDEVELOP_VERSION_MAJOR}.${KDEVELOP_VERSION_MINOR}.${KDEVELOP_VERSION_PATCH} VARIABLE_PREFIX KDEVELOP VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdevelop_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfigVersion.cmake" SOVERSION ${KDEVELOP_LIB_SOVERSION} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kdevelop_version.h" DESTINATION "${KDE_INSTALL_INCLUDEDIR}/kdevelop") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" ) install(EXPORT KDevelopTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" NAMESPACE KDev:: FILE KDevelopTargets.cmake) # kdebugsettings file install(FILES kdevelop.categories DESTINATION ${KDE_INSTALL_CONFDIR}) # CTestCustom.cmake has to be in the CTEST_BINARY_DIR. # in the KDE build system, this is the same as CMAKE_BINARY_DIR. configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake) install(FILES org.kde.kdevelop.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/analyzers/cppcheck/config/projectconfigpage.h b/analyzers/cppcheck/config/projectconfigpage.h index da6f8d2938..57dbf89a8f 100644 --- a/analyzers/cppcheck/config/projectconfigpage.h +++ b/analyzers/cppcheck/config/projectconfigpage.h @@ -1,68 +1,68 @@ /* This file is part of KDevelop Copyright 2013 Christoph Thielecke Copyright 2016 Anton Anikin 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CPPCHECK_PROJECT_CONFIG_PAGE_H #define CPPCHECK_PROJECT_CONFIG_PAGE_H #include "parameters.h" #include namespace KDevelop { class IProject; } namespace cppcheck { namespace Ui { class ProjectConfigPage; } class Parameters; class ProjectConfigPage : public KDevelop::ConfigPage { Q_OBJECT public: ProjectConfigPage(KDevelop::IPlugin* plugin, KDevelop::IProject* project, QWidget* parent); ~ProjectConfigPage() override; QIcon icon() const override; QString name() const override; -public slots: +public Q_SLOTS: void defaults() override; void reset() override; private: void updateCommandLine(); QScopedPointer ui; QScopedPointer m_parameters; }; } #endif diff --git a/analyzers/cppcheck/job.h b/analyzers/cppcheck/job.h index 70b658216d..184bd388cb 100644 --- a/analyzers/cppcheck/job.h +++ b/analyzers/cppcheck/job.h @@ -1,79 +1,79 @@ /* This file is part of KDevelop * Copyright 2006-2008 Hamish Rodda * Copyright 2002 Harald Fernengel * Copyright 2011 Mathieu Lornac * Copyright 2011 Damien Coppel * Copyright 2011 Lionel Duc * Copyright 2013 Christoph Thielecke * Copyright 2016 Anton Anikin 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CPPCHECK_JOB_H #define CPPCHECK_JOB_H #include "parameters.h" #include #include class QElapsedTimer; namespace cppcheck { class CppcheckParser; class Job : public KDevelop::OutputExecuteJob { Q_OBJECT public: explicit Job(const Parameters& params, QObject* parent = nullptr); ~Job() override; void start() override; Q_SIGNALS: void problemsDetected(const QVector& problems); -protected slots: +protected Q_SLOTS: void postProcessStdout(const QStringList& lines) override; void postProcessStderr(const QStringList& lines) override; void childProcessExited(int exitCode, QProcess::ExitStatus exitStatus) override; void childProcessError(QProcess::ProcessError processError) override; protected: void emitProblems(); QScopedPointer m_timer; QScopedPointer m_parser; QVector m_problems; QStringList m_standardOutput; QStringList m_xmlOutput; bool m_showXmlOutput; KDevelop::Path m_projectRootPath; }; } #endif diff --git a/analyzers/cppcheck/tests/test_cppcheckjob.h b/analyzers/cppcheck/tests/test_cppcheckjob.h index bc46543a7d..578d3f4a72 100644 --- a/analyzers/cppcheck/tests/test_cppcheckjob.h +++ b/analyzers/cppcheck/tests/test_cppcheckjob.h @@ -1,34 +1,34 @@ /************************************************************************************* * Copyright 2016 (C) Anton Anikin * * * * 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 TEST_CPPCHECK_JOB_H #define TEST_CPPCHECK_JOB_H #include class TestCppcheckJob : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testJob(); }; #endif diff --git a/analyzers/cppcheck/tests/test_cppcheckparser.h b/analyzers/cppcheck/tests/test_cppcheckparser.h index e89c061657..e6eb9a0d97 100644 --- a/analyzers/cppcheck/tests/test_cppcheckparser.h +++ b/analyzers/cppcheck/tests/test_cppcheckparser.h @@ -1,34 +1,34 @@ /************************************************************************************* * Copyright 2016 (C) Peje Nilsson * * * * 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 TEST_CPPCHECK_PARSER_H #define TEST_CPPCHECK_PARSER_H #include class TestCppcheckParser : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testParser(); }; #endif diff --git a/analyzers/heaptrack/job.h b/analyzers/heaptrack/job.h index fc15a2bbdd..edefd4588b 100644 --- a/analyzers/heaptrack/job.h +++ b/analyzers/heaptrack/job.h @@ -1,64 +1,64 @@ /* This file is part of KDevelop Copyright 2017 Anton Anikin 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #pragma once #include #include namespace KDevelop { class ILaunchConfiguration; } namespace Heaptrack { class Job : public KDevelop::OutputExecuteJob, public KDevelop::IStatus { Q_OBJECT Q_INTERFACES(KDevelop::IStatus) public: explicit Job(KDevelop::ILaunchConfiguration* launchConfig); explicit Job(long int pid); ~Job() override; void start() override; QString statusName() const override; QString resultsFile() const; -signals: +Q_SIGNALS: void clearMessage(KDevelop::IStatus*) override; void hideProgress(KDevelop::IStatus*) override; void showErrorMessage(const QString& message, int timeout = 0) override; void showMessage(KDevelop::IStatus*, const QString& message, int timeout = 0) override; void showProgress(KDevelop::IStatus*, int minimum, int maximum, int value) override; protected: void setup(); void postProcessStdout(const QStringList& lines) override; long int m_pid; QString m_analyzedExecutable; QString m_resultsFile; }; } diff --git a/debuggers/common/dialogs/processselection.h b/debuggers/common/dialogs/processselection.h index b09bc81d94..dd7c53d6a9 100644 --- a/debuggers/common/dialogs/processselection.h +++ b/debuggers/common/dialogs/processselection.h @@ -1,51 +1,51 @@ /* KDevelop GDB 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 PROCESSSELECTION_H #define PROCESSSELECTION_H #include class KSysGuardProcessList; class QItemSelection; class QPushButton; namespace KDevMI { class ProcessSelectionDialog : public QDialog { Q_OBJECT public: explicit ProcessSelectionDialog( QWidget *parent=nullptr ); ~ProcessSelectionDialog() override; long int pidSelected(); QSize sizeHint() const override; - private slots: + private Q_SLOTS: void selectionChanged( const QItemSelection& selected ); private: KSysGuardProcessList* m_processList; QPushButton* m_attachButton; }; } // end of namespace KDevMI #endif diff --git a/debuggers/common/mivariablecontroller.h b/debuggers/common/mivariablecontroller.h index 65129318ea..6850b3273c 100644 --- a/debuggers/common/mivariablecontroller.h +++ b/debuggers/common/mivariablecontroller.h @@ -1,78 +1,78 @@ /* * Variable controller implementation common to MI based debugger * * Copyright 2007 Hamish Rodda * Copyright 2008 Vladimir Prus * Copyright 2009 Niko Sams * * 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 MIVARIABLECONTROLLER_H #define MIVARIABLECONTROLLER_H #include "dbgglobal.h" #include namespace KDevMI { namespace MI { struct AsyncRecord; struct ResultRecord; struct Value; } class MIDebugSession; class MIVariableController : public KDevelop::IVariableController { Q_OBJECT public: explicit MIVariableController( MIDebugSession* parent); KDevelop::Variable* createVariable(KDevelop::TreeModel* model, KDevelop::TreeItem* parent, const QString& expression, const QString& display = {}) override; KTextEditor::Range expressionRangeUnderCursor(KTextEditor::Document* doc, const KTextEditor::Cursor& cursor) override; void addWatch(KDevelop::Variable* variable) override; void addWatchpoint(KDevelop::Variable* variable) override; void update() override; protected: void updateLocals(); -private slots: +private Q_SLOTS: void programStopped(const MI::AsyncRecord &r); void stateChanged(KDevelop::IDebugSession::DebuggerState); private: MIDebugSession* debugSession() const; void handleVarUpdate(const MI::ResultRecord& r); void addWatch(const MI::ResultRecord& r); void addWatchpoint(const MI::ResultRecord& r); void handleEvent(KDevelop::IDebugSession::event_t event) override; }; } // end of namespace KDevMI #endif // MIVARIABLECONTROLLER_H diff --git a/debuggers/common/registers/registercontroller.h b/debuggers/common/registers/registercontroller.h index cd03bff30c..07dfbb9769 100644 --- a/debuggers/common/registers/registercontroller.h +++ b/debuggers/common/registers/registercontroller.h @@ -1,247 +1,247 @@ /* * Class to fetch/change/send registers to the debugger. * Copyright 2013 Vlas Puhov * * 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 _REGISTERCONTROLLER_H_ #define _REGISTERCONTROLLER_H_ #include #include #include #include #include namespace KDevMI { namespace MI { struct ResultRecord; } class MIDebugSession; enum RegisterType {general, structured, flag, floatPoint}; class GroupsName { public: QString name() const { return _name;} int index() const {return _index;} RegisterType type() const{return _type; } QString flagName() const{return _flagName;} bool operator==(const GroupsName& g) const {return _name == g.name();} GroupsName(): _index(-1), _type(general) {} private: GroupsName(const QString& name, int idx, RegisterType type = general, const QString& flag = QString()): _name(name), _index(idx), _type(type), _flagName(flag) {} private: QString _name; int _index; ///Should be unique for each group for current architecture (0, 1...n). RegisterType _type; QString _flagName; ///Used only for flag registers. friend class IRegisterController; friend struct RegistersGroup; }; enum Format { Binary, Octal, Decimal, Hexadecimal, Raw, Unsigned, LAST_FORMAT }; enum Mode { natural, v4_float, v2_double, v4_int32, v2_int64, u32, u64, f32, f64, LAST_MODE }; struct FormatsModes { QVector formats; QVector modes; }; ///Register in format: @p name, @p value - space separated list of values struct Register { Register() {} Register(const QString& _name, const QString& _value): name(_name), value(_value) {} QString name; QString value; }; ///List of @p registers for @p groupName in @p format struct RegistersGroup { RegistersGroup() : format(Binary) , flag(false) {} GroupsName groupName; QVector registers; Format format; /// namesOfRegisterGroups() const = 0; ///Returns all supported formats for @p group (bin, dec, hex ...) QVector formats(const GroupsName& group); ///Sets current format for the @p group, if format is supported. Does nothing otherwise. void setFormat(Format f, const GroupsName& group); ///Returns all supported modes for @p group (i.e. how to display group: 2 int, 4 float or other number of columns) QVector modes(const GroupsName& group); ///Sets current mode for the @p group, if mode is supported. Does nothing otherwise. void setMode(Mode m, const GroupsName& group); -signals: +Q_SIGNALS: ///Emits @p group with updated registers. void registersChanged(const RegistersGroup& g); -public slots: +public Q_SLOTS: ///Updates registers in @p group. If @p group is empty - updates all registers. virtual void updateRegisters(const GroupsName& group = GroupsName()); ///Sends updated register's @p reg value to the debugger. virtual void setRegisterValue(const Register& reg); protected: explicit IRegisterController(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr); ///Returns registers from the @p group, or empty registers group if @p group is invalid. virtual RegistersGroup registersFromGroup(const GroupsName& group) const = 0; ///Sets value for @p register from @p group. virtual void setRegisterValueForGroup(const GroupsName& group, const Register& reg) = 0; ///Returns names of all registers for @p group. virtual QStringList registerNamesForGroup(const GroupsName& group) const = 0; /**Updates value for each register in the group. * @param [out] registers Registers which values should be updated. */ virtual void updateValuesForRegisters(RegistersGroup* registers) const; ///Returns value for the given @p name, empty string if the name is incorrect or there is no registers yet. QString registerValue(const QString& name) const; /** Sets a flag register. * @param reg register to set * @param flag flag register @p reg belongs to. */ void setFlagRegister(const Register& reg, const FlagRegister& flag); ///Sets new value for register @p reg, from group @p group. void setGeneralRegister(const Register& reg, const GroupsName& group); ///Sets new value for structured register(XMM, VFP quad and other) @p reg, from group @p group. void setStructuredRegister(const Register& reg, const GroupsName& group); ///Updates values in @p flagsGroup for @p flagRegister. void updateFlagValues(RegistersGroup* flagsGroup, const FlagRegister& flagRegister) const; ///Returns group that given register belongs to. GroupsName groupForRegisterName(const QString& name) const; ///Initializes registers, that is gets names of all available registers. Returns true is succeed. bool initializeRegisters(); GroupsName createGroupName(const QString& name, int idx, RegisterType t = general, const QString& flag = QString()) const; ///Returns register's number for @p name. QString numberForName(const QString& name) const; public: ~IRegisterController() override; private : ///Handles initialization of register's names. void registerNamesHandler(const MI::ResultRecord& r); ///Parses new values for general registers from @p r and updates it in m_registers. ///Emits registersChanged signal. void generalRegistersHandler(const MI::ResultRecord& r); ///Parses new values for structured registers from @p r and updates it in m_registers. ///Emits registersChanged signal. virtual void structuredRegistersHandler(const MI::ResultRecord& r); private: ///Groups that should be updated(emitted @p registersInGroupChanged signal), if empty - all. QVector m_pendingGroups; protected: ///Register names as it sees debugger (in format: number, name). QVector m_rawRegisterNames; ///Registers in format: name, value QHash m_registers; ///Supported formats and modes for each register's group. First format/mode is current. QVector m_formatsModes; ///Current debug session; MIDebugSession* m_debugSession; }; } // end of namespace KDevMI Q_DECLARE_TYPEINFO(KDevMI::Register, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(KDevMI::RegistersGroup, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(KDevMI::FlagRegister, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(KDevMI::GroupsName, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(KDevMI::FormatsModes, Q_MOVABLE_TYPE); #endif diff --git a/debuggers/common/registers/registercontroller_arm.h b/debuggers/common/registers/registercontroller_arm.h index 0a5c2efa5b..206354ab41 100644 --- a/debuggers/common/registers/registercontroller_arm.h +++ b/debuggers/common/registers/registercontroller_arm.h @@ -1,73 +1,73 @@ /* * Class to fetch/change/send registers to the debugger for arm architecture. * Copyright 2013 Vlas Puhov * * 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 REGISTERCONTROLLER_ARM_H #define REGISTERCONTROLLER_ARM_H #include "registercontroller.h" namespace KDevMI { class MIDebugSession; class RegisterController_Arm : public IRegisterController { Q_OBJECT public: explicit RegisterController_Arm(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr); QVector namesOfRegisterGroups() const override; -public slots: +public Q_SLOTS: void updateRegisters(const GroupsName& group = GroupsName()) override; protected: RegistersGroup registersFromGroup(const GroupsName& group) const override; QStringList registerNamesForGroup(const GroupsName& group) const override; void updateValuesForRegisters(RegistersGroup* registers) const override; void setRegisterValueForGroup(const GroupsName& group, const Register& reg) override; enum ArmRegisterGroups {General, Flags, VFP_single, VFP_double, VFP_quad, LAST_REGISTER}; GroupsName enumToGroupName(ArmRegisterGroups group) const; //None of functions below checks value for validity, if value is invalid updateRegistres() will restore the previous state. void setVFPS_Register(const Register& reg); void setVFPD_Register(const Register& reg); void setVFPQ_Register(const Register& reg); static QVector m_registerNames; private: void initRegisterNames(); static FlagRegister m_cpsr; bool m_registerNamesInitialized; }; } // end of namespace KDevMI #endif // REGISTERCONTROLLER_ARM_H diff --git a/debuggers/common/registers/registercontroller_x86.h b/debuggers/common/registers/registercontroller_x86.h index 71cfad2e2c..9023c6b164 100644 --- a/debuggers/common/registers/registercontroller_x86.h +++ b/debuggers/common/registers/registercontroller_x86.h @@ -1,96 +1,96 @@ /* * Class to fetch/change/send registers to the debugger for x86, x86_64 architectures. * Copyright 2013 Vlas Puhov * * 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 REGISTERCONTROLLER_X86_H #define REGISTERCONTROLLER_X86_H #include "registercontroller.h" namespace KDevMI { class MIDebugSession; class RegisterControllerGeneral_x86 : public IRegisterController { Q_OBJECT public: QVector namesOfRegisterGroups() const override; -public slots: +public Q_SLOTS: void updateRegisters(const GroupsName& group = GroupsName()) override; protected: explicit RegisterControllerGeneral_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr); RegistersGroup registersFromGroup(const GroupsName& group) const override; QStringList registerNamesForGroup(const GroupsName& group) const override; void updateValuesForRegisters(RegistersGroup* registers) const override; void setRegisterValueForGroup(const GroupsName& group, const Register& reg) override; enum X86RegisterGroups {General, Flags, FPU, XMM, Segment, LAST_REGISTER}; GroupsName enumToGroupName(X86RegisterGroups group) const; //None of functions below checks value for validity, if value is invalid updateRegistres() will restore the previous state. void setFPURegister(const Register& reg); void setXMMRegister(const Register& reg); void setSegmentRegister(const Register& reg); void setEFfagRegister(const Register& reg); private: void initRegisterNames();; protected: static QVector m_registerNames; static FlagRegister m_eflags; ///Indicates if register names were initialized. bool m_registerNamesInitialized; }; class RegisterController_x86 : public RegisterControllerGeneral_x86 { Q_OBJECT public: explicit RegisterController_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr); private: void initRegisterNames(); }; class RegisterController_x86_64 : public RegisterControllerGeneral_x86 { Q_OBJECT public: explicit RegisterController_x86_64(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr); private: void initRegisterNames(); }; } // end of namespace KDevMI #endif // REGISTERCONTROLLER_X86_H diff --git a/debuggers/common/registers/registersview.h b/debuggers/common/registers/registersview.h index 5fda3e11c5..28b45ee5f4 100644 --- a/debuggers/common/registers/registersview.h +++ b/debuggers/common/registers/registersview.h @@ -1,93 +1,93 @@ /* * Displays registers. * Copyright 2013 Vlas Puhov * * 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 REGISTERSVIEW_H #define REGISTERSVIEW_H #include "ui_registersview.h" #include class QMenu; class QSignalMapper; namespace KDevMI { class ModelsManager; /** @brief Class for displaying registers content */ class RegistersView : public QWidget, private Ui::RegistersView { Q_OBJECT public: explicit RegistersView(QWidget* p = nullptr); void enable(bool enabled); void setModel(ModelsManager* m); -public slots: +public Q_SLOTS: ///Updates registers for active views. void updateRegisters(); protected: ///Allows to choose register formates/modes. void contextMenuEvent(QContextMenuEvent* e) override; private: ///Returns list of active views. QStringList activeViews(); ///Adds @p v to the list of views with assigning it a name. void addView(QTableView* view, int idx); ///Clears names of all views. void clear(); ///Sets name for the table with index @p idx to the @p name. void setNameForTable(int idx, const QString& name); -private slots: +private Q_SLOTS: ///Changes register formates/modes to @p formatOrMode. void menuTriggered(const QString& formatOrMode); private: void setupActions(); ///Adds new action into m_actions and to this widget's list of actions. void insertAction(const QString& name, Qt::Key k); ///Returns action for given @p name. QAction* findAction(const QString& name); private Q_SLOTS: ///Enables/disables actions based on current view. void changeAvaliableActions(); private: QMenu* m_menu; QSignalMapper* m_mapper; ModelsManager* m_modelsManager; QVector m_actions; }; } // end of namespace KDevMI #endif diff --git a/debuggers/gdb/memviewdlg.h b/debuggers/gdb/memviewdlg.h index 25dcb05183..d89827a5a5 100644 --- a/debuggers/gdb/memviewdlg.h +++ b/debuggers/gdb/memviewdlg.h @@ -1,121 +1,121 @@ /*************************************************************************** begin : Tue Oct 5 1999 copyright : (C) 1999 by John Birch email : jbb@kdevelop.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 * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef MEMVIEW_H_ #define MEMVIEW_H_ #include "dbgglobal.h" #include "mi/mi.h" #include namespace Okteta { class ByteArrayModel; } namespace Okteta { class ByteArrayColumnView; } namespace KDevelop { class IDebugSession; } class QToolBox; namespace KDevMI { namespace GDB { class CppDebuggerPlugin; class MemoryView; class GDBController; class MemoryRangeSelector; class MemoryViewerWidget : public QWidget { Q_OBJECT public: explicit MemoryViewerWidget(CppDebuggerPlugin* plugin, QWidget* parent = nullptr); public Q_SLOTS: /** Adds a new memory view. */ void slotAddMemoryView(); Q_SIGNALS: void requestRaise(); private Q_SLOTS: void slotChildCaptionChanged(const QString& caption); private: // Data QToolBox* m_toolBox; }; class MemoryView : public QWidget { Q_OBJECT public: explicit MemoryView(QWidget* parent); void debuggerStateChanged(DBGStateFlags state); Q_SIGNALS: void captionChanged(const QString& caption); private: // Callbacks void sizeComputed(const QString& value); void memoryRead(const MI::ResultRecord& r); // Returns true is we successfully created the memoryView, and // can work. bool isOk() const; private Q_SLOTS: void memoryEdited(int start, int end); /** Informs the view about changes in debugger state. * Allows view to disable itself when debugger is not running. */ void slotStateChanged(DBGStateFlags oldState, DBGStateFlags newState); /** Invoked when user has changed memory range. Gets memory for the new range. */ void slotChangeMemoryRange(); void slotHideRangeDialog(); void slotEnableOrDisable(); private: // QWidget overrides void contextMenuEvent(QContextMenuEvent* e) override; void initWidget(); MemoryRangeSelector* m_rangeSelector; Okteta::ByteArrayModel *m_memViewModel; Okteta::ByteArrayColumnView *m_memViewView; quintptr m_memStart; QString m_memStartStr, m_memAmountStr; QByteArray m_memData; int m_debuggerState; - private slots: + private Q_SLOTS: void currentSessionChanged(KDevelop::IDebugSession* session); }; } // end of namespace GDB } // end of namespace KDevMI #endif diff --git a/debuggers/lldb/unittests/test_lldb.h b/debuggers/lldb/unittests/test_lldb.h index dc645029aa..b4d778b5d3 100644 --- a/debuggers/lldb/unittests/test_lldb.h +++ b/debuggers/lldb/unittests/test_lldb.h @@ -1,137 +1,137 @@ /* * Unit tests for LLDB debugger plugin * 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 LLDBTEST_H #define LLDBTEST_H #include class IExecutePlugin; namespace KDevelop { class BreakpointModel; class TestCore; class Variable; class VariableCollection; } namespace KDevMI { namespace LLDB { class LldbTest : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); void testStdout(); void testEnvironmentSet(); void testBreakpoint(); void testBreakOnStart(); void testDisableBreakpoint(); void testChangeLocationBreakpoint(); void testDeleteBreakpoint(); void testPendingBreakpoint(); void testUpdateBreakpoint(); void testIgnoreHitsBreakpoint(); void testConditionBreakpoint(); void testBreakOnWriteBreakpoint(); void testBreakOnWriteWithConditionBreakpoint(); void testBreakOnReadBreakpoint(); void testBreakOnReadBreakpoint2(); void testBreakOnAccessBreakpoint(); void testInsertBreakpointWhileRunning(); void testInsertBreakpointWhileRunningMultiple(); void testInsertBreakpointFunctionName(); void testManualBreakpoint(); void testInsertAndRemoveBreakpointWhileRunning(); void testPickupManuallyInsertedBreakpoint(); void testPickupManuallyInsertedBreakpointOnlyOnce(); void testBreakpointWithSpaceInPath(); void testBreakpointDisabledOnStart(); void testMultipleLocationsBreakpoint(); void testMultipleBreakpoint(); void testRegularExpressionBreakpoint(); void testChangeBreakpointWhileRunning(); void testCatchpoint(); void testShowStepInSource(); void testStack(); void testStackFetchMore(); void testStackDeactivateAndActive(); void testStackSwitchThread(); void testAttach(); void testRemoteDebugging(); void testCoreFile(); void testVariablesLocals(); void testVariablesLocalsStruct(); void testVariablesWatches(); void testVariablesWatchesQuotes(); void testVariablesWatchesTwoSessions(); void testVariablesStopDebugger(); void testVariablesStartSecondSession(); void testVariablesSwitchFrame(); void testVariablesQuicklySwitchFrame(); void testSwitchFrameLldbConsole(); void testSegfaultDebugee(); void testCommandOrderFastStepping(); void testRunLldbScript(); void testBug301287(); void testDebugInExternalTerminal(); void testSpecialPath(); void testEnvironmentCd(); private: // convenient access methods KDevelop::BreakpointModel *breakpoints(); KDevelop::VariableCollection *variableCollection(); KDevelop::Variable *watchVariableAt(int i); QModelIndex localVariableIndexAt(int i, int col = 0); private: KDevelop::TestCore *m_core; IExecutePlugin *m_iface; QString m_debugeeFileName; }; } // end of namespace LLDB } // end of namespace KDevMI #endif // LLDBTEST_H diff --git a/documentation/manpage/manpagedocumentation.h b/documentation/manpage/manpagedocumentation.h index 303f1b602d..1f13f93ecd 100644 --- a/documentation/manpage/manpagedocumentation.h +++ b/documentation/manpage/manpagedocumentation.h @@ -1,70 +1,70 @@ /* 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 MANPAGEDOCUMENTATION_H #define MANPAGEDOCUMENTATION_H #include "manpagemodel.h" #include #include #include #include #include class QWidget; class ManPagePlugin; class ManPageDocumentation : public KDevelop::IDocumentation { Q_OBJECT public: ManPageDocumentation(const QString& name, const QUrl& url); QString name() const override { return m_name; } QString description() const override; virtual bool providesWidget() const; QWidget* documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent = nullptr) override; KDevelop::IDocumentationProvider* provider() const override; static ManPagePlugin* s_provider; - private slots: + private Q_SLOTS: void finished(KJob*); private: const QUrl m_url; const QString m_name; QString m_description; }; class ManPageHomeDocumentation : public KDevelop::IDocumentation { Q_OBJECT public: KDevelop::IDocumentationProvider* provider() const override; QString name() const override; QString description() const override { return name(); } QWidget* documentationWidget ( KDevelop::DocumentationFindWidget* findWidget, QWidget* parent = nullptr ) override; }; #endif // MANPAGEDOCUMENTATION_H diff --git a/documentation/manpage/manpagedocumentationwidget.h b/documentation/manpage/manpagedocumentationwidget.h index 51c3f600ba..1839575ecd 100644 --- a/documentation/manpage/manpagedocumentationwidget.h +++ b/documentation/manpage/manpagedocumentationwidget.h @@ -1,48 +1,48 @@ /* This file is part of KDevelop Copyright 2010 Benjamin Port Copyright 2010 Yannick Motta 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 MANPAGEDOCUMENTATIONWIDGET_H #define MANPAGEDOCUMENTATIONWIDGET_H #include class QString; class QLabel; class QTreeView; class QProgressBar; class ManPageDocumentationWidget : public QStackedWidget { Q_OBJECT public: explicit ManPageDocumentationWidget(QWidget *parent = nullptr); -public slots: +public Q_SLOTS: void manIndexLoaded(); void sectionListUpdated(); void sectionParsed(); void handleError(const QString& errorString); private: QWidget* m_loadingWidget; QTreeView* m_treeView; QLabel* m_statusLabel; QProgressBar* m_progressBar; }; #endif // MANPAGEDOCUMENTATIONWIDGET_H diff --git a/documentation/manpage/manpagemodel.h b/documentation/manpage/manpagemodel.h index 9d1e2a8664..8527a76bb0 100644 --- a/documentation/manpage/manpagemodel.h +++ b/documentation/manpage/manpagemodel.h @@ -1,96 +1,96 @@ /* This file is part of KDevelop Copyright 2010 Yannick Motta Copyright 2010 Benjamin Port Copyright 2014 Milian Wolff 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 MANPAGEMODEL_H #define MANPAGEMODEL_H #include #include #include // id and name for man section typedef QPair ManSection; class ManPageModel : public QAbstractItemModel { Q_OBJECT public: explicit ManPageModel(QObject* parent = nullptr); ~ManPageModel() override; /** * You can use @p DeclarationRole to get the Declaration for a given index. * NOTE: If you use that, don't forget to lock the DUChain if you access the declaration! */ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; int columnCount(const QModelIndex& = QModelIndex()) const override { return 1; } QModelIndex parent(const QModelIndex& child = QModelIndex()) const override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; QStringListModel* indexList(); bool containsIdentifier(const QString& identifier); int sectionCount() const; bool isLoaded() const; int nbSectionLoaded() const; bool identifierInSection(const QString &identifier, const QString §ion) const; bool hasError() const; const QString& errorString() const; -signals: +Q_SIGNALS: void sectionParsed(); void sectionListUpdated(); void manPagesLoaded(); void error(const QString& errorString); -public slots: +public Q_SLOTS: void showItem(const QModelIndex& idx); void showItemFromUrl(const QUrl& url); -private slots: +private Q_SLOTS: void initModel(); void indexEntries(KIO::Job* job, const KIO::UDSEntryList& entries); void indexLoaded(KJob* job); void sectionEntries(KIO::Job* job, const KIO::UDSEntryList& entries); void sectionLoaded(); private: QString manPage(const QString §ionUrl, int position) const; void initSection(); QListIterator *iterator = nullptr; QList m_sectionList; QHash > m_manMap; QStringList m_index; QStringListModel* m_indexModel; bool m_loaded; int m_nbSectionLoaded; QString m_errorString; }; #endif // MANPAGEMODEL_H diff --git a/documentation/manpage/manpageplugin.h b/documentation/manpage/manpageplugin.h index f5e641664f..75f59f42a6 100644 --- a/documentation/manpage/manpageplugin.h +++ b/documentation/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; -signals: +Q_SIGNALS: void addHistory(const KDevelop::IDocumentation::Ptr& doc ) const override; private: KDevelop::IDocumentation::Ptr documentationForIdentifier(const QString& identifier) const; ManPageModel *m_model; }; #endif // MANPAGEPLUGIN_H diff --git a/documentation/qthelp/qthelpconfig.h b/documentation/qthelp/qthelpconfig.h index 264a12650a..3952a48464 100644 --- a/documentation/qthelp/qthelpconfig.h +++ b/documentation/qthelp/qthelpconfig.h @@ -1,70 +1,70 @@ /* This file is part of KDevelop Copyright 2010 Benjamin Port Copyright 2014 Kevin Funk 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 QTHELPCONFIG_H #define QTHELPCONFIG_H #include #include class QTreeWidgetItem; class QtHelpPlugin; namespace Ui { class QtHelpConfigUI; } class QtHelpConfig : public KDevelop::ConfigPage { public: Q_OBJECT public: explicit QtHelpConfig(QtHelpPlugin* plugin, QWidget *parent = nullptr); ~QtHelpConfig() override; KDevelop::ConfigPage::ConfigPageType configPageType() const override; bool checkNamespace(const QString &filename, QTreeWidgetItem* modifiedItem); QString name() const override; QString fullName() const override; QIcon icon() const override; - private slots: + private Q_SLOTS: void add(); void remove(QTreeWidgetItem* item); void modify(QTreeWidgetItem* item); void knsUpdate(KNS3::Entry::List list); public Q_SLOTS: void apply() override; void defaults() override; void reset() override; private: QTreeWidgetItem * addTableItem(const QString &icon, const QString &name, const QString &path, const QString &ghnsStatus); Ui::QtHelpConfigUI* m_configWidget; }; #endif // QTHELPCONFIG_H diff --git a/documentation/qthelp/qthelpdocumentation.h b/documentation/qthelp/qthelpdocumentation.h index c3f96e6c66..e649bf79b8 100644 --- a/documentation/qthelp/qthelpdocumentation.h +++ b/documentation/qthelp/qthelpdocumentation.h @@ -1,106 +1,106 @@ /* 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 QTHELPDOCUMENTATION_H #define QTHELPDOCUMENTATION_H #include #include #include #include #include namespace KDevelop { class StandardDocumentationView; } class QModelIndex; class QNetworkAccessManager; class QtHelpProviderAbstract; class QTemporaryFile; class QtHelpDocumentation : public KDevelop::IDocumentation { Q_OBJECT public: QtHelpDocumentation(const QString& name, const QMap& info); QtHelpDocumentation(const QString& name, const QMap& info, const QString& key); ~QtHelpDocumentation() override; QString name() const override { return m_name; } QString description() const override; QWidget* documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent) override; KDevelop::IDocumentationProvider* provider() const override; QMap info() const { return m_info; } static QtHelpProviderAbstract* s_provider; - public slots: + public Q_SLOTS: void viewContextMenuRequested(const QPoint& pos); - private slots: + private Q_SLOTS: void jumpedTo(const QUrl& newUrl); private: void setUserStyleSheet(KDevelop::StandardDocumentationView* view, const QUrl& url); private: QtHelpProviderAbstract *m_provider; const QString m_name; const QMap m_info; const QMap::const_iterator m_current; KDevelop::StandardDocumentationView* lastView; QPointer m_lastStyleSheet; }; class HomeDocumentation : public KDevelop::IDocumentation { Q_OBJECT public: HomeDocumentation(); QWidget* documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent = nullptr) override; QString description() const override { return QString(); } QString name() const override; KDevelop::IDocumentationProvider* provider() const override; - public slots: + public Q_SLOTS: void clicked(const QModelIndex& idx); private: QtHelpProviderAbstract *m_provider; }; class QtHelpAlternativeLink : public QAction { Q_OBJECT public: QtHelpAlternativeLink(const QString& name, const QtHelpDocumentation* doc, QObject* parent); - public slots: + public Q_SLOTS: void showUrl(); private: const QtHelpDocumentation* mDoc; const QString mName; }; #endif diff --git a/documentation/qthelp/qthelpplugin.h b/documentation/qthelp/qthelpplugin.h index ef57800ac6..9c76abd406 100644 --- a/documentation/qthelp/qthelpplugin.h +++ b/documentation/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 slots: + public Q_SLOTS: void readConfig(); - signals: + Q_SIGNALS: void changedProvidersList() const 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/documentation/qthelp/qthelpproviderabstract.h b/documentation/qthelp/qthelpproviderabstract.h index e580bb59f8..10dad0b87c 100644 --- a/documentation/qthelp/qthelpproviderabstract.h +++ b/documentation/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 slots: +public Q_SLOTS: void jumpedTo(const QUrl& newUrl) const; -signals: +Q_SIGNALS: void addHistory(const KDevelop::IDocumentation::Ptr& doc) const override; protected: QHelpEngine m_engine; HelpNetworkAccessManager* const m_nam; }; #endif // QTHELPPROVIDERABSTRACT_H diff --git a/documentation/qthelp/qthelpqtdoc.h b/documentation/qthelp/qthelpqtdoc.h index 6a71136e1b..440bffb3f6 100644 --- a/documentation/qthelp/qthelpqtdoc.h +++ b/documentation/qthelp/qthelpqtdoc.h @@ -1,47 +1,47 @@ /* This file is part of KDevelop Copyright 2009 Aleix Pol Copyright 2010 Benjamin Port Copyright 2016 Andreas Cord-Landwehr 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 QTHELPQTDOC_H #define QTHELPQTDOC_H #include "qthelpproviderabstract.h" class QtHelpQtDoc : public QtHelpProviderAbstract { Q_OBJECT public: QtHelpQtDoc(QObject *parent, const QVariantList &args); QIcon icon() const override; QString name() const override; void registerDocumentations(); void loadDocumentation(); void unloadDocumentation(); /** @return local paths to all QCH files found in QT_INSTALL_DOCS directory **/ QStringList qchFiles() const; private: QString m_path; - private slots: + private Q_SLOTS: void lookupDone(int code); }; #endif // QTHELPQTDOC_H diff --git a/documentation/qthelp/tests/test_qthelpplugin.h b/documentation/qthelp/tests/test_qthelpplugin.h index fdf30a4211..c78353876f 100644 --- a/documentation/qthelp/tests/test_qthelpplugin.h +++ b/documentation/qthelp/tests/test_qthelpplugin.h @@ -1,55 +1,55 @@ /* 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 TEST_QTHELPPLUGIN_H #define TEST_QTHELPPLUGIN_H #include class QtHelpPlugin; class TestQtHelpPlugin : public QObject { Q_OBJECT public: TestQtHelpPlugin(); private: KDevelop::TestCore* m_testCore; QtHelpPlugin *m_plugin; -private slots: +private Q_SLOTS: void initTestCase(); void init(); void testDefaultValue(); void testUnsetQtHelpDoc(); void testAddOneValidProvider(); void testAddTwoDifferentValidProvider(); void testAddInvalidProvider(); void testAddTwiceSameProvider(); void testRemoveOneProvider(); void testDeclarationLookup_Class(); void testDeclarationLookup_Method(); void testDeclarationLookup_OperatorFunction(); void cleanup(); void cleanupTestCase(); }; #endif // TEST_QTHELPPLUGIN_H diff --git a/formatters/astyle/astyle_preferences.h b/formatters/astyle/astyle_preferences.h index 62ae7cc0f3..ccc7ca3bcf 100644 --- a/formatters/astyle/astyle_preferences.h +++ b/formatters/astyle/astyle_preferences.h @@ -1,64 +1,64 @@ /* This file is part of KDevelop * Copyright (C) 2008 Cédric Pasteur Copyright (C) 2001 Matthias Hölzer-Klüpfel 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef ASTYLEPREFERENCES_H #define ASTYLEPREFERENCES_H #include #include "ui_astyle_preferences.h" class AStyleFormatter; class AStylePreferences : public KDevelop::SettingsWidget, public Ui::AStylePreferences { Q_OBJECT public: enum Language { CPP, Java, CSharp}; explicit AStylePreferences(Language lang=CPP, QWidget *parent=nullptr); ~AStylePreferences() override; void load(const KDevelop::SourceFormatterStyle &style) override; QString save() override; protected: void init(); void updatePreviewText(bool emitChangedSignal = true); void setItemChecked(int idx, bool checked); void updateWidgets(); -private slots: +private Q_SLOTS: void currentTabChanged(); void indentChanged(); void indentObjectsChanged(QListWidgetItem *item); void minMaxValuesChanged(); void bracketsChanged(); void blocksChanged(); void paddingChanged(); void onelinersChanged(); void pointerAlignChanged(); private: QScopedPointer m_formatter; bool m_enableWidgetSignals; }; #endif // ASTYLEPREFERENCES_H diff --git a/formatters/astyle/tests/test_astyle.h b/formatters/astyle/tests/test_astyle.h index 1fd2f1b031..e28ec2e929 100644 --- a/formatters/astyle/tests/test_astyle.h +++ b/formatters/astyle/tests/test_astyle.h @@ -1,46 +1,46 @@ /* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 TEST_ASTYLE_H #define TEST_ASTYLE_H #include class AStyleFormatter; class TestAstyle : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void testFuzzyMatching(); void testTabMatching(); void renameVariable(); void overrideHelper(); void varTypeAssistant(); void testMultipleFormatters(); void testMacroFormatting(); void testContext(); void testTabIndentation(); void testForeach(); private: AStyleFormatter* m_formatter; }; #endif // TEST_ASTYLE_H diff --git a/formatters/customscript/customscript_plugin.h b/formatters/customscript/customscript_plugin.h index 14eb0619e9..6dcdb0a519 100644 --- a/formatters/customscript/customscript_plugin.h +++ b/formatters/customscript/customscript_plugin.h @@ -1,112 +1,112 @@ /* This file is part of KDevelop Copyright (C) 2008 Cédric Pasteur Copyright (C) 2011 David Nolden 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CUSTOMSCRIPTPLUGIN_H #define CUSTOMSCRIPTPLUGIN_H #include #include #include #include #include #include #include class CustomScriptPlugin : public KDevelop::IPlugin , public KDevelop::ISourceFormatter { Q_OBJECT Q_INTERFACES(KDevelop::ISourceFormatter) public: explicit CustomScriptPlugin(QObject* parent, const QVariantList& = QVariantList()); ~CustomScriptPlugin() override; QString name() override; QString caption() override; QString description() override; /** Formats using the current style. */ QString formatSource(const QString& text, const QUrl& url, const QMimeType& mime, const QString& leftContext, const QString& rightContext) override; QString formatSourceWithStyle(KDevelop::SourceFormatterStyle, const QString& text, const QUrl& url, const QMimeType& mime, const QString& leftContext = QString(), const QString& rightContext = QString()) override; /** \return A map of predefined styles (a key and a caption for each type) */ QList predefinedStyles() override; /** \return The widget to edit a style. */ KDevelop::SettingsWidget* editStyleWidget(const QMimeType& mime) override; /** \return The text used in the config dialog to preview the current style. */ QString previewText(const KDevelop::SourceFormatterStyle& style, const QMimeType& mime) override; /** \return The indentation of the currently selected style. */ Indentation indentation(const QUrl& url) override; private: QStringList computeIndentationFromSample(const QUrl& url); QStringList m_options; KDevelop::SourceFormatterStyle m_currentStyle; KDevelop::SourceFormatterStyle predefinedStyle(const QString& name); }; class CustomScriptPreferences : public KDevelop::SettingsWidget { Q_OBJECT public: CustomScriptPreferences(); void load (const KDevelop::SourceFormatterStyle& style) override; QString save() override; private: QVBoxLayout* m_vLayout; QLabel* m_captionLabel; QHBoxLayout* m_hLayout; QLabel* m_commandLabel; QLineEdit* m_commandEdit; QLabel* m_bottomLabel; QTimer* m_updateTimer; QPushButton* m_moreVariablesButton; KDevelop::SourceFormatterStyle m_style; -private slots: +private Q_SLOTS: void textEdited(const QString&) { m_updateTimer->start(1000); } void updateTimeout(); void moreVariablesClicked (bool); }; #endif // CUSTOMSCRIPTPLUGIN_H // kate: indent-mode cstyle; space-indent off; tab-width 4; diff --git a/kdeintegration/executeplasmoid/plasmoidexecutionconfig.h b/kdeintegration/executeplasmoid/plasmoidexecutionconfig.h index b18820d15a..e0496d0d41 100644 --- a/kdeintegration/executeplasmoid/plasmoidexecutionconfig.h +++ b/kdeintegration/executeplasmoid/plasmoidexecutionconfig.h @@ -1,99 +1,99 @@ /* This file is part of KDevelop Copyright 2009 Andreas Pakulat Copyright 2009 Niko Sams 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 SCRIPTAPPCONFIGTYPE_H #define SCRIPTAPPCONFIGTYPE_H #include #include #include #include #include "ui_plasmoidexecutionconfig.h" class ExecutePlasmoidPlugin; class PlasmoidExecutionConfig : public KDevelop::LaunchConfigurationPage, Ui::PlasmoidExecutionPage { Q_OBJECT public: explicit PlasmoidExecutionConfig( QWidget* parent ); void loadFromConfiguration( const KConfigGroup& cfg, KDevelop::IProject* project = nullptr ) override; void saveToConfiguration( KConfigGroup cfg, KDevelop::IProject* project = nullptr ) const override; QString title() const override; QIcon icon() const override; }; class PlasmoidLauncher : public KDevelop::ILauncher { public: explicit PlasmoidLauncher( ExecutePlasmoidPlugin* plugin ); QList< KDevelop::LaunchConfigurationPageFactory* > configPages() const override; QString description() const override; QString id() override; QString name() const override; KJob* start(const QString& launchMode, KDevelop::ILaunchConfiguration* cfg) override; virtual KJob* dependencies(KDevelop::ILaunchConfiguration* cfg); QStringList supportedModes() const override; static KJob* calculateDependencies(KDevelop::ILaunchConfiguration* cfg); private: ExecutePlasmoidPlugin* m_plugin; }; class PlasmoidPageFactory : public KDevelop::LaunchConfigurationPageFactory { public: PlasmoidPageFactory(); KDevelop::LaunchConfigurationPage* createWidget(QWidget* parent) override; }; /** * A specific configuration to start a launchable, this could be a native * compiled application, or some script file or byte-compiled file or something else * Provides access to the various configured information, as well as its type and a name */ class PlasmoidExecutionConfigType : public KDevelop::LaunchConfigurationType { Q_OBJECT public: PlasmoidExecutionConfigType(); ~PlasmoidExecutionConfigType() override; static QString typeId(); QString id() const override { return typeId(); } QString name() const override; QList configPages() const override; QIcon icon() const override; bool canLaunch( const QUrl &file ) const override; bool canLaunch(KDevelop::ProjectBaseItem* item) const override; void configureLaunchFromItem(KConfigGroup config, KDevelop::ProjectBaseItem* item) const override; void configureLaunchFromCmdLineArguments(KConfigGroup config, const QStringList& args) const override; QMenu* launcherSuggestions() override; private: QList factoryList; -public slots: +public Q_SLOTS: void suggestionTriggered(); }; #endif diff --git a/kdeintegration/executeplasmoid/plasmoidexecutionjob.h b/kdeintegration/executeplasmoid/plasmoidexecutionjob.h index da3aac0ddc..cd2bf60a60 100644 --- a/kdeintegration/executeplasmoid/plasmoidexecutionjob.h +++ b/kdeintegration/executeplasmoid/plasmoidexecutionjob.h @@ -1,58 +1,58 @@ /* This file is part of KDevelop Copyright 2009 Andreas Pakulat Copyright 2009 Niko Sams 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 PLASMOIDEXECUTIONJOB_H #define PLASMOIDEXECUTIONJOB_H #include #include class ExecutePlasmoidPlugin; namespace KDevelop { class ILaunchConfiguration; class OutputModel; class CommandExecutor; } class PlasmoidExecutionJob : public KDevelop::OutputJob { Q_OBJECT public: PlasmoidExecutionJob( ExecutePlasmoidPlugin* parent, KDevelop::ILaunchConfiguration* cfg ); void start() override; bool doKill() override; KDevelop::OutputModel* model(); static QString executable(KDevelop::ILaunchConfiguration* cfg); static QStringList arguments(KDevelop::ILaunchConfiguration* cfg); static QString workingDirectory(KDevelop::ILaunchConfiguration* cfg); -public slots: +public Q_SLOTS: void slotCompleted(int); void slotFailed(QProcess::ProcessError); private: KDevelop::CommandExecutor* m_process; }; #endif diff --git a/languages/clang/clangsupport.h b/languages/clang/clangsupport.h index 69aed2d5ef..1fa44a50b5 100644 --- a/languages/clang/clangsupport.h +++ b/languages/clang/clangsupport.h @@ -1,104 +1,104 @@ /* This file is part of KDevelop Copyright 2013 Olivier de Gaalon Copyright 2013 Milian Wolff Copyright 2014 Kevin Funk 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 KDEVCLANGSUPPORT_H #define KDEVCLANGSUPPORT_H #include #include #include #include class ClangIndex; class ClangRefactoring; namespace KDevelop { class IDocument; } namespace KTextEditor { class View; class Document; } class ClangSupport : public KDevelop::IPlugin, public KDevelop::ILanguageSupport, public KDevelop::IBuddyDocumentFinder { Q_OBJECT Q_INTERFACES(KDevelop::ILanguageSupport) public: explicit ClangSupport(QObject *parent, const QVariantList& args = QVariantList()); ~ClangSupport() override; /** Name Of the Language */ QString name() const override; /** Parsejob used by background parser to parse given url */ KDevelop::ParseJob *createParseJob(const KDevelop::IndexedString &url) override; /** the code highlighter */ KDevelop::ICodeHighlighting* codeHighlighting() const override; KDevelop::BasicRefactoring* refactoring() const override; KDevelop::ICreateClassHelper* createClassHelper() const override; void createActionsForMainWindow(Sublime::MainWindow* window, QString& xmlFile, KActionCollection& actions) override; KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context) override; KTextEditor::Range specialLanguageObjectRange(const QUrl &url, const KTextEditor::Cursor& position) override; QPair specialLanguageObjectJumpCursor(const QUrl &url, const KTextEditor::Cursor& position) override; QWidget* specialLanguageObjectNavigationWidget(const QUrl &url, const KTextEditor::Cursor& position) override; ClangIndex* index(); KDevelop::TopDUContext* standardContext(const QUrl &url, bool proxyContext = false) override; KDevelop::ConfigPage* configPage(int number, QWidget *parent) override; int configPages() const override; int suggestedReparseDelayForChange(KTextEditor::Document* doc, const KTextEditor::Range& changedRange, const QString& changedText, bool removal) const override; //BEGIN IBuddyDocumentFinder bool areBuddies(const QUrl &url1, const QUrl& url2) override; bool buddyOrder(const QUrl &url1, const QUrl& url2) override; QVector< QUrl > getPotentialBuddies(const QUrl &url) const override; //END IBuddyDocumentFinder -private slots: +private Q_SLOTS: void documentActivated(KDevelop::IDocument* doc); void disableKeywordCompletion(KTextEditor::View* view); void enableKeywordCompletion(KTextEditor::View* view); private: KDevelop::ICodeHighlighting *m_highlighting; ClangRefactoring *m_refactoring; QScopedPointer m_index; }; #endif diff --git a/languages/clang/codecompletion/context.cpp b/languages/clang/codecompletion/context.cpp index 2dcd664a17..c1fc729d77 100644 --- a/languages/clang/codecompletion/context.cpp +++ b/languages/clang/codecompletion/context.cpp @@ -1,1227 +1,1227 @@ /* * This file is part of KDevelop * Copyright 2014 Milian Wolff * Copyright 2015 Sergey Kalinichev * * 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 . */ #include "context.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../util/clangdebug.h" #include "../util/clangtypes.h" #include "../duchain/clangdiagnosticevaluator.h" #include "../duchain/parsesession.h" #include "../duchain/navigationwidget.h" #include "../clangsettings/clangsettingsmanager.h" #include #include #include #include using namespace KDevelop; namespace { /// Maximum return-type string length in completion items const int MAX_RETURN_TYPE_STRING_LENGTH = 20; /// Priority of code-completion results. NOTE: Keep in sync with Clang code base. enum CodeCompletionPriority { /// Priority for the next initialization in a constructor initializer list. CCP_NextInitializer = 7, /// Priority for an enumeration constant inside a switch whose condition is of the enumeration type. CCP_EnumInCase = 7, CCP_LocalDeclarationMatch = 8, CCP_DeclarationMatch = 12, CCP_LocalDeclarationSimiliar = 17, /// Priority for a send-to-super completion. CCP_SuperCompletion = 20, CCP_DeclarationSimiliar = 25, /// Priority for a declaration that is in the local scope. CCP_LocalDeclaration = 34, /// Priority for a member declaration found from the current method or member function. CCP_MemberDeclaration = 35, /// Priority for a language keyword (that isn't any of the other categories). CCP_Keyword = 40, /// Priority for a code pattern. CCP_CodePattern = 40, /// Priority for a non-type declaration. CCP_Declaration = 50, /// Priority for a type. CCP_Type = CCP_Declaration, /// Priority for a constant value (e.g., enumerator). CCP_Constant = 65, /// Priority for a preprocessor macro. CCP_Macro = 70, /// Priority for a nested-name-specifier. CCP_NestedNameSpecifier = 75, /// Priority for a result that isn't likely to be what the user wants, but is included for completeness. CCP_Unlikely = 80 }; /** * Common base class for Clang code completion items. */ template class CompletionItem : public Base { public: CompletionItem(const QString& display, const QString& prefix) : Base() , m_display(display) , m_prefix(prefix) { } ~CompletionItem() override = default; QVariant data(const QModelIndex& index, int role, const CodeCompletionModel* /*model*/) const override { if (role == Qt::DisplayRole) { if (index.column() == CodeCompletionModel::Prefix) { return m_prefix; } else if (index.column() == CodeCompletionModel::Name) { return m_display; } } return {}; } protected: QString m_display; QString m_prefix; }; class OverrideItem : public CompletionItem { public: OverrideItem(const QString& nameAndParams, const QString& returnType) : CompletionItem( nameAndParams, i18n("Override %1", returnType) ) , m_returnType(returnType) { } QVariant data(const QModelIndex& index, int role, const CodeCompletionModel* model) const override { if (role == Qt::DecorationRole) { if (index.column() == KTextEditor::CodeCompletionModel::Icon) { static const QIcon icon = QIcon::fromTheme(QStringLiteral("CTparents")); return icon; } } return CompletionItem::data(index, role, model); } void execute(KTextEditor::View* view, const KTextEditor::Range& word) override { view->document()->replaceText(word, m_returnType + QLatin1Char(' ') + m_display.replace(QRegularExpression(QStringLiteral("\\s*=\\s*0")), QString()) + QLatin1String(" override;")); } private: QString m_returnType; }; /** * Specialized completion item class for items which are represented by a Declaration */ class DeclarationItem : public CompletionItem { public: DeclarationItem(Declaration* dec, const QString& display, const QString& prefix, const QString& replacement) : CompletionItem(display, prefix) , m_replacement(replacement) { m_declaration = dec; } QVariant data(const QModelIndex& index, int role, const CodeCompletionModel* model) const override { if (role == CodeCompletionModel::MatchQuality && m_matchQuality) { return m_matchQuality; } auto ret = CompletionItem::data(index, role, model); if (ret.isValid()) { return ret; } return NormalDeclarationCompletionItem::data(index, role, model); } void execute(KTextEditor::View* view, const KTextEditor::Range& word) override { QString repl = m_replacement; DUChainReadLocker lock; if(!m_declaration){ return; } if(m_declaration->isFunctionDeclaration()) { auto doc = view->document(); // Function pointer? bool funcptr = false; const auto line = doc->line(word.start().line()); auto pos = word.end().column() - 1; while ( pos > 0 && (line.at(pos).isLetterOrNumber() || line.at(pos) == QLatin1Char(':')) ) { pos--; if ( line.at(pos) == QLatin1Char('&') ) { funcptr = true; break; } } if ( !funcptr && doc->characterAt(word.end()) != QLatin1Char('(') ) { repl += QLatin1String("()"); } view->document()->replaceText(word, repl); auto f = m_declaration->type(); if (f && f->indexedArgumentsSize()) { view->setCursorPosition(word.start() + KTextEditor::Cursor(0, repl.size() - 1)); } } else { view->document()->replaceText(word, repl); } } bool createsExpandingWidget() const override { return true; } QWidget* createExpandingWidget(const CodeCompletionModel* /*model*/) const override { return new ClangNavigationWidget(m_declaration, KDevelop::AbstractNavigationWidget::EmbeddableWidget); } int matchQuality() const { return m_matchQuality; } ///Sets match quality from 0 to 10. 10 is the best fit. void setMatchQuality(int value) { m_matchQuality = value; } void setInheritanceDepth(int depth) { m_inheritanceDepth = depth; } int argumentHintDepth() const override { return m_depth; } void setArgumentHintDepth(int depth) { m_depth = depth; } protected: int m_matchQuality = 0; int m_depth = 0; QString m_replacement; }; class ImplementsItem : public DeclarationItem { public: static QString replacement(const FuncImplementInfo& info) { QString replacement = info.templatePrefix; if (!info.isDestructor && !info.isConstructor) { replacement += info.returnType + QLatin1Char(' '); } replacement += info.prototype + QLatin1String("\n{\n}\n"); return replacement; } explicit ImplementsItem(const FuncImplementInfo& item) : DeclarationItem(item.declaration.data(), item.prototype, i18n("Implement %1", item.isConstructor ? QStringLiteral("") : item.isDestructor ? QStringLiteral("") : item.returnType), replacement(item) ) { } QVariant data(const QModelIndex& index, int role, const CodeCompletionModel* model) const override { if (index.column() == CodeCompletionModel::Arguments) { // our display string already contains the arguments return {}; } return DeclarationItem::data(index, role, model); } void execute(KTextEditor::View* view, const KTextEditor::Range& word) override { view->document()->replaceText(word, m_replacement); } }; class ArgumentHintItem : public DeclarationItem { public: struct CurrentArgumentRange { int start; int end; }; ArgumentHintItem(Declaration* decl, const QString& prefix, const QString& name, const QString& arguments, const CurrentArgumentRange& range) : DeclarationItem(decl, name, prefix, {}) , m_range(range) , m_arguments(arguments) {} QVariant data(const QModelIndex& index, int role, const CodeCompletionModel* model) const override { if (role == CodeCompletionModel::CustomHighlight && index.column() == CodeCompletionModel::Arguments && argumentHintDepth()) { QList highlighting; highlighting << QVariant(m_range.start); highlighting << QVariant(m_range.end); QTextCharFormat boldFormat; boldFormat.setFontWeight(QFont::Bold); highlighting << boldFormat; return highlighting; } if (role == CodeCompletionModel::HighlightingMethod && index.column() == CodeCompletionModel::Arguments && argumentHintDepth()) { return QVariant(CodeCompletionModel::CustomHighlighting); } if (index.column() == CodeCompletionModel::Arguments && !m_declaration) { return m_arguments; } return DeclarationItem::data(index, role, model); } private: CurrentArgumentRange m_range; QString m_arguments; }; /** * A minimalistic completion item for macros and such */ class SimpleItem : public CompletionItem { public: SimpleItem(const QString& display, const QString& prefix, const QString& replacement, const QIcon& icon = QIcon()) : CompletionItem(display, prefix) , m_replacement(replacement) , m_icon(icon) { } void execute(KTextEditor::View* view, const KTextEditor::Range& word) override { view->document()->replaceText(word, m_replacement); } QVariant data(const QModelIndex& index, int role, const CodeCompletionModel* model) const override { if (role == Qt::DecorationRole && index.column() == KTextEditor::CodeCompletionModel::Icon) { return m_icon; } return CompletionItem::data(index, role, model); } private: QString m_replacement; QIcon m_icon; }; /** * Return true in case position @p position represents a cursor inside a comment */ bool isInsideComment(CXTranslationUnit unit, CXFile file, const KTextEditor::Cursor& position) { if (!position.isValid()) { return false; } // TODO: This may get very slow for a large TU, investigate if we can improve this function auto begin = clang_getLocation(unit, file, 1, 1); auto end = clang_getLocation(unit, file, position.line() + 1, position.column() + 1); CXSourceRange range = clang_getRange(begin, end); // tokenize the whole range from the start until 'position' // if we detect a comment token at this position, return true const ClangTokens tokens(unit, range); for (CXToken token : tokens) { CXTokenKind tokenKind = clang_getTokenKind(token); if (tokenKind != CXToken_Comment) { continue; } auto range = ClangRange(clang_getTokenExtent(unit, token)); if (range.toRange().contains(position)) { return true; } } return false; } QString& elideStringRight(QString& str, int length) { if (str.size() > length + 3) { return str.replace(length, str.size() - length, QStringLiteral("...")); } return str; } /** * @return Value suited for @ref CodeCompletionModel::MatchQuality in the range [0.0, 10.0] (the higher the better) * * See http://clang.llvm.org/doxygen/CodeCompleteConsumer_8h_source.html for list of priorities * They (currently) have a range from [-3, 80] (the lower, the better) */ int codeCompletionPriorityToMatchQuality(unsigned int completionPriority) { return 10u - qBound(0u, completionPriority, 80u) / 8; } int adjustPriorityForType(const AbstractType::Ptr& type, int completionPriority) { const auto modifier = 4; if (type) { const auto whichType = type->whichType(); if (whichType == AbstractType::TypePointer || whichType == AbstractType::TypeReference) { // Clang considers all pointers as similar, this is not what we want. completionPriority += modifier; } else if (whichType == AbstractType::TypeStructure) { // Clang considers all classes as similar too... completionPriority += modifier; } else if (whichType == AbstractType::TypeDelayed) { completionPriority += modifier; } else if (whichType == AbstractType::TypeAlias) { auto aliasedType = type.cast(); return adjustPriorityForType(aliasedType ? aliasedType->type() : AbstractType::Ptr(), completionPriority); } else if (whichType == AbstractType::TypeFunction) { auto functionType = type.cast(); return adjustPriorityForType(functionType ? functionType->returnType() : AbstractType::Ptr(), completionPriority); } } else { completionPriority += modifier; } return completionPriority; } /// Adjusts priority for the @p decl int adjustPriorityForDeclaration(Declaration* decl, unsigned int completionPriority) { if(completionPriority < CCP_LocalDeclarationSimiliar || completionPriority > CCP_SuperCompletion){ return completionPriority; } return adjustPriorityForType(decl->abstractType(), completionPriority); } /** * @return Whether the declaration represented by identifier @p identifier qualifies as completion result * * For example, we don't want to offer SomeClass::SomeClass as completion item to the user * (otherwise we'd end up generating code such as 's.SomeClass();') */ bool isValidCompletionIdentifier(const QualifiedIdentifier& identifier) { const int count = identifier.count(); if (identifier.count() < 2) { return true; } const Identifier scope = identifier.at(count-2); const Identifier id = identifier.last(); if (scope == id) { return false; // is constructor } const QString idString = id.toString(); if (idString.startsWith(QLatin1Char('~')) && scope.toString() == idString.midRef(1)) { return false; // is destructor } return true; } /** * @return Whether the declaration represented by identifier @p identifier qualifies as "special" completion result * * "Special" completion results are items that are likely not regularly used. * * Examples: * - 'SomeClass::operator=(const SomeClass&)' */ bool isValidSpecialCompletionIdentifier(const QualifiedIdentifier& identifier) { if (identifier.count() < 2) { return false; } const Identifier id = identifier.last(); const QString idString = id.toString(); if (idString.startsWith(QLatin1String("operator="))) { return true; // is assignment operator } return false; } Declaration* findDeclaration(const QualifiedIdentifier& qid, const DUContextPointer& ctx, const CursorInRevision& position, QSet& handled) { PersistentSymbolTable::Declarations decl = PersistentSymbolTable::self().getDeclarations(qid); const auto top = ctx->topContext(); const auto& importedContexts = top->importedParentContexts(); for (auto it = decl.iterator(); it; ++it) { // if the context is not included, then this match is not correct for our consideration // this fixes issues where we used to include matches from files that did not have // anything to do with the current TU, e.g. the main from a different file or stuff like that // it also reduces the chance of us picking up a function of the same name from somewhere else // also, this makes sure the context has the correct language and we don't get confused by stuff // from other language plugins if (std::none_of(importedContexts.begin(), importedContexts.end(), [it] (const DUContext::Import& import) { return import.topContextIndex() == it->indexedTopContext().index(); })) { continue; } auto declaration = it->declaration(); if (!declaration) { // Mitigate problems such as: Cannot load a top-context from file "/home/kfunk/.cache/kdevduchain/kdevelop-{foo}/topcontexts/6085" // - the required language-support for handling ID 55 is probably not loaded qCWarning(KDEV_CLANG) << "Detected an invalid declaration for" << qid; continue; } if (declaration->kind() == Declaration::Instance && !declaration->isFunctionDeclaration()) { break; } if (!handled.contains(declaration)) { handled.insert(declaration); return declaration; } } const auto foundDeclarations = ctx->findDeclarations(qid, position); for (auto dec : foundDeclarations) { if (!handled.contains(dec)) { handled.insert(dec); return dec; } } return nullptr; } /// If any parent of this context is a class, the closest class declaration is returned, nullptr otherwise Declaration* classDeclarationForContext(const DUContextPointer& context, const CursorInRevision& position) { auto parent = context; while (parent) { if (parent->type() == DUContext::Class) { break; } if (auto owner = parent->owner()) { // Work-around for out-of-line methods. They have Helper context instead of Class context if (owner->context() && owner->context()->type() == DUContext::Helper) { auto qid = owner->qualifiedIdentifier(); qid.pop(); QSet tmp; auto decl = findDeclaration(qid, context, position, tmp); if (decl && decl->internalContext() && decl->internalContext()->type() == DUContext::Class) { parent = decl->internalContext(); break; } } } parent = parent->parentContext(); } return parent ? parent->owner() : nullptr; } class LookAheadItemMatcher { public: explicit LookAheadItemMatcher(const TopDUContextPointer& ctx) : m_topContext(ctx) , m_enabled(ClangSettingsManager::self()->codeCompletionSettings().lookAhead) {} /// Adds all local declarations for @p declaration into possible look-ahead items. void addDeclarations(Declaration* declaration) { if (!m_enabled) { return; } if (declaration->kind() != Declaration::Instance) { return; } auto type = typeForDeclaration(declaration); auto identifiedType = dynamic_cast(type.data()); if (!identifiedType) { return; } addDeclarationsForType(identifiedType, declaration); } /// Add type for matching. This type'll be used for filtering look-ahead items /// Only items with @p type will be returned through @sa matchedItems void addMatchedType(const IndexedType& type) { matchedTypes.insert(type); } /// @return look-ahead items that math given types. @sa addMatchedType QList matchedItems() { QList lookAheadItems; for (const auto& pair: possibleLookAheadDeclarations) { auto decl = pair.first; if (matchedTypes.contains(decl->indexedType())) { auto parent = pair.second; const QString access = parent->abstractType()->whichType() == AbstractType::TypePointer ? QStringLiteral("->") : QStringLiteral("."); const QString text = parent->identifier().toString() + access + decl->identifier().toString(); auto item = new DeclarationItem(decl, text, {}, text); item->setMatchQuality(8); lookAheadItems.append(CompletionTreeItemPointer(item)); } } return lookAheadItems; } private: AbstractType::Ptr typeForDeclaration(const Declaration* decl) { return TypeUtils::targetType(decl->abstractType(), m_topContext.data()); } void addDeclarationsForType(const IdentifiedType* identifiedType, Declaration* declaration) { if (auto typeDecl = identifiedType->declaration(m_topContext.data())) { if (dynamic_cast(typeDecl->logicalDeclaration(m_topContext.data()))) { if (!typeDecl->internalContext()) { return; } for (auto localDecl : typeDecl->internalContext()->localDeclarations()) { if(localDecl->identifier().isEmpty()){ continue; } if(auto classMember = dynamic_cast(localDecl)){ // TODO: Also add protected/private members if completion is inside this class context. if(classMember->accessPolicy() != Declaration::Public){ continue; } } if(!declaration->abstractType()){ continue; } if (declaration->abstractType()->whichType() == AbstractType::TypeIntegral) { if (auto integralType = declaration->abstractType().cast()) { if (integralType->dataType() == IntegralType::TypeVoid) { continue; } } } possibleLookAheadDeclarations.insert({localDecl, declaration}); } } } } // Declaration and it's context typedef QPair DeclarationContext; /// Types of declarations that look-ahead completion items can have QSet matchedTypes; // List of declarations that can be added to the Look Ahead group // Second declaration represents context QSet possibleLookAheadDeclarations; TopDUContextPointer m_topContext; bool m_enabled; }; struct MemberAccessReplacer : public QObject { Q_OBJECT public: enum Type { None, DotToArrow, ArrowToDot }; -public slots: +public Q_SLOTS: void replaceCurrentAccess(MemberAccessReplacer::Type type) { if (auto document = ICore::self()->documentController()->activeDocument()) { if (auto textDocument = document->textDocument()) { auto activeView = document->activeTextView(); if (!activeView) { return; } auto cursor = activeView->cursorPosition(); QString oldAccess, newAccess; if (type == ArrowToDot) { oldAccess = QStringLiteral("->"); newAccess = QStringLiteral("."); } else { oldAccess = QStringLiteral("."); newAccess = QStringLiteral("->"); } auto oldRange = KTextEditor::Range(cursor - KTextEditor::Cursor(0, oldAccess.length()), cursor); // This code needed for testReplaceMemberAccess test // Maybe we should do a similar thing for '->' to '.' direction, but this is not so important while (textDocument->text(oldRange) == QLatin1String(" ") && oldRange.start().column() >= 0) { oldRange = KTextEditor::Range({oldRange.start().line(), oldRange.start().column() - 1}, {oldRange.end().line(), oldRange.end().column() - 1}); } if (oldRange.start().column() >= 0 && textDocument->text(oldRange) == oldAccess) { textDocument->replaceText(oldRange, newAccess); } } } } }; static MemberAccessReplacer s_memberAccessReplacer; } Q_DECLARE_METATYPE(MemberAccessReplacer::Type) ClangCodeCompletionContext::ClangCodeCompletionContext(const DUContextPointer& context, const ParseSessionData::Ptr& sessionData, const QUrl& url, const KTextEditor::Cursor& position, const QString& text, const QString& followingText ) : CodeCompletionContext(context, text + followingText, CursorInRevision::castFromSimpleCursor(position), 0) , m_results(nullptr, clang_disposeCodeCompleteResults) , m_parseSessionData(sessionData) { qRegisterMetaType(); const QByteArray file = url.toLocalFile().toUtf8(); ParseSession session(m_parseSessionData); { const unsigned int completeOptions = clang_defaultCodeCompleteOptions(); CXUnsavedFile unsaved; unsaved.Filename = file.constData(); const QByteArray content = m_text.toUtf8(); unsaved.Contents = content.constData(); unsaved.Length = content.size() + 1; // + \0-byte m_results.reset(clang_codeCompleteAt(session.unit(), file.constData(), position.line() + 1, position.column() + 1, content.isEmpty() ? nullptr : &unsaved, content.isEmpty() ? 0 : 1, completeOptions)); if (!m_results) { qCWarning(KDEV_CLANG) << "Something went wrong during 'clang_codeCompleteAt' for file" << file; return; } auto numDiagnostics = clang_codeCompleteGetNumDiagnostics(m_results.get()); for (uint i = 0; i < numDiagnostics; i++) { auto diagnostic = clang_codeCompleteGetDiagnostic(m_results.get(), i); auto diagnosticType = ClangDiagnosticEvaluator::diagnosticType(diagnostic); clang_disposeDiagnostic(diagnostic); if (diagnosticType == ClangDiagnosticEvaluator::ReplaceWithArrowProblem || diagnosticType == ClangDiagnosticEvaluator::ReplaceWithDotProblem) { MemberAccessReplacer::Type replacementType; if (diagnosticType == ClangDiagnosticEvaluator::ReplaceWithDotProblem) { replacementType = MemberAccessReplacer::ArrowToDot; } else { replacementType = MemberAccessReplacer::DotToArrow; } QMetaObject::invokeMethod(&s_memberAccessReplacer, "replaceCurrentAccess", Qt::QueuedConnection, Q_ARG(MemberAccessReplacer::Type, replacementType)); m_valid = false; return; } } auto addMacros = ClangSettingsManager::self()->codeCompletionSettings().macros; if (!addMacros) { m_filters |= NoMacros; } } if (!m_results->NumResults) { const auto trimmedText = text.trimmed(); if (trimmedText.endsWith(QLatin1Char('.'))) { // TODO: This shouldn't be needed if Clang provided diagnostic. // But it doesn't always do it, so let's try to manually determine whether '.' is used instead of '->' m_text = trimmedText.left(trimmedText.size() - 1); m_text += QStringLiteral("->"); CXUnsavedFile unsaved; unsaved.Filename = file.constData(); const QByteArray content = m_text.toUtf8(); unsaved.Contents = content.constData(); unsaved.Length = content.size() + 1; m_results.reset(clang_codeCompleteAt(session.unit(), file.constData(), position.line() + 1, position.column() + 1 + 1, &unsaved, 1, clang_defaultCodeCompleteOptions())); if (m_results && m_results->NumResults) { QMetaObject::invokeMethod(&s_memberAccessReplacer, "replaceCurrentAccess", Qt::QueuedConnection, Q_ARG(MemberAccessReplacer::Type, MemberAccessReplacer::DotToArrow)); } m_valid = false; return; } } // check 'isValidPosition' after parsing the new content auto clangFile = session.file(file); if (!isValidPosition(session.unit(), clangFile)) { m_valid = false; return; } m_completionHelper.computeCompletions(session, clangFile, position); } ClangCodeCompletionContext::~ClangCodeCompletionContext() { } bool ClangCodeCompletionContext::isValidPosition(CXTranslationUnit unit, CXFile file) const { if (isInsideComment(unit, file, m_position.castToSimpleCursor())) { clangDebug() << "Invalid completion context: Inside comment"; return false; } return true; } QList ClangCodeCompletionContext::completionItems(bool& abort, bool /*fullCompletion*/) { if (!m_valid || !m_duContext || !m_results) { return {}; } const auto ctx = DUContextPointer(m_duContext->findContextAt(m_position)); /// Normal completion items, such as 'void Foo::foo()' QList items; /// Stuff like 'Foo& Foo::operator=(const Foo&)', etc. Not regularly used by our users. QList specialItems; /// Macros from the current context QList macros; /// Builtins reported by Clang QList builtin; QSet handled; LookAheadItemMatcher lookAheadMatcher(TopDUContextPointer(ctx->topContext())); // If ctx is/inside the Class context, this represents that context. const auto currentClassContext = classDeclarationForContext(ctx, m_position); clangDebug() << "Clang found" << m_results->NumResults << "completion results"; for (uint i = 0; i < m_results->NumResults; ++i) { if (abort) { return {}; } auto result = m_results->Results[i]; const auto availability = clang_getCompletionAvailability(result.CompletionString); if (availability == CXAvailability_NotAvailable) { continue; } const bool isMacroDefinition = result.CursorKind == CXCursor_MacroDefinition; if (isMacroDefinition && m_filters & NoMacros) { continue; } const bool isBuiltin = (result.CursorKind == CXCursor_NotImplemented); if (isBuiltin && m_filters & NoBuiltins) { continue; } const bool isDeclaration = !isMacroDefinition && !isBuiltin; if (isDeclaration && m_filters & NoDeclarations) { continue; } if (availability == CXAvailability_NotAccessible && (!isDeclaration || !currentClassContext)) { continue; } // the string that would be needed to type, usually the identifier of something. Also we use it as name for code completion declaration items. QString typed; // the return type of a function e.g. QString resultType; // the replacement text when an item gets executed QString replacement; QString arguments; ArgumentHintItem::CurrentArgumentRange argumentRange; //BEGIN function signature parsing // nesting depth of parentheses int parenDepth = 0; enum FunctionSignatureState { // not yet inside the function signature Before, // any token is part of the function signature now Inside, // finished parsing the function signature After }; // current state FunctionSignatureState signatureState = Before; //END function signature parsing std::function processChunks = [&] (CXCompletionString completionString) { const uint chunks = clang_getNumCompletionChunks(completionString); for (uint j = 0; j < chunks; ++j) { const auto kind = clang_getCompletionChunkKind(completionString, j); if (kind == CXCompletionChunk_Optional) { completionString = clang_getCompletionChunkCompletionString(completionString, j); if (completionString) { processChunks(completionString); } continue; } // We don't need function signature for declaration items, we can get it directly from the declaration. Also adding the function signature to the "display" would break the "Detailed completion" option. if (isDeclaration && !typed.isEmpty()) { #if CINDEX_VERSION_MINOR >= 30 // TODO: When parent context for CXCursor_OverloadCandidate is fixed remove this check if (result.CursorKind != CXCursor_OverloadCandidate) { break; } #else break; #endif } const QString string = ClangString(clang_getCompletionChunkText(completionString, j)).toString(); switch (kind) { case CXCompletionChunk_TypedText: typed = string; replacement = string; break; case CXCompletionChunk_ResultType: resultType = string; continue; case CXCompletionChunk_Placeholder: if (signatureState == Inside) { arguments += string; } continue; case CXCompletionChunk_LeftParen: if (signatureState == Before && !parenDepth) { signatureState = Inside; } parenDepth++; break; case CXCompletionChunk_RightParen: --parenDepth; if (signatureState == Inside && !parenDepth) { arguments += QLatin1Char(')'); signatureState = After; } break; case CXCompletionChunk_Text: #if CINDEX_VERSION_MINOR >= 30 if (result.CursorKind == CXCursor_OverloadCandidate) { typed += string; } #endif break; case CXCompletionChunk_CurrentParameter: argumentRange.start = arguments.size(); argumentRange.end = string.size(); break; default: break; } if (signatureState == Inside) { arguments += string; } } }; processChunks(result.CompletionString); #if CINDEX_VERSION_MINOR >= 30 // TODO: No closing paren if default parameters present if (result.CursorKind == CXCursor_OverloadCandidate && !arguments.endsWith(QLatin1Char(')'))) { arguments += QLatin1Char(')'); } #endif // ellide text to the right for overly long result types (templates especially) elideStringRight(resultType, MAX_RETURN_TYPE_STRING_LENGTH); if (isDeclaration) { const Identifier id(typed); QualifiedIdentifier qid; ClangString parent(clang_getCompletionParent(result.CompletionString, nullptr)); if (parent.c_str() != nullptr) { qid = QualifiedIdentifier(parent.toString()); } qid.push(id); if (!isValidCompletionIdentifier(qid)) { continue; } auto found = findDeclaration(qid, ctx, m_position, handled); CompletionTreeItemPointer item; if (found) { // TODO: Bug in Clang: protected members from base classes not accessible in derived classes. if (availability == CXAvailability_NotAccessible) { if (auto cl = dynamic_cast(found)) { if (cl->accessPolicy() != Declaration::Protected) { continue; } auto declarationClassContext = classDeclarationForContext(DUContextPointer(found->context()), m_position); uint steps = 10; auto inheriters = DUChainUtils::getInheriters(declarationClassContext, steps); if(!inheriters.contains(currentClassContext)){ continue; } } else { continue; } } auto declarationItem = new DeclarationItem(found, typed, resultType, replacement); const unsigned int completionPriority = adjustPriorityForDeclaration(found, clang_getCompletionPriority(result.CompletionString)); const bool bestMatch = completionPriority <= CCP_SuperCompletion; //don't set best match property for internal identifiers, also prefer declarations from current file if (bestMatch && !found->indexedIdentifier().identifier().toString().startsWith(QLatin1String("__")) ) { const int matchQuality = codeCompletionPriorityToMatchQuality(completionPriority); declarationItem->setMatchQuality(matchQuality); // TODO: LibClang missing API to determine expected code completion type. lookAheadMatcher.addMatchedType(found->indexedType()); } else { declarationItem->setInheritanceDepth(completionPriority); lookAheadMatcher.addDeclarations(found); } #if CINDEX_VERSION_MINOR >= 30 if (result.CursorKind == CXCursor_OverloadCandidate) { declarationItem->setArgumentHintDepth(1); } #endif item = declarationItem; } else { #if CINDEX_VERSION_MINOR >= 30 if (result.CursorKind == CXCursor_OverloadCandidate) { // TODO: No parent context for CXCursor_OverloadCandidate items, hence qid is broken -> no declaration found auto ahi = new ArgumentHintItem({}, resultType, typed, arguments, argumentRange); ahi->setArgumentHintDepth(1); item = ahi; } else { #endif // still, let's trust that Clang found something useful and put it into the completion result list clangDebug() << "Could not find declaration for" << qid; item = CompletionTreeItemPointer(new SimpleItem(typed + arguments, resultType, replacement)); #if CINDEX_VERSION_MINOR >= 30 } #endif } if (isValidSpecialCompletionIdentifier(qid)) { // If it's a special completion identifier e.g. "operator=(const&)" and we don't have a declaration for it, don't add it into completion list, as this item is completely useless and pollutes the test case. // This happens e.g. for "class A{}; a.|". At | we have "operator=(const A&)" as a special completion identifier without a declaration. if(item->declaration()){ specialItems.append(item); } } else { items.append(item); } continue; } if (result.CursorKind == CXCursor_MacroDefinition) { // TODO: grouping of macros and built-in stuff static const QIcon icon = QIcon::fromTheme(QStringLiteral("code-macro")); auto item = CompletionTreeItemPointer(new SimpleItem(typed + arguments, resultType, replacement, icon)); macros.append(item); } else if (result.CursorKind == CXCursor_NotImplemented) { auto item = CompletionTreeItemPointer(new SimpleItem(typed, resultType, replacement)); builtin.append(item); } } if (abort) { return {}; } addImplementationHelperItems(); addOverwritableItems(); eventuallyAddGroup(i18n("Special"), 700, specialItems); eventuallyAddGroup(i18n("Look-ahead Matches"), 800, lookAheadMatcher.matchedItems()); eventuallyAddGroup(i18n("Builtin"), 900, builtin); eventuallyAddGroup(i18n("Macros"), 1000, macros); return items; } void ClangCodeCompletionContext::eventuallyAddGroup(const QString& name, int priority, const QList& items) { if (items.isEmpty()) { return; } KDevelop::CompletionCustomGroupNode* node = new KDevelop::CompletionCustomGroupNode(name, priority); node->appendChildren(items); m_ungrouped << CompletionTreeElementPointer(node); } void ClangCodeCompletionContext::addOverwritableItems() { auto overrideList = m_completionHelper.overrides(); if (overrideList.isEmpty()) { return; } QList overrides; QList overridesAbstract; for (const auto& info : overrideList) { QStringList params; for (const auto& param : info.params) { params << param.type + QLatin1Char(' ') + param.id; } QString nameAndParams = info.name + QLatin1Char('(') + params.join(QStringLiteral(", ")) + QLatin1Char(')'); if(info.isConst) nameAndParams = nameAndParams + QLatin1String(" const"); if(info.isPureVirtual) nameAndParams = nameAndParams + QLatin1String(" = 0"); auto item = CompletionTreeItemPointer(new OverrideItem(nameAndParams, info.returnType)); if (info.isPureVirtual) overridesAbstract << item; else overrides << item; } eventuallyAddGroup(i18n("Abstract Override"), 0, overridesAbstract); eventuallyAddGroup(i18n("Virtual Override"), 0, overrides); } void ClangCodeCompletionContext::addImplementationHelperItems() { auto implementsList = m_completionHelper.implements(); if (implementsList.isEmpty()) { return; } QList implements; foreach(const auto& info, implementsList) { implements << CompletionTreeItemPointer(new ImplementsItem(info)); } eventuallyAddGroup(i18n("Implement Function"), 0, implements); } QList ClangCodeCompletionContext::ungroupedElements() { return m_ungrouped; } ClangCodeCompletionContext::ContextFilters ClangCodeCompletionContext::filters() const { return m_filters; } void ClangCodeCompletionContext::setFilters(const ClangCodeCompletionContext::ContextFilters& filters) { m_filters = filters; } #include "context.moc" diff --git a/languages/clang/codecompletion/model.cpp b/languages/clang/codecompletion/model.cpp index fd5d71a531..8d29177b67 100644 --- a/languages/clang/codecompletion/model.cpp +++ b/languages/clang/codecompletion/model.cpp @@ -1,216 +1,216 @@ /* * This file is part of KDevelop * Copyright 2014 Milian Wolff * * 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 . */ #include "model.h" #include "util/clangdebug.h" #include "context.h" #include "includepathcompletioncontext.h" #include "duchain/parsesession.h" #include "duchain/clangindex.h" #include "duchain/duchainutils.h" #include #include #include #include #include #include using namespace KDevelop; namespace { bool isSpaceOnly(const QString& string) { return std::find_if(string.begin(), string.end(), [] (const QChar c) { return !c.isSpace(); }) == string.end(); } bool includePathCompletionRequired(const QString& text) { const auto properties = IncludePathProperties::parseText(text); return properties.valid; } QSharedPointer createCompletionContext(const DUContextPointer& context, const ParseSessionData::Ptr& session, const QUrl& url, const KTextEditor::Cursor& position, const QString& text, const QString& followingText) { if (includePathCompletionRequired(text)) { return QSharedPointer::create(context, session, url, position, text); } else { return QSharedPointer::create(context, session, url, position, text, followingText); } } class ClangCodeCompletionWorker : public CodeCompletionWorker { Q_OBJECT public: ClangCodeCompletionWorker(ClangIndex* index, CodeCompletionModel* model) : CodeCompletionWorker(model) , m_index(index) {} ~ClangCodeCompletionWorker() override = default; -public slots: +public Q_SLOTS: void completionRequested(const QUrl &url, const KTextEditor::Cursor& position, const QString& text, const QString& followingText) { aborting() = false; DUChainReadLocker lock; if (aborting()) { failed(); return; } auto top = DUChainUtils::standardContextForUrl(url); if (!top) { qCWarning(KDEV_CLANG) << "No context found for" << url; return; } ParseSessionData::Ptr sessionData(ClangIntegration::DUChainUtils::findParseSessionData(top->url(), m_index->translationUnitForUrl(top->url()))); if (!sessionData) { // TODO: trigger reparse and re-request code completion qCWarning(KDEV_CLANG) << "No parse session / AST attached to context for url" << url; return; } if (aborting()) { failed(); return; } // We hold DUChain lock, and ask for ParseSession, but TUDUChain indirectly holds ParseSession lock. lock.unlock(); auto completionContext = ::createCompletionContext(DUContextPointer(top), sessionData, url, position, text, followingText); lock.lock(); if (aborting()) { failed(); return; } bool abort = false; // NOTE: cursor might be wrong here, but shouldn't matter much I hope... // when the document changed significantly, then the cache is off anyways and we don't get anything sensible // the position here is just a "optimization" to only search up to that position const auto& items = completionContext->completionItems(abort); if (aborting()) { failed(); return; } auto tree = computeGroups( items, {} ); if (aborting()) { failed(); return; } tree += completionContext->ungroupedElements(); foundDeclarations( tree, {} ); } private: ClangIndex* m_index; }; } ClangCodeCompletionModel::ClangCodeCompletionModel(ClangIndex* index, QObject* parent) : CodeCompletionModel(parent) , m_index(index) { qRegisterMetaType(); } ClangCodeCompletionModel::~ClangCodeCompletionModel() { } bool ClangCodeCompletionModel::shouldStartCompletion(KTextEditor::View* view, const QString& inserted, bool userInsertion, const KTextEditor::Cursor& position) { static const QString noCompletionAfter = QStringLiteral(";{}]) "); if (inserted.isEmpty() || isSpaceOnly(inserted)) { return false; } const auto lastChar = inserted.at(inserted.size() - 1); if (noCompletionAfter.contains(lastChar)) { return false; } // also show include path completion after dashes if (userInsertion && lastChar == QLatin1Char('-') && includePathCompletionRequired(view->document()->line(position.line()))) { return true; } return KDevelop::CodeCompletionModel::shouldStartCompletion(view, inserted, userInsertion, position); } KTextEditor::Range ClangCodeCompletionModel::completionRange(KTextEditor::View* view, const KTextEditor::Cursor& position) { auto range = KDevelop::CodeCompletionModel::completionRange(view, position); const auto includeProperties = IncludePathProperties::parseText(view->document()->line(position.line()), position.column()); if (includeProperties.valid && includeProperties.inputFrom != -1) { // expand include path range to include e.g. dashes range.setStart({position.line(), includeProperties.inputFrom}); } return range; } bool ClangCodeCompletionModel::shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range& range, const QString& currentCompletion) { const auto shouldAbort = KDevelop::CodeCompletionModel::shouldAbortCompletion(view, range, currentCompletion); if (shouldAbort && includePathCompletionRequired(view->document()->line(range.end().line()))) { // don't abort include path completion which can contain dashes return false; } return shouldAbort; } CodeCompletionWorker* ClangCodeCompletionModel::createCompletionWorker() { auto worker = new ClangCodeCompletionWorker(m_index, this); connect(this, &ClangCodeCompletionModel::requestCompletion, worker, &ClangCodeCompletionWorker::completionRequested); return worker; } void ClangCodeCompletionModel::completionInvokedInternal(KTextEditor::View* view, const KTextEditor::Range& range, CodeCompletionModel::InvocationType /*invocationType*/, const QUrl &url) { auto text = view->document()->text({0, 0, range.start().line(), range.start().column()}); auto followingText = view->document()->text({{range.start().line(), range.start().column()}, view->document()->documentEnd()}); emit requestCompletion(url, KTextEditor::Cursor(range.start()), text, followingText); } #include "model.moc" #include "moc_model.cpp" diff --git a/languages/clang/codecompletion/model.h b/languages/clang/codecompletion/model.h index 38b22909fb..8ab94a538e 100644 --- a/languages/clang/codecompletion/model.h +++ b/languages/clang/codecompletion/model.h @@ -1,59 +1,59 @@ /* * This file is part of KDevelop * Copyright 2014 Milian Wolff * * 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 CLANGCODECOMPLETIONMODEL_H #define CLANGCODECOMPLETIONMODEL_H #include #include "clangprivateexport.h" class ClangIndex; class KDEVCLANGPRIVATE_EXPORT ClangCodeCompletionModel : public KDevelop::CodeCompletionModel { Q_OBJECT public: explicit ClangCodeCompletionModel(ClangIndex* index, QObject* parent); ~ClangCodeCompletionModel() override; bool shouldStartCompletion(KTextEditor::View* view, const QString& inserted, bool userInsertion, const KTextEditor::Cursor& position) override; KTextEditor::Range completionRange(KTextEditor::View* view, const KTextEditor::Cursor& position) override; bool shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range& range, const QString& currentCompletion) override; -signals: +Q_SIGNALS: void requestCompletion(const QUrl &url, const KTextEditor::Cursor& cursor, const QString& text, const QString& followingText); protected: KDevelop::CodeCompletionWorker* createCompletionWorker() override; void completionInvokedInternal(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType invocationType, const QUrl &url) override; private: ClangIndex* m_index; }; #endif // CLANGCODECOMPLETIONMODEL_H diff --git a/languages/clang/codegen/adaptsignatureassistant.h b/languages/clang/codegen/adaptsignatureassistant.h index 08011ecacf..fc54eacaf7 100644 --- a/languages/clang/codegen/adaptsignatureassistant.h +++ b/languages/clang/codegen/adaptsignatureassistant.h @@ -1,75 +1,75 @@ /* Copyright 2009 David Nolden Copyright 2014 Kevin Funk This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 SIGNATUREASSISTANT_H #define SIGNATUREASSISTANT_H #include "adaptsignatureaction.h" #include "clangprivateexport.h" #include #include #include #include namespace KTextEditor { class View; } class KDEVCLANGPRIVATE_EXPORT AdaptSignatureAssistant : public KDevelop::StaticAssistant { Q_OBJECT public: explicit AdaptSignatureAssistant(KDevelop::ILanguageSupport* supportedLanguage); QString title() const override; void textChanged(KTextEditor::Document* doc, const KTextEditor::Range& invocationRange, const QString& removedText = QString()) override; bool isUseful() const override; KTextEditor::Range displayRange() const override; private: ///Compare @a newSignature to m_oldSignature and put differences in @a oldPositions ///@returns whether or not there are any differences bool getSignatureChanges(const Signature &newSignature, QList &oldPositions) const; ///Set default params in @a newSignature based on m_oldSignature's defaults and @a oldPositions void setDefaultParams(Signature &newSignature, const QList &oldPositions) const; ///@returns RenameActions for each parameter in newSignature that has been renamed QList getRenameActions(const Signature &newSignature, const QList &oldPositions) const; // If this is true, the user is editing on the definition side, // and the declaration should be updated bool m_editingDefinition = false; KDevelop::Identifier m_declarationName; KDevelop::DeclarationId m_otherSideId; KDevelop::ReferencedTopDUContext m_otherSideTopContext; KDevelop::DUContextPointer m_otherSideContext; KTextEditor::Cursor m_lastEditPosition; //old signature of the _other_side Signature m_oldSignature; QPointer m_document; QPointer m_view; -private slots: +private Q_SLOTS: void updateReady(const KDevelop::IndexedString& document, const KDevelop::ReferencedTopDUContext& context) override; void reset(); }; #endif // SIGNATUREASSISTANT_H diff --git a/languages/clang/codegen/clangrefactoring.h b/languages/clang/codegen/clangrefactoring.h index b7f0aef247..6f22e511f5 100644 --- a/languages/clang/codegen/clangrefactoring.h +++ b/languages/clang/codegen/clangrefactoring.h @@ -1,63 +1,63 @@ /* * This file is part of KDevelop * * Copyright 2015 Sergey Kalinichev * * 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 SIMPLEREFACTORING_H #define SIMPLEREFACTORING_H #include "clangprivateexport.h" #include class TestRefactoring; namespace KDevelop { class Context; class ContextMenuExtension; class Declaration; } class KDEVCLANGPRIVATE_EXPORT ClangRefactoring : public KDevelop::BasicRefactoring { Q_OBJECT public: explicit ClangRefactoring(QObject* parent = nullptr); void fillContextMenu(KDevelop::ContextMenuExtension& extension, KDevelop::Context* context) override; QString moveIntoSource(const KDevelop::IndexedDeclaration& iDecl); -public slots: +public Q_SLOTS: void executeMoveIntoSourceAction(); protected: KDevelop::DocumentChangeSet::ChangeResult applyChangesToDeclarations(const QString& oldName, const QString& newName, KDevelop::DocumentChangeSet& changes, const QList& declarations) override; private: friend TestRefactoring; bool validCandidateToMoveIntoSource(KDevelop::Declaration* decl); }; #endif diff --git a/languages/clang/tests/bench_codecompletion.h b/languages/clang/tests/bench_codecompletion.h index 5596de1b0a..1e604985cb 100644 --- a/languages/clang/tests/bench_codecompletion.h +++ b/languages/clang/tests/bench_codecompletion.h @@ -1,46 +1,46 @@ /* * Copyright 2016 Milian Wolff * * 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 BENCHCODECOMPLETION_H #define BENCHCODECOMPLETION_H #include "codecompletiontestbase.h" class ClangIndex; class ClangCodeCompletionModel; class BenchCodeCompletion : public CodeCompletionTestBase { Q_OBJECT public: BenchCodeCompletion(); ~BenchCodeCompletion() override; -private slots: +private Q_SLOTS: void benchCodeCompletion_data(); void benchCodeCompletion(); private: QScopedPointer m_index; ClangCodeCompletionModel* m_model; }; #endif // BENCHCODECOMPLETION_H diff --git a/languages/clang/tests/codecompletiontestbase.h b/languages/clang/tests/codecompletiontestbase.h index 0a7485437a..7bd6251a41 100644 --- a/languages/clang/tests/codecompletiontestbase.h +++ b/languages/clang/tests/codecompletiontestbase.h @@ -1,60 +1,60 @@ /* * Copyright 2014 David Stevens * Copyright 2014 Kevin Funk * Copyright 2016 Milian Wolff * * 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 CODECOMPLETIONTESTBASE_H #define CODECOMPLETIONTESTBASE_H #include #include namespace KTextEditor { class View; } namespace KDevelop { class TestProjectController; }; struct DeleteDocument { void operator()(KTextEditor::View* view) const; }; class CodeCompletionTestBase : public QObject { Q_OBJECT public: std::unique_ptr createView(const QUrl& url, QObject* parent) const; -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void init(); protected: KDevelop::TestProjectController* m_projectController; }; #endif // CODECOMPLETIONTESTBASE_H diff --git a/languages/clang/tests/test_assistants.h b/languages/clang/tests/test_assistants.h index 88cd6794ea..1235de5502 100644 --- a/languages/clang/tests/test_assistants.h +++ b/languages/clang/tests/test_assistants.h @@ -1,44 +1,44 @@ /* This file is part of KDevelop Copyright 2012 Olivier de Gaalon 2014 David Stevens This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 TESTASSISTANTS_H #define TESTASSISTANTS_H #include class TestAssistants : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testRenameAssistant_data(); void testRenameAssistant(); void testRenameAssistantUndoRename(); void testSignatureAssistant_data(); void testSignatureAssistant(); void testUnknownDeclarationAssistant_data(); void testUnknownDeclarationAssistant(); void testMoveIntoSource_data(); void testMoveIntoSource(); }; #endif diff --git a/languages/clang/tests/test_buddies.h b/languages/clang/tests/test_buddies.h index f7a8347d75..186e4cb846 100644 --- a/languages/clang/tests/test_buddies.h +++ b/languages/clang/tests/test_buddies.h @@ -1,74 +1,74 @@ /*************************************************************************** * Copyright 2011 Martin Heide * * Copyright 2012 Milian Wolff * * * * This program 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 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 Library 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 SHELLBUDDYTEST_H #define SHELLBUDDYTEST_H #include #include namespace Sublime { class View; class Controller; } namespace KDevelop { class IUiController; class IDocumentController; } using namespace KDevelop; class TestBuddies: public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); void testDeclarationDefinitionOrder(); void testMultiDotFilenames(); void testActivation(); void testDisableBuddies(); void testDisableOpenAfterCurrent(); void testDisableAll(); void testMultipleFolders(); void testSplitViewBuddies(); void testDUChainBuddy(); void testDUChainBuddyVote(); private: void verifyFilename(Sublime::View *view, const QString& endOfFilename); void createFile(const QDir& dir, const QString& filename); void enableBuddies(bool enable = true); void enableOpenAfterCurrent(bool enable = true); IDocumentController *m_documentController; IUiController *m_uiController; Sublime::Controller *m_sublimeController; }; #endif diff --git a/languages/clang/tests/test_clangutils.h b/languages/clang/tests/test_clangutils.h index b30e287e50..23e9f0aa74 100644 --- a/languages/clang/tests/test_clangutils.h +++ b/languages/clang/tests/test_clangutils.h @@ -1,43 +1,43 @@ /* * Copyright 2014 Kevin Funk * * 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 TESTCLANGUTILS_H #define TESTCLANGUTILS_H #include class TestClangUtils : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testGetScope(); void testGetScope_data(); void testTemplateArgumentTypes(); void testTemplateArgumentTypes_data(); void testGetRawContents(); void testGetRawContents_data(); void testRangeForIncludePathSpec(); }; #endif // TESTCLANGUTILS_H diff --git a/languages/clang/tests/test_codecompletion.h b/languages/clang/tests/test_codecompletion.h index b1cb9eab74..58e646980e 100644 --- a/languages/clang/tests/test_codecompletion.h +++ b/languages/clang/tests/test_codecompletion.h @@ -1,63 +1,63 @@ /* * Copyright 2014 David Stevens * Copyright 2014 Kevin Funk * * 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 TESTCODECOMPLETION_H #define TESTCODECOMPLETION_H #include "codecompletiontestbase.h" class TestCodeCompletion : public CodeCompletionTestBase { Q_OBJECT -private slots: +private Q_SLOTS: void testIncludePathCompletion_data(); void testIncludePathCompletion(); void testIncludePathCompletionLocal(); void testClangCodeCompletion(); void testClangCodeCompletion_data(); void testVirtualOverride(); void testVirtualOverride_data(); void testImplement(); void testImplement_data(); void testImplementOtherFile(); void testImplementAfterEdit(); void testInvalidCompletions(); void testInvalidCompletions_data(); void testCompletionPriority(); void testCompletionPriority_data(); void testReplaceMemberAccess(); void testReplaceMemberAccess_data(); void testArgumentHintCompletion(); void testArgumentHintCompletion_data(); void testOverloadedFunctions(); void testVariableScope(); void testArgumentHintCompletionDefaultParameters(); void testCompleteFunction_data(); void testCompleteFunction(); void testIgnoreGccBuiltins(); }; #endif // TESTCODECOMPLETION_H diff --git a/languages/clang/tests/test_duchain.h b/languages/clang/tests/test_duchain.h index 013058c42f..c05dbbe0e5 100644 --- a/languages/clang/tests/test_duchain.h +++ b/languages/clang/tests/test_duchain.h @@ -1,109 +1,109 @@ /* * Copyright 2014 Milian Wolff * * 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 DUCHAINTEST_H #define DUCHAINTEST_H #include class TestEnvironmentProvider; namespace KDevelop { class TestProjectController; } class TestDUChain : public QObject { Q_OBJECT public: ~TestDUChain() override; -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); void testComments(); void testComments_data(); void testElaboratedType(); void testElaboratedType_data(); void testInclude(); void testMissingInclude(); void testIncludeLocking(); void testReparse(); void testReparseError(); void testTemplate(); void testNamespace(); void testAutoTypeDeduction(); void testTypeDeductionInTemplateInstantiation(); void testVirtualMemberFunction(); void testBaseClasses(); void testReparseBaseClasses(); void testReparseBaseClassesTemplates(); void testGetInheriters(); void testGetInheriters_data(); void testGlobalFunctionDeclaration(); void testFunctionDefinitionVsDeclaration(); void testEnsureNoDoubleVisit(); void testReparseWithAllDeclarationsContextsAndUses(); void testReparseOnDocumentActivated(); void testParsingEnvironment(); void testSystemIncludes(); void testReparseInclude(); void testReparseChangeEnvironment(); void testMacrosRanges(); void testMacroUses(); void testHeaderParsingOrder1(); void testHeaderParsingOrder2(); void testMacroDependentHeader(); void testNestedImports(); void testEnvironmentWithDifferentOrderOfElements(); void testReparseMacro(); void testMultiLineMacroRanges(); void testNestedMacroRanges(); void testGotoStatement(); void testRangesOfOperatorsInsideMacro(); void testActiveDocumentHasASTAttached(); void testActiveDocumentsGetBestPriority(); void testUsesCreatedForDeclarations(); void testReparseIncludeGuard(); void testExternC(); void testReparseUnchanged_data(); void testReparseUnchanged(); void testTypeAliasTemplate(); void testDeclarationsInsideMacroExpansion(); void testForwardTemplateTypeParameterContext(); void testTemplateFunctionParameterName(); void testFriendDeclaration(); void testVariadicTemplateArguments(); void benchDUChainBuilder(); void testGccCompatibility(); void testQtIntegration(); private: QScopedPointer m_provider; KDevelop::TestProjectController* m_projectController; }; #endif // DUCHAINTEST_H diff --git a/languages/clang/tests/test_duchainutils.h b/languages/clang/tests/test_duchainutils.h index c5701202fb..871b9e5026 100644 --- a/languages/clang/tests/test_duchainutils.h +++ b/languages/clang/tests/test_duchainutils.h @@ -1,38 +1,38 @@ /* * Copyright 2014 Kevin Funk * * 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 TESTDUCHAINUTILS_H #define TESTDUCHAINUTILS_H #include class TestDUChainUtils : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void getFunctionSignatureRange(); void getFunctionSignatureRange_data(); }; #endif // TESTDUCHAINUTILS_H diff --git a/languages/clang/tests/test_files.h b/languages/clang/tests/test_files.h index 411401829c..83e9ba1641 100644 --- a/languages/clang/tests/test_files.h +++ b/languages/clang/tests/test_files.h @@ -1,35 +1,35 @@ /************************************************************************************* * Copyright (C) 2013 by Milian Wolff * * Copyright (C) 2013 Olivier de Gaalon * * * * 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 TEST_FILES_H #define TEST_FILES_H #include class TestFiles : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testFiles_data(); void testFiles(); }; #endif // TEST_FILES_H diff --git a/languages/clang/tests/test_problems.h b/languages/clang/tests/test_problems.h index 91d3334c1b..29b28f9627 100644 --- a/languages/clang/tests/test_problems.h +++ b/languages/clang/tests/test_problems.h @@ -1,54 +1,54 @@ /************************************************************************************* * Copyright (C) Kevin Funk * * * * 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 TEST_PROBLEMS_H #define TEST_PROBLEMS_H #include #include class TestProblems : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testNoProblems(); void testBasicProblems(); void testBasicRangeSupport(); void testChildDiagnostics(); void testRanges_data(); void testRanges(); void testProblemsForIncludedFiles(); void testFixits(); void testFixits_data(); void testTodoProblems(); void testTodoProblems_data(); void testMissingInclude(); void testMissingInclude_data(); void testSeverity(); void testSeverity_data(); }; #endif // TEST_PROBLEMS_H diff --git a/languages/clang/tests/test_refactoring.h b/languages/clang/tests/test_refactoring.h index 0287ae174f..c9805609b8 100644 --- a/languages/clang/tests/test_refactoring.h +++ b/languages/clang/tests/test_refactoring.h @@ -1,49 +1,49 @@ /* * Copyright 2017 Kevin Funk * * 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 TEST_REFACTORING_H #define TEST_REFACTORING_H #include namespace KDevelop { class TestProjectController; } class TestRefactoring : public QObject { Q_OBJECT public: ~TestRefactoring() override; -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); void testClassRename(); private: KDevelop::TestProjectController* m_projectController; }; #endif // TEST_REFACTORING_H diff --git a/languages/plugins/custom-definesandincludes/compilerprovider/tests/test_compilerprovider.h b/languages/plugins/custom-definesandincludes/compilerprovider/tests/test_compilerprovider.h index 7472236720..1ca6978ed8 100644 --- a/languages/plugins/custom-definesandincludes/compilerprovider/tests/test_compilerprovider.h +++ b/languages/plugins/custom-definesandincludes/compilerprovider/tests/test_compilerprovider.h @@ -1,42 +1,42 @@ /* * This file is part of KDevelop * * Copyright 2014 Sergey Kalinichev * * 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 TESTCOMPILERPROVIDER_H #define TESTCOMPILERPROVIDER_H #include class TestCompilerProvider : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testRegisterCompiler(); void testCompilerIncludesAndDefines(); void testStorageBackwardsCompatible(); void testCompilerIncludesAndDefinesForProject(); void testStorageNewSystem(); }; #endif diff --git a/languages/plugins/custom-definesandincludes/compilerprovider/widget/compilersmodel.h b/languages/plugins/custom-definesandincludes/compilerprovider/widget/compilersmodel.h index 6c2e1e34aa..c406a55f89 100644 --- a/languages/plugins/custom-definesandincludes/compilerprovider/widget/compilersmodel.h +++ b/languages/plugins/custom-definesandincludes/compilerprovider/widget/compilersmodel.h @@ -1,69 +1,69 @@ /* * This file is part of KDevelop * * Copyright 2014 Sergey Kalinichev * * 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 COMPILERMODEL_H #define COMPILERMODEL_H #include #include #include "../compilerprovider/icompiler.h" class TreeItem; class CompilersModel : public QAbstractItemModel { Q_OBJECT public: enum SpecialRole { CompilerDataRole = Qt::UserRole + 1 }; explicit CompilersModel( QObject* parent = nullptr ); ~CompilersModel() override; void setCompilers( const QVector& compilers ); QVector compilers() const; QModelIndex addCompiler(const CompilerPointer& compiler); void updateCompiler(const QItemSelection& compiler); -signals: +Q_SIGNALS: /// emitted whenever new compiler added or existing one modified/deleted. void compilerChanged(); public: QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override; int rowCount( const QModelIndex& parent = QModelIndex() ) const override; Qt::ItemFlags flags( const QModelIndex& index ) const override; int columnCount( const QModelIndex& parent = QModelIndex() ) const override; QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex& child) const override; bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; private: TreeItem* m_rootItem; }; #endif // COMPILERMODEL_H diff --git a/languages/plugins/custom-definesandincludes/compilerprovider/widget/compilerswidget.h b/languages/plugins/custom-definesandincludes/compilerprovider/widget/compilerswidget.h index 2631056918..27bb48f388 100644 --- a/languages/plugins/custom-definesandincludes/compilerprovider/widget/compilerswidget.h +++ b/languages/plugins/custom-definesandincludes/compilerprovider/widget/compilerswidget.h @@ -1,83 +1,83 @@ /* * This file is part of KDevelop * * Copyright 2014 Sergey Kalinichev * * 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 COMPILERWIDGET_H #define COMPILERWIDGET_H #include #include #include #include "../compilerprovider/icompiler.h" namespace Ui { class CompilersWidget; } class CompilersModel; class QMenu; class QSignalMapper; class CompilersWidget : public KDevelop::ConfigPage { Q_OBJECT public: explicit CompilersWidget(QWidget* parent = nullptr); ~CompilersWidget() override; void setCompilers(const QVector& compilers); QVector compilers() const; void clear(); QString name() const override; QString fullName() const override; QIcon icon() const override; KDevelop::ConfigPage::ConfigPageType configPageType() const override; void apply() override; void reset() override; void defaults() override; -private slots: +private Q_SLOTS: void deleteCompiler(); void addCompiler(const QString& factoryName); void compilerSelected(const QModelIndex& index); void compilerEdited(); -signals: +Q_SIGNALS: void compilerChanged(); private: void enableItems(bool enable); QScopedPointer m_ui; CompilersModel* m_compilersModel; QMenu *m_addMenu; QSignalMapper *m_mapper; }; #endif diff --git a/languages/plugins/custom-definesandincludes/kcm_widget/defineswidget.h b/languages/plugins/custom-definesandincludes/kcm_widget/defineswidget.h index 63f197aeb9..af2a26816d 100644 --- a/languages/plugins/custom-definesandincludes/kcm_widget/defineswidget.h +++ b/languages/plugins/custom-definesandincludes/kcm_widget/defineswidget.h @@ -1,58 +1,58 @@ /************************************************************************ * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef KDEVELOP_PROJECTMANAGERS_CUSTOM_BUILDSYSTEM_DEFINESWIDGET_H #define KDEVELOP_PROJECTMANAGERS_CUSTOM_BUILDSYSTEM_DEFINESWIDGET_H #include #include "idefinesandincludesmanager.h" namespace Ui { class DefinesWidget; } namespace KDevelop { class IProject; } class DefinesModel; class DefinesWidget : public QWidget { Q_OBJECT public: explicit DefinesWidget( QWidget* parent = nullptr ); void setDefines( const KDevelop::Defines& defines ); void clear(); -signals: +Q_SIGNALS: void definesChanged( const KDevelop::Defines& defines ); -private slots: +private Q_SLOTS: // Forward defines model changes void definesChanged(); // Handle Del key in defines list void deleteDefine(); private: Ui::DefinesWidget* ui; DefinesModel* definesModel; }; #endif diff --git a/languages/plugins/custom-definesandincludes/kcm_widget/includeswidget.h b/languages/plugins/custom-definesandincludes/kcm_widget/includeswidget.h index cb59494ea0..f37a23fd8b 100644 --- a/languages/plugins/custom-definesandincludes/kcm_widget/includeswidget.h +++ b/languages/plugins/custom-definesandincludes/kcm_widget/includeswidget.h @@ -1,68 +1,68 @@ /************************************************************************ * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef KDEVELOP_PROJECTMANAGERS_CUSTOM_BUILDSYSTEM_INCLUDESWIDGET_H #define KDEVELOP_PROJECTMANAGERS_CUSTOM_BUILDSYSTEM_INCLUDESWIDGET_H #include namespace Ui { class IncludesWidget; } namespace KDevelop { class IProject; } class QUrl; class ProjectPathsModel; class IncludesModel; class IncludesWidget : public QWidget { Q_OBJECT public: explicit IncludesWidget( QWidget* parent = nullptr ); void setProject(KDevelop::IProject* w_project); void setIncludes( const QStringList& ); void clear(); -signals: +Q_SIGNALS: void includesChanged( const QStringList& ); -private slots: +private Q_SLOTS: // Handling of include-path url-requester, add and remove buttons void includePathSelected( const QModelIndex& selected ); void includePathEdited(); void includePathUrlSelected(const QUrl&); void addIncludePath(); // Handles action and also Del-key in list void deleteIncludePath(); void checkIfIncludePathExist(); // Forward includes model changes void includesChanged(); private: Ui::IncludesWidget* ui; IncludesModel* includesModel; QString makeIncludeDirAbsolute( const QUrl &url ) const; // Enables/Disables widgets based on UI state/selection void updateEnablements(); void updatePathsModel( const QVariant& newData, int role ); }; #endif diff --git a/languages/plugins/custom-definesandincludes/kcm_widget/parserwidget.h b/languages/plugins/custom-definesandincludes/kcm_widget/parserwidget.h index cb8c8fc016..078975310e 100644 --- a/languages/plugins/custom-definesandincludes/kcm_widget/parserwidget.h +++ b/languages/plugins/custom-definesandincludes/kcm_widget/parserwidget.h @@ -1,67 +1,67 @@ /* * This file is part of KDevelop * * Copyright 2015 Sergey Kalinichev * * 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 PARSERWIDGET_H #define PARSERWIDGET_H #include #include namespace Ui { class ParserWidget; } namespace KDevelop { class IProject; } struct ParserArguments; class ParserWidget : public QWidget { Q_OBJECT public: explicit ParserWidget(QWidget* parent); ~ParserWidget() override; void setParserArguments(const ParserArguments& arguments); ParserArguments parserArguments() const; -signals: +Q_SIGNALS: void changed(); -private slots: +private Q_SLOTS: void textEdited(); void languageStandardChangedC(const QString& standard); void languageStandardChangedCpp(const QString& standard); void languageStandardChangedOpenCl(const QString& standard); void languageStandardChangedCuda(const QString& standard); void updateEnablements(); private: QScopedPointer m_ui; }; #endif // PARSERWIDGET_H diff --git a/languages/plugins/custom-definesandincludes/kcm_widget/projectpathswidget.h b/languages/plugins/custom-definesandincludes/kcm_widget/projectpathswidget.h index 15e54e3dcf..c897076bca 100644 --- a/languages/plugins/custom-definesandincludes/kcm_widget/projectpathswidget.h +++ b/languages/plugins/custom-definesandincludes/kcm_widget/projectpathswidget.h @@ -1,83 +1,83 @@ /************************************************************************ * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef KDEVELOP_PROJECTMANAGERS_CUSTOM_BUILDSYSTEM_PROJECTPATHSWIDGET_H #define KDEVELOP_PROJECTMANAGERS_CUSTOM_BUILDSYSTEM_PROJECTPATHSWIDGET_H #include #include "../compilerprovider/icompiler.h" #include "../compilerprovider/settingsmanager.h" namespace Ui { class ProjectPathsWidget; } namespace KDevelop { class IProject; } class ProjectPathsModel; class ProjectPathsWidget : public QWidget { Q_OBJECT public: explicit ProjectPathsWidget( QWidget* parent = nullptr ); void setProject(KDevelop::IProject* w_project); void setPaths( const QVector& ); QVector paths() const; void clear(); -signals: +Q_SIGNALS: void changed(); private: void setCurrentCompiler(const QString& name); CompilerPointer currentCompiler() const; -private slots: +private Q_SLOTS: // Handling of project-path combobox, add and remove buttons void projectPathSelected( int index ); void addProjectPath(); void deleteProjectPath(); void batchEdit(); void tabChanged(int); void changeCompilerForPath(); // Forward includes model changes into the pathsModel void includesChanged( const QStringList& includes ); // Forward defines model changes into the pathsModel void definesChanged( const KDevelop::Defines& defines ); void parserArgumentsChanged(); private: Ui::ProjectPathsWidget* ui; ProjectPathsModel* pathsModel; // Enables/Disables widgets based on UI state/selection void updateEnablements(); void updatePathsModel( const QVariant& newData, int role ); }; #endif diff --git a/languages/plugins/custom-definesandincludes/tests/test_definesandincludes.h b/languages/plugins/custom-definesandincludes/tests/test_definesandincludes.h index 1107233d37..f7d6cb2207 100644 --- a/languages/plugins/custom-definesandincludes/tests/test_definesandincludes.h +++ b/languages/plugins/custom-definesandincludes/tests/test_definesandincludes.h @@ -1,42 +1,42 @@ /************************************************************************ * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef TEST_DEFINESANDINCLUDES_H #define TEST_DEFINESANDINCLUDES_H #include namespace KDevelop { class TestCore; } class TestDefinesAndIncludes : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void cleanup(); void loadSimpleProject(); void loadMultiPathProject(); void testNoProjectIncludeDirectories(); void testEmptyProject(); }; #endif diff --git a/languages/qmljs/codecompletion/tests/test_qmljscompletion.h b/languages/qmljs/codecompletion/tests/test_qmljscompletion.h index 2761d285ac..49f682a1fb 100644 --- a/languages/qmljs/codecompletion/tests/test_qmljscompletion.h +++ b/languages/qmljs/codecompletion/tests/test_qmljscompletion.h @@ -1,41 +1,41 @@ /***************************************************************************** * Copyright 2011-2012 Sven Brauch * * * * 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, see * *****************************************************************************/ #ifndef QMLCOMPLETIONTEST_H #define QMLCOMPLETIONTEST_H #include namespace QmlJS { class QmlCompletionTest : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testContainsDeclaration(); void testContainsDeclaration_data(); void testDoesNotContainDeclaration(); void testDoesNotContainDeclaration_data(); void testContainsText(); void testContainsText_data(); }; } #endif diff --git a/languages/qmljs/duchain/tests/test_qmljscontexts.h b/languages/qmljs/duchain/tests/test_qmljscontexts.h index 28b619419d..2055e24b26 100644 --- a/languages/qmljs/duchain/tests/test_qmljscontexts.h +++ b/languages/qmljs/duchain/tests/test_qmljscontexts.h @@ -1,40 +1,40 @@ /* * This file is part of KDevelop * Copyright 2013 Milian Wolff * * 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 TESTCONTEXTS_H #define TESTCONTEXTS_H #include class TestContexts : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testFunctionContext(); void testFunctionContext_data(); void testQMLContext(); }; #endif // TESTCONTEXTS_H diff --git a/languages/qmljs/duchain/tests/test_qmljsdeclarations.h b/languages/qmljs/duchain/tests/test_qmljsdeclarations.h index ce231a5bf0..e832d984c4 100644 --- a/languages/qmljs/duchain/tests/test_qmljsdeclarations.h +++ b/languages/qmljs/duchain/tests/test_qmljsdeclarations.h @@ -1,43 +1,43 @@ /* * This file is part of KDevelop * Copyright 2013 Milian Wolff * * 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 TESTCONTEXTS_H #define TESTCONTEXTS_H #include class TestDeclarations : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testJSProblems(); void testFunction(); void testQMLId(); void testProperty(); void testQMLtypesImportPaths(); }; #endif // TESTCONTEXTS_H diff --git a/languages/qmljs/libs/qmljs/qmljsmodelmanagerinterface.h b/languages/qmljs/libs/qmljs/qmljsmodelmanagerinterface.h index 75fa2c99ac..176c02b96d 100644 --- a/languages/qmljs/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/languages/qmljs/libs/qmljs/qmljsmodelmanagerinterface.h @@ -1,292 +1,292 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms and ** conditions see http://www.qt.io/terms-conditions. For further information ** use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QMLJSMODELMANAGERINTERFACE_H #define QMLJSMODELMANAGERINTERFACE_H #include "qmljs_global.h" #include "qmljsbundle.h" #include "qmljsdocument.h" #include "qmljsqrcparser.h" #include "qmljsdialect.h" // #include #include #include #include #include #include #include #include QT_FORWARD_DECLARE_CLASS(QTimer) namespace ProjectExplorer { class Project; } namespace QmlJS { class Snapshot; class PluginDumper; class QMLJS_EXPORT ModelManagerInterface: public QObject { Q_OBJECT public: enum QrcResourceSelector { ActiveQrcResources, AllQrcResources }; class ProjectInfo { public: ProjectInfo() : tryQmlDump(false), qmlDumpHasRelocatableFlag(true) { } ProjectInfo(QPointer project) : project(project) , tryQmlDump(false), qmlDumpHasRelocatableFlag(true) { } explicit operator bool() const { return ! project.isNull(); } bool isValid() const { return ! project.isNull(); } bool isNull() const { return project.isNull(); } public: // attributes QPointer project; QStringList sourceFiles; PathsAndLanguages importPaths; QStringList activeResourceFiles; QStringList allResourceFiles; // whether trying to run qmldump makes sense bool tryQmlDump; bool qmlDumpHasRelocatableFlag; QString qmlDumpPath; ::Utils::Environment qmlDumpEnvironment; QString qtImportsPath; QString qtQmlPath; QString qtVersionString; QmlJS::QmlLanguageBundles activeBundle; QmlJS::QmlLanguageBundles extendedBundle; }; class WorkingCopy { public: typedef QHash > Table; void insert(const QString &fileName, const QString &source, int revision = 0) { _elements.insert(fileName, qMakePair(source, revision)); } bool contains(const QString &fileName) const { return _elements.contains(fileName); } QString source(const QString &fileName) const { return _elements.value(fileName).first; } QPair get(const QString &fileName) const { return _elements.value(fileName); } Table all() const { return _elements; } private: Table _elements; }; class CppData { public: QList exportedTypes; QHash contextProperties; }; typedef QHash CppDataHash; typedef QHashIterator CppDataHashIterator; public: ModelManagerInterface(QObject *parent = 0); ~ModelManagerInterface() override; static Dialect guessLanguageOfFile(const QString &fileName); static QStringList globPatternsForLanguages(const QList languages); static ModelManagerInterface *instance(); static void writeWarning(const QString &msg); static WorkingCopy workingCopy(); QmlJS::Snapshot snapshot() const; QmlJS::Snapshot newestSnapshot() const; void activateScan(); void updateSourceFiles(const QStringList &files, bool emitDocumentOnDiskChanged); void fileChangedOnDisk(const QString &path); void removeFiles(const QStringList &files); QStringList filesAtQrcPath(const QString &path, const QLocale *locale = 0, ProjectExplorer::Project *project = 0, QrcResourceSelector resources = AllQrcResources); QMap filesInQrcPath(const QString &path, const QLocale *locale = 0, ProjectExplorer::Project *project = 0, bool addDirs = false, QrcResourceSelector resources = AllQrcResources); QList projectInfos() const; ProjectInfo projectInfo(ProjectExplorer::Project *project, const ModelManagerInterface::ProjectInfo &defaultValue = ProjectInfo()) const; void updateProjectInfo(const ProjectInfo &pinfo, ProjectExplorer::Project *p); void updateDocument(QmlJS::Document::Ptr doc); void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info); void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc); void updateQrcFile(const QString &path); ProjectInfo projectInfoForPath(const QString &path) const; QList allProjectInfosForPath(const QString &path) const; bool isIdle() const ; PathsAndLanguages importPaths() const; QmlJS::QmlLanguageBundles activeBundles() const; QmlJS::QmlLanguageBundles extendedBundles() const; void loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion); CppDataHash cppData() const; LibraryInfo builtins(const Document::Ptr &doc) const; ViewerContext completeVContext(const ViewerContext &vCtx, const Document::Ptr &doc = Document::Ptr(0)) const; ViewerContext defaultVContext(Dialect language = Dialect::Qml, const Document::Ptr &doc = Document::Ptr(0), bool autoComplete = true) const; void setDefaultVContext(const ViewerContext &vContext); virtual ProjectInfo defaultProjectInfo() const; virtual ProjectInfo defaultProjectInfoForProject(ProjectExplorer::Project *project) const; // Blocks until all parsing threads are done. Used for testing. void joinAllThreads(); QmlJS::Document::Ptr ensuredGetDocumentForPath(const QString &filePath); static void importScan(QFutureInterface &future, WorkingCopy workingCopyInternal, PathsAndLanguages paths, ModelManagerInterface *modelManager, bool emitDocChangedOnDisk, bool libOnly = true); -public slots: +public Q_SLOTS: virtual void resetCodeModel(); void removeProjectInfo(ProjectExplorer::Project *project); -signals: +Q_SIGNALS: void documentUpdated(QmlJS::Document::Ptr doc); void documentChangedOnDisk(QmlJS::Document::Ptr doc); void aboutToRemoveFiles(const QStringList &files); void libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info); void projectInfoUpdated(const ProjectInfo &pinfo); void projectPathChanged(const QString &projectPath); -protected slots: +protected Q_SLOTS: // void maybeQueueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc); // void queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan); void asyncReset(); // virtual void startCppQmlTypeUpdate(); protected: QMutex *mutex() const; virtual QHash languageForSuffix() const; virtual void writeMessageInternal(const QString &msg) const; virtual WorkingCopy workingCopyInternal() const; virtual void addTaskInternal(QFuture result, const QString &msg, const char *taskId) const; QFuture refreshSourceFiles(const QStringList &sourceFiles, bool emitDocumentOnDiskChanged); static void parseLoop(QSet &scannedPaths, QSet &newLibraries, WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager, QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk, std::function reportProgress); static void parse(QFutureInterface &future, WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager, QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk); // static void updateCppQmlTypes(QFutureInterface &interface, // ModelManagerInterface *qmlModelManager, // CPlusPlus::Snapshot snapshot, // QHash > documents); void maybeScan(const PathsAndLanguages &importPaths); void updateImportPaths(); void loadQmlTypeDescriptionsInternal(const QString &path); void setDefaultProject(const ProjectInfo &pInfo, ProjectExplorer::Project *p); private: mutable QMutex m_mutex; QmlJS::Snapshot m_validSnapshot; QmlJS::Snapshot m_newestSnapshot; PathsAndLanguages m_allImportPaths; QStringList m_defaultImportPaths; QmlJS::QmlLanguageBundles m_activeBundles; QmlJS::QmlLanguageBundles m_extendedBundles; QHash m_defaultVContexts; bool m_shouldScanImports; QSet m_scannedPaths; // QTimer *m_updateCppQmlTypesTimer; QTimer *m_asyncResetTimer; // QHash > /*m_queuedCppDocuments*/; QFuture m_cppQmlTypesUpdater; QrcCache m_qrcCache; CppDataHash m_cppDataHash; mutable QMutex m_cppDataMutex; // project integration QMap m_projects; ProjectInfo m_defaultProjectInfo; ProjectExplorer::Project *m_defaultProject; QMultiHash m_fileToProject; PluginDumper *m_pluginDumper; QFutureSynchronizer m_synchronizer; bool m_indexerEnabled; }; } // namespace QmlJS #endif // QMLJSMODELMANAGERINTERFACE_H diff --git a/languages/qmljs/libs/qmljs/qmljsplugindumper.h b/languages/qmljs/libs/qmljs/qmljsplugindumper.h index 2e1644851f..9fd41b168a 100644 --- a/languages/qmljs/libs/qmljs/qmljsplugindumper.h +++ b/languages/qmljs/libs/qmljs/qmljsplugindumper.h @@ -1,105 +1,105 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms and ** conditions see http://www.qt.io/terms-conditions. For further information ** use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QMLJSPLUGINDUMPER_H #define QMLJSPLUGINDUMPER_H #include #include #include #include QT_BEGIN_NAMESPACE class QDir; QT_END_NAMESPACE namespace Utils { class FileSystemWatcher; } namespace QmlJS { class PluginDumper : public QObject { Q_OBJECT public: explicit PluginDumper(ModelManagerInterface *modelManager); public: void loadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info); void loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion); void scheduleRedumpPlugins(); void scheduleMaybeRedumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info); -private slots: +private Q_SLOTS: void onLoadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info, bool force = false); void onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion); void dumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info); void dumpAllPlugins(); void qmlPluginTypeDumpDone(int exitCode); void qmlPluginTypeDumpError(QProcess::ProcessError error); void pluginChanged(const QString &pluginLibrary); private: class Plugin { public: QString qmldirPath; QString importPath; QString importUri; QString importVersion; QStringList typeInfoPaths; }; void dump(const Plugin &plugin); void loadQmltypesFile(const QStringList &qmltypesFilePaths, const QString &libraryPath, QmlJS::LibraryInfo libraryInfo); QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName); QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName, const QStringList &suffixes, const QString &prefix = QString()); private: Utils::FileSystemWatcher *pluginWatcher(); ModelManagerInterface *m_modelManager; Utils::FileSystemWatcher *m_pluginWatcher; QHash m_runningQmldumps; QList m_plugins; QHash m_libraryToPluginIndex; QHash m_qtToInfo; }; } // namespace QmlJS #endif // QMLJSPLUGINDUMPER_H diff --git a/languages/qmljs/libs/utils/filesystemwatcher.h b/languages/qmljs/libs/utils/filesystemwatcher.h index 05860b6a92..14c17c5e09 100644 --- a/languages/qmljs/libs/utils/filesystemwatcher.h +++ b/languages/qmljs/libs/utils/filesystemwatcher.h @@ -1,91 +1,91 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms and ** conditions see http://www.qt.io/terms-conditions. For further information ** use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef FILESYSTEMWATCHER_H #define FILESYSTEMWATCHER_H #include "utils_global.h" #include namespace Utils { class FileSystemWatcherPrivate; // Documentation inside. class QTCREATOR_UTILS_EXPORT FileSystemWatcher : public QObject { Q_OBJECT public: enum WatchMode { WatchModifiedDate, WatchAllChanges }; explicit FileSystemWatcher(QObject *parent = 0); explicit FileSystemWatcher(int id, QObject *parent = 0); ~FileSystemWatcher() override; void addFile(const QString &file, WatchMode wm); void addFiles(const QStringList &files, WatchMode wm); void removeFile(const QString &file); void removeFiles(const QStringList &files); bool watchesFile(const QString &file) const; QStringList files() const; void addDirectory(const QString &file, WatchMode wm); void addDirectories(const QStringList &files, WatchMode wm); void removeDirectory(const QString &file); void removeDirectories(const QStringList &files); bool watchesDirectory(const QString &file) const; QStringList directories() const; -private slots: +private Q_SLOTS: void slotFileChanged(const QString &path); void slotDirectoryChanged(const QString &path); -signals: +Q_SIGNALS: void fileChanged(const QString &path); void directoryChanged(const QString &path); private: void init(); FileSystemWatcherPrivate *d; }; } // namespace Utils #endif // FILESYSTEMWATCHER_H diff --git a/languages/qmljs/navigation/propertypreviewwidget.h b/languages/qmljs/navigation/propertypreviewwidget.h index 5af36c170b..721dd9398e 100644 --- a/languages/qmljs/navigation/propertypreviewwidget.h +++ b/languages/qmljs/navigation/propertypreviewwidget.h @@ -1,101 +1,101 @@ /************************************************************************************* * Copyright (C) 2013 by Sven Brauch * * * * 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 PROPERTYPREVIEWWIDGET_H #define PROPERTYPREVIEWWIDGET_H #include #include #include #include using namespace KDevelop; class QQuickWidget; // Describes one supported property, such as "width" struct SupportedProperty { explicit SupportedProperty(const QUrl& qmlfile, const QString &typeContains = QString(), const QString &classContains = QString()) : qmlfile(qmlfile), typeContains(typeContains), classContains(classContains) { } // the absolute (!) URL to the qml file to load when creating a widget // for this property QUrl qmlfile; // A string that must be contained into the string representation of the // type of the key being matched. QString typeContains; // A string that must be contained into the name of the class in which the // key is declared QString classContains; }; // This class is responsible for creating the property widgets for editing QML properties // with e.g. sliders. It knows which properties are supported, and creates a widget from // a QML file for each supported property when requested. For the actual implementations // of the widgets, see the propertywidgets/ subfolder, especially the README file. class PropertyPreviewWidget : public QWidget { Q_OBJECT public: // Constructs a widget operating on the given document if the given key is in the list // of supported properties. // key and value must be the key and the current value of the property in question, // without spaces or other extra characters. // The ranges must encompass the text which should be replaced by the new values // selected by the user. // Returns 0 when the property is not supported, which tells kdevplatform not to // display any widget when returned from e.g. specialLanguageObjectNavigationWidget. static QWidget* constructIfPossible(KTextEditor::Document* doc, KTextEditor::Range keyRange, KTextEditor::Range valueRange, Declaration* decl, const QString& key, const QString& value); ~PropertyPreviewWidget() override; private: // private because you should use the static constructIfPossible function to create instances, // to make sure you don't have widgets which operate on unsupported properties. explicit PropertyPreviewWidget(KTextEditor::Document* doc, KTextEditor::Range keyRange, KTextEditor::Range valueRange, const SupportedProperty& property, const QString& value); static QHash supportedProperties; QQuickWidget* view; // the document the widget replaces text in KTextEditor::Document* document; // the range of the key KTextEditor::Range const keyRange; // the range of the value to be modified. Not const because the range might change // if the newly inserted text is smaller or larger than what was there before // (e.g. 9 -> 10) KTextEditor::Range valueRange; // the SupportedProperty instance for this widget SupportedProperty const property; -private slots: +private Q_SLOTS: // updates the text in the document to contain the new value in valueRange void updateValue(); }; #endif diff --git a/languages/qmljs/tests/test_files.h b/languages/qmljs/tests/test_files.h index 266e8ef8de..c9b08f3fa9 100644 --- a/languages/qmljs/tests/test_files.h +++ b/languages/qmljs/tests/test_files.h @@ -1,43 +1,43 @@ /************************************************************************************* * Copyright (C) 2013 by Milian Wolff * * Copyright (C) 2013 Olivier de Gaalon * * * * 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 TEST_FILES_H #define TEST_FILES_H #include class TestFiles : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testQMLCustomComponent(); void testJSUsesBetweenFiles(); void testNodeJS(); void testFiles_data(); void testFiles(); void testQMLTypes(); void testTypeMismatchFalsePositives(); private: void parseAndCheck(const QString& fileName, bool check = true); }; #endif // TEST_FILES_H diff --git a/projectbuilders/cmakebuilder/prunejob.h b/projectbuilders/cmakebuilder/prunejob.h index e448ad3155..536b9126c2 100644 --- a/projectbuilders/cmakebuilder/prunejob.h +++ b/projectbuilders/cmakebuilder/prunejob.h @@ -1,43 +1,43 @@ /* KDevelop CMake Support * * Copyright 2013 Aleix Pol Gonzalez * * 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 PRUNEJOB_H #define PRUNEJOB_H #include namespace KDevelop { class IProject; } class PruneJob : public KDevelop::OutputJob { Q_OBJECT public: explicit PruneJob(KDevelop::IProject* project); void start() override; bool doKill() override; - private slots: + private Q_SLOTS: void jobFinished(KJob* job); private: KDevelop::IProject* m_project; KJob* m_job; }; #endif // PRUNEJOB_H diff --git a/projectbuilders/makebuilder/imakebuilder.h b/projectbuilders/makebuilder/imakebuilder.h index 20a3d2ee00..ce2e1d182a 100644 --- a/projectbuilders/makebuilder/imakebuilder.h +++ b/projectbuilders/makebuilder/imakebuilder.h @@ -1,94 +1,94 @@ /* KDevelop * * Copyright 2007 Andreas Pakulat * * 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 IMAKEBUILDER_H #define IMAKEBUILDER_H #include #include #include #include class KJob; /** @author Andreas Pakulat */ /** * Used to create make variables of the form KEY=VALUE. */ typedef QList< QPair > MakeVariables; class IMakeBuilder : public KDevelop::IProjectBuilder { public: virtual ~IMakeBuilder() {} /** * Return a build job for the given target. * * E.g. if @a targetnames is \c 'myModule', the returned job * will execute the command: * * \code make myModule \endcode * * The command is executed inside the directory of @a item and uses the * configuration of its project. * * @param item Item of the project to build. * @param targetname Command-line target name to pass to make. */ virtual KJob* executeMakeTarget(KDevelop::ProjectBaseItem* item, const QString& targetname ) = 0; /** * Return a build job for the given targets with optional make variables defined. * * E.g. if @a targetnames is \code {'all', 'modules'} \endcode and @a variables is * \code { 'CFLAGS' : '-Wall', 'CC' : 'gcc-3.4' } \endcode, the returned job should * execute this command: * * \code make CFLAGS=-Wall CC=gcc-3.4 all modules \endcode * * The command is executed inside the directory of @a item and uses the * configuration of its project. * * @param item Item of the project to build. * @param targetnames Optional command-line targets names to pass to make. * @param variables Optional list of command-line variables to pass to make. */ virtual KJob* executeMakeTargets(KDevelop::ProjectBaseItem* item, const QStringList& targetnames = QStringList(), const MakeVariables& variables = MakeVariables() ) = 0; -signals: +Q_SIGNALS: /** * Emitted every time a target is finished being built for a project item. */ void makeTargetBuilt( KDevelop::ProjectBaseItem* item, const QString& targetname ); }; Q_DECLARE_INTERFACE( IMakeBuilder, "org.kdevelop.IMakeBuilder" ) #endif diff --git a/projectbuilders/ninjabuilder/ninjajob.h b/projectbuilders/ninjabuilder/ninjajob.h index 181cad8c78..f33f341dea 100644 --- a/projectbuilders/ninjabuilder/ninjajob.h +++ b/projectbuilders/ninjabuilder/ninjajob.h @@ -1,83 +1,83 @@ /* This file is part of KDevelop Copyright 2012 Aleix Pol Gonzalez Copyright 2017 Kevin Funk This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 NINJAJOB_H #define NINJAJOB_H #include #include namespace KDevelop { class ProjectBaseItem; } class NinjaBuilder; class QUrl; class NinjaJob : public KDevelop::OutputExecuteJob { Q_OBJECT public: enum CommandType { BuildCommand, CleanCommand, CustomTargetCommand, InstallCommand }; enum ErrorTypes { Correct = 0, Failed }; public: NinjaJob(KDevelop::ProjectBaseItem* item, CommandType commandType, const QStringList& arguments, const QByteArray& signal, NinjaBuilder* parent); ~NinjaJob() override; void setIsInstalling(bool isInstalling); static QString ninjaExecutable(); KDevelop::ProjectBaseItem* item() const; CommandType commandType() const; QUrl workingDirectory() const override; QStringList privilegedExecutionCommand() const override; -protected slots: +protected Q_SLOTS: void postProcessStdout(const QStringList& lines) override; void postProcessStderr(const QStringList& lines) override; -private slots: +private Q_SLOTS: void emitProjectBuilderSignal(KJob* job); private: bool m_isInstalling; QPersistentModelIndex m_idx; CommandType m_commandType; QByteArray m_signal; QPointer m_plugin; void appendLines(const QStringList& lines); }; #endif // NINJAJOB_H diff --git a/projectbuilders/qmakebuilder/qmakebuilderpreferences.h b/projectbuilders/qmakebuilder/qmakebuilderpreferences.h index 4060b6ceac..afa2e432a2 100644 --- a/projectbuilders/qmakebuilder/qmakebuilderpreferences.h +++ b/projectbuilders/qmakebuilder/qmakebuilderpreferences.h @@ -1,63 +1,63 @@ /* KDevelop QMake Support * * Copyright 2007 Andreas Pakulat * Copyright 2014 Kevin Funk * * 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 QMAKEBUILDERPREFERENCES_H #define QMAKEBUILDERPREFERENCES_H #include class QWidget; class QMakeBuilderSettings; class QMakeBuildDirChooser; namespace Ui { class QMakeConfig; class QMakeBuildDirChooser; } /** * @author Andreas Pakulat */ class QMakeBuilderPreferences : public KDevelop::ConfigPage { Q_OBJECT public: explicit QMakeBuilderPreferences(KDevelop::IPlugin* plugin, const KDevelop::ProjectConfigOptions& options, QWidget* parent = nullptr); ~QMakeBuilderPreferences() override; -public slots: +public Q_SLOTS: void apply() override; void reset() override; QString name() const override; void loadOtherConfig(const QString &config); void addBuildConfig(); void removeBuildConfig(); void validate(); private: KDevelop::IProject* m_project; Ui::QMakeConfig* m_prefsUi; QMakeBuildDirChooser* m_chooserUi; }; #endif diff --git a/projectmanagers/cmake/cmakebuilddirchooser.h b/projectmanagers/cmake/cmakebuilddirchooser.h index 30bc7afba0..9180957634 100644 --- a/projectmanagers/cmake/cmakebuilddirchooser.h +++ b/projectmanagers/cmake/cmakebuilddirchooser.h @@ -1,97 +1,97 @@ /* KDevelop CMake Support * * Copyright 2007 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 CMAKEBUILDDIRCHOOSER_H #define CMAKEBUILDDIRCHOOSER_H #include #include #include #include "cmakeextraargumentshistory.h" #include "cmakecommonexport.h" class QDialogButtonBox; namespace Ui { class CMakeBuildDirChooser; } namespace KDevelop { class IProject; } class KDEVCMAKECOMMON_EXPORT CMakeBuildDirChooser : public QDialog { Q_OBJECT public: enum StatusType { BuildDirCreated = 1, CorrectProject = 2, BuildFolderEmpty = 4, CorrectBuildDir = 16, DirAlreadyCreated = 32 //Error message in case it's already configured }; Q_DECLARE_FLAGS( StatusTypes, StatusType ) explicit CMakeBuildDirChooser(QWidget* parent = nullptr); ~CMakeBuildDirChooser() override; KDevelop::Path installPrefix() const; KDevelop::Path buildFolder() const; QString buildType() const; QString extraArguments() const; int alreadyUsedIndex() const; bool reuseBuilddir(); void setInstallPrefix(const KDevelop::Path& path); void setBuildFolder(const KDevelop::Path& path); void setBuildType(const QString& buildType); void setProject( KDevelop::IProject* project ); void setSourceFolder(const KDevelop::Path &path) { m_srcFolder = path; } void setAlreadyUsed(const QStringList& used); void setStatus(const QString& message, bool canApply); void setExtraArguments(const QString& args); void setShowAvailableBuildDirs(bool show); - private slots: + private Q_SLOTS: void updated(); private: void adoptPreviousBuildDirectory(int index); void buildDirSettings( const KDevelop::Path& buildDir, QString& srcDir, QString& installDir, QString& buildType); QStringList m_alreadyUsed; CMakeExtraArgumentsHistory* m_extraArgumentsHistory; Ui::CMakeBuildDirChooser* m_chooserUi; QDialogButtonBox* m_buttonBox; KDevelop::IProject* m_project; KDevelop::Path m_srcFolder; }; Q_DECLARE_OPERATORS_FOR_FLAGS( CMakeBuildDirChooser::StatusTypes ) #endif diff --git a/projectmanagers/cmake/cmakecommitchangesjob.h b/projectmanagers/cmake/cmakecommitchangesjob.h index 2e4bbaede8..15a7bcc84c 100644 --- a/projectmanagers/cmake/cmakecommitchangesjob.h +++ b/projectmanagers/cmake/cmakecommitchangesjob.h @@ -1,86 +1,86 @@ /* KDevelop CMake Support * * Copyright 2013 Aleix Pol Gonzalez * * 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 CMAKECOMMITCHANGESJOB_H #define CMAKECOMMITCHANGESJOB_H #include #include #include namespace KDevelop { class IProject; class ProjectTargetItem; class ProjectFolderItem; } class CMakeManager; class CMakeFolderItem; struct CMakeProjectData; struct ProcessedTarget { Target target; QStringList includes; QStringList defines; QString outputName; KDevelop::Path location; }; Q_DECLARE_TYPEINFO(ProcessedTarget, Q_MOVABLE_TYPE); class CMakeCommitChangesJob : public KJob { Q_OBJECT public: explicit CMakeCommitChangesJob(const KDevelop::Path& url, CMakeManager* manager, KDevelop::IProject* project); KDevelop::Path::List addProjectData(const CMakeProjectData& data); void setFindParentItem(bool find); virtual void start(); -public slots: +public Q_SLOTS: void reloadFiles(); void folderAvailable(KDevelop::ProjectFolderItem* item); -signals: +Q_SIGNALS: void folderCreated(KDevelop::ProjectFolderItem* item); -private slots: +private Q_SLOTS: void makeChanges(); private: void reloadFiles(KDevelop::ProjectFolderItem* item); void setTargetFiles(KDevelop::ProjectTargetItem* target, const KDevelop::Path::List& files); KDevelop::Path m_path; QVector m_subdirectories; QVector m_targets; QVector m_tests; KDevelop::IProject* m_project; CMakeManager* m_manager; QStringList m_directories; CMakeDefinitions m_definitions; bool m_projectDataAdded; KDevelop::ProjectFolderItem* m_parentItem; bool m_waiting; bool m_findParent; }; #endif // CMAKECOMMITCHANGESJOB_H diff --git a/projectmanagers/cmake/cmakemanager.h b/projectmanagers/cmake/cmakemanager.h index 1a76c5d425..7f26dd8829 100644 --- a/projectmanagers/cmake/cmakemanager.h +++ b/projectmanagers/cmake/cmakemanager.h @@ -1,166 +1,166 @@ /* KDevelop CMake Support * * Copyright 2006 Matt Rogers * Copyright 2007-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 CMAKEMANAGER_H #define CMAKEMANAGER_H #include #include #include #include #include #include #include #include #include "cmakeprojectdata.h" #include "icmakemanager.h" class WaitAllJobs; class CMakeCommitChangesJob; struct CMakeProjectData; class QObject; class CMakeHighlighting; class CMakeDocumentation; namespace KDevelop { class IProject; class IProjectBuilder; class ICodeHighlighting; class ProjectFolderItem; class ProjectBaseItem; class ProjectFileItem; class ProjectTargetItem; class ProjectFilterManager; class IProjectFilter; class ParseJob; class ContextMenuExtension; class Context; class IRuntime; } class CMakeFolderItem; class CMakeManager : public KDevelop::AbstractFileManagerPlugin , public KDevelop::IBuildSystemManager , public KDevelop::ILanguageSupport , public ICMakeManager { Q_OBJECT Q_INTERFACES( KDevelop::IBuildSystemManager ) Q_INTERFACES( KDevelop::IProjectFileManager ) Q_INTERFACES( KDevelop::ILanguageSupport ) Q_INTERFACES( ICMakeManager ) public: explicit CMakeManager( QObject* parent = nullptr, const QVariantList& args = QVariantList() ); ~CMakeManager() override; Features features() const override { return Features(Folders | Targets | Files ); } KDevelop::IProjectBuilder* builder() const override; bool hasBuildInfo(KDevelop::ProjectBaseItem*) const override; KDevelop::Path buildDirectory(KDevelop::ProjectBaseItem*) const override; KDevelop::Path::List includeDirectories(KDevelop::ProjectBaseItem *) const override; KDevelop::Path::List frameworkDirectories(KDevelop::ProjectBaseItem *item) const override; QHash defines(KDevelop::ProjectBaseItem *) const override; KDevelop::ProjectTargetItem* createTarget( const QString&, KDevelop::ProjectFolderItem* ) override { return nullptr; } virtual QList targets() const; QList targets(KDevelop::ProjectFolderItem* folder) const override; // virtual KDevelop::ProjectFolderItem* addFolder( const KDevelop::Path& folder, KDevelop::ProjectFolderItem* parent ); // virtual KDevelop::ProjectFileItem* addFile( const KDevelop::Path&, KDevelop::ProjectFolderItem* ); bool addFilesToTarget( const QList &files, KDevelop::ProjectTargetItem* target) override; bool removeTarget( KDevelop::ProjectTargetItem* ) override { return false; } bool removeFilesFromTargets( const QList &files ) override; // virtual bool removeFilesAndFolders( const QList &items); // // virtual bool renameFile(KDevelop::ProjectFileItem*, const KDevelop::Path&); // virtual bool renameFolder(KDevelop::ProjectFolderItem*, const KDevelop::Path&); // virtual bool moveFilesAndFolders(const QList< KDevelop::ProjectBaseItem* > &items, KDevelop::ProjectFolderItem *newParent); // virtual bool copyFilesAndFolders(const KDevelop::Path::List &items, KDevelop::ProjectFolderItem* newParent); // // virtual QList parse( KDevelop::ProjectFolderItem* dom ); KDevelop::ProjectFolderItem* import( KDevelop::IProject *project ) override; KJob* createImportJob(KDevelop::ProjectFolderItem* item) override; // bool reload(KDevelop::ProjectFolderItem*) override; // // virtual KDevelop::ContextMenuExtension contextMenuExtension( KDevelop::Context* context ); KDevelop::ProjectFolderItem* createFolderItem(KDevelop::IProject* project, const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent = nullptr) override; QPair cacheValue(KDevelop::IProject* project, const QString& id) const override; //LanguageSupport QString name() const override; KDevelop::ParseJob *createParseJob(const KDevelop::IndexedString &url) override; KDevelop::ICodeHighlighting* codeHighlighting() const override; QWidget* specialLanguageObjectNavigationWidget(const QUrl &url, const KTextEditor::Cursor& position) override; // void addPending(const KDevelop::Path& path, CMakeFolderItem* folder); // CMakeFolderItem* takePending(const KDevelop::Path& path); // void addWatcher(KDevelop::IProject* p, const QString& path); // CMakeProjectData projectData(KDevelop::IProject* project); KDevelop::ProjectFilterManager* filterManager() const; static KDevelop::IndexedString languageName(); int perProjectConfigPages() const override; KDevelop::ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, QWidget* parent) override; void integrateData(const CMakeProjectData &data, KDevelop::IProject* project); -signals: +Q_SIGNALS: void folderRenamed(const KDevelop::Path& oldFolder, KDevelop::ProjectFolderItem* newFolder); void fileRenamed(const KDevelop::Path& oldFile, KDevelop::ProjectFileItem* newFile); -private slots: +private Q_SLOTS: void serverResponse(KDevelop::IProject* project, const QJsonObject &value); // void jumpToDeclaration(); void projectClosing(KDevelop::IProject*); void dirtyFile(const QString& file); // // void directoryChanged(const QString& dir); // void filesystemBuffererTimeout(); private: void reloadProjects(); CMakeFile fileInformation(KDevelop::ProjectBaseItem* item) const; void folderAdded(KDevelop::ProjectFolderItem* folder); QHash m_projects; KDevelop::ProjectFilterManager* m_filter; KDevelop::ICodeHighlighting* m_highlight; }; #endif diff --git a/projectmanagers/cmake/settings/cmakecachedelegate.h b/projectmanagers/cmake/settings/cmakecachedelegate.h index 6b7d8c023a..d5aeca2734 100644 --- a/projectmanagers/cmake/settings/cmakecachedelegate.h +++ b/projectmanagers/cmake/settings/cmakecachedelegate.h @@ -1,50 +1,50 @@ /* KDevelop CMake Support * * Copyright 2008 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 CMAKECACHEDELEGATE_H #define CMAKECACHEDELEGATE_H #include #include class KUrlRequester; class CMakeCacheDelegate : public QItemDelegate { Q_OBJECT public: explicit CMakeCacheDelegate(QObject* parent); ~CMakeCacheDelegate() override; QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const override; void setEditorData ( QWidget * editor, const QModelIndex & index ) const override; void setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const override; void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const override; QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index ) const override; - private slots: + private Q_SLOTS: void closingEditor(QWidget * editor, QAbstractItemDelegate::EndEditHint hint = NoHint); void checkboxToggled(); private: KUrlRequester *m_sample; }; #endif diff --git a/projectmanagers/cmake/settings/cmakecachemodel.h b/projectmanagers/cmake/settings/cmakecachemodel.h index 5c3b145c14..fd23af7eb4 100644 --- a/projectmanagers/cmake/settings/cmakecachemodel.h +++ b/projectmanagers/cmake/settings/cmakecachemodel.h @@ -1,65 +1,65 @@ /* KDevelop CMake Support * * Copyright 2007-2008 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 CMAKECACHEMODEL_H #define CMAKECACHEMODEL_H #include #include #include #include #include /** * This class parses the CMakeCache.txt files and put it to a Model * @author Aleix Pol */ class CMakeCacheModel : public QStandardItemModel { Q_OBJECT public: CMakeCacheModel(QObject* parent, const KDevelop::Path &path); ~CMakeCacheModel() override {} bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; int internal() const { return m_internalBegin; } QString value(const QString& name) const; bool isAdvanced(int i) const; bool isInternal(int i) const; QList persistentIndices() const; KDevelop::Path filePath() const; void read(); QVariantMap changedValues() const; - public slots: + public Q_SLOTS: void reset(); private: KDevelop::Path m_filePath; int m_internalBegin; QSet m_internal; QSet m_modifiedRows; }; #endif diff --git a/projectmanagers/cmake/settings/cmakepreferences.h b/projectmanagers/cmake/settings/cmakepreferences.h index 3e6bbef4f4..c0589a6963 100644 --- a/projectmanagers/cmake/settings/cmakepreferences.h +++ b/projectmanagers/cmake/settings/cmakepreferences.h @@ -1,77 +1,77 @@ /* KDevelop CMake Support * * Copyright 2006 Matt Rogers * Copyright 2007 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 CMAKEPREFERENCES_H #define CMAKEPREFERENCES_H #include "cmakecachemodel.h" #include "cmakeextraargumentshistory.h" #include #include class CMakeSettings; namespace Ui { class CMakeBuildSettings; } /** * @author Matt Rogers * @author Aleix Pol */ class CMakePreferences : public KDevelop::ConfigPage { Q_OBJECT public: explicit CMakePreferences(KDevelop::IPlugin* plugin, const KDevelop::ProjectConfigOptions& options, QWidget* parent = nullptr); ~CMakePreferences() override; QString name() const override; QString fullName() const override; QIcon icon() const override; void apply() override; void reset() override; void defaults() override; - private slots: + private Q_SLOTS: void listSelectionChanged ( const QModelIndex& current, const QModelIndex& ); void showInternal(int state); void cacheEdited(QStandardItem * ) { emit changed(); } void buildDirChanged(int index); void cacheUpdated(); void createBuildDir(); void removeBuildDir(); void showAdvanced(bool v); void configureCacheView(); private: void configure(); void initAdvanced(); KDevelop::IProject* m_project; KDevelop::Path m_srcFolder; KDevelop::Path m_subprojFolder; void updateCache( const KDevelop::Path & ); Ui::CMakeBuildSettings* m_prefsUi; CMakeCacheModel* m_currentModel; CMakeExtraArgumentsHistory* m_extraArgumentsHistory; }; #endif diff --git a/projectmanagers/cmake/testing/ctestfindjob.h b/projectmanagers/cmake/testing/ctestfindjob.h index 258eea9e69..ce9e468109 100644 --- a/projectmanagers/cmake/testing/ctestfindjob.h +++ b/projectmanagers/cmake/testing/ctestfindjob.h @@ -1,52 +1,52 @@ /* This file is part of KDevelop Copyright 2012 Miha Čančula 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CTESTFINDJOB_H #define CTESTFINDJOB_H #include #include namespace KDevelop { class IndexedString; class ReferencedTopDUContext; } class CTestSuite; class CTestFindJob : public KJob { Q_OBJECT public: explicit CTestFindJob(CTestSuite* suite, QObject* parent = nullptr); void start() override; -private slots: +private Q_SLOTS: void findTestCases(); void updateReady(const KDevelop::IndexedString& document, const KDevelop::ReferencedTopDUContext& context); protected: bool doKill() override; private: CTestSuite* m_suite; QList m_pendingFiles; }; #endif // CTESTFINDJOB_H diff --git a/projectmanagers/cmake/testing/ctestrunjob.h b/projectmanagers/cmake/testing/ctestrunjob.h index 1e7583baab..170cd7db58 100644 --- a/projectmanagers/cmake/testing/ctestrunjob.h +++ b/projectmanagers/cmake/testing/ctestrunjob.h @@ -1,52 +1,52 @@ /* This file is part of KDevelop Copyright 2012 Miha Čančula 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CTESTRUNJOB_H #define CTESTRUNJOB_H #include #include #include class CTestSuite; class CTestRunJob : public KJob { Q_OBJECT public: CTestRunJob(CTestSuite* suite, const QStringList& cases, KDevelop::OutputJob::OutputJobVerbosity verbosity, QObject* parent = nullptr); void start() override; protected: bool doKill() override; -private slots: +private Q_SLOTS: void processFinished(KJob* job); void rowsInserted(const QModelIndex &parent, int startRow, int endRow); private: CTestSuite* m_suite; QStringList m_cases; QHash m_caseResults; KJob* m_job; KDevelop::OutputJob* m_outputJob; KDevelop::OutputJob::OutputJobVerbosity m_verbosity; }; #endif // CTESTRUNJOB_H diff --git a/projectmanagers/cmake/tests/kdevprojectopen.h b/projectmanagers/cmake/tests/kdevprojectopen.h index 687b1edc46..2258c52e3b 100644 --- a/projectmanagers/cmake/tests/kdevprojectopen.h +++ b/projectmanagers/cmake/tests/kdevprojectopen.h @@ -1,44 +1,44 @@ /* KDevelop CMake Support * * Copyright 2013 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 KDEVPROJECTOPEN_H #define KDEVPROJECTOPEN_H #include #include namespace KDevelop { class IProject; } class KDevProjectOpen : public QObject { Q_OBJECT public: explicit KDevProjectOpen(QObject* parent = nullptr); void openProject(const QUrl& path); void cleanup(); -private slots: +private Q_SLOTS: void projectDone(KDevelop::IProject*); private: int m_toOpen; }; #endif diff --git a/projectmanagers/cmake/tests/test_cmakemanager.h b/projectmanagers/cmake/tests/test_cmakemanager.h index c5688149d8..e85119dfe0 100644 --- a/projectmanagers/cmake/tests/test_cmakemanager.h +++ b/projectmanagers/cmake/tests/test_cmakemanager.h @@ -1,59 +1,59 @@ /* This file is part of KDevelop Copyright 2010 Esben Mose Hansen 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 TEST_CMAKEMANAGER_H #define TEST_CMAKEMANAGER_H #include namespace KDevelop { class IProject; } /** * Test of the cmake manager. * + Test that CMakeCache.txt is found, loaded and parsed * @author Esben Mose Hansen **/ class TestCMakeManager : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void cleanup(); void testWithBuildDirProject(); void testIncludePaths(); void testRelativePaths(); void testTargetIncludeDirectories(); void testTargetIncludePaths(); void testDefines(); void testCustomTargetSources(); void testConditionsInSubdirectoryBasedOnRootVariables(); void testQt5App(); void testQt5AppOld(); void testKF5App(); void testEnumerateTargets(); void testFaultyTarget(); void testParenthesesInTestArguments(); void testReload(); void testExecutableOutputPath(); }; #endif // TEST_CMAKEMANAGER_H diff --git a/projectmanagers/cmake/tests/test_cmakeserver.cpp b/projectmanagers/cmake/tests/test_cmakeserver.cpp index b4f6ab3781..9cdb8175aa 100644 --- a/projectmanagers/cmake/tests/test_cmakeserver.cpp +++ b/projectmanagers/cmake/tests/test_cmakeserver.cpp @@ -1,106 +1,106 @@ /* KDevelop CMake Support * * Copyright 2017 Aleix Pol Gonzalez * * 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. */ #include #include #include #include #include "testhelpers.h" #include #include #include using namespace KDevelop; class CMakeServerTest : public QObject { Q_OBJECT public: CMakeServerTest() { QLoggingCategory::setFilterRules(QStringLiteral("default.debug=true\nkdevelop.projectmanagers.cmake.debug=true\n")); AutoTestShell::init(); TestCore::initialize(); } -private slots: +private Q_SLOTS: void initTestCase() { QProcess p; p.start("cmake", {"--version"}); QVERIFY(p.waitForFinished()); auto output = p.readAll(); QRegularExpression rx("cmake version (\\d\\.\\d).*"); const auto match = rx.match(output); QVERIFY(match.isValid()); const auto capture = match.capturedRef(1); const auto version = capture.split('.'); const bool versionWithServer = version[0] == "3" && version[1].toInt()>=8; if (!versionWithServer) QSKIP("cmake server not supported"); } void testRun() { CMakeServer server(this); QSignalSpy spyConnected(&server, &CMakeServer::connected); QVERIFY(server.isServerAvailable() || spyConnected.wait()); QSignalSpy spy(&server, &CMakeServer::response); QJsonObject codeModel; int errors = 0; connect(&server, &CMakeServer::response, this, [&errors, &codeModel, &server](const QJsonObject &response) { if (response.value(QStringLiteral("type")) == QLatin1String("reply")) { if (response.value(QStringLiteral("inReplyTo")) == QLatin1String("configure")) server.compute(); else if (response.value(QStringLiteral("inReplyTo")) == QLatin1String("compute")) server.codemodel(); else if(response.value(QStringLiteral("inReplyTo")) == QLatin1String("codemodel")) codeModel = response; } else if(response.value(QStringLiteral("type")) == QLatin1String("error")) { ++errors; } }); const QString name = QStringLiteral("single_subdirectory"); const auto paths = projectPaths(name); const QString builddir = QStringLiteral(CMAKE_TESTS_BINARY_DIR "/cmake-server-test-builddir/") + name; QVERIFY(QDir(builddir).removeRecursively()); QVERIFY(QDir(builddir).mkpath(builddir)); QVERIFY(spy.wait()); server.handshake(paths.sourceDir, Path(builddir)); QVERIFY(spy.wait()); server.configure({}); while(codeModel.isEmpty()) QVERIFY(spy.wait()); QCOMPARE(errors, 0); QVERIFY(!codeModel.isEmpty()); qDebug() << "codemodel" << codeModel; } }; QTEST_MAIN( CMakeServerTest ) #include "test_cmakeserver.moc" diff --git a/projectmanagers/cmake/tests/test_ctestfindsuites.h b/projectmanagers/cmake/tests/test_ctestfindsuites.h index 89f2a2041e..fbd6085839 100644 --- a/projectmanagers/cmake/tests/test_ctestfindsuites.h +++ b/projectmanagers/cmake/tests/test_ctestfindsuites.h @@ -1,40 +1,40 @@ /* KDevelop CMake Support * * Copyright 2012 Miha Čančula * Copyright 2017 Kevin Funk * * 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 TEST_CTESTFINDSUITES_H #define TEST_CTESTFINDSUITES_H #include class TestCTestFindSuites : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void cleanup(); void initTestCase(); void cleanupTestCase(); void testCTestSuite(); }; #endif diff --git a/projectmanagers/custom-buildsystem/configwidget.h b/projectmanagers/custom-buildsystem/configwidget.h index 0ba34c41d6..5e717ff452 100644 --- a/projectmanagers/custom-buildsystem/configwidget.h +++ b/projectmanagers/custom-buildsystem/configwidget.h @@ -1,63 +1,63 @@ /************************************************************************ * KDevelop4 Custom Buildsystem Support * * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef CONFIGWIDGET_H #define CONFIGWIDGET_H #include #include "custombuildsystemconfig.h" namespace Ui { class ConfigWidget; } namespace KDevelop { class IProject; } class ConfigWidget : public QWidget { Q_OBJECT public: explicit ConfigWidget( QWidget* parent = nullptr ); void loadConfig( CustomBuildSystemConfig cfg ); CustomBuildSystemConfig config() const; void clear(); -signals: +Q_SIGNALS: void changed(); -private slots: +private Q_SLOTS: void changeAction( int ); void toggleActionEnablement( bool ); void actionArgumentsEdited( const QString& ); void actionEnvironmentChanged(const QString&); void actionExecutableChanged( const QUrl& ); void actionExecutableChanged( const QString& ); private: template void applyChange(F toolChanger); Ui::ConfigWidget* ui; QVector m_tools; void setTool( const CustomBuildSystemTool& tool ); }; #endif diff --git a/projectmanagers/custom-buildsystem/custombuildjob.h b/projectmanagers/custom-buildsystem/custombuildjob.h index a3c3076191..17a4f70ef2 100644 --- a/projectmanagers/custom-buildsystem/custombuildjob.h +++ b/projectmanagers/custom-buildsystem/custombuildjob.h @@ -1,73 +1,73 @@ /************************************************************************ * KDevelop4 Custom Buildsystem Support * * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef CUSTOMBUILDJOB_H #define CUSTOMBUILDJOB_H #include #include "custombuildsystemconfig.h" #include class CustomBuildSystem; namespace KDevelop { class ProjectBaseItem; class CommandExecutor; class OutputModel; class IProject; } class CustomBuildJob : public KDevelop::OutputJob { Q_OBJECT public: enum ErrorType { UndefinedBuildType = UserDefinedError, FailedToStart, UnknownExecError, Crashed, WrongArgs, ToolDisabled, NoCommand }; CustomBuildJob( CustomBuildSystem*, KDevelop::ProjectBaseItem*, CustomBuildSystemTool::ActionType t ); void start() override; bool doKill() override; void setInstallPrefix(const QUrl &installPrefix) { this->installPrefix=installPrefix; } -private slots: +private Q_SLOTS: void procFinished(int); void procError( QProcess::ProcessError ); private: KDevelop::OutputModel* model(); CustomBuildSystemTool::ActionType type; QString projectName; QString cmd; QString arguments; QString environment; QString builddir; QUrl installPrefix; KDevelop::CommandExecutor* exec; bool killed; bool enabled; }; #endif diff --git a/projectmanagers/custom-buildsystem/custombuildsystemconfigwidget.h b/projectmanagers/custom-buildsystem/custombuildsystemconfigwidget.h index 6ba6b0d520..1f58032cf4 100644 --- a/projectmanagers/custom-buildsystem/custombuildsystemconfigwidget.h +++ b/projectmanagers/custom-buildsystem/custombuildsystemconfigwidget.h @@ -1,63 +1,63 @@ /************************************************************************ * KDevelop4 Custom Buildsystem Support * * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef CUSTOMBUILDSYSTEMCONFIGWIDGET_H #define CUSTOMBUILDSYSTEMCONFIGWIDGET_H #include #include "custombuildsystemconfig.h" #include "custombuildjob.h" class KConfig; class KConfigGroup; namespace KDevelop { class IProject; } namespace Ui { class CustomBuildSystemConfigWidget; } class CustomBuildSystemConfigWidget : public QWidget { Q_OBJECT public: explicit CustomBuildSystemConfigWidget( QWidget* parent ); void loadFrom( KConfig* ); void saveTo( KConfig*, KDevelop::IProject* project ); void loadDefaults(); -signals: +Q_SIGNALS: void changed(); -private slots: +private Q_SLOTS: void configChanged(); void changeCurrentConfig(int); void renameCurrentConfig(const QString& name); void addConfig(); void removeConfig(); void verify(); private: void saveConfig( KConfigGroup& grp, CustomBuildSystemConfig& c, int index ); Ui::CustomBuildSystemConfigWidget* ui; QList configs; }; #endif diff --git a/projectmanagers/custom-buildsystem/custombuildsystemplugin.h b/projectmanagers/custom-buildsystem/custombuildsystemplugin.h index c580773cfe..834dc0ab00 100644 --- a/projectmanagers/custom-buildsystem/custombuildsystemplugin.h +++ b/projectmanagers/custom-buildsystem/custombuildsystemplugin.h @@ -1,91 +1,91 @@ /************************************************************************ * KDevelop4 Custom Buildsystem Support * * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef CUSTOMBUILDSYSTEMPLUGIN_H #define CUSTOMBUILDSYSTEMPLUGIN_H #include #include #include #include class KConfigGroup; class KDialogBase; namespace KDevelop { class ProjectBaseItem; class IProject; } class CustomBuildSystem : public KDevelop::AbstractFileManagerPlugin, public KDevelop::IProjectBuilder, public KDevelop::IBuildSystemManager { Q_OBJECT Q_INTERFACES( KDevelop::IProjectBuilder ) Q_INTERFACES( KDevelop::IProjectFileManager ) Q_INTERFACES( KDevelop::IBuildSystemManager ) public: explicit CustomBuildSystem( QObject *parent = nullptr, const QVariantList &args = QVariantList() ); virtual ~CustomBuildSystem(); // ProjectBuilder API KJob* build( KDevelop::ProjectBaseItem* dom ) override; KJob* clean( KDevelop::ProjectBaseItem* dom ) override; KJob* prune( KDevelop::IProject* ) override; /// @p installPrefix will be passed as DESTDIR environment variable KJob* install( KDevelop::ProjectBaseItem* item, const QUrl &installPrefix ) override; KJob* configure( KDevelop::IProject* ) override; -signals: +Q_SIGNALS: void built( KDevelop::ProjectBaseItem *dom ); void installed( KDevelop::ProjectBaseItem* ); void cleaned( KDevelop::ProjectBaseItem* ); void failed( KDevelop::ProjectBaseItem *dom ); void configured( KDevelop::IProject* ); void pruned( KDevelop::IProject* ); // AbstractFileManagerPlugin API public: Features features() const override; virtual KDevelop::ProjectFolderItem* createFolderItem( KDevelop::IProject* project, const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent = nullptr ) override; // BuildSystemManager API public: bool addFilesToTarget( const QList& file, KDevelop::ProjectTargetItem* parent ) override; bool hasBuildInfo( KDevelop::ProjectBaseItem* ) const override; KDevelop::Path buildDirectory( KDevelop::ProjectBaseItem* ) const override; IProjectBuilder* builder() const override; KDevelop::ProjectTargetItem* createTarget( const QString& target, KDevelop::ProjectFolderItem* parent ) override; QHash defines( KDevelop::ProjectBaseItem* ) const override; KDevelop::Path::List includeDirectories( KDevelop::ProjectBaseItem* ) const override; KDevelop::Path::List frameworkDirectories( KDevelop::ProjectBaseItem* ) const override; bool removeFilesFromTargets( const QList& ) override; bool removeTarget( KDevelop::ProjectTargetItem* target ) override; QList targets( KDevelop::ProjectFolderItem* ) const override; KConfigGroup configuration( KDevelop::IProject* ) const; KConfigGroup findMatchingPathGroup( const KConfigGroup& cfg, KDevelop::ProjectBaseItem* item ) const; // IPlugin API public: int perProjectConfigPages() const override; KDevelop::ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, QWidget* parent) override; }; #endif diff --git a/projectmanagers/custom-buildsystem/tests/kcmuitestmain.cpp b/projectmanagers/custom-buildsystem/tests/kcmuitestmain.cpp index 064b22d11f..0b9736b5af 100644 --- a/projectmanagers/custom-buildsystem/tests/kcmuitestmain.cpp +++ b/projectmanagers/custom-buildsystem/tests/kcmuitestmain.cpp @@ -1,142 +1,142 @@ /************************************************************************ * KDevelop4 Custom Buildsystem Support * * * * Copyright 2012 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "custombuildsystemconfigwidget.h" #include static const char description[] = I18N_NOOP("CustomBuildSystem Config Ui Test App"); static const char version[] = "0.1"; class State : public QObject { Q_OBJECT public: State( QDialogButtonBox* buttonBox, CustomBuildSystemConfigWidget* cfgWidget, KConfig* config, KDevelop::IProject* proj ) : buttonBox(buttonBox), configWidget(cfgWidget), cfg(config), project(proj) { connect(buttonBox, &QDialogButtonBox::clicked, this, &State::buttonClicked); connect(configWidget, &CustomBuildSystemConfigWidget::changed, this, &State::configChanged); } -public slots: +public Q_SLOTS: void buttonClicked(QAbstractButton* button) { if (button == buttonBox->button(QDialogButtonBox::Apply)) { apply(); } else if (button == buttonBox->button(QDialogButtonBox::Ok)) { ok(); } else if (button == buttonBox->button(QDialogButtonBox::Cancel)) { qApp->quit(); } } void apply() { configWidget->saveTo(cfg, project); buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); } void ok() { apply(); qApp->quit(); } void configChanged() { buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); } private: QDialogButtonBox* buttonBox; CustomBuildSystemConfigWidget* configWidget; KConfig* cfg; KDevelop::IProject* project; }; int main(int argc, char **argv) { KAboutData aboutData(QStringLiteral("kcm_uitest"), i18n("kcm_uitest"), version, i18n(description), KAboutLicense::GPL, i18n("(C) 2012 Andreas Pakulat")); aboutData.addAuthor( i18n("Andreas Pakulat"), QString(), QStringLiteral("apaku@gmx.de") ); QApplication app(argc, argv); QCommandLineParser parser; KAboutData::setApplicationData(aboutData); parser.addVersionOption(); parser.addHelpOption(); aboutData.setupCommandLine(&parser); parser.process(app); aboutData.processCommandLine(&parser); QTemporaryDir tempdir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)+"/kdev-custom-uitest"); qCDebug(CUSTOMBUILDSYSTEM) << "created tempdir:" << tempdir.path(); KConfig projkcfg( tempdir.path() + "/kdev-custom-uitest.kdev4" ); QDir projdir(tempdir.path()); projdir.mkdir(QStringLiteral("includedir")); projdir.mkdir(QStringLiteral("subtree")); projdir.mkpath(QStringLiteral("subtree/includedir")); projdir.mkpath(QStringLiteral("subtree/deeptree")); projdir.mkpath(QStringLiteral("subtree/deeptree/includedir")); qCDebug(CUSTOMBUILDSYSTEM) << "project config:" << projkcfg.name(); QDialog dlg; QVBoxLayout mainLayout; dlg.setLayout(&mainLayout); KDevelop::TestProject proj; proj.setPath( KDevelop::Path(projkcfg.name())); CustomBuildSystemConfigWidget widget(nullptr); widget.loadFrom(&projkcfg); mainLayout.addWidget(&widget); dlg.setWindowTitle(QStringLiteral("Ui Test App for Config Widget")); QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel); buttonBox.button(QDialogButtonBox::Apply)->setEnabled(false); buttonBox.button(QDialogButtonBox::Ok)->setEnabled(false); State state(&buttonBox, &widget, &projkcfg, &proj ); dlg.resize(800, 600); dlg.show(); return app.exec(); } #include "kcmuitestmain.moc" diff --git a/projectmanagers/custom-buildsystem/tests/test_custombuildsystemplugin.h b/projectmanagers/custom-buildsystem/tests/test_custombuildsystemplugin.h index 97659a68ab..dacffd5aee 100644 --- a/projectmanagers/custom-buildsystem/tests/test_custombuildsystemplugin.h +++ b/projectmanagers/custom-buildsystem/tests/test_custombuildsystemplugin.h @@ -1,41 +1,41 @@ /************************************************************************ * KDevelop4 Custom Buildsystem Support * * * * Copyright 2010 Andreas Pakulat * * * * 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 or version 3 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, see . * ************************************************************************/ #ifndef TEST_CUSTOMBUILDSYSTEMPLUGIN_H #define TEST_CUSTOMBUILDSYSTEMPLUGIN_H #include namespace KDevelop { class TestCore; } class TestCustomBuildSystemPlugin : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void loadSimpleProject(); void buildDirProject(); void loadMultiPathProject(); }; #endif diff --git a/projectmanagers/custommake/custommakemanager.h b/projectmanagers/custommake/custommakemanager.h index 19eeedf26c..390e85681b 100644 --- a/projectmanagers/custommake/custommakemanager.h +++ b/projectmanagers/custommake/custommakemanager.h @@ -1,144 +1,144 @@ /* KDevelop Custom Makefile Support * * Copyright 2007 Dukju Ahn * Copyright 2011 Milian Wolff * * 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. */ #ifndef CUSTOMMAKEMANAGER_H #define CUSTOMMAKEMANAGER_H #include #include #include #include class IMakeBuilder; class CustomMakeProvider; class CustomMakeManager : public KDevelop::AbstractFileManagerPlugin, public KDevelop::IBuildSystemManager { Q_OBJECT Q_INTERFACES( KDevelop::IBuildSystemManager ) public: explicit CustomMakeManager( QObject *parent = nullptr, const QVariantList& args = QVariantList() ); ~CustomMakeManager() override; Features features() const override { return Features(Folders | Targets | Files); } KDevelop::ProjectFolderItem* import(KDevelop::IProject* project) override; /** * Provide access to the builder */ KDevelop::IProjectBuilder* builder() const override; /** * Provide a list of include directories. */ KDevelop::Path::List includeDirectories(KDevelop::ProjectBaseItem*) const override; /** * Provide a list of framework directories. */ KDevelop::Path::List frameworkDirectories(KDevelop::ProjectBaseItem*) const override; /** * Provide a list of files that contain the preprocessor defines for the * project */ QHash defines(KDevelop::ProjectBaseItem*) const override; /** * Create a new target * * Creates the target specified by @p target to the folder @p parent and * modifies the underlying build system if needed */ KDevelop::ProjectTargetItem* createTarget(const QString& target, KDevelop::ProjectFolderItem *parent) override; /** * Add a file to a target * * Adds the file specified by @p file to the target @p parent and modifies * the underlying build system if needed. */ bool addFilesToTarget(const QList &files, KDevelop::ProjectTargetItem *parent) override; /** * Remove a target * * Removes the target specified by @p target and * modifies the underlying build system if needed. */ bool removeTarget(KDevelop::ProjectTargetItem *target) override; /** * Remove a file from a target * * Removes the file specified by @p file from the folder @p parent and * modifies the underlying build system if needed. The file is not removed * from the folder it is in */ bool removeFilesFromTargets(const QList&) override; /** * Test if @p item has any includes or defines from this BSM */ bool hasBuildInfo(KDevelop::ProjectBaseItem* item) const override; /** * Get the toplevel build directory for the project */ KDevelop::Path buildDirectory(KDevelop::ProjectBaseItem*) const override; /** * Get a list of all the targets in this project * * The list returned by this function should be checked to verify it is not * empty before using it * * @return The list of targets for this project * @todo implement */ QList targets(KDevelop::ProjectFolderItem*) const override; protected: KDevelop::ProjectFileItem* createFileItem(KDevelop::IProject* project, const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent) override; KDevelop::ProjectFolderItem* createFolderItem(KDevelop::IProject* project, const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent = nullptr) override; void unload() override; -private slots: +private Q_SLOTS: void reloadMakefile(KDevelop::ProjectFileItem *item); void projectClosing(KDevelop::IProject*); private: /** * Initialize targets by reading Makefile in @arg dir * @return Target lists in Makefile at @arg dir. */ QStringList parseCustomMakeFile( const KDevelop::Path &makefile ); void createTargetItems(KDevelop::IProject* project, const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent); private: IMakeBuilder *m_builder; QScopedPointer m_provider; QSet m_projectPaths; friend class CustomMakeProvider; }; #endif diff --git a/projectmanagers/custommake/makefileresolver/tests/test_custommake.h b/projectmanagers/custommake/makefileresolver/tests/test_custommake.h index 1e5f37bf8c..912bc75a25 100644 --- a/projectmanagers/custommake/makefileresolver/tests/test_custommake.h +++ b/projectmanagers/custommake/makefileresolver/tests/test_custommake.h @@ -1,39 +1,39 @@ /* * This file is part of KDevelop * * Copyright 2014 Sergey Kalinichev * * This program 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 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 TEST_CUSTOMMAKE_H #define TEST_CUSTOMMAKE_H #include class TestCustomMake : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testIncludeDirectories(); void testFrameworkDirectories(); void testDefines(); }; #endif // TEST_CUSTOMMAKE_H diff --git a/projectmanagers/qmake/parser/tests/assignmenttest.h b/projectmanagers/qmake/parser/tests/assignmenttest.h index 10f0450123..6d3bc7092c 100644 --- a/projectmanagers/qmake/parser/tests/assignmenttest.h +++ b/projectmanagers/qmake/parser/tests/assignmenttest.h @@ -1,104 +1,104 @@ /* KDevelop QMake Support * * Copyright 2006 Andreas Pakulat * * 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 ASSIGNMENTTEST_H #define ASSIGNMENTTEST_H #include #include namespace QMake { class StatementAST; class ProjectAST; } class AssignmentTest : public QObject { Q_OBJECT public: explicit AssignmentTest( QObject* parent = nullptr ); ~AssignmentTest() override; - private slots: + private Q_SLOTS: void init(); void cleanup(); void simpleParsed(); void simpleParsed_data(); void assignInValue(); void assignInValue_data(); void commentCont(); void commentCont_data(); void quotedBrace(); void quotedBrace_data(); void quotedVal(); void quotedVal_data(); void quotedValEscapeQuote(); void quotedValEscapeQuote_data(); void dotVariable(); void dotVariable_data(); void underscoreVariable(); void underscoreVariable_data(); void dashVariable(); void dashVariable_data(); void opNoSpace(); void opNoSpace_data(); void opPlusEq(); void opPlusEq_data(); void opTildeEq(); void opTildeEq_data(); void opMinusEq(); void opMinusEq_data(); void opStarEq(); void opStarEq_data(); void opEqual(); void opEqual_data(); void otherVarSimple(); void otherVarSimple_data(); void otherVarBrace(); void otherVarBrace_data(); void otherVarBracket(); void otherVarBracket_data(); void shellVar(); void shellVar_data(); void commandExec(); void commandExec_data(); void bracketVarQuote(); void bracketVarQuote_data(); void pathValue(); void pathValue_data(); void varNameDollar(); void varNameDollar_data(); void commentInMultiline(); void commentInMultiline_data(); void commandExecQMakeVar(); void commandExecQMakeVar_data(); void varComment(); void varComment_data(); void noDashEndVar(); void noDashEndVar_data(); void contAfterComment(); void contAfterComment_data(); private: QMake::ProjectAST* ast; }; #endif diff --git a/projectmanagers/qmake/parser/tests/functionscopetest.h b/projectmanagers/qmake/parser/tests/functionscopetest.h index 589ab04356..c9e5905489 100644 --- a/projectmanagers/qmake/parser/tests/functionscopetest.h +++ b/projectmanagers/qmake/parser/tests/functionscopetest.h @@ -1,86 +1,86 @@ /* KDevelop * * Copyright 2007 Andreas Pakulat * * 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 FUNCTIONSCOPETEST_H #define FUNCTIONSCOPETEST_H #include #include namespace QMake { class StatementAST; class ProjectAST; class FunctionArgAST; } class FunctionScopeTest : public QObject { Q_OBJECT public: explicit FunctionScopeTest( QObject* parent = nullptr ); ~FunctionScopeTest() override; - private slots: + private Q_SLOTS: void init(); void cleanup(); void execSimpleFunc(); void execSimpleFunc_data(); void execBasicFunc(); void execBasicFunc_data(); void evalQMakeSyntax(); void evalQMakeSyntax_data(); void simpleVarArg(); void simpleVarArg_data(); void argWithEqual(); void argWithEqual_data(); void partlyQuotedArg(); void partlyQuotedArg_data(); void slashArg(); void slashArg_data(); void oneStatementScope(); void oneStatementScope_data(); void nestedFunccalls(); void nestedFunccalls_data(); void multiLineScope(); void multiLineScope_data(); void multiLineScopeFuncCall(); void multiLineScopeFuncCall_data(); void oneStatementSubScope(); void oneStatementSubScope_data(); void notFunc(); void notFunc_data(); void orOperator(); void orOperator_data(); void spaceBeforeBrace(); void spaceBeforeBrace_data(); void missingStatement(); void missingStatement_data(); void missingBrace(); void missingBrace_data(); void missingParenthesis(); void missingParenthesis_data(); private: QMake::ProjectAST* ast; }; #endif diff --git a/projectmanagers/qmake/parser/tests/lexertest.h b/projectmanagers/qmake/parser/tests/lexertest.h index 02f8f43ce5..0259629349 100644 --- a/projectmanagers/qmake/parser/tests/lexertest.h +++ b/projectmanagers/qmake/parser/tests/lexertest.h @@ -1,48 +1,48 @@ /* KDevelop * * Copyright 2007 Andreas Pakulat * * 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 LEXERTEST_H #define LEXERTEST_H #include #include class LexerTest : public QObject { Q_OBJECT public: explicit LexerTest( QObject* parent = nullptr ); ~LexerTest() override; - private slots: + private Q_SLOTS: void init(); void cleanup(); void varAssignment(); void varAssignment_data(); void operators(); void operators_data(); void scope(); void scope_data(); void functions(); void functions_data(); }; #endif diff --git a/projectmanagers/qmake/parser/tests/parsetest.h b/projectmanagers/qmake/parser/tests/parsetest.h index 4a33803ce4..a7e75b2549 100644 --- a/projectmanagers/qmake/parser/tests/parsetest.h +++ b/projectmanagers/qmake/parser/tests/parsetest.h @@ -1,54 +1,54 @@ /* KDevelop QMake Support * * Copyright 2006 Andreas Pakulat * * 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 PARSETEST_H #define PARSETEST_H #include #include namespace QMake { class ProjectAST; } class ParseTest : public QObject { Q_OBJECT public: explicit ParseTest( QObject* parent = nullptr ); ~ParseTest() override; - private slots: + private Q_SLOTS: void init(); void cleanup(); void successSimpleProject(); void successSimpleProject_data(); void failSimpleProject(); void failSimpleProject_data(); void successFullProject(); void successFullProject_data(); void failFullProject(); void failFullProject_data(); private: QMake::ProjectAST* ast; }; #endif diff --git a/projectmanagers/qmake/parser/tests/scopetest.h b/projectmanagers/qmake/parser/tests/scopetest.h index f6d7d69d68..dbec366c01 100644 --- a/projectmanagers/qmake/parser/tests/scopetest.h +++ b/projectmanagers/qmake/parser/tests/scopetest.h @@ -1,61 +1,61 @@ /* KDevelop * * Copyright 2007 Andreas Pakulat * * 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 SCOPETEST_H #define SCOPETEST_H #include #include namespace QMake { class StatementAST; class ProjectAST; class FunctionArgAST; } class ScopeTest : public QObject { Q_OBJECT public: explicit ScopeTest( QObject* parent = nullptr ); ~ScopeTest() override; - private slots: + private Q_SLOTS: void init(); void cleanup(); void basicScope(); void basicScope_data(); void basicScopeBrace(); void basicScopeBrace_data(); void nestedScope(); void nestedScope_data(); void missingStatement(); void missingStatement_data(); void missingColon(); void missingColon_data(); void strangeScopeNames(); private: QMake::ProjectAST* ast; }; #endif diff --git a/projectmanagers/qmake/qmakebuilddirchooserdialog.h b/projectmanagers/qmake/qmakebuilddirchooserdialog.h index 7fb6038f38..5f8c8b4f89 100644 --- a/projectmanagers/qmake/qmakebuilddirchooserdialog.h +++ b/projectmanagers/qmake/qmakebuilddirchooserdialog.h @@ -1,59 +1,59 @@ /*************************************************************************** * This file is part of KDevelop * * Copyright (C) 2011 Martin Heide * * Copyright (C) 2011 Julien Desgats * * * * This program 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 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 Library 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 QMAKEBUILDDIRCHOOSERDIALOG_H #define QMAKEBUILDDIRCHOOSERDIALOG_H #include class QMakeBuildDirChooser; class QDialogButtonBox; namespace KDevelop { class IProject; } class QMakeBuildDirChooserDialog : public QDialog { Q_OBJECT public: explicit QMakeBuildDirChooserDialog(KDevelop::IProject* project, QWidget *parent = nullptr); ~QMakeBuildDirChooserDialog() override; void loadConfig(); void saveConfig(); QString buildDir() const; -public slots: +public Q_SLOTS: void accept() override; -private slots: +private Q_SLOTS: void validate(); private: QMakeBuildDirChooser* m_chooserUi; QDialogButtonBox* m_buttonBox; }; #endif diff --git a/projectmanagers/qmake/qmakejob.h b/projectmanagers/qmake/qmakejob.h index 5da47dcbe8..0fd072dc76 100644 --- a/projectmanagers/qmake/qmakejob.h +++ b/projectmanagers/qmake/qmakejob.h @@ -1,68 +1,68 @@ /*************************************************************************** * This file is part of KDevelop * * Copyright 2010 Milian Wolff * * * * This program 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 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 Library 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 QMAKEJOB_H #define QMAKEJOB_H #include #include namespace KDevelop { class OutputModel; } class QProcess; class QMakeJob : public KDevelop::OutputJob { Q_OBJECT public: QMakeJob( QString srcDir, QString buildDir, QObject* parent = nullptr ); void start() override; ~QMakeJob() override; void setQMakePath(const QString& path); void setInstallPrefix(const QString& prefix); void setBuildType(int comboboxSelectedIndex); // --> qmakebuilddirchooser.ui void setExtraArguments(const QString& args); QString errorString() const override; protected: bool doKill() override; -private slots: +private Q_SLOTS: void processError( QProcess::ProcessError error ); void processFinished( int exitCode, QProcess::ExitStatus status ); private: QString m_srcDir; QString m_buildDir; QString m_qmakePath; QString m_installPrefix; int m_buildType; QString m_extraArguments; QProcess* m_process; KDevelop::OutputModel* m_model; }; #endif // QMAKEJOB_H diff --git a/projectmanagers/qmake/qmakemanager.h b/projectmanagers/qmake/qmakemanager.h index 690f58c3a5..ab6c650e32 100644 --- a/projectmanagers/qmake/qmakemanager.h +++ b/projectmanagers/qmake/qmakemanager.h @@ -1,108 +1,108 @@ /* KDevelop QMake Support * * Copyright 2006 Andreas Pakulat * Copyright 2010 Milian Wolff * * 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 QMAKEMANAGER_H #define QMAKEMANAGER_H #include #include class QMakeFolderItem; class IQMakeBuilder; class QMakeCache; class QMakeProjectFile; class QMakeProjectManager : public KDevelop::AbstractFileManagerPlugin, public KDevelop::IBuildSystemManager { Q_OBJECT Q_INTERFACES( KDevelop::IBuildSystemManager ) public: explicit QMakeProjectManager( QObject* parent = nullptr, const QVariantList& args = QVariantList() ); ~QMakeProjectManager() override; static QMakeProjectManager* self(); KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context) override; //BEGIN AbstractFileManager KDevelop::ProjectFolderItem* import( KDevelop::IProject* project ) override; KDevelop::ProjectFolderItem* createFolderItem( KDevelop::IProject* project, const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent = nullptr ) override; Features features() const override; bool isValid( const KDevelop::Path& path, const bool isFolder, KDevelop::IProject* project ) const override; //END AbstractFileManager //BEGIN IBuildSystemManager //TODO KDevelop::IProjectBuilder* builder() const override; KDevelop::Path buildDirectory(KDevelop::ProjectBaseItem*) const override; KDevelop::Path::List collectDirectories(KDevelop::ProjectBaseItem*, const bool collectIncludes=true) const; KDevelop::Path::List includeDirectories(KDevelop::ProjectBaseItem*) const override; KDevelop::Path::List frameworkDirectories(KDevelop::ProjectBaseItem* item) const override; QHash defines(KDevelop::ProjectBaseItem*) const override; bool hasBuildInfo(KDevelop::ProjectBaseItem*) const override; KDevelop::ProjectTargetItem* createTarget( const QString&, KDevelop::ProjectFolderItem* ) override { return nullptr; } bool addFilesToTarget(const QList&, KDevelop::ProjectTargetItem*) override { return false; } bool removeTarget( KDevelop::ProjectTargetItem* ) override { return false; } bool removeFilesFromTargets(const QList&) override { return false; } QList targets(KDevelop::ProjectFolderItem*) const override; //END IBuildSystemManager -private slots: +private Q_SLOTS: void slotFolderAdded( KDevelop::ProjectFolderItem* folder ); void slotRunQMake(); void slotDirty(const QString& path); private: KDevelop::ProjectFolderItem* projectRootItem( KDevelop::IProject* project, const KDevelop::Path& path ); KDevelop::ProjectFolderItem* buildFolderItem( KDevelop::IProject* project, const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent ); QMakeCache* findQMakeCache( KDevelop::IProject* project, const KDevelop::Path &path = {} ) const; IQMakeBuilder* m_builder; mutable QString m_qtIncludeDir; QAction* m_runQMake; QMakeFolderItem* m_actionItem; static QMakeProjectManager* m_self; }; #endif diff --git a/projectmanagers/qmake/tests/test_qmakefile.h b/projectmanagers/qmake/tests/test_qmakefile.h index 28e10a5154..69724a4524 100644 --- a/projectmanagers/qmake/tests/test_qmakefile.h +++ b/projectmanagers/qmake/tests/test_qmakefile.h @@ -1,57 +1,57 @@ /* KDevelop QMake Support * * Copyright 2010 Milian Wolff * * 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 TEST_QMAKEFILE_H #define TEST_QMAKEFILE_H #include class TestQMakeFile : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: void varResolution_data(); void varResolution(); void referenceParser_data(); void referenceParser(); void libTarget_data(); void libTarget(); void defines_data(); void defines(); void replaceFunctions_data(); void replaceFunctions(); void qtIncludeDirs_data(); void qtIncludeDirs(); void testInclude(); void globbing_data(); void globbing(); void benchGlobbing(); void benchGlobbingNoPattern(); }; #endif // TEST_QMAKEFILE_H diff --git a/projectmanagers/qmake/tests/test_qmakeproject.h b/projectmanagers/qmake/tests/test_qmakeproject.h index 6de0a57942..36450b7f15 100644 --- a/projectmanagers/qmake/tests/test_qmakeproject.h +++ b/projectmanagers/qmake/tests/test_qmakeproject.h @@ -1,46 +1,46 @@ /* KDevelop QMake Support * * Copyright 2011 Julien Desgats * * 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 TEST_QMAKEPROJECT_H #define TEST_QMAKEPROJECT_H #include /** * Test project handling related features. Very basic at moment, should be completed. * Project needed for tests are located in manual directory, and path is accessible by * QMAKE_TESTS_PROJECTS_DIR macro. */ class TestQMakeProject : public QObject { Q_OBJECT public: explicit TestQMakeProject(QObject* parent = nullptr); ~TestQMakeProject() override; -private slots: +private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testBuildDirectory_data(); void testBuildDirectory(); }; #endif diff --git a/providers/ghprovider/ghdialog.h b/providers/ghprovider/ghdialog.h index 474f0918be..35442f6b0a 100644 --- a/providers/ghprovider/ghdialog.h +++ b/providers/ghprovider/ghdialog.h @@ -1,99 +1,99 @@ /* This file is part of KDevelop * * Copyright (C) 2012-2013 Miquel Sabaté * * 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 GH_DIALOG_H #define GH_DIALOG_H #include class QLabel; namespace gh { class Account; /** * @class Dialog * * The Dialog class handles the configuration dialog to be shown so the * user can setup its Github account. */ class Dialog : public QDialog { Q_OBJECT public: /** * Constructor. * * @param parent The QWidget this Dialog is parented to. * @param account The user's account. */ explicit Dialog(QWidget *parent, Account *account); -signals: +Q_SIGNALS: /** * This signal is emitted whenever the dialog has successfully performed * an action that may imply some changes on the UI of the plugin. */ void shouldUpdate(); -private slots: +private Q_SLOTS: /** * The "Authorize" button has been clicked. a KPasswordDialog will be * shown and a request will be sent to Github to authenticate the given * user. */ void authorizeClicked(); /** * Handle a response from Github on the authorization process. If the * given id is empty, it means that something went wrong. Otherwise, when * successful, it will also call the syncUser method. * * @param id The id of the authorization. * @param token The authorization token. */ void authorizeResponse(const QByteArray &id, const QByteArray &token, const QString &tokenName); /// Sync the user's groups. void syncUser(); /** * Update the organization list of the current user. * * @param orgs A list of organizations for the current user. */ void updateOrgs(const QStringList& orgs); /// Revoke the access of this application. void revokeAccess(); private: Account *m_account; QString m_name; QLabel *m_text; }; } // End of namespace gh #endif /* GH_DIALOG_H */ diff --git a/providers/ghprovider/ghlineedit.h b/providers/ghprovider/ghlineedit.h index f626045ed1..9a7cb48082 100644 --- a/providers/ghprovider/ghlineedit.h +++ b/providers/ghprovider/ghlineedit.h @@ -1,66 +1,66 @@ /* This file is part of KDevelop * * Copyright (C) 2012-2013 Miquel Sabaté * * 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 GH_LINEEDIT_H #define GH_LINEEDIT_H #include namespace gh { /** * @class LineEdit * * This class is the Line Edit used in the gh::ProviderWidget. It's basically * the same as the QLineEdit class but it emits the returnPressed() signal * when the return key has been pressed. Moreover, it also implements an * internal timer that emits the returnPressed signal when 0.5 seconds have * passed since the user pressed a key. */ class LineEdit : public QLineEdit { Q_OBJECT public: /// Constructor. explicit LineEdit(QWidget *parent = nullptr); /// Destructor. ~LineEdit() override; protected: /// Overridden from QLineEdit. void keyPressEvent(QKeyEvent *e) override; -private slots: +private Q_SLOTS: /// The timer has timed out: stop it and emit the returnPressed signal. void timeOut(); private: QTimer *m_timer; }; } // End of namespace gh #endif // GH_LINEEDIT_H diff --git a/providers/ghprovider/ghproviderwidget.h b/providers/ghprovider/ghproviderwidget.h index 8afcd7a3d4..ce39e7b38f 100644 --- a/providers/ghprovider/ghproviderwidget.h +++ b/providers/ghprovider/ghproviderwidget.h @@ -1,86 +1,86 @@ /* This file is part of KDevelop * * Copyright (C) 2012-2013 Miquel Sabaté * * 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 GH_PROVIDERWIDGET_H #define GH_PROVIDERWIDGET_H #include class QLabel; class QComboBox; class QListView; class QModelIndex; namespace gh { class Resource; class Account; class LineEdit; /** * @class ProviderWidget * * This class will be the widget displayed in the "Fetch Project" dialog * when the user selects this plugin to fetch a project. */ class ProviderWidget : public KDevelop::IProjectProviderWidget { Q_OBJECT public: /// Constructor. explicit ProviderWidget(QWidget *parent = nullptr); /// Re-implemented from KDevelop::IProjectProviderWidget. KDevelop::VcsJob * createWorkingCopy(const QUrl &dest) override; /// Re-implemented from KDevelop::IProjectProviderWidget. bool isCorrect() const override; -private slots: +private Q_SLOTS: /// Fill the m_combo member. void fillCombo(); /// The user has selected a project, change the working directory. void projectIndexChanged(const QModelIndex ¤tIndex); /// Show the settings dialog. void showSettings(); /// Search the repo specified by the user. void searchRepo(); private: QListView *m_projects; Resource *m_resource; LineEdit *m_edit; Account *m_account; QComboBox *m_combo; QLabel *m_waiting; }; } // End of namespace gh #endif // GH_PROVIDERWIDGET_H diff --git a/providers/ghprovider/ghresource.h b/providers/ghprovider/ghresource.h index 425f8c7501..190b4cef25 100644 --- a/providers/ghprovider/ghresource.h +++ b/providers/ghprovider/ghresource.h @@ -1,181 +1,181 @@ /* This file is part of KDevelop * * Copyright (C) 2012-2013 Miquel Sabaté * * 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 GH_RESOURCE_H #define GH_RESOURCE_H #include class KJob; namespace KIO { class Job; class TransferJob; } namespace gh { class ProviderModel; /** * @class Resource * * This class provides methods that extract information from the given * Github's JSON responses. */ class Resource : public QObject { Q_OBJECT public: /** * Constructor. * * @param parent The QObject this Resource is parented to. * @param model The model to be used in the other methods. */ explicit Resource(QObject *parent, ProviderModel *model); /** * Search repos by calling the Github API. When successful, it will re-fill * the model provided in the constructor. Otherwise, if something went * wrong, it will do nothing. * * @param uri A string containing the URI to be called to retrieve * the repos. Therefore, this parameter also determines whether the repos * belong to a user or a organization. * @param token The authorization token. */ void searchRepos(const QString &uri, const QString &token); /** * Get public and private organizations for the currently authenticated * user and save it to its local account. * * @param token The authorization token. */ void getOrgs(const QString &token); /** * Authenticate the current user with the given name and password. * This method will eventually emit the authenticated signal. * * @param name The username of the current user. * @param password The password used to login the current user. */ void authenticate(const QString &name, const QString &password); /** * Revoke an access to the Github API (a.k.a. log out the current user). * * @param id The id of the currently valid authorization. * @param name The name of the current user. * @param password The Github API requires the password again to perform * this action. */ void revokeAccess(const QString &id, const QString &name, const QString &password); private: /** * Get a TransferJob for the given URI and authorization token. * * @param uri The URI to be requested. * @param token The authorization token to be set on the headers. */ KIO::TransferJob * getTransferJob(const QString &uri, const QString &token) const; /** * Retrieve the info of the name and the URL of each repo and append * it in the model that was provided in the constructor. * * @param data A Github response in JSON format. */ void retrieveRepos(const QByteArray &data); /** * Retrieve the organizations for the current user from the given * JSON data. It will emit the orgsUpdated signal. * * @param data A Github response in JSON format. */ void retrieveOrgs(const QByteArray &data); -signals: +Q_SIGNALS: /** * This signal will eventually be sent when the authentication process * has finished. An empty id means that the authentication wasn't * successful. * * @param id The id of the authorization. Empty if something went wrong. * @param token The authorization token (e.g. "14bf8e87e2ec5fe30f8a6755bda63b5bc4d02e22"). * Empty if something went wrong. * @param tokenName The authorization token (e.g. "KDevelop Github Provider : machinename - Thu Nov 17 23:18:03 2016 GMT"). * Empty if something went wrong. */ void authenticated(const QByteArray &id, const QByteArray &token, const QString &tokenName); /** * This signal is emitted when the model containing repos has * been updated. */ void reposUpdated(); /** * This signal is fired when the list of organizations for the current * user has been updated. * * @param orgs A list of the names of the organizations. */ void orgsUpdated(const QStringList &orgs); -private slots: +private Q_SLOTS: /** * Handle the response of the Github authentication process. * * @param job The KJob responsible from the authentication. */ void slotAuthenticate(KJob *job); /** * Handle the response of retrieving repos from Github. * * @param job The job returned after the HTTP request has finished. * @param data The data returned by the HTTP response. */ void slotRepos(KIO::Job *job, const QByteArray &data); /** * Handle the response of retrieving orgs for the currently * authenticated user. * * @param job The job returned after the HTTP request has finished. * @param data The data returned by the HTTP response. */ void slotOrgs(KIO::Job *job, const QByteArray &data); private: ProviderModel *m_model; QByteArray m_temp, m_orgTemp; }; } // End of namespace gh #endif // GH_RESOURCE_H diff --git a/providers/kdeprovider/kdeprojectsreader.h b/providers/kdeprovider/kdeprojectsreader.h index 1a24fd449d..c918f12bcc 100644 --- a/providers/kdeprovider/kdeprojectsreader.h +++ b/providers/kdeprovider/kdeprojectsreader.h @@ -1,49 +1,49 @@ /* This file is part of KDevelop Copyright 2010 Aleix Pol Gonzalez This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 KDEPROJECTSREADER_H #define KDEPROJECTSREADER_H #include "kdeprojectsmodel.h" #include #include class KDEProjectsReader : public QObject { Q_OBJECT public: KDEProjectsReader(KDEProjectsModel* m, QObject* parent); QStringList errors() const { return m_errors; } bool hasErrors() { return !m_errors.isEmpty(); } - public slots: + public Q_SLOTS: void downloadFinished(QNetworkReply* reply); void downloadError(QNetworkReply::NetworkError); - signals: + Q_SIGNALS: void downloadDone(); private: KDevelop::Stack m_current; QStringList m_errors; KDEProjectsModel* m_m; }; #endif // KDEPROJECTSREADER_H diff --git a/providers/kdeprovider/kdeproviderwidget.h b/providers/kdeprovider/kdeproviderwidget.h index 95eb6005d6..b7b0d8b2e3 100644 --- a/providers/kdeprovider/kdeproviderwidget.h +++ b/providers/kdeprovider/kdeproviderwidget.h @@ -1,46 +1,46 @@ /* * This file is part of KDevelop * Copyright 2010 Aleix Pol Gonzalez * * This program 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 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 KDEPROVIDERWIDGET_H #define KDEPROVIDERWIDGET_H #include class QModelIndex; class KFilterProxySearchLine; class QListView; class KDEProviderWidget : public KDevelop::IProjectProviderWidget { Q_OBJECT public: explicit KDEProviderWidget(QWidget* parent = nullptr); KDevelop::VcsJob* createWorkingCopy(const QUrl &destinationDirectory) override; bool isCorrect() const override; - private slots: + private Q_SLOTS: void showSettings(); void projectIndexChanged(const QModelIndex& currentIndex); private: QListView* m_projects; }; #endif // KDEPROVIDERWIDGET_H diff --git a/providers/kdeprovider/tests/test_kdeprojectsreader.h b/providers/kdeprovider/tests/test_kdeprojectsreader.h index 4a3f2d9f36..f74aa771a6 100644 --- a/providers/kdeprovider/tests/test_kdeprojectsreader.h +++ b/providers/kdeprovider/tests/test_kdeprojectsreader.h @@ -1,32 +1,32 @@ /* This file is part of KDevelop Copyright 2010 Aleix Pol Gonzalez This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 TEST_KDEPROJECTSREADER_H #define TEST_KDEPROJECTSREADER_H #include class TestKDEProjectsReader : public QObject { Q_OBJECT - private slots: + private Q_SLOTS: void testsProperParse(); }; #endif // TEST_KDEPROJECTSREADER_H diff --git a/utils/okteta/oktetawidget.h b/utils/okteta/oktetawidget.h index 1886a683c6..0043c114d3 100644 --- a/utils/okteta/oktetawidget.h +++ b/utils/okteta/oktetawidget.h @@ -1,67 +1,67 @@ /* This file is part of the KDevelop Okteta module, part of the KDE project. Copyright 2010 Friedrich W. H. Kossebau This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 6 of version 3 of the license. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef OKTETAWIDGET_H #define OKTETAWIDGET_H // KDE #include // Qt #include namespace Kasten { class ByteArrayView; class AbstractXmlGuiController; } namespace KDevelop { class OktetaPlugin; class OktetaWidget : public QWidget, public KXMLGUIClient { Q_OBJECT public: OktetaWidget( QWidget* parent, Kasten::ByteArrayView* byteArrayView, OktetaPlugin* plugin ); ~OktetaWidget() override; #if 0 - private slots: + private Q_SLOTS: void save(); void editWidgets(); void editBuddys(); void editSignals(); void editTabOrder(); #endif private: void setupActions(OktetaPlugin* plugin); private: Kasten::ByteArrayView* mByteArrayView; // TODO: move this to the plugin, per mainwindow QList mControllers; }; } #endif