Ejemplo n.º 1
0
bool DatabaseDialog::tablesDoNext()
{
  m_databaseStatus->setText( i18n("Retrieving meta data of tables...") );
  QStringList tables;

  {
    Q3ListViewItem * item = (Q3CheckListItem *) m_tableView->firstChild();
    for (; item; item = item->nextSibling())
    {
      if (((Q3CheckListItem * ) item)->isOn())
      {
        tables.append(((Q3CheckListItem * ) item)->text());
      }
    }
  }

  if (tables.empty())
  {
    KMessageBox::error( this, i18n("You have to select at least one table.") );
    return false;
  }

  m_columnView->clear();
  QSqlRecord info;
  for (int i = 0; i < (int) tables.size(); ++i)
  {
    info = m_dbConnection.record( tables[i] );
    for (int j = 0; j < (int) info.count(); ++j)
    {
      QString name = info.fieldName(j);
      Q3CheckListItem * checkItem = new Q3CheckListItem( m_columnView, name,
                                 Q3CheckListItem::CheckBox );
      checkItem->setOn(false);
      m_columnView->insertItem( checkItem );
      checkItem->setText( 1, tables[i] );
      QSqlField field = info.field(name);
      checkItem->setText( 2, QVariant::typeToName(field.type()) );
    }
  }
  m_columnView->setSorting(1, true);
  m_columnView->sort();
  m_columnView->setSorting( -1 );

  setValid(m_columns, true);

  return true;
}
KLProjectConfigWidget::KLProjectConfigWidget(KLProject* project, QWidget *parent, const char *name)
    :QDialog(parent, name), m_validator(QRegExp("0x[0-9a-fA-F]{1,4}"), this, "reValidator"),
      ui(new Ui_KLProjectConfigWidgetBase)
{
    ui->setupUi(this);
    m_project = project;
    m_projectManagerInConfigWidget =
            new KLProjectManagerWidget( project, ui->tab_common, "managerInConfig" );
    m_projectManagerInConfigWidget->setConfigButtonVisible( false );
    ui->layProjectManager->addWidget( m_projectManagerInConfigWidget );
    ui->cbCPU->clear();
    // Add all the CPUs:
    ui->cbCPU->insertStringList( project->cpus() );
    // Update the project files list:
    project->update();
    // Add linker flags columns
    ui->lvLinkerFlags->addColumn(i18n("Purpose"));
    ui->lvLinkerFlags->addColumn(i18n("Flags"));
    // Fill the linker flags list:
    m_possibleLinkerFlags["-Wl,-lm"] = i18n("Link with math library");
    m_possibleLinkerFlags["-Wl,-lprintf"] = i18n("Link with printf library");
    m_possibleLinkerFlags["-Wl,-lprintf_min"] = i18n("Link with printf_min library");
    m_possibleLinkerFlags["-Wl,-u,vfprintf -Wl,-lprintf_flt"] = i18n("Link with floating point printf library");
    QStringList keys = m_possibleLinkerFlags.keys();
    keys.sort();

    for ( QStringList::iterator it = keys.begin(); it != keys.end(); ++it )
    {
        Q3CheckListItem* cur = new Q3CheckListItem( ui->lvLinkerFlags, m_possibleLinkerFlags[*it], Q3CheckListItem::CheckBox );
        cur->setText( 1, *it );
        m_linkerFlagsCBs.append( cur );
    }
    updateGUIFromSettings();
    updateCPUInfo( ui->cbCPU->currentText() );

    connect(ui->cbCPU,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotCPUChanged(QString)));
    connect(ui->pbOK,SIGNAL(clicked()),this,SLOT(slotOK()));
    connect(ui->pbCancel,SIGNAL(clicked()),this,SLOT(slotCancel()));
    connect(ui->pbSetDefault,SIGNAL(clicked()),this,SLOT(slotSetDefault()));

    //Setup spinboxes with hex-in and output
    ui->kisbStartOfText->setValidator(&m_validator);
    ui->kisbStartOfText->setBase(16);

    ui->kisbStartOfData->setValidator(&m_validator);
    ui->kisbStartOfData->setBase(16);

    ui->kisbStartOfBSS->setValidator(&m_validator);
    ui->kisbStartOfBSS->setBase(16);

    ui->kisbStartOfHeap->setValidator(&m_validator);
    ui->kisbStartOfHeap->setBase(16);

    ui->kisbEndOfHeap->setValidator(&m_validator);
    ui->kisbEndOfHeap->setBase(16);
}