[rkward-cvs] SF.net SVN: rkward: [1580] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Mar 14 21:21:29 UTC 2007


Revision: 1580
          http://svn.sourceforge.net/rkward/?rev=1580&view=rev
Author:   tfry
Date:     2007-03-14 14:21:29 -0700 (Wed, 14 Mar 2007)

Log Message:
-----------
Add a status bar label for current working directory (does not get updated, yet).
Remove some unneeded includes

Modified Paths:
--------------
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/rkward.h

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2007-03-14 16:21:28 UTC (rev 1579)
+++ trunk/rkward/rkward/rkward.cpp	2007-03-14 21:21:29 UTC (rev 1580)
@@ -38,17 +38,9 @@
 #include <kinputdialog.h>
 #include <kdockwidget.h>
 #include <kmultitabbar.h>
+#include <ksqueezedtextlabel.h>
 #include <dcopclient.h>
 
-// include files for the kate part. Some may not be useful
-#include <ktexteditor/configinterface.h>
-#include <ktexteditor/sessionconfiginterface.h>
-#include <ktexteditor/viewcursorinterface.h>
-#include <ktexteditor/printinterface.h>
-#include <ktexteditor/encodinginterface.h>
-#include <ktexteditor/editorchooser.h>
-#include <ktexteditor/popupmenuinterface.h>
-
 // application specific includes
 #include "rkward.h"
 #include "core/rkmodificationtracker.h"
@@ -409,10 +401,23 @@
 void RKWardMainWindow::initStatusBar () {
 	RK_TRACE (APP);
 
-	r_status_label = new QLabel (i18n ("starting R engine"), statusBar ());
-	r_status_label->setPaletteBackgroundColor (QColor (255, 255, 0));
-	statusBar ()->addWidget (r_status_label, 0, true);
+	// why do we need this QHBox, when the statusbar already does horizontal layout?
+	// Well, apparently the stretch factors do not survive a hide/show, so we need some way to work around this
+	QHBox *statusbar_hbox = new QHBox (statusBar ());
+	statusbar_action = new KSqueezedTextLabel (statusbar_hbox);
+	statusbar_action->hide ();
+	statusbar_ready = new QLabel (i18n ("Ready."), statusbar_hbox);
+	statusbar_cwd = new KSqueezedTextLabel (statusbar_hbox);
+	statusbar_cwd->setAlignment (QLabel::AlignRight);
+	statusbar_hbox->setStretchFactor (statusbar_cwd, 1);
+	updateCWD ();
+	statusBar ()->addWidget (statusbar_hbox, 1);
 
+	statusbar_r_status = new QLabel (i18n ("starting R engine"), statusBar ());
+	statusbar_r_status->setPaletteBackgroundColor (QColor (255, 255, 0));
+	statusbar_r_status->setFixedHeight (statusBar ()->fontMetrics ().height () + 2);
+	statusBar ()->addWidget (statusbar_r_status, 0, true);
+
 	connect (actionCollection (), SIGNAL (actionStatusText (const QString &)), this, SLOT (slotSetStatusBarText (const QString &)));
 	connect (actionCollection (), SIGNAL (clearStatusText ()), this, SLOT (slotSetStatusReady ()));
 }
@@ -713,15 +718,26 @@
 	new RKSaveAgent (RObjectList::getObjectList ()->getWorkspaceURL (), true);
 }
 
+void RKWardMainWindow::updateCWD () {
+	RK_TRACE (APP);
+
+	statusbar_cwd->setText (QDir::currentDirPath ());
+}
+
 void RKWardMainWindow::slotSetStatusBarText (const QString &text) {
 	RK_TRACE (APP);
 
 	QString ntext = text.stripWhiteSpace ();
 	ntext.replace ("<qt>", "");	// WORKAROUND: what the ?!? is going on? The KTHMLPart seems to post such messages.
 	if (ntext.isEmpty ()) {
-		statusBar ()->message (i18n ("Ready."));
+		statusbar_action->hide ();
+		statusbar_ready->show ();
+		statusbar_cwd->show ();
 	} else {
-		statusBar ()->message (ntext);
+		statusbar_action->show ();
+		statusbar_ready->hide ();
+		statusbar_cwd->hide ();
+		statusbar_action->setText (ntext);
 	}
 }
 
@@ -752,11 +768,11 @@
 void RKWardMainWindow::setRStatus (bool busy) {
 	RK_TRACE (APP);
 	if (busy) {
-		r_status_label->setText (i18n ("R engine busy"));
-		r_status_label->setPaletteBackgroundColor (QColor (255, 0, 0));
+		statusbar_r_status->setText (i18n ("R engine busy"));
+		statusbar_r_status->setPaletteBackgroundColor (QColor (255, 0, 0));
 	} else {
-		r_status_label->setText (i18n ("R engine idle"));
-		r_status_label->setPaletteBackgroundColor (QColor (0, 255, 0));
+		statusbar_r_status->setText (i18n ("R engine idle"));
+		statusbar_r_status->setPaletteBackgroundColor (QColor (0, 255, 0));
 	}
 }
 

Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h	2007-03-14 16:21:28 UTC (rev 1579)
+++ trunk/rkward/rkward/rkward.h	2007-03-14 21:21:29 UTC (rev 1580)
@@ -57,6 +57,7 @@
 class RKCommandEditorWindow;
 class KMdiToolViewAccessor;
 class RKMDIWindow;
+class QHBox;
 
 /**
 The main class of rkward. This is where all strings are tied togther, controlls the initialization, and there are some of the most important slots for user actions. All real work is done elsewhere.
@@ -207,7 +208,10 @@
 private:
 	void toggleToolView (RKMDIWindow *tool_window);
 
-	QLabel* r_status_label;
+	QLabel* statusbar_r_status;
+	QLabel* statusbar_cwd;
+	QLabel* statusbar_ready;
+	QLabel* statusbar_action;
 	KParts::PartManager *part_manager;
 
 	// KAction pointers to enable/disable actions
@@ -249,6 +253,8 @@
 	friend class RInterface;
 /** set the R status message ("R engine idel/busy") to idle or busy */
 	void setRStatus (bool busy);
+/** update the display for the current working directory */
+	void updateCWD ();
 };
 
 #endif // RKWARD_H


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