コード例 #1
0
ファイル: resindvdbin.c プロジェクト: zsx/ossbuild
static GstStateChangeReturn
rsn_dvdbin_change_state (GstElement * element, GstStateChange transition)
{
  GstStateChangeReturn ret;
  RsnDvdBin *dvdbin = RESINDVDBIN (element);

  switch (transition) {
    case GST_STATE_CHANGE_NULL_TO_READY:
      if (!create_elements (dvdbin)) {
        remove_elements (dvdbin);
        return GST_STATE_CHANGE_FAILURE;
      }
      break;
    default:
      break;
  }

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
  if (ret == GST_STATE_CHANGE_FAILURE)
    return ret;

  switch (transition) {
    case GST_STATE_CHANGE_PAUSED_TO_READY:
    case GST_STATE_CHANGE_READY_TO_NULL:
      remove_elements (dvdbin);
      break;
    default:
      break;
  }

  return ret;
}
コード例 #2
0
UsersGroupsManager::UsersGroupsManager(QSqlDatabase *db, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::UsersGroupsManager)
{   /** CONSTRUCTOR **/

    /// Initialisation of the class properties
    ui->setupUi(this); // GUI
    m_db = db;
    m_listStudents = new QList<qulonglong>();
    m_listGroups = new QList<qulonglong>();
    m_shortcutNotepad = Notepad::shortcut();
    this->addAction(m_shortcutNotepad);

    /// Get the list of the students
    QSqlQuery query(*m_db);
    query.exec("SELECT `id`, `name`, `first_name` FROM `tau_users` ORDER BY UPPER(`name`), UPPER(`first_name`)");
    while (query.next()) {
        Student* stdnt = new Student();
        stdnt->setId(query.value(0).toInt());
        stdnt->setName(query.value(1).toString());
        stdnt->setFirst_name(query.value(2).toString());
        // Add the student in a list
        m_listStudents->append((qulonglong) stdnt);
    }
    /// Get the list of the groups
    query.exec("SELECT `id`, `name` FROM `tau_groups` ORDER BY UPPER(`name`)");
    while (query.next()) {
        Group* grp = new Group();
        grp->setId(query.value(0).toInt());
        grp->setName(query.value(1).toString());
        // Add the group in a list
        m_listGroups->append((qulonglong) grp);
    }

    /// Connect to detect when user click on an item or on a button
    connect(ui->comboBox_browse, SIGNAL(currentIndexChanged(int)), this, SLOT(update_list_browse()));
    connect(ui->list_browse, SIGNAL(itemSelectionChanged()), this, SLOT(update_listsYesNo()));
    connect(ui->pushButton_add, SIGNAL(clicked()), this, SLOT(add_elements()));
    connect(ui->pushButton_remove, SIGNAL(clicked()), this, SLOT(remove_elements()));

    /// Fill the combobox which selects the method to link
    ui->comboBox_browse->addItem("A partir des élèves", BrowseStudents);
    ui->comboBox_browse->addItem("A partir des groupes", BrowseGroups);

    /// Update the lists
    update_list_browse();
}