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; } }
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); }
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; } }
void create_dialog() { if (main_dialog) { return; } dialog_create_alert(&main_dialog); dialog_set_alert_message_text(main_dialog, "\n"); dialog_set_group_id(main_dialog, get_window_group_id()); dialog_set_cancel_required(main_dialog, true); dialog_add_button(main_dialog, "Query", true, "query", true); dialog_add_button(main_dialog, "Vol Up", true, "double", true); dialog_add_button(main_dialog, "Vol Down", true, "half", true); dialog_add_button(main_dialog, "Toggle Mute", true, "toggle", true); dialog_show(main_dialog); }
void AlertDialog::run() { bps_initialize(); //request all dialog events dialog_request_events(0); if (dialog_create_alert(&m_dialog) != BPS_SUCCESS) { qDebug() << "Failed to create alert dialog."; emit cancel(); return; } //set the alert message if (!m_alertMessage.trimmed().isEmpty() && dialog_set_alert_message_text(m_dialog, m_alertMessage.toAscii()) != BPS_SUCCESS) { qDebug() << "Failed to set alert dialog message text."; destroyDialog(); emit cancel(); return; } if (!setTitle()) { destroyDialog(); emit cancel(); return; } if (!addButtons()) { destroyDialog(); emit cancel(); return; } if (!showDialog()) { qDebug() << "Failed to show alert dialog."; destroyDialog(); emit cancel(); return; } bool shutdown = false; while (!shutdown) { bps_event_t* event = NULL; // -1 means that the function waits for an event before returning bps_get_event(&event, -1); if (event) { if (bps_event_get_domain(event) == dialog_get_domain()) { int selectedIndex = dialog_event_get_selected_index(event); const char* label = dialog_event_get_selected_label(event); const char* context = dialog_event_get_selected_context(event); if (label != NULL && context != NULL) { if (QString::compare(context, getCancelButtonContext()) == 0) { emit cancel(); } else if (QString::compare(context, getOkButtonContext()) == 0) { emit ok(); } else { emit customButton(selectedIndex, label, context); } } qDebug() << "Got alert dialog click"; shutdown = true; } } } destroyDialog(); }