diff --git a/shell/problem.h b/shell/problem.h index f9a438cff..d5fdd40f0 100644 --- a/shell/problem.h +++ b/shell/problem.h @@ -1,112 +1,112 @@ /* * Copyright 2015 Laszlo Kis-Adam * * 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 PROBLEM_H #define PROBLEM_H #include #include #include #include #include struct DetectedProblemPrivate; namespace KDevelop { /** * @brief Represents a problem as one unit with the IProblem interface so can be used with anything that can handle IProblem. * * You should have it wrapped in an IProblem::Ptr which is a shared pointer for it. * It is basically a mirror of DUChain's Problem class. * However that class is strongly coupled with DUChain's internals due to DUChain's needs (special serialization). * * Usage example: * @code * IProblem::Ptr problem(new DetectedProblem()); * problem->setSource(IProblem::Plugin); * problem->setSeverity(IProblem::Warning); * problem->setDescription(QStringLiteral("Warning message")); * problem->setExplanation(QStringLiteral("Warning explanation")); * * DocumentRange range; * range.document = IndexedString("/path/to/source/file"); * range.setBothLines(1337); * range.setBothColumns(12); * problem->setFinalLocation(range); * @endcode * */ class KDEVPLATFORMSHELL_EXPORT DetectedProblem : public IProblem { public: /// Creates new empty DetectedProblem with default properties: /// severity - KDevelop::IProblem::Error; /// source - KDevelop::IProblem::Unknown; /// finalLocationMode - KDevelop::IProblem::Range. DetectedProblem(); /// Creates new DetectedProblem, produced by some plugin, for example by analyzer plugins /// like cppcheck/clang-tydy/valgrind/etc. /// Default values of problem properties are: /// severity - KDevelop::IProblem::Error; /// source - KDevelop::IProblem::Plugin; /// sourceString - passed pluginName parameter; /// finalLocationMode - KDevelop::IProblem::Range. - DetectedProblem(const QString& pluginName); + explicit DetectedProblem(const QString& pluginName); ~DetectedProblem() override; Source source() const override; void setSource(Source source) override; QString sourceString() const override; DocumentRange finalLocation() const override; void setFinalLocation(const DocumentRange& location) override; FinalLocationMode finalLocationMode() const override; void setFinalLocationMode(FinalLocationMode mode) override; QString description() const override; void setDescription(const QString& description) override; QString explanation() const override; void setExplanation(const QString& explanation) override; Severity severity() const override; void setSeverity(Severity severity) override; QString severityString() const override; QVector diagnostics() const override; void setDiagnostics(const QVector &diagnostics) override; void addDiagnostic(const Ptr &diagnostic) override; void clearDiagnostics() override; QExplicitlySharedDataPointer solutionAssistant() const override; private: QScopedPointer d; }; } #endif diff --git a/shell/settings/environmentprofilemodel.h b/shell/settings/environmentprofilemodel.h index 9c87b1200..271bdc8c1 100644 --- a/shell/settings/environmentprofilemodel.h +++ b/shell/settings/environmentprofilemodel.h @@ -1,78 +1,78 @@ /* This file is part of KDevelop Copyright 2007 Andreas Pakulat Copyright 2017 Friedrich W. H. Kossebau This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KDEVPLATFORM_ENVIRONMENTPROFILEMODEL_H #define KDEVPLATFORM_ENVIRONMENTPROFILEMODEL_H #include #include namespace KDevelop { class EnvironmentProfileListModel; class EnvironmentProfileModel : public QAbstractTableModel { Q_OBJECT public: enum Role { VariableRole = Qt::UserRole + 1, ValueRole }; enum Column { VariableColumn = 0, ValueColumn = 1 }; - EnvironmentProfileModel(EnvironmentProfileListModel* profileListModel, QObject* parent = nullptr); + explicit EnvironmentProfileModel(EnvironmentProfileListModel* profileListModel, QObject* parent = nullptr); int rowCount(const QModelIndex& parent = {}) const override; int columnCount(const QModelIndex& parent = {}) const override; Qt::ItemFlags flags(const QModelIndex& index) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; bool setData(const QModelIndex& index, const QVariant&, int role = Qt::EditRole) override; void setCurrentProfile(const QString& profileName); void addVariable(const QString& variableName, const QString& value); /** * Load a set of environment variables from a plaintext string. * * @p plainText In the form "FOO=1\nBAR=2" */ void setVariablesFromString(const QString& plainText); void removeVariable(const QString& variableName); void removeVariables(const QStringList& variableNames); private: void onProfileAboutToBeRemoved(const QString& profileName); private: QStringList m_varsByIndex; QString m_currentProfileName; EnvironmentProfileListModel* m_profileListModel; }; } #endif diff --git a/vcs/models/vcseventmodel.h b/vcs/models/vcseventmodel.h index dc2dc5f6c..e1ac7e578 100644 --- a/vcs/models/vcseventmodel.h +++ b/vcs/models/vcseventmodel.h @@ -1,96 +1,96 @@ /*************************************************************************** * This file is part of KDevelop * * Copyright 2007 Andreas Pakulat * * * * 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 KDEVPLATFORM_VCSEVENTMODEL_H #define KDEVPLATFORM_VCSEVENTMODEL_H #include #include #include class QUrl; class KJob; namespace KDevelop { class VcsRevision; class IBasicVersionControl; class VcsEvent; /** * This is a generic model to store a list of VcsEvents. * * To add events use @c addEvents */ class KDEVPLATFORMVCS_EXPORT VcsBasicEventModel : public QAbstractTableModel { Q_OBJECT public: enum Column { RevisionColumn, SummaryColumn, AuthorColumn, DateColumn, ColumnCount, }; - VcsBasicEventModel(QObject* parent); + explicit VcsBasicEventModel(QObject* parent); ~VcsBasicEventModel() override; int rowCount(const QModelIndex& = QModelIndex()) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; QVariant data(const QModelIndex&, int role = Qt::DisplayRole) const override; QVariant headerData(int, Qt::Orientation, int role = Qt::DisplayRole) const override; KDevelop::VcsEvent eventForIndex(const QModelIndex&) const; protected: void addEvents(const QList&); private: QScopedPointer d; }; /** * This model stores a list of VcsEvents corresponding to the log obtained * via IBasicVersionControl::log for a given revision. The model is populated * lazily via @c fetchMore. */ class KDEVPLATFORMVCS_EXPORT VcsEventLogModel : public VcsBasicEventModel { Q_OBJECT public: VcsEventLogModel(KDevelop::IBasicVersionControl* iface, const KDevelop::VcsRevision& rev, const QUrl& url, QObject* parent); ~VcsEventLogModel() override; /// Adds events to the model via @sa IBasicVersionControl::log void fetchMore(const QModelIndex& parent) override; bool canFetchMore(const QModelIndex& parent) const override; private slots: void jobReceivedResults( KJob* job ); private: QScopedPointer d; }; } #endif