Beispiel #1
0
void show_alert()
{

    if (dialog_create_alert(&alert_dialog) != BPS_SUCCESS) {
        fprintf(stderr, "Failed to create alert dialog.");
        return;
    }
    dialog_set_size(alert_dialog,DIALOG_SIZE_FULL);

	if (dialog_set_alert_message_text(alert_dialog,
			"Download our brand new application Compass: \n\nThis is the first magnetic compass written natively for the BlackBerry® PlayBook. It does not use GPS (no movement necessary to get a correct direction), instead the Magnetometer is used.Keep the PlayBook out of range of any metallic object, as this can interfere with the compass!\nTry it!\nFeatures:\n\n- Real magnetic compass (no GPS and/or movement needed)\n- Stunning graphics\n- Swipe down for easy to understand calibration") != BPS_SUCCESS) {
		fprintf(stderr, "Failed to set alert dialog message text.");
		dialog_destroy(alert_dialog);
		alert_dialog = 0;
		return;
	}


    /*
     * Use a button label of our own. Don't attach a context to the button.
     */
    if (dialog_add_button(alert_dialog, "Cancel", true, 0, true) != BPS_SUCCESS) {
        fprintf(stderr, "Failed to add button to alert dialog.");
        dialog_destroy(alert_dialog);
        alert_dialog = 0;
        return;
    }
    if (dialog_add_button(alert_dialog, "mappau.com", true, 0, true) != BPS_SUCCESS) {
        fprintf(stderr, "Failed to add button to alert dialog.");
        dialog_destroy(alert_dialog);
        alert_dialog = 0;
        return;
    }

    if (dialog_add_button(alert_dialog, "Download", true, 0, true) != BPS_SUCCESS) {
        fprintf(stderr, "Failed to add button to alert dialog.");
        dialog_destroy(alert_dialog);
        alert_dialog = 0;
        return;
    }

    if (dialog_show(alert_dialog) != BPS_SUCCESS) {
        fprintf(stderr, "Failed to show alert dialog.");
        dialog_destroy(alert_dialog);
        alert_dialog = 0;
        return;
    }
}
Beispiel #2
0
static void video_dialog_draw_const(void)
{
	char buf[80];
	time_t now;

	time(&now);
	if (now != started) {
		countdown--;
		time(&started); /* err... */
		status.flags |= NEED_UPDATE;
		if (countdown == 0) {
			dialog_destroy();
			video_mode_cancel(NULL);
			return;
		}
	}

	draw_text("Your video settings have been changed.", 21,19,0,2);
	sprintf(buf, "In %2d seconds, your changes will be", countdown);
	draw_text(buf, 23, 21, 0, 2);
	draw_text("reverted to the last known-good", 21, 22, 0, 2);
	draw_text("settings.", 21, 23, 0, 2);
	draw_text("To use the new video mode, and make", 21, 24, 0, 2);
	draw_text("it default, select OK.", 21, 25, 0, 2);
}
void
destroy_dialog() {
    if (main_dialog) {
        dialog_destroy(main_dialog);
    }
    main_dialog = 0;
}
Beispiel #4
0
	void show_loading(){
		if( loading_dialog ) {
			return;
		}
	
		if( dialog_create_alert(&loading_dialog) != BPS_SUCCESS ){
			return;
		}

		if( dialog_set_background_alpha(loading_dialog, 0.2) != BPS_SUCCESS ){
			return;
		}

		if( dialog_set_alert_message_text(loading_dialog, "..." ) != BPS_SUCCESS ){
			return;
		}

		if( dialog_set_position(loading_dialog, DIALOG_POSITION_MIDDLE_CENTER ) != BPS_SUCCESS ){
			return;
		}
		
		if (dialog_show(loading_dialog) != BPS_SUCCESS) {
			dialog_destroy(loading_dialog);
			loading_dialog = 0;
		}
	
	}
Beispiel #5
0
static int _fixup_ignore_globals(struct key_event *k)
{
        if (k->mouse && k->y > 20) return 0;
        switch (k->sym) {
        case SDLK_LEFT:
        case SDLK_RIGHT:
        case SDLK_DOWN:
        case SDLK_UP:
        case SDLK_TAB:
        case SDLK_RETURN:
        case SDLK_ESCAPE:
                /* use default handler */
                return 0;
        case SDLK_F2: case SDLK_F5: case SDLK_F9: case SDLK_F10:
                // Ctrl + these keys does not lead to a new screen
                if (k->mod & KMOD_CTRL)
                        break;
                // Fall through.
        case SDLK_F1: case SDLK_F3: case SDLK_F4:
        case SDLK_F11: case SDLK_F12:
                // Ignore Alt and so on.
                if (k->mod & (KMOD_ALT | KMOD_SHIFT))
                        break;
                dialog_destroy();
                return 0;
        default:
                break;
        }
        /* this way, we can't pull up help here */
        return 1;
}
void ScoreLoopThread::DisplayDialog(AppData_t *app, const char* title, const char* message) {
	/* Close a former dialog - if any */
	if (app->dialog) {
		dialog_destroy(app->dialog);
		app->dialog = 0;
	}

	/* Open a new alert dialog here - you would probably want to do something more elaborate */
	dialog_create_alert(&app->dialog);
	dialog_set_title_text(app->dialog, title);
	dialog_set_alert_message_text(app->dialog, message);
	dialog_add_button(app->dialog, DIALOG_OK_LABEL, true, NULL, true);
	dialog_show(app->dialog);
}
Beispiel #7
0
void dialog_destroy_single(gint type, struct model_pak *model)
{
GSList *list;
struct dialog_pak *dialog;

list = sysenv.dialog_list;
while (list)
  {
  dialog = list->data;
  list = g_slist_next(list);

  if (dialog->type == type && dialog->model == model)
    dialog_destroy(NULL, dialog);
  }
}
Beispiel #8
0
void dialog_destroy_type(gint type)
{
GSList *list;
struct dialog_pak *dialog;

list = sysenv.dialog_list;
while (list)
  {
  dialog = list->data;
  list = g_slist_next(list);

  if (dialog->type == type)
    dialog_destroy(NULL, dialog);
  }
}
Beispiel #9
0
void handle_dialog_response(bps_event_t *event)
{
    /*
     * Double check that the event is valid
     */
    if (event == NULL) {
        return;
    }

    int selectedIndex = dialog_event_get_selected_index(event);
    fprintf(stderr,"SELECTION: %i\n",selectedIndex);
    switch (selectedIndex){
    case 2:
    	navigator_invoke("appworld://content/92507", 0);
        	break;
    case 1:
    	navigator_invoke("http://www.mappau.com", 0);
        	break;
    }

    dialog_destroy(alert_dialog);
    alert_dialog = 0;
}
QQnxFileDialogHelper::~QQnxFileDialogHelper()
{
    if (m_dialog)
        dialog_destroy(m_dialog);
}
bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
{
    Q_UNUSED(flags);
    qFileDialogHelperDebug() << Q_FUNC_INFO;

    QQnxBpsEventFilter *eventFilter = m_integration->bpsEventFilter();
    // We *really* need the bps event filter ;)
    if (!eventFilter)
        return false;

    // Native dialogs can only handle application modal use cases so far
    if (modality != Qt::ApplicationModal)
        return false;

    // Tear down any existing dialog and start again as dialog mode may have changed
    if (m_dialog) {
        dialog_destroy(m_dialog);
        m_dialog = 0;
    }

    // Create dialog
    const QSharedPointer<QFileDialogOptions> &opts = options();
    if (opts->acceptMode() == QFileDialogOptions::AcceptOpen) {
        if (dialog_create_filebrowse(&m_dialog) != BPS_SUCCESS) {
            qWarning("dialog_create_filebrowse failed");
            return false;
        }

        // Select one or many files?
        bool multiSelect = (opts->fileMode() == QFileDialogOptions::ExistingFiles);
        dialog_set_filebrowse_multiselect(m_dialog, multiSelect);

        // Set the actual list of extensions
        if (!opts->nameFilters().isEmpty()) {
            qFileDialogHelperDebug() << "nameFilters =" << opts->nameFilters();
            setNameFilter(opts->nameFilters().first());
        } else {
            QString defaultNameFilter = QStringLiteral("*.*");
            setNameFilter(defaultNameFilter);
        }
    } else {
        if (dialog_create_filesave(&m_dialog) != BPS_SUCCESS) {
            qWarning("dialog_create_filesave failed");
            return false;
        }

        // Maybe pre-select a filename
        if (!opts->initiallySelectedFiles().isEmpty()) {
            QString fileName = opts->initiallySelectedFiles().first().toLocalFile();
            dialog_set_filesave_filename(m_dialog, QFile::encodeName(fileName).constData());
        }

        // Add OK and Cancel buttons. We add the buttons in the order "CANCEL" followed by "OK
        // such that they have indices matching the buttons on the file open dialog which
        // is automatically populated with buttons.
        if (dialog_add_button(m_dialog, tr("CANCEL").toLocal8Bit().constData(), true, 0, true) != BPS_SUCCESS) {
            qWarning("dialog_add_button failed");
            return false;
        }

        if (dialog_add_button(m_dialog, tr("OK").toLocal8Bit().constData(), true, 0, true) != BPS_SUCCESS) {
            qWarning("dialog_add_button failed");
            return false;
        }
    }

    // Cache the accept mode so we know which functions to use to get the results back
    m_acceptMode = opts->acceptMode();

    // Set the libscreen window group and common properties

    QQnxScreen *nativeScreen = parent ? static_cast<QQnxScreen *>(parent->screen()->handle()) :
                                        m_integration->primaryDisplay();
    Q_ASSERT(nativeScreen);
    dialog_set_group_id(m_dialog, nativeScreen->windowGroupName());
    dialog_set_title_text(m_dialog, opts->windowTitle().toLocal8Bit().constData());

    // Register ourselves for dialog domain events from bps
    eventFilter->registerForDialogEvents(this);

    // Show the dialog
    dialog_show(m_dialog);

    return true;
}
void ScoreLoopThread::run() {
	qDebug() << "ScoreLoopThread run() started";

	AppData_t app;
	SC_InitData_t initData;
	SC_Error_t rc;
	char versionBuffer[0x100]; /* Thats 256 bytes */

	qDebug() << "Starting Scoreloop Sample...";

	/* Initialize the BPS event system */
	bps_initialize();
	bps_set_verbosity(0); /* Set to 1 or 2 for more output if you like */

	memset(&app, 0, sizeof(AppData_t));

	/* Initialize the Scoreloop platform dependent SC_InitData_t structure to default values. */
	SC_InitData_Init(&initData);

	/* What version of the Scoreloop library do we use? */
	if (SC_GetVersionInfo(&initData, versionBuffer, sizeof(versionBuffer))) {
		qDebug() << "Version-Info: " << versionBuffer;
	}

	/* Now, create the Scoreloop Client with the initialized SC_InitData_t structure
	 * as well as the game-id and game-secret as found on the developer portal.
	 */
	rc = SC_Client_New(&app.client, &initData, SCORELOOP_GAME_ID, SCORELOOP_GAME_SECRET, SCORELOOP_GAME_VERSION, SCORELOOP_GAME_CURRENCY, SCORELOOP_GAME_LANGUAGE);
	if (rc != SC_OK) {
		HandleError(&app, rc);
	} else {
		//InformUser(&app, "Note", "Scoreloop Sample started...");

		/* Request the user here just for demonstration purposes */
		RequestUser(&app);
	}

	while (!m_quit) {
		/* Get next BPS event */
		bps_event_t *event;
		bps_get_event(&event, -1);

		/* Scoreloop event handling  */
		if (bps_event_get_domain(event) == SC_GetBPSEventDomain(&initData)) {
			SC_HandleBPSEvent(&initData, event);
		}

		else if (bps_event_get_domain(event) == dialog_get_domain()) {
			dialog_destroy(dialog_event_get_dialog_instance(event));
			app.dialog = 0;
		}
		/* Add more BPS event handling here... */

	}

	/* Cleanup the Scoreloop client */
	SC_Client_Release(app.client);

	/* Shutdown BPS */
	bps_shutdown();
	qDebug() << "SensorsThread run() finished.";
}
Beispiel #13
0
	void hide_loading(){
		if(loading_dialog){
			dialog_destroy(loading_dialog);
			loading_dialog = 0;
		}
	}
Beispiel #14
0
void siesta_animation_dialog_destroy(GtkWidget *w, gpointer *dialog)
{

    //kill the dialog
    dialog_destroy(w, dialog);
}