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
bdcc740e
Commit
bdcc740e
authored
Jul 01, 2020
by
Shubham .
Browse files
Include session in DocumentationPanel
parent
3782766d
Changes
9
Hide whitespace changes
Inline
Side-by-side
documentation/CMakeLists.txt
View file @
bdcc740e
add_subdirectory
(
m
axima
)
add_subdirectory
(
M
axima
)
documentation/
m
axima/CMakeLists.txt
→
documentation/
M
axima/CMakeLists.txt
View file @
bdcc740e
File moved
documentation/
m
axima/help.qch
→
documentation/
M
axima/help.qch
View file @
bdcc740e
File moved
documentation/
m
axima/help.qhc
→
documentation/
M
axima/help.qhc
View file @
bdcc740e
File moved
src/panelplugins/documentationpanel/documentationpanelplugin.cpp
View file @
bdcc740e
...
...
@@ -19,6 +19,7 @@
*/
#include "documentationpanelplugin.h"
#include "session.h"
DocumentationPanelPlugin
::
DocumentationPanelPlugin
(
QObject
*
parent
,
QList
<
QVariant
>
args
)
:
Cantor
::
PanelPlugin
(
parent
),
m_widget
(
nullptr
)
{
...
...
@@ -30,11 +31,17 @@ DocumentationPanelPlugin::~DocumentationPanelPlugin()
delete
m_widget
;
}
void
DocumentationPanelPlugin
::
onSessionChanged
()
{
if
(
m_widget
)
m_widget
->
setSession
(
session
());
}
QWidget
*
DocumentationPanelPlugin
::
widget
()
{
if
(
!
m_widget
)
{
m_widget
=
new
DocumentationPanelWidget
(
parentWidget
());
m_widget
=
new
DocumentationPanelWidget
(
session
(),
parentWidget
());
connect
(
parent
()
->
parent
(),
SIGNAL
(
requestDocumentation
(
QString
)),
m_widget
,
SLOT
(
contextSensitiveHelp
(
QString
)));
connect
(
parent
()
->
parent
(),
SIGNAL
(
requestDocumentation
(
QString
)),
this
,
SIGNAL
(
visibilityRequested
()));
}
...
...
src/panelplugins/documentationpanel/documentationpanelplugin.h
View file @
bdcc740e
...
...
@@ -37,6 +37,9 @@ class DocumentationPanelPlugin : public Cantor::PanelPlugin
bool
showOnStartup
()
override
;
protected:
void
onSessionChanged
()
override
;
private:
QPointer
<
DocumentationPanelWidget
>
m_widget
;
};
...
...
src/panelplugins/documentationpanel/documentationpanelwidget.cpp
View file @
bdcc740e
...
...
@@ -20,6 +20,7 @@
#include "cantor_macros.h"
#include "documentationpanelplugin.h"
#include "session.h"
#include <KLocalizedString>
...
...
@@ -41,10 +42,11 @@
#include <QWebEngineView>
#include <QWidget>
DocumentationPanelWidget
::
DocumentationPanelWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
m_engine
(
nullptr
),
m_textBrowser
(
nullptr
),
m_tabWidget
(
nullptr
),
m_splitter
(
nullptr
)
DocumentationPanelWidget
::
DocumentationPanelWidget
(
Cantor
::
Session
*
session
,
QWidget
*
parent
)
:
QWidget
(
parent
),
m_engine
(
nullptr
),
m_textBrowser
(
nullptr
),
m_tabWidget
(
nullptr
),
m_splitter
(
nullptr
)
,
m_session
(
nullptr
)
{
const
QString
backendName
=
QLatin1String
(
"maxima"
);
const
QString
fileName
=
QStandardPaths
::
locate
(
QStandardPaths
::
AppDataLocation
,
QLatin1String
(
"documentation/"
)
+
backendName
+
QLatin1String
(
"/help.qhc"
));
const
QString
backend
=
session
->
backend
()
->
name
();
qDebug
()
<<
backend
;
const
QString
fileName
=
QStandardPaths
::
locate
(
QStandardPaths
::
AppDataLocation
,
QLatin1String
(
"documentation/"
)
+
backend
+
QLatin1String
(
"/help.qhc"
));
m_engine
=
new
QHelpEngine
(
fileName
,
this
);
if
(
!
m_engine
->
setupData
())
...
...
@@ -96,6 +98,13 @@ DocumentationPanelWidget::DocumentationPanelWidget(QWidget* parent) :QWidget(par
connect
(
m_engine
->
contentWidget
(),
&
QHelpContentWidget
::
linkActivated
,
this
,
&
DocumentationPanelWidget
::
displayHelp
);
connect
(
m_engine
->
indexWidget
(),
&
QHelpIndexWidget
::
linkActivated
,
this
,
&
DocumentationPanelWidget
::
displayHelp
);
//connect(search, SIGNAL(clicked(bool)), this, SLOT(doSearch(QString)));
setSession
(
session
);
}
void
DocumentationPanelWidget
::
setSession
(
Cantor
::
Session
*
session
)
{
m_session
=
session
;
}
void
DocumentationPanelWidget
::
displayHelp
(
const
QUrl
&
url
)
...
...
@@ -130,30 +139,23 @@ void DocumentationPanelWidget::contextSensitiveHelp(const QString& keyword)
void
DocumentationPanelWidget
::
loadDocumentation
()
{
//1. Get the backend name
//2. Load their documentation
const
QString
backendName
=
QLatin1String
(
"maxima"
);
const
QString
fileName
=
QStandardPaths
::
locate
(
QStandardPaths
::
AppDataLocation
,
QLatin1String
(
"documentation/"
)
+
backendName
+
QLatin1String
(
"/help.qch"
));
const
QString
backend
=
backendName
();
const
QString
fileName
=
QStandardPaths
::
locate
(
QStandardPaths
::
AppDataLocation
,
QLatin1String
(
"documentation/"
)
+
backend
+
QLatin1String
(
"/help.qch"
));
m_engine
->
registerDocumentation
(
fileName
);
}
void
DocumentationPanelWidget
::
unloadDocumentation
()
{
//1. Get the backend name
//2. Unload their documentation
//Call this function when the user changes the current backend
m_engine
->
unregisterDocumentation
(
QLatin1String
(
"org.kde.cantor"
));
}
QIcon
DocumentationPanelWidget
::
icon
()
const
{
// return backend's icon
return
QIcon
();
return
QIcon
::
fromTheme
(
m_session
->
backend
()
->
icon
());
}
QString
DocumentationPanelWidget
::
n
ame
()
const
QString
DocumentationPanelWidget
::
backendN
ame
()
const
{
// return backend's name
return
QString
(
QLatin1String
(
"maxima"
));
return
QString
(
QLatin1String
(
"Maxima"
));
//m_session->backend()->name();
}
src/panelplugins/documentationpanel/documentationpanelwidget.h
View file @
bdcc740e
...
...
@@ -24,6 +24,10 @@
#include <QPointer>
#include <QWidget>
namespace
Cantor
{
class
Session
;
}
class
QHelpEngine
;
class
QSplitter
;
class
QTabWidget
;
...
...
@@ -35,14 +39,16 @@ class DocumentationPanelWidget : public QWidget
Q_OBJECT
public:
DocumentationPanelWidget
(
QWidget
*
);
DocumentationPanelWidget
(
Cantor
::
Session
*
session
,
QWidget
*
parent
);
~
DocumentationPanelWidget
()
override
=
default
;
void
setSession
(
Cantor
::
Session
*
session
);
/** @return icon of the current backend **/
QIcon
icon
()
const
;
/** @return name of the current backend **/
QString
n
ame
()
const
;
QString
backendN
ame
()
const
;
void
loadDocumentation
();
void
unloadDocumentation
();
...
...
@@ -58,7 +64,7 @@ class DocumentationPanelWidget : public QWidget
QPointer
<
QTabWidget
>
m_tabWidget
;
QPointer
<
QSplitter
>
m_splitter
;
// later add member variable for path to help files
Cantor
::
Session
*
m_session
;
};
#endif
/* _DOCUMENTATIONPANELWIDGET_H */
src/panelplugins/variablemgr/variablemanagerwidget.h
View file @
bdcc740e
...
...
@@ -34,7 +34,7 @@ class VariableManagerWidget : public QWidget
{
Q_OBJECT
public:
VariableManagerWidget
(
Cantor
::
Session
*
session
,
QWidget
*
parent
);
VariableManagerWidget
(
Cantor
::
Session
*
session
,
QWidget
*
parent
);
~
VariableManagerWidget
()
override
=
default
;
void
setSession
(
Cantor
::
Session
*
session
);
...
...
Write
Preview
Markdown
is supported
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