[education/rkward] rkward: Also add restart-R-backend action in new hamburger menu next to R status indicator.
Thomas Friedrichsmeier
null at kde.org
Sun Jun 5 21:39:25 BST 2022
Git commit c0cd0df8321d8067358c49334b37551b5c9757da by Thomas Friedrichsmeier.
Committed on 05/06/2022 at 20:39.
Pushed by tfry into branch 'master'.
Also add restart-R-backend action in new hamburger menu next to R status indicator.
M +12 -4 rkward/rkward.cpp
M +1 -0 rkward/rkward.h
M +1 -1 rkward/windows/rkcodecompletion.cpp
https://invent.kde.org/education/rkward/commit/c0cd0df8321d8067358c49334b37551b5c9757da
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index d0bb641c..1720237f 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -612,10 +612,11 @@ void RKWardMainWindow::initActions() {
save_actions_plug_point = save_any_action->addSeparator ();
//save_any_action->addAction (proxy_export); -> later
- auto restart_r = actionCollection()->addAction("restart_r");
+ restart_r = actionCollection()->addAction("restart_r");
+ restart_r->setIcon(QIcon::fromTheme("view-refresh"));
restart_r->setText(i18n("Restart R Backend"));
connect(restart_r, &QAction::triggered, this, [this]() {
- QString message = i18n("<p>This feature is primarily targetted at package developers, who know what they are doing. Please proceed with caution.</p><p><b>All unsaved data in this workspace will be lost!</b> All data editors, and graphics windows will be closed.</p><p>Are you sure you want to proceed?</p>");
+ QString message = i18n("<p>This feature is primarily targetted at advanced users working on scripts or packages. Please proceed with caution.</p><p><b>All unsaved data in this workspace will be lost!</b> All data editors, and graphics windows will be closed.</p><p>Are you sure you want to proceed?</p>");
if (KMessageBox::warningContinueCancel(this, message, i18n("Restart R backend"), KGuiItem(i18n("Restart R backend"))) == KMessageBox::Continue) {
bool forced = RInterface::instance()->backendIsDead();
while (!RInterface::instance()->backendIsDead() && !RInterface::instance()->backendIsIdle()) {
@@ -769,9 +770,16 @@ void RKWardMainWindow::initStatusBar () {
boxl->addWidget(statusbar_r_status);
QToolButton* dummy = new QToolButton();
- dummy->setDefaultAction(interrupt_all_commands);
+ dummy->setPopupMode(QToolButton::InstantPopup);
+ dummy->setIcon(RKStandardIcons::getIcon(RKStandardIcons::ActionShowMenu));
+ dummy->setMenu(new QMenu(dummy));
+ dummy->menu()->addAction(interrupt_all_commands);
+ dummy->menu()->addAction(restart_r);
+ dummy->menu()->addSeparator();
+ QAction *a = new QAction(i18n("Configure R backend"));
+ connect(a, &QAction::triggered, this, []() { RKSettings::configureSettings(RKSettings::PageR); });
+ dummy->menu()->addAction(a);
dummy->setFixedHeight(statusbar_r_status->height());
- dummy->setAutoRaise(true);
boxl->addWidget(dummy);
realbar->addPermanentWidget(box, 0);
diff --git a/rkward/rkward.h b/rkward/rkward.h
index 6cc67a0d..2d48c145 100644
--- a/rkward/rkward.h
+++ b/rkward/rkward.h
@@ -152,6 +152,7 @@ private:
QAction* window_detach;
QAction* configure;
+ QAction* restart_r;
/** used so that if the menu is empty, there is a note in it, explaining that fact */
QAction* edit_menu_dummy;
diff --git a/rkward/windows/rkcodecompletion.cpp b/rkward/windows/rkcodecompletion.cpp
index 98a11ace..c282f9c3 100644
--- a/rkward/windows/rkcodecompletion.cpp
+++ b/rkward/windows/rkcodecompletion.cpp
@@ -694,7 +694,7 @@ QVariant RKCallHintModel::data (const QModelIndex& index, int role) const {
if (role == Qt::DisplayRole) {
if (col == KTextEditor::CodeCompletionModel::Prefix) return (name);
if (col == KTextEditor::CodeCompletionModel::Arguments) return (formals);
- if (col == KTextEditor::CodeCompletionModel::Postfix) return (" "); // Size is of a bit for KF5 5.44.0. Provide some padding to work around cut-off parts.
+ if (col == KTextEditor::CodeCompletionModel::Postfix) return (" "); // Size is off a bit for KF5 5.44.0. Provide some padding to work around cut-off parts.
} else if (role == KTextEditor::CodeCompletionModel::ArgumentHintDepth) {
return 1;
} else if (role == KTextEditor::CodeCompletionModel::CompletionRole) {
More information about the rkward-tracker
mailing list