void KstVectorDialogI::configureSource() {
  bool isNew = false;
  KST::dataSourceList.lock().readLock();
  KstDataSourcePtr ds = *KST::dataSourceList.findReusableFileName(_w->FileName->url());
  KST::dataSourceList.lock().unlock();
  if (!ds) {
    isNew = true;
    ds = KstDataSource::loadSource(_w->FileName->url());
    if (!ds || !ds->isValid()) {
      _w->_configure->setEnabled(false);
      return;
    }
  }

  assert(_configWidget);
  KDialogBase *dlg = new KDialogBase(this, "Data Config Dialog", true, i18n("Configure Data Source"));
  if (isNew) {
    connect(dlg, SIGNAL(okClicked()), _configWidget, SLOT(save()));
    connect(dlg, SIGNAL(applyClicked()), _configWidget, SLOT(save()));
  } else {
    connect(dlg, SIGNAL(okClicked()), this, SLOT(markSourceAndSave()));
    connect(dlg, SIGNAL(applyClicked()), this, SLOT(markSourceAndSave()));
  }
  _configWidget->reparent(dlg, QPoint(0, 0));
  dlg->setMainWidget(_configWidget);
  _configWidget->setInstance(ds);
  _configWidget->load();
  dlg->exec();
  _configWidget->reparent(0L, QPoint(0, 0));
  dlg->setMainWidget(0L);
  delete dlg;
  updateCompletion(); // could be smarter by only running if Ok/Apply clicked
}
Esempio n. 2
0
MgCommandLine::MgCommandLine(QWidget * parent)
:QLineEdit(parent),m_scriptEngine(0)
{
	setStyleSheet(" "
			"QLineEdit {"
			"border: 1px solid darkgray;"
			"border-radius: 2px;"
			"padding: 0 8px;"
			"background: rgb(45,45,45);"
			"color: rgb(210,210,210);"
			"selection-background-color: darkgray;"
			"}");

	m_completionModel = new  QStringListModel(this);
	m_completionModel->setStringList(QStringList());
	m_completer = new QCompleter(m_completionModel,this);
	m_completer->setCompletionMode(QCompleter::PopupCompletion);
	setCompleter(m_completer);
	disconnect(m_completer, 0, this, 0);
    connect(m_completer, SIGNAL(activated(QString)),this,SLOT(insertText(QString)));
	QPalette p = m_completer->popup()->palette();
	p.setColor(QPalette::Base,QColor(45,45,45));
	p.setColor(QPalette::Text,QColor(210,210,210));
	m_completer->popup()->setPalette(p);
	m_completer->popup()->setWindowOpacity(.8);
	connect(this,SIGNAL(textChanged(QString)),this,SLOT(updateCompletion()));
}
Esempio n. 3
0
void KstMatrixDialog::configureSource() {
  KstDataSourcePtr ds;
  bool isNew = false;

  KST::dataSourceList.lock().readLock();
// xxx  ds = *KST::dataSourceList.findReusableFileName(_w->_fileName->url());
  KST::dataSourceList.lock().unlock();

  if (!ds) {
    isNew = true;
// xxx    ds = KstDataSource::loadSource(_w->_fileName->url());
    if (!ds || !ds->isValid()) {
      _w->_configure->setEnabled(false);

      return;
    }
  }

  if (_configWidget) {
    QDialog *dlg;
  
    dlg = new QDialog(this);
    dlg->setWindowTitle(QObject::tr("Configure Data Source"));

    if (isNew) {
      connect(dlg, SIGNAL(okClicked()), _configWidget, SLOT(save()));
      connect(dlg, SIGNAL(applyClicked()), _configWidget, SLOT(save()));
    } else {
      connect(dlg, SIGNAL(okClicked()), this, SLOT(markSourceAndSave()));
      connect(dlg, SIGNAL(applyClicked()), this, SLOT(markSourceAndSave()));
    }

    _configWidget->setParent(dlg);
// xxx    dlg->setMainWidget(_configWidget);
    _configWidget->setInstance(ds);
    _configWidget->load();
    dlg->exec();
// xxx    _configWidget->reparent(0L, QPoint(0, 0));
// xxx    dlg->setMainWidget(0L);

    delete dlg;
  }

  updateCompletion(); // could be smarter by only running if Ok/Apply clicked
}
void KstVectorDialogI::fillFieldsForNew() {
  _w->_readFromSource->setChecked(true);
  _w->_rvectorGroup->show();
  _w->_rvectorGroup->setEnabled(true);
  _w->_kstDataRange->show();
  _w->_kstDataRange->setEnabled(true);
  _w->_svectorGroup->show();
  _w->_svectorGroup->setEnabled(false);
  _w->sourceGroup->show();

  _tagName->setText(defaultTag);

  // set defaults with vectorDefaults
  KST::vectorDefaults.sync();
  _w->FileName->setURL(KST::vectorDefaults.dataSource());
  updateCompletion();
  _w->_kstDataRange->update();
  _w->Field->setFocus();
  adjustSize();
  resize(minimumSizeHint());
  setFixedHeight(height());
}
Esempio n. 5
0
void KstVectorDialogI::_fillFieldsForNew() {
  KstRVectorList vectorList = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);

  int n_v = vectorList.count();

  if (n_v < 1) {
    Field->insertItem("INDEX");
  } else {
    Field->setCurrentText(QString::null);
  }
  QString new_label;
  new_label.sprintf("V%d-", n_v+1);
  new_label += "<New_Vector>";
  _tagName->setText(new_label);

  /* set defaults with vectorDefaults */
  KST::vectorDefaults.sync();
  FileName->setURL(KST::vectorDefaults.dataSource());
  updateCompletion();
  _kstDataRange->update();
  Field->setFocus();
}
Esempio n. 6
0
void KstMatrixDialog::testURL() {
  _inTest = true;
  updateCompletion();
  _inTest = false;
}
void KstVectorDialogI::testURL() {
  _inTest = true;
  updateCompletion();
  _inTest = false;
}