File indexing completed on 2024-04-28 11:20:42

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2011 Filipe Saraiva <filipe@kde.org>
0004 */
0005 
0006 #include "scilabbackend.h"
0007 #include "scilabsession.h"
0008 #include "scilabextensions.h"
0009 #include "scilabsettingswidget.h"
0010 #include "settings.h"
0011 
0012 #include <KPluginFactory>
0013 
0014 ScilabBackend::ScilabBackend(QObject* parent,const QList<QVariant> args) : Cantor::Backend(parent, args)
0015 {
0016     new ScilabVariableManagementExtension(this);
0017     new ScilabScriptExtension(this);
0018 }
0019 
0020 ScilabBackend::~ScilabBackend()
0021 {
0022     qDebug()<<"Destroying ScilabBackend";
0023 }
0024 
0025 QString ScilabBackend::id() const
0026 {
0027     return QLatin1String("scilab");
0028 }
0029 
0030 QString ScilabBackend::version() const
0031 {
0032     return QLatin1String("5.5, 6.0");
0033 }
0034 
0035 Cantor::Session* ScilabBackend::createSession()
0036 {
0037     qDebug()<<"Spawning a new Scilab session";
0038 
0039     return new ScilabSession(this);
0040 }
0041 
0042 Cantor::Backend::Capabilities ScilabBackend::capabilities() const
0043 {
0044     return Cantor::Backend::SyntaxHighlighting |
0045            Cantor::Backend::Completion         |
0046            Cantor::Backend::VariableManagement;
0047 }
0048 
0049 bool ScilabBackend::requirementsFullfilled(QString* const reason) const
0050 {
0051     const QString& path = ScilabSettings::self()->path().toLocalFile();
0052     return Cantor::Backend::checkExecutable(QLatin1String("Scilab"), path, reason);
0053 }
0054 
0055 QWidget* ScilabBackend::settingsWidget(QWidget* parent) const
0056 {
0057     return new ScilabSettingsWidget(parent, id());
0058 }
0059 
0060 KConfigSkeleton* ScilabBackend::config() const
0061 {
0062     return ScilabSettings::self();
0063 }
0064 
0065 QUrl ScilabBackend::helpUrl() const
0066 {
0067     return QUrl(i18nc("The url to the documentation of Scilab, please check if there is a translated version and use the correct url",
0068                       "https://www.scilab.org/support/documentation"));
0069 }
0070 
0071 QString ScilabBackend::description() const
0072 {
0073     return i18n("<b>Scilab</b> is a free software, cross-platform numerical computational package and a high-level, numerically oriented programming language." \
0074         "Scilab is distributed under CeCILL license (GPL compatible).");
0075 }
0076 
0077 K_PLUGIN_FACTORY_WITH_JSON(scilabbackend, "scilabbackend.json", registerPlugin<ScilabBackend>();)
0078 #include "scilabbackend.moc"