[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [cantor] src: - change the font of the help panel to monospace
From: Alexander Rieder <alexanderrieder () gmail ! com>
Date: 2014-02-04 20:16:13
Message-ID: E1WAmPl-0006yG-0b () scm ! kde ! org
[Download RAW message or body]
Git commit a2f20c1659a46b4ea7493b04500068947a62fd48 by Alexander Rieder.
Committed on 04/02/2014 at 20:12.
Pushed by arieder into branch 'master'.
- change the font of the help panel to monospace
- escape spaces in the help messages, as they might be important for formatting
Patch by Yichao Zhou, thanks!
BUG: 329106
M +2 -0 src/backends/R/rexpression.cpp
M +3 -0 src/backends/octave/octaveexpression.cpp
M +3 -0 src/backends/sage/sageexpression.cpp
M +13 -2 src/panelplugins/helppanel/helppanelplugin.cpp
M +1 -0 src/panelplugins/helppanel/helppanelplugin.h
http://commits.kde.org/cantor/a2f20c1659a46b4ea7493b04500068947a62fd48
diff --git a/src/backends/R/rexpression.cpp b/src/backends/R/rexpression.cpp
index 894e9d3..9548479 100644
--- a/src/backends/R/rexpression.cpp
+++ b/src/backends/R/rexpression.cpp
@@ -119,6 +119,8 @@ void RExpression::showFilesAsResult(const QStringList& files)
QString content=QTextStream(&f).readAll();
if (!type->is("text/html"))
{
+ //Escape whitespace
+ content.replace( ' ', " ");
//replace appearing backspaces, as they mess the whole output up
content.remove(QRegExp(".\b"));
//Replace < and > with their html code, so they won't be confused as \
html tags
diff --git a/src/backends/octave/octaveexpression.cpp \
b/src/backends/octave/octaveexpression.cpp index e15189e..ec0df20 100644
--- a/src/backends/octave/octaveexpression.cpp
+++ b/src/backends/octave/octaveexpression.cpp
@@ -109,6 +109,9 @@ void OctaveExpression::parseOutput ( QString output )
{
if (command().contains("help"))
{
+ //Escape whitespace
+ m_resultString.replace( ' ', " ");
+
setResult(new Cantor::HelpResult(m_resultString));
}
else
diff --git a/src/backends/sage/sageexpression.cpp \
b/src/backends/sage/sageexpression.cpp index fbde7c1..cbb4f36 100644
--- a/src/backends/sage/sageexpression.cpp
+++ b/src/backends/sage/sageexpression.cpp
@@ -203,6 +203,9 @@ void SageExpression::evalFinished()
if (m_isHelpRequest)
{
+ //Escape whitespace
+ stripped.replace( ' ', " ");
+
//make things quoted in `` `` bold
stripped.replace(QRegExp("``([^`]*)``"), "<b>\\1</b>");
diff --git a/src/panelplugins/helppanel/helppanelplugin.cpp \
b/src/panelplugins/helppanel/helppanelplugin.cpp index ccea79a..2fcb848 100644
--- a/src/panelplugins/helppanel/helppanelplugin.cpp
+++ b/src/panelplugins/helppanel/helppanelplugin.cpp
@@ -39,16 +39,27 @@ QWidget* HelpPanelPlugin::widget()
if(m_edit==0)
{
m_edit=new KTextEdit(parentWidget());
- m_edit->setText(i18n("<h1>Cantor</h1>The KDE way to do Mathematics"));
+ setHelpHtml(i18n("<h1>Cantor</h1>The KDE way to do Mathematics"));
m_edit->setTextInteractionFlags(Qt::TextBrowserInteraction);
- connect(parent()->parent(), SIGNAL(showHelp(QString)), m_edit, \
SLOT(setHtml(QString))); + connect(parent()->parent(), \
SIGNAL(showHelp(QString)), this, SLOT(setHelpHtml(QString)));
connect(parent()->parent(), SIGNAL(showHelp(QString)), this, \
SIGNAL(visibilityRequested())); }
return m_edit;
}
+void HelpPanelPlugin::setHelpHtml(const QString& help)
+{
+ if(!m_edit)
+ return;
+
+ m_edit->setHtml(help);
+ m_edit->selectAll();
+ m_edit->setFontFamily("Monospace");
+ m_edit->moveCursor(QTextCursor::Start);
+}
+
void HelpPanelPlugin::showHelp(const QString& help)
{
if(m_edit)
diff --git a/src/panelplugins/helppanel/helppanelplugin.h \
b/src/panelplugins/helppanel/helppanelplugin.h index 6f7d59a..f180dea 100644
--- a/src/panelplugins/helppanel/helppanelplugin.h
+++ b/src/panelplugins/helppanel/helppanelplugin.h
@@ -36,6 +36,7 @@ class HelpPanelPlugin : public Cantor::PanelPlugin
QWidget* widget();
public slots:
+ void setHelpHtml(const QString& help);
void showHelp(const QString& help);
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic