[rkward] /: EXPERIMENTAL: Move preview controls to the button-column of dialogs.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Jan 29 10:44:54 UTC 2016


Git commit 6de2fce42e57e3893700d1f988bba50378a2976e by Thomas Friedrichsmeier.
Committed on 29/01/2016 at 10:44.
Pushed by tfry into branch 'master'.

EXPERIMENTAL: Move preview controls to the button-column of dialogs.

M  +1    -0    ChangeLog
M  +1    -0    rkward/plugin/rkpreviewbox.cpp
M  +8    -0    rkward/plugin/rkstandardcomponent.cpp
M  +6    -1    rkward/plugin/rkstandardcomponentgui.cpp
M  +2    -1    rkward/plugin/rkstandardcomponentgui.h

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

diff --git a/ChangeLog b/ChangeLog
index 745d2ec..22941ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+- EXPERIMENTAL: Move preview controls to the button-column of dialogs. TODO document, polish
 - Add preview to Power Analysis plugin
 - Add support for adding "htmlwidget"- and "gvis"-class objects to the output window via rk.print()
 - Add plugins for importing Excel files (.xls and .xlsx, Perl- and Java-based)
diff --git a/rkward/plugin/rkpreviewbox.cpp b/rkward/plugin/rkpreviewbox.cpp
index 7ffa5bb..2fad847 100644
--- a/rkward/plugin/rkpreviewbox.cpp
+++ b/rkward/plugin/rkpreviewbox.cpp
@@ -64,6 +64,7 @@ RKPreviewBox::RKPreviewBox (const QDomElement &element, RKComponent *parent_comp
 
 	// status label
 	status_label = new QLabel (QString (), this);
+	status_label->setWordWrap (true);
 	vbox->addWidget (status_label);
 
 	// prepare placement
diff --git a/rkward/plugin/rkstandardcomponent.cpp b/rkward/plugin/rkstandardcomponent.cpp
index e1b8a0a..64343b2 100644
--- a/rkward/plugin/rkstandardcomponent.cpp
+++ b/rkward/plugin/rkstandardcomponent.cpp
@@ -658,7 +658,15 @@ void RKComponentBuilder::buildElement (const QDomElement &element, XMLHelper &xm
 		} else if (e.tagName () == QLatin1String ("text")) {
 			widget = new RKText (e, component (), parent_widget);
 		} else if (e.tagName () == QLatin1String ("preview")) {
+			QWidget *pwidget = parent_widget;
+			if (!parent->isWizardish ()) {
+				RKStandardComponent *uicomp = parent->topmostStandardComponent ();
+				if (uicomp) {
+					parent_widget = static_cast<RKStandardComponent*> (uicomp)->gui->custom_preview_buttons_area;
+				}
+			}
 			widget = new RKPreviewBox (e, component (), parent_widget);
+			parent_widget->layout ()->addWidget (widget);
 		} else if (e.tagName () == QLatin1String ("saveobject")) {
 			widget = new RKPluginSaveObject (e, component (), parent_widget);
 		} else if (e.tagName () == QLatin1String ("embed")) {
diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp
index 6678f40..4bb328b 100644
--- a/rkward/plugin/rkstandardcomponentgui.cpp
+++ b/rkward/plugin/rkstandardcomponentgui.cpp
@@ -147,7 +147,12 @@ void RKStandardComponentGUI::createDialog (bool switchable) {
 		vbox->addWidget (switch_button);
 	}
 	vbox->addStretch (2);
-	
+
+	custom_preview_buttons_area = new QWidget ();
+	QVBoxLayout *dummy = new QVBoxLayout (custom_preview_buttons_area);
+	dummy->setContentsMargins (0, 0, 0, 0);
+	vbox->addWidget (custom_preview_buttons_area);
+
 	toggle_code_box = new QCheckBox (i18n ("Code Preview"), upper_widget);
 	connect (toggle_code_box, SIGNAL (clicked()), this, SLOT (toggleCode()));
 	vbox->addWidget (toggle_code_box);
diff --git a/rkward/plugin/rkstandardcomponentgui.h b/rkward/plugin/rkstandardcomponentgui.h
index 236c648..afb493e 100644
--- a/rkward/plugin/rkstandardcomponentgui.h
+++ b/rkward/plugin/rkstandardcomponentgui.h
@@ -109,7 +109,6 @@ protected:
 	void closeEvent (QCloseEvent *e);
 	RKStandardComponent *component;
 	QTimer *code_update_timer;
-
 	// common widgets
 	QWidget *main_widget;
 	QPushButton *cancel_button;
@@ -118,6 +117,8 @@ protected:
 	QCheckBox *auto_close_box;
 	QSplitter *splitter;
 	RKCommandEditorWindow *code_display;
+friend class RKComponentBuilder;
+	QWidget *custom_preview_buttons_area;
 
 	bool enslaved;
 



More information about the rkward-tracker mailing list