示例#1
0
ScriptingLangDialog::ScriptingLangDialog(ScriptingEnv *env, ApplicationWindow *parent, Qt::WFlags fl )
  : QDialog(parent, fl), Scripted(env)
{
	setCaption(tr("MantidPlot - Select scripting language"));

  langList = new QListWidget(this);

  btnOK = new QPushButton(tr("OK"));
  btnCancel = new QPushButton(tr("Cancel"));

  QHBoxLayout *hbox1 = new QHBoxLayout();
  hbox1->addStretch();
  hbox1->addWidget(btnOK);
  hbox1->addWidget(btnCancel);

  QVBoxLayout *vl = new QVBoxLayout(this);
  vl->addWidget(langList);
  vl->addLayout(hbox1);

  connect(btnOK, SIGNAL(clicked()), this, SLOT(accept()));
  connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
  connect(langList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(accept()));

  updateLangList();
}
void QAbstractLangList::setConfigFile(const QString& newCfg)
{
//handle error message
//#ifdef  QAbstractLangList_QT4
//    QFile::copy(d->cfg,newCfg);
    QFile::remove(d->cfg);
//    d->cfg=newCfg;
//#else
	d->cfg=newCfg;
	updateLangList();
//#endif // QAbstractLangList_QT4
}
ScriptingLangDialog::ScriptingLangDialog(ScriptingEnv *env, ApplicationWindow *parent, const char *name, bool modal, WFlags fl )
  : QDialog(parent, name, modal, fl), scripted(env)
{
  setCaption(tr("QtiPlot - Select scripting language"));
 
  langList = new QListBox(this, "langList");

  QHBox *box1 = new QHBox(this, "box1");
  btnOK = new QPushButton(box1, "btnOK");
  btnOK->setText(tr("OK"));
  btnOK->setDefault(true);
  btnCancel = new QPushButton(box1, "btnCancel");
  btnCancel->setText(tr("Cancel"));

  QVBoxLayout *layout = new QVBoxLayout(this, 5, 5, "layout");
  layout->addWidget(langList);
  layout->addWidget(box1);

  connect(btnOK, SIGNAL(clicked()), this, SLOT(accept()));
  connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
  
  updateLangList();
}
void QAbstractLangList::setThisQmDir(const QString& dir)
{
        d->thisQmDir=dir;
        updateLangList();
}
void QAbstractLangList::setQmFilter(const QString& qf)
{
    d->qmFilter=qf;
    updateLangList();
}