Example #1
0
void
show_action_arg_details (GUPnPServiceActionArgInfo *info)
{
        char *details[32];
        int   i = 0;

        details[i++] = _("Name");
        details[i++] = g_strdup (info->name);
        details[i++] = _("Direction");
        if (info->direction == GUPNP_SERVICE_ACTION_ARG_DIRECTION_IN)
                details[i++] = g_strdup ("in");
        else
                details[i++] = g_strdup ("out");
        details[i++] = _("Related State Variable");
        details[i++] = g_strdup (info->related_state_variable);
        details[i++] = _("Is Return Value");
        details[i++] = g_strdup (info->retval? _("Yes"): _("No"));
        details[i] = NULL;

        update_details ((const char **) details);

        /* Only free the values */
        for (i = 1; details[i - 1]; i += 2) {
                if (details[i])
                        g_free (details[i]);
        }
}
Example #2
0
void
show_device_details (GUPnPDeviceInfo *info)
{
        char          *details[32];
        const SoupURI *uri;
        const char    *str;
        int            i = 0;

        details[i++] = _("Location");
        str = gupnp_device_info_get_location (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("UDN");
        str = gupnp_device_info_get_udn (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("Type");
        str = gupnp_device_info_get_device_type (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("Base URL");
        uri = gupnp_device_info_get_url_base (info);
        if (uri)
                details[i++] = soup_uri_to_string ((SoupURI *) uri, FALSE);

        details[i++] = _("Friendly Name");
        details[i++] = gupnp_device_info_get_friendly_name (info);
        details[i++] = _("Manufacturer");
        details[i++] = gupnp_device_info_get_manufacturer (info);
        details[i++] = _("Manufacturer URL");
        details[i++] = gupnp_device_info_get_manufacturer_url (info);
        details[i++] = _("Model Description");
        details[i++] = gupnp_device_info_get_model_description (info);
        details[i++] = _("Model Name");
        details[i++] = gupnp_device_info_get_model_name (info);
        details[i++] = _("Model Number");
        details[i++] = gupnp_device_info_get_model_number (info);
        details[i++] = _("Model URL");
        details[i++] = gupnp_device_info_get_model_url (info);
        details[i++] = _("Serial Number");
        details[i++] = gupnp_device_info_get_serial_number (info);
        details[i++] = _("UPC");
        details[i++] = gupnp_device_info_get_upc (info);
        details[i++] = _("Presentation URL");
        details[i++] = gupnp_device_info_get_presentation_url (info);
        details[i] = NULL;

        update_details ((const char **) details);

        /* Only free the values */
        for (i = 1; details[i - 1]; i += 2) {
                if (details[i])
                        g_free (details[i]);
        }
}
Example #3
0
void tmp_create_game::on_filter_change(twindow& window, const std::string& id)
{
	create_engine_.apply_level_filter(find_widget<widget>(&window, id, false).get_value());

	tlistbox& game_list = find_widget<tlistbox>(&window, "games_list", false);

	std::vector<bool> filtered(game_list.get_item_count());
	for(const size_t i : create_engine_.get_filtered_level_indices(create_engine_.current_level_type())) {
		filtered[i] = true;
	}

	game_list.set_row_shown(filtered);

	update_details(window);
}
static void
show_default_details (void)
{
        const char *details[32];
        int         i = 0;

        details[i++] = _("Software");
        details[i++] = _(SOFTWARE_INFO);
        details[i++] = _("Version");
        details[i++] = VERSION;
        details[i++] = _("Author");
        details[i++] = AUTHOR_INFO;
        details[i] = NULL;
        update_details (details);
}
Example #5
0
void
show_service_details (GUPnPServiceInfo *info)
{
        char          *details[32];
        const SoupURI *uri;
        const char    *str;
        int            i = 0;

        details[i++] = _("Location");
        str = gupnp_service_info_get_location (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("UDN");
        str = gupnp_service_info_get_udn (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("Type");
        str = gupnp_service_info_get_service_type (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("Base URL");
        uri = gupnp_service_info_get_url_base (info);
        if (uri)
                details[i++] = soup_uri_to_string ((SoupURI *) uri, FALSE);

        details[i++] = _("Service ID");
        details[i++] = gupnp_service_info_get_id (info);
        details[i++] = _("Service URL");
        details[i++] = gupnp_service_info_get_scpd_url (info);
        details[i++] = _("Control URL");
        details[i++] = gupnp_service_info_get_control_url (info);
        details[i++] = _("Event Subscription URL");
        details[i++] = gupnp_service_info_get_event_subscription_url (info);
        details[i] = NULL;

        update_details ((const char **) details);

        /* Only free the values */
        for (i = 1; details[i - 1]; i += 2) {
                if (details[i])
                        g_free (details[i]);
        }
}
Example #6
0
void
show_action_details (GUPnPServiceActionInfo *info)
{
        char *details[32];
        int   i = 0;

        details[i++] = _("Name");
        details[i++] = g_strdup (info->name);
        details[i++] = _("Number of Arguments");
        details[i++] = g_strdup_printf ("%u",
                                        g_list_length (info->arguments));
        details[i] = NULL;

        update_details ((const char **) details);

        /* Only free the values */
        for (i = 1; details[i - 1]; i += 2) {
                if (details[i])
                        g_free (details[i]);
        }
}
Example #7
0
void tmp_create_game::display_games_of_type(twindow& window, ng::level::TYPE type)
{
	create_engine_.set_current_level_type(type);

	tlistbox& list = find_widget<tlistbox>(&window, "games_list", false);

	list.clear();

	for(const auto& game : create_engine_.get_levels_by_type(type)) {
		if(!game.get()->can_launch_game()) {
			continue;
		}

		std::map<std::string, string_map> data;
		string_map item;

		if(type == ng::level::TYPE::CAMPAIGN || type == ng::level::TYPE::SP_CAMPAIGN) {
			item["label"] = game.get()->icon();
			data.emplace("game_icon", item);
		}

		item["label"] = game.get()->name();
		data.emplace("game_name", item);

		tgrid* row_grid = &list.add_row(data);

		find_widget<ttoggle_panel>(row_grid, "game_list_panel", false).set_callback_mouse_left_double_click(
			std::bind(&tmp_create_game::dialog_exit_hook, this, std::ref(window)));
	}

	const bool is_random_map = type == ng::level::TYPE::RANDOM_MAP;

	find_widget<tbutton>(&window, "random_map_regenerate", false).set_active(is_random_map);
	find_widget<tbutton>(&window, "random_map_settings", false).set_active(is_random_map);

	update_details(window);
}
Example #8
0
static void login_state_machine(gpointer data)
{
    QQLoginPanel *panel = (QQLoginPanel*)data;
    while(TRUE){
        switch(state)
        {
            case LOGIN_SM_CHECKVC:
                if(qq_check_verifycode(info, panel -> uin, NULL) != 0){
                    state = LOGIN_SM_ERR;
                    break;
                }
                state = LOGIN_SM_LOGIN;
                if(info -> need_vcimage){
                    gqq_mainloop_attach(&gtkloop, read_verifycode, 1, panel);
                    // Quit the state machine.
                    // The state machine will restart in the read verify code
                    // dialog.
                    return;
                }
            case LOGIN_SM_LOGIN:
                if(do_login(panel) != 0){
                    state = LOGIN_SM_ERR;
                }else{
                    state = LOGIN_SM_GET_DATA;
                }
                break;
            case LOGIN_SM_GET_DATA:
                //Read cached data from db
                gqq_config_load(cfg, panel -> uin);
                qq_get_buddies_and_categories(info, NULL);
                qq_get_groups(info, NULL);
                state = LOGIN_SM_DONE;
                break;
            case LOGIN_SM_DONE:
                g_debug("Login done. show main panel!(%s, %d)", __FILE__, __LINE__);
                //
                // Start poll message
                //
                qq_start_poll(info, qq_poll_message_callback, &gtkloop, NULL);
                // update main panel
                gqq_mainloop_attach(&gtkloop, qq_mainpanel_update
                                    , 1, QQ_MAINWINDOW(panel -> container) 
                                    -> main_panel);
                // show main panel
                gqq_mainloop_attach(&gtkloop, qq_mainwindow_show_mainpanel
                                    , 1, panel -> container);
                update_details(info, panel);

                return;
            case LOGIN_SM_ERR:
                g_debug("Login error... (%s, %d)", __FILE__, __LINE__);
                gqq_mainloop_attach(&gtkloop, qq_mainwindow_show_loginpanel
                                    , 1, panel -> container);
                g_debug("Show login panel.(%s, %d)", __FILE__, __LINE__);
                return;
            default:
                break;
        }
    }
    return;
}
void
current_call_view_set_call_info(CurrentCallView *view, const QModelIndex& idx) {
    CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(view);

    priv->call = CallModel::instance().getCall(idx);

    /* get call image */
    QVariant var_i = GlobalInstances::pixmapManipulator().callPhoto(priv->call, QSize(60, 60), false);
    std::shared_ptr<GdkPixbuf> image = var_i.value<std::shared_ptr<GdkPixbuf>>();
    gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_peer), image.get());

    /* get name */
    QVariant var = idx.model()->data(idx, static_cast<int>(Call::Role::Name));
    QByteArray ba_name = var.toString().toUtf8();
    gtk_label_set_text(GTK_LABEL(priv->label_identity), ba_name.constData());

    /* change some things depending on call state */
    update_state(view, priv->call);
    update_details(view, priv->call);

    priv->state_change_connection = QObject::connect(
        priv->call,
        &Call::stateChanged,
        [view, priv]() { update_state(view, priv->call); }
    );

    priv->call_details_connection = QObject::connect(
        priv->call,
        static_cast<void (Call::*)(void)>(&Call::changed),
        [view, priv]() { update_details(view, priv->call); }
    );

    /* check if we already have a renderer */
    video_widget_push_new_renderer(VIDEO_WIDGET(priv->video_widget),
                                   priv->call->videoRenderer(),
                                   VIDEO_RENDERER_REMOTE);

    /* callback for remote renderer */
    priv->remote_renderer_connection = QObject::connect(
        priv->call,
        &Call::videoStarted,
        [priv](Video::Renderer *renderer) {
            video_widget_push_new_renderer(VIDEO_WIDGET(priv->video_widget),
                                           renderer,
                                           VIDEO_RENDERER_REMOTE);
        }
    );

    /* local renderer */
    if (Video::PreviewManager::instance().isPreviewing())
        video_widget_push_new_renderer(VIDEO_WIDGET(priv->video_widget),
                                       Video::PreviewManager::instance().previewRenderer(),
                                       VIDEO_RENDERER_LOCAL);

    /* callback for local renderer */
    priv->local_renderer_connection = QObject::connect(
        &Video::PreviewManager::instance(),
        &Video::PreviewManager::previewStarted,
        [priv](Video::Renderer *renderer) {
            video_widget_push_new_renderer(VIDEO_WIDGET(priv->video_widget),
                                           renderer,
                                           VIDEO_RENDERER_LOCAL);
        }
    );

    /* handle video widget button click event */
    g_signal_connect(priv->video_widget, "button-press-event", G_CALLBACK(video_widget_on_button_press_in_screen_event), priv->call);

    /* handle video widget drag and drop*/
    g_signal_connect(priv->video_widget, "drag-data-received", G_CALLBACK(video_widget_on_drag_data_received), priv->call);

    /* catch double click to make full screen */
    g_signal_connect(priv->video_widget, "button-press-event",
                     G_CALLBACK(on_button_press_in_video_event),
                     view);

    /* check if auto quality is enabled or not; */
    if (const auto& codecModel = priv->call->account()->codecModel()) {
        const auto& videoCodecs = codecModel->videoCodecs();
        if (videoCodecs->rowCount() > 0) {
            /* we only need to check the first codec since by default it is ON for all, and the
             * gnome client sets its ON or OFF for all codecs as well */
            const auto& idx = videoCodecs->index(0,0);
            auto auto_quality_enabled = idx.data(static_cast<int>(CodecModel::Role::AUTO_QUALITY_ENABLED)).toString() == "true";
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_autoquality), auto_quality_enabled);

            // TODO: save the manual quality setting in the client and set the slider to that value here;
            //       the daemon resets the bitrate/quality between each call, and the default may be
            //       different for each codec, so there is no reason to check it here
        }
    }

    /* init chat view */
    auto chat_view = chat_view_new_call(priv->call);
    gtk_container_add(GTK_CONTAINER(priv->frame_chat), chat_view);

    /* check if there were any chat notifications and open the chat view if so */
    if (ring_notify_close_chat_notification(priv->call->peerContactMethod()))
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->togglebutton_chat), TRUE);

    /* show chat view on any new incoming messages */
    g_signal_connect_swapped(chat_view, "new-messages-displayed", G_CALLBACK(show_chat_view), view);
}
Example #10
0
void tmp_create_game::regenerate_random_map(twindow& window)
{
	create_engine_.init_generated_level_data();

	update_details(window);
}
Example #11
0
void tmp_create_game::on_game_select(twindow& window)
{
	if(find_widget<tlistbox>(&window, "games_list", false).get_selected_row() != selected_game_index_) {
		update_details(window);
	}
}
Example #12
0
void
show_state_variable_details (GUPnPServiceStateVariableInfo *info)
{
        char  *details[32];
        GValue str_value;
        int    i = 0;

        memset (&str_value, 0, sizeof (GValue));
        g_value_init (&str_value, G_TYPE_STRING);

        details[i++] = _("Name");
        details[i++] = g_strdup (info->name);
        details[i++] = _("Send Events");
        details[i++] = g_strdup (info->send_events? _("Yes"): _("No"));
        details[i++] = _("GType");
        details[i++] = g_strdup (g_type_name (info->type));

        details[i++] = _("Default Value");
        g_value_transform (&info->default_value,
                           &str_value);
        details[i++] = g_value_dup_string (&str_value);

        if (info->is_numeric) {
                details[i++] = _("Minimum");
                g_value_transform (&info->minimum,
                                   &str_value);
                details[i++] = g_value_dup_string (&str_value);
                details[i++] = _("Maximum");
                g_value_transform (&info->maximum,
                                   &str_value);
                details[i++] = g_value_dup_string (&str_value);
                details[i++] = _("Step");
                g_value_transform (&info->step,
                                   &str_value);
                details[i++] = g_value_dup_string (&str_value);
        } else if (info->allowed_values) {
                GList *iter;
                char **valuesv;
                int    j;

                valuesv =
                        g_malloc (sizeof (char *) *
                                  (g_list_length (info->allowed_values) + 1));

                for (j = 0, iter = info->allowed_values;
                     iter;
                     iter = iter->next, j++) {
                        valuesv[j] = (char *) iter->data;
                }
                valuesv[j] = NULL;

                details[i++] = _("Allowed Values");
                details[i++] = g_strjoinv (", ", valuesv);
        }

        g_value_unset (&str_value);
        details[i] = NULL;

        update_details ((const char **) details);

        /* Only free the values */
        for (i = 1; details[i - 1]; i += 2) {
                if (details[i])
                        g_free (details[i]);
        }
}