Ejemplo n.º 1
0
static void
video_double_clicked(G_GNUC_UNUSED CurrentCallView *view, RingMainWindow *self)
{
    g_return_if_fail(IS_RING_MAIN_WINDOW(self));
    auto priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));

    if (priv->is_fullscreen) {
        leave_full_screen(self);
    } else {
        enter_full_screen(self);
    }
}
Ejemplo n.º 2
0
static void
full_screen(void)
{
	if(!amFullScreen) {
		oldWindow = theWindow;
		HideWindow(theWindow);
		GDHandle device;
		GetWindowGreatestAreaDevice(theWindow, kWindowTitleBarRgn, &device, NULL);
		BeginFullScreen(&fullScreenRestore, device, 0, 0, &theWindow, 0, 0);
		amFullScreen = 1;
		window_resized();
		Rectangle rect =  { { 0, 0 }, { bounds.size.width, bounds.size.height } };
		wmtrack(0, rect.max.x, rect.max.y, 0);
		drawqlock();
		flushmemscreen(rect);
		drawqunlock();
	} else
		leave_full_screen();
}
Ejemplo n.º 3
0
static gboolean
selected_item_changed(RingMainWindow *win)
{
    // g_debug("item changed");
    RingMainWindowPrivate *priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(win));

    /* if we're showing the settings, then nothing needs to be done as the call
       view is not shown */
    if (priv->show_settings) return G_SOURCE_REMOVE;

    auto idx_selected = RecentModel::instance().selectionModel()->currentIndex();

    /* we prioritize showing the call view; but if the call is over we go back to showing the chat view */
    if(auto call = RecentModel::instance().getActiveCall(idx_selected)) {
        /* check if we need to change the view */
        auto current_view = gtk_bin_get_child(GTK_BIN(priv->frame_call));
        auto state = call->lifeCycleState();

        /* check what the current state is vs what is displayed */
        switch(state) {
            case Call::LifeCycleState::CREATION:
            case Call::LifeCycleState::FINISHED:
            /* go back to incoming call view;
             * it will show that the call failed and offer to hang it up */
            case Call::LifeCycleState::INITIALIZATION:
                {
                    /* show the incoming call view */
                    if (!IS_INCOMING_CALL_VIEW(current_view)) {
                        auto new_view = incoming_call_view_new();
                        incoming_call_view_set_call_info(INCOMING_CALL_VIEW(new_view), CallModel::instance().getIndex(call));
                        gtk_container_remove(GTK_CONTAINER(priv->frame_call), current_view);
                        gtk_container_add(GTK_CONTAINER(priv->frame_call), new_view);
                        gtk_widget_show(new_view);
                    }
                }
                break;
            case Call::LifeCycleState::PROGRESS:
                {
                    /* show the current call view */
                    if (!IS_CURRENT_CALL_VIEW(current_view)) {
                        auto new_view = current_call_view_new();
                        g_signal_connect(new_view, "video-double-clicked", G_CALLBACK(video_double_clicked), win);
                        current_call_view_set_call_info(CURRENT_CALL_VIEW(new_view), CallModel::instance().getIndex(call));
                        gtk_container_remove(GTK_CONTAINER(priv->frame_call), current_view);
                        gtk_container_add(GTK_CONTAINER(priv->frame_call), new_view);
                        gtk_widget_show(new_view);
                    }
                }
                break;
            case Call::LifeCycleState::COUNT__:
                g_warning("LifeCycleState should never be COUNT");
                break;
        }
    } else if (idx_selected.isValid()) {
        /* otherwise, the call is over and is already removed from the RecentModel */
        auto current_view = gtk_bin_get_child(GTK_BIN(priv->frame_call));
        leave_full_screen(win);

        /* show the chat view */
        if (!IS_CHAT_VIEW(current_view)) {
            auto type = idx_selected.data(static_cast<int>(Ring::Role::ObjectType)).value<Ring::ObjectType>();
            auto object = idx_selected.data(static_cast<int>(Ring::Role::Object));
            if (type == Ring::ObjectType::Person && object.isValid()) {
                /* show chat view constructed from Person object */
                auto new_view = chat_view_new_person(object.value<Person *>());
                gtk_container_remove(GTK_CONTAINER(priv->frame_call), current_view);
                gtk_container_add(GTK_CONTAINER(priv->frame_call), new_view);
                gtk_widget_show(new_view);
            } else if (type == Ring::ObjectType::ContactMethod && object.isValid()) {
                /* show chat view constructed from CM */
                auto new_view = chat_view_new_cm(object.value<ContactMethod *>());
                gtk_container_remove(GTK_CONTAINER(priv->frame_call), current_view);
                gtk_container_add(GTK_CONTAINER(priv->frame_call), new_view);
                gtk_widget_show(new_view);
            }
        }
    }

    return G_SOURCE_REMOVE;
}
Ejemplo n.º 4
0
/**
 * This takes the RecentModel index as the argument and displays the corresponding view:
 * - incoming call view
 * - current call view
 * - chat view
 * - welcome view (if no index is selected)
 */
static void
selection_changed(const QModelIndex& recent_idx, RingMainWindow *win)
{
    // g_debug("selection changed");
    g_return_if_fail(IS_RING_MAIN_WINDOW(win));
    RingMainWindowPrivate *priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(win));

    /* if we're showing the settings, then nothing needs to be done as the call
       view is not shown */
    if (priv->show_settings) return;

    /* get the current visible stack child */
    GtkWidget *old_call_view = gtk_bin_get_child(GTK_BIN(priv->frame_call));

    /* make sure we leave full screen, since the call selection is changing */
    leave_full_screen(win);

    /* check which object type is selected */
    auto type = recent_idx.data(static_cast<int>(Ring::Role::ObjectType)).value<Ring::ObjectType>();
    auto object = recent_idx.data(static_cast<int>(Ring::Role::Object));
    /* try to get the call model index, in case its a call, since we're still using the CallModel as well */
    auto call_idx = CallModel::instance().getIndex(RecentModel::instance().getActiveCall(recent_idx));

    /* we prioritize showing the call view */
    if (call_idx.isValid()) {
        /* show the call view */
        QVariant state =  call_idx.data(static_cast<int>(Call::Role::LifeCycleState));
        GtkWidget *new_call_view = NULL;

        switch(state.value<Call::LifeCycleState>()) {
            case Call::LifeCycleState::CREATION:
            case Call::LifeCycleState::INITIALIZATION:
            case Call::LifeCycleState::FINISHED:
                new_call_view = incoming_call_view_new();
                incoming_call_view_set_call_info(INCOMING_CALL_VIEW(new_call_view), call_idx);
                break;
            case Call::LifeCycleState::PROGRESS:
                new_call_view = current_call_view_new();
                g_signal_connect(new_call_view, "video-double-clicked", G_CALLBACK(video_double_clicked), win);
                current_call_view_set_call_info(CURRENT_CALL_VIEW(new_call_view), call_idx);
                break;
            case Call::LifeCycleState::COUNT__:
                g_warning("LifeCycleState should never be COUNT");
                break;
        }

        gtk_container_remove(GTK_CONTAINER(priv->frame_call), old_call_view);
        gtk_container_add(GTK_CONTAINER(priv->frame_call), new_call_view);
        gtk_widget_show(new_call_view);
    } else if (type == Ring::ObjectType::Person && object.isValid()) {
        /* show chat view constructed from Person object */
        auto new_chat_view = chat_view_new_person(object.value<Person *>());
        gtk_container_remove(GTK_CONTAINER(priv->frame_call), old_call_view);
        gtk_container_add(GTK_CONTAINER(priv->frame_call), new_chat_view);
        gtk_widget_show(new_chat_view);
    } else if (type == Ring::ObjectType::ContactMethod && object.isValid()) {
        /* show chat view constructed from CM */
        auto new_chat_view = chat_view_new_cm(object.value<ContactMethod *>());
        gtk_container_remove(GTK_CONTAINER(priv->frame_call), old_call_view);
        gtk_container_add(GTK_CONTAINER(priv->frame_call), new_chat_view);
        gtk_widget_show(new_chat_view);
    } else {
        /* nothing selected that we can display, show the welcome view */
        gtk_container_remove(GTK_CONTAINER(priv->frame_call), old_call_view);
        gtk_container_add(GTK_CONTAINER(priv->frame_call), priv->welcome_view);
    }
}
Ejemplo n.º 5
0
static void vm_frm_exit_func(mmi_scrn_essential_struct* data)
{
	vm_graphic_flatten_previous_blt_layer_to_base_layer();
    leave_full_screen();
    vm_pmng_set_inactive((VM_P_HANDLE)data->user_data);
}