Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Education
Cantor
Commits
c0811bef
Commit
c0811bef
authored
Sep 14, 2019
by
Alexander Semke
Browse files
Made couple of functions pure virtual in backend.h.
parent
8803a9a8
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/backends/null/nullbackend.cpp
View file @
c0811bef
...
...
@@ -57,5 +57,32 @@ Cantor::Backend::Capabilities NullBackend::capabilities() const
return
Cantor
::
Backend
::
Nothing
;
}
QWidget
*
NullBackend
::
settingsWidget
(
QWidget
*
parent
)
const
{
Q_UNUSED
(
parent
)
return
nullptr
;
}
KConfigSkeleton
*
NullBackend
::
config
()
const
{
return
nullptr
;
}
QUrl
NullBackend
::
helpUrl
()
const
{
return
QUrl
();
}
QString
NullBackend
::
version
()
const
{
return
QLatin1String
();
}
bool
NullBackend
::
requirementsFullfilled
(
QString
*
const
reason
)
const
{
Q_UNUSED
(
reason
);
return
true
;
}
K_PLUGIN_FACTORY_WITH_JSON
(
nullbackend
,
"nullbackend.json"
,
registerPlugin
<
NullBackend
>
();)
#include
"nullbackend.moc"
src/backends/null/nullbackend.h
View file @
c0811bef
...
...
@@ -34,7 +34,11 @@ class NullBackend : public Cantor::Backend
Cantor
::
Session
*
createSession
()
override
;
Cantor
::
Backend
::
Capabilities
capabilities
()
const
override
;
QWidget
*
settingsWidget
(
QWidget
*
parent
)
const
override
;
KConfigSkeleton
*
config
()
const
override
;
bool
requirementsFullfilled
(
QString
*
const
reason
)
const
override
;
QUrl
helpUrl
()
const
override
;
QString
version
()
const
override
;
};
...
...
src/backends/python2/python2backend.cpp
View file @
c0811bef
...
...
@@ -86,5 +86,11 @@ KConfigSkeleton* Python2Backend::config() const
return
PythonSettings
::
self
();
}
bool
Python2Backend
::
requirementsFullfilled
(
QString
*
const
reason
)
const
{
const
QString
&
path
=
QStandardPaths
::
findExecutable
(
QLatin1String
(
"cantor_python2server"
));
return
Cantor
::
Backend
::
checkExecutable
(
QLatin1String
(
"Cantor Python2 Server"
),
path
,
reason
);
}
K_PLUGIN_FACTORY_WITH_JSON
(
python2backend
,
"python2backend.json"
,
registerPlugin
<
Python2Backend
>
();)
#include
"python2backend.moc"
src/backends/python2/python2backend.h
View file @
c0811bef
...
...
@@ -36,7 +36,7 @@ class Python2Backend : public PythonBackend
Cantor
::
Backend
::
Capabilities
capabilities
()
const
override
;
QUrl
helpUrl
()
const
override
;
QString
description
()
const
override
;
bool
requirementsFullfilled
(
QString
*
const
reason
=
nullptr
)
const
override
;
KConfigSkeleton
*
config
()
const
override
;
};
...
...
src/backends/python3/python3backend.cpp
View file @
c0811bef
...
...
@@ -82,5 +82,11 @@ KConfigSkeleton* Python3Backend::config() const
return
PythonSettings
::
self
();
}
bool
Python3Backend
::
requirementsFullfilled
(
QString
*
const
reason
)
const
{
const
QString
&
path
=
QStandardPaths
::
findExecutable
(
QLatin1String
(
"cantor_python3server"
));
return
Cantor
::
Backend
::
checkExecutable
(
QLatin1String
(
"Cantor Python3 Server"
),
path
,
reason
);
}
K_PLUGIN_FACTORY_WITH_JSON
(
python3backend
,
"python3backend.json"
,
registerPlugin
<
Python3Backend
>
();)
#include
"python3backend.moc"
src/backends/python3/python3backend.h
View file @
c0811bef
...
...
@@ -35,7 +35,7 @@ class Python3Backend : public PythonBackend
Cantor
::
Backend
::
Capabilities
capabilities
()
const
override
;
QUrl
helpUrl
()
const
override
;
QString
description
()
const
override
;
bool
requirementsFullfilled
(
QString
*
const
reason
=
nullptr
)
const
override
;
KConfigSkeleton
*
config
()
const
override
;
};
...
...
src/lib/backend.cpp
View file @
c0811bef
...
...
@@ -71,21 +71,11 @@ QString Backend::icon() const
return
d
->
icon
;
}
QString
Backend
::
version
()
const
{
return
QLatin1String
();
}
QString
Backend
::
url
()
const
{
return
d
->
url
;
}
QUrl
Backend
::
helpUrl
()
const
{
return
QUrl
();
}
bool
Backend
::
isEnabled
()
const
{
return
d
->
enabled
&&
requirementsFullfilled
();
...
...
@@ -168,17 +158,6 @@ Backend* Backend::getBackend(const QString& name)
return
nullptr
;
}
QWidget
*
Backend
::
settingsWidget
(
QWidget
*
parent
)
const
{
Q_UNUSED
(
parent
)
return
nullptr
;
}
KConfigSkeleton
*
Backend
::
config
()
const
{
return
nullptr
;
}
QStringList
Backend
::
extensions
()
const
{
QList
<
Extension
*>
extensions
=
findChildren
<
Extension
*>
(
QRegularExpression
(
QLatin1String
(
".*Extension"
)));
...
...
@@ -193,12 +172,6 @@ Extension* Backend::extension(const QString& name) const
return
findChild
<
Extension
*>
(
name
);
}
bool
Backend
::
requirementsFullfilled
(
QString
*
const
reason
)
const
{
Q_UNUSED
(
reason
);
return
true
;
}
bool
Backend
::
checkExecutable
(
const
QString
&
name
,
const
QString
&
path
,
QString
*
reason
)
{
if
(
path
.
isEmpty
())
...
...
src/lib/backend.h
View file @
c0811bef
...
...
@@ -83,6 +83,7 @@ class CANTOR_EXPORT Backend : public QObject, public KXMLGUIClient
* Destructor. Doesn't anything.
*/
~
Backend
()
override
;
public:
/**
...
...
@@ -103,7 +104,7 @@ class CANTOR_EXPORT Backend : public QObject, public KXMLGUIClient
* @return @c false some requirements are missing. e.g. the maxima executable can not be found
* @see Capability
*/
virtual
bool
requirementsFullfilled
(
QString
*
const
reason
=
nullptr
)
const
;
virtual
bool
requirementsFullfilled
(
QString
*
const
reason
=
nullptr
)
const
=
0
;
/**
* Returns a unique string to identify this backend.
...
...
@@ -116,7 +117,7 @@ class CANTOR_EXPORT Backend : public QObject, public KXMLGUIClient
* Returns the recommended version of the backend supported by Cantor
* @return the recommended version of the backend
*/
virtual
QString
version
()
const
;
virtual
QString
version
()
const
=
0
;
//Stuff extracted from the .desktop file
/**
...
...
@@ -148,7 +149,7 @@ class CANTOR_EXPORT Backend : public QObject, public KXMLGUIClient
* "http://docs.kde.org/stable/en/kdeedu/kalgebra/");
* @return Url of the help
*/
virtual
QUrl
helpUrl
()
const
;
virtual
QUrl
helpUrl
()
const
=
0
;
/**
* Returns if the backend should be enabled (shown in the Backend dialog)
* @return @c true, if the enabled flag is set to true, and the requirements are fulfilled
...
...
@@ -172,13 +173,13 @@ class CANTOR_EXPORT Backend : public QObject, public KXMLGUIClient
* Returns a Widget for configuring this backend
* @return Widget for usage in the Settings dialog
*/
virtual
QWidget
*
settingsWidget
(
QWidget
*
parent
)
const
;
virtual
QWidget
*
settingsWidget
(
QWidget
*
parent
)
const
=
0
;
/**
* Returns a KConfig object, containing all the settings,
* the backend might need
* @return a KConfigSkeleton object, for configuring this backend
*/
virtual
KConfigSkeleton
*
config
()
const
;
virtual
KConfigSkeleton
*
config
()
const
=
0
;
/**
* Returns a list of the names of all the Extensions supported by this backend
* @return a list of the names of all the Extensions supported by this backend
...
...
@@ -190,7 +191,7 @@ class CANTOR_EXPORT Backend : public QObject, public KXMLGUIClient
* if the Backend doesn't have an extension with this name.
* @return Pointer to the Extension object with the given name
*/
Extension
*
extension
(
const
QString
&
name
)
const
;
Extension
*
extension
(
const
QString
&
name
)
const
;
/**
* Returns a list of the names of all the installed and enabled backends
...
...
@@ -215,6 +216,7 @@ class CANTOR_EXPORT Backend : public QObject, public KXMLGUIClient
* In case the requrements are not fullfilled, the reason is written to @c reason.
*/
static
bool
checkExecutable
(
const
QString
&
name
,
const
QString
&
path
,
QString
*
reason
);
private:
BackendPrivate
*
d
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment