Commit e2f3cbbf authored by Morten Volden's avatar Morten Volden
Browse files

Move implementation of hasError and setHasError to iplugin.

Adapt to the move of hasError and setErrorDescription. Unify the way plugins report errors when failing .
Differential Revision: https://phabricator.kde.org/D2193
parent 9cb910b9
......@@ -38,13 +38,9 @@ KDevNinjaBuilderPlugin::KDevNinjaBuilderPlugin(QObject* parent, const QVariantLi
: KDevelop::IPlugin("kdevninja", parent)
{
KDEV_USE_EXTENSION_INTERFACE( KDevelop::IProjectBuilder )
if(hasError())
qWarning() << "Ninja plugin installed but ninja is not installed.";
}
bool KDevNinjaBuilderPlugin::hasError() const
{
return NinjaJob::ninjaBinary().isEmpty();
if(NinjaJob::ninjaBinary().isEmpty()) {
setErrorDescription(i18n("Unable to find ninja executable. Is it installed on the system?"));
}
}
static QStringList targetsInFolder(KDevelop::ProjectFolderItem* item)
......
......@@ -33,7 +33,6 @@ class KDevNinjaBuilderPlugin : public KDevelop::IPlugin, KDevelop::IProjectBuild
Q_INTERFACES( KDevelop::IProjectBuilder )
public:
KDevNinjaBuilderPlugin(QObject* parent = 0, const QVariantList& args = QVariantList());
bool hasError() const override;
KJob* build(KDevelop::ProjectBaseItem* item) override;
KJob* clean(KDevelop::ProjectBaseItem* item) override;
......
......@@ -55,6 +55,7 @@ CMakeDocumentation::CMakeDocumentation(QObject* parent, const QVariantList&)
KDEV_USE_EXTENSION_INTERFACE( ICMakeDocumentation )
if (mCMakeCmd.isEmpty()) {
setErrorDescription(i18n("Unable to find cmake executable. Is it installed on the system?") );
return;
}
......@@ -63,16 +64,6 @@ CMakeDocumentation::CMakeDocumentation(QObject* parent, const QVariantList&)
initializeModel();
}
bool CMakeDocumentation::hasError() const
{
return mCMakeCmd.isEmpty();
}
QString CMakeDocumentation::errorDescription() const
{
return mCMakeCmd.isEmpty() ? i18n("cmake is not installed") : QString();
}
static const char* args[] = { "--help-command", "--help-variable", "--help-module", "--help-property", 0, 0 };
void CMakeDocumentation::delayedInitialization()
......
......@@ -41,9 +41,6 @@ class CMakeDocumentation : public KDevelop::IPlugin, public ICMakeDocumentation
public:
explicit CMakeDocumentation( QObject* parent = 0, const QVariantList& args = QVariantList() );
bool hasError() const override;
QString errorDescription() const override;
KDevelop::IDocumentation::Ptr description(const QString& identifier, const QUrl &file) const override;
KDevelop::IDocumentation::Ptr documentationForDeclaration(KDevelop::Declaration* declaration) const override;
......
......@@ -89,7 +89,8 @@ CMakeManager::CMakeManager( QObject* parent, const QVariantList& )
KDEV_USE_EXTENSION_INTERFACE( KDevelop::ILanguageSupport )
KDEV_USE_EXTENSION_INTERFACE( ICMakeManager)
if (hasError()) {
if (CMake::findExecutable().isEmpty()) {
setErrorDescription(i18n("Unable to find cmake executable. Is it installed on the system?"));
m_highlight = nullptr;
return;
}
......@@ -107,16 +108,6 @@ CMakeManager::CMakeManager( QObject* parent, const QVariantList& )
// connect(m_fileSystemChangeTimer,SIGNAL(timeout()),SLOT(filesystemBuffererTimeout()));
}
bool CMakeManager::hasError() const
{
return CMake::findExecutable().isEmpty();
}
QString CMakeManager::errorDescription() const
{
return hasError() ? i18n("cmake is not installed") : QString();
}
CMakeManager::~CMakeManager()
{
parseLock()->lockForWrite();
......
......@@ -81,9 +81,6 @@ public:
~CMakeManager() override;
bool hasError() const override;
QString errorDescription() const override;
Features features() const override { return Features(Folders | Targets | Files ); }
KDevelop::IProjectBuilder* builder() const override;
bool hasBuildInfo(KDevelop::ProjectBaseItem*) const override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment