diff --git a/rkward/dialogs/rksetupwizard.cpp b/rkward/dialogs/rksetupwizard.cpp
index 4503749e..95597688 100644
--- a/rkward/dialogs/rksetupwizard.cpp
+++ b/rkward/dialogs/rksetupwizard.cpp
@@ -1,271 +1,306 @@
/***************************************************************************
rksetupwizard - description
-------------------
begin : Fri May 25 20200
copyright : (C) 2020 by Thomas Friedrichsmeier
email : thomas.friedrichsmeier@kdemail.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "rksetupwizard.h"
#include %1: %2 This dialog will guide you through a quick check of the basic setup of the required (or recommended) components. The setup assistant has been invoked, automatically, because a new version of RKWard has been detected.
"); l->addWidget(waiting_to_start_label); auto firstpageref = wizard->addPage (firstpage, i18n("RKWard Setup Assistant")); wizard->setValid(firstpageref, false); // Basic installation page wizard->createStandardPage(); bool reinstallation_required = false; auto idir = new RKSetupWizardItem(i18n("Installation directory")); if (RKCommonFunctions::getRKWardDataDir ().isEmpty ()) { idir->setStatus(RKSetupWizardItem::Error, i18n("Not found.")); idir->setLongLabel("
RKWard either could not find its resource files at all, or only an old version of those files. The most likely cause is that the last installation failed to place the files in the correct place. This can lead to all sorts of problems, from single missing features to complete failure to function.
You should quit RKWard, now, and fix your installation. For help with that, see https://rkward.kde.org/Building_RKWard_From_Source.html.
"); idir->addOption(i18n("Reinstallation required"), i18n("This problem cannot be corrected, automatically. You will have to reinstall RKWard."), [](RKSetupWizard*) {}); reinstallation_required = true; } else { idir->setStatus(RKSetupWizardItem::Good, i18n("Found.")); } wizard->appendItem(idir); auto pluginmaps = new RKSetupWizardItem(i18n("RKWard plugins")); if (RKSettingsModulePlugins::pluginMaps().isEmpty()) { pluginmaps->setLongLabel(i18n("No plugins are enabled. This is probably not intended.
")); pluginmaps->setStatus(RKSetupWizardItem::Warning, i18n("None selected")); pluginmaps->addOption(i18n("Restore defaults"), i18n("Enable the default plugins"), [](RKSetupWizard*) { RKSettingsModulePlugins::registerDefaultPluginMaps(RKSettingsModulePlugins::AddIfDefault); }); pluginmaps->addOption(i18n("No change"), i18n("Proceed without plugins"), [](RKSetupWizard*) {}); // TODO: Also offer help, if a suspicioulsy small share of plugins is active? RKSettingsModulePlugins::knownUsablePluginCount(); } else { pluginmaps->setStatus(RKSetupWizardItem::Good, i18n("Found.")); } wizard->appendItem(pluginmaps); auto kateplugins = new RKSetupWizardItem(i18n("Kate plugins")); int kateplugincount = RKWardMainWindow::getMain()->katePluginIntegration()->knownPluginCount(); if (kateplugincount < 1) { kateplugins->setLongLabel(i18n("Important functionality in RKWard is provided by kate plugins. It looks like none are installed on this system. On Linux/BSD, this can usually be fixed by installing kate.
")); kateplugins->setStatus(RKSetupWizardItem::Error, i18n("None found")); - kateplugins->addOption(i18n("(Attempt to) install kate"), i18n("Attempt to install kate using the muon package manager. If this is not available, please install kate, manuelly"), [](RKSetupWizard* wizard) { wizard->markExternalPackageForInstallation(QStringLiteral("kate"), true); }); - kateplugins->addOption(i18n("No change"), i18n("Proceed without plugins"), [](RKSetupWizard* wizard) { wizard->markExternalPackageForInstallation(QStringLiteral("kate"), false); }); + addSoftwareInstallOptions(kateplugins, QStringLiteral("kate"), "https://kate.kde.org"); } else { kateplugins->setStatus(RKSetupWizardItem::Good, i18n("Found %1 plugins.", kateplugincount)); } wizard->appendItem(kateplugins); for (int i = 0; i < settings_items.size(); ++i) { wizard->appendItem(settings_items[i]); } wizard->current_layout->setRowStretch(++wizard->current_row, 1); wizard->addPage(wizard->current_page, i18n("Basic installation")); // Wait for R Interface, then start dialog wizard->setWindowModality(Qt::ApplicationModal); wizard->show(); while (!RKGlobals::rInterface()->backendIsIdle()) { if (RKGlobals::rInterface()->backendIsDead()) { waiting_to_start_label->setText(i18n("R backend has crashed. Click \"Cancel\" to exit setup assitant.")); } else { QApplication::processEvents(QEventLoop::AllEvents, 1000); } } waiting_to_start_label->setText(i18n("R backend has started. Click \"Next\" to continue.")); wizard->setValid(firstpageref, true); // R packages page // This must be created _after_ the backend has started, for obvious reasons. wizard->createStandardPage(); - auto r2htmlpackage = makeRPackageCheck("R2HTML", i18n("The R2HTML package is used by nearly all RKWard output functions, and thus required."), RKSetupWizardItem::Error); - wizard->appendItem(r2htmlpackage); - auto rmarkdownpackage = makeRPackageCheck("rmarkdown", i18n("The rmarkdown package is required for rendering .Rmd files (including preview rendering), which is an optional but recommended feature."), RKSetupWizardItem::Warning); - wizard->appendItem(rmarkdownpackage); + wizard->appendItem(makeRPackageCheck("R2HTML", i18n("The R2HTML package is used by nearly all RKWard output functions, and thus required."), RKSetupWizardItem::Error)); + wizard->appendItem(makeRPackageCheck("rmarkdown", i18n("The rmarkdown package is required for rendering .Rmd files (including preview rendering), which is an optional but recommended feature."), RKSetupWizardItem::Warning)); wizard->current_layout->setRowStretch(++wizard->current_row, 1); wizard->addPage(wizard->current_layout->parentWidget(), i18n("R Packages")); + // external software page + wizard->createStandardPage(); + + wizard->appendItem(makeSoftwareCheck("pandoc", i18n("The pandoc software is needed for rendering (or previewing) R markdown (.Rmd) files. This is optional but recommended."), "https://pandoc.org/installing.html", RKSetupWizardItem::Warning)); + wizard->appendItem(makeSoftwareCheck("kbibtex", i18n("The kbibtex software is useful for managing citations while writing articles. It integrates into RKWard via the Document Preview kate plugin."), "https://userbase.kde.org/KBibTeX", RKSetupWizardItem::Warning)); + + wizard->current_layout->setRowStretch(++wizard->current_row, 1); + wizard->addPage(wizard->current_layout->parentWidget(), i18n("External software")); + auto res = wizard->exec(); if (res == QDialog::Accepted) { for(int i = 0; i < wizard->items.size(); ++i) { wizard->items[i]->apply(wizard); } if (!wizard->packages_to_install.isEmpty()) { RKLoadLibsDialog::showInstallPackagesModal(wizard, 0, wizard->packages_to_install); } - // TODO: external software + if (!wizard->software_to_install.isEmpty()) { + // TODO: external software + } } delete wizard; } void RKSetupWizard::createStandardPage() { RK_TRACE (DIALOGS); current_page = new QWidget(); current_layout = new QGridLayout(current_page); current_layout->setColumnStretch(1, 2); current_layout->setColumnStretch(2, 1); current_row = -1; } void RKSetupWizard::appendItem(RKSetupWizardItem* item) { RK_TRACE (DIALOGS); item->createWidget(current_layout, ++current_row); items.append(item); } -void RKSetupWizard::markExternalPackageForInstallation(const QString& name, bool install) { +void RKSetupWizard::markSoftwareForInstallation(const QString& name, const QString& downloadurl, bool install) { RK_TRACE (DIALOGS); bool present = software_to_install.contains(name); - if (install && !present) software_to_install.append(name); - if (present && !install) software_to_install.removeAll(name); + if (install && !present) { + software_to_install.append(name); + software_to_install_urls.append(downloadurl); + } + if (present && !install) { + software_to_install.removeAll(name); + software_to_install_urls.removeAll(downloadurl); + } } void RKSetupWizard::markRPackageForInstallation(const QString& name, bool install) { RK_TRACE (DIALOGS); bool present = packages_to_install.contains(name); if (install && !present) packages_to_install.append(name); if (present && !install) packages_to_install.removeAll(name); } diff --git a/rkward/dialogs/rksetupwizard.h b/rkward/dialogs/rksetupwizard.h index d7763650..7f50dc46 100644 --- a/rkward/dialogs/rksetupwizard.h +++ b/rkward/dialogs/rksetupwizard.h @@ -1,89 +1,90 @@ /*************************************************************************** rksetupwizard - description ------------------- begin : Fri May 25 20200 copyright : (C) 2020 by Thomas Friedrichsmeier email : thomas.friedrichsmeier@kdemail.net ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef RKSETUPWIZARD_H #define RKSETUPWIZARD_H #include