Commit 8e7e4028 authored by Alexander Semke's avatar Alexander Semke
Browse files

Minor cleanup in the help panel plugin.

parent 3e81757c
Pipeline #24491 passed with stage
in 19 minutes and 14 seconds
...@@ -21,14 +21,11 @@ ...@@ -21,14 +21,11 @@
#include "helppanelplugin.h" #include "helppanelplugin.h"
#include <KLocalizedString> #include <KLocalizedString>
#include <KTextEdit> #include <KTextEdit>
#include "cantor_macros.h"
HelpPanelPlugin::HelpPanelPlugin(QObject* parent, QList<QVariant> args) : Cantor::PanelPlugin(parent) HelpPanelPlugin::HelpPanelPlugin(QObject* parent, const QList<QVariant>& args) : Cantor::PanelPlugin(parent), m_edit(nullptr)
{ {
Q_UNUSED(args); Q_UNUSED(args);
m_edit=nullptr;
} }
HelpPanelPlugin::~HelpPanelPlugin() HelpPanelPlugin::~HelpPanelPlugin()
...@@ -38,12 +35,13 @@ HelpPanelPlugin::~HelpPanelPlugin() ...@@ -38,12 +35,13 @@ HelpPanelPlugin::~HelpPanelPlugin()
QWidget* HelpPanelPlugin::widget() QWidget* HelpPanelPlugin::widget()
{ {
if(m_edit==nullptr) if(!m_edit)
{ {
m_edit=new KTextEdit(parentWidget()); m_edit = new KTextEdit(parentWidget());
setHelpHtml(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); m_edit->setTextInteractionFlags(Qt::TextBrowserInteraction);
//using old-style syntax here, otherwise we'd need to include and link to CantorPart and KParts
connect(parent()->parent(), SIGNAL(showHelp(QString)), this, SLOT(setHelpHtml(QString))); connect(parent()->parent(), SIGNAL(showHelp(QString)), this, SLOT(setHelpHtml(QString)));
connect(parent()->parent(), SIGNAL(showHelp(QString)), this, SIGNAL(visibilityRequested())); connect(parent()->parent(), SIGNAL(showHelp(QString)), this, SIGNAL(visibilityRequested()));
} }
...@@ -73,7 +71,5 @@ bool HelpPanelPlugin::showOnStartup() ...@@ -73,7 +71,5 @@ bool HelpPanelPlugin::showOnStartup()
return false; return false;
} }
K_PLUGIN_FACTORY_WITH_JSON(helppanelplugin, "helppanelplugin.json", registerPlugin<HelpPanelPlugin>();) K_PLUGIN_FACTORY_WITH_JSON(helppanelplugin, "helppanelplugin.json", registerPlugin<HelpPanelPlugin>();)
#include "helppanelplugin.moc" #include "helppanelplugin.moc"
...@@ -23,14 +23,13 @@ ...@@ -23,14 +23,13 @@
#include "panelplugin.h" #include "panelplugin.h"
class KTextEdit; class KTextEdit;
class HelpPanelPlugin : public Cantor::PanelPlugin class HelpPanelPlugin : public Cantor::PanelPlugin
{ {
Q_OBJECT Q_OBJECT
public: public:
HelpPanelPlugin( QObject* parent, QList<QVariant> args); HelpPanelPlugin(QObject* parent, const QList<QVariant>& args);
~HelpPanelPlugin() override; ~HelpPanelPlugin() override;
QWidget* widget() override; QWidget* widget() override;
...@@ -38,8 +37,8 @@ class HelpPanelPlugin : public Cantor::PanelPlugin ...@@ -38,8 +37,8 @@ class HelpPanelPlugin : public Cantor::PanelPlugin
bool showOnStartup() override; bool showOnStartup() override;
public Q_SLOTS: public Q_SLOTS:
void setHelpHtml(const QString& help); void setHelpHtml(const QString&);
void showHelp(const QString& help); void showHelp(const QString&);
private: private:
QPointer<KTextEdit> m_edit; QPointer<KTextEdit> m_edit;
......
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