132
117
ulStatus = GTK_STATUSBAR(glade_xml_get_widget(xml, "status6"));
133
118
dlStatus = GTK_STATUSBAR(glade_xml_get_widget(xml, "status7"));
135
connectButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "connect"));
136
pubHubsButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "publicHubs"));
137
searchButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "search"));
138
settingsButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "settings"));
139
hashButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "hash"));
140
queueButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "queue"));
141
finishedDL_button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "finishedDownloads"));
142
finishedUL_button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "finishedUploads"));
143
favHubsButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "favHubs"));
144
quitButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "quit"));
120
GtkToolButton *connectButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "connect"));
121
GtkToolButton *pubHubsButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "publicHubs"));
122
GtkToolButton *searchButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "search"));
123
GtkToolButton *settingsButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "settings"));
124
GtkToolButton *hashButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "hash"));
125
GtkToolButton *queueButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "queue"));
126
GtkToolButton *finishedDL_button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "finishedDownloads"));
127
GtkToolButton *finishedUL_button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "finishedUploads"));
128
GtkToolButton *favHubsButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "favHubs"));
129
GtkToolButton *quitButton = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, "quit"));
146
131
exitDialog = GTK_DIALOG(glade_xml_get_widget(xml, "exitDialog"));
147
132
connectDialog = GTK_DIALOG(glade_xml_get_widget(xml, "connectDialog"));
148
133
flistDialog = GTK_DIALOG(glade_xml_get_widget(xml, "flistDialog"));
149
134
aboutDialog = GTK_DIALOG(glade_xml_get_widget(xml, "aboutDialog"));
135
gtk_dialog_set_alternative_button_order(exitDialog, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1);
136
gtk_dialog_set_alternative_button_order(connectDialog, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1);
137
gtk_dialog_set_alternative_button_order(flistDialog, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1);
151
139
window = GTK_WINDOW(glade_xml_get_widget(xml, "mainWindow"));
140
transferPane = GTK_PANED(glade_xml_get_widget(xml, "pane"));
152
141
book = GTK_NOTEBOOK(glade_xml_get_widget(xml, "book"));
153
transferView = GTK_TREE_VIEW(glade_xml_get_widget(xml, "transfers"));
154
142
connectEntry = GTK_ENTRY(glade_xml_get_widget(xml, "connectEntry"));
156
openFList = GTK_MENU_ITEM(glade_xml_get_widget(xml, "open_file_list_1"));
157
openOwnFList = GTK_MENU_ITEM(glade_xml_get_widget(xml, "open_own_list1"));
158
refreshFList = GTK_MENU_ITEM(glade_xml_get_widget(xml, "refresh_file_list1"));
159
openDLdir = GTK_MENU_ITEM(glade_xml_get_widget(xml, "open_downloads_directory1"));
160
quickConnect = GTK_MENU_ITEM(glade_xml_get_widget(xml, "quick_connect1"));
161
followRedirect = GTK_MENU_ITEM(glade_xml_get_widget(xml, "follow_last_redirect1"));
162
reconnectItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "reconnect1"));
163
settingsItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "settings1"));
164
quitItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "exit1"));
143
windowMenu = glade_xml_get_widget(xml, "windowMenu");
145
// Set the logo in the about menu.
146
file = WulforManager::get()->getPath() + "/pixmaps/linuxdcpp.png";
147
GtkImage *logo = GTK_IMAGE(gtk_image_new_from_file(file.c_str()));
148
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(aboutDialog), gtk_image_get_pixbuf(logo));
150
// Set all windows to the default icon
151
file = WulforManager::get()->getPath() + "/pixmaps/linuxdcpp-icon.png";
152
gtk_window_set_icon_from_file(window, file.c_str(), NULL);
153
gtk_window_set_default_icon_from_file(file.c_str(), NULL);
155
GtkMenuItem *openFList = GTK_MENU_ITEM(glade_xml_get_widget(xml, "open_file_list_1"));
156
GtkMenuItem *openOwnFList = GTK_MENU_ITEM(glade_xml_get_widget(xml, "open_own_list1"));
157
GtkMenuItem *refreshFList = GTK_MENU_ITEM(glade_xml_get_widget(xml, "refresh_file_list1"));
158
GtkMenuItem *openDLdir = GTK_MENU_ITEM(glade_xml_get_widget(xml, "open_downloads_directory1"));
159
GtkMenuItem *quickConnect = GTK_MENU_ITEM(glade_xml_get_widget(xml, "quick_connect1"));
160
GtkMenuItem *followRedirect = GTK_MENU_ITEM(glade_xml_get_widget(xml, "follow_last_redirect1"));
161
GtkMenuItem *reconnectItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "reconnect1"));
162
GtkMenuItem *settingsItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "settings1"));
163
GtkMenuItem *quitItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "exit1"));
166
pubHubsItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "public_hubs1"));
167
queueItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "download_queue1"));
168
finishedDL_item = GTK_MENU_ITEM(glade_xml_get_widget(xml, "finished_downloads1"));
169
finishedUL_item = GTK_MENU_ITEM(glade_xml_get_widget(xml, "finished_uploads1"));
170
favHubsItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "favorite_hubs1"));
171
favUsersItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "favorite_users1"));
172
searchItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "search1"));
173
ADLSearchItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "adl_search1"));
174
searchSpyItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "search_spy1"));
175
networkStatsItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "network_statistics1"));
176
hashItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "indexing_progress1"));
177
aboutItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "about"));
165
GtkMenuItem *pubHubsItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "public_hubs1"));
166
GtkMenuItem *queueItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "download_queue1"));
167
GtkMenuItem *finishedDL_item = GTK_MENU_ITEM(glade_xml_get_widget(xml, "finished_downloads1"));
168
GtkMenuItem *finishedUL_item = GTK_MENU_ITEM(glade_xml_get_widget(xml, "finished_uploads1"));
169
GtkMenuItem *favHubsItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "favorite_hubs1"));
170
GtkMenuItem *favUsersItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "favorite_users1"));
171
GtkMenuItem *searchItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "search1"));
172
GtkMenuItem *ADLSearchItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "adl_search1"));
173
GtkMenuItem *searchSpyItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "search_spy1"));
174
GtkMenuItem *networkStatsItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "network_statistics1"));
175
GtkMenuItem *hashItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "indexing_progress1"));
176
GtkMenuItem *aboutItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "about"));
179
178
gtk_widget_set_sensitive(GTK_WIDGET(openDLdir), false);
180
179
gtk_widget_set_sensitive(GTK_WIDGET(followRedirect), false);
263
280
g_signal_connect (G_OBJECT (closeConnection), "activate", G_CALLBACK (onCloseConnectionClicked_gui), (gpointer)this);
264
281
gtk_menu_shell_append (GTK_MENU_SHELL (popupMenu), closeConnection);
266
gtk_widget_show_all (popupMenu);
268
283
gtk_widget_show_all(GTK_WIDGET(window));
270
connectCallback.connect(G_OBJECT(connectButton), "clicked", NULL);
271
connectCallback.connect(G_OBJECT(quickConnect), "activate", NULL);
272
pubHubsCallback.connect(G_OBJECT(pubHubsButton), "clicked", NULL);
273
pubHubsCallback.connect(G_OBJECT(pubHubsItem), "activate", NULL);
274
dlQueueCallback.connect(G_OBJECT(queueButton), "clicked", NULL);
275
dlQueueCallback.connect(G_OBJECT(queueItem), "activate", NULL);
276
favHubsCallback.connect(G_OBJECT(favHubsButton), "clicked", NULL);
277
favHubsCallback.connect(G_OBJECT(favHubsItem), "activate", NULL);
278
settingsCallback.connect(G_OBJECT(settingsButton), "clicked", NULL);
279
settingsCallback.connect(G_OBJECT(settingsItem), "activate", NULL);
280
searchCallback.connect(G_OBJECT(searchButton), "clicked", NULL);
281
searchCallback.connect(G_OBJECT(searchItem), "activate", NULL);
282
hashCallback.connect(G_OBJECT(hashButton), "clicked", NULL);
283
hashCallback.connect(G_OBJECT(hashItem), "activate", NULL);
284
aboutCallback.connect(G_OBJECT(aboutItem), "activate", NULL);
285
quitCallback.connect(G_OBJECT(quitItem), "activate", NULL);
286
quitCallback.connect(G_OBJECT(quitButton), "clicked", NULL);
287
aboutItem = GTK_MENU_ITEM(glade_xml_get_widget(xml, "about"));
288
finishedDL_Callback.connect(G_OBJECT(finishedDL_button), "clicked", NULL);
289
finishedDL_Callback.connect(G_OBJECT(finishedDL_item), "activate", NULL);
290
finishedUL_Callback.connect(G_OBJECT(finishedUL_button), "clicked", NULL);
291
finishedUL_Callback.connect(G_OBJECT(finishedUL_item), "activate", NULL);
292
openFListCallback.connect(G_OBJECT(openFList), "activate", NULL);
293
openFListCallback.connect(G_OBJECT(openOwnFList), "activate", NULL);
294
refreshFListCallback.connect(G_OBJECT(refreshFList), "activate", NULL);
296
deleteCallback.connect(G_OBJECT(window), "delete-event", NULL);
297
// transferCallback.connect(G_OBJECT(window), "button-release-event", this);
298
switchPageCallback.connect(G_OBJECT(book), "switch-page", NULL);
285
g_signal_connect(G_OBJECT(connectButton), "clicked", G_CALLBACK(connectClicked_gui), (gpointer)this);
286
g_signal_connect(G_OBJECT(quickConnect), "activate", G_CALLBACK(connectClicked_gui), (gpointer)this);
287
g_signal_connect(G_OBJECT(pubHubsButton), "clicked", G_CALLBACK(pubHubsClicked_gui), (gpointer)this);
288
g_signal_connect(G_OBJECT(pubHubsItem), "activate", G_CALLBACK(pubHubsClicked_gui), (gpointer)this);
289
g_signal_connect(G_OBJECT(searchButton), "clicked", G_CALLBACK(searchClicked_gui), (gpointer)this);
290
g_signal_connect(G_OBJECT(searchItem), "activate", G_CALLBACK(searchClicked_gui), (gpointer)this);
291
g_signal_connect(G_OBJECT(settingsButton), "clicked", G_CALLBACK(settingsClicked_gui), (gpointer)this);
292
g_signal_connect(G_OBJECT(settingsItem), "activate", G_CALLBACK(settingsClicked_gui), (gpointer)this);
293
g_signal_connect(G_OBJECT(hashButton), "clicked", G_CALLBACK(hashClicked_gui), (gpointer)this);
294
g_signal_connect(G_OBJECT(hashItem), "activate", G_CALLBACK(hashClicked_gui), (gpointer)this);
295
g_signal_connect(G_OBJECT(queueButton), "clicked", G_CALLBACK(dlQueueClicked_gui), (gpointer)this);
296
g_signal_connect(G_OBJECT(queueItem), "activate", G_CALLBACK(dlQueueClicked_gui), (gpointer)this);
297
g_signal_connect(G_OBJECT(finishedDL_button), "clicked", G_CALLBACK(finishedDLclicked_gui), (gpointer)this);
298
g_signal_connect(G_OBJECT(finishedDL_item), "activate", G_CALLBACK(finishedDLclicked_gui), (gpointer)this);
299
g_signal_connect(G_OBJECT(finishedUL_button), "clicked", G_CALLBACK(finishedULclicked_gui), (gpointer)this);
300
g_signal_connect(G_OBJECT(finishedUL_item), "activate", G_CALLBACK(finishedULclicked_gui), (gpointer)this);
301
g_signal_connect(G_OBJECT(favHubsButton), "clicked", G_CALLBACK(favHubsClicked_gui), (gpointer)this);
302
g_signal_connect(G_OBJECT(favHubsItem), "activate", G_CALLBACK(favHubsClicked_gui), (gpointer)this);
303
g_signal_connect(G_OBJECT(quitItem), "activate", G_CALLBACK(quitClicked_gui), (gpointer)this);
304
g_signal_connect(G_OBJECT(quitButton), "clicked", G_CALLBACK(quitClicked_gui), (gpointer)this);
305
g_signal_connect(G_OBJECT(aboutItem), "activate", G_CALLBACK(aboutClicked_gui), (gpointer)this);
306
g_signal_connect(G_OBJECT(openFList), "activate", G_CALLBACK(openFileList_gui), (gpointer)this);
307
g_signal_connect(G_OBJECT(openOwnFList), "activate", G_CALLBACK(openOwnList_gui), (gpointer)this);
308
g_signal_connect(G_OBJECT(refreshFList), "activate", G_CALLBACK(refreshFList_gui), (gpointer)this);
309
g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(deleteWindow_gui), (gpointer)this);
300
311
//Load window state and position from settings manager
301
int posX = SETTING(MAIN_WINDOW_POS_X);
302
int posY = SETTING(MAIN_WINDOW_POS_Y);
303
int sizeX = SETTING(MAIN_WINDOW_SIZE_X);
304
int sizeY = SETTING(MAIN_WINDOW_SIZE_Y);
312
WulforSettingsManager *sm = WulforSettingsManager::get();
313
int posX = sm->getInt("main-window-pos-x");
314
int posY = sm->getInt("main-window-pos-y");
315
int sizeX = sm->getInt("main-window-size-x");
316
int sizeY = sm->getInt("main-window-size-y");
317
int transferPanePosition = sm->getInt("transfer-pane-position");
306
//The gtk move/get position cause drift, one adds window decorations, one does not
307
gdk_window_move(GTK_WIDGET(window)->window, posX, posY);
308
gtk_window_resize(window, sizeX, sizeY);
309
if (SETTING(MAIN_WINDOW_STATE) == STATE_MAXIMIZED)
319
gtk_window_move(window, posX, posY);
320
gtk_window_resize(window, sizeX, sizeY);
321
if (sm->getInt("main-window-maximized"))
310
322
gtk_window_maximize(window);
312
//Create text in about window
313
GtkLabel *al = GTK_LABEL(glade_xml_get_widget(xml, "aboutLabel"));
314
string text = string("<big>Linux DC++</big>\n") +
315
string("Bringing DC++ to Linux!\n") +
316
string("<b>Version:</b> 0.1-rc1\n") +
317
string("<b>Core version:</b> ") + string(VERSIONSTRING) + string("\n") +
318
string("<b>Developers:</b>\n ") +
319
string("Jens Oknelid (paskharen)\n") +
320
string("Alexander Nordfelth (phase)\n") +
323
string("Trent Lloyd\n") +
324
string("Kristian Berg/Ixan\n") +
326
string("Rikard Bj�rklind\n") +
327
string("clairvoyant\n") +
329
string("John Armstrong\n") +
331
gtk_label_set_markup(al, Text::acpToUtf8(text).c_str());
323
gtk_paned_set_position(transferPane, transferPanePosition);
333
325
GtkWidget *dummy;
334
326
GtkRequisition req;
434
void MainWindow::onPrivateMessageClicked_gui (GtkMenuItem *item, gpointer user_data)
497
void MainWindow::onPrivateMessageClicked_gui(GtkMenuItem *item, gpointer data)
436
MainWindow *mw = (MainWindow*)user_data;
437
User::Ptr user = mw->getSelectedTransfer_gui ();
499
MainWindow *mw = (MainWindow*)data;
500
User::Ptr user = mw->getSelectedTransfer_gui();
438
501
WulforManager::get()->addPrivMsg_gui(user);
441
void MainWindow::onAddFavoriteUserClicked_gui (GtkMenuItem *item, gpointer user_data)
504
void MainWindow::onAddFavoriteUserClicked_gui(GtkMenuItem *item, gpointer data)
443
MainWindow *mw = (MainWindow*)user_data;
444
User::Ptr user = mw->getSelectedTransfer_gui ();
506
MainWindow *mw = (MainWindow*)data;
507
User::Ptr user = mw->getSelectedTransfer_gui();
445
508
HubManager::getInstance()->addFavoriteUser(user);
448
void MainWindow::onGrantExtraSlotClicked_gui (GtkMenuItem *item, gpointer user_data)
511
void MainWindow::onGrantExtraSlotClicked_gui(GtkMenuItem *item, gpointer data)
450
MainWindow *mw = (MainWindow*)user_data;
451
User::Ptr user = mw->getSelectedTransfer_gui ();
513
MainWindow *mw = (MainWindow*)data;
514
User::Ptr user = mw->getSelectedTransfer_gui();
452
515
UploadManager::getInstance()->reserveSlot(user);
455
void MainWindow::onRemoveUserFromQueueClicked_gui (GtkMenuItem *item, gpointer user_data)
518
void MainWindow::onRemoveUserFromQueueClicked_gui(GtkMenuItem *item, gpointer data)
457
MainWindow *mw = (MainWindow*)user_data;
458
User::Ptr user = mw->getSelectedTransfer_gui ();
520
MainWindow *mw = (MainWindow*)data;
521
User::Ptr user = mw->getSelectedTransfer_gui();
459
522
QueueManager::getInstance()->removeSources(user, QueueItem::Source::FLAG_REMOVED);
462
void MainWindow::onForceAttemptClicked_gui (GtkMenuItem *item, gpointer user_data)
465
MainWindow *mw = (MainWindow*)user_data;
466
GtkTreeSelection *selection;
467
GtkTreeModel *m = GTK_TREE_MODEL (mw->transferStore);
468
selection = mw->transferSel;
470
GList *list = gtk_tree_selection_get_selected_rows (selection, &m);
471
GList *tmp = g_list_first (list);
472
vector<User::Ptr> user;
480
if (gtk_tree_model_get_iter (m, &tmpiter, (GtkTreePath*)tmp->data))
482
user.push_back (TreeViewFactory::getValue<gpointer,ConnectionQueueItem*>(m, &tmpiter, COLUMN_USERPTR)->getUser ());
483
gtk_list_store_set(mw->transferStore, &tmpiter, COLUMN_STATUS, "Connecting (forced)...", -1);
486
tmp = g_list_next (tmp);
491
for (int i=0;i<user.size ();i++)
495
void MainWindow::onCloseConnectionClicked_gui (GtkMenuItem *item, gpointer user_data)
497
MainWindow *mw = (MainWindow*)user_data;
498
GtkTreeSelection *selection;
499
GtkTreeModel *m = GTK_TREE_MODEL (mw->transferStore);
500
selection = mw->transferSel;
502
GList *list = gtk_tree_selection_get_selected_rows (selection, &m);
503
GList *tmp = g_list_first (list);
504
vector<User::Ptr> user;
505
vector<bool> isDownload;
513
if (gtk_tree_model_get_iter (m, &tmpiter, (GtkTreePath*)tmp->data))
515
ConnectionQueueItem *qi = TreeViewFactory::getValue<gpointer,ConnectionQueueItem*>(m, &tmpiter, COLUMN_USERPTR);
516
if (qi->getConnection())
518
if (qi->getConnection()->isSet(UserConnection::FLAG_UPLOAD))
519
isDownload.push_back(false);
521
isDownload.push_back(true);
522
user.push_back (qi->getUser ());
526
tmp = g_list_next (tmp);
531
for (int i=0;i<user.size ();i++)
532
ConnectionManager::getInstance()->removeConnection(user[i], isDownload[i]);
535
void MainWindow::connectClicked_gui(GtkWidget *widget, gpointer data) {
525
void MainWindow::onForceAttemptClicked_gui(GtkMenuItem *menuItem, gpointer data)
527
MainWindow *mw = (MainWindow *)data;
528
GtkTreeModel *m = GTK_TREE_MODEL(mw->transferStore);
532
GList *list = gtk_tree_selection_get_selected_rows(mw->transferSel, NULL);
533
gint count = gtk_tree_selection_count_selected_rows(mw->transferSel);
535
for (int i = 0; i < count; i++)
537
path = (GtkTreePath *)g_list_nth_data(list, i);
538
if (gtk_tree_model_get_iter(m, &iter, path))
540
item = mw->transferView.getValue<gpointer, TransferItem*>(&iter, "TransferItem");
541
item->user->connect();
542
gtk_list_store_set(mw->transferStore, &iter, mw->transferView.col("Status"), "Connecting (forced)...", -1);
544
gtk_tree_path_free(path);
549
void MainWindow::onCloseConnectionClicked_gui(GtkMenuItem *menuItem, gpointer data)
551
MainWindow *mw = (MainWindow *)data;
552
GtkTreeModel *m = GTK_TREE_MODEL(mw->transferStore);
556
GList *list = gtk_tree_selection_get_selected_rows(mw->transferSel, NULL);
557
gint count = gtk_tree_selection_count_selected_rows(mw->transferSel);
559
for (int i = 0; i < count; i++)
561
path = (GtkTreePath *)g_list_nth_data(list, i);
562
if (gtk_tree_model_get_iter(m, &iter, path))
564
item = mw->transferView.getValue<gpointer, TransferItem*>(&iter, "TransferItem");
565
ConnectionManager::getInstance()->removeConnection(item->user, item->isDownload);
567
gtk_tree_path_free(path);
572
void MainWindow::connectClicked_gui(GtkWidget *widget, gpointer data)
574
MainWindow *mw = (MainWindow *)data;
539
gtk_widget_show_all(GTK_WIDGET(connectDialog));
540
response = gtk_dialog_run(connectDialog);
541
gtk_widget_hide(GTK_WIDGET(connectDialog));
578
gtk_widget_show_all(GTK_WIDGET(mw->connectDialog));
579
response = gtk_dialog_run(mw->connectDialog);
580
gtk_widget_hide(GTK_WIDGET(mw->connectDialog));
543
582
if (response == GTK_RESPONSE_OK) {
544
address = gtk_entry_get_text(connectEntry);
583
address = gtk_entry_get_text(mw->connectEntry);
545
584
WulforManager::get()->addHub_gui(address);
855
929
setStatus_gui(dlStatus, dl);
858
void MainWindow::updateTransfer_gui(string id, connection_t type, ConnectionQueueItem *item,
859
string status, string time, string speed, string file, string size, string path)
862
findId_gui(id, &iter);
864
if (!gtk_list_store_iter_is_valid(transferStore, &iter)) {
865
gtk_list_store_append(transferStore, &iter);
866
gtk_list_store_set(transferStore, &iter, COLUMN_ID, id.c_str(), -1);
869
if (type == CONNECTION_UL) {
870
gtk_list_store_set(transferStore, &iter, COLUMN_TYPE, uploadPic, -1);
872
if (type == CONNECTION_DL) {
873
gtk_list_store_set(transferStore, &iter, COLUMN_TYPE, downloadPic, -1);
876
gtk_list_store_set(transferStore, &iter, COLUMN_USER, item->getUser()->getNick().c_str(), COLUMN_USERPTR, (gpointer)item, -1);
879
gtk_list_store_set(transferStore, &iter, COLUMN_STATUS, status.c_str(), -1);
882
gtk_list_store_set(transferStore, &iter, COLUMN_TIMELEFT, time.c_str(), -1);
885
gtk_list_store_set(transferStore, &iter, COLUMN_SPEED, speed.c_str(), -1);
888
gtk_list_store_set(transferStore, &iter, COLUMN_FILENAME, file.c_str(), -1);
891
gtk_list_store_set(transferStore, &iter, COLUMN_SIZE, size.c_str(), -1);
894
gtk_list_store_set(transferStore, &iter, COLUMN_PATH, path.c_str(), -1);
898
void MainWindow::removeTransfer_gui(string id) {
900
findId_gui(id, &iter);
902
if (gtk_list_store_iter_is_valid(transferStore, &iter)) {
903
gtk_list_store_remove(transferStore, &iter);
907
void MainWindow::findId_gui(string id, GtkTreeIter *iter) {
908
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(transferStore), iter);
910
while (gtk_list_store_iter_is_valid(transferStore, iter)) {
913
gtk_tree_model_get(GTK_TREE_MODEL(transferStore), iter,
918
if (id == text) return;
920
//When the connection is just created we don't know the type.
921
//Thus we have a special "connecting" id that matches any other id
922
//from the same user, as well as separate upload and download ids.
923
if (text.find("$Connecting", 0) != string::npos ||
924
id.find("$Connecting", 0) != string::npos)
926
if (text.substr(0, text.find('$', 0)) ==
927
id.substr(0, id.find('$', 0)))
929
gtk_list_store_set(transferStore, iter,
930
COLUMN_ID, id.c_str(), -1);
935
gtk_tree_model_iter_next(GTK_TREE_MODEL(transferStore), iter);
939
string MainWindow::getId_client(ConnectionQueueItem *item) {
940
string ret = item->getUser()->getNick() + "$" +
941
item->getUser()->getLastHubAddress();
943
//The $ is a special char in DC that can't be used in nicks.
944
//Thus nobody can make an evil nick to mess with this list.
945
if (item->getConnection()) {
946
if (item->getConnection()->isSet(UserConnection::FLAG_UPLOAD)) {
952
ret += "$Connecting";
958
string MainWindow::getId_client(Transfer *t) {
959
assert (t->getUserConnection());
960
assert (t->getUserConnection()->getCQI());
962
return getId_client(t->getUserConnection()->getCQI());
965
void MainWindow::transferComplete_client(Transfer *t) {
966
string status, id = getId_client(t);
968
if (t->getUserConnection()->isSet(UserConnection::FLAG_UPLOAD)) {
969
status = "Upload finished, idle...";
971
status = "Download finished, idle...";
975
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_NA, NULL, status,
976
"Done", " ", "", "", "");
977
WulforManager::get()->dispatchGuiFunc(func);
981
void MainWindow::openFList_gui(GtkWidget *widget, gpointer data)
932
void MainWindow::openFileList_gui(GtkWidget *widget, gpointer data)
934
MainWindow *mw = (MainWindow *)data;
984
936
string path, filename;
986
if (widget == GTK_WIDGET(openFList))
938
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(mw->flistDialog),
939
Text::toT(Util::getDataPath() + "FileLists/").c_str());
940
gtk_widget_show_all(GTK_WIDGET(mw->flistDialog));
941
int ret = gtk_dialog_run(mw->flistDialog);
942
gtk_widget_hide(GTK_WIDGET(mw->flistDialog));
944
if (ret == GTK_RESPONSE_OK)
988
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(flistDialog),
989
Text::toT(Util::getDataPath() + "FileLists/").c_str());
990
gtk_widget_show_all(GTK_WIDGET(flistDialog));
991
int ret = gtk_dialog_run(flistDialog);
992
gtk_widget_hide(GTK_WIDGET(flistDialog));
994
if (ret != GTK_RESPONSE_OK && ret != GTK_RESPONSE_ACCEPT) return;
996
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(flistDialog));
946
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(mw->flistDialog));
997
947
filename = g_path_get_basename(path.c_str());
998
948
if (filename.substr(filename.length()-8, 8) != ".xml.bz2" && Util::getFileExt(filename) != ".DcLst")
1000
950
user = new User(filename);
1004
user = new User("My List");
1005
path = Util::getDataPath() + "files.xml.bz2";
1008
// Test if file list already exists
1009
::File myFileList(path, ::File::READ, ::File::OPEN);
1012
catch (const FileException&)
1014
// No existing file list; create one instead
1015
ShareManager::getInstance()->getOwnListFile();
951
WulforManager::get()->addShareBrowser_gui(user, path);
955
void MainWindow::openOwnList_gui(GtkWidget *widget, gpointer data)
957
MainWindow *mw = (MainWindow *)data;
959
string path, filename;
960
user = new User(SETTING(NICK));
961
path = Util::getDataPath() + "files.xml.bz2";
964
// Test if file list already exists
965
::File myFileList(path, ::File::READ, ::File::OPEN);
968
catch (const FileException&)
970
// No existing file list; create one instead
971
ShareManager::getInstance()->getOwnListFile();
1019
973
WulforManager::get()->addShareBrowser_gui(user, path);
976
void MainWindow::updateTransfer_gui(TransferItem *item)
983
path = gtk_tree_row_reference_get_path(item->rowRef);
984
if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(transferStore), &iter, path))
986
gtk_tree_path_free(path);
989
gtk_tree_path_free(path);
991
if (item->isSet(TransferItem::MASK_FILE) && !item->file.empty())
992
gtk_list_store_set(transferStore, &iter, transferView.col("Filename"), item->file.c_str(), -1);
994
if (item->isSet(TransferItem::MASK_PATH) && !item->path.empty())
995
gtk_list_store_set(transferStore, &iter, transferView.col("Path"), item->path.c_str(), -1);
997
if (item->isSet(TransferItem::MASK_STATUS) && !item->status.empty())
998
gtk_list_store_set(transferStore, &iter, transferView.col("Status"), item->status.c_str(), -1);
1000
if (item->isSet(TransferItem::MASK_TIME) && !item->time.empty())
1001
gtk_list_store_set(transferStore, &iter, transferView.col("Time Left"), item->time.c_str(), -1);
1003
if (item->isSet(TransferItem::MASK_SORT_ORDER) && !item->sortOrder.empty())
1004
gtk_list_store_set(transferStore, &iter, transferView.col("Sort Order"), item->sortOrder.c_str(), -1);
1006
if (item->isSet(TransferItem::MASK_SIZE) && item->size >= 0)
1008
gtk_list_store_set(transferStore, &iter,
1009
transferView.col("Size"), Util::formatBytes(item->size).c_str(),
1010
transferView.col("Size Order"), item->size,
1014
if (item->isSet(TransferItem::MASK_SPEED) && item->speed >= 0)
1016
gtk_list_store_set(transferStore, &iter,
1017
transferView.col("Speed"), Util::formatBytes(item->speed).append("/s").c_str(),
1018
transferView.col("Speed Order"), item->speed,
1022
if (item->isSet(TransferItem::MASK_PROGRESS) && item->progress >= 0 && item->progress <= 100)
1023
gtk_list_store_set(transferStore, &iter, transferView.col("Progress"), item->progress, -1);
1026
void MainWindow::removeTransfer_gui(TransferItem *item)
1031
path = gtk_tree_row_reference_get_path(item->rowRef);
1032
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(transferStore), &iter, path))
1033
gtk_list_store_remove(transferStore, &iter);
1035
gtk_tree_path_free(path);
1036
gtk_tree_row_reference_free(item->rowRef);
1041
MainWindow::TransferItem* MainWindow::getTransferItem(UserID id)
1045
if (transferMap.find(id) == transferMap.end())
1047
transferMap[id] = item = new TransferItem(id.first, id.second);
1048
typedef Func1<MainWindow, TransferItem *> F1;
1049
F1 *f1 = new F1(this, &MainWindow::insertTransfer_gui, item);
1050
WulforManager::get()->dispatchGuiFunc(f1);
1053
item = transferMap[id];
1055
item->updateMask = 0;
1059
void MainWindow::insertTransfer_gui(TransferItem *item)
1065
GtkTreeModel *m = GTK_TREE_MODEL(transferStore);
1067
gtk_list_store_append(transferStore, &iter);
1068
path = gtk_tree_model_get_path(m, &iter);
1069
item->rowRef = gtk_tree_row_reference_new(m, path);
1070
gtk_tree_path_free(path);
1072
if (item->isDownload)
1073
gtk_list_store_set(transferStore, &iter, transferView.col("Icon"), downloadPic, -1);
1075
gtk_list_store_set(transferStore, &iter, transferView.col("Icon"), uploadPic, -1);
1077
gtk_list_store_set(transferStore, &iter,
1078
transferView.col("User"), item->nicks.c_str(),
1079
transferView.col("Hub Name"), item->hubs.c_str(),
1080
transferView.col("TransferItem"), (gpointer)item,
1084
void MainWindow::transferComplete_client(Transfer *t)
1086
bool isDownload = t->getUserConnection()->isSet(UserConnection::FLAG_DOWNLOAD);
1087
UserID id(t->getUserConnection()->getUser(), isDownload);
1088
TransferItem *item = getTransferItem(id);
1091
item->setStatus("Download finished, idle...");
1093
item->setStatus("Upload finished, idle...");
1094
item->setTime("Done");
1095
item->setProgress(100);
1096
item->setSortOrder("w" + item->nicks + item->hubs);
1098
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1099
WulforManager::get()->dispatchGuiFunc(func);
1022
1102
void MainWindow::refreshFList_gui(GtkWidget *widget, gpointer data)
1024
//fingers crossed this works, I have no ideas if this works
1025
typedef Func3<ShareManager, bool, bool, bool> F0;
1026
F0 *func = new F0(ShareManager::getInstance(), &ShareManager::refresh, true, true, false);
1027
WulforManager::get()->dispatchGuiFunc(func);
1104
ShareManager::getInstance()->setDirty();
1105
// Function would simply not work when put into GUI queue.
1106
ShareManager::getInstance()->refresh(true, true, false);
1107
ShareManager::getInstance()->getOwnListFile();
1031
1110
//From Connection manager
1032
void MainWindow::on(ConnectionManagerListener::Added, ConnectionQueueItem *item) throw() {
1033
string status = "Connecting...";
1034
string id = getId_client(item);
1037
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_NA,
1038
item, status, "", "", "", "", "");
1039
WulforManager::get()->dispatchGuiFunc(func);
1042
void MainWindow::on(ConnectionManagerListener::Removed, ConnectionQueueItem *item) throw() {
1043
string id = getId_client(item);
1045
typedef Func1 <MainWindow, string> F1;
1046
F1 *func = new F1(this, &MainWindow::removeTransfer_gui, id);
1047
WulforManager::get()->dispatchGuiFunc(func);
1050
void MainWindow::on(ConnectionManagerListener::Failed, ConnectionQueueItem *item, const string &reason) throw() {
1051
string status = reason;
1052
string id = getId_client(item);
1055
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_NA, NULL, status,
1056
"", "", "", "", "");
1057
WulforManager::get()->dispatchGuiFunc(func);
1060
void MainWindow::on(ConnectionManagerListener::StatusChanged, ConnectionQueueItem *item) throw() {
1062
string id = getId_client(item);
1064
if (item->getState() == ConnectionQueueItem::CONNECTING) {
1065
status = "Connecting...";
1067
status = "Waiting to retry...";
1111
void MainWindow::on(ConnectionManagerListener::Added, ConnectionQueueItem *cqi) throw()
1113
UserID id(cqi->getUser(), cqi->getDownload());
1114
TransferItem *item = getTransferItem(id);
1115
item->setStatus("Connecting...");
1116
item->setProgress(0);
1117
item->setSortOrder("w" + item->nicks + item->hubs);
1119
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1120
WulforManager::get()->dispatchGuiFunc(func);
1123
void MainWindow::on(ConnectionManagerListener::Removed, ConnectionQueueItem *cqi) throw()
1125
UserID id(cqi->getUser(), cqi->getDownload());
1127
if (transferMap.find(id) != transferMap.end())
1129
TransferItem *item = transferMap[id];
1130
transferMap.erase(id);
1131
typedef Func1 <MainWindow, TransferItem *> F1;
1132
F1 *func = new F1(this, &MainWindow::removeTransfer_gui, item);
1133
WulforManager::get()->dispatchGuiFunc(func);
1071
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_NA, NULL, status,
1072
"", "", "", "", "");
1137
void MainWindow::on(ConnectionManagerListener::Failed, ConnectionQueueItem *cqi, const string &reason) throw()
1139
UserID id(cqi->getUser(), cqi->getDownload());
1140
TransferItem *item = getTransferItem(id);
1141
item->setStatus(reason, true);
1142
item->setSortOrder("w" + item->nicks + item->hubs);
1144
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1145
WulforManager::get()->dispatchGuiFunc(func);
1148
void MainWindow::on(ConnectionManagerListener::StatusChanged, ConnectionQueueItem *cqi) throw()
1150
UserID id(cqi->getUser(), cqi->getDownload());
1151
TransferItem *item = getTransferItem(id);
1153
if (cqi->getState() == ConnectionQueueItem::CONNECTING)
1154
item->setStatus("Connecting...");
1156
item->setStatus("Waiting to retry...");
1158
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1073
1159
WulforManager::get()->dispatchGuiFunc(func);
1076
1162
//From Download manager
1077
void MainWindow::on(DownloadManagerListener::Starting, Download *dl) throw() {
1078
string status, size, path, file, target;
1079
string id = getId_client(dl);
1081
size = Util::formatBytes(dl->getSize());
1082
target = Text::acpToUtf8(dl->getTarget());
1083
status = "Download starting...";
1163
void MainWindow::on(DownloadManagerListener::Starting, Download *dl) throw()
1165
UserID id(dl->getUserConnection()->getUser(), TRUE);
1166
TransferItem *item = getTransferItem(id);
1167
string target = Text::acpToUtf8(dl->getTarget());
1085
1169
if (dl->isSet(Download::FLAG_USER_LIST))
1170
item->setFile("Filelist");
1171
else if (dl->isSet(Download::FLAG_TREE_DOWNLOAD))
1172
item->setFile("TTH: " + Util::getFileName(target));
1092
file = Util::getFileName(target);
1093
path = Util::getFilePath(target);
1097
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_DL, NULL, status,
1098
"", "", file, size, path);
1174
item->setFile(Util::getFileName(target));
1176
item->setPath(Util::getFilePath(target));
1177
item->setStatus("Download starting...");
1178
item->setSize(dl->getSize());
1179
item->setSortOrder("d" + item->nicks + item->hubs);
1181
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1099
1182
WulforManager::get()->dispatchGuiFunc(func);
1102
void MainWindow::on(DownloadManagerListener::Tick, const Download::List &list) throw() {
1103
string id, status, timeLeft, speed;
1185
void MainWindow::on(DownloadManagerListener::Tick, const Download::List &list) throw()
1187
string status, time, bytes;
1104
1190
Download::List::const_iterator it;
1106
for (it = list.begin(); it != list.end(); it++) {
1193
for (it = list.begin(); it != list.end(); it++)
1108
1196
ostringstream stream;
1110
id = getId_client(dl);
1112
string bytes = Util::formatBytes(dl->getPos());
1113
double percent = (double)(dl->getPos() * 100.0) / dl->getSize();
1114
string time = Util::formatSeconds((GET_TICK() - dl->getStart()) / 1000);
1197
UserID id(dl->getUserConnection()->getUser(), TRUE);
1198
item = getTransferItem(id);
1200
bytes = Util::formatBytes(dl->getPos());
1201
percent = (double)(dl->getPos() * 100.0) / dl->getSize();
1202
time = Util::formatSeconds((GET_TICK() - dl->getStart()) / 1000);
1115
1203
stream << setiosflags(ios::fixed) << setprecision(1);
1116
1204
stream << "Downloaded " << bytes << " (" << percent << "%) in " << time;
1118
timeLeft = Util::formatSeconds(dl->getSecondsLeft());
1119
speed = Util::formatBytes(dl->getRunningAverage()) + "/s";
1121
if (dl->isSet(Download::FLAG_ZDOWNLOAD)) {
1122
status = "* " + stream.str();
1124
status = stream.str();
1128
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_NA, NULL,
1129
status, timeLeft, speed, "", "", "");
1207
/* Future flags in DC++ > 0.674
1208
if (dl->getUserConnection()->isSecure())
1210
if (dl->isSet(Download::FLAG_TTH_CHECK))
1212
*/ if (dl->isSet(Download::FLAG_ZDOWNLOAD))
1214
if (dl->isSet(Download::FLAG_ROLLBACK))
1216
if (!status.empty())
1218
status += stream.str();
1220
item->setStatus(status);
1221
item->setTime(Util::formatSeconds(dl->getSecondsLeft()));
1222
item->setSpeed(dl->getRunningAverage());
1223
item->setProgress((int)percent);
1225
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1130
1226
WulforManager::get()->dispatchGuiFunc(func);
1134
void MainWindow::on(DownloadManagerListener::Complete, Download *dl) throw() {
1230
void MainWindow::on(DownloadManagerListener::Complete, Download *dl) throw()
1135
1232
transferComplete_client(dl);
1138
void MainWindow::on(DownloadManagerListener::Failed, Download *dl, const string &reason) throw() {
1139
string status, size, file, path, target;
1140
string id = getId_client(dl);
1143
size = Util::formatBytes(dl->getSize());
1144
target = Text::acpToUtf8(dl->getTarget());
1235
void MainWindow::on(DownloadManagerListener::Failed, Download *dl, const string &reason) throw()
1237
UserID id(dl->getUserConnection()->getUser(), TRUE);
1238
TransferItem *item = getTransferItem(id);
1239
string target = Text::acpToUtf8(dl->getTarget());
1146
1241
if (dl->isSet(Download::FLAG_USER_LIST))
1242
item->setFile("Filelist");
1243
else if (dl->isSet(Download::FLAG_TREE_DOWNLOAD))
1244
item->setFile("TTH: " + Util::getFileName(target));
1153
file = Util::getFileName(target);
1154
path = Util::getFilePath(target);
1158
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_NA, NULL,
1159
status, "", "", file, size, path);
1246
item->setFile(Util::getFileName(target));
1248
item->setPath(Util::getFilePath(target));
1249
item->setStatus(reason, true);
1250
item->setSize(dl->getSize());
1251
item->setSortOrder("w" + item->nicks + item->hubs);
1253
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1160
1254
WulforManager::get()->dispatchGuiFunc(func);
1163
1257
//From Upload manager
1164
void MainWindow::on(UploadManagerListener::Starting, Upload *ul) throw() {
1165
string status, size, path, file, target;
1166
string id = getId_client(ul);
1168
size = Util::formatBytes(ul->getSize());
1169
target = Text::acpToUtf8(ul->getFileName());
1170
status = "Upload starting...";
1172
if (ul->isSet(Upload::FLAG_USER_LIST))
1258
void MainWindow::on(UploadManagerListener::Starting, Upload *ul) throw()
1260
UserID id(ul->getUserConnection()->getUser(), FALSE);
1261
TransferItem *item = getTransferItem(id);
1262
string target = Text::acpToUtf8(ul->getFileName());
1264
if (ul->isSet(Download::FLAG_USER_LIST))
1265
item->setFile("Filelist");
1266
else if (ul->isSet(Download::FLAG_TREE_DOWNLOAD))
1267
item->setFile("TTH: " + Util::getFileName(target));
1179
file = Util::getFileName(target);
1180
path = Util::getFilePath(target);
1184
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_UL, NULL, status,
1185
"", "", file, size, path);
1269
item->setFile(Util::getFileName(target));
1271
item->setPath(Util::getFilePath(target));
1272
item->setStatus("Upload starting...");
1273
item->setSize(ul->getSize());
1274
item->setSortOrder("u" + item->nicks + item->hubs);
1276
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1186
1277
WulforManager::get()->dispatchGuiFunc(func);
1189
void MainWindow::on(UploadManagerListener::Tick, const Upload::List &list) throw() {
1190
string id, status, timeLeft, speed;
1280
void MainWindow::on(UploadManagerListener::Tick, const Upload::List &list) throw()
1282
string status, time, bytes;
1191
1285
Upload::List::const_iterator it;
1193
for (it = list.begin(); it != list.end(); it++) {
1288
for (it = list.begin(); it != list.end(); it++)
1195
1291
ostringstream stream;
1197
id = getId_client(ul);
1199
string bytes = Util::formatBytes(ul->getPos());
1200
double percent = (double)(ul->getPos() * 100.0) / ul->getSize();
1201
string time = Util::formatSeconds((GET_TICK() - ul->getStart()) / 1000);
1292
UserID id(ul->getUserConnection()->getUser(), FALSE);
1293
item = getTransferItem(id);
1295
bytes = Util::formatBytes(ul->getPos());
1296
percent = (double)(ul->getPos() * 100.0) / ul->getSize();
1297
time = Util::formatSeconds((GET_TICK() - ul->getStart()) / 1000);
1202
1298
stream << setiosflags(ios::fixed) << setprecision(1);
1203
1299
stream << "Uploaded " << bytes << " (" << percent << "%) in " << time;
1205
timeLeft = Util::formatSeconds(ul->getSecondsLeft());
1206
speed = Util::formatBytes(ul->getRunningAverage()) + "/s";
1208
if (ul->isSet(Download::FLAG_ZDOWNLOAD)) {
1209
status = "* " + stream.str();
1211
status = stream.str();
1215
func = new UFunc(this, &MainWindow::updateTransfer_gui, id, CONNECTION_NA, NULL,
1216
status, timeLeft, speed, "", "", "");
1302
/* Future flags in DC++ > 0.674
1303
if (ul->getUserConnection()->isSecure())
1305
*/ if (ul->isSet(Upload::FLAG_ZUPLOAD))
1307
if (!status.empty())
1309
status += stream.str();
1311
item->setStatus(status);
1312
item->setTime(Util::formatSeconds(ul->getSecondsLeft()));
1313
item->setSpeed(ul->getRunningAverage());
1314
item->setProgress((int)percent);
1316
UFunc *func = new UFunc(this, &MainWindow::updateTransfer_gui, item);
1217
1317
WulforManager::get()->dispatchGuiFunc(func);
1221
void MainWindow::on(UploadManagerListener::Complete, Upload *ul) throw() {
1321
void MainWindow::on(UploadManagerListener::Complete, Upload *ul) throw()
1222
1323
transferComplete_client(ul);