예제 #1
1
DiagramDialog::DiagramDialog(Diagram *d, const QString& _DataSet,
                             QWidget *parent, Graph *currentGraph)
                    : QDialog(parent, 0, TRUE, Qt::WDestructiveClose)
{
  Diag = d;
  Graphs.setAutoDelete(true);
  copyDiagramGraphs();   // make a copy of all graphs
  defaultDataSet = _DataSet;
  setCaption(tr("Edit Diagram Properties"));
  changed = false;
  transfer = false;  // have changes be applied ? (used by "Cancel")
  toTake = false;   // double-clicked variable be inserted into graph list ?

  Expr.setPattern("[^\"]+");
  Validator  = new QRegExpValidator(Expr, this);
  ValInteger = new QIntValidator(0, 360, this);
  ValDouble  = new QDoubleValidator(-1e200, 1e200, 6, this);

  QString NameY, NameZ;
  if((Diag->Name == "Rect") || (Diag->Name == "Curve")) {
    NameY = tr("left Axis");
    NameZ = tr("right Axis");
  }
  else if(Diag->Name == "Polar") {
    NameY = tr("y-Axis");
  }
  else if((Diag->Name == "Smith") || (Diag->Name == "ySmith")) {
    NameY = tr("y-Axis");
  }
  else if(Diag->Name == "PS") {
    NameY = tr("smith Axis");
    NameZ = tr("polar Axis");
  }
  else if(Diag->Name == "SP") {
    NameY = tr("polar Axis");
    NameZ = tr("smith Axis");
  }
  else if(Diag->Name == "Rect3D") {
    NameY = tr("y-Axis");
    NameZ = tr("z-Axis");
  }

  
  all = new QVBoxLayout(this); // to provide neccessary size
  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QVBox *Tab1 = new QVBox(this);
  Tab1->setSpacing(5);

  Label4 = 0;     // different types with same content
  yrLabel = 0;
  yAxisBox = 0;
  Property2 = 0;
  ColorButt = 0;
  hideInvisible = 0;
  rotationX = rotationY = rotationZ = 0;

  QVButtonGroup *InputGroup = new QVButtonGroup(tr("Graph Input"), Tab1);
  GraphInput = new QLineEdit(InputGroup);
  GraphInput->setValidator(Validator);
  connect(GraphInput, SIGNAL(textChanged(const QString&)),
		      SLOT(slotResetToTake(const QString&)));
  QHBox *Box2 = new QHBox(InputGroup);
  Box2->setSpacing(5);

  if(Diag->Name == "Tab") {
    Label1 = new QLabel(tr("Number Notation: "), Box2);
    PropertyBox = new QComboBox(Box2);
    PropertyBox->insertItem(tr("real/imaginary"));
    PropertyBox->insertItem(tr("magnitude/angle (degree)"));
    PropertyBox->insertItem(tr("magnitude/angle (radian)"));
    PropertyBox->setCurrentItem(1);
    connect(PropertyBox, SIGNAL(activated(int)), SLOT(slotSetNumMode(int)));
    Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder

    Label2 = new QLabel(tr("Precision:"), Box2);
    Property2 = new QLineEdit(Box2);
    Property2->setValidator(ValInteger);
    Property2->setMaxLength(2);
    Property2->setMaximumWidth(25);
    Property2->setText("3");
  }
  else if(Diag->Name != "Truth") {
    Label1 = new QLabel(tr("Color:"),Box2);
    ColorButt = new QPushButton("   ",Box2);
    ColorButt->setMinimumWidth(50);
    ColorButt->setEnabled(false);
    connect(ColorButt, SIGNAL(clicked()), SLOT(slotSetColor()));
    Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder

    Label3 = new QLabel(tr("Style:"),Box2);
    Label3->setEnabled(false);
    PropertyBox = new QComboBox(Box2);
    PropertyBox->insertItem(tr("solid line"));
    PropertyBox->insertItem(tr("dash line"));
    PropertyBox->insertItem(tr("dot line"));
    if(Diag->Name != "Time") {
      PropertyBox->insertItem(tr("long dash line"));
      PropertyBox->insertItem(tr("stars"));
      PropertyBox->insertItem(tr("circles"));
      PropertyBox->insertItem(tr("arrows"));
    }
    connect(PropertyBox, SIGNAL(activated(int)),
			 SLOT(slotSetGraphStyle(int)));
    Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder

    Label2 = new QLabel(tr("Thickness:"),Box2);
    Property2 = new QLineEdit(Box2);
    Property2->setValidator(ValInteger);
    Property2->setMaximumWidth(25);
    Property2->setMaxLength(2);
    Property2->setText("0");

    if((Diag->Name=="Rect") || (Diag->Name=="PS") || (Diag->Name=="SP") ||
       (Diag->Name=="Curve")) {
      QHBox *Box3 = new QHBox(InputGroup);
      Box3->setSpacing(5);

      Label4 = new QLabel(tr("y-Axis:"),Box3);
      Label4->setEnabled(false);
      yAxisBox = new QComboBox(Box3);
      yAxisBox->insertItem(NameY);
      yAxisBox->insertItem(NameZ);
      yAxisBox->setEnabled(false);
      connect(yAxisBox, SIGNAL(activated(int)), SLOT(slotSetYAxis(int)));
      Box3->setStretchFactor(new QWidget(Box3), 5); // stretchable placeholder
    }
  }
  if(Property2) {
    connect(Property2, SIGNAL(textChanged(const QString&)),
			SLOT(slotSetProp2(const QString&)));

    Label1->setEnabled(false);
    PropertyBox->setEnabled(false);
    Label2->setEnabled(false);
    Property2->setEnabled(false);
  }

  QHBox *Box1 = new QHBox(Tab1);
  Box1->setSpacing(5);

  QVButtonGroup *DataGroup = new QVButtonGroup(tr("Dataset"), Box1);
  ChooseData = new QComboBox(false, DataGroup);
  ChooseData->setMinimumWidth(200);
  connect(ChooseData, SIGNAL(activated(int)), SLOT(slotReadVars(int)));
  ChooseVars = new QListView(DataGroup);
  ChooseVars->addColumn(tr("Name"));
  ChooseVars->addColumn(tr("Type"));
  ChooseVars->addColumn(tr("Size"));
  connect(ChooseVars, SIGNAL(doubleClicked(QListViewItem*)),
		      SLOT(slotTakeVar(QListViewItem*)));


  QVButtonGroup *GraphGroup = new QVButtonGroup(tr("Graph"), Box1);
  GraphList = new QListBox(GraphGroup);
  connect(GraphList, SIGNAL(clicked(QListBoxItem*)),
		     SLOT(slotSelectGraph(QListBoxItem*)));
  QPushButton *NewButt = new QPushButton(tr("New Graph"), GraphGroup);
  connect(NewButt, SIGNAL(clicked()), SLOT(slotNewGraph()));
  QPushButton *DelButt = new QPushButton(tr("Delete Graph"), GraphGroup);
  connect(DelButt, SIGNAL(clicked()), SLOT(slotDeleteGraph()));

  t->addTab(Tab1, tr("Data"));

  // ...........................................................
  int Row = 0;
  if(Diag->Name.at(0) != 'T') {  // not tabular or timing diagram
    QWidget *Tab2 = new QWidget(t);
    QGridLayout *gp = new QGridLayout(Tab2,13,3,5,5);

    gp->addMultiCellWidget(new QLabel(tr("x-Axis Label:"), Tab2), Row,Row,0,0);
    xLabel = new QLineEdit(Tab2);
    xLabel->setValidator(Validator);
    gp->addMultiCellWidget(xLabel, Row,Row,1,2);
    Row++;

    gp->addMultiCellWidget(
		new QLabel(NameY+" "+tr("Label:"), Tab2), Row,Row,0,0);
    ylLabel = new QLineEdit(Tab2);
    ylLabel->setValidator(Validator);
    gp->addMultiCellWidget(ylLabel, Row,Row,1,2);
    Row++;

    if((Diag->Name != "Smith") && (Diag->Name != "Polar")) {
      gp->addMultiCellWidget(
		new QLabel(NameZ +" "+tr("Label:"), Tab2), Row,Row,0,0);
      yrLabel = new QLineEdit(Tab2);
      yrLabel->setValidator(Validator);
      gp->addMultiCellWidget(yrLabel, Row,Row,1,2);
      Row++;
    }

    gp->addMultiCellWidget(new QLabel(
        tr("<b>Label text</b>: Use LaTeX style for special characters, e.g. \\tau"),
        Tab2),  Row,Row,0,2);
    Row++;

    if(Diag->Name != "Rect3D") {
      GridOn = new QCheckBox(tr("show Grid"), Tab2);
      gp->addMultiCellWidget(GridOn, Row,Row,0,2);
      Row++;

      GridLabel1 = new QLabel(tr("Grid Color:"),Tab2);
      gp->addMultiCellWidget(GridLabel1, Row,Row,0,0);
      GridColorButt = new QPushButton("        ",Tab2);
      connect(GridColorButt, SIGNAL(clicked()), SLOT(slotSetGridColor()));
      gp->addMultiCellWidget(GridColorButt, Row,Row,1,2);
      Row++;
      GridColorButt->setPaletteBackgroundColor(Diag->GridPen.color());

      GridLabel2 = new QLabel(tr("Grid Style: "), Tab2);
      gp->addMultiCellWidget(GridLabel2, Row,Row,0,0);
      GridStyleBox = new QComboBox(Tab2);
      GridStyleBox->insertItem(tr("solid line"));
      GridStyleBox->insertItem(tr("dash line"));
      GridStyleBox->insertItem(tr("dot line"));
      GridStyleBox->insertItem(tr("dash dot line"));
      GridStyleBox->insertItem(tr("dash dot dot line"));
      gp->addMultiCellWidget(GridStyleBox, Row,Row,1,2);
      Row++;
      GridStyleBox->setCurrentItem(Diag->GridPen.style()-1);
    
      GridOn->setChecked(Diag->xAxis.GridOn);
      if(!Diag->xAxis.GridOn) slotSetGridBox(QButton::Off);
      connect(GridOn, SIGNAL(stateChanged(int)), SLOT(slotSetGridBox(int)));
    }
    else {
      GridOn = 0;
      GridColorButt = 0;
      GridStyleBox = 0;
    }

    // ...........................................................
    xLabel->setText(Diag->xAxis.Label);
    ylLabel->setText(Diag->yAxis.Label);
    if(yrLabel)  yrLabel->setText(Diag->zAxis.Label);

    if((Diag->Name.left(4) == "Rect") || (Diag->Name == "Curve")) {
      GridLogX = new QCheckBox(tr("logarithmical X Axis Grid"), Tab2);
      gp->addMultiCellWidget(GridLogX, Row,Row,0,2);
      Row++;

      GridLogY = new QCheckBox(tr("logarithmical")+" "+NameY+" "+tr("Grid"), Tab2);
      gp->addMultiCellWidget(GridLogY, Row,Row,0,2);
      Row++;

      GridLogZ = new QCheckBox(tr("logarithmical")+" "+NameZ+" "+tr("Grid"), Tab2);
      gp->addMultiCellWidget(GridLogZ, Row,Row,0,2);
      Row++;

      // ...........................................................
      // transfer the diagram properties to the dialog
      GridLogX->setChecked(Diag->xAxis.log);
      GridLogY->setChecked(Diag->yAxis.log);
      GridLogZ->setChecked(Diag->zAxis.log);


      if(Diag->Name == "Rect3D") {
	hideInvisible = new QCheckBox(tr("hide invisible lines"), Tab2);
	gp->addMultiCellWidget(hideInvisible, Row,Row,0,2);
	Row++;

	QLabel *LabelRotX = new QLabel(tr("Rotation around x-Axis:"), Tab2);
	LabelRotX->setPaletteForegroundColor(Qt::red);
	gp->addWidget(LabelRotX, Row,0);
	SliderRotX = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotX,
				 Qt::Horizontal, Tab2);
	gp->addWidget(SliderRotX, Row,1);
	connect(SliderRotX, SIGNAL(valueChanged(int)), SLOT(slotNewRotX(int)));
	rotationX = new QLineEdit(Tab2);
	rotationX->setValidator(ValInteger);
	rotationX->setMaxLength(3);
	rotationX->setMaximumWidth(40);
	gp->addWidget(rotationX, Row,2);
	connect(rotationX, SIGNAL(textChanged(const QString&)),
			   SLOT(slotEditRotX(const QString&)));
	Row++;

	QLabel *LabelRotY = new QLabel(tr("Rotation around y-Axis:"), Tab2);
	LabelRotY->setPaletteForegroundColor(Qt::green);
	gp->addWidget(LabelRotY, Row,0);
	SliderRotY = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotY,
				 Qt::Horizontal, Tab2);
	gp->addWidget(SliderRotY, Row,1);
	connect(SliderRotY, SIGNAL(valueChanged(int)), SLOT(slotNewRotY(int)));
	rotationY = new QLineEdit(Tab2);
	rotationY->setValidator(ValInteger);
	rotationY->setMaxLength(3);
	rotationY->setMaximumWidth(40);
	gp->addWidget(rotationY, Row,2);
	connect(rotationY, SIGNAL(textChanged(const QString&)),
			   SLOT(slotEditRotY(const QString&)));
	Row++;

	QLabel *LabelRotZ = new QLabel(tr("Rotation around z-Axis:"), Tab2);
	LabelRotZ->setPaletteForegroundColor(Qt::blue);
	gp->addWidget(LabelRotZ, Row,0);
	SliderRotZ = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotZ,
				 Qt::Horizontal, Tab2);
	gp->addWidget(SliderRotZ, Row,1);
	connect(SliderRotZ, SIGNAL(valueChanged(int)), SLOT(slotNewRotZ(int)));
	rotationZ = new QLineEdit(Tab2);
	rotationZ->setValidator(ValInteger);
	rotationZ->setMaxLength(3);
	rotationZ->setMaximumWidth(40);
	gp->addWidget(rotationZ, Row,2);
	connect(rotationZ, SIGNAL(textChanged(const QString&)),
			   SLOT(slotEditRotZ(const QString&)));
	Row++;

	gp->addWidget(new QLabel(tr("2D-projection:"), Tab2), Row,0);
	DiagCross = new Cross3D(((Rect3DDiagram*)Diag)->rotX,
				((Rect3DDiagram*)Diag)->rotY,
				((Rect3DDiagram*)Diag)->rotZ, Tab2);
	gp->addWidget(DiagCross, Row,1);

	// transfer the diagram properties to the dialog
	hideInvisible->setChecked(Diag->hideLines);
	rotationX->setText(QString::number(((Rect3DDiagram*)Diag)->rotX));
	rotationY->setText(QString::number(((Rect3DDiagram*)Diag)->rotY));
	rotationZ->setText(QString::number(((Rect3DDiagram*)Diag)->rotZ));

      }
    }
    else GridLogX = GridLogY = GridLogZ = 0;

    t->addTab(Tab2, tr("Properties"));

  // ...........................................................
    QVBox *Tab3 = new QVBox(this);
    Tab1->setSpacing(5);

    QHGroupBox *axisX = new QHGroupBox(tr("x-Axis"), Tab3);

    QVBox *VBox1 = new QVBox(axisX);
    VBox1->setStretchFactor(new QWidget(VBox1),5); // stretchable placeholder
    manualX = new QCheckBox(tr("manual"), VBox1);
    connect(manualX, SIGNAL(stateChanged(int)), SLOT(slotManualX(int)));

    QVBox *VBox2 = new QVBox(axisX);
    new QLabel(tr("start"), VBox2);
    startX = new QLineEdit(VBox2);
    startX->setValidator(ValDouble);

    QVBox *VBox3 = new QVBox(axisX);
    new QLabel(tr("step"), VBox3);
    stepX = new QLineEdit(VBox3);
    stepX->setValidator(ValDouble);

    QVBox *VBox4 = new QVBox(axisX);
    new QLabel(tr("stop"), VBox4);
    stopX = new QLineEdit(VBox4);
    stopX->setValidator(ValDouble);


    QHGroupBox *axisY;
    axisY = new QHGroupBox(NameY, Tab3);

    QVBox *VBox5 = new QVBox(axisY);
    VBox5->setStretchFactor(new QWidget(VBox5),5); // stretchable placeholder
    manualY = new QCheckBox(tr("manual"), VBox5);
    connect(manualY, SIGNAL(stateChanged(int)), SLOT(slotManualY(int)));

    QVBox *VBox6 = new QVBox(axisY);
    new QLabel(tr("start"), VBox6);
    startY = new QLineEdit(VBox6);
    startY->setValidator(ValDouble);

    QVBox *VBox7 = new QVBox(axisY);
    if((Diag->Name=="Smith") || (Diag->Name=="ySmith") || (Diag->Name=="PS"))
      new QLabel(tr("number"), VBox7);
    else  new QLabel(tr("step"), VBox7);
    stepY = new QLineEdit(VBox7);
    stepY->setValidator(ValDouble);

    QVBox *VBox8 = new QVBox(axisY);
    new QLabel(tr("stop"), VBox8);
    stopY = new QLineEdit(VBox8);
    stopY->setValidator(ValDouble);


    QHGroupBox *axisZ;
    axisZ = new QHGroupBox(NameZ, Tab3);

    QVBox *VBox9 = new QVBox(axisZ);
    VBox9->setStretchFactor(new QWidget(VBox9),5); // stretchable placeholder
    manualZ = new QCheckBox(tr("manual"), VBox9);
    connect(manualZ, SIGNAL(stateChanged(int)), SLOT(slotManualZ(int)));

    QVBox *VBox10 = new QVBox(axisZ);
    new QLabel(tr("start"), VBox10);
    startZ = new QLineEdit(VBox10);
    startZ->setValidator(ValDouble);

    QVBox *VBox11 = new QVBox(axisZ);
    if(Diag->Name == "SP")  new QLabel(tr("number"), VBox11);
    else  new QLabel(tr("step"), VBox11);
    stepZ = new QLineEdit(VBox11);
    stepZ->setValidator(ValDouble);

    QVBox *VBox12 = new QVBox(axisZ);
    new QLabel(tr("stop"), VBox12);
    stopZ = new QLineEdit(VBox12);
    stopZ->setValidator(ValDouble);


    Tab3->setStretchFactor(new QWidget(Tab3),5); // stretchable placeholder

    t->addTab(Tab3, tr("Limits"));

    // ...........................................................
    // transfer the diagram properties to the dialog
    if(Diag->xAxis.autoScale)  slotManualX(QButton::Off);
    else  manualX->setChecked(true);
    if(Diag->yAxis.autoScale)  slotManualY(QButton::Off);
    else  manualY->setChecked(true);
    if(Diag->zAxis.autoScale)  slotManualZ(QButton::Off);
    else  manualZ->setChecked(true);

    Diag->calcLimits();    // inserts auto-scale values if not manual

    startX->setText(QString::number(Diag->xAxis.limit_min));
    stepX->setText(QString::number(Diag->xAxis.step));
    stopX->setText(QString::number(Diag->xAxis.limit_max));

    startY->setText(QString::number(Diag->yAxis.limit_min));
    stepY->setText(QString::number(Diag->yAxis.step));
    stopY->setText(QString::number(Diag->yAxis.limit_max));

    startZ->setText(QString::number(Diag->zAxis.limit_min));
    stepZ->setText(QString::number(Diag->zAxis.step));
    stopZ->setText(QString::number(Diag->zAxis.limit_max));

    if((Diag->Name == "Smith") || (Diag->Name == "ySmith") ||
       (Diag->Name == "Polar")) {
       axisZ->setEnabled(false);
    }
    if(Diag->Name.left(4) != "Rect")   // cartesian 2D and 3D
      if(Diag->Name != "Curve") {
        axisX->setEnabled(false);
        startY->setEnabled(false);
        startZ->setEnabled(false);
      }
  }
  else  stepX = 0;

  connect(t, SIGNAL(currentChanged(QWidget*)), SLOT(slotChangeTab(QWidget*)));
  // ...........................................................
  QHBox *Butts = new QHBox(this);
  Butts->setSpacing(5);
  Butts->setMargin(5);
  all->addWidget(Butts);

  QPushButton *OkButt = new QPushButton(tr("OK"), Butts);
  connect(OkButt, SIGNAL(clicked()), SLOT(slotOK()));
  QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts);
  connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply()));
  QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts);
  connect(CancelButt, SIGNAL(clicked()), SLOT(slotCancel()));

  OkButt->setDefault(true);


  // ...........................................................
  // put all data files into ComboBox
  QFileInfo Info(defaultDataSet);
  QDir ProjDir(Info.dirPath());
  QStringList Elements = ProjDir.entryList("*.dat", QDir::Files, QDir::Name);
  QStringList::iterator it;
  for(it = Elements.begin(); it != Elements.end(); ++it) {
    ChooseData->insertItem((*it).left((*it).length()-4));
    if((*it) == Info.fileName())
      // default dataset should be the current
      ChooseData->setCurrentItem(ChooseData->count()-1);
  }
  slotReadVars(0);  // put variables into the ListView

  // ...........................................................
  // put all graphs into the ListBox
  Row = 0;
  for(Graph *pg = Diag->Graphs.first(); pg != 0; pg = Diag->Graphs.next()) {
    GraphList->insertItem(pg->Var);
    if(pg == currentGraph) {
      GraphList->setCurrentItem(Row);   // select current graph
      SelectGraph(currentGraph);
    }
    Row++;
  }

  if(ColorButt)
    if(!currentGraph)
      ColorButt->setPaletteBackgroundColor
	(QColor(DefaultColors[GraphList->count()]));
}
  
  QList<QList<QListWidgetItem*> > moveItems;
  moveItems << _listWidget->findItems("Appearance", Qt::MatchFixedString);
  moveItems << _listWidget->findItems("Size/Position", Qt::MatchFixedString);
  foreach(const QList<QListWidgetItem*>& found, moveItems) {
    if (found.size() > 0) {
      _listWidget->addItem(_listWidget->takeItem(_listWidget->row(found.first())));
    }
  }

  selectDialogPage(contentsPage);
  _saveAsDefault->show();

  connect(this, SIGNAL(editMultipleMode()), this, SLOT(editMultiple()));
  connect(this, SIGNAL(editSingleMode()), this, SLOT(editSingle()));
  connect(this, SIGNAL(apply()), this, SLOT(slotApply()));

  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // Make sure the labels are visible, doesn't work right now :-)
}


PlotItemDialog::~PlotItemDialog() {
}


void PlotItemDialog::editMultiple() {
  _xAxisTab->clearTabValues();
  _yAxisTab->clearTabValues();
  _rangeTab->clearTabValues();
  _labelTab->clearTabValues();
  _labelTab->enableSingleEditOptions(false);
예제 #3
0
void K3b::AudioTrackDialog::slotOk()
{
    slotApply();
    done(0);
}
예제 #4
0
ScoreInfoDialog::ScoreInfoDialog(NMainFrameWidget *parent) :
	KDialogBase
		(Tabbed,                             //  dialogFace
		 kapp->makeStdCaption(i18n("Score information")),
		 Help | User1 | User2 | Ok | Apply | Cancel,
		 Ok,                                 //  defaultButton
		 parent,                             //  parent
		 "ScoreInfoDialog",                  //  name (for internal use only)
		 true,                               //  modal
		 true,                               //  separator
		 i18n("&Revert"),                    //  User1
		 i18n("Cl&ear all")                  //  User1
		),
	mainWidget(parent) {

	kapp->config()->setGroup("ScoreInfo");


	//  GENERAL

	QFrame *pageGeneral = addPage(i18n("&General"));
	QGridLayout *layoutGeneral = new QGridLayout(pageGeneral, 5, 2);
	layoutGeneral->setSpacing(KDialog::spacingHint());
	layoutGeneral->setColStretch(1 /* the right column */, 1 /*factor*/);

	//  Title
	title = new KHistoryCombo(pageGeneral);
	title->setHistoryItems(kapp->config()->readListEntry("TitleHistory"), true);
	title->setEditText(mainWidget->scTitle_);
	layoutGeneral->addWidget(title, 0, 1);
	QLabel *titleLabel = new QLabel(title, i18n("&Title:"), pageGeneral);
	layoutGeneral->addWidget(titleLabel, 0, 0);

	//  Subject
	subject = new KHistoryCombo(pageGeneral);
	subject->setHistoryItems
		(kapp->config()->readListEntry("SubjectHistory"), true);
	subject->setEditText(mainWidget->scSubtitle_);
	layoutGeneral->addWidget(subject, 1, 1);
	QLabel *subjectLabel = new QLabel(subject, i18n("&Subject:"), pageGeneral);
	layoutGeneral->addWidget(subjectLabel, 1, 0);

	//  Author
	author = new KHistoryCombo(pageGeneral);
	author->setHistoryItems
		(kapp->config()->readListEntry("AuthorHistory"), true);
	author->setEditText(mainWidget->scAuthor_);
	layoutGeneral->addWidget(author, 2, 1);
	QLabel *authorLabel = new QLabel(author, i18n("A&uthor:"), pageGeneral);
	layoutGeneral->addWidget(authorLabel, 2, 0);

	//  Last author
	lastAuthor = new KHistoryCombo(pageGeneral);
	lastAuthor->setHistoryItems
		(kapp->config()->readListEntry("LastAuthorHistory"), true);
	lastAuthor->setEditText(mainWidget->scLastAuthor_);
	layoutGeneral->addWidget(lastAuthor, 3, 1);
	QLabel *lastAuthorLabel = new QLabel
		(lastAuthor, i18n("&Last author:"), pageGeneral);
	layoutGeneral->addWidget(lastAuthorLabel, 3, 0);


	// Copyright
	copyright = new KHistoryCombo(pageGeneral);
	copyright->setHistoryItems
		(kapp->config()->readListEntry("Copyright"), true);
	copyright->setEditText(mainWidget->scCopyright_);
	layoutGeneral->addWidget(copyright, 4, 1);
	QLabel *copyrightLabel = new QLabel
		(lastAuthor, i18n("&Copyright:"), pageGeneral);
	layoutGeneral->addWidget(copyrightLabel, 4, 0);



	//  COMMENTS
	QGrid *pageComments = addGridPage(1, QGrid::Horizontal, i18n("Co&mments"));
	comments = new QMultiLineEdit(pageComments);
	comments->setText(mainWidget->scComment_);
	comments->setSizePolicy
		(QSizePolicy
			(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)
		);

	connect(this, SIGNAL(finished()), this, SLOT(saveComboData()));
	connect(this, SIGNAL(user2Clicked()), title,      SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), subject,    SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), author,     SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), lastAuthor, SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), copyright, SLOT(clearEdit()));
	connect(this, SIGNAL(user2Clicked()), comments,   SLOT(clear()));
	connect(this, SIGNAL(okClicked()), this, SLOT(slotApply()));
	connect(this, SIGNAL(okClicked()), this, SLOT(hide()));

}
예제 #5
0
void DlgPrefRecord::slotRecordPathChange() {
    m_bConfirmOverwrite = false;
    slotApply();
}
예제 #6
0
void allIPTCEditWidget::slotOk()
{
    slotApply();
    saveSettings();
}
예제 #7
0
displayLines::displayLines (QWidget * parent, MISC *mi):
  QDialog (parent, (Qt::WindowFlags) Qt::WA_DeleteOnClose)
{
  misc = mi;


  setWindowTitle (tr ("pfmEdit3D View Selected Lines"));
  resize (500, 500);


  QVBoxLayout *vbox = new QVBoxLayout (this);
  vbox->setMargin (5);
  vbox->setSpacing (5);


  QGroupBox *sbox = new QGroupBox (tr ("Selected lines"), this);
  QVBoxLayout *sboxLayout = new QVBoxLayout;
  sbox->setLayout (sboxLayout);


  selectBox = new QListWidget (this);
  selectBox->setWhatsThis (DLText);
  selectBox->setSelectionMode (QAbstractItemView::ExtendedSelection);
  sboxLayout->addWidget (selectBox);

  vbox->addWidget (sbox, 0, 0);


  NV_CHAR temp[512];
  for (NV_INT32 i = 0 ; i < misc->line_count ; i++)
    {
      NV_INT32 pfm = misc->line_number[i] / SHARED_LINE_MULT;
      NV_INT32 line_number = misc->line_number[i] % SHARED_LINE_MULT;

      strcpy (temp, read_line_file (misc->pfm_handle[pfm], line_number));

      if (!strcmp (temp, "UNDEFINED")) sprintf (temp, "%d", line_number);

      QString lineData = QString (temp) + "   :   " + 
	QFileInfo (QString (misc->abe_share->open_args[pfm].list_path)).fileName ().remove (".pfm") + "   :   " +
	QString (PFM_data_type[misc->line_type[i]]);

      selectList += lineData;
    }

  selectBox->addItems (selectList);

  for (NV_INT32 i = 0 ; i < misc->line_count ; i++)
    {
      if (misc->num_lines && misc->line_num[i] == misc->line_number[i]) selectBox->item (i)->setSelected (TRUE);
    }


  QHBoxLayout *actions = new QHBoxLayout (0);
  vbox->addLayout (actions);

  QPushButton *bHelp = new QPushButton (this);
  bHelp->setIcon (QIcon (":/icons/contextHelp.xpm"));
  bHelp->setToolTip (tr ("Enter What's This mode for help"));
  connect (bHelp, SIGNAL (clicked ()), this, SLOT (slotHelp ()));
  actions->addWidget (bHelp);

  actions->addStretch (10);

  QPushButton *applyButton = new QPushButton (tr ("Apply"), this);
  applyButton->setToolTip (tr ("Redraw main window using selected lines"));
  applyButton->setWhatsThis (applyDLText);
  connect (applyButton, SIGNAL (clicked ()), this, SLOT (slotApply ()));
  actions->addWidget (applyButton);

  QPushButton *closeButton = new QPushButton (tr ("Close"), this);
  closeButton->setToolTip (tr ("Close the View Selected Lines dialog"));
  closeButton->setWhatsThis (closeDLText);
  connect (closeButton, SIGNAL (clicked ()), this, SLOT (slotClose ()));
  actions->addWidget (closeButton);


  show ();
}
예제 #8
0
// -----------------------------------------------------------
void QucsSettingsDialog::slotOK()
{
  slotApply();
  accept();
}
예제 #9
0
void OptionsDialog::slotOk()
{
  if( configChanged )
    slotApply();
  KDialogBase::slotOk();
}
예제 #10
0
파일: FontDia.cpp 프로젝트: ChrisJong/krita
void FontDia::slotReset()
{
    initTabs();
    slotApply(); // ### Should reset() apply?
}
예제 #11
0
파일: FontDia.cpp 프로젝트: ChrisJong/krita
void FontDia::slotOk()
{
    slotApply();
    KoDialog::accept();
}
void AssociationPropertiesDialog::slotOk()
{
    slotApply();
    accept();
}
QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent, const char *name)
			: QDialog(parent, name)
{
  App = parent;
  setWindowTitle(tr("Edit Qucs Properties"));

  Expr.setPattern("[\\w_]+");
  Validator  = new QRegExpValidator(Expr, this);

  all = new QVBoxLayout(this); // to provide the neccessary size
  QTabWidget *t = new QTabWidget();
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  QGridLayout *gp = new QGridLayout(Tab1);

  gp->addWidget(new QLabel(tr("Font (set after reload):"), Tab1), 0,0);
  FontButton = new QPushButton(Tab1);
  connect(FontButton, SIGNAL(clicked()), SLOT(slotFontDialog()));
  gp->addWidget(FontButton,0,1);

  gp->addWidget(new QLabel(tr("Document Background Color:"), Tab1) ,1,0);
  BGColorButton = new QPushButton("      ", Tab1);
  connect(BGColorButton, SIGNAL(clicked()), SLOT(slotBGColorDialog()));
  gp->addWidget(BGColorButton,1,1);

  gp->addWidget(new QLabel(tr("Language (set after reload):"), Tab1) ,2,0);
  LanguageCombo = new QComboBox(Tab1);
  LanguageCombo->insertItem(tr("system language"));
  LanguageCombo->insertItem(tr("English")+" (en)");
  LanguageCombo->insertItem(tr("German")+" (de)");
  LanguageCombo->insertItem(tr("French")+" (fr)");
  LanguageCombo->insertItem(tr("Spanish")+" (es)");
  LanguageCombo->insertItem(tr("Italian")+" (it)");
  LanguageCombo->insertItem(tr("Polish")+" (pl)");
  LanguageCombo->insertItem(tr("Romanian")+" (ro)");
  LanguageCombo->insertItem(tr("Japanese")+" (jp)");
  LanguageCombo->insertItem(tr("Swedish")+" (sv)");
  LanguageCombo->insertItem(tr("Hungarian")+" (hu)");
  LanguageCombo->insertItem(tr("Hebrew")+" (he)");
  LanguageCombo->insertItem(tr("Portuguese")+" (pt)");
  LanguageCombo->insertItem(tr("Turkish")+" (tr)");
  LanguageCombo->insertItem(tr("Ukrainian")+" (uk)");
  LanguageCombo->insertItem(tr("Russian")+" (ru)");
  LanguageCombo->insertItem(tr("Czech")+" (cs)");
  LanguageCombo->insertItem(tr("Catalan")+" (ca)");
  LanguageCombo->insertItem(tr("Arabic")+" (ar)");
  LanguageCombo->insertItem(tr("Kazakh")+" (kk)");
  gp->addWidget(LanguageCombo,2,1);

  val200 = new QIntValidator(0, 200, this);
  gp->addWidget(new QLabel(tr("maximum undo operations:"), Tab1) ,3,0);
  undoNumEdit = new QLineEdit(Tab1);
  undoNumEdit->setValidator(val200);
  gp->addWidget(undoNumEdit,3,1);

  gp->addWidget(new QLabel(tr("text editor:"), Tab1) ,4,0);
  editorEdit = new QLineEdit(Tab1);
  gp->addWidget(editorEdit,4,1);

  gp->addWidget(new QLabel(tr("start wiring when clicking open node:"), Tab1) ,5,0);
  checkWiring = new QCheckBox(Tab1);
  gp->addWidget(checkWiring,5,1);


  t->addTab(Tab1, tr("Settings"));

  // ...........................................................
  QWidget *Tab3 = new QWidget(t);
  QGridLayout *gp3 = new QGridLayout(Tab3);

  gp3->addMultiCellWidget(new QLabel(tr("Colors for Syntax Highlighting:"), Tab3), 0,0,0,1);

  ColorComment = new QPushButton(tr("Comment"), Tab3);
  ColorComment->setPaletteForegroundColor(QucsSettings.Comment);
  ColorComment->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorComment, SIGNAL(clicked()), SLOT(slotColorComment()));
  gp3->addWidget(ColorComment,1,0);

  ColorString = new QPushButton(tr("String"), Tab3);
  ColorString->setPaletteForegroundColor(QucsSettings.String);
  ColorString->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorString, SIGNAL(clicked()), SLOT(slotColorString()));
  gp3->addWidget(ColorString,1,1);

  ColorInteger = new QPushButton(tr("Integer Number"), Tab3);
  ColorInteger->setPaletteForegroundColor(QucsSettings.Integer);
  ColorInteger->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorInteger, SIGNAL(clicked()), SLOT(slotColorInteger()));
  gp3->addWidget(ColorInteger,1,2);

  ColorReal = new QPushButton(tr("Real Number"), Tab3);
  ColorReal->setPaletteForegroundColor(QucsSettings.Real);
  ColorReal->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorReal, SIGNAL(clicked()), SLOT(slotColorReal()));
  gp3->addWidget(ColorReal,2,0);

  ColorCharacter = new QPushButton(tr("Character"), Tab3);
  ColorCharacter->setPaletteForegroundColor(QucsSettings.Character);
  ColorCharacter->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorCharacter, SIGNAL(clicked()), SLOT(slotColorCharacter()));
  gp3->addWidget(ColorCharacter,2,1);

  ColorDataType = new QPushButton(tr("Data Type"), Tab3);
  ColorDataType->setPaletteForegroundColor(QucsSettings.Type);
  ColorDataType->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorDataType, SIGNAL(clicked()), SLOT(slotColorDataType()));
  gp3->addWidget(ColorDataType,2,2);

  ColorAttribute = new QPushButton(tr("Attribute"), Tab3);
  ColorAttribute->setPaletteForegroundColor(QucsSettings.Attribute);
  ColorAttribute->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorAttribute, SIGNAL(clicked()), SLOT(slotColorAttribute()));
  gp3->addWidget(ColorAttribute,3,0);

  ColorDirective = new QPushButton(tr("Directive"), Tab3);
  ColorDirective->setPaletteForegroundColor(QucsSettings.Directive);
  ColorDirective->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorDirective, SIGNAL(clicked()), SLOT(slotColorDirective()));
  gp3->addWidget(ColorDirective,3,1);

  ColorTask = new QPushButton(tr("Task"), Tab3);
  ColorTask->setPaletteForegroundColor(QucsSettings.Task);
  ColorTask->setPaletteBackgroundColor(QucsSettings.BGColor);
  connect(ColorTask, SIGNAL(clicked()), SLOT(slotColorTask()));
  gp3->addWidget(ColorTask,3,2);


  t->addTab(Tab3, tr("Source Code Editor"));

  // ...........................................................
  QWidget *Tab2 = new QWidget(t);
  QGridLayout *gp2 = new QGridLayout(Tab2);

  QLabel *note = new QLabel(
     tr("Register filename extensions here in order to\nopen files with an appropriate program."));
  gp2->addWidget(note,0,0,1,2);

  tableWidget = new QTableWidget(Tab2);
  tableWidget->setColumnCount(2);

  QTableWidgetItem *item1 = new QTableWidgetItem();
  QTableWidgetItem *item2 = new QTableWidgetItem();

  tableWidget->setHorizontalHeaderItem(0, item1);
  tableWidget->setHorizontalHeaderItem(1, item2);

  item1->setText(tr("Suffix"));
  item2->setText(tr("Program"));

  tableWidget->horizontalHeader()->setStretchLastSection(true);
  tableWidget->verticalHeader()->hide();
  connect(tableWidget, SIGNAL(cellClicked(int,int)), SLOT(slotTableCliked(int,int)));
  gp2->addWidget(tableWidget,1,0,3,1);

  // fill listview with already registered file extensions
  QStringList::Iterator it = QucsSettings.FileTypes.begin();
  while(it != QucsSettings.FileTypes.end()) {
    int row = tableWidget->rowCount();
    tableWidget->setRowCount(row+1);
    QTableWidgetItem *suffix = new QTableWidgetItem(QString((*it).section('/',0,0)));
    QTableWidgetItem *program = new QTableWidgetItem(QString((*it).section('/',1,1)));
    suffix->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    program->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    tableWidget->setItem(row, 0, suffix);
    tableWidget->setItem(row, 1, program);
    it++;
  }

  QLabel *l5 = new QLabel(tr("Suffix:"), Tab2);
  gp2->addWidget(l5,1,1);
  Input_Suffix = new QLineEdit(Tab2);
  Input_Suffix->setValidator(Validator);
  gp2->addWidget(Input_Suffix,1,2);
//  connect(Input_Suffix, SIGNAL(returnPressed()), SLOT(slotGotoProgEdit())); //not implemented

  QLabel *l6 = new QLabel(tr("Program:"), Tab2);
  gp2->addWidget(l6,2,1);
  Input_Program = new QLineEdit(Tab2);
  gp2->addWidget(Input_Program,2,2);

  QPushButton *AddButt = new QPushButton(tr("Set"));
  gp2->addWidget(AddButt,3,1);
  connect(AddButt, SIGNAL(clicked()), SLOT(slotAdd()));
  QPushButton *RemoveButt = new QPushButton(tr("Remove"));
  gp2->addWidget(RemoveButt,3,2);
  connect(RemoveButt, SIGNAL(clicked()), SLOT(slotRemove()));

  gp2->setRowStretch(3,4);
  t->addTab(Tab2, tr("File Types"));

  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  QHBoxLayout *Butts = new QHBoxLayout();
  Butts->setSpacing(3);
  Butts->setMargin(3);
  all->addLayout(Butts);

  QPushButton *OkButt = new QPushButton(tr("OK"));
  Butts->addWidget(OkButt);
  connect(OkButt, SIGNAL(clicked()), SLOT(slotOK()));
  QPushButton *ApplyButt = new QPushButton(tr("Apply"));
  Butts->addWidget(ApplyButt);
  connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply()));
  QPushButton *CancelButt = new QPushButton(tr("Cancel"));
  Butts->addWidget(CancelButt);
  connect(CancelButt, SIGNAL(clicked()), SLOT(reject()));
  QPushButton *DefaultButt = new QPushButton(tr("Default Values"));
  Butts->addWidget(DefaultButt);
  connect(DefaultButt, SIGNAL(clicked()), SLOT(slotDefaultValues()));

  OkButt->setDefault(true);

  // ...........................................................
  // fill the fields with the Qucs-Properties
  Font  = QucsSettings.font;
  FontButton->setText(Font.toString());
  BGColorButton->setPaletteBackgroundColor(QucsSettings.BGColor);
  undoNumEdit->setText(QString::number(QucsSettings.maxUndo));
  editorEdit->setText(QucsSettings.Editor);
  checkWiring->setChecked(QucsSettings.NodeWiring);

  for(int z=LanguageCombo->count()-1; z>=0; z--)
    if(LanguageCombo->text(z).section('(',1,1).remove(')') == QucsSettings.Language)
      LanguageCombo->setCurrentItem(z);

  resize(300, 200);
}
void AttachmentEditDialog::accept()
{
  slotApply();
  KDialog::accept();
}
예제 #15
0
PrefDialog::PrefDialog(QWidget *parent,int nbChannels)
 : QPageDialog(parent)
{

    setButtons(Help | Default | Ok | Apply | Cancel);
    setDefaultButton(Ok);
    setFaceType(List);
    setWindowTitle(tr("Preferences"));

    setHelp("settings","klusters");
    
    QWidget * w = new QWidget(this);
    prefGeneral = new PrefGeneral(w);
    QPageWidgetItem *item = new QPageWidgetItem(prefGeneral,tr("General"));
    item->setHeader(tr("Klusters General Configuration"));
    item->setIcon(QIcon(":/shared-icons/folder-open"));


    addPage(item);



    //adding page "Cluster view configuration"
    w = new QWidget(this);
    prefclusterView = new PrefClusterView(w);

    item = new QPageWidgetItem(prefclusterView,tr("Cluster view"));
    item->setHeader(tr("Cluster View configuration"));
    item->setIcon(QIcon(":/icons/clusterview"));
    addPage(item);


    //adding page "Waveform view configuration"
    w = new QWidget(this);
    prefWaveformView = new PrefWaveformView(w,nbChannels);

    item = new QPageWidgetItem(prefWaveformView,tr("Waveform view"));
    item->setHeader(tr("Waveform View configuration"));
    item->setIcon(QIcon(":/icons/waveformview"));
    addPage(item);



    // connect interactive widgets and selfmade signals to the enableApply slotDefault
    connect(prefGeneral->crashRecoveryCheckBox,SIGNAL(clicked()),this,SLOT(enableApply()));
    connect(prefGeneral->crashRecoveryComboBox,SIGNAL(activated(int)),this,SLOT(enableApply()));
    connect(prefGeneral->undoSpinBox,SIGNAL(valueChanged(int)),this,SLOT(enableApply()));
    connect(prefGeneral->backgroundColorButton,SIGNAL(colorChanged(QColor)),this,SLOT(enableApply()));
    connect(prefGeneral->reclusteringExecutableLineEdit,SIGNAL(textChanged(QString)),this,SLOT(enableApply()));
    //connect(prefGeneral,SIGNAL(reclusteringArgsUpdate()),this,SLOT(enableApply()));
    connect(prefGeneral->reclusteringArgsLineEdit,SIGNAL(textChanged(QString)),this,SLOT(enableApply()));
    connect(prefGeneral->useWhiteColorPrinting,SIGNAL(clicked()),this,SLOT(enableApply()));
    
    connect(prefclusterView->intervalSpinBox,SIGNAL(valueChanged(int)),this,SLOT(enableApply()));
    connect(prefWaveformView->gainSpinBox,SIGNAL(valueChanged(int)),this,SLOT(enableApply()));
    connect(prefWaveformView,SIGNAL(positionsChanged()),this,SLOT(enableApply()));


    connect(this, SIGNAL(applyClicked()), SLOT(slotApply()));
    connect(this, SIGNAL(defaultClicked()), SLOT(slotDefault()));
    connect(this,SIGNAL(helpClicked()),SLOT(slotHelp()));

    applyEnable = false;
}
예제 #16
0
OptimizeDialog::OptimizeDialog(Optimize_Sim *c_, Schematic *d_)
			: QDialog(d_, 0, TRUE, Qt::WDestructiveClose)
{
  Comp = c_;
  Doc  = d_;
  changed = false;
  setCaption(tr("Edit Optimization Properties"));

  Expr.setPattern("[\\w_]+");
  Validator = new QRegExpValidator(Expr, this);
  numVal = new QDoubleValidator(this);
  intVal = new QIntValidator(this);

  all = new Q3VBoxLayout(this); // to provide the neccessary size
  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  Q3GridLayout *gp1 = new Q3GridLayout(Tab1,3,2,3,3);

  gp1->addWidget(new QLabel(tr("Name:"), Tab1), 0,0);
  NameEdit = new QLineEdit(Tab1);
  NameEdit->setValidator(Validator);
  gp1->addWidget(NameEdit,0,1);

  gp1->addWidget(new QLabel(tr("Simulation:"), Tab1), 1,0);
  SimEdit = new QComboBox(Tab1);
  SimEdit->setEditable(true);
  gp1->addWidget(SimEdit,1,1);

  t->addTab(Tab1, tr("General"));

  // ...........................................................
  QWidget *Tab4 = new QWidget(t);
  Q3GridLayout *gp4 = new Q3GridLayout(Tab4,11,2,3,3);

  gp4->addWidget(new QLabel(tr("Method:"), Tab4), 0,0);
  MethodCombo = new QComboBox(Tab4);
  MethodCombo->insertItem("DE/best/1/exp");
  MethodCombo->insertItem("DE/rand/1/exp");
  MethodCombo->insertItem("DE/rand-to-best/1/exp");
  MethodCombo->insertItem("DE/best/2/exp");
  MethodCombo->insertItem("DE/rand/1/exp");
  MethodCombo->insertItem("DE/best/1/bin");
  MethodCombo->insertItem("DE/rand/1/bin");
  MethodCombo->insertItem("DE/rand-to-best/1/bin");
  MethodCombo->insertItem("DE/best/2/bin");
  MethodCombo->insertItem("DE/rand/2/bin");
  gp4->addWidget(MethodCombo,0,1);

  gp4->addWidget(new QLabel(tr("Maximum number of iterations:"), Tab4), 1,0);
  IterEdit = new QLineEdit(Tab4);
  IterEdit->setValidator(intVal);
  gp4->addWidget(IterEdit,1,1);

  gp4->addWidget(new QLabel(tr("Output refresh cycle:"), Tab4), 2,0);
  RefreshEdit = new QLineEdit(Tab4);
  RefreshEdit->setValidator(intVal);
  gp4->addWidget(RefreshEdit,2,1);

  gp4->addWidget(new QLabel(tr("Number of parents:"), Tab4), 3,0);
  ParentsEdit = new QLineEdit(Tab4);
  ParentsEdit->setValidator(intVal);
  gp4->addWidget(ParentsEdit,3,1);

  gp4->addWidget(new QLabel(tr("Constant F:"), Tab4), 4,0);
  ConstEdit = new QLineEdit(Tab4);
  ConstEdit->setValidator(new QDoubleValidator(0.0,2.0,20,ConstEdit));
  gp4->addWidget(ConstEdit,4,1);

  gp4->addWidget(new QLabel(tr("Crossing over factor:"), Tab4), 5,0);
  CrossEdit = new QLineEdit(Tab4);
  CrossEdit->setValidator(new QDoubleValidator(0.0,1.0,20,CrossEdit));
  gp4->addWidget(CrossEdit,5,1);

  gp4->addWidget(new QLabel(tr("Pseudo random number seed:"), Tab4), 6,0);
  SeedEdit = new QLineEdit(Tab4);
  SeedEdit->setValidator(numVal);
  gp4->addWidget(SeedEdit,6,1);

  gp4->addWidget(new QLabel(tr("Minimum cost variance:"), Tab4), 7,0);
  CostVarEdit = new QLineEdit(Tab4);
  CostVarEdit->setValidator(numVal);
  gp4->addWidget(CostVarEdit,7,1);

  gp4->addWidget(new QLabel(tr("Cost objectives:"), Tab4), 8,0);
  CostObjEdit = new QLineEdit(Tab4);
  CostObjEdit->setValidator(numVal);
  gp4->addWidget(CostObjEdit,8,1);

  gp4->addWidget(new QLabel(tr("Cost constraints:"), Tab4), 9,0);
  CostConEdit = new QLineEdit(Tab4);
  CostConEdit->setValidator(numVal);
  gp4->addWidget(CostConEdit,9,1);

  t->addTab(Tab4, tr("Algorithm"));

  // ...........................................................
  QWidget *Tab2 = new QWidget(t);
  Q3GridLayout *gp2 = new Q3GridLayout(Tab2,5,3,3,3);

  VarList = new Q3ListView(Tab2);
  VarList->addColumn(tr("Name"));
  VarList->addColumn(tr("active"));
  VarList->addColumn(tr("initial"));
  VarList->addColumn(tr("min"));
  VarList->addColumn(tr("max"));
  VarList->addColumn(tr("Type"));
  VarList->setSorting(-1);   // no sorting
  gp2->addMultiCellWidget(VarList,0,0,0,2);
  connect(VarList, SIGNAL(selectionChanged(Q3ListViewItem*)),
                   SLOT(slotEditVariable(Q3ListViewItem*)));

  Q3HBox *VarLine = new Q3HBox(Tab2);
  VarLine->setSpacing(3);
  gp2->addMultiCellWidget(VarLine, 1,1,0,2);

  new QLabel(tr("Name:"), VarLine);
  VarNameEdit = new QLineEdit(VarLine);
  VarNameEdit->setValidator(Validator);
  connect(VarNameEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeVarName(const QString&)));
  VarActiveCheck = new QCheckBox(tr("active"), VarLine);
  VarActiveCheck->setChecked(true);
  connect(VarActiveCheck, SIGNAL(toggled(bool)),
          SLOT(slotChangeVarActive(bool)));

  gp2->addWidget(new QLabel(tr("initial:"), Tab2), 2,0);
  gp2->addWidget(new QLabel(tr("min:"), Tab2), 2,1);
  gp2->addWidget(new QLabel(tr("max:"), Tab2), 2,2);
  VarInitEdit = new QLineEdit(Tab2);
  VarInitEdit->setValidator(numVal);
  gp2->addWidget(VarInitEdit,3,0);
  connect(VarInitEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeVarInit(const QString&)));
  VarMinEdit = new QLineEdit(Tab2);
  VarMinEdit->setValidator(numVal);
  gp2->addWidget(VarMinEdit,3,1);
  connect(VarMinEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeVarMin(const QString&)));
  VarMaxEdit = new QLineEdit(Tab2);
  VarMaxEdit->setValidator(numVal);
  gp2->addWidget(VarMaxEdit,3,2);
  connect(VarMaxEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeVarMax(const QString&)));

  Q3HBox *VarButtons = new Q3HBox(Tab2);
  VarButtons->setSpacing(3);
  gp2->addMultiCellWidget(VarButtons, 4,4,0,2);

  new QLabel(tr("Type:"), VarButtons);
  VarTypeCombo = new QComboBox(VarButtons);
  VarTypeCombo->insertItem(tr("linear double"));
  VarTypeCombo->insertItem(tr("logarithmic double"));
  VarTypeCombo->insertItem(tr("linear integer"));
  VarTypeCombo->insertItem(tr("logarithmic integer"));
  connect(VarTypeCombo, SIGNAL(activated(const QString&)),
          SLOT(slotChangeVarType(const QString&)));

  VarButtons->setStretchFactor(new QWidget(VarButtons), 10);
  QPushButton *AddVar_Butt = new QPushButton(tr("Add"), VarButtons);
  connect(AddVar_Butt, SIGNAL(clicked()), SLOT(slotAddVariable()));
  QPushButton *DelVar_Butt = new QPushButton(tr("Delete"), VarButtons);
  connect(DelVar_Butt, SIGNAL(clicked()), SLOT(slotDeleteVariable()));

  t->addTab(Tab2, tr("Variables"));

  // ...........................................................
  QWidget *Tab3 = new QWidget(t);
  Q3GridLayout *gp3 = new Q3GridLayout(Tab3,4,3,3,3);

  GoalList = new Q3ListView(Tab3);
  GoalList->addColumn(tr("Name"));
  GoalList->addColumn(tr("Type"));
  GoalList->addColumn(tr("Value"));
  GoalList->setSorting(-1);   // no sorting
  gp3->addMultiCellWidget(GoalList,0,0,0,2);
  connect(GoalList, SIGNAL(selectionChanged(Q3ListViewItem*)),
                    SLOT(slotEditGoal(Q3ListViewItem*)));

  gp3->addWidget(new QLabel(tr("Name:"), Tab3), 1,0);
  GoalNameEdit = new QLineEdit(Tab3);
  GoalNameEdit->setValidator(Validator);
  gp3->addWidget(GoalNameEdit,1,1);
  connect(GoalNameEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeGoalName(const QString&)));

  gp3->addWidget(new QLabel(tr("Value:"), Tab3), 2,0);
  GoalNumEdit = new QLineEdit(Tab3);
  GoalNumEdit->setValidator(numVal);
  gp3->addWidget(GoalNumEdit,2,1);
  connect(GoalNumEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeGoalNum(const QString&)));

  GoalTypeCombo = new QComboBox(Tab3);
  GoalTypeCombo->insertItem(tr("minimize"));
  GoalTypeCombo->insertItem(tr("maximize"));
  GoalTypeCombo->insertItem(tr("less"));
  GoalTypeCombo->insertItem(tr("greater"));
  GoalTypeCombo->insertItem(tr("equal"));
  GoalTypeCombo->insertItem(tr("monitor"));
  gp3->addWidget(GoalTypeCombo,2,2);
  connect(GoalTypeCombo, SIGNAL(activated(const QString&)),
          SLOT(slotChangeGoalType(const QString&)));

  Q3HBox *GoalButtons = new Q3HBox(Tab3);
  GoalButtons->setSpacing(3);
  gp3->addMultiCellWidget(GoalButtons, 3,3,0,2);

  GoalButtons->setStretchFactor(new QWidget(GoalButtons),5);
  QPushButton *AddGoal_Butt = new QPushButton(tr("Add"), GoalButtons);
  connect(AddGoal_Butt, SIGNAL(clicked()), SLOT(slotAddGoal()));
  QPushButton *DelGoal_Butt = new QPushButton(tr("Delete"), GoalButtons);
  connect(DelGoal_Butt, SIGNAL(clicked()), SLOT(slotDeleteGoal()));

  t->addTab(Tab3, tr("Goals"));

  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  Q3HBox *Butts = new Q3HBox(this);
  Butts->setSpacing(3);
  Butts->setMargin(3);
  all->addWidget(Butts);

  QPushButton *OkButt = new QPushButton(tr("OK"), Butts);
  connect(OkButt, SIGNAL(clicked()), SLOT(slotOK()));
  QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts);
  connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply()));
  QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts);
  connect(CancelButt, SIGNAL(clicked()), SLOT(slotCancel()));

  OkButt->setFocus();

  // ...........................................................

  Component *pc;
  for(pc=Doc->Components->first(); pc!=0; pc=Doc->Components->next())
    if(pc != Comp)
      if(pc->Model[0] == '.' && pc->Model != ".Opt")
        SimEdit->insertItem(pc->Name);

  Property *pp;
  pp = Comp->Props.at(0);
  if(!pp->Value.isEmpty())
    SimEdit->setCurrentText(pp->Value);

  pp = Comp->Props.at(1);
  if(!pp->Value.isEmpty()) {
    MethodCombo->setCurrentItem(pp->Value.section('|',0,0).toInt()-1);
    IterEdit->setText(pp->Value.section('|',1,1));
    RefreshEdit->setText(pp->Value.section('|',2,2));
    ParentsEdit->setText(pp->Value.section('|',3,3));
    ConstEdit->setText(pp->Value.section('|',4,4));
    CrossEdit->setText(pp->Value.section('|',5,5));
    SeedEdit->setText(pp->Value.section('|',6,6));
    CostVarEdit->setText(pp->Value.section('|',7,7));
    CostObjEdit->setText(pp->Value.section('|',8,8));
    CostConEdit->setText(pp->Value.section('|',9,9));
  }

  NameEdit->setText(Comp->Name);

  for(pp = Comp->Props.at(2); pp != 0; pp = Comp->Props.next()) {
    if(pp->Name == "Var") {
      new Q3ListViewItem(VarList, pp->Value.section('|',0,0),
        pp->Value.section('|',1,1) == "yes" ? tr("yes") : tr("no"),
	pp->Value.section('|',2,2),
        pp->Value.section('|',3,3), pp->Value.section('|',4,4),
        ((pp->Value.section('|',5,5)=="LIN_DOUBLE")?tr("linear double") :
        ((pp->Value.section('|',5,5)=="LOG_DOUBLE")?tr("logarithmic double") :
        ((pp->Value.section('|',5,5)=="LIN_INT")?tr("linear integer") :
	 tr("logarithmic integer")))));
    }
    if(pp->Name == "Goal") {
      new Q3ListViewItem(GoalList, pp->Value.section('|',0,0),
        ((pp->Value.section('|',1,1) == "MIN") ? tr("minimize") :
        ((pp->Value.section('|',1,1) == "MAX") ? tr("maximize") :
        ((pp->Value.section('|',1,1) == "LE") ? tr("less") :
        ((pp->Value.section('|',1,1) == "GE") ? tr("greater") :
        ((pp->Value.section('|',1,1) == "EQ") ? tr("equal") :
	 tr("monitor")))))),
	pp->Value.section('|',2,2));
    }
  }

  resize(300, 250);
}
예제 #17
0
// -----------------------------------------------------------
void OptimizeDialog::slotOK()
{
  slotApply();
  slotCancel();
}
예제 #18
0
QuasarConfig::QuasarConfig(MainWindow* main)
    : QuasarWindow(main, "QuasarConfig"), _styleChanged(false)
{
    _helpSource = "quasar_config.html";

    QFrame* frame = new QFrame(this);

    _areas = new QListView(frame);
    _stack = new QWidgetStack(frame);

    _display = new QFrame(_stack);
    _i18n = new QFrame(_stack);

    _changeStyle = new QCheckBox(tr("Change Style?"), _display);
    _changeStyle->setMinimumSize(_changeStyle->sizeHint());
    connect(_changeStyle, SIGNAL(toggled(bool)), SLOT(slotChangeStyle(bool)));

    _style = new ComboBox(_display);
    _style->insertItem("");
    _style->insertStringList(QStyleFactory::keys());

    _changeColor = new QCheckBox(tr("Change Color?"), _display);
    _changeColor->setMinimumSize(_changeColor->sizeHint());
    connect(_changeColor, SIGNAL(toggled(bool)), SLOT(slotChangeColor(bool)));

    _color = new QPushButton(tr("New Color"), _display);
    connect(_color, SIGNAL(clicked()), SLOT(slotPickColor()));

    _changeFont = new QCheckBox(tr("Change Font?"), _display);
    _changeFont->setMinimumSize(_changeFont->sizeHint());
    connect(_changeFont, SIGNAL(toggled(bool)), SLOT(slotChangeFont(bool)));

    _font = new QPushButton(tr("Push To Choose"), _display);
    connect(_font, SIGNAL(clicked()), SLOT(slotPickFont()));

    QGridLayout* displayGrid = new QGridLayout(_display);
    displayGrid->setSpacing(3);
    displayGrid->setMargin(3);
    displayGrid->setRowStretch(3, 1);
    displayGrid->setColStretch(2, 1);
    displayGrid->addWidget(_changeStyle, 0, 0);
    displayGrid->addWidget(_style, 0, 1);
    displayGrid->addWidget(_changeColor, 1, 0);
    displayGrid->addWidget(_color, 1, 1);
    displayGrid->addWidget(_changeFont, 2, 0);
    displayGrid->addWidget(_font, 2, 1);

    QLabel* localeLabel = new QLabel(tr("Locale:"), _i18n);
    _locale = new ComboBox(_i18n);
    _locale->setMinimumWidth(_locale->fontMetrics().width("x") * 30);
    localeLabel->setBuddy(_locale);
    connect(_locale, SIGNAL(activated(int)), SLOT(slotLocaleChange()));

    QGroupBox* samples = new QGroupBox(tr("Data Formats"), _i18n);

    QLabel* positiveLabel = new QLabel(tr("Positive"), samples);
    QLabel* negativeLabel = new QLabel(tr("Negative"), samples);

    QLabel* numLabel = new QLabel(tr("Number:"), samples);
    _numberPosSample = new QLabel(samples);
    _numberNegSample = new QLabel(samples);

    QLabel* moneyLabel = new QLabel(tr("Currency:"), samples);
    _moneyPosSample = new QLabel(samples);
    _moneyNegSample = new QLabel(samples);

    QLabel* percentLabel = new QLabel(tr("Percent:"), samples);
    _percentPosSample = new QLabel(samples);
    _percentNegSample = new QLabel(samples);

    QLabel* dateLabel = new QLabel(tr("Date:"), samples);
    _dateSample = new QLabel(samples);

    QLabel* timeLabel = new QLabel(tr("Time:"), samples);
    _timeSample = new QLabel(samples);

    QGridLayout* sampleGrid = new QGridLayout(samples);
    sampleGrid->addRowSpacing(0, samples->fontMetrics().height());
    sampleGrid->setSpacing(3);
    sampleGrid->setMargin(10);
    sampleGrid->setColStretch(1, 1);
    sampleGrid->setColStretch(2, 1);
    sampleGrid->setRowStretch(3, 1);
    sampleGrid->addRowSpacing(3, 20);
    sampleGrid->addWidget(dateLabel, 1, 0);
    sampleGrid->addWidget(_dateSample, 1, 1, AlignRight|AlignVCenter);
    sampleGrid->addWidget(timeLabel, 2, 0);
    sampleGrid->addWidget(_timeSample, 2, 1, AlignRight|AlignVCenter);
    sampleGrid->addWidget(positiveLabel, 4, 1, AlignRight|AlignVCenter);
    sampleGrid->addWidget(negativeLabel, 4, 2, AlignRight|AlignVCenter);
    sampleGrid->addWidget(numLabel, 5, 0);
    sampleGrid->addWidget(_numberPosSample, 5, 1, AlignRight|AlignVCenter);
    sampleGrid->addWidget(_numberNegSample, 5, 2, AlignRight|AlignVCenter);
    sampleGrid->addWidget(moneyLabel, 6, 0);
    sampleGrid->addWidget(_moneyPosSample, 6, 1, AlignRight|AlignVCenter);
    sampleGrid->addWidget(_moneyNegSample, 6, 2, AlignRight|AlignVCenter);
    sampleGrid->addWidget(percentLabel, 7, 0);
    sampleGrid->addWidget(_percentPosSample, 7, 1, AlignRight|AlignVCenter);
    sampleGrid->addWidget(_percentNegSample, 7, 2, AlignRight|AlignVCenter);

    QGridLayout* i18nGrid = new QGridLayout(_i18n);
    i18nGrid->setSpacing(3);
    i18nGrid->setMargin(3);
    i18nGrid->addRowSpacing(1, 20);
    i18nGrid->setRowStretch(2, 1);
    i18nGrid->setColStretch(2, 1);
    i18nGrid->addWidget(localeLabel, 0, 0);
    i18nGrid->addWidget(_locale, 0, 1, AlignLeft | AlignVCenter);
    i18nGrid->addMultiCellWidget(samples, 2, 2, 0, 2);

    _stack->addWidget(_display, 0);
    _stack->addWidget(_i18n, 1);

    _areas->addColumn(tr("Area"), -1);
    _areas->setSorting(-1);
    _areas->header()->hide();
    connect(_areas, SIGNAL(selectionChanged()), SLOT(slotAreaChange()));

    QListViewItem* user = new QListViewItem(_areas, tr("User Configuration"));

    user->setOpen(true);
    new QListViewItem(user, tr("Internationalization"));
    QListViewItem* displayArea = new QListViewItem(user, tr("Display"));

    QFrame* buttons = new QFrame(frame);
    QPushButton* ok = new QPushButton(tr("&OK"), buttons);
    QPushButton* apply = new QPushButton(tr("&Apply"), buttons);
    QPushButton* defaults = new QPushButton(tr("&Defaults"), buttons);
    QPushButton* cancel = new QPushButton(tr("&Cancel"), buttons);

    ok->setMinimumSize(defaults->sizeHint());
    apply->setMinimumSize(defaults->sizeHint());
    defaults->setMinimumSize(defaults->sizeHint());
    cancel->setMinimumSize(defaults->sizeHint());

    connect(ok, SIGNAL(clicked()), SLOT(slotOk()));
    connect(apply, SIGNAL(clicked()), SLOT(slotApply()));
    connect(defaults, SIGNAL(clicked()), SLOT(slotDefaults()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(slotCancel()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(3);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(ok, 0, 1);
    buttonGrid->addWidget(apply, 0, 2);
    buttonGrid->addWidget(defaults, 0, 3);
    buttonGrid->addWidget(cancel, 0, 4);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(1, 1);
    grid->addWidget(_areas, 0, 0);
    grid->addWidget(_stack, 0, 1);
    grid->addMultiCellWidget(buttons, 1, 1, 0, 1);

    _config.load();
    _locales = Locale::getAvailableLocales(_localesCnt);

    slotDefaults();
    _areas->setCurrentItem(displayArea);
    _stack->raiseWidget(_display);
    _changeStyle->setFocus();

    setCentralWidget(frame);
    setCaption(tr("Quasar Configuration"));
    finalize();
}
예제 #19
0
QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent, const char *name)
			: QDialog(parent, name, TRUE, Qt::WDestructiveClose)
{
  App = parent;
  setCaption(tr("Edit Qucs Properties"));

  all = new Q3VBoxLayout(this); // to provide the neccessary size
  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  Q3GridLayout *gp = new Q3GridLayout(Tab1,5,2,5,5);

  QLabel *l1 = new QLabel(tr("Font (set after reload):"), Tab1);
  gp->addWidget(l1,0,0);
  FontButton = new QPushButton(Tab1);
  connect(FontButton, SIGNAL(clicked()), SLOT(slotFontDialog()));
  gp->addWidget(FontButton,0,1);

  QLabel *l2 = new QLabel(tr("Document Background Color:"), Tab1);
  gp->addWidget(l2,1,0);
  BGColorButton = new QPushButton("      ", Tab1);
  connect(BGColorButton, SIGNAL(clicked()), SLOT(slotBGColorDialog()));
  gp->addWidget(BGColorButton,1,1);

  val200 = new QIntValidator(0, 200, this);
  QLabel *l3 = new QLabel(tr("maximum undo operations:"), Tab1);
  gp->addWidget(l3,2,0);
  undoNumEdit = new QLineEdit(Tab1);
  undoNumEdit->setValidator(val200);
  gp->addWidget(undoNumEdit,2,1);

  QLabel *l4 = new QLabel(tr("text editor:"), Tab1);
  gp->addWidget(l4,3,0);
  editorEdit = new QLineEdit(Tab1);
  gp->addWidget(editorEdit,3,1);


  t->addTab(Tab1, tr("Settings"));

  // ...........................................................
/*  QWidget *Tab2 = new QWidget(t);
  QGridLayout *gp2 = new QGridLayout(Tab2,3,2,5,5);
  Check_GridOn = new QCheckBox(tr("show Grid"),Tab2);

  QLabel *l3 = new QLabel(tr("horizontal Grid:"), Tab2);
  gp2->addWidget(l3,1,0);
  Input_GridX = new QLineEdit(Tab2);
  gp2->addWidget(Input_GridX,1,1);

  QLabel *l4 = new QLabel(tr("vertical Grid:"), Tab2);
  gp2->addWidget(l4,2,0);
  Input_GridY = new QLineEdit(Tab2);
  gp2->addWidget(Input_GridY,2,1);

  t->addTab(Tab2, tr("Grid"));
*/
  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  Q3HBox *Butts = new Q3HBox(this);
  Butts->setSpacing(5);
  Butts->setMargin(5);
  all->addWidget(Butts);

  QPushButton *OkButt = new QPushButton(tr("OK"), Butts);
  connect(OkButt, SIGNAL(clicked()), SLOT(slotOK()));
  QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts);
  connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply()));
  QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts);
  connect(CancelButt, SIGNAL(clicked()), SLOT(reject()));
  QPushButton *DefaultButt = new QPushButton(tr("Default Values"), Butts);
  connect(DefaultButt, SIGNAL(clicked()), SLOT(slotDefaultValues()));

  OkButt->setDefault(true);

  // ...........................................................
  // fill the fields with the Qucs-Properties

  Font  = QucsSettings.font;
  FontButton->setText(Font.toString());
  BGColorButton->setPaletteBackgroundColor(
	App->view->viewport()->paletteBackgroundColor());
  undoNumEdit->setText(QString::number(QucsSettings.maxUndo));
  editorEdit->setText(QucsSettings.Editor);
}
예제 #20
0
void EXIFEditDialog::slotUser2()
{
    slotApply();
    d->currItem--;
    slotItemChanged();
}
예제 #21
0
void allIPTCEditWidget::slotUser2()
{
    slotApply();
    d->currItem--;
    slotItemChanged();
}
예제 #22
0
void EXIFEditDialog::slotOk()
{
    slotApply();
    saveSettings();
    accept();
}
예제 #23
0
void ExportWebDialog::slotOk()
{
  slotApply();
  emit exportHTML( mSettings );
  accept();
}
예제 #24
0
// --------------------------------------------------------------------------
// Is called if "Ok" button is pressed.
void DiagramDialog::slotOK()
{
  slotApply();
  slotCancel();
}
예제 #25
0
DlgPrefRecord::DlgPrefRecord(QWidget* parent, UserSettingsPointer pConfig)
        : DlgPreferencePage(parent),
          m_pConfig(pConfig),
          m_bConfirmOverwrite(false),
          m_pRadioOgg(NULL),
          m_pRadioMp3(NULL),
          m_pRadioAiff(NULL),
          m_pRadioFlac(NULL),
          m_pRadioWav(NULL) {
    setupUi(this);

    // See RECORD_* #defines in defs_recording.h
    m_pRecordControl = new ControlObjectSlave(
            RECORDING_PREF_KEY, "status", this);

    m_pRadioOgg = new QRadioButton("Ogg Vorbis");
    m_pRadioMp3 = new QRadioButton(ENCODING_MP3);

    // Setting recordings path.
    QString recordingsPath = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Directory"));
    if (recordingsPath == "") {
        // Initialize recordings path in config to old default path.
        // Do it here so we show current value in UI correctly.
        QString musicDir = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
        QDir recordDir(musicDir + "/Mixxx/Recordings");
        recordingsPath = recordDir.absolutePath();
    }
    LineEditRecordings->setText(recordingsPath);

    connect(PushButtonBrowseRecordings, SIGNAL(clicked()),
            this, SLOT(slotBrowseRecordingsDir()));
    connect(LineEditRecordings, SIGNAL(returnPressed()),
            this, SLOT(slotApply()));

    connect(m_pRadioOgg, SIGNAL(clicked()),
            this, SLOT(slotApply()));
    connect(m_pRadioMp3, SIGNAL(clicked()),
            this, SLOT(slotApply()));
    horizontalLayout->addWidget(m_pRadioOgg);
    horizontalLayout->addWidget(m_pRadioMp3);

    // AIFF and WAVE are supported by default.
    m_pRadioWav = new QRadioButton(ENCODING_WAVE);
    connect(m_pRadioWav, SIGNAL(clicked()), this, SLOT(slotApply()));
    horizontalLayout->addWidget(m_pRadioWav);

    m_pRadioAiff = new QRadioButton(ENCODING_AIFF);
    connect(m_pRadioAiff, SIGNAL(clicked()), this, SLOT(slotApply()));
    horizontalLayout->addWidget(m_pRadioAiff);

#ifdef SF_FORMAT_FLAC
    m_pRadioFlac = new QRadioButton(ENCODING_FLAC);
    connect(m_pRadioFlac, SIGNAL(clicked()), this, SLOT(slotApply()));
    horizontalLayout->addWidget(m_pRadioFlac);
#endif

    // Read config and check radio button.
    QString format = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Encoding"));
    if (format == ENCODING_WAVE) {
        m_pRadioWav->setChecked(true);
    } else if (format == ENCODING_OGG) {
        m_pRadioOgg->setChecked(true);
    } else if (format == ENCODING_MP3) {
        m_pRadioMp3->setChecked(true);
    } else if (format == ENCODING_AIFF) {
        m_pRadioAiff->setChecked(true);
#ifdef SF_FORMAT_FLAC
    } else if (format == ENCODING_FLAC) {
        m_pRadioFlac->setChecked(true);
#endif
    } else {
        // Invalid, so set default and save.
        // If no config was available, set to WAVE as default.
        m_pRadioWav->setChecked(true);
        m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_WAVE));
    }

    loadMetaData();

    connect(SliderQuality, SIGNAL(valueChanged(int)),
            this, SLOT(slotSliderQuality()));
    connect(SliderQuality, SIGNAL(sliderMoved(int)),
            this, SLOT(slotSliderQuality()));
    connect(SliderQuality, SIGNAL(sliderReleased()),
            this, SLOT(slotSliderQuality()));
    connect(CheckBoxRecordCueFile, SIGNAL(stateChanged(int)),
            this, SLOT(slotEnableCueFile(int)));
    connect(comboBoxSplitting, SIGNAL(activated(int)),
            this, SLOT(slotChangeSplitSize()));

    slotApply();
    // Make sure a corrupt config file won't cause us to record constantly.
    m_pRecordControl->set(RECORD_OFF);

    comboBoxSplitting->addItem(SPLIT_650MB);
    comboBoxSplitting->addItem(SPLIT_700MB);
    comboBoxSplitting->addItem(SPLIT_1024MB);
    comboBoxSplitting->addItem(SPLIT_2048MB);
    comboBoxSplitting->addItem(SPLIT_4096MB);

    QString fileSizeStr = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "FileSize"));
    int index = comboBoxSplitting->findText(fileSizeStr);
    if (index > 0) {
        // Set file split size
        comboBoxSplitting->setCurrentIndex(index);
    }
    // Otherwise 650 MB will be default file split size.

    // Read CUEfile info
    CheckBoxRecordCueFile->setChecked(
            (bool) m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CueEnabled")).toInt());

}
예제 #26
0
void
LilyPondOptionsDialog::accept()
{
    slotApply();
    QDialog::accept();
}
예제 #27
0
void ParagraphSettingsDialog::slotOk()
{
    slotApply();
    KDialog::accept();
}
예제 #28
0
SettingsDialog::SettingsDialog(Schematic *Doc_)
    : QDialog(Doc_) 
{
    Doc = Doc_;
    setWindowTitle(tr("Edit File Properties"));

    all = new QVBoxLayout(this);
    QTabWidget *t = new QTabWidget();
    all->addWidget(t);

    // ...........................................................
    QWidget *Tab1 = new QWidget(t);
    QGridLayout *gp = new QGridLayout(Tab1);
    Tab1->setLayout(gp);

    QLabel *l2 = new QLabel(tr("Data Set:"), Tab1);
    gp->addWidget(l2,0,0);
    Input_DataSet = new QLineEdit(Tab1);
    gp->addWidget(Input_DataSet,0,1,1,1);

    QLabel *l1 = new QLabel(tr("Data Display:"));
    gp->addWidget(l1,1,0);
    Input_DataDisplay = new QLineEdit(Tab1);
    gp->addWidget(Input_DataDisplay,1,1,1,1);

    Check_OpenDpl = new QCheckBox(tr("Open data display after simulation"), Tab1);
    gp->addWidget(Check_OpenDpl,2,0,1,2);

    QLabel *l20 = new QLabel(tr("Octave Script:"), Tab1);
    gp->addWidget(l20,3,0);
    Input_Script = new QLineEdit(Tab1);
    gp->addWidget(Input_Script,3,1,1,1);

    Check_RunScript = new QCheckBox(tr("Run the script after simulation"), Tab1);
    gp->addWidget(Check_RunScript,4,0,1,2);

    t->addTab(Tab1, tr("Simulation"));

    // ...........................................................
    QWidget *Tab2 = new QWidget(t);
    QGridLayout *gp2 = new QGridLayout(Tab2);
    Check_GridOn = new QCheckBox(tr("Show Grid"), Tab2);
    gp2->addWidget(Check_GridOn,0,0,1,1);

    valExpr = new QRegExpValidator(QRegExp("[1-9]\\d{0,2}"), this);

    QLabel *l3 = new QLabel(tr("Horizontal Grid:"), Tab2);
    gp2->addWidget(l3,1,0);
    Input_GridX = new QLineEdit(Tab2);
    Input_GridX->setValidator(valExpr);
    gp2->addWidget(Input_GridX,1,1,1,1);

    QLabel *l4 = new QLabel(tr("Vertical Grid:"), Tab2);
    gp2->addWidget(l4,2,0);
    Input_GridY = new QLineEdit(Tab2);
    Input_GridY->setValidator(valExpr);
    gp2->addWidget(Input_GridY,2,1,1,1);

    t->addTab(Tab2, tr("Grid"));

    // ...........................................................
    QWidget *Tab3 = new QWidget(t);
    QGridLayout *gp3 = new QGridLayout(Tab3);
    Combo_Frame = new QComboBox(Tab3);
    Combo_Frame->insertItem(tr("No Frame"));
    Combo_Frame->insertItem(tr("DIN A5 landscape"));
    Combo_Frame->insertItem(tr("DIN A5 portrait"));
    Combo_Frame->insertItem(tr("DIN A4 landscape"));
    Combo_Frame->insertItem(tr("DIN A4 portrait"));
    Combo_Frame->insertItem(tr("DIN A3 landscape"));
    Combo_Frame->insertItem(tr("DIN A3 portrait"));
    Combo_Frame->insertItem(tr("Letter landscape"));
    Combo_Frame->insertItem(tr("Letter portrait"));
    gp3->addWidget(Combo_Frame,0,0,1,2);

    Input_Frame0 = new QTextEdit(Tab3);
    Input_Frame0->setTextFormat(Qt::PlainText);
    Input_Frame0->setWordWrapMode(QTextOption::NoWrap);
    gp3->addWidget(Input_Frame0,1,0,2,2);

    Input_Frame1 = new QLineEdit(Tab3);
    gp3->addWidget(Input_Frame1,3,0,1,2);

    Input_Frame2 = new QLineEdit(Tab3);
    gp3->addWidget(Input_Frame2,4,0);
    Input_Frame3 = new QLineEdit(Tab3);
    gp3->addWidget(Input_Frame3,4,1);

    t->addTab(Tab3, tr("Frame"));

    // ...........................................................
    // buttons on the bottom of the dialog (independent of the TabWidget)
    QHBoxLayout *Butts = new QHBoxLayout();
    Butts->setSpacing(5);
    Butts->setMargin(5);
    all->addLayout(Butts);

    QPushButton *OkButt = new QPushButton(tr("OK"));
    Butts->addWidget(OkButt);
    connect(OkButt, SIGNAL(clicked()), SLOT(slotOK()));
    QPushButton *ApplyButt = new QPushButton(tr("Apply"));
    Butts->addWidget(ApplyButt);
    connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply()));
    QPushButton *CancelButt = new QPushButton(tr("Cancel"));
    Butts->addWidget(CancelButt);
    connect(CancelButt, SIGNAL(clicked()), SLOT(reject()));

    OkButt->setDefault(true);

    // ...........................................................
    // fill the fields with the QucsDoc-Properties

    Input_DataSet->setText(Doc->DataSet);
    Input_DataDisplay->setText(Doc->DataDisplay);
    Input_Script->setText(Doc->Script);
    Check_OpenDpl->setChecked(Doc->SimOpenDpl);
    Check_RunScript->setChecked(Doc->SimRunScript);

    /*Check_GridOn->setChecked(Doc->GridOn);
    Input_GridX->setText(QString::number(Doc->GridX));
    Input_GridY->setText(QString::number(Doc->GridY));*/

    // nvdl: todo: Changes
    Check_GridOn->setChecked(QucsSettings.gridOn);
    Input_GridX->setText(QString::number(QucsSettings.grid1Spacing));
    Input_GridY->setText(QString::number(QucsSettings.grid1Spacing));

    Combo_Frame->setCurrentItem(Doc->showFrame);

    QString Text_;
    decode_String(Text_ = Doc->Frame_Text0);
    Input_Frame0->setText(Text_);
    decode_String(Text_ = Doc->Frame_Text1);
    Input_Frame1->setText(Text_);
    decode_String(Text_ = Doc->Frame_Text2);
    Input_Frame2->setText(Text_);
    decode_String(Text_ = Doc->Frame_Text3);
    Input_Frame3->setText(Text_);

    resize(250, 200);
}
예제 #29
0
void
ManageMetronomeDialog::accept()
{
    slotApply();
    QDialog::accept();
}
예제 #30
0
void KGameDialog::slotOk()
{
 slotApply();
 QDialog::accept();
}