[rkward-cvs] SF.net SVN: rkward: [2231] branches/KDE4_port/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Nov 16 16:33:50 UTC 2007


Revision: 2231
          http://rkward.svn.sourceforge.net/rkward/?rev=2231&view=rev
Author:   tfry
Date:     2007-11-16 08:33:50 -0800 (Fri, 16 Nov 2007)

Log Message:
-----------
Still busy removing Qt3 support code

Modified Paths:
--------------
    branches/KDE4_port/rkward/misc/rkstandardicons.cpp
    branches/KDE4_port/rkward/misc/rkstandardicons.h
    branches/KDE4_port/rkward/plugin/rkformula.cpp
    branches/KDE4_port/rkward/plugin/rkinput.cpp
    branches/KDE4_port/rkward/plugin/rktabpage.cpp
    branches/KDE4_port/rkward/plugin/rktext.cpp
    branches/KDE4_port/rkward/plugin/rkvarslot.cpp
    branches/KDE4_port/rkward/rbackend/rthread.h

Modified: branches/KDE4_port/rkward/misc/rkstandardicons.cpp
===================================================================
--- branches/KDE4_port/rkward/misc/rkstandardicons.cpp	2007-11-16 15:10:26 UTC (rev 2230)
+++ branches/KDE4_port/rkward/misc/rkstandardicons.cpp	2007-11-16 16:33:50 UTC (rev 2231)
@@ -47,6 +47,9 @@
 	icons[ActionDeleteVar] = icons[ActionDeleteRow];
 	icons[ActionInsertVar] = icons[ActionInsertRow];
 
+	icons[ActionAddRight] = KIcon ("arrow-right");
+	icons[ActionRemoveLeft] = KIcon ("arrow-left");
+
 	icons[ActionDetachWindow] = KIcon ("view-fullscreen");
 	icons[ActionAttachWindow] = KIcon ("view-restore");
 

Modified: branches/KDE4_port/rkward/misc/rkstandardicons.h
===================================================================
--- branches/KDE4_port/rkward/misc/rkstandardicons.h	2007-11-16 15:10:26 UTC (rev 2230)
+++ branches/KDE4_port/rkward/misc/rkstandardicons.h	2007-11-16 16:33:50 UTC (rev 2231)
@@ -47,6 +47,9 @@
 		ActionDeleteVar,
 		ActionInsertVar,
 
+		ActionAddRight,
+		ActionRemoveLeft,
+
 		ActionDetachWindow,
 		ActionAttachWindow,
 

Modified: branches/KDE4_port/rkward/plugin/rkformula.cpp
===================================================================
--- branches/KDE4_port/rkward/plugin/rkformula.cpp	2007-11-16 15:10:26 UTC (rev 2230)
+++ branches/KDE4_port/rkward/plugin/rkformula.cpp	2007-11-16 16:33:50 UTC (rev 2231)
@@ -27,11 +27,11 @@
 #include <QTreeWidget>
 
 #include <klocale.h>
-#include <kiconloader.h>
 
 #include "rkcomponent.h"
 #include "../core/rcontainerobject.h"
 #include "../misc/xmlhelper.h"
+#include "../misc/rkstandardicons.h"
 #include "../rkglobals.h"
 
 #include "../debug.h"
@@ -82,16 +82,18 @@
 	model_hbox->addWidget (predictors_view);
 	model_hbox->addSpacing (6);
 	
-	QVBoxLayout *model_vbox = new QVBoxLayout (model_hbox);
+	QVBoxLayout *model_vbox = new QVBoxLayout ();
+	model_hbox->addLayout (model_vbox);
 	add_button = new QPushButton (QString::null, custom_model_widget);
-	add_button->setPixmap (SmallIcon ("arrow-right"));
+	add_button->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionAddRight));
 	connect (add_button, SIGNAL (clicked ()), this, SLOT (addButtonClicked ()));
 	model_vbox->addWidget (add_button);
 	remove_button = new QPushButton (QString::null, custom_model_widget);
-	remove_button->setPixmap (SmallIcon ("arrow-left"));
+	remove_button->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRemoveLeft));
 	connect (remove_button, SIGNAL (clicked ()), this, SLOT (removeButtonClicked ()));
 	model_vbox->addWidget (remove_button);
-	level_box = new QSpinBox (0, 0, 1, custom_model_widget);
+	level_box = new QSpinBox (custom_model_widget);
+	level_box->setRange (0, 0);
 	level_box->setSpecialValueText (i18n ("Main effects"));
 	model_vbox->addWidget (level_box);
 	model_hbox->addSpacing (6);
@@ -200,11 +202,11 @@
 			if (it != interaction_map.begin ()) {
 				model_string.append (" + ");
 			}
-			for (int i=0; i <= it.data ().level; ++i) {
+			for (int i=0; i <= it.value ().level; ++i) {
 				if (i) {
 					model_string.append (":");
 				}
-				model_string.append (mangleName (it.data ().vars[i]));
+				model_string.append (mangleName (it.value ().vars[i]));
 			}
 		}
 	}
@@ -216,7 +218,7 @@
 		if (it != mangled_names.begin ()) {
 			labels_string.append (", ");
 		}
-		labels_string.append (it.key () + "=\"" + it.data ()->getDescription () + "\"");
+		labels_string.append (it.key () + "=\"" + it.value ()->getDescription () + "\"");
 	}
 	labels_string.append (")");
 
@@ -234,7 +236,7 @@
 	QString dummy2 = dummy;
 	MangledNames::iterator it;
 	int i=-1;
-	while (((it = mangled_names.find (dummy)) != mangled_names.end ()) && (it.data () != var)) {
+	while (((it = mangled_names.find (dummy)) != mangled_names.end ()) && (it.value () != var)) {
 		dummy = dummy2.append (QString ().setNum (++i));
 	}
 	mangled_names.insert (dummy, var);
@@ -264,7 +266,7 @@
 		Interaction new_inter = interactions[inter];
 		QTreeWidgetItem *dupe = 0;
 		for (InteractionMap::Iterator it = interaction_map.begin (); it != interaction_map.end (); ++it) {
-			Interaction existing_inter = it.data ();
+			Interaction existing_inter = it.value ();
 			// BEGIN: actual comparison
 			if (new_inter.level == existing_inter.level) {
 				int num_matches = 0;
@@ -369,19 +371,19 @@
 	RK_TRACE (PLUGIN);
 	int max_level = predictors_view->topLevelItemCount () - 1;
 	if (max_level >= 0) {
-		level_box->setMaxValue (max_level);
+		level_box->setMaximum (max_level);
 	} else {
-		level_box->setMaxValue (0);
+		level_box->setMaximum (0);
 	}
 
 	// clear terms which are no longer valid
 	for (InteractionMap::iterator in = interaction_map.begin (); in != interaction_map.end (); ++in) {
-		Interaction inter = in.data ();
+		Interaction inter = in.value ();
 		int found_vars = 0;
 		for (int i=0; i <= inter.level; ++i) {
-			for (ItemMap::iterator item = predictors_map.begin (); item != predictors_map.end (); ++item) {
+			for (ItemMap::const_iterator item = predictors_map.constBegin (); item != predictors_map.constEnd (); ++item) {
 				RK_DO (qDebug ("level %d", i), PLUGIN, DL_DEBUG);
-				if (item.data () == inter.vars[i]) {
+				if (item.value () == inter.vars[i]) {
 					++found_vars;
 					break;
 				}

Modified: branches/KDE4_port/rkward/plugin/rkinput.cpp
===================================================================
--- branches/KDE4_port/rkward/plugin/rkinput.cpp	2007-11-16 15:10:26 UTC (rev 2230)
+++ branches/KDE4_port/rkward/plugin/rkinput.cpp	2007-11-16 16:33:50 UTC (rev 2231)
@@ -93,15 +93,17 @@
 	if (!widget) widget = textedit;
 	RK_ASSERT (widget);
 
+	QPalette palette = widget->palette ();
 	if (isEnabled ()) {
 		if (isSatisfied ()) {
-			widget->setPaletteBackgroundColor (QColor (255, 255, 255));
+			palette.setColor (widget->backgroundRole (), QColor (255, 255, 255));
 		} else {
-			widget->setPaletteBackgroundColor (QColor (255, 0, 0));
+			palette.setColor (widget->backgroundRole (), QColor (255, 0, 0));
 		}
 	} else {
-		widget->setPaletteBackgroundColor (QColor (200, 200, 200));
+		palette.setColor (widget->backgroundRole (), QColor (200, 200, 200));
 	}
+	widget->setPalette (palette);
 }
 
 void RKInput::requirednessChanged (RKComponentPropertyBase *) {
@@ -142,7 +144,7 @@
 	RK_TRACE (PLUGIN);
 
 	RK_ASSERT (textedit);
-	textChanged (textedit->text ());
+	textChanged (textedit->toPlainText ());
 }
 
 bool RKInput::isValid () {

Modified: branches/KDE4_port/rkward/plugin/rktabpage.cpp
===================================================================
--- branches/KDE4_port/rkward/plugin/rktabpage.cpp	2007-11-16 15:10:26 UTC (rev 2230)
+++ branches/KDE4_port/rkward/plugin/rktabpage.cpp	2007-11-16 16:33:50 UTC (rev 2231)
@@ -56,17 +56,18 @@
 	if (property == visibility_property) {
 		if (visibility_property->boolValue ()) {
 			if (!inserted) {
-				tabbook->insertTab (this, label, index);
+#warning this may not be reliable, if an earlier page is invisible as well
+				tabbook->insertTab (index, this, label);
 				inserted = true;
 			}
 		} else {
 			if (inserted) {
-				tabbook->removePage (this);
+				tabbook->removeTab (tabbook->indexOf (this));
 				inserted = false;
 			}
 		}
 	} else if (property == enabledness_property) {
-		tabbook->setTabEnabled (this, enabledness_property->boolValue ());
+		tabbook->setTabEnabled (tabbook->indexOf (this), enabledness_property->boolValue ());
 	}
 }
 

Modified: branches/KDE4_port/rkward/plugin/rktext.cpp
===================================================================
--- branches/KDE4_port/rkward/plugin/rktext.cpp	2007-11-16 15:10:26 UTC (rev 2230)
+++ branches/KDE4_port/rkward/plugin/rktext.cpp	2007-11-16 16:33:50 UTC (rev 2231)
@@ -42,7 +42,7 @@
 	vbox->addWidget (label);
 
 	QString initial_text;
-	QStringList lines = lines.split ("\n", element.text (), false);
+	QStringList lines = element.text ().split ("\n");
 	for (int i=0; i < lines.count (); i++) {
 		QString line = lines[i].trimmed ();
 		if (!line.isEmpty ()) {
@@ -53,13 +53,15 @@
 	int type = xml->getMultiChoiceAttribute (element, "type", "normal;warning;error", 0, DL_INFO);
 	if (type != 0) {
 		QFont font = label->font ();
+		QPalette palette = label->palette ();
 		if (type == 1) {		// warning
-			label->setPaletteForegroundColor (QColor (255, 100, 0));
+			palette.setColor (label->foregroundRole (), QColor (255, 100, 0));
 			font.setWeight (QFont::DemiBold);
 		} else if (type == 2) {		// error
-			label->setPaletteForegroundColor (QColor (255, 0, 0));
+			palette.setColor (label->foregroundRole (), QColor (255, 0, 0));
 			font.setWeight (QFont::Bold);
 		}
+		label->setPalette (palette);
 		label->setFont (font);
 	}
 

Modified: branches/KDE4_port/rkward/plugin/rkvarslot.cpp
===================================================================
--- branches/KDE4_port/rkward/plugin/rkvarslot.cpp	2007-11-16 15:10:26 UTC (rev 2230)
+++ branches/KDE4_port/rkward/plugin/rkvarslot.cpp	2007-11-16 16:33:50 UTC (rev 2231)
@@ -25,15 +25,14 @@
 #include <QGridLayout>
 
 #include <klocale.h>
-#include <kiconloader.h>
 
 #include "rkvarselector.h"
 #include "../core/robject.h"
 #include "../rkglobals.h"
 #include "../debug.h"
 #include "../misc/xmlhelper.h"
+#include "../misc/rkstandardicons.h"
 
-
 RKVarSlot::RKVarSlot (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
 	RK_TRACE (PLUGIN);
 
@@ -49,7 +48,7 @@
 	setSelectButton (false);
 	connect (select, SIGNAL (clicked ()), this, SLOT (selectPressed ()));
 	g_layout->addWidget (select, 1, 0);
-	g_layout->addColSpacing (1, 5);
+	g_layout->addItem (new QSpacerItem (5, 0), 0, 1);
 
 	list = new QTreeWidget (this);
 	list->setSelectionMode (QAbstractItemView::ExtendedSelection);
@@ -85,9 +84,9 @@
 	}
 
 	// initialize filters
-	available->setClassFilter (QStringList::split (" ", xml->getStringAttribute (element, "classes", QString::null, DL_INFO)));
+	available->setClassFilter (xml->getStringAttribute (element, "classes", QString (), DL_INFO).split (" "));
 	setRequired (xml->getBoolAttribute (element, "required", false, DL_INFO));
-	available->setTypeFilter (QStringList::split (" ", xml->getStringAttribute (element, "types", QString::null, DL_INFO)));
+	available->setTypeFilter (xml->getStringAttribute (element, "types", QString::null, DL_INFO).split (" "));
 	available->setDimensionFilter (xml->getIntAttribute (element, "num_dimensions", 0, DL_INFO), xml->getIntAttribute (element, "min_length", 0, DL_INFO), xml->getIntAttribute (element, "max_length", INT_MAX, DL_INFO));
 
 	connect (available, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (availablePropertyChanged (RKComponentPropertyBase *)));
@@ -100,10 +99,10 @@
 
 void RKVarSlot::setSelectButton (bool add) {
 	if (add) {
-		select->setPixmap (SmallIcon ("arrow-right"));
+		select->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionAddRight));
 		add_mode = true;
 	} else {
-		select->setPixmap (SmallIcon ("arrow-left"));
+		select->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRemoveLeft));
 		add_mode = false;
 	}
 }
@@ -148,19 +147,21 @@
 void RKVarSlot::updateLook () {
 	RK_TRACE (PLUGIN);
 
+	QPalette palette = list->palette ();
 	if (isEnabled ()) {
 		if (!isSatisfied ()) {
-			list->setPaletteBackgroundColor (QColor (255, 0, 0));
+			palette.setColor (list->backgroundRole (), QColor (255, 0, 0));
 		} else {
-			list->setPaletteBackgroundColor (QColor (255, 255, 255));
+			palette.setColor (list->backgroundRole (), QColor (255, 255, 255));
 		}
 	} else {
 		if (!isSatisfied ()) {
-			list->setPaletteBackgroundColor (QColor (200, 0, 0));
+			palette.setColor (list->backgroundRole (), QColor (200, 0, 0));
 		} else {
-			list->setPaletteBackgroundColor (QColor (200, 200, 200));
+			palette.setColor (list->backgroundRole (), QColor (200, 200, 200));
 		}
 	}
+	list->setPalette(palette);
 }
 
 void RKVarSlot::selectPressed () {

Modified: branches/KDE4_port/rkward/rbackend/rthread.h
===================================================================
--- branches/KDE4_port/rkward/rbackend/rthread.h	2007-11-16 15:10:26 UTC (rev 2230)
+++ branches/KDE4_port/rkward/rbackend/rthread.h	2007-11-16 16:33:50 UTC (rev 2231)
@@ -20,6 +20,7 @@
 #include <qthread.h>
 #include <qstringlist.h>
 #include <QList>
+#include <QEvent>
 
 #include "rcommand.h"
 #include "rcommandstack.h"
@@ -29,6 +30,30 @@
 struct RCallbackArgs;
 struct ROutput;
 
+/** Simple event class to relay information from the RThread to the main thread. This is basically like QCustomEvent in Qt3*/
+class RKRBackendEvent : public QEvent {
+public:
+	enum EventType {
+		BaseEvent = QEvent::User + 1,
+		RCommandInEvent,
+		RCommandOutEvent,
+		RBusyEvent,
+		RIdleEvent,
+		RCommandOutputEvent,
+		RStaredEvent,
+		REvalRequestEvent,
+		RCallbackRequestEvent,
+		RStartupErrorEvent
+	};
+
+	RKRBackendEvent (EventType type, void* data) : QEvent (type) { _data = data; };
+	RKRBackendEvent ();
+
+	void* data () { return _data; };
+private:
+	void* _data;
+};
+
 #define RCOMMAND_IN_EVENT 10001
 #define RCOMMAND_OUT_EVENT 10002
 #define RBUSY_EVENT 10003


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list