changeset 206:aeeaae4dd540

'Dropsite' fixes for d2.
author SokoL_SD
date Tue, 14 Jul 2009 09:13:27 +0000
parents 3dadfee97421
children 71101646ab25
files examples/draganddrop/dropsite/droparea.d examples/draganddrop/dropsite/dropsitewindow.d examples/draganddrop/dropsite/main.d
diffstat 3 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/examples/draganddrop/dropsite/droparea.d	Mon Jul 13 23:35:23 2009 +0000
+++ b/examples/draganddrop/dropsite/droparea.d	Tue Jul 14 09:13:27 2009 +0000
@@ -43,9 +43,6 @@
 
 import qt.gui.QLabel;
 
-import tango.io.Stdout;
-
-
 class DropArea : public QLabel
 {
 public:
@@ -107,7 +104,7 @@
 			setTextFormat(Qt.PlainText);
 		} else if (mimeData.hasUrls()) {
 			QUrl[] urlList = mimeData.urls();
-			char[] text;
+			string text;
 			for (int i = 0; i < urlList.length && i < 32; ++i) {
 				text ~= urlList[i].path() ~ "\n";
 			}
--- a/examples/draganddrop/dropsite/dropsitewindow.d	Mon Jul 13 23:35:23 2009 +0000
+++ b/examples/draganddrop/dropsite/dropsitewindow.d	Tue Jul 14 09:13:27 2009 +0000
@@ -47,6 +47,7 @@
     import tango.text.convert.Format: format = Format;
 } else {
     import std.string;
+    alias strip trim;
 }
 
 import qt.gui.QWidget;
@@ -75,7 +76,7 @@
 		dropArea = new DropArea;
 		dropArea.changed.connect(&updateFormatsTable);
 
-		char[][] labels;
+		string[] labels;
 		labels ~= tr("Format");
 		labels ~= tr("Content");
 
@@ -112,12 +113,12 @@
 		if (!mimeData)
 			return;
 
-		foreach (char[] format; mimeData.formats()) {
+		foreach (string format; mimeData.formats()) {
 			QTableWidgetItem formatItem = new QTableWidgetItem(format);
 			formatItem.setFlags(Qt.ItemIsEnabled);
 			formatItem.setTextAlignment(Qt.AlignTop | Qt.AlignLeft);
 
-			char[] text;
+			string text;
 			if (format == "text/plain") {
 				text = trim(mimeData.text());
 			} else if (format == "text/html") {
@@ -125,13 +126,16 @@
 			} else if (format == "text/uri-list") {
 				QUrl[] urlList = mimeData.urls();
 				for (int i = 0; i < urlList.length && i < 32; ++i) {
-					char[] url = urlList[i].path();
+					string url = urlList[i].path();
 					text ~= url ~ " ";
 				}
 			} else {
 				QByteArray data = mimeData.data(format);
 				for (int i = 0; i < data.size() && i < 32; ++i) {
-					char[] hex = toUpper(Format("{0:x}", data.at(i)));
+					version(Tango)
+					    string hex = toUupper(Format("{0:x}", data.at(i)));
+					else
+					    string hex = toupper(std.string.format("%x", data.at(i)));					
 					text ~= hex ~ " ";
 				}
 			}
--- a/examples/draganddrop/dropsite/main.d	Mon Jul 13 23:35:23 2009 +0000
+++ b/examples/draganddrop/dropsite/main.d	Tue Jul 14 09:13:27 2009 +0000
@@ -42,7 +42,7 @@
 import qt.gui.QApplication;
 import dropsitewindow;
 
-int main(char[][] args)
+int main(string[] args)
 {
     scope app = new QApplication(args);
     scope window = new DropSiteWindow;