Commit e6440ba3 authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Merge branch 'development/plugin_management_to_loadlibs'

parents a844170a 4e6a7545
# DO NOT CHANGE THIS FILE MANUALLY!
# It will be overwritten by scripts/set_dist_version.sh
SET(RKVERSION_NUMBER 0.6.2z+0.6.3+devel1)
SET(RKVERSION_NUMBER 0.6.2z+0.6.3+devel2)
......@@ -61,20 +61,20 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool
setFaceType (KPageDialog::Tabbed);
setModal (modal);
setCaption (i18n ("Configure Packages"));
setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::User1);
setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel);
LoadUnloadWidget *luwidget = new LoadUnloadWidget (this);
addPage (luwidget, i18n ("Local packages"));
addChild (luwidget, i18n ("Local packages"));
connect (this, SIGNAL (installedPackagesChanged()), luwidget, SLOT (updateInstalledPackages()));
install_packages_widget = new InstallPackagesWidget (this);
install_packages_pageitem = addPage (install_packages_widget, i18n ("Install / Update / Remove"));
install_packages_pageitem = addChild (install_packages_widget, i18n ("Install / Update / Remove"));
setButtonText (KDialog::User1, i18n ("Configure Repositories"));
configure_pluginmaps_pageitem = addChild (new RKPluginMapSelectionWidget (this), i18n ("Manage Plugins"));
connect (this, SIGNAL (currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, SLOT (slotPageChanged()));
QTimer::singleShot (0, this, SLOT (slotPageChanged()));
num_child_widgets = 3;
num_child_widgets = 4;
accepted = false;
RKGlobals::rInterface ()->issueCommand (".libPaths ()", RCommand::App | RCommand::GetStringVector, QString (), this, GET_CURRENT_LIBLOCS_COMMAND, chain);
......@@ -87,6 +87,16 @@ RKLoadLibsDialog::~RKLoadLibsDialog () {
else KPageDialog::reject ();
}
KPageWidgetItem* RKLoadLibsDialog::addChild (QWidget *child_page, const QString &caption) {
RK_TRACE (DIALOGS);
connect (this, SIGNAL (okClicked()), child_page, SLOT (ok()));
connect (this, SIGNAL (applyClicked()), child_page, SLOT (apply()));
connect (this, SIGNAL (cancelClicked()), child_page, SLOT (cancel()));
connect (child_page, SIGNAL (destroyed()), this, SLOT (childDeleted()));
return addPage (child_page, caption);
}
void RKLoadLibsDialog::slotPageChanged () {
RK_TRACE (DIALOGS);
......@@ -106,6 +116,15 @@ void RKLoadLibsDialog::showInstallPackagesModal (QWidget *parent, RCommandChain
RK_TRACE (DIALOGS);
}
// static
void RKLoadLibsDialog::showPluginmapConfig (QWidget* parent, RCommandChain* chain) {
RK_TRACE (DIALOGS);
RKLoadLibsDialog *dialog = new RKLoadLibsDialog (parent, chain, false);
dialog->setCurrentPage (dialog->configure_pluginmaps_pageitem);
dialog->show ();
}
void RKLoadLibsDialog::automatedInstall () {
RK_TRACE (DIALOGS);
......@@ -144,9 +163,6 @@ void RKLoadLibsDialog::slotButtonClicked (int button) {
case KDialog::Apply:
emit (applyClicked ());
break;
case KDialog::User1:
RKSettings::configureSettings (RKSettings::PageRPackages, this, chain);
break;
}
}
......@@ -432,11 +448,6 @@ LoadUnloadWidget::LoadUnloadWidget (RKLoadLibsDialog *dialog) : QWidget (0) {
connect (loaded_view, SIGNAL (itemSelectionChanged()), this, SLOT (updateButtons()));
connect (installed_view, SIGNAL (itemSelectionChanged()), this, SLOT (updateButtons()));
connect (dialog, SIGNAL (okClicked()), this, SLOT (ok()));
connect (dialog, SIGNAL (applyClicked()), this, SLOT (apply()));
connect (dialog, SIGNAL (cancelClicked()), this, SLOT (cancel()));
connect (this, SIGNAL (destroyed()), dialog, SLOT (childDeleted()));
updateInstalledPackages ();
updateButtons ();
}
......@@ -625,14 +636,14 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : QWidge
RK_TRACE (DIALOGS);
InstallPackagesWidget::parent = dialog;
QVBoxLayout *mvbox = new QVBoxLayout (this);
mvbox->setContentsMargins (0, 0, 0, 0);
QLabel *label = new QLabel (i18n ("Many packages are available on CRAN (Comprehensive R Archive Network), and other repositories<br>(click \"Configure Repositories\" to add more sources)."), this);
mvbox->addWidget (label);
QHBoxLayout *hbox = new QHBoxLayout ();
mvbox->addLayout (hbox);
QHBoxLayout *hbox = new QHBoxLayout (this);
hbox->setContentsMargins (0, 0, 0, 0);
QVBoxLayout *vbox = new QVBoxLayout ();
vbox->setContentsMargins (0, 0, 0, 0);
hbox->addLayout (vbox);
hbox->setStretchFactor (vbox, 2);
packages_status = new RKRPackageInstallationStatus (this);
packages_view = new QTreeView (this);
packages_view->setSortingEnabled (true);
......@@ -643,13 +654,18 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : QWidge
packages_view->setModel (model);
packages_view->setEnabled (false);
packages_view->setMinimumHeight (packages_view->sizeHintForRow (0) * 15); // force a decent height
hbox->addWidget (packages_view);
hbox->setStretchFactor (packages_view, 2);
packages_view->setMinimumWidth (packages_view->fontMetrics ().width ("This is to force a sensible min width for the packages view (empty on construction)"));
vbox->addWidget (packages_view);
QPushButton *configure_repos_button = new QPushButton (i18n ("Configure Repositories"), this);
RKCommonFunctions::setTips (i18n ("Many packages are available on CRAN (Comprehensive R Archive Network), and other repositories.<br>Click this to add more sources."), configure_repos_button);
connect (configure_repos_button, SIGNAL (clicked()), this, SLOT(configureRepositories()));
vbox->addWidget (configure_repos_button);
QVBoxLayout *buttonvbox = new QVBoxLayout ();
hbox->addLayout (buttonvbox);
buttonvbox->setContentsMargins (0, 0, 0, 0);
label = new QLabel (i18n ("Show only packages matching:"), this);
QLabel *label = new QLabel (i18n ("Show only packages matching:"), this);
filter_edit = new QLineEdit (QString (), this);
RKCommonFunctions::setTips (i18n ("<p>You can limit the packages displayed in the list to with names or titles matching a filter string.</p><p><b>Note:</b> To limit the search to matches at the start of the string, start the filter with '^', e.g. ('^rk.'). To limit searches to the end of the string, append '$' at the end of the filter.</p>"), label, filter_edit);
connect (filter_edit, SIGNAL (textChanged(QString)), this, SLOT (filterChanged()));
......@@ -672,11 +688,6 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : QWidge
buttonvbox->addStretch (1);
buttonvbox->addWidget (install_params);
buttonvbox->addStretch (1);
connect (dialog, SIGNAL (okClicked()), this, SLOT (ok()));
connect (dialog, SIGNAL (applyClicked()), this, SLOT (apply()));
connect (dialog, SIGNAL (cancelClicked()), this, SLOT (cancel()));
connect (this, SIGNAL (destroyed()), dialog, SLOT (childDeleted()));
}
InstallPackagesWidget::~InstallPackagesWidget () {
......@@ -783,6 +794,11 @@ void InstallPackagesWidget::cancel () {
deleteLater ();
}
void InstallPackagesWidget::configureRepositories () {
RK_TRACE (DIALOGS);
RKSettings::configureSettings (RKSettings::PageRPackages, this, parent->chain);
}
/////////////////////// PackageInstallParamsWidget //////////////////////////
#include <qcombobox.h>
......@@ -1195,6 +1211,61 @@ void RKRPackageInstallationStatusSortFilterModel::setRKWardOnly (bool only) {
if (rkward_only != old_only) invalidate ();
}
/////////////////////////
#include "../misc/multistringselector.h"
RKPluginMapSelectionWidget::RKPluginMapSelectionWidget (RKLoadLibsDialog* dialog) : QWidget (dialog) {
RK_TRACE (DIALOGS);
model = 0;
changes_pending = false;
#include "rkloadlibsdialog.moc"
QVBoxLayout *vbox = new QVBoxLayout (this);
vbox->setContentsMargins (0, 0, 0, 0);
vbox->addWidget (new QLabel (i18n ("Installed plugin groups (.pluginmap files)"), this));
selector = new RKMultiStringSelectorV2 (QString (), this);
vbox->addWidget (selector);
}
RKPluginMapSelectionWidget::~RKPluginMapSelectionWidget () {
RK_TRACE (DIALOGS);
}
void RKPluginMapSelectionWidget::activated () {
RK_TRACE (DIALOGS);
if (!model) {
model = new RKSettingsModulePluginsModel (this);
model->init (RKSettingsModulePlugins::knownPluginmaps ());
selector->setModel (model, 1);
connect (selector, SIGNAL (insertNewStrings(int)), model, SLOT (insertNewStrings(int)));
connect (selector, SIGNAL (swapRows(int,int)), model, SLOT (swapRows(int,int)));
connect (selector, SIGNAL (listChanged()), this, SLOT (changed()));
}
}
void RKPluginMapSelectionWidget::apply () {
RK_TRACE (DIALOGS);
if (!changes_pending) return;
RK_ASSERT (model);
RKSettingsModulePlugins::PluginMapList new_list = RKSettingsModulePlugins::setPluginMaps (model->pluginMaps ());
selector->setModel (0); // we don't want any extra change notification for this
model->init (new_list);
selector->setModel (model, 1);
changes_pending = false;
}
void RKPluginMapSelectionWidget::cancel () {
RK_TRACE (DIALOGS);
deleteLater ();
}
void RKPluginMapSelectionWidget::ok () {
RK_TRACE (DIALOGS);
if (!changes_pending) return;
RK_ASSERT (model);
RKSettingsModulePlugins::setPluginMaps (model->pluginMaps ());
deleteLater ();
}
#include "rkloadlibsdialog.moc"
......@@ -63,6 +63,7 @@ public:
@param chain RCommandChain to run the necessary commands in
@param package_name name of the required package */
static void showInstallPackagesModal (QWidget *parent, RCommandChain *chain, const QString &package_name);
static void showPluginmapConfig (QWidget *parent=0, RCommandChain *chain=0);
QStringList currentLibraryLocations () const { return library_locations; };
signals:
void downloadComplete ();
......@@ -87,12 +88,14 @@ private:
void addLibraryLocation (const QString &new_loc);
void tryDestruct ();
void runInstallationCommand (const QString& command, bool as_root, const QString& message, const QString& title);
KPageWidgetItem* addChild (QWidget *child_page, const QString &caption);
friend class LoadUnloadWidget;
friend class InstallPackagesWidget;
RCommandChain *chain;
InstallPackagesWidget *install_packages_widget; // needed for automated installation
KPageWidgetItem *install_packages_pageitem;
KPageWidgetItem *configure_pluginmaps_pageitem;
QStringList library_locations;
......@@ -248,6 +251,7 @@ public slots:
void filterChanged ();
void activated ();
void markAllUpdates ();
void configureRepositories ();
private:
void doInstall (bool refresh);
QTreeView *packages_view;
......@@ -283,4 +287,24 @@ private:
QCheckBox *suggested_packages;
};
#include "../settings/rksettingsmoduleplugins.h"
class RKPluginMapSelectionWidget : public QWidget {
Q_OBJECT
public:
RKPluginMapSelectionWidget (RKLoadLibsDialog *dialog);
virtual ~RKPluginMapSelectionWidget ();
public slots:
void ok ();
void apply ();
void cancel ();
void activated ();
void changed () { changes_pending = true; };
private:
RKMultiStringSelectorV2* selector;
RKSettingsModulePluginsModel* model;
bool changes_pending;
};
#endif
......@@ -166,11 +166,15 @@ void RKComponentGUIXML::Menu::clear () {
RKComponentGUIXML::Group *findOrCreateGroup (RKComponentGUIXML::Menu *parent, const QString group) {
// try to find group
int bottom_index = -1;
QList<RKComponentGUIXML::Group*> &list = parent->groups;
for (int i = 0; i < list.size (); ++i) {
if (list[i]->id == group) {
return list[i];
}
if (list[i]->id == QLatin1String ("bottom")) {
bottom_index = i;
}
}
RK_TRACE (PLUGIN);
......@@ -182,10 +186,10 @@ RKComponentGUIXML::Group *findOrCreateGroup (RKComponentGUIXML::Menu *parent, co
} else if (group == QLatin1String ("bottom")) {
list.append (new_group);
} else {
if (list.isEmpty () || list.last ()->id != QLatin1String ("bottom")) { // no "bottom" is defined, yet
if (bottom_index < 0) { // no "bottom" is defined, yet
list.append (new_group);
} else { // a bottom group already exists, add new group _above_ that
list.insert (list.size () - 1, new_group);
list.insert (bottom_index, new_group);
}
}
return new_group;
......@@ -314,7 +318,7 @@ void RKComponentMap::clearAll () {
RK_TRACE (PLUGIN);
actionCollection ()->clear ();
for (ComponentMap::iterator it = components.begin (); it != components.end (); ++it) {
for (ComponentMap::const_iterator it = components.constBegin (); it != components.constEnd (); ++it) {
delete (it.value ());
/* TODO: this is not technically correct, as there may be several actions for this id, and we're only deleting one. But practically this should not really be relevant. */
delete (actionCollection ()->action (it.key ()));
......@@ -327,6 +331,10 @@ void RKComponentMap::clearAll () {
pluginmapfiles.clear ();
component_attributes.clear ();
component_dependencies.clear ();
for (RKComponentContextMap::const_iterator it = contexts.constBegin (); it != contexts.constEnd (); ++it) {
delete (it.value ());
}
contexts.clear ();
clearGUIDescription ();
......
......@@ -37,7 +37,7 @@ public:
QList<RKComponentDependency> getDependencies () const { return dependencies; };
static QString parseId (const QDomElement &e, XMLHelper &xml);
const RKMessageCatalog *messageCatalog () const { return catalog; };
// Get the about data for this pluginmap.
/** Get the about data for this pluginmap. */
RKComponentAboutData getAboutData ();
private:
friend class RKComponentMap;
......
<!DOCTYPE rkpluginmap>
<document base_prefix="" namespace="rkward" id="all_rkward_plugins">
<include file="pluginmap_meta.inc"/>
<require file="import_export.pluginmap"/>
<require file="analysis.pluginmap"/>
<require file="distributions.pluginmap"/>
<require file="plots.pluginmap"/>
<require file="x11device.pluginmap"/>
<require file="irt.pluginmap"/>
<require file="data.pluginmap"/>
</document>
......@@ -2,6 +2,16 @@
<document base_prefix="" namespace="rkward" id="analysis" po_id="analysis">
<include file="pluginmap_meta.inc"/>
<about
name="Analysis"
shortinfo="Assorted plugins for univariate and multivariate data analysis. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<require file="menu.pluginmap"/>
<components>
......
......@@ -2,6 +2,16 @@
<document base_prefix="" namespace="rkward" id="data">
<include file="pluginmap_meta.inc"/>
<about
name="Data transformation and conversion"
shortinfo="Plugins for transforming, subsetting, recoding, etc. of data. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<require file="menu.pluginmap"/>
<components>
......
......@@ -2,6 +2,16 @@
<document base_prefix="distributions/" namespace="rkward" id="distributions">
<include file="pluginmap_meta.inc"/>
<about
name="Distributions"
shortinfo="Distribution functions, plots, tests of (normal) distribution, central limit theorem. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<require file="../menu.pluginmap"/>
<components>
......
<!DOCTYPE rkpluginmap>
<document base_prefix="" namespace="rkward" id="embedded">
<document base_prefix="" namespace="rkward" id="embedded" priority="hidden">
<include file="pluginmap_meta.inc"/>
<require file="menu.pluginmap"/>
<about
name="Embedded plugins"
shortinfo="Not for direct use: Utility plugins that can be included by other plugins. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<components>
<!-- These are meant to be embedded, and are not shown in the menu -->
......
......@@ -2,6 +2,16 @@
<document base_prefix="00saveload/" namespace="rkward" id="import_export">
<include file="pluginmap_meta.inc"/>
<about
name="Data Import and Export"
shortinfo="Plugins for reading and writing data in various formats. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<require file="../menu.pluginmap"/>
<components>
......
......@@ -2,6 +2,16 @@
<document base_prefix="" namespace="rkward" id="irt">
<include file="pluginmap_meta.inc"/>
<about
name="Item Response Theory"
shortinfo="Item Response Theory Plugins. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<require file="menu.pluginmap"/>
<components>
......
<!DOCTYPE rkpluginmap>
<!-- The point of this pluginmap is to pre-define the layout (and labels) of some menus -->
<document base_prefix="" namespace="rkward" id="rkward_menu_hierarchy">
<document base_prefix="" namespace="rkward" id="rkward_menu_hierarchy" priority="hidden">
<include file="pluginmap_meta.inc"/>
<about
name="Menu structure definition"
shortinfo="Not for direct use: Defines the names and order of top level menus. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<hierarchy>
<!-- Define a group before and after each top-level menu to allow inserting top-level menus at defined positions -->
<group id="before_data"/>
......
......@@ -2,6 +2,16 @@
<document base_prefix="plots/" namespace="rkward" id="plots">
<include file="pluginmap_meta.inc"/>
<about
name="Plots"
shortinfo="Plugins for procuding various plots. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<require file="../menu.pluginmap"/>
<components>
......
<document>
<about
name="RKWard pluginmap"
shortinfo="Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<author
name="RKWard Team"
email="rkward-devel@lists.sf.net"
url="http://rkward.kde.org" />
</about>
<!-- Guard against accidental inclusion of pluginmaps in a different installed version of RKWard -->
<dependencies rkward_min_version="0.6.2z" rkward_max_version="0.6.3y" />
<snippets>
<snippet id="author_rkward_team">
<author
name="RKWard Team"
email="rkward-devel@lists.sf.net"
url="http://rkward.kde.org" />
</snippet>
<snippet id="rkward_version_guard">
<!-- Guard against accidental inclusion of pluginmaps in a different installed version of RKWard -->
<dependencies rkward_min_version="0.6.2z" rkward_max_version="0.6.3y" />
</snippet>
</snippets>
</document>
<!DOCTYPE rkpluginmap>
<document base_prefix="" namespace="rkward">
<document base_prefix="" namespace="rkward" priority="low" id="under_development">
<include file="pluginmap_meta.inc"/>
<require file="menu.pluginmap"/>
<about
name="Plugins under development"
shortinfo="Plugins that are under development, experimental, or meant for testing, only. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<require file="menu.pluginmap"/>
<components>
<component type="standard" id="simple_anova" file="simple_anova/description.xml" label="Simple Anova" />
<component type="standard" id="sieve_plot" file="plots/sieve_plot.xml" label="Extended Sieve Plot" />
......@@ -34,8 +43,6 @@
</menu>
<menu id="data" label="Data">
<group id="testing" group="bottom" separated="true"/>
<entry component="generate_random" group="testing"/>
<entry component="sort_data" group="testing"/>
<entry component="sort_data2" group="testing"/>
</menu>
<menu id="analysis" label="Analysis">
......
......@@ -2,6 +2,17 @@
<document base_prefix="x11device/" namespace="rkward" id="x11device">
<include file="pluginmap_meta.inc"/>
<about
name="Graphics Device add-ons"
shortinfo="Plugins for use in graphics device (e.g. X11()) windows. Part of the official RKWard distribution"
version="0.6.3"
license="GPL"
url="http://rkward.kde.org">
<insert snippet="author_rkward_team"/>
</about>
<insert snippet="rkward_version_guard"/>
<require file="../menu.pluginmap"/>
<components>
<component type="standard" id="export_x11_device" file="export.xml" label="Export..." />
......
......@@ -3,4 +3,4 @@
# rkward/SetVersionNumber.cmake
#' @export
".rk.app.version" <- "0.6.2z+0.6.3+devel1"
".rk.app.version" <- "0.6.2z+0.6.3+devel2"
......@@ -22,9 +22,6 @@
#include <kmessagebox.h>
#include <khbox.h>
#include <kdeversion.h>
#include <ktar.h>
#include <kzip.h>
#include <kio/deletejob.h>
#include <qlayout.h>
#include <qlabel.h>
......@@ -42,6 +39,7 @@
#include "../misc/rkspinbox.h"
#include "../misc/xmlhelper.h"
#include "../plugin/rkcomponentmap.h"
#include "../dialogs/rkloadlibsdialog.h"
#include "rksettingsmodulegeneral.h"
#include "../debug.h"
......@@ -107,15 +105,11 @@ RKSettingsModulePlugins::RKSettingsModulePlugins (RKSettings *gui, QWidget *pare
main_vbox->addSpacing (2*RKGlobals::spacingHint ());
QPushButton *pluginmap_config_button = new QPushButton (i18n ("Configure Active Plugins"), this);
connect (pluginmap_config_button, SIGNAL (clicked()), this, SLOT (configurePluginmaps()));
main_vbox->addWidget (pluginmap_config_button);
map_choser = new RKMultiStringSelectorV2 (i18n ("Select .pluginmap file(s)"), this);
map_model = new RKSettingsModulePluginsModel (this);
map_model->init (known_plugin_maps);
map_choser->setModel (map_model, 1);
connect (map_choser, SIGNAL (insertNewStrings(int)), map_model, SLOT (insertNewStrings(int)));
connect (map_choser, SIGNAL (swapRows(int,int)), map_model, SLOT (swapRows(int,int)));
connect (map_choser, SIGNAL (listChanged()), this, SLOT (settingChanged()));