|
发表于 2005-10-31 08:17:34
|
显示全部楼层
事实上我只有打上下面的补丁界面才显示正常。
[code:1]
--- BitStormLite-0.1c/src/LiteWindow.cpp 2005-10-29 16:07:52.000000000 +0800
+++ src/LiteWindow.cpp 2005-10-31 08:01:09.000000000 +0800
@@ -103,7 +103,18 @@ void CLiteWindow::createWindow()
//TaskNameLabel
GtkWidget* hbox = gtk_hbox_new(FALSE, 0);
std::string taskName = _task->getTorrentFile()->getName() + " (" + byteCount2Str(_task->getTorrentFile()->getTotalSize()) +")";
- _taskNameLabel = gtk_label_new(_task->getTorrentFile()->getName().c_str());
+ gchar *val = g_strdup(_task->getTorrentFile()->getName().c_str());
+ if (!g_utf8_validate (val, -1, NULL))
+ {
+ gchar * utf8 = g_filename_to_utf8 (val, -1, NULL, NULL, NULL);
+ if (utf8) {
+ g_free (val);
+ val = utf8;
+ }
+ }
+ _taskNameLabel = gtk_label_new(val);
+ g_free (val);
+
gtk_label_set_justify(GTK_LABEL(_taskNameLabel), GTK_JUSTIFY_LEFT);
gtk_box_pack_start(GTK_BOX(hbox), _taskNameLabel, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 3);
@@ -133,12 +144,21 @@ void CLiteWindow::createWindow()
//DownloadTo
hbox = gtk_hbox_new(FALSE, 0);
std::string dest = _("downlaod to : ");
- dest += _task->getDestPath()+_task->getTorrentFile()->getName();
+ val = g_strdup (std::string(_task->getDestPath()+_task->getTorrentFile()->getName()).c_str());
+ if (!g_utf8_validate (val, -1, NULL)) {
+ gchar *utf8 = g_filename_to_utf8 (val, -1, NULL, NULL, NULL);
+ if (utf8) {
+ free (val);
+ val = utf8;
+ }
+ }
+ dest += val;
+ g_free (val);
_downloadToLabel = gtk_label_new(dest.c_str());
gtk_label_set_justify(GTK_LABEL(_downloadToLabel), GTK_JUSTIFY_LEFT);
gtk_box_pack_start(GTK_BOX(hbox), _downloadToLabel, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 3);
-
+
//State
GtkWidget* stateHbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), stateHbox, FALSE, TRUE, 5);
[/code:1] |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|