Beispiel #1
0
/**
 * 创建待接收文件区域.
 * @return 主窗体
 */
GtkWidget *DialogPeer::CreateFileToReceiveArea()
{
    GtkWidget *frame, *hbox, *vbox, *button ,*pbar, *sw, *treeview;
    GtkTreeModel *model;

    frame = gtk_frame_new(_("File to be receive."));
    gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
    pbar = gtk_progress_bar_new();
    g_datalist_set_data(&widset, "file-receive-progress-bar-widget", pbar);
    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar),_("Receiving progress."));
    hbox = gtk_hbox_new(FALSE,1);
    gtk_box_pack_start(GTK_BOX(hbox),pbar,TRUE,TRUE,0);
    button = gtk_button_new_with_label(_("Accept"));
    g_signal_connect_swapped(button, "clicked",
                     G_CALLBACK(ReceiveFile), this);
    g_datalist_set_data(&widset, "file-receive-accept-button", button);
    gtk_box_pack_start(GTK_BOX(hbox),button,FALSE,TRUE,0);
    button = gtk_button_new_with_label(_("Refuse"));
    gtk_box_pack_start(GTK_BOX(hbox),button,FALSE,TRUE,0);
    g_signal_connect_swapped(button, "clicked",
                     G_CALLBACK(RemoveSelectedRcv), this);
    g_datalist_set_data(&widset, "file-receive-refuse-button", button);
    button = gtk_button_new_with_label(_("Detial"));
    gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0);
    g_signal_connect_swapped(button, "clicked",
                     G_CALLBACK(OpenTransDlg), NULL);
    vbox = gtk_vbox_new(FALSE,0);
    gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
    sw = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
             GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
                                             GTK_SHADOW_ETCHED_IN);
    model = CreateFileToReceiveModel();
    g_datalist_set_data_full(&mdlset, "file-to-receive-model", model,
                             GDestroyNotify(g_object_unref));
    treeview = CreateFileToReceiveTree(model);
    g_datalist_set_data(&widset, "file-to-receive-treeview-widget", treeview);
    g_object_set_data(G_OBJECT(treeview), "dialog", this);
    gtk_container_add(GTK_CONTAINER(sw), treeview);
    gtk_box_pack_end(GTK_BOX(vbox),sw,TRUE,TRUE,0);
    gtk_container_add(GTK_CONTAINER(frame), vbox);

    return frame;
}
Beispiel #2
0
/**
 * 创建已接收文件区域.
 * @return 主窗体
 */
GtkWidget *DialogPeer::CreateFileReceivedArea()
{
    GtkWidget *frame, *sw,  *treeview;
    GtkTreeModel *model;
    frame = gtk_frame_new(_("File received."));
    gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
    sw = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
             GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
                                             GTK_SHADOW_ETCHED_IN);
    model = CreateFileReceivedModel();
    g_datalist_set_data_full(&mdlset, "file-received-model", model,
                             GDestroyNotify(g_object_unref));
    treeview = CreateFileReceivedTree(model);
    g_datalist_set_data(&widset, "file-received-treeview-widget", treeview);
    g_object_set_data(G_OBJECT(treeview), "dialog", this);
    gtk_container_add(GTK_CONTAINER(sw), treeview);
    gtk_container_add(GTK_CONTAINER(frame), sw);

    return frame;
}
Beispiel #3
0
/**
 * 接收好友文件信息.
 */
void UdpData::RecvPalFile()
{
        uint32_t packetno, commandno;
        const char *ptr;
        pthread_t pid;
        GData *para;

        packetno = iptux_get_dec_number(buf, ':', 1);
        commandno = iptux_get_dec_number(buf, ':', 4);
        ptr = iptux_skip_string(buf, size, 1);
        /* 只有当此为共享文件信息或文件信息不为空才需要接收 */
        if ((commandno & IPTUX_SHAREDOPT) || (ptr && *ptr != '\0')) {
                para = NULL;
                g_datalist_init(&para);
                g_datalist_set_data(&para, "palinfo", cthrd.GetPalFromList(ipv4));
                g_datalist_set_data_full(&para, "extra-data", g_strdup(ptr),
                                                 GDestroyNotify(g_free));
                g_datalist_set_data(&para, "packetno", GUINT_TO_POINTER(packetno));
                g_datalist_set_data(&para, "commandno", GUINT_TO_POINTER(commandno));
                pthread_create(&pid, NULL, ThreadFunc(RecvFile::RecvEntry), para);
                pthread_detach(pid);
        }
}
Beispiel #4
0
/**
 * 初始化声音系统.
 */
void SoundSystem::InitSublayer()
{
        GstElement *pipeline;
        GstElement *filesrc, *decode, *volume, *convert, *sink;
        GstBus *bus;

        gst_init(NULL, NULL);
        pipeline = gst_pipeline_new("sound-system");
        g_datalist_set_data_full(&eltset, "pipeline-element", pipeline,
                                 GDestroyNotify(gst_object_unref));
        filesrc = gst_element_factory_make("filesrc", "source");
        g_datalist_set_data(&eltset, "filesrc-element", filesrc);
        decode = gst_element_factory_make("decodebin", "decode");
        g_datalist_set_data(&eltset, "decode-element", decode);
        volume = gst_element_factory_make("volume", "volume");
        g_datalist_set_data(&eltset, "volume-element", volume);
        convert = gst_element_factory_make("audioconvert", "convert");
        g_datalist_set_data(&eltset, "convert-element", convert);
        sink = gst_element_factory_make("autoaudiosink", "output");
        g_datalist_set_data(&eltset, "output-element", sink);

        gst_bin_add_many(GST_BIN(pipeline), filesrc, decode, volume, convert, sink, NULL);
        gst_element_link_many(filesrc, decode, NULL);
        gst_element_link_many(volume, convert, sink, NULL);
        g_signal_connect_swapped(decode, "pad-added", G_CALLBACK(LinkElement), &eltset);

        bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
        gst_bus_add_signal_watch(GST_BUS(bus));
        g_signal_connect_swapped(bus, "message::error",
                         G_CALLBACK(ErrorMessageOccur), this);
        g_signal_connect_swapped(bus, "message::eos",
                         G_CALLBACK(EosMessageOccur), this);
        gst_object_unref(bus);

        g_object_set(volume, "volume", progdt.volume, NULL);
}