[education/rkward] /: Allow to turn off mouseover object hints

Thomas Friedrichsmeier null at kde.org
Mon Jun 20 20:36:18 BST 2022


Git commit b22a6c476e9e12402dd44135974c99f1e0be2445 by Thomas Friedrichsmeier.
Committed on 20/06/2022 at 19:35.
Pushed by tfry into branch 'master'.

Allow to turn off mouseover object hints

M  +0    -1    ChangeLog
M  +1    -1    rkward/rkconsole.cpp
M  +1    -1    rkward/settings/rksettingsmodulecommandeditor.cpp
M  +2    -1    rkward/settings/rksettingsmodulecommandeditor.h
M  +1    -1    rkward/windows/rkcommandeditorwindow.cpp
M  +3    -1    rkward/windows/rktexthints.cpp
M  +4    -1    rkward/windows/rktexthints.h

https://invent.kde.org/education/rkward/commit/b22a6c476e9e12402dd44135974c99f1e0be2445

diff --git a/ChangeLog b/ChangeLog
index e39d597d..97b54d41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,6 @@
 - Many new basic and advanced R, R Markdown and LaTeX snippets
 	- Complex R Markdown template part of the snippets
 - Provide tooltips on symbols in scripts and R console
-  - TODO: make configurable
 - Fixed: Expresssions spanning several lines would not be shown, correctly, in "R Console"-mode script preview
 - Fix focus problems, and better efficiency for data previews (as used in data import dialogs)
 - Fixed: Excel import plugin failed to accept file name
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 511c4670..c4697a93 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -125,7 +125,7 @@ RKConsole::RKConsole (QWidget *parent, bool tool_window, const char *name) : RKM
 	view->installEventFilter(this);
 	auto manager = new RKCompletionManager (view, RKSettingsModuleConsole::completionSettings());  // Must be instantiated _after_ our event filter, so that it will apply its filter first
 	manager->setLinePrefixes(nprefix, iprefix);
-	new RKTextHints(view);
+	new RKTextHints(view, RKSettingsModuleConsole::completionSettings());
 
 	doc->setModified (false);
 
diff --git a/rkward/settings/rksettingsmodulecommandeditor.cpp b/rkward/settings/rksettingsmodulecommandeditor.cpp
index 14dbb064..3562a9ab 100644
--- a/rkward/settings/rksettingsmodulecommandeditor.cpp
+++ b/rkward/settings/rksettingsmodulecommandeditor.cpp
@@ -46,7 +46,7 @@ RKCodeCompletionSettingsWidget::RKCodeCompletionSettingsWidget(QWidget *parent,
 
 	QGridLayout *g_layout = new QGridLayout ();
 	box_layout->addLayout (g_layout);
-	makeCompletionTypeBoxes (QStringList () << i18n ("Function call tip") << i18n ("Function argument completion") << i18n ("Object name completion") << i18n ("Filename completion") << i18n ("Auto word completion"), g_layout);
+	makeCompletionTypeBoxes (QStringList () << i18n ("Function call tip") << i18n ("Function argument completion") << i18n ("Object name completion") << i18n ("Filename completion") << i18n ("Auto word completion") << i18n("Mouseover object info"), g_layout);
 
 	auto_completion_enabled_box = new QGroupBox (i18n ("Start code completions/hints, automatically"), group);
 	auto_completion_enabled_box->setCheckable (true);
diff --git a/rkward/settings/rksettingsmodulecommandeditor.h b/rkward/settings/rksettingsmodulecommandeditor.h
index 6eeed18e..629d1761 100644
--- a/rkward/settings/rksettingsmodulecommandeditor.h
+++ b/rkward/settings/rksettingsmodulecommandeditor.h
@@ -32,6 +32,7 @@ public:
 		Object,
 		Filename,
 		AutoWord,
+		MouseOver,
 		N_COMPLETION_CATEGORIES
 	};
 
@@ -54,7 +55,7 @@ friend class RKSettingsModuleConsole;
 	RKConfigValue<int> auto_completion_timeout {"Completion timeout", 250};
 	RKConfigValue<bool> auto_completion_cursor_activated {"Auto completion on cursor navigation", false};
 	RKConfigValue<bool> tabkey_invokes_completion {"Tabkey invokes completion", false};
-	RKConfigValue<bool> completion_type_enabled[N_COMPLETION_CATEGORIES] {{"Calltips", true}, {"Argument completion", true}, {"Object completion", true}, {"Filename completion", true}, {"Auto word completion", true}};
+	RKConfigValue<bool> completion_type_enabled[N_COMPLETION_CATEGORIES] {{"Calltips", true}, {"Argument completion", true}, {"Object completion", true}, {"Filename completion", true}, {"Auto word completion", true}, {"mouseover", true}};
 	RKConfigValue<bool> cursor_navigates_completions {"Cursor navigate completions", false};
 	RKConfigValue<int> completion_options {"Completion option flags", (int) RObject::IncludeEnvirIfMasked};
 	RKConfigGroup dummyoptions = RKConfigGroup(0, N_COMPLETION_CATEGORIES, completion_type_enabled);
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index d6fba5d6..9d87fc92 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -273,7 +273,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl &_url,
 	if (use_r_highlighting || RKSettingsModuleCommandEditor::completionSettings()->completionForAllFileTypes()) {
 		if (flags & RKCommandEditorFlags::UseCodeHinting) {
 			new RKCompletionManager (m_view, RKSettingsModuleCommandEditor::completionSettings());
-			new RKTextHints(m_view);
+			new RKTextHints(m_view, RKSettingsModuleCommandEditor::completionSettings());
 			//hinter = new RKFunctionArgHinter (this, m_view);
 		}
 	}
diff --git a/rkward/windows/rktexthints.cpp b/rkward/windows/rktexthints.cpp
index 67b81417..a16b6454 100644
--- a/rkward/windows/rktexthints.cpp
+++ b/rkward/windows/rktexthints.cpp
@@ -10,10 +10,11 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "../misc/rkcommonfunctions.h"
 #include "../core/robjectlist.h"
+#include "../settings/rksettingsmodulecommandeditor.h"
 
 #include "../debug.h"
 
-RKTextHints::RKTextHints(KTextEditor::View *view) : QObject(view), KTextEditor::TextHintProvider() {
+RKTextHints::RKTextHints(KTextEditor::View *view, const RKCodeCompletionSettings *settings) : QObject(view), KTextEditor::TextHintProvider(), settings(settings) {
 	RK_TRACE(COMMANDEDITOR);
 	auto iface = qobject_cast<KTextEditor::TextHintInterface*>(view);
 	if (iface) {
@@ -28,6 +29,7 @@ RKTextHints::~RKTextHints() {
 }
 
 QString RKTextHints::textHint(KTextEditor::View *view, const KTextEditor::Cursor &position) {
+	if (!settings->isEnabled(RKCodeCompletionSettings::MouseOver)) return QString();
 	RK_TRACE(COMMANDEDITOR);
 	QString line = view->document()->line(position.line()) + ' ';
 	QString symbol = RKCommonFunctions::getCurrentSymbol(line, position.column(), false);
diff --git a/rkward/windows/rktexthints.h b/rkward/windows/rktexthints.h
index 355302b3..5f955a26 100644
--- a/rkward/windows/rktexthints.h
+++ b/rkward/windows/rktexthints.h
@@ -10,14 +10,17 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <ktexteditor/view.h>
 #include <ktexteditor/texthintinterface.h>
 
+class RKCodeCompletionSettings;
+
 /** Provides text hints for a KTextEditor::View */
 class RKTextHints : public QObject, public KTextEditor::TextHintProvider {
 	Q_OBJECT
 public:
-	RKTextHints(KTextEditor::View *view);
+	RKTextHints(KTextEditor::View *view, const RKCodeCompletionSettings *settings);
 	QString textHint(KTextEditor::View *view, const KTextEditor::Cursor &position) override;
 private:
 	~RKTextHints();
+	const RKCodeCompletionSettings *settings;
 };
 
 #endif


More information about the rkward-tracker mailing list