[rkward-cvs] [rkward/development/plugin_management_to_loadlibs] rkward/dialogs: Move the "Configure Repositories"-button to the tab it applies to.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Dec 31 21:02:47 UTC 2014


Git commit 6b3a955c7f43473447e5f9bc9d0ac83f93b66e0c by Thomas Friedrichsmeier.
Committed on 31/12/2014 at 19:36.
Pushed by tfry into branch 'development/plugin_management_to_loadlibs'.

Move the "Configure Repositories"-button to the tab it applies to.

M  +20   -15   rkward/dialogs/rkloadlibsdialog.cpp
M  +1    -0    rkward/dialogs/rkloadlibsdialog.h

http://commits.kde.org/rkward/6b3a955c7f43473447e5f9bc9d0ac83f93b66e0c

diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 14c39af..63c6078 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -61,7 +61,7 @@ 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"));
@@ -70,8 +70,6 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool
 	install_packages_widget = new InstallPackagesWidget (this);
 	install_packages_pageitem = addPage (install_packages_widget, i18n ("Install / Update / Remove"));
 
-	setButtonText (KDialog::User1, i18n ("Configure Repositories"));
-
 	addPage (new RKPluginMapSelectionWidget (this), i18n ("Manage Plugins"));
 
 	connect (this, SIGNAL (currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, SLOT (slotPageChanged()));
@@ -146,9 +144,6 @@ void RKLoadLibsDialog::slotButtonClicked (int button) {
 	case KDialog::Apply:
 		emit (applyClicked ());
 		break;
-	case KDialog::User1:
-		RKSettings::configureSettings (RKSettings::PageRPackages, this, chain);
-		break;
 	}
 }
 
@@ -627,14 +622,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);
@@ -645,13 +640,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()));
@@ -785,6 +785,11 @@ void InstallPackagesWidget::cancel () {
 	deleteLater ();
 }
 
+void InstallPackagesWidget::configureRepositories () {
+	RK_TRACE (DIALOGS);
+	RKSettings::configureSettings (RKSettings::PageRPackages, this, parent->chain);
+}
+
 /////////////////////// PackageInstallParamsWidget //////////////////////////
 
 #include <qcombobox.h>
diff --git a/rkward/dialogs/rkloadlibsdialog.h b/rkward/dialogs/rkloadlibsdialog.h
index 55af834..d8cbc25 100644
--- a/rkward/dialogs/rkloadlibsdialog.h
+++ b/rkward/dialogs/rkloadlibsdialog.h
@@ -248,6 +248,7 @@ public slots:
 	void filterChanged ();
 	void activated ();
 	void markAllUpdates ();
+	void configureRepositories ();
 private:
 	void doInstall (bool refresh);
 	QTreeView *packages_view;





More information about the rkward-tracker mailing list