Пример #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()]));
}
Пример #2
0
/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void mainForm::languageChange()
{
    setCaption( tr( "Browser" ) );
    QToolTip::add( mainTab, QString::null );
    dblistView->header()->setLabel( 0, tr( "Name" ) );
    dblistView->header()->setLabel( 1, tr( "Object" ) );
    dblistView->header()->setLabel( 2, tr( "Type" ) );
    dblistView->header()->setLabel( 3, tr( "Schema" ) );
    QWhatsThis::add( dblistView, tr( "This area shows the structure of your database, including all tables and indexes." ) );
    mainTab->changeTab( structure, tr( "Database Structure" ) );
    textLabel1->setText( tr( "Table:" ) );
    comboBrowseTable->clear();
    comboBrowseTable->insertItem( tr( "select" ) );
    comboBrowseTable->insertItem( tr( "users" ) );
    QToolTip::add( comboBrowseTable, tr( "Select a table to browse data" ) );
    QWhatsThis::add( comboBrowseTable, tr( "Use this list to select a table to be displayed in the database view" ) );
    buttonFind->setText( QString::null );
    QToolTip::add( buttonFind, tr( "Open or close the floating find window" ) );
    QWhatsThis::add( buttonFind, tr( "This button toggles the appearance of the Find window, used to search records in the database view" ) );
    buttonNewRecord->setText( tr( "New Record" ) );
    QToolTip::add( buttonNewRecord, tr( "Insert a new record in the current table" ) );
    QWhatsThis::add( buttonNewRecord, tr( "This button creates a new, empty record in the database" ) );
    buttonDeleteRecord->setText( tr( "Delete Record" ) );
    QToolTip::add( buttonDeleteRecord, tr( "Delete the current record" ) );
    QWhatsThis::add( buttonDeleteRecord, tr( "This button deletes the record currently selected in the database" ) );
    QToolTip::add( dataTable, QString::null );
    QWhatsThis::add( dataTable, tr( "This is the database view. You can double-click any record to edit its contents in the cell editor window." ) );
    buttonPrevious->setText( tr( "<" ) );
    QToolTip::add( buttonPrevious, tr( "Go to previous record set page" ) );
    QWhatsThis::add( buttonPrevious, tr( "This button is used to navigate to the previous set of 1000 records in the database view" ) );
    labelRecordset->setText( tr( "1000 - 2000 of 100000" ) );
    buttonNext->setText( tr( ">" ) );
    QToolTip::add( buttonNext, tr( "Go to next record set page" ) );
    QWhatsThis::add( buttonNext, tr( "This button is used to navigate to the next 1000 records set in the database view" ) );
    buttonGoto->setText( tr( "Go to:" ) );
    QToolTip::add( buttonGoto, tr( "Click here to browse the specified record " ) );
    QWhatsThis::add( buttonGoto, tr( "This button is used to navigate to the record number specied in the Go to: area." ) );
    editGoto->setText( tr( "0" ) );
    QToolTip::add( editGoto, tr( "Enter record number to browse" ) );
    QWhatsThis::add( editGoto, tr( "Type a record number in this area and click the Go to: button to display the record in the database view" ) );
    mainTab->changeTab( browser, tr( "Browse Data" ) );
    textLabel1_2->setText( tr( "SQL string:" ) );
    QToolTip::add( sqlTextEdit, tr( "Type SQL string here" ) );
    QWhatsThis::add( sqlTextEdit, tr( "Type the SQL query in this area, and press the button below to execute it. Results and error messages will be shown in the fields at the bottom of this form." ) );
    executeQueryButton->setText( tr( "Execute query" ) );
    QToolTip::add( executeQueryButton, tr( "Execute SQL query" ) );
    QWhatsThis::add( executeQueryButton, tr( "This button is used to execute the SQL query entered in the text area above." ) );
    textLabel2->setText( tr( "Error message from database engine:" ) );
    QToolTip::add( queryErrorLineEdit, tr( "Error messages" ) );
    QWhatsThis::add( queryErrorLineEdit, tr( "Messages returned from the database engine when the SQL query is executed are displayed in this area." ) );
    textLabel3->setText( tr( "Data returned:" ) );
    QToolTip::add( queryResultListView, tr( "Query generated data" ) );
    QWhatsThis::add( queryResultListView, tr( "This table displays data returned from the database engine as a result of the SQL query. You can not modify data directly on this view, only consult it." ) );
    mainTab->changeTab( query, tr( "Execute SQL" ) );
    fileNewAction->setText( tr( "New Database" ) );
    fileNewAction->setMenuText( tr( "&New Database" ) );
    fileNewAction->setToolTip( tr( "Create a new database file" ) );
    fileNewAction->setWhatsThis( tr( "This option is used to create a new database file." ) );
    fileNewAction->setAccel( tr( "Ctrl+N" ) );
    fileOpenAction->setText( tr( "Open Database" ) );
    fileOpenAction->setMenuText( tr( "&Open Database" ) );
    fileOpenAction->setToolTip( tr( "Open an existing database file" ) );
    fileOpenAction->setWhatsThis( tr( "This option is used to open an existing database file." ) );
    fileOpenAction->setAccel( tr( "Ctrl+O" ) );
    fileExitAction->setText( tr( "Exit" ) );
    fileExitAction->setMenuText( tr( "E&xit" ) );
    fileExitAction->setAccel( QString::null );
    editCopyAction->setText( tr( "Copy" ) );
    editCopyAction->setMenuText( tr( "&Copy" ) );
    editCopyAction->setWhatsThis( tr( "Copies the selected text to the clipboard" ) );
    editCopyAction->setAccel( tr( "Ctrl+C" ) );
    editPasteAction->setText( tr( "Paste" ) );
    editPasteAction->setMenuText( tr( "&Paste" ) );
    editPasteAction->setWhatsThis( tr( "Pastes text from the clipboard into the current text insertion point" ) );
    editPasteAction->setAccel( tr( "Ctrl+V" ) );
    editFindAction->setText( tr( "Find" ) );
    editFindAction->setMenuText( tr( "&Find..." ) );
    editFindAction->setAccel( tr( "F" ) );
    helpContentsAction->setText( tr( "Contents" ) );
    helpContentsAction->setMenuText( tr( "&Contents..." ) );
    helpContentsAction->setAccel( QString::null );
    helpIndexAction->setText( tr( "Index" ) );
    helpIndexAction->setMenuText( tr( "&Index..." ) );
    helpIndexAction->setAccel( QString::null );
    helpAboutAction->setText( tr( "About" ) );
    helpAboutAction->setMenuText( tr( "&About" ) );
    helpAboutAction->setAccel( QString::null );
    fileCloseAction->setText( tr( "Close Database" ) );
    fileCloseAction->setMenuText( tr( "Close Database" ) );
    newRecordAction->setText( tr( "New Record" ) );
    newRecordAction->setMenuText( tr( "New Record" ) );
    fileCompactAction->setText( tr( "Compact Database" ) );
    fileCompactAction->setMenuText( tr( "Compact Database" ) );
    fileCompactAction->setStatusTip( tr( "Compact the database file, removing space wasted by deleted records." ) );
    fileCompactAction->setWhatsThis( tr( "Compact the database file, removing space wasted by deleted records." ) );
    helpWhatsThisAction->setText( tr( "What's This?" ) );
    helpWhatsThisAction->setMenuText( tr( "What's This?" ) );
    helpWhatsThisAction->setAccel( tr( "Shift+F1" ) );
    sqlLogAction->setText( tr( "SQL Log" ) );
    sqlLogAction->setMenuText( tr( "SQL Log" ) );
    sqlLogAction->setWhatsThis( tr( "Display or hide the SQL log window, which stores all SQL commands issued by the user or the application." ) );
    fileImportCSVAction->setText( tr( "Table from CSV file" ) );
    fileImportCSVAction->setMenuText( tr( "Table from CSV file" ) );
    fileImportCSVAction->setToolTip( tr( "Open a wizard that lets you import data from a comma separated text file into a database table." ) );
    fileImportCSVAction->setWhatsThis( tr( "Open a wizard that lets you import data from a comma separated text file into a database table. CSV files can be created on most database and spreadsheet applications." ) );
    fileExportCSVAction->setText( tr( "Table as CSV file" ) );
    fileExportCSVAction->setMenuText( tr( "Table as CSV file" ) );
    fileExportCSVAction->setToolTip( tr( "Export a database table as a comma separated text file." ) );
    fileExportCSVAction->setWhatsThis( tr( "Export a database table as a comma separated text file, ready to be imported into other database or spreadsheet applications." ) );
    fileSaveAction->setText( tr( "Save Database" ) );
    fileSaveAction->setMenuText( tr( "Save Database" ) );
    fileSaveAction->setToolTip( tr( "Save changes to the database file" ) );
    fileSaveAction->setWhatsThis( tr( "This option is used to save changes to the database file." ) );
    fileRevertAction->setText( tr( "Revert Database" ) );
    fileRevertAction->setMenuText( tr( "Revert Database" ) );
    fileRevertAction->setToolTip( tr( "Revert database to last saved state" ) );
    fileRevertAction->setWhatsThis( tr( "This option is used to revert the current database file to its last saved state. All changes made since the last save operation are lost." ) );
    fileImportAction->setText( tr( "Import" ) );
    fileImportAction->setMenuText( tr( "Import" ) );
    fileExportAction->setText( tr( "Export" ) );
    fileExportAction->setMenuText( tr( "Export" ) );
    editCreateTableAction->setText( tr( "Create Table" ) );
    editCreateTableAction->setMenuText( tr( "Create Table" ) );
    editCreateTableAction->setWhatsThis( tr( "Open the Create Table wizard, where it is possible to define the name and fields for a new table in the database" ) );
    editDeleteTableAction->setText( tr( "Delete Table" ) );
    editDeleteTableAction->setMenuText( tr( "Delete Table" ) );
    editDeleteTableAction->setWhatsThis( tr( "Open the Delete Table wizard, where you can select a database table to be dropped." ) );
    editModifyTableAction->setText( tr( "Modify Table" ) );
    editModifyTableAction->setMenuText( tr( "Modify Table" ) );
    editModifyTableAction->setWhatsThis( tr( "Open the Modify Table wizard, where it is possible to rename an existing table. It is also possible to add or delete fields form a table, as well as modify field names and types." ) );
    editCreateIndexAction->setText( tr( "Create Index" ) );
    editCreateIndexAction->setMenuText( tr( "Create Index" ) );
    editCreateIndexAction->setWhatsThis( tr( "Open the Create Index wizard, where it is possible to define a new index on an existing database table." ) );
    editDeleteIndexAction->setText( tr( "Delete Index" ) );
    editDeleteIndexAction->setMenuText( tr( "Delete Index" ) );
    editDeleteIndexAction->setWhatsThis( tr( "Open the Delete Index wizard, where you can select a database index to be dropped." ) );
    fileImportSQLAction->setText( tr( "Database from SQL file" ) );
    fileImportSQLAction->setMenuText( tr( "Database from SQL file" ) );
    fileImportSQLAction->setToolTip( tr( "Import data from an .sql dump text file into a new or existing database." ) );
    fileImportSQLAction->setWhatsThis( tr( "This option lets you import data from an .sql dump text file into a new or existing database. SQL dump files can be created on most database engines, including MySQL and PostgreSQL." ) );
    fileExportSQLAction->setText( tr( "Database to SQL file" ) );
    fileExportSQLAction->setMenuText( tr( "Database to SQL file" ) );
    fileExportSQLAction->setToolTip( tr( "Export a database to a .sql dump text file." ) );
    fileExportSQLAction->setWhatsThis( tr( "This option lets you export a database to a .sql dump text file. SQL dump files contain all data necessary to recreate the database on most database engines, including MySQL and PostgreSQL." ) );
    Toolbar->setLabel( tr( "Toolbar" ) );
    menubar->findItem( 1 )->setText( tr( "&File" ) );
    menubar->findItem( 2 )->setText( tr( "Edit" ) );
    menubar->findItem( 3 )->setText( tr( "View" ) );
    menubar->findItem( 4 )->setText( tr( "Help" ) );
}
Пример #3
0
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdEntity::loadBuffer(byte *buffer, bool complete) {
	TOKEN_TABLE_START(commands)
	TOKEN_TABLE(ENTITY)
	TOKEN_TABLE(SPRITE)
	TOKEN_TABLE(X)
	TOKEN_TABLE(Y)
	TOKEN_TABLE(TEMPLATE)
	TOKEN_TABLE(NAME)
	TOKEN_TABLE(SCALABLE)
	TOKEN_TABLE(REGISTRABLE)
	TOKEN_TABLE(INTERACTIVE)
	TOKEN_TABLE(SHADOWABLE)
	TOKEN_TABLE(COLORABLE)
	TOKEN_TABLE(ACTIVE)
	TOKEN_TABLE(EVENTS)
	TOKEN_TABLE(FONT)
	TOKEN_TABLE(TALK_SPECIAL)
	TOKEN_TABLE(TALK)
	TOKEN_TABLE(CURSOR)
	TOKEN_TABLE(REGION)
	TOKEN_TABLE(BLOCKED_REGION)
	TOKEN_TABLE(EDITOR_SELECTED)
	TOKEN_TABLE(SCRIPT)
	TOKEN_TABLE(SOUND_START_TIME)
	TOKEN_TABLE(SOUND_VOLUME)
	TOKEN_TABLE(SOUND_PANNING)
	TOKEN_TABLE(SOUND)
	TOKEN_TABLE(SUBTYPE)
	TOKEN_TABLE(CAPTION)
	TOKEN_TABLE(PROPERTY)
	TOKEN_TABLE(WAYPOINTS)
	TOKEN_TABLE(IGNORE_ITEMS)
	TOKEN_TABLE(ROTABLE)
	TOKEN_TABLE(ROTATABLE)
	TOKEN_TABLE(ALPHA_COLOR)
	TOKEN_TABLE(SCALE)
	TOKEN_TABLE(RELATIVE_SCALE)
	TOKEN_TABLE(ALPHA)
	TOKEN_TABLE(EDITOR_PROPERTY)
	TOKEN_TABLE(ITEM)
	TOKEN_TABLE(WALK_TO_X)
	TOKEN_TABLE(WALK_TO_Y)
	TOKEN_TABLE(WALK_TO_DIR)
	TOKEN_TABLE(SAVE_STATE)
	TOKEN_TABLE_END

	byte *params;
	int cmd;
	BaseParser parser;

	if (complete) {
		if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ENTITY) {
			_gameRef->LOG(0, "'ENTITY' keyword expected.");
			return STATUS_FAILED;
		}
		buffer = params;
	}

	AdGame *adGame = (AdGame *)_gameRef;
	BaseSprite *spr = nullptr;
	int ar = 0, ag = 0, ab = 0, alpha = 0;
	while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
		switch (cmd) {
		case TOKEN_TEMPLATE:
			if (DID_FAIL(loadFile((char *)params))) {
				cmd = PARSERR_GENERIC;
			}
			break;

		case TOKEN_X:
			parser.scanStr((char *)params, "%d", &_posX);
			break;

		case TOKEN_Y:
			parser.scanStr((char *)params, "%d", &_posY);
			break;

		case TOKEN_SPRITE: {
			delete _sprite;
			_sprite = nullptr;
			spr = new BaseSprite(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadFile((char *)params))) {
				cmd = PARSERR_GENERIC;
			} else {
				_sprite = spr;
			}
		}
		break;

		case TOKEN_TALK: {
			spr = new BaseSprite(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) {
				cmd = PARSERR_GENERIC;
			} else {
				_talkSprites.add(spr);
			}
		}
		break;

		case TOKEN_TALK_SPECIAL: {
			spr = new BaseSprite(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) {
				cmd = PARSERR_GENERIC;
			} else {
				_talkSpritesEx.add(spr);
			}
		}
		break;

		case TOKEN_NAME:
			setName((char *)params);
			break;

		case TOKEN_ITEM:
			setItem((char *)params);
			break;

		case TOKEN_CAPTION:
			setCaption((char *)params);
			break;

		case TOKEN_FONT:
			setFont((char *)params);
			break;

		case TOKEN_SCALABLE:
			parser.scanStr((char *)params, "%b", &_zoomable);
			break;

		case TOKEN_SCALE: {
			int s;
			parser.scanStr((char *)params, "%d", &s);
			_scale = (float)s;

		}
		break;

		case TOKEN_RELATIVE_SCALE: {
			int s;
			parser.scanStr((char *)params, "%d", &s);
			_relativeScale = (float)s;

		}
		break;

		case TOKEN_ROTABLE:
		case TOKEN_ROTATABLE:
			parser.scanStr((char *)params, "%b", &_rotatable);
			break;

		case TOKEN_REGISTRABLE:
		case TOKEN_INTERACTIVE:
			parser.scanStr((char *)params, "%b", &_registrable);
			break;

		case TOKEN_SHADOWABLE:
		case TOKEN_COLORABLE:
			parser.scanStr((char *)params, "%b", &_shadowable);
			break;

		case TOKEN_ACTIVE:
			parser.scanStr((char *)params, "%b", &_active);
			break;

		case TOKEN_CURSOR:
			delete _cursor;
			_cursor = new BaseSprite(_gameRef);
			if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
				delete _cursor;
				_cursor = nullptr;
				cmd = PARSERR_GENERIC;
			}
			break;

		case TOKEN_EDITOR_SELECTED:
			parser.scanStr((char *)params, "%b", &_editorSelected);
			break;

		case TOKEN_REGION: {
			if (_region) {
				_gameRef->unregisterObject(_region);
			}
			_region = nullptr;
			BaseRegion *rgn = new BaseRegion(_gameRef);
			if (!rgn || DID_FAIL(rgn->loadBuffer(params, false))) {
				cmd = PARSERR_GENERIC;
			} else {
				_region = rgn;
				_gameRef->registerObject(_region);
			}
		}
		break;

		case TOKEN_BLOCKED_REGION: {
			delete _blockRegion;
			_blockRegion = nullptr;
			delete _currentBlockRegion;
			_currentBlockRegion = nullptr;
			BaseRegion *rgn = new BaseRegion(_gameRef);
			BaseRegion *crgn = new BaseRegion(_gameRef);
			if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) {
				delete _blockRegion;
				_blockRegion = nullptr;
				delete _currentBlockRegion;
				_currentBlockRegion = nullptr;
				cmd = PARSERR_GENERIC;
			} else {
				_blockRegion = rgn;
				_currentBlockRegion = crgn;
				_currentBlockRegion->mimic(_blockRegion);
			}
		}
		break;

		case TOKEN_WAYPOINTS: {
			delete _wptGroup;
			_wptGroup = nullptr;
			delete _currentWptGroup;
			_currentWptGroup = nullptr;
			AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef);
			AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef);
			if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) {
				delete _wptGroup;
				_wptGroup = nullptr;
				delete _currentWptGroup;
				_currentWptGroup = nullptr;
				cmd = PARSERR_GENERIC;
			} else {
				_wptGroup = wpt;
				_currentWptGroup = cwpt;
				_currentWptGroup->mimic(_wptGroup);
			}
		}
		break;

		case TOKEN_SCRIPT:
			addScript((char *)params);
			break;

		case TOKEN_SUBTYPE: {
			if (scumm_stricmp((char *)params, "sound") == 0) {
				delete _sprite;
				_sprite = nullptr;
				if (_gameRef->_editorMode) {
					spr = new BaseSprite(_gameRef, this);
					if (!spr || DID_FAIL(spr->loadFile("entity_sound.sprite"))) {
						cmd = PARSERR_GENERIC;
					} else {
						_sprite = spr;
					}
				}
				if (_gameRef->_editorMode) {
					_editorOnly = true;
				}
				_zoomable = false;
				_rotatable = false;
				_registrable = _gameRef->_editorMode;
				_shadowable = false;
				_subtype = ENTITY_SOUND;
			}
		}
		break;

		case TOKEN_SOUND:
			playSFX((char *)params, false, false);
			break;

		case TOKEN_SOUND_START_TIME:
			parser.scanStr((char *)params, "%d", &_sFXStart);
			break;

		case TOKEN_SOUND_VOLUME:
			parser.scanStr((char *)params, "%d", &_sFXVolume);
			break;

		case TOKEN_SOUND_PANNING:
			parser.scanStr((char *)params, "%b", &_autoSoundPanning);
			break;

		case TOKEN_SAVE_STATE:
			parser.scanStr((char *)params, "%b", &_saveState);
			break;

		case TOKEN_PROPERTY:
			parseProperty(params, false);
			break;

		case TOKEN_IGNORE_ITEMS:
			parser.scanStr((char *)params, "%b", &_ignoreItems);
			break;

		case TOKEN_ALPHA_COLOR:
			parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
			break;

		case TOKEN_ALPHA:
			parser.scanStr((char *)params, "%d", &alpha);
			break;

		case TOKEN_EDITOR_PROPERTY:
			parseEditorProperty(params, false);
			break;

		case TOKEN_WALK_TO_X:
			parser.scanStr((char *)params, "%d", &_walkToX);
			break;

		case TOKEN_WALK_TO_Y:
			parser.scanStr((char *)params, "%d", &_walkToY);
			break;

		case TOKEN_WALK_TO_DIR: {
			int i;
			parser.scanStr((char *)params, "%d", &i);
			if (i < 0) {
				i = 0;
			}
			if (i >= NUM_DIRECTIONS) {
				i = DI_NONE;
			}
			_walkToDir = (TDirection)i;
		}
		break;
		}
	}
	if (cmd == PARSERR_TOKENNOTFOUND) {
		_gameRef->LOG(0, "Syntax error in ENTITY definition");
		return STATUS_FAILED;
	}
	if (cmd == PARSERR_GENERIC) {
		_gameRef->LOG(0, "Error loading ENTITY definition");
		if (spr) {
			delete spr;
		}
		return STATUS_FAILED;
	}

	if (_region && _sprite) {
		_gameRef->LOG(0, "Warning: Entity '%s' has both sprite and region.", getName());
	}

	updatePosition();

	if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
		ar = ag = ab = 255;
	}
	_alphaColor = BYTETORGBA(ar, ag, ab, alpha);
	_state = STATE_READY;

	if (_item && ((AdGame *)_gameRef)->isItemTaken(_item)) {
		_active = false;
	}

	return STATUS_OK;
}
Пример #4
0
Simulation::Simulation(int argc, char* argv[], int width, int height) : BaseGfxApp(argc, argv, width, height, 50, 50, GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH, true, 851, 50)
{
	setCaption("Robot Simulation");

	//creates a basic UI panel with quit button
	GLUI_Panel *toolPanel = new GLUI_Panel(m_glui, "Control Panel");
	new GLUI_Button(m_glui, "Start", UI_START, (GLUI_Update_CB)s_gluicallback);
	new GLUI_Button(m_glui, "Pause", UI_PAUSE, (GLUI_Update_CB)s_gluicallback);
	new GLUI_Button(m_glui, "Resume", UI_RESUME, (GLUI_Update_CB)s_gluicallback);
	new GLUI_Button(m_glui, "Quit", UI_QUIT, (GLUI_Update_CB)quick_exit);
	float scale = 1.0;
	//add_spinner_to_panel( GLUI_Panel *panel, const char *name, int data_type=GLUI_SPINNER_INT, void *live_var=NULL, int id=-1, GLUI_CB callback=GLUI_CB() );
	spinner = m_glui->add_spinner_to_panel(toolPanel, "Light ActionRange(1-3):", GLUI_SPINNER_FLOAT, &scale, UI_SPIN, (GLUI_Update_CB)s_gluicallback);
	spinner->set_float_limits(1.0, 3.0, GLUI_LIMIT_CLAMP);
	spinner->set_speed(10.0f);
    
	// Initialize OpenGL
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f );
	glEnable(GL_BLEND); 
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
	glMatrixMode(GL_PROJECTION); 
	glLoadIdentity();
	glMatrixMode(GL_MODELVIEW); 
	glLoadIdentity();
	gluOrtho2D(0, m_width, 0, m_height);
	glViewport(0, 0, m_width, m_height);
	
	controlflag = true;
	// environment constructer
	//env.EnvironmentClass(area, boundary[0], boundary[1], robots, lights);
	env = new EnvironmentClass((glutGet(GLUT_WINDOW_WIDTH)*glutGet(GLUT_WINDOW_HEIGHT)), glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT), &robots, &lights);
	oldTimeSinceStart = 0;
	
	count = 0;
	
	// initial setting : 10 robots, 5 lights
	srand(time(NULL));

	int i = 0, j = 0, k = 0, l = 0;
	numRobot = 10;
	numLight = 4;
	for (i = 0; i < numRobot; i++)
	{
		float c[3] = {1.0f, 0.0f, 0.0f};							// red
		//RobotClass(pos_x, , pos_y, width, length, speed, orientation, shapeType, color, ConnectionType, id)
		
		RobotClass robot(rand()%760+20, rand()%760+20, 20 + rand() % 10, 0.0, 0,  2*M_PI*(double)rand()/RAND_MAX, Circle, c, ConnectionType(rand()%4), i);
		
		
		env->registerRobotClass(robot);
		
		/*
		cout << "Robot "<< i << endl;
		cout << "X: " << robots[i].getXPosition() << " Y: " << robots[i].getYPosition() << endl;
		cout << "Ori: " << robots[i].getOrientation() << endl;
		cout << "Radius: " << robots[i].getWidth()/2.0 << endl;
		cout << "l Wheel X:" << robots[i].getLeftWheelX() << "   l Wheel Y: " << robots[i].getLeftWheelY() << endl << endl;
		cout << "r Wheel X:" << robots[i].getRightWheelX() << "   r Wheel Y: " << robots[i].getRightWheelY() << endl << endl;
		*/
	}
	
	for (i = 0; i < numLight; i++)
	{
		float c[3] = {1.0f, 0.0f, 1.0f};							// yellow
		//Light(pos_x, , pos_y, width, length, speed, orientation, shapeType, color, actionRange)
		Light light(rand() % 760 +20, rand() % 760 + 20, 20 + rand() % 20, 0.0, 0.0, 0.0, Circle, c);
		env->registerLight(light);
	}

	
//#############################################################################################################
	cout << "---------------Avoid initial overlap start:-------------"<<endl;
	// avoid initial overlap
	int num = numRobot + numLight;
	cout << "The number of Lights and Robots: " << num <<endl; 

	//-----------------------------checks if overlap occurs robot/robot ---------------------------------------
	for(j = 0; j < robots.size(); j++){				
		for(k = 0; k < robots.size(); k++){
			if ( ((j != k) && (DetectRobot_Robot (robots[j], robots[k]))) || robots[j].detectWall(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT)) != None){
				double r = robots[j].getWidth()/2.0;
				double x = fmod(rand(),(800.0-2*r)) + r;
				double y = fmod(rand(),(800.0-2*r)) + r;
				robots[j].setNewPosition(x, y);
				k = 0;
			}
		}
	}
	
	
	//-----------------------------checks if overlap occurs light/robot ---------------------------------------
	for(j = 0; j < lights.size(); j++){				
		for(k = 0; k < lights.size(); k++){
			for( l = 0; l < robots.size(); l++){
				double r = lights[j].getWidth()/2.0;
				if ( (j != k) && DetectLights_Lights (lights[j], lights[k])){			// light overlap with other light
					lights[j].setPosition(fmod(rand(),(800.0-2*r)) + r, fmod(rand(),(800.0-2*r))+r);
					k = 0;
					l = 0;
				}else if(lights[j].detectWall(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT)) != None){	//  light overlap with wall
					lights[j].setPosition(fmod(rand(),(800.0-2*r)) + r, fmod(rand(),(800.0-2*r))+r);
					k = 0;
					l = 0;
				}else if(DetectLights_Robot (lights[j], robots[l]))			// light overlap with other light
				{
					lights[j].setPosition(fmod(rand(),(800.0-2*r)) + r, fmod(rand(),(800.0-2*r))+r);
					k = 0;
					l = 0;
				}
			}
		}
	}
}
Пример #5
0
ListEndpoints::ListEndpoints(RDMatrix *matrix,RDMatrix::Endpoint endpoint,
			     QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  QString sql;
  RDSqlQuery *q;
  QListViewItem *l;
  QString str;

  list_matrix=matrix;
  list_endpoint=endpoint;
  switch(list_endpoint) {
      case RDMatrix::Input:
	list_size=list_matrix->inputs();
	list_table="INPUTS";
	setCaption(tr("List Inputs"));
	break;

      case RDMatrix::Output:
	list_size=list_matrix->outputs();
	list_table="OUTPUTS";
	setCaption(tr("List Outputs"));
	break;
  }

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  //
  // Create Fonts
  //
  QFont bold_font=QFont("Helvetica",12,QFont::Bold);
  bold_font.setPixelSize(12);
  QFont font=QFont("Helvetica",12,QFont::Normal);
  font.setPixelSize(12);

  //
  // Endpoints List Box
  //
  list_list_view=new QListView(this,"list_box");
  list_list_view->
    setGeometry(10,24,sizeHint().width()-20,sizeHint().height()-94);
  QLabel *label=
    new QLabel(list_list_view,list_table,this,"list_list_view_label");
  label->setFont(bold_font);
  label->setGeometry(14,5,85,19);
  list_list_view->setAllColumnsShowFocus(true);
  list_list_view->setItemMargin(5);
  switch(list_endpoint) {
      case RDMatrix::Input:
	list_list_view->addColumn(tr("INPUT"));
	break;

      case RDMatrix::Output:
	list_list_view->addColumn(tr("OUTPUT"));
	break;
  }
  list_list_view->setColumnAlignment(0,Qt::AlignHCenter);
  list_list_view->addColumn(tr("LABEL"));
  list_list_view->setColumnAlignment(1,Qt::AlignLeft);
  switch(matrix->type()) {
    case RDMatrix::Unity4000:
      list_readonly=false;
      if(list_endpoint==RDMatrix::Input) {
	list_list_view->addColumn(tr("SOURCE"));
	list_list_view->setColumnAlignment(2,Qt::AlignHCenter);
	list_list_view->addColumn(tr("MODE"));
	list_list_view->setColumnAlignment(3,Qt::AlignHCenter);
      }
      break;
      
    case RDMatrix::LogitekVguest:
      list_readonly=false;
      list_list_view->addColumn(tr("ENGINE (Hex)"));
      list_list_view->setColumnAlignment(2,Qt::AlignHCenter);	
      list_list_view->addColumn(tr("DEVICE (Hex)"));
      list_list_view->setColumnAlignment(2,Qt::AlignHCenter);	
      break;
      
    case RDMatrix::StarGuideIII:
      list_readonly=false;
      if(list_endpoint==RDMatrix::Input) {
	list_list_view->addColumn(tr("PROVIDER ID"));
	list_list_view->setColumnAlignment(2,Qt::AlignHCenter);
	list_list_view->addColumn(tr("SERVICE ID"));
	list_list_view->setColumnAlignment(3,Qt::AlignHCenter);
	list_list_view->addColumn(tr("MODE"));
	list_list_view->setColumnAlignment(4,Qt::AlignHCenter);
      }
      break;
      
    case RDMatrix::LiveWireLwrpAudio:
      list_readonly=true;
      list_list_view->addColumn(tr("NODE"));
      list_list_view->setColumnAlignment(2,Qt::AlignHCenter);
      list_list_view->addColumn(tr("#"));
      list_list_view->setColumnAlignment(3,Qt::AlignHCenter);
      break;

    case RDMatrix::SasUsi:
      list_readonly=true;
      break;

    default:
      list_readonly=false;
      break;
  }
  if(!list_readonly) {
    connect(list_list_view,
	    SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
	    this,
	    SLOT(doubleClickedData(QListViewItem *,const QPoint &,int)));
  }
Пример #6
0
EditReport::EditReport(QString rptname,QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  QString sql;
  RDSqlQuery *q;
  QString str;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  edit_report=new RDReport(rptname);
  str=QString(tr("Edit Report"));
  setCaption(QString().sprintf("%s - %s",(const char *)str,
			       (const char *)rptname));

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);
  QFont check_font=QFont("Helvetica",12,QFont::Normal);
  check_font.setPixelSize(12);
  QFont section_font=QFont("Helvetica",14,QFont::Bold);
  section_font.setPixelSize(14);

  //
  // Text Validator
  //
  RDTextValidator *validator=new RDTextValidator(this,"validator");

  //
  // Report Description
  //
  edit_description_edit=new QLineEdit(this,"edit_description_edit");
  edit_description_edit->setGeometry(170,10,sizeHint().width()-180,19);
  edit_description_edit->setMaxLength(64);
  QLabel *label=new QLabel(edit_description_edit,tr("&Report Description:"),
			   this,"edit_description_label");
  label->setGeometry(10,10,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Export Filter Type
  //
  edit_filter_box=new QComboBox(this,"edit_filter_box");
  edit_filter_box->setGeometry(170,31,sizeHint().width()-180,19);
  for(int i=0;i<(int)RDReport::LastFilter;i++) {
    edit_filter_box->
      insertItem(RDReport::filterText((RDReport::ExportFilter)i));
  }
  label=new QLabel(edit_description_edit,tr("Export &Filter:"),this,
		   "edit_filter_label");
  label->setGeometry(10,31,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Station ID
  //
  edit_stationid_edit=new QLineEdit(this,"edit_stationid_edit");
  edit_stationid_edit->setGeometry(170,52,180,19);
  edit_stationid_edit->setMaxLength(16);
  edit_stationid_edit->setValidator(validator);
  label=new QLabel(edit_stationid_edit,
		   tr("Station ID:"),this,
		   "edit_stationid_label");
  label->setGeometry(10,52,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Cart Number Parameters
  //
  label=new QLabel(tr("Cart Number Parameters:"),this,"edit_cartdigits_label");
  label->setGeometry(10,73,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  
  edit_cartzeros_box=new QCheckBox(this,"edit_cartzeros_box");
  edit_cartzeros_box->setGeometry(170,75,15,15);
  connect(edit_cartzeros_box,SIGNAL(toggled(bool)),
	  this,SLOT(leadingZerosToggled(bool)));
  label=new QLabel(edit_cartzeros_box,
		   tr("Use Leading Zeros"),this,
		   "edit_cartzeros_label");
  label->setGeometry(187,73,120,19);
  label->setFont(check_font);
  label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);

  edit_cartdigits_spin=new QSpinBox(this,"edit_cartdigits_spin");
  edit_cartdigits_spin->setGeometry(350,73,40,19);
  edit_cartdigits_spin->setRange(1,6);
  edit_cartdigits_label=new QLabel(edit_cartdigits_spin,
				   tr("Digits:"),this,
				   "edit_cartdigits_label");
  edit_cartdigits_label->setGeometry(300,73,45,19);
  edit_cartdigits_label->setFont(check_font);
  edit_cartdigits_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Station Type
  //
  edit_stationtype_box=new QComboBox(this,"edit_stationtype_box");
  edit_stationtype_box->setGeometry(170,94,70,19);
  for(int i=0;i<RDReport::TypeLast;i++) {
    edit_stationtype_box->
      insertItem(RDReport::stationTypeText((RDReport::StationType)i));
  }
  label=new QLabel(edit_stationtype_box,tr("Station Type:"),
		   this,"edit_stationtype_label");
  label->setGeometry(10,94,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Lines Per Page
  //
  edit_linesperpage_spin=new QSpinBox(this,"edit_linesperpage_spin");
  edit_linesperpage_spin->setGeometry(360,94,50,19);
  edit_linesperpage_spin->setRange(10,200);
  label=new QLabel(edit_linesperpage_spin,tr("Lines per Page:"),
		   this,"edit_stationid_label");
  label->setGeometry(255,94,100,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  edit_linesperpage_spin->hide();
  label->hide();

  //
  // Service Name
  //
  edit_servicename_edit=new QLineEdit(this,"edit_servicename_edit");
  edit_servicename_edit->setGeometry(170,115,sizeHint().width()-180,19);
  edit_servicename_edit->setMaxLength(64);
  label=new QLabel(edit_servicename_edit,tr("Ser&vice Name:"),
		   this,"edit_servicename_label");
  label->setGeometry(10,115,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Station Format
  //
  edit_stationformat_edit=new QLineEdit(this,"edit_stationformat_edit");
  edit_stationformat_edit->setGeometry(170,136,sizeHint().width()-180,19);
  edit_stationformat_edit->setMaxLength(64);
  label=new QLabel(edit_stationformat_edit,tr("Station &Format:"),
		   this,"edit_stationformat_label");
  label->setGeometry(10,136,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Linux Export Path
  //
  edit_path_edit=new QLineEdit(this,"edit_path_edit");
  edit_path_edit->setGeometry(170,157,sizeHint().width()-180,19);
  edit_path_edit->setMaxLength(255);
  edit_path_edit->setValidator(validator);
  label=new QLabel(edit_path_edit,
		   tr("Linux Export Path:"),this,
		   "edit_path_label");
  label->setGeometry(10,157,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Windows Export Path
  //
  edit_winpath_edit=new QLineEdit(this,"edit_winpath_edit");
  edit_winpath_edit->setGeometry(170,178,sizeHint().width()-180,19);
  edit_winpath_edit->setMaxLength(255);
  label=new QLabel(edit_winpath_edit,
		   tr("Windows Export Path:"),this,
		   "edit_winpath_label");
  label->setGeometry(10,178,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Type Selectors
  //
  label=new QLabel(tr("Export Event Types:"),this,"export_types_label");
  label->setGeometry(10,199,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  edit_traffic_box=new QCheckBox(this,"edit_traffic_box");
  edit_traffic_box->setGeometry(170,200,15,15);
  edit_traffic_label=new QLabel(tr("Traffic"),this,"export_traffic_label");
  edit_traffic_label->setGeometry(187,199,80,19);
  edit_traffic_label->setFont(check_font);
  edit_traffic_label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);
  
  edit_music_box=new QCheckBox(this,"edit_music_box");
  edit_music_box->setGeometry(270,201,15,15);
  edit_music_label=new QLabel(tr("Music"),this,"export_music_label");
  edit_music_label->setGeometry(287,199,80,19);
  edit_music_label->setFont(check_font);
  edit_music_label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);

  edit_generic_box=new QCheckBox(this,"edit_generic_box");
  edit_generic_box->setGeometry(370,201,15,15);
  label=new QLabel(tr("All"),this,"export_generic_label");
  label->setGeometry(387,199,80,19);
  label->setFont(check_font);
  label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);
  connect(edit_generic_box,SIGNAL(toggled(bool)),
	  this,SLOT(genericEventsToggledData(bool)));

  //
  // Force Event Source Selectors
  //
  label=new QLabel(tr("Export Events From:"),
		   this,"export_forcetypes_label");
  label->setGeometry(10,220,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  edit_forcetraffic_box=new QCheckBox(this,"edit_forcetraffic_box");
  edit_forcetraffic_box->setGeometry(170,222,15,15);
  label=new QLabel(tr("Traffic Log"),this,"export_forcetraffic_label");
  label->setGeometry(187,220,80,19);
  label->setFont(check_font);
  label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);
  
  edit_forcemusic_box=new QCheckBox(this,"edit_forcemusic_box");
  edit_forcemusic_box->setGeometry(270,222,15,15);
  label=new QLabel(tr("Music Log"),this,"export_forcemusic_label");
  label->setGeometry(287,220,80,19);
  label->setFont(check_font);
  label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);

  //
  // Include Only On Air Events
  //
  edit_onairflag_box=new QComboBox(this,"edit_onairflag_box");
  edit_onairflag_box->setGeometry(170,241,60,19);
  edit_onairflag_box->insertItem(tr("No"));
  edit_onairflag_box->insertItem(tr("Yes"));
  label=new QLabel(edit_onairflag_box,tr("Include Only OnAir Events:"),
		   this,"edit_onairflag_label");
  label->setGeometry(10,241,155,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Service Selector
  //
  edit_service_sel=new RDListSelector(this,"edit_service_sel");
  edit_service_sel->
    setGeometry((sizeHint().width()-edit_service_sel->sizeHint().width())/2,
		268,edit_service_sel->sizeHint().width(),
		edit_service_sel->sizeHint().height());
  edit_service_sel->sourceSetLabel(tr("Available Services"));
  edit_service_sel->destSetLabel(tr("Source Services"));
  
  //
  // Station Selector
  //
  edit_station_sel=new RDListSelector(this,"edit_station_sel");
  edit_station_sel->
    setGeometry((sizeHint().width()-edit_station_sel->sizeHint().width())/2,
		378,edit_station_sel->sizeHint().width(),
		edit_station_sel->sizeHint().height());
  edit_station_sel->sourceSetLabel(tr("Available Hosts"));
  edit_station_sel->destSetLabel(tr("Source Hosts"));

  //
  //  Ok Button
  //
  QPushButton *button=new QPushButton(this,"ok_button");
  button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  button->setDefault(true);
  button->setFont(font);
  button->setText(tr("&OK"));
  connect(button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  //  Cancel Button
  //
  button=new QPushButton(this,"cancel_button");
  button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  button->setFont(font);
  button->setText(tr("&Cancel"));
  connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Populate Fields
  //
  edit_description_edit->setText(edit_report->description());
  edit_filter_box->setCurrentItem((int)edit_report->filter());
  edit_stationid_edit->setText(edit_report->stationId());
  edit_cartzeros_box->setChecked(edit_report->useLeadingZeros());
  leadingZerosToggled(edit_cartzeros_box->isChecked());
  edit_cartdigits_spin->setValue(edit_report->cartDigits());
  edit_stationtype_box->setCurrentItem((int)edit_report->stationType());
  edit_servicename_edit->setText(edit_report->serviceName());
  edit_stationformat_edit->setText(edit_report->stationFormat());
  edit_linesperpage_spin->setValue(edit_report->linesPerPage());
  edit_path_edit->setText(edit_report->exportPath(RDReport::Linux));
  edit_winpath_edit->setText(edit_report->exportPath(RDReport::Windows));
  edit_traffic_box->
    setChecked(edit_report->exportTypeEnabled(RDReport::Traffic));
  edit_music_box->
    setChecked(edit_report->exportTypeEnabled(RDReport::Music));
  edit_generic_box->
    setChecked(edit_report->exportTypeEnabled(RDReport::Generic));
  edit_forcetraffic_box->
    setChecked(edit_report->exportTypeForced(RDReport::Traffic));
  edit_forcemusic_box->
    setChecked(edit_report->exportTypeForced(RDReport::Music));
  genericEventsToggledData(edit_generic_box->isChecked());
  if(edit_report->filterOnairFlag()) {
    edit_onairflag_box->setCurrentItem(1);
  }
  else {
    edit_onairflag_box->setCurrentItem(0);
  }

  sql=QString().sprintf("select SERVICE_NAME from REPORT_SERVICES \
                         where REPORT_NAME=\"%s\"",
			(const char *)edit_report->name());
  q=new RDSqlQuery(sql);
  while(q->next()) {
    edit_service_sel->destInsertItem(q->value(0).toString());
  }
  delete q;

  sql=QString().sprintf("select NAME from SERVICES");
  q=new RDSqlQuery(sql);
  while(q->next()) {
    if(edit_service_sel->destFindItem(q->value(0).toString())==0) {
      edit_service_sel->sourceInsertItem(q->value(0).toString());
    }
  }
  delete q;

  sql=QString().sprintf("select STATION_NAME from REPORT_STATIONS \
                         where REPORT_NAME=\"%s\"",
			(const char *)edit_report->name());
  q=new RDSqlQuery(sql);
  while(q->next()) {
    edit_station_sel->destInsertItem(q->value(0).toString());
  }
  delete q;

  sql=QString().sprintf("select NAME from STATIONS");
  q=new RDSqlQuery(sql);
  while(q->next()) {
    if(edit_station_sel->destFindItem(q->value(0).toString())==0) {
      edit_station_sel->sourceInsertItem(q->value(0).toString());
    }
  }
  delete q;
}
Пример #7
0
EditUserPerms::EditUserPerms(RDUser *user,QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  QString sql;
  RDSqlQuery *q;

  user_user=user;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  setCaption(tr("User: "******"Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Groups Selector
  //
  user_host_sel=new RDListSelector(this,"user_host_sel");
  user_host_sel->sourceSetLabel(tr("Available Groups"));
  user_host_sel->destSetLabel(tr("Enabled Groups"));
  user_host_sel->setGeometry(10,10,380,130);

  //
  //  Ok Button
  //
  QPushButton *ok_button=new QPushButton(this,"ok_button");
  ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  ok_button->setDefault(true);
  ok_button->setFont(font);
  ok_button->setText(tr("&OK"));
  connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  //  Cancel Button
  //
  QPushButton *cancel_button=new QPushButton(this,"cancel_button");
  cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  cancel_button->setFont(font);
  cancel_button->setText(tr("&Cancel"));
  connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Populate Fields
  //
  sql=QString().sprintf("select GROUP_NAME from USER_PERMS \
                         where USER_NAME=\"%s\"",
			(const char *)user_user->name());
  q=new RDSqlQuery(sql);
  while(q->next()) {
    user_host_sel->destInsertItem(q->value(0).toString());
  }
  delete q;

  sql=QString().sprintf("select NAME from GROUPS");
  q=new RDSqlQuery(sql);
  while(q->next()) {
    if(user_host_sel->destFindItem(q->value(0).toString())==0) {
      user_host_sel->sourceInsertItem(q->value(0).toString());
    }
  }
  delete q;
}
Пример #8
0
Scanner::Scanner (QString n, DBIndex *i) : QTabDialog (0, 0, FALSE)
{
  chartIndex = i;
  scannerName = n;
  
  QString s = "Qtstalker Scanner";
  s.append(": ");
  s.append(scannerName);
  setCaption (s);

  QWidget *w = new QWidget(this);
  
  QVBoxLayout *vbox = new QVBoxLayout(w);
  vbox->setMargin(5);
  vbox->setSpacing(5);
  
  QHGroupBox *gbox = new QHGroupBox(tr("Symbol Selection"), w);  
  vbox->addWidget(gbox);

  allSymbols = new QCheckBox(tr("All symbols"), gbox);
  connect(allSymbols, SIGNAL(toggled(bool)), this, SLOT(allSymbolsToggled(bool)));

  fileButton = new QPushButton(tr("0 Symbols"), gbox);
  connect(fileButton, SIGNAL(clicked()), this, SLOT(getSymbols()));

  basePath = new QComboBox(gbox);
  basePath->insertItem(tr("Chart"), -1);
  basePath->insertItem(tr("Group"), -1);

  QGridLayout *grid = new QGridLayout(vbox, 1, 2);
  grid->setColStretch(1, 1);

  QLabel *label = new QLabel(tr("Bar Length"), w);
  grid->addWidget(label, 0, 0);

  BarData bd(scannerName);
  period = new QComboBox(w);
  bd.getBarLengthList(barLengthList);
  period->insertStringList(barLengthList, -1);
  period->setCurrentText("Daily");
  grid->addWidget(period, 0, 1);

  label = new QLabel(tr("Bars"), w);
  grid->addWidget(label, 1, 0);

  bars = new QSpinBox(1, 99999999, 1, w);
  bars->setValue(100);
  grid->addWidget(bars, 1, 1);
  
  list = new FormulaEdit(w, FormulaEdit::Logic);
  vbox->addWidget(list);
  
  setDefaultButton(tr("&Scan"));
  connect(this, SIGNAL(defaultButtonPressed()), this, SLOT(scan()));
  
  setApplyButton(tr("&Apply"));  
  connect(this, SIGNAL(applyButtonPressed()), this, SLOT(saveRule()));
  
  setCancelButton(tr("&Cancel"));  
  connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(exitDialog()));
  
  setOkButton(QString::null);  
  
  setHelpButton();
  QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(slotHelp()));
  
  addTab(w, tr("Parms"));

  loadRule();
}
SelectOperation::SelectOperation(QString showcode,QString showtitle,
		   QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  select_showcode=showcode;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumWidth(sizeHint().width());
  setMaximumHeight(sizeHint().height());

  setCaption("Call Manager - Select Operation");

  //
  // Create Fonts
  //
  QFont label_font=QFont("Helvetica",14,QFont::Bold);
  label_font.setPixelSize(14);
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Show Label
  //
  QLabel *label=new QLabel(showtitle,this,"show_label");
  label->setGeometry(10,5,sizeHint().width()-20,20);
  label->setFont(label_font);
  label->setAlignment(Qt::AlignCenter);

  //
  //  Actions Button
  //
  QPushButton *button=new QPushButton(this,"actions_button");
  button->setGeometry(10,32,100,50);
  button->setFont(font);
  button->setText("Configure \n&Actions");
  connect(button,SIGNAL(clicked()),this,SLOT(actionsData()));

  //
  //  Details Button
  //
  button=new QPushButton(this,"details_button");
  button->setGeometry(120,32,100,50);
  button->setFont(font);
  button->setText("View Call\n&Details");
  connect(button,SIGNAL(clicked()),this,SLOT(detailsData()));

  //
  //  Contests Button
  //
  button=new QPushButton(this,"contests_button");
  button->setGeometry(65,92,100,50);
  button->setFont(font);
  button->setText("Manage\n&Contests");
  connect(button,SIGNAL(clicked()),this,SLOT(contestsData()));

  //
  //  Close Button
  //
  button=new QPushButton(this,"close_button");
  button->setGeometry(10,sizeHint().height()-60,sizeHint().width()-20,50);
  button->setFont(font);
  button->setText("&Close");
  button->setDefault(true);
  connect(button,SIGNAL(clicked()),this,SLOT(closeData()));
}
Пример #10
0
popupPublic::popupPublic(QWidget *parent, const char *name,QString sfile,bool filemode,KShortcut goDefaultKey):
KDialogBase( Plain, i18n("Select Public Key"), Details | Ok | Cancel, Ok, parent, name,true)
{

	QWidget *page = plainPage();
	QVBoxLayout *vbox=new QVBoxLayout(page,0,spacingHint());
	vbox->setAutoAdd(true);

	setButtonText(KDialogBase::Details,i18n("Options"));

        if (KGpgSettings::allowCustomEncryptionOptions())
                customOptions=KGpgSettings::customEncryptionOptions();

        KIconLoader *loader = KGlobal::iconLoader();

        keyPair=loader->loadIcon("kgpg_key2",KIcon::Small,20);
        keySingle=loader->loadIcon("kgpg_key1",KIcon::Small,20);
	keyGroup=loader->loadIcon("kgpg_key3",KIcon::Small,20);

        if (filemode) setCaption(i18n("Select Public Key for %1").arg(sfile));
        fmode=filemode;

	QHButtonGroup *hBar=new QHButtonGroup(page);
	//hBar->setFrameStyle(QFrame::NoFrame);
	hBar->setMargin(0);

#if KDE_IS_VERSION( 3, 2, 90 )
	QToolButton *clearSearch = new QToolButton(hBar);
	clearSearch->setTextLabel(i18n("Clear Search"), true);
	clearSearch->setIconSet(SmallIconSet(QApplication::reverseLayout() ? "clear_left"
                                            : "locationbar_erase"));
	(void) new QLabel(i18n("Search: "),hBar);
	KListViewSearchLine* listViewSearch = new KListViewSearchLine(hBar);
	connect(clearSearch, SIGNAL(pressed()), listViewSearch, SLOT(clear()));
#endif

        keysList = new KListView( page );
	 keysList->addColumn(i18n("Name"));
	 keysList->addColumn(i18n("Email"));
	 keysList->addColumn(i18n("ID"));

#if KDE_IS_VERSION( 3, 2, 90 )
	 listViewSearch->setListView(keysList);
#endif

        keysList->setRootIsDecorated(false);
        page->setMinimumSize(540,200);
        keysList->setShowSortIndicator(true);
        keysList->setFullWidth(true);
	keysList->setAllColumnsShowFocus(true);
        keysList->setSelectionModeExt(KListView::Extended);
	keysList->setColumnWidthMode(0,QListView::Manual);
	keysList->setColumnWidthMode(1,QListView::Manual);
	keysList->setColumnWidth(0,210);
	keysList->setColumnWidth(1,210);

        boutonboxoptions=new QButtonGroup(5,Qt::Vertical ,page,0);

	KActionCollection *actcol=new KActionCollection(this);
	(void) new KAction(i18n("&Go to Default Key"),goDefaultKey, this, SLOT(slotGotoDefaultKey()),actcol,"go_default_key");


        CBarmor=new QCheckBox(i18n("ASCII armored encryption"),boutonboxoptions);
        CBuntrusted=new QCheckBox(i18n("Allow encryption with untrusted keys"),boutonboxoptions);
        CBhideid=new QCheckBox(i18n("Hide user id"),boutonboxoptions);
        setDetailsWidget(boutonboxoptions);
        QWhatsThis::add
                (keysList,i18n("<b>Public keys list</b>: select the key that will be used for encryption."));
        QWhatsThis::add
                (CBarmor,i18n("<b>ASCII encryption</b>: makes it possible to open the encrypted file/message in a text editor"));
        QWhatsThis::add
                (CBhideid,i18n("<b>Hide user ID</b>: Do not put the keyid into encrypted packets. This option hides the receiver "
                                "of the message and is a countermeasure against traffic analysis. It may slow down the decryption process because "
                                "all available secret keys are tried."));
        QWhatsThis::add
                (CBuntrusted,i18n("<b>Allow encryption with untrusted keys</b>: when you import a public key, it is usually "
                                  "marked as untrusted and you cannot use it unless you sign it in order to make it 'trusted'. Checking this "
                                  "box enables you to use any key, even if it has not be signed."));

        if (filemode) {
		QWidget *parentBox=new QWidget(boutonboxoptions);
		QHBoxLayout *shredBox=new QHBoxLayout(parentBox,0);
		//shredBox->setFrameStyle(QFrame::NoFrame);
		//shredBox->setMargin(0);
	       CBshred=new QCheckBox(i18n("Shred source file"),parentBox);
                QWhatsThis::add
                        (CBshred,i18n("<b>Shred source file</b>: permanently remove source file. No recovery will be possible"));

		QString shredWhatsThis = i18n( "<qt><b>Shred source file:</b><br /><p>Checking this option will shred (overwrite several times before erasing) the files you have encrypted. This way, it is almost impossible that the source file is recovered.</p><p><b>But you must be aware that this is not secure</b> on all file systems, and that parts of the file may have been saved in a temporary file or in the spooler of your printer if you previously opened it in an editor or tried to print it. Only works on files (not on folders).</p></qt>");
		  KActiveLabel *warn= new KActiveLabel( i18n("<a href=\"whatsthis:%1\">Read this before using shredding</a>").arg(shredWhatsThis),parentBox );
		  shredBox->addWidget(CBshred);
		  shredBox->addWidget(warn);
        }

	        CBsymmetric=new QCheckBox(i18n("Symmetrical encryption"),boutonboxoptions);
                QWhatsThis::add
                        (CBsymmetric,i18n("<b>Symmetrical encryption</b>: encryption does not use keys. You just need to give a password "
                                          "to encrypt/decrypt the file"));
                QObject::connect(CBsymmetric,SIGNAL(toggled(bool)),this,SLOT(isSymetric(bool)));

	CBarmor->setChecked( KGpgSettings::asciiArmor() );
	CBuntrusted->setChecked( KGpgSettings::allowUntrustedKeys() );
	CBhideid->setChecked( KGpgSettings::hideUserID() );
	if (filemode) CBshred->setChecked( KGpgSettings::shredSource() );

        if (KGpgSettings::allowCustomEncryptionOptions()) {
                QHButtonGroup *bGroup = new QHButtonGroup(page);
                //bGroup->setFrameStyle(QFrame::NoFrame);
                (void) new QLabel(i18n("Custom option:"),bGroup);
                KLineEdit *optiontxt=new KLineEdit(bGroup);
                optiontxt->setText(customOptions);
                QWhatsThis::add
                        (optiontxt,i18n("<b>Custom option</b>: for experienced users only, allows you to enter a gpg command line option, like: '--armor'"));
                QObject::connect(optiontxt,SIGNAL(textChanged ( const QString & )),this,SLOT(customOpts(const QString & )));
        }
        QObject::connect(keysList,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),this,SLOT(slotOk()));
//	QObject::connect(this,SIGNAL(okClicked()),this,SLOT(crypte()));
        QObject::connect(CBuntrusted,SIGNAL(toggled(bool)),this,SLOT(refresh(bool)));

        char line[200]="\0";
        FILE *fp2;
        seclist=QString::null;

        fp2 = popen("gpg --no-secmem-warning --no-tty --with-colon --list-secret-keys ", "r");
        while ( fgets( line, sizeof(line), fp2))
        {
            QString readLine=QString::fromUtf8(line);
            if (readLine.startsWith("sec")) seclist+=", 0x"+readLine.section(":",4,4).right(8);
        }
        pclose(fp2);

        trusted=CBuntrusted->isChecked();

        refreshkeys();
	setMinimumSize(550,200);
	updateGeometry();
	keysList->setFocus();
	show();
}
Пример #11
0
KMSpecialPrinterDlg::KMSpecialPrinterDlg(QWidget *parent, const char *name) : KDialogBase(parent, name, true, QString::null, Ok | Cancel, Ok)
{
    setCaption(i18n("Add Special Printer"));

    QWidget *dummy = new QWidget(this);
    setMainWidget(dummy);

    // widget creation
    m_name = new QLineEdit(dummy);
    connect(m_name, SIGNAL(textChanged(const QString &)), this, SLOT(slotTextChanged(const QString &)));
    m_description = new QLineEdit(dummy);
    m_location = new QLineEdit(dummy);
    QLabel *m_namelabel = new QLabel(i18n("&Name:"), dummy);
    QLabel *m_desclabel = new QLabel(i18n("&Description:"), dummy);
    QLabel *m_loclabel = new QLabel(i18n("&Location:"), dummy);
    m_namelabel->setBuddy(m_name);
    m_desclabel->setBuddy(m_description);
    m_loclabel->setBuddy(m_location);

    KSeparator *sep = new KSeparator(KSeparator::HLine, dummy);

    sep->setFixedHeight(10);
    QGroupBox *m_gb = new QGroupBox(1, Qt::Horizontal, i18n("Command &Settings"), dummy);
    m_command = new KXmlCommandSelector(true, m_gb, "CommandSelector", this);

    QGroupBox *m_outfile_gb = new QGroupBox(0, Qt::Horizontal, i18n("Outp&ut File"), dummy);

    m_usefile = new QCheckBox(i18n("&Enable output file"), m_outfile_gb);

    m_mimetype = new QComboBox(m_outfile_gb);
    KMimeType::List list = KMimeType::allMimeTypes();
    for(QValueList< KMimeType::Ptr >::ConstIterator it = list.begin(); it != list.end(); ++it)
    {
        QString mimetype = (*it)->name();
        m_mimelist << mimetype;
    }
    m_mimelist.sort();
    m_mimetype->insertStringList(m_mimelist);

    QLabel *m_mimetypelabel = new QLabel(i18n("&Format:"), m_outfile_gb);
    m_mimetypelabel->setBuddy(m_mimetype);

    m_extension = new QLineEdit(m_outfile_gb);

    QLabel *m_extensionlabel = new QLabel(i18n("Filename e&xtension:"), m_outfile_gb);
    m_extensionlabel->setBuddy(m_extension);

    m_icon = new KIconButton(dummy);
    m_icon->setIcon("fileprint");
    m_icon->setFixedSize(QSize(48, 48));

    connect(m_usefile, SIGNAL(toggled(bool)), m_mimetype, SLOT(setEnabled(bool)));
    connect(m_usefile, SIGNAL(toggled(bool)), m_extension, SLOT(setEnabled(bool)));
    connect(m_usefile, SIGNAL(toggled(bool)), m_mimetypelabel, SLOT(setEnabled(bool)));
    connect(m_usefile, SIGNAL(toggled(bool)), m_extensionlabel, SLOT(setEnabled(bool)));
    m_mimetypelabel->setEnabled(false);
    m_mimetype->setEnabled(false);
    m_extensionlabel->setEnabled(false);
    m_extension->setEnabled(false);

    QWhatsThis::add(m_usefile, i18n("<p>The command will use an output file. If checked, make sure the "
                                    "command contains an output tag.</p>"));
    QWhatsThis::add(m_command, i18n("<p>The command to execute when printing on this special printer. Either enter "
                                    "the command to execute directly, or associate/create a command object with/for "
                                    "this special printer. The command object is the preferred method as it provides "
                                    "support for advanced settings like mime type checking, configurable options and "
                                    "requirement list (the plain command is only provided for backward compatibility). "
                                    "When using a plain command, the following tags are recognized:</p>"
                                    "<ul><li><b>%in</b>: the input file (required).</li>"
                                    "<li><b>%out</b>: the output file (required if using an output file).</li>"
                                    "<li><b>%psl</b>: the paper size in lower case.</li>"
                                    "<li><b>%psu</b>: the paper size with the first letter in upper case.</li></ul>"));
    QString mimetypeWhatsThis = i18n("<p>The default mimetype for the output file (e.g. application/postscript).</p>");
    QWhatsThis::add(m_mimetypelabel, mimetypeWhatsThis);
    QWhatsThis::add(m_mimetype, mimetypeWhatsThis);
    QString extensionWhatsThis = i18n("<p>The default extension for the output file (e.g. ps, pdf, ps.gz).</p>");
    QWhatsThis::add(m_extensionlabel, extensionWhatsThis);
    QWhatsThis::add(m_extension, extensionWhatsThis);

    // layout creation
    QVBoxLayout *l0 = new QVBoxLayout(dummy, 0, 10);
    QGridLayout *l1 = new QGridLayout(0, 3, 3, 0, 5);
    l0->addLayout(l1);
    l1->setColStretch(2, 1);
    l1->addColSpacing(0, 60);
    l1->addMultiCellWidget(m_icon, 0, 2, 0, 0, Qt::AlignCenter);
    l1->addWidget(m_namelabel, 0, 1);
    l1->addWidget(m_desclabel, 1, 1);
    l1->addWidget(m_loclabel, 2, 1);
    l1->addWidget(m_name, 0, 2);
    l1->addWidget(m_description, 1, 2);
    l1->addWidget(m_location, 2, 2);
    l0->addWidget(sep);
    l0->addWidget(m_gb);
    l0->addWidget(m_outfile_gb);
    QGridLayout *l6 = new QGridLayout(m_outfile_gb->layout(), 3, 2, 10);
    l6->addMultiCellWidget(m_usefile, 0, 0, 0, 1);
    l6->addWidget(m_mimetypelabel, 1, 0);
    l6->addWidget(m_mimetype, 1, 1);
    l6->addWidget(m_extensionlabel, 2, 0);
    l6->addWidget(m_extension, 2, 1);

    enableButton(Ok, !m_name->text().isEmpty());

    // resize dialog
    resize(400, 100);
}
ossimQtSingleImageWindow::ossimQtSingleImageWindow(QWidget* parent,
        const char* name,
        Qt::WFlags f)
    : QMainWindow(parent, name, f),
      ossimConnectableObject(),
      ossimConnectableDisplayListener(),
      theImageWidget(0),
      theLastOpenedDirectory(),
      theResolutionLevelMenu(0)
{
    ossimReferenced::ref();
    setCaption("iview");

    QSize size(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    setBaseSize(size);

    // This set the window's widget size.
    setGeometry(0,0,DEFAULT_WIDTH-1,DEFAULT_HEIGHT-1);

    // Create the image widget parenting it to this.
    theImageWidget = new ossimQtScrollingImageWidget(this, "image_widget");

    // This will clear out any initial garbage in the widget.
    theImageWidget->refresh();

    // Disable random caching scheme.
    theImageWidget->setRandomPriorityQueueEnabledFlag(false);

    // Set the the width and height of the window.
    theImageWidget->resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // Make the image widget the centralized widget.
    setCentralWidget(theImageWidget);

    // Make the "File" pull down menu.
    QMenu* file = new QMenu( this );
    menuBar()->insertItem( "&File", file );
    file->insertItem( "&Open Image",  this, SLOT(openImage()), Qt::CTRL+Qt::Key_O );
    file->insertItem( "&Close Image",  this, SLOT(closeImage()), Qt::CTRL+Qt::Key_C );
    file->insertItem( "&Export",  this, SLOT(exportImage()), Qt::CTRL+Qt::Key_E );
    file->insertItem( "&Quit",  this, SLOT(closeWindow()), Qt::CTRL+Qt::Key_Q );

    // Make the "Edit" pull down menu.
    QMenu* edit = new QMenu( this );
    menuBar()->insertItem( "&Edit", edit );
    edit->insertItem( "Image Chain",  this, SLOT(editImageChain()));

    // Make the "Utilities" pull down menu.
    QMenu* utilities = new QMenu( this );
    menuBar()->insertItem( "&Utilities", utilities );
    utilities->insertItem( "Refresh",  this, SLOT(refreshDisplay()));

    // Make the "Resolution_Level" pull down menu.
    theResolutionLevelMenu = new QMenu( this );
    menuBar()->insertItem( "&Resolution_Level",  theResolutionLevelMenu);

    QAction* rsetAct = new QAction(QString("0"), this);
    rsetAct->setCheckable(true);
    rsetAct->setChecked(true);
    rsetAct->setData(0);
    rsetAct->setEnabled(false);

    theResolutionLevelMenu->addAction( rsetAct );

    // Connect the activated signal to the changeResolutionLevel slot.
    connect( theResolutionLevelMenu, SIGNAL( triggered( QAction * ) ),
             this, SLOT ( changeResolutionLevel( QAction * ) ) );

    // Make the "Help" pull down menu.
    QMenu* help = new QMenu( this );
    menuBar()->insertItem( "&Help", help );
    help->insertItem( "&About",  this, SLOT(about()), Qt::CTRL+Qt::Key_A );

    // Connect up the slot to capture mouse events.
    connect(theImageWidget,
            SIGNAL(scrollingImageWidgetMouseEvent(ossimQtMouseEvent*)),
            this,
            SLOT(trackImageWidget(ossimQtMouseEvent*)));

    // Add us in as a listener for display events like refresh.
    addListener((ossimConnectableDisplayListener*)this);

    //---
    // Connect this display up to "theImageWidget" so that event propagation
    // comes up the chain to us.
    //---
    connectMyInputTo(theImageWidget);

    // Send a dummy message to make the status bar show.
    statusBar()->message( QString(" ") );

    //---
    // Set the last open directory to the current working dir so the open image
    // dialog will come up where you started.
    //---
    theLastOpenedDirectory = getenv("PWD");
}
Пример #13
0
MainWidget::MainWidget(QWidget *parent,const char *name)
  :QWidget(parent,name)
{
  //
  // HACK: Disable the Broken Custom SuSE Dialogs
  //
#ifndef WIN32
  setenv("QT_NO_KDE_INTEGRATION","1",1);
#endif  // WIN32

  //
  // Read Command Options
  //
  bool cmd_generate = false;
  bool cmd_merge_music = false;
  bool cmd_merge_traffic = false;
  QString cmd_service = NULL;
  QDate cmd_date = QDate::currentDate().addDays(1);

  RDCmdSwitch *cmd=
    new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogmanager","\n");
  for(unsigned i=0;i<cmd->keys();i++)
     {
     if (cmd->key(i)=="-g")
       cmd_generate = true;
     if (cmd->key(i)=="-m")
       cmd_merge_music = true;
     if (cmd->key(i)=="-t")
       cmd_merge_traffic = true;
     if (cmd->key(i)=="-s")
       if (i+1<cmd->keys())
         {
         i++;
         cmd_service = cmd->key(i);
         }
     if (cmd->key(i)=="-d")
       if (i+1<cmd->keys())
         {
         i++;
         cmd_date = QDate::currentDate().addDays(cmd->key(i).toInt());
         }
    }
  delete cmd;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  //
  // Ensure that the system daemons are running
  //
#ifndef WIN32
  RDInitializeDaemons();
#endif  // WIN32

  //
  // Load Local Configs
  //
  log_config=new RDConfig();
  log_config->load();
  setCaption(tr("RDLogManager"));

  //
  // Open Database
  //
  QString err;
  log_db=RDInitDb(&err);
  if(!log_db) {
    QMessageBox::warning(this,tr("Can't Connect"),err);
    exit(0);
  }
  new RDDbHeartbeat(log_config->mysqlHeartbeatInterval(),this);

  //
  // Allocate Global Resources
  //
  rdstation_conf=new RDStation(log_config->stationName());
   
  //
  // CAE Connection
  //
#ifndef WIN32
  rdcae=new RDCae(parent,name);
  rdcae->connectHost("localhost",CAED_TCP_PORT,log_config->password());
#endif  // WIN32

  //
  // RIPC Connection
  //
  rdripc=new RDRipc(log_config->stationName());
  connect(rdripc,SIGNAL(userChanged()),this,SLOT(userData()));
  rdripc->connectHost("localhost",RIPCD_TCP_PORT,log_config->password());

  //
  // User
  //
  rduser=NULL;

  //
  // Generate Fonts
  //
  QFont default_font("Helvetica",12,QFont::Normal);
  default_font.setPixelSize(12);
  qApp->setFont(default_font);
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  button_font.setPixelSize(12);
  QFont label_font=QFont("Helvetica",12,QFont::Bold);
  label_font.setPixelSize(12);
  QFont day_font=QFont("Helvetica",12,QFont::Normal);
  day_font.setPixelSize(12);

  //
  // Create And Set Icon
  //
  log_rivendell_map=new QPixmap(rivendell_xpm);
  setIcon(*log_rivendell_map);

  //
  // Filters
  //
  event_filter=new QString();
  clock_filter=new QString();

  //
  // Title Label
  //
  QLabel *label=new QLabel(tr("RDLogManager"),this,"title_label");
  label->setGeometry(0,5,sizeHint().width(),32);
  label->setFont(label_font);
  label->setAlignment(AlignHCenter);
  label=new QLabel(tr("Select an operation:"),this,"instruction_label");
  label->setGeometry(0,25,sizeHint().width(),16);
  label->setFont(day_font);
  label->setAlignment(AlignCenter);

  //
  //  Edit Events Button
  //
  log_events_button=new QPushButton(this,"events_button");
  log_events_button->setGeometry(10,45,sizeHint().width()-20,50);
  log_events_button->setFont(button_font);
  log_events_button->setText(tr("Edit &Events"));
  connect(log_events_button,SIGNAL(clicked()),this,SLOT(eventsData()));

  //
  //  Edit Clocks Button
  //
  log_clocks_button=new QPushButton(this,"clocks_button");
  log_clocks_button->setGeometry(10,95,sizeHint().width()-20,50);
  log_clocks_button->setFont(button_font);
  log_clocks_button->setText(tr("Edit C&locks"));
  connect(log_clocks_button,SIGNAL(clicked()),this,SLOT(clocksData()));

  //
  //  Edit Grids Button
  //
  log_grids_button=new QPushButton(this,"grid_button");
  log_grids_button->setGeometry(10,145,sizeHint().width()-20,50);
  log_grids_button->setFont(button_font);
  log_grids_button->setText(tr("Edit G&rids"));
  connect(log_grids_button,SIGNAL(clicked()),this,SLOT(gridsData()));

  //
  //  Generate Logs Button
  //
  log_logs_button=new QPushButton(this,"logs_button");
  log_logs_button->setGeometry(10,195,sizeHint().width()-20,50);
  log_logs_button->setFont(button_font);
  log_logs_button->setText(tr("&Generate Logs"));
  connect(log_logs_button,SIGNAL(clicked()),this,SLOT(generateData()));

  //
  //  Generate Reports Button
  //
  log_reports_button=new QPushButton(this,"reports_button");
  log_reports_button->setGeometry(10,245,sizeHint().width()-20,50);
  log_reports_button->setFont(button_font);
  log_reports_button->setText(tr("Manage &Reports"));
  connect(log_reports_button,SIGNAL(clicked()),this,SLOT(reportsData()));

  //
  //  Close Button
  //
  log_close_button=new QPushButton(this,"close_button");
  log_close_button->setGeometry(10,sizeHint().height()-60,
				sizeHint().width()-20,50);
  log_close_button->setFont(button_font);
  log_close_button->setText(tr("&Close"));
  log_close_button->setDefault(true);
  connect(log_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget()));

  if (cmd_generate)
    {
    GenerateLog *generatelog=new GenerateLog(this,"list_grids",1,&cmd_service,&cmd_date);
    delete generatelog;
    }
  if (cmd_merge_music)
    {
    GenerateLog *generatelog=new GenerateLog(this,"list_grids",2,&cmd_service,&cmd_date);
    delete generatelog;
    }
  if (cmd_merge_traffic)
    {
    GenerateLog *generatelog=new GenerateLog(this,"list_grids",3,&cmd_service,&cmd_date);
    delete generatelog;
    }
   if (cmd_generate || cmd_merge_music ||cmd_merge_traffic )
    quitMainWidget();

#ifndef WIN32
  signal(SIGCHLD,SigHandler);
#endif  // WIN32
}
Пример #14
0
ListReports::ListReports(const QString &filter,const QString &type_filter,
			 const QString &group,const QString &schedcode,
			 QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  list_filter=filter;
  list_type_filter=type_filter;
  list_group=group;
  list_schedcode=schedcode;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  setCaption(tr("RDLibrary Reports"));

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Reports List
  //
  list_reports_box=new QComboBox(this,"list_reports_box");
  list_reports_box->setGeometry(50,10,sizeHint().width()-60,19);
  list_reports_box->insertItem(tr("Cart Report"));
  list_reports_box->insertItem(tr("Cut Report"));
  list_reports_box->insertItem(tr("Cart Data Dump (fixed width)"));
  list_reports_box->insertItem(tr("Cart Data Dump (CSV)"));
  list_reports_label=new QLabel(list_reports_box,tr("Type:"),this);
  list_reports_label->setGeometry(10,10,35,19);
  list_reports_label->setFont(font);
  list_reports_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  connect(list_reports_box,SIGNAL(activated(int)),
	  this,SLOT(typeActivatedData(int)));

  //
  // Field Names Checkbox
  //
  list_fieldnames_check=new QCheckBox(this);
  list_fieldnames_check->setGeometry(55,34,15,15);
  list_fieldnames_check->setChecked(true);
  list_fieldnames_check->setDisabled(true);
  list_fieldnames_label=
    new QLabel(list_fieldnames_check,tr("Prepend Field Names"),this);
  list_fieldnames_label->setGeometry(75,32,sizeHint().width()-75,19);
  list_fieldnames_label->setFont(font);
  list_fieldnames_label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);
  list_fieldnames_label->setDisabled(true);

  //
  //  Generate Button
  //
  QPushButton *generate_button=new QPushButton(this,"generate_button");
  generate_button->
    setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  generate_button->setDefault(true);
  generate_button->setFont(font);
  generate_button->setText(tr("&Generate"));
  connect(generate_button,SIGNAL(clicked()),this,SLOT(generateData()));

  //
  //  Close Button
  //
  QPushButton *close_button=new QPushButton(this,"close_button");
  close_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  close_button->setFont(font);
  close_button->setText(tr("&Close"));
  connect(close_button,SIGNAL(clicked()),this,SLOT(closeData()));
}
Пример #15
0
CdRipper::CdRipper(QString cutname,RDCddbRecord *rec,RDLibraryConf *conf,
		   bool profile_rip,QWidget *parent,const char *name) 
  : QDialog(parent,name)
{
  rip_profile_rip=profile_rip;
  rip_isrc_read=false;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());

  //
  // Generate Fonts
  //
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  button_font.setPixelSize(12);
  QFont label_font=QFont("Helvetica",12,QFont::Bold);
  label_font.setPixelSize(12);

  rip_conf=conf;
  rip_cddb_record=rec;
  rip_track[0]=-1;
  rip_track[1]=-1;
  rip_title=NULL;

  setCaption("Rip CD");

  //
  // Create Temporary Directory
  //
  char path[PATH_MAX];
  strncpy(path,RDTempDir(),PATH_MAX);
  strcat(path,"/XXXXXX");
  if(mkdtemp(path)==NULL) {
    QMessageBox::warning(this,"RDLibrary - "+tr("Ripper Error"),
			 tr("Unable to create temporary directory!"));
  }
  else {
    rip_cdda_dir.setPath(path);
  }

  //
  // Target Cut
  //
  rip_cut=new RDCut(cutname);

  //
  // The CDROM Drive
  //
  if(rip_profile_rip) {
    rip_cdrom=new RDCdPlayer(stdout,this);
  }
  else {
    rip_cdrom=new RDCdPlayer(NULL,this);
  }
  connect(rip_cdrom,SIGNAL(ejected()),this,SLOT(ejectedData()));
  connect(rip_cdrom,SIGNAL(mediaChanged()),this,SLOT(mediaChangedData()));
  connect(rip_cdrom,SIGNAL(played(int)),this,SLOT(playedData(int)));
  connect(rip_cdrom,SIGNAL(stopped()),this,SLOT(stoppedData()));
  rip_cdrom->setDevice(rip_conf->ripperDevice());
  rip_cdrom->open();

  //
  // CDDB Stuff
  //
  if(rip_profile_rip) {
    rip_cddb_lookup=new RDCddbLookup(stdout,this,"rip_cddb_lookup");
  }
  else {
    rip_cddb_lookup=new RDCddbLookup(NULL,this,"rip_cddb_lookup");
  }
  connect(rip_cddb_lookup,SIGNAL(done(RDCddbLookup::Result)),
	  this,SLOT(cddbDoneData(RDCddbLookup::Result)));

  //
  // Title Selector
  //
  rip_title_label=new QLabel(tr("Title:"),this);
  rip_title_label->setFont(label_font);
  rip_title_label->setAlignment(AlignRight|AlignVCenter);
  rip_title_box=new QComboBox(this);
  rip_title_box->insertItem(tr("[none]"));

  //
  // Artist Label
  //
  rip_artist_label=new QLabel(tr("Artist:"),this);
  rip_artist_label->setFont(label_font);
  rip_artist_label->setAlignment(AlignRight|AlignVCenter);
  rip_artist_edit=new QLineEdit(this,"rip_artist_edit");

  //
  // Album Edit
  //
  rip_album_label=new QLabel(tr("Album:"),this);
  rip_album_label->setFont(label_font);
  rip_album_label->setAlignment(AlignRight|AlignVCenter);
  rip_album_edit=new QLineEdit(this,"rip_album_edit");

  //
  // Other Edit
  //
  rip_other_label=new QLabel(tr("Other:"),this);
  rip_other_label->setFont(label_font);
  rip_other_label->setAlignment(AlignRight);
  rip_other_edit=new QTextEdit(this,"rip_other_edit");
  rip_other_edit->setReadOnly(true);

  //
  // Apply FreeDB Check Box
  //
  rip_apply_box=new QCheckBox(this,"rip_apply_box");
  rip_apply_box->setChecked(true);
  rip_apply_box->setDisabled(true);
  rip_apply_label=new QLabel(rip_apply_box,tr("Apply FreeDB Values to Cart"),
		   this,"rip_apply_label");
  rip_apply_label->setFont(label_font);
  rip_apply_label->setAlignment(AlignLeft);
  rip_apply_box->setChecked(false);
  rip_apply_label->setDisabled(true);

  //
  // Track List
  //
  rip_track_list=new RDListView(this);
  rip_track_list->setAllColumnsShowFocus(true);
  rip_track_list->setSelectionMode(QListView::Extended);
  rip_track_list->setItemMargin(5);
  rip_track_list->setSorting(-1);
  connect(rip_track_list,SIGNAL(selectionChanged()),
	  this,SLOT(trackSelectionChangedData()));
  rip_track_label=new QLabel(rip_track_list,tr("Tracks"),this);
  rip_track_label->setFont(label_font);
  rip_track_list->addColumn(tr("TRACK"));
  rip_track_list->setColumnAlignment(0,Qt::AlignHCenter);
  rip_track_list->addColumn(tr("LENGTH"));
  rip_track_list->setColumnAlignment(1,Qt::AlignRight);
  rip_track_list->addColumn(tr("TITLE"));
  rip_track_list->setColumnAlignment(2,Qt::AlignLeft);
  rip_track_list->addColumn(tr("OTHER"));
  rip_track_list->setColumnAlignment(3,Qt::AlignLeft);
  rip_track_list->addColumn(tr("TYPE"));
  rip_track_list->setColumnAlignment(4,Qt::AlignLeft);

  //
  // Progress Bar
  //
  rip_bar=new QProgressBar(this,"rip_bar");

  //
  // Eject Button
  //
  rip_eject_button=new RDTransportButton(RDTransportButton::Eject,
					this,"close_button");
  connect(rip_eject_button,SIGNAL(clicked()),this,SLOT(ejectButtonData()));
  
  //
  // Play Button
  //
  rip_play_button=new RDTransportButton(RDTransportButton::Play,
					this,"close_button");
  connect(rip_play_button,SIGNAL(clicked()),this,SLOT(playButtonData()));
  
  //
  // Stop Button
  //
  rip_stop_button=new RDTransportButton(RDTransportButton::Stop,
					this,"close_button");
  rip_stop_button->setOnColor(red);
  rip_stop_button->on();
  connect(rip_stop_button,SIGNAL(clicked()),this,SLOT(stopButtonData()));
  
  //
  // Rip Track Button
  //
  rip_rip_button=new QPushButton(tr("&Rip\nTrack"),this,"rip_track_button");
  rip_rip_button->setFont(button_font);
  rip_rip_button->setDisabled(true);
  connect(rip_rip_button,SIGNAL(clicked()),this,SLOT(ripTrackButtonData()));

  //
  // Normalize Check Box
  //
  rip_normalize_box=new QCheckBox(this);
  rip_normalize_box->setChecked(true);
  rip_normalize_box_label=new QLabel(rip_normalize_box,tr("Normalize"),this);
  rip_normalize_box_label->setFont(label_font);
  rip_normalize_box_label->setAlignment(AlignLeft|AlignVCenter);
  connect(rip_normalize_box,SIGNAL(toggled(bool)),
	  this,SLOT(normalizeCheckData(bool)));

  //
  // Normalize Level
  //
  rip_normalize_spin=new QSpinBox(this,"rip_normalize_spin");
  rip_normalize_spin->setRange(-30,0);
  rip_normalize_label=new QLabel(rip_normalize_spin,tr("Level:"),
				 this,"normalize_spin_label");
  rip_normalize_label->setFont(label_font);
  rip_normalize_label->setAlignment(AlignRight|AlignVCenter);
  rip_normalize_unit=new QLabel(tr("dBFS"),this,"normalize_unit_label");
  rip_normalize_unit->setFont(label_font);
  rip_normalize_unit->setAlignment(AlignLeft|AlignVCenter);

  //
  // Autotrim Check Box
  //
  rip_autotrim_box=new QCheckBox(this);
  rip_autotrim_box->setChecked(true);
  rip_autotrim_box_label=new QLabel(rip_autotrim_box,tr("Autotrim"),this);
  rip_autotrim_box_label->setFont(label_font);
  rip_autotrim_box_label->setAlignment(AlignLeft|AlignVCenter);
  connect(rip_autotrim_box,SIGNAL(toggled(bool)),
	  this,SLOT(autotrimCheckData(bool)));

  //
  // Autotrim Level
  //
  rip_autotrim_spin=new QSpinBox(this,"rip_autotrim_spin");
  rip_autotrim_spin->setRange(-99,0);
  rip_autotrim_label=new QLabel(rip_autotrim_spin,tr("Level:"),
				 this,"autotrim_spin_label");
  rip_autotrim_label->setFont(label_font);
  rip_autotrim_label->setAlignment(AlignRight|AlignVCenter);
  rip_autotrim_unit=new QLabel(tr("dBFS"),this,"autotrim_unit_label");
  rip_autotrim_unit->setFont(label_font);
  rip_autotrim_unit->setAlignment(AlignLeft|AlignVCenter);

  //
  // Channels
  //
  rip_channels_box=new QComboBox(this);
  rip_channels_label=new QLabel(rip_channels_box,tr("Channels:"),this);
  rip_channels_label->setFont(label_font);
  rip_channels_label->setAlignment(AlignRight|AlignVCenter);

  //
  // Close Button
  //
  rip_close_button=new QPushButton("&Close",this,"close_button");
  rip_close_button->setFont(button_font);
  connect(rip_close_button,SIGNAL(clicked()),this,SLOT(closeData()));

  //
  // Populate Data
  //
  rip_normalize_spin->setValue(rip_conf->ripperLevel()/100);
  rip_autotrim_spin->setValue(rip_conf->trimThreshold()/100);
  rip_channels_box->insertItem("1");
  rip_channels_box->insertItem("2");
  rip_channels_box->setCurrentItem(rip_conf->defaultChannels()-1);
  rip_done=false;
}
Пример #16
0
SynchroDialog::SynchroDialog(Q3PtrList<BrowserView> & b)
    : QDialog(0, "Synchronize", TRUE), browsers(b) {
  setCaption("Synchronize");
  
  Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
  Q3HBoxLayout * hbox;
  
  vbox->setMargin(5);
  
  bool has_ro = FALSE;
  bool has_ro_need_update = FALSE;
  bool has_need_update = FALSE;
  Q3PtrListIterator<BrowserView> it(browsers);
  
  for (; it.current(); ++it) {
    if (it.current()->is_need_update()) {
      if (it.current()->is_cant_update()) {
	has_ro = TRUE;
	has_ro_need_update = TRUE;
      }
      else
	has_need_update = TRUE;
    }
  }  

  QLabel * lbl;
  
  if (has_need_update) {
    lbl = 
      new QLabel("\nChoose the projects to synchronize with the others\n", 
		 this);
    
    lbl->setAlignment(::Qt::AlignCenter);
    vbox->addWidget(lbl);
    
    if (has_ro_need_update) {
      lbl = 
	new QLabel("\nWarning : some projects can't be synchronized because of read-only files\n", 
		   this);
      
      lbl->setAlignment(::Qt::AlignCenter);
      vbox->addWidget(lbl);
    }
  }
  else if (has_ro_need_update) {
    lbl = 
      new QLabel("\nSynchronisation not possible because of read-only files\n", 
		 this);
    
    lbl->setAlignment(::Qt::AlignCenter);
    vbox->addWidget(lbl);
  }
  else {
    lbl = 
      new QLabel("\nAll the projects are synchronized\n",
		 this);
    
    lbl->setAlignment(::Qt::AlignCenter);
    vbox->addWidget(lbl);
  }
  
  //
  
  for (it.toFirst() ; it.current(); ++it) {
    if (it.current()->is_need_update()) {
      QCheckBox * cb = new QCheckBox(it.current()->get_dir().path(), this);
      
      vbox->addWidget(cb);
      
      if (it.current()->is_cant_update())
	cb->setEnabled(FALSE);
      else
	checks.append(cb);
    }
  }
  
  //
  
  hbox = new Q3HBoxLayout(vbox);
  hbox->setMargin(5);

  if (has_need_update) {
    QPushButton * ok = new QPushButton("Synchronize", this);
  
    hbox->addWidget(new QLabel(this));
    hbox->addWidget(ok);
    connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
  }
  
  QPushButton * cancel = new QPushButton("Cancel", this);
  
  hbox->addWidget(new QLabel(this));
  hbox->addWidget(cancel);
  hbox->addWidget(new QLabel(this));
  connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
Пример #17
0
DeviceConfigureDialog::DeviceConfigureDialog( const Medium &medium )
        : KDialogBase( amaroK::mainWindow(), "deviceconfiguredialog", true, QString("Select Plugin for " + medium.name()), Ok|Cancel, Ok, false )
{
    m_medium = new Medium( medium );
    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n( "Configure Media Device" ) ) );
    showButtonApply( false );

    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing( KDialog::spacingHint() );

    QLabel *connectLabel = 0;
    m_connectEdit = 0;
    QLabel *disconnectLabel = 0;
    m_disconnectEdit = 0;
    m_transcodeCheck = 0;
    QButtonGroup *transcodeGroup = 0;
    m_transcodeAlways = 0;
    m_transcodeWhenNecessary = 0;
    m_transcodeRemove = 0;

    MediaDevice* device = MediaBrowser::instance()->deviceFromId( m_medium->id() );

    if( device )
    {
        device->loadConfig();

        // pre-connect/post-disconnect (mount/umount)
        connectLabel = new QLabel( vbox );
        connectLabel->setText( i18n( "Pre-&connect command:" ) );
        m_connectEdit = new HintLineEdit( device->m_preconnectcmd, vbox );
        m_connectEdit->setHint( i18n( "Example: mount %d" ) );
        connectLabel->setBuddy( m_connectEdit );
        QToolTip::add( m_connectEdit, i18n( "Set a command to be run before connecting to your device (e.g. a mount command) here.\n%d is replaced by the device node, %m by the mount point.\nEmpty commands are not executed." ) );

        disconnectLabel = new QLabel( vbox );
        disconnectLabel->setText( i18n( "Post-&disconnect command:" ) );
        m_disconnectEdit = new HintLineEdit( device->m_postdisconnectcmd, vbox );
        disconnectLabel->setBuddy( m_disconnectEdit );
        m_disconnectEdit->setHint( i18n( "Example: eject %d" ) );
        QToolTip::add( m_disconnectEdit, i18n( "Set a command to be run after disconnecting from your device (e.g. an eject command) here.\n%d is replaced by the device node, %m by the mount point.\nEmpty commands are not executed." ) );

        // transcode
        m_transcodeCheck = new QCheckBox( vbox );
        m_transcodeCheck->setText( i18n( "&Transcode before transferring to device" ) );
        m_transcodeCheck->setChecked( device->m_transcode );

        transcodeGroup = new QVButtonGroup( vbox );
        transcodeGroup->setTitle( i18n( "Transcode to preferred format for device" ) );
        m_transcodeAlways = new QRadioButton( transcodeGroup );
        m_transcodeAlways->setText( i18n( "Whenever possible" ) );
        m_transcodeAlways->setChecked( device->m_transcodeAlways );
        m_transcodeWhenNecessary = new QRadioButton( transcodeGroup );
        m_transcodeWhenNecessary->setText( i18n( "When necessary" ) );
        m_transcodeWhenNecessary->setChecked( !device->m_transcodeAlways );
        connect( m_transcodeCheck, SIGNAL(toggled( bool )),
                transcodeGroup, SLOT(setEnabled( bool )) );
        transcodeGroup->insert( m_transcodeAlways );
        transcodeGroup->insert( m_transcodeWhenNecessary );
        m_transcodeRemove = new QCheckBox( transcodeGroup );
        m_transcodeRemove->setText( i18n( "Remove transcoded files after transfer" ) );
        m_transcodeRemove->setChecked( device->m_transcodeRemove );

        const ScriptManager *sm = ScriptManager::instance();
        m_transcodeCheck->setEnabled( sm->transcodeScriptRunning() != QString::null );
        transcodeGroup->setEnabled( sm->transcodeScriptRunning() != QString::null && device->m_transcode );
        if( sm->transcodeScriptRunning().isNull() )
        {
            QToolTip::add( m_transcodeCheck, i18n( "For this feature, a script of type \"Transcode\" has to be running" ) );
            QToolTip::add( transcodeGroup, i18n( "For this feature, a script of type \"Transcode\" has to be running" ) );
        }

        device->addConfigElements( vbox );
    }

    m_accepted = false;
}
Пример #18
0
SystemInfo::SystemInfo(QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  setCaption("Call Administrator - System Information");

  //
  // Create Fonts
  //
  QFont title_font=QFont("Helvetica",24,QFont::DemiBold);
  title_font.setPixelSize(22);
  QFont slogan_font=QFont("Helvetica",14,QFont::Normal);
  slogan_font.setPixelSize(14);
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  button_font.setPixelSize(12);
  QFont bold_font=QFont("Helvetica",10,QFont::Bold);
  bold_font.setPixelSize(10);
  QFont font=QFont("Helvetica",10,QFont::Normal);
  font.setPixelSize(10);

  //
  // Title
  //
  QLabel *label=new QLabel("CallCommander",this,"title_label");
  label->setGeometry(10,10,sizeHint().width()-20,36);
  label->setFont(title_font);

  //
  // Slogan
  //
  label=new QLabel("The Civilized Call Screener",this,"title_label");
  label->setGeometry(10,38,sizeHint().width()-20,18);
  label->setFont(slogan_font);

  //
  // Version
  //
  label=new QLabel(QString().sprintf("Version %s",VERSION),this,"title_label");
  label->setGeometry(10,58,200,14);
  label->setFont(font);

  //
  // Signature
  //
  label=new QLabel(QString().sprintf("Copyright 2002-2011 Fred Gleason <%s>","*****@*****.**"),this,"title_label");
//  label=new QLabel(QString().sprintf("Copyright 2002-2011 Fred Gleason <%s>",PACKAGE_BUGREPORT),this,"title_label");
  label->setGeometry(10,73,sizeHint().width()-20,14);
  label->setFont(font);

  //
  // Disclaimer
  //
  label=new MLLabel(this,"title_label");
  label->setGeometry(10,90,sizeHint().width()-20,60);
  label->setFont(font);
  label->setText("This program is free software, and comes with ABSOLUTELY NO WARRANTY,\nnot even the implied warranties of MERCHANTIBILITY or FITNESS FOR A\nPARTICULAR PURPOSE.  Touch the \"View License\" button for details.");

  //
  // License Button
  //
  QPushButton *button=new QPushButton(this,"license_button");
  button->setGeometry(10,sizeHint().height()-60,80,50);
  button->setFont(button_font);
  button->setText("View\n&License");
  connect(button,SIGNAL(clicked()),this,SLOT(viewLicenseData()));

  //
  //  Close Button
  //
  button=new QPushButton(this,"close_button");
  button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			    80,50);
  button->setFont(button_font);
  button->setText("&Close");
  button->setDefault(true);
  connect(button,SIGNAL(clicked()),this,SLOT(closeData()));
}
Пример #19
0
ExportDialog::ExportDialog(int w, int h, int wsel, int hsel, QString filename_, bool nosel_, QWidget *parent) :
    QDialog(parent)
{

    setCaption(tr("Export graphics"));
    dwidth = w;
    dheight = h;
    dwidthsel = wsel;
    dheightsel = hsel;
    svg = false;
    noselected = nosel_;

    filename = filename_;

    lblFilename = new QLabel(tr("Save to file (Graphics format by extension)"));
    lblResolutionX = new QLabel(tr("Width  in pixels"));
    lblResolutionY = new QLabel(tr("Height in pixels"));
    lblRatio = new QLabel(tr("Scale factor: "));
    lblFormat = new QLabel(tr("Image format:"));

    ExportButt = new QPushButton(tr("Export"));
    connect(ExportButt,SIGNAL(clicked()),this,SLOT(accept()));
    CancelButt = new QPushButton(tr("Cancel"));
    connect(CancelButt,SIGNAL(clicked()),this,SLOT(reject()));
    SaveButt = new QPushButton(tr("File"));
    connect(SaveButt,SIGNAL(clicked()),this,SLOT(setFileName()));

    editFilename = new QLineEdit(filename);
    connect(editFilename,SIGNAL(textChanged(QString)),this,SLOT(setSvg(QString)));

    editResolutionX = new QLineEdit(QString::number(dwidth));
    QIntValidator *val = new QIntValidator(0,64000,this);
    editResolutionX->setValidator(val);
    editResolutionX->setEnabled(false);
    editResolutionY = new QLineEdit(QString::number(dheight));
    editResolutionY->setValidator(val);
    editResolutionY->setEnabled(false);
    editScale = new QLineEdit(QString::number(1.0));
    QDoubleValidator *val1 = new QDoubleValidator(0,20.0,2,this);
    editScale->setValidator(val1);

    cbxImgType = new QComboBox(this);
    QStringList lst;
    lst<<tr("Colour")<<tr("Monochrome");
    cbxImgType->addItems(lst);

    cbRatio = new QCheckBox(tr("Original width to height ratio"));
    cbRatio->setChecked(true);
    connect(cbRatio,SIGNAL(toggled(bool)),this,SLOT(recalcRatio()));

    cbResolution = new QCheckBox(tr("Original size"));
    connect(cbResolution,SIGNAL(toggled(bool)),editResolutionX,SLOT(setDisabled(bool)));
    connect(cbResolution,SIGNAL(toggled(bool)),editResolutionY,SLOT(setDisabled(bool)));
    connect(cbResolution,SIGNAL(toggled(bool)),cbRatio,SLOT(setDisabled(bool)));
    connect(cbResolution,SIGNAL(toggled(bool)),editScale,SLOT(setDisabled(bool)));
    connect(cbResolution,SIGNAL(toggled(bool)),this,SLOT(restoreOriginalWtoH()));
    cbResolution->setChecked(true);

    connect(editResolutionX,SIGNAL(textEdited(QString)),this,SLOT(calcHeight()));
    connect(editResolutionY,SIGNAL(textEdited(QString)),this,SLOT(calcWidth()));
    connect(editScale,SIGNAL(textChanged(QString)),this,SLOT(recalcScale()));

    cbSelected = new QCheckBox(tr("Export selected only"));
    connect(cbSelected,SIGNAL(toggled(bool)),this,SLOT(setSelectedWH()));
    cbSelected->setChecked(false);
    if (noselected) cbSelected->setDisabled(true);

    //cbResolution->setEnabled(false);
    cbRatio->setEnabled(false);


    top = new QVBoxLayout;
    lower1 = new QHBoxLayout;
    lower2 = new QHBoxLayout;
    lower3 = new QHBoxLayout;
    lower4 = new QHBoxLayout;

    top->addWidget(lblFilename);
    lower1->addWidget(editFilename);
    lower1->addWidget(SaveButt);
    top->addLayout(lower1);
    lower4->addWidget(lblFormat);
    lower4->addWidget(cbxImgType);
    top->addLayout(lower4);
    top->addWidget(cbResolution);
    //top->addWidget(cbRatio);
    lower3->addWidget(lblRatio);
    lower3->addWidget(editScale);
    top->addLayout(lower3);
    top->addWidget(lblResolutionX);
    top->addWidget(editResolutionX);
    top->addWidget(lblResolutionY);
    top->addWidget(editResolutionY);
    top->addWidget(cbSelected);

    lower2->addWidget(ExportButt);
    lower2->addWidget(CancelButt);
    top->addLayout(lower2);
    this->setLayout(top);

    this->layout()->setSizeConstraint(QLayout::SetFixedSize);
    this->setWindowTitle(tr("Export schematic to raster or vector image"));

    this->setSvg(editFilename->text());
}
Пример #20
0
ItemMargin::ItemMargin(MainWindow* main)
    : QuasarWindow(main, "ItemMargin")
{
    _helpSource = "item_margin.html";

    QFrame* frame = new QFrame(this);

    QFrame* top = new QFrame(frame);

    _lookup = new ItemLookup(_main, this);
    _lookup->soldOnly = true;
    _lookup->store_id = _quasar->defaultStore();

    QLabel* itemLabel = new QLabel(tr("Item Number:"), top);
    _item = new ItemEdit(_lookup, top);
    _item->setLength(18, '9');
    itemLabel->setBuddy(_item);

    QLabel* descLabel = new QLabel(tr("Description:"), top);
    _desc = new LineEdit(top);
    _desc->setLength(30);
    _desc->setFocusPolicy(NoFocus);

    QLabel* storeLabel = new QLabel(tr("Store:"), top);
    _store = new LookupEdit(new StoreLookup(_main, this), top);
    _store->setLength(30);
    storeLabel->setBuddy(_store);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setMargin(3);
    topGrid->setSpacing(3);
    topGrid->setColStretch(2, 1);
    topGrid->addWidget(itemLabel, 0, 0);
    topGrid->addWidget(_item, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addWidget(_desc, 1, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(storeLabel, 2, 0);
    topGrid->addWidget(_store, 2, 1, AlignLeft | AlignVCenter);

    QGroupBox* price = new QGroupBox(tr("Price"), frame);
    QGridLayout* priceGrid = new QGridLayout(price,2,1,price->frameWidth()*2);
    priceGrid->addRowSpacing(0, price->fontMetrics().height());

    QLabel* priceSizeLabel = new QLabel(tr("Size:"), price);
    _priceSize = new ComboBox(price);
    priceSizeLabel->setBuddy(_priceSize);

    QLabel* priceLabel = new QLabel(tr("Price:"), price);
    _price = new PriceEdit(price);
    priceLabel->setBuddy(_price);

    QLabel* priceTaxLabel = new QLabel(tr("Tax:"), price);
    _priceTax = new MoneyEdit(price);
    _priceTax->setFocusPolicy(NoFocus);
    priceTaxLabel->setBuddy(_priceTax);

    QLabel* priceDepositLabel = new QLabel(tr("Deposit:"), price);
    _priceDeposit = new MoneyEdit(price);
    _priceDeposit->setFocusPolicy(NoFocus);
    priceDepositLabel->setBuddy(_priceDeposit);

    QLabel* priceBaseLabel = new QLabel(tr("Base:"), price);
    _priceBase = new MoneyEdit(price);
    priceBaseLabel->setBuddy(_priceBase);

    priceGrid->setColStretch(2, 1);
    priceGrid->addWidget(priceSizeLabel, 1, 0);
    priceGrid->addWidget(_priceSize, 1, 1, AlignLeft | AlignVCenter);
    priceGrid->addWidget(priceLabel, 2, 0);
    priceGrid->addWidget(_price, 2, 1, AlignLeft | AlignVCenter);
    priceGrid->addWidget(priceTaxLabel, 3, 0);
    priceGrid->addWidget(_priceTax, 3, 1, AlignLeft | AlignVCenter);
    priceGrid->addWidget(priceDepositLabel, 4, 0);
    priceGrid->addWidget(_priceDeposit, 4, 1, AlignLeft | AlignVCenter);
    priceGrid->addWidget(priceBaseLabel, 5, 0);
    priceGrid->addWidget(_priceBase, 5, 1, AlignLeft | AlignVCenter);

    QGroupBox* cost = new QGroupBox(tr("Rep Cost"), frame);
    QGridLayout* costGrid = new QGridLayout(cost,2,1,cost->frameWidth()*2);
    costGrid->addRowSpacing(0, cost->fontMetrics().height());

    QLabel* costSizeLabel = new QLabel(tr("Size:"), cost);
    _costSize = new ComboBox(cost);
    costSizeLabel->setBuddy(_costSize);

    QLabel* costLabel = new QLabel(tr("Cost:"), cost);
    _cost = new PriceEdit(cost);
    costLabel->setBuddy(_cost);

    QLabel* costTaxLabel = new QLabel(tr("Tax:"), cost);
    _costTax = new MoneyEdit(cost);
    _costTax->setFocusPolicy(NoFocus);
    costTaxLabel->setBuddy(_costTax);

    QLabel* costDepositLabel = new QLabel(tr("Deposit:"), cost);
    _costDeposit = new MoneyEdit(cost);
    _costDeposit->setFocusPolicy(NoFocus);
    costDepositLabel->setBuddy(_costDeposit);

    QLabel* costBaseLabel = new QLabel(tr("Base:"), cost);
    _costBase = new MoneyEdit(cost);
    costBaseLabel->setBuddy(_costBase);

    costGrid->setColStretch(2, 1);
    costGrid->addWidget(costSizeLabel, 1, 0);
    costGrid->addWidget(_costSize, 1, 1, AlignLeft | AlignVCenter);
    costGrid->addWidget(costLabel, 2, 0);
    costGrid->addWidget(_cost, 2, 1, AlignLeft | AlignVCenter);
    costGrid->addWidget(costTaxLabel, 3, 0);
    costGrid->addWidget(_costTax, 3, 1, AlignLeft | AlignVCenter);
    costGrid->addWidget(costDepositLabel, 4, 0);
    costGrid->addWidget(_costDeposit, 4, 1, AlignLeft | AlignVCenter);
    costGrid->addWidget(costBaseLabel, 5, 0);
    costGrid->addWidget(_costBase, 5, 1, AlignLeft | AlignVCenter);

    QGroupBox* margin = new QGroupBox(tr("Margin"), frame);
    QGridLayout* marginGrid = new QGridLayout(margin, 2, 1,
					      margin->frameWidth()*2);
    marginGrid->addRowSpacing(0, margin->fontMetrics().height());

    QLabel* marginSizeLabel = new QLabel(tr("Size:"), margin);
    _marginSize = new ComboBox(margin);
    marginSizeLabel->setBuddy(_marginSize);

    QLabel* marginPriceLabel = new QLabel(tr("Price:"), margin);
    _marginPrice = new MoneyEdit(margin);
    marginPriceLabel->setBuddy(_marginPrice);

    QLabel* targetLabel = new QLabel(tr("Target GM:"), margin);
    _targetGM = new PercentEdit(margin);
    _targetGM->setFocusPolicy(NoFocus);
    targetLabel->setBuddy(_targetGM);

    QLabel* repCostLabel = new QLabel(tr("Rep Cost:"), margin);
    _repCost = new MoneyEdit(margin);
    repCostLabel->setBuddy(_repCost);

    QLabel* repProfitLabel = new QLabel(tr("Rep Profit:"), margin);
    _repProfit = new MoneyEdit(margin);
    repProfitLabel->setBuddy(_repProfit);

    QLabel* repMarginLabel = new QLabel(tr("Rep Margin:"), margin);
    _repMargin = new PercentEdit(margin);
    repMarginLabel->setBuddy(_repMargin);

    QLabel* lastCostLabel = new QLabel(tr("Last Cost:"), margin);
    _lastCost = new MoneyEdit(margin);
    _lastCost->setFocusPolicy(NoFocus);
    lastCostLabel->setBuddy(_lastCost);

    QLabel* lastProfitLabel = new QLabel(tr("Last Profit:"), margin);
    _lastProfit = new MoneyEdit(margin);
    lastProfitLabel->setBuddy(_lastProfit);

    QLabel* lastMarginLabel = new QLabel(tr("Last Margin:"), margin);
    _lastMargin = new PercentEdit(margin);
    lastMarginLabel->setBuddy(_lastMargin);

    QLabel* avgCostLabel = new QLabel(tr("Avg Cost:"), margin);
    _avgCost = new MoneyEdit(margin);
    _avgCost->setFocusPolicy(NoFocus);
    avgCostLabel->setBuddy(_avgCost);

    QLabel* avgProfitLabel = new QLabel(tr("Avg Profit:"), margin);
    _avgProfit = new MoneyEdit(margin);
    avgProfitLabel->setBuddy(_avgProfit);

    QLabel* avgMarginLabel = new QLabel(tr("Avg Margin:"), margin);
    _avgMargin = new PercentEdit(margin);
    avgMarginLabel->setBuddy(_avgMargin);

    marginGrid->setColStretch(2, 1);
    marginGrid->setColStretch(5, 1);
    marginGrid->addColSpacing(2, 10);
    marginGrid->addColSpacing(5, 10);
    marginGrid->addWidget(marginSizeLabel, 1, 0);
    marginGrid->addWidget(_marginSize, 1, 1, AlignLeft | AlignVCenter);
    marginGrid->addWidget(marginPriceLabel, 1, 3);
    marginGrid->addWidget(_marginPrice, 1, 4, AlignLeft | AlignVCenter);
    marginGrid->addWidget(targetLabel, 1, 6);
    marginGrid->addWidget(_targetGM, 1, 7, AlignLeft | AlignVCenter);
    marginGrid->addWidget(repCostLabel, 2, 0);
    marginGrid->addWidget(_repCost, 2, 1, AlignLeft | AlignVCenter);
    marginGrid->addWidget(repProfitLabel, 2, 3);
    marginGrid->addWidget(_repProfit, 2, 4, AlignLeft | AlignVCenter);
    marginGrid->addWidget(repMarginLabel, 2, 6);
    marginGrid->addWidget(_repMargin, 2, 7, AlignLeft | AlignVCenter);
    marginGrid->addWidget(lastCostLabel, 3, 0);
    marginGrid->addWidget(_lastCost, 3, 1, AlignLeft | AlignVCenter);
    marginGrid->addWidget(lastProfitLabel, 3, 3);
    marginGrid->addWidget(_lastProfit, 3, 4, AlignLeft | AlignVCenter);
    marginGrid->addWidget(lastMarginLabel, 3, 6);
    marginGrid->addWidget(_lastMargin, 3, 7, AlignLeft | AlignVCenter);
    marginGrid->addWidget(avgCostLabel, 4, 0);
    marginGrid->addWidget(_avgCost, 4, 1, AlignLeft | AlignVCenter);
    marginGrid->addWidget(avgProfitLabel, 4, 3);
    marginGrid->addWidget(_avgProfit, 4, 4, AlignLeft | AlignVCenter);
    marginGrid->addWidget(avgMarginLabel, 4, 6);
    marginGrid->addWidget(_avgMargin, 4, 7, AlignLeft | AlignVCenter);

    QFrame* box = new QFrame(frame);

    QPushButton* refresh = new QPushButton(tr("&Refresh"), box);
    refresh->setMinimumSize(refresh->sizeHint());
    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));

    QPushButton* save = new QPushButton(tr("&Save"), box);
    save->setMinimumSize(refresh->sizeHint());
    connect(save, SIGNAL(clicked()), SLOT(slotSave()));

    QPushButton* close = new QPushButton(tr("Cl&ose"), box);
    close->setMinimumSize(refresh->sizeHint());
    connect(close, SIGNAL(clicked()), SLOT(slotClose()));

    QGridLayout* boxGrid = new QGridLayout(box);
    boxGrid->setSpacing(6);
    boxGrid->setMargin(6);
    boxGrid->setColStretch(1, 1);
    boxGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter);
    boxGrid->addWidget(save, 0, 1, AlignRight | AlignVCenter);
    boxGrid->addWidget(close, 0, 2, AlignRight | AlignVCenter);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->addMultiCellWidget(top, 0, 0, 0, 1);
    grid->addWidget(price, 1, 0);
    grid->addWidget(cost, 1, 1);
    grid->addMultiCellWidget(margin, 2, 2, 0, 1);
    grid->addMultiCellWidget(box, 3, 3, 0, 1);

    connect(_item, SIGNAL(validData()), SLOT(slotItemChanged()));
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged()));
    connect(_priceSize, SIGNAL(activated(int)), SLOT(slotPriceSizeChanged()));
    connect(_price, SIGNAL(validData()), SLOT(slotPriceChanged()));
    connect(_priceBase, SIGNAL(validData()), SLOT(slotPriceBaseChanged()));
    connect(_costSize, SIGNAL(activated(int)), SLOT(slotCostSizeChanged()));
    connect(_cost, SIGNAL(validData()), SLOT(slotCostChanged()));
    connect(_costBase, SIGNAL(validData()), SLOT(slotCostBaseChanged()));
    connect(_marginSize, SIGNAL(activated(int)),SLOT(slotMarginSizeChanged()));
    connect(_marginPrice, SIGNAL(validData()), SLOT(slotMarginPriceChanged()));
    connect(_repCost, SIGNAL(validData()), SLOT(slotRepCostChanged()));
    connect(_repProfit, SIGNAL(validData()), SLOT(slotRepProfitChanged()));
    connect(_repMargin, SIGNAL(validData()), SLOT(slotRepMarginChanged()));
    connect(_lastProfit, SIGNAL(validData()), SLOT(slotLastProfitChanged()));
    connect(_lastMargin, SIGNAL(validData()), SLOT(slotLastMarginChanged()));
    connect(_avgProfit, SIGNAL(validData()), SLOT(slotAvgProfitChanged()));
    connect(_avgMargin, SIGNAL(validData()), SLOT(slotAvgMarginChanged()));

    setStoreId(_quasar->defaultStore());
    _item->setFocus();

    setCentralWidget(frame);
    setCaption(tr("Item Margin"));
    finalize();
}
Пример #21
0
void ReadMail::updateView()
{
	Enclosure *ePtr;
	QString mailStringSize;
	QString text, temp;

	mail->read = TRUE;			//mark as read
	inbox = mail->received;

	replyButton->setEnabled(false);
	/*replyButton->removeFrom(bar);
	forwardButton->removeFrom(mailMenu);
	forwardButton->removeFrom(bar);*/
	downloadButton->removeFrom(bar);

	//downloadButton->setEnabled(!mail->downloaded);


	if (inbox == TRUE) {
		replyButton->setEnabled(true);
		/*replyButton->addTo(mailMenu);
		forwardButton->addTo(bar);
		forwardButton->addTo(mailMenu);*/


		if (!mail->downloaded) {

			downloadButton->addTo(bar);

			//report currently viewed mail so that it will be
			//placed first in the queue of new mails to download
			emit viewingMail(mail);

			double mailSize = (double) mail->size;
			if (mailSize < 1024) {
				mailStringSize.setNum(mailSize);
				mailStringSize += " Bytes";
			} else if (mailSize < 1024*1024) {
				mailStringSize.setNum( (mailSize / 1024), 'g', 2 );
				mailStringSize += " Kb";
			} else {
				mailStringSize.setNum( (mailSize / (1024*1024)), 'g', 3);
				mailStringSize += " Mb";
			}
		}
	}

	QMimeSourceFactory *mime = emailView->mimeSourceFactory();

	if (! plainTxt) {						//use RichText, inline pics etc.
		emailView->setTextFormat(QTextView::RichText);
		text = "<b><big><center><font color=\"blue\">" + mail->subject
			+"</font></center></big></b><br>";
		text += "<b>From: </b>" + mail->from + " <i>" +
			mail->fromMail + "</i><br>";

		text +="<b>To: </b>";
	        for (QStringList::Iterator it = mail->recipients.begin();
	        	it != mail->recipients.end(); ++it ) {
			text += *it + " ";
		}

		text +="<br><b>CC: </b>";
	        for (QStringList::Iterator it = mail->carbonCopies.begin();
	        	it != mail->carbonCopies.end(); ++it ) {
			text += *it + " ";
		}

		text += "<br>"  + mail->date;

		if (mail->files.count() > 0) {
			text += "<br><b>Attatchments: </b>";

			for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
				text += ePtr->originalName + " ";
			}
			text += "<hr><br>" + mail->body;

			if (inbox) {
				for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {

					text += "<br><hr><b>Attatchment: </b>" +
						ePtr->originalName + "<hr>";

					if (ePtr->contentType == "TEXT") {
						QFile f(ePtr->path + ePtr->name);

						if (f.open(IO_ReadOnly) ) {
							QTextStream t(&f);
							temp = t.read();
							text += temp + "<br>";
							f.close();
						} else {
							text += "<b>Could not locate file</b><br>";
						}

					}
					if (ePtr->contentType == "IMAGE") {
//						temp.setNum(emailView->width());	//get display width
//						text += "<img width=" + temp +" src =""" +
//							ePtr->originalName + """> </img>";
						text += "<img src =""" +
							ePtr->originalName + """> </img>";
						mime->setPixmap(ePtr->originalName, QPixmap( (ePtr->path + ePtr->name) ));
					}
				}
			}
		} else {
			if (mail->downloaded || !inbox) {
				text += "<hr><br>" + mail->body;
			} else {
				text += "<hr><br><b> Awaiting download </b><br>";
				text += "Size of mail: " + mailStringSize;
			}
		}
		emailView->setText(text);
	} else {										// show plain txt mail
		emailView->setTextFormat(QTextView::PlainText);
		text = "Subject: " + mail->subject + "\n";
		text += "From: " + mail->from + " " + mail->fromMail + "\n";
		text += "To: ";
	        for (QStringList::Iterator it = mail->recipients.begin();
	        	it != mail->recipients.end(); ++it ) {
			text += *it + " ";
		}

		text += "\nCC: ";
	        for (QStringList::Iterator it = mail->carbonCopies.begin();
	        	it != mail->carbonCopies.end(); ++it ) {
			text += *it + " ";
		}


		text += "\nDate: " + mail->date + "\n";
		if (mail->files.count() > 0) {
			text += "Attatchments: ";
			for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
				text += ePtr->originalName + " ";
			}
			text += "\n\n";
		} else text += "\n";

		if (!inbox) {
			text += mail->body;
		} else if (mail->downloaded) {
			text += mail->bodyPlain;
		} else {
			text += "\nAwaiting download\n";
			text += "Size of mail: " + mailStringSize;
		}

		emailView->setText(text);
	}

	if (mail->files.count() == 0)
		attachmentButton->setEnabled(FALSE);
	else attachmentButton->setEnabled(TRUE);

	setCaption("Examining mail: " + mail->subject);
}
Пример #22
0
GofunAbout::GofunAbout()
{
	setCaption(tr("GoFun About"));
	
	//This is the main grid
	QGridLayout* grid = new QGridLayout(this,4,1);
	grid->setMargin(2);
	
	//This is the 'propaganda' part ;)
	QLabel* left_propaganda = new QLabel(tr("The GNU"),this);
	left_propaganda->setAlignment(Qt::AlignCenter);
	QFont font;
	font.setBold(true);
	left_propaganda->setFont(font);
	QLabel* right_propaganda = new QLabel(tr("Fun Extension"),this);
	right_propaganda->setAlignment(Qt::AlignCenter);
	right_propaganda->setFont(font);
	QLabel* logo_label = new QLabel(this);
	logo_label->setPixmap(QImage("gofun.png").scale(100,100,QImage::ScaleMin));
	logo_label->setAlignment(Qt::AlignHCenter);
	QHBoxLayout* propaganda_layout = new QHBoxLayout;
	propaganda_layout->addWidget(left_propaganda);
	propaganda_layout->addWidget(logo_label);
	propaganda_layout->addWidget(right_propaganda);
	
	//In this group-box licensing information is presented
	QGroupBox* gb_gpl = new QGroupBox(tr("License"),this);
	gb_gpl->setColumnLayout(0, Qt::Vertical );
	gb_gpl->layout()->setSpacing( 6 );
	gb_gpl->layout()->setMargin( 5 );
	
	//In this group-box the credits are shown
	QGroupBox* gb_credits = new QGroupBox(tr("Credits"),this);
	gb_credits->setColumnLayout(0, Qt::Vertical );
	gb_credits->layout()->setSpacing( 6 );
	gb_credits->layout()->setMargin( 5 );
	
	//In this group-box contact and link information is presented
	QGroupBox* gb_cl = new QGroupBox(tr("Contact and links"),this);
	gb_cl->setColumnLayout(0, Qt::Vertical );
	gb_cl->layout()->setSpacing( 6 );
	gb_cl->layout()->setMargin( 5 );
	
	//The following layouts are used inside the group-boxes
	QGridLayout* grid_gpl = new QGridLayout(gb_gpl->layout(),1,1);
	QGridLayout* grid_credits = new QGridLayout(gb_credits->layout(),1,1);
	QGridLayout* grid_cl = new QGridLayout(gb_cl->layout(),2,2);
	
	//Create the text-fields and load the appropriate texts
	QTextEdit* t_gpl = new QTextEdit(gb_gpl);
	t_gpl->setReadOnly(true);
	t_gpl->setText(getFileText("../doc/gofun/COPYING"));
	QTextEdit* t_credits = new QTextEdit(gb_credits);
	t_credits->setReadOnly(true);
	t_credits->setText(getFileText("../doc/gofun/AUTHORS"));
		
	//This is our close-button
	QPushButton* close = new QPushButton(tr("Close"),this);
	connect(close,SIGNAL(clicked()),this,SLOT(hide()));
	
	grid->addLayout(propaganda_layout,0,0);
	grid->addWidget(gb_gpl,1,0);
	grid->addWidget(gb_credits,2,0);
	grid->addWidget(gb_cl,3,0);
	grid->addWidget(close,4,0);
		
	grid_gpl->addWidget(t_gpl,0,0);
	grid_credits->addWidget(t_credits,0,0);
	
	grid_cl->addWidget(new QLabel(tr("Homepage:"),gb_cl),0,0);
	grid_cl->addWidget(new QLabel(" http://gofun.berlios.de/\n",gb_cl),0,1);
	grid_cl->addWidget(new QLabel(tr("E-Mail:"),gb_cl),1,0);
	grid_cl->addWidget(new QLabel(" [email protected]",gb_cl),1,1);
}
AddCallerIdSource::AddCallerIdSource(QString *hostname,int *host_id,
		 QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  add_hostname=hostname;
  add_host_id=host_id;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumWidth(sizeHint().width());
  setMaximumHeight(sizeHint().height());

  setCaption("Call Administrator - Add CallerID Source");

  //
  // Create Fonts
  //
  QFont label_font=QFont("Helvetica",12,QFont::Bold);
  label_font.setPixelSize(12);
  QFont font=QFont("Helvetica",12,QFont::Normal);
  font.setPixelSize(12);

  //
  // Host Name
  //
  add_hostname_edit=new QLineEdit(this,"add_hostname_edit");
  add_hostname_edit->setGeometry(80,10,sizeHint().width()-90,20);
  add_hostname_edit->setFont(font);
  add_hostname_edit->setMaxLength(255);
  QLabel *label=
    new QLabel(add_hostname_edit,"&Hostname:",this,"add_hostname_label");
  label->setGeometry(10,10,65,20);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  label->setFont(label_font);

  //
  // Host ID
  //
  add_hostid_spin=new QSpinBox(this,"add_hostid_spin");
  add_hostid_spin->setGeometry(80,32,40,20);
  add_hostid_spin->setRange(1,ML_MAX_CALLERID_SOURCES);
  label=new QLabel(add_hostid_spin,"&Source #:",this,"add_hostid_label");
  label->setGeometry(10,32,65,20);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  label->setFont(label_font);

  //
  //  OK Button
  //
  QPushButton *button=new QPushButton(this,"ok_button");
  button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  button->setDefault(true);
  button->setFont(label_font);
  button->setText("&OK");
  connect(button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  //  Cancel Button
  //
  button=new QPushButton(this,"cancel_button");
  button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50);
  button->setFont(label_font);
  button->setText("&Cancel");
  connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
}
Пример #24
0
UserMaster::UserMaster(MainWindow* main, Id user_id)
    : DataWindow(main, "UserMaster", user_id)
{
    _helpSource = "user_master.html";

    // Create widgets
    QLabel* nameLabel = new QLabel(tr("User Name:"), _frame);
    _name = new LineEdit(16, _frame);
    nameLabel->setBuddy(_name);

    _newPassword = new QCheckBox(tr("Change Password?"), _frame);
    connect(_newPassword, SIGNAL(toggled(bool)), SLOT(slotToggled(bool)));

    QLabel* passwordLabel = new QLabel(tr("Password:"******"Confirm:"), _frame);
    _confirm = new LineEdit(16, _frame);
    _confirm->setEchoMode(QLineEdit::Password);
    confirmLabel->setBuddy(_confirm);

    QLabel* storeLabel = new QLabel(tr("Default Store:"), _frame);
    _store = new LookupEdit(new StoreLookup(_main, this), _frame);
    storeLabel->setBuddy(_store);

    QLabel* employeeLabel = new QLabel(tr("Default Employee:"), _frame);
    _employee = new LookupEdit(new EmployeeLookup(_main, this), _frame);
    employeeLabel->setBuddy(_employee);

    QLabel* securityLabel = new QLabel(tr("Security Type:"), _frame);
    _security = new LookupEdit(new SecurityTypeLookup(_main, this), _frame);
    securityLabel->setBuddy(_security);

    QLabel* screenLabel = new QLabel(tr("Screen:"), _frame);
    _screen = new ComboBox(_frame);
    screenLabel->setBuddy(_screen);

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(_newPassword, 1, 1, 0, 1, AlignLeft|AlignVCenter);
    grid->addWidget(passwordLabel, 2, 0);
    grid->addWidget(_password, 2, 1, AlignLeft | AlignVCenter);
    grid->addWidget(confirmLabel, 3, 0);
    grid->addWidget(_confirm, 3, 1, AlignLeft | AlignVCenter);
    grid->addWidget(storeLabel, 4, 0);
    grid->addWidget(_store, 4, 1, AlignLeft | AlignVCenter);
    grid->addWidget(employeeLabel, 5, 0);
    grid->addWidget(_employee, 5, 1, AlignLeft | AlignVCenter);
    grid->addWidget(securityLabel, 6, 0);
    grid->addWidget(_security, 6, 1, AlignLeft | AlignVCenter);
    grid->addWidget(screenLabel, 7, 0);
    grid->addWidget(_screen, 7, 1, AlignLeft | AlignVCenter);

    // Get screen filenames
    QStringList fileNames;
    _quasar->resourceList("screens", fileNames);
    _screen->insertItem("");
    _screen->insertStringList(fileNames);

    if (user_id == INVALID_ID)
	_newPassword->hide();

    setCaption(tr("User Master"));
    finalize();
}
/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void ListViewEditorBase::languageChange()
{
    setCaption( tr( "Edit Listview" ) );
    QWhatsThis::add( this, tr( "<b>Edit Listview</b><p>Use the controls on the <b>Items</b>-tab to add, edit or delete items in the listview. Change the column configuration of the listview using the controls on the <b>Columns</b>-tab.</p>Click the <b>New Item</b>-button to create a new item, then enter text and add a pixmap.</p><p>Select an item from the list and click the <b>Delete Item</b>-button to remove the item from the list.</p>" ) );
    itemDelete->setText( tr( "&Delete Item" ) );
    QToolTip::add( itemDelete, tr( "Delete item" ) );
    QWhatsThis::add( itemDelete, tr( "<b>Deletes the selected item.</b><p>Any sub-items are also deleted.</p>" ) );
    GroupBox1->setTitle( tr( "Item Properties" ) );
    Label2->setText( tr( "Pi&xmap:" ) );
    Label1->setText( tr( "&Text:" ) );
    QToolTip::add( itemText, tr( "Change text" ) );
    QWhatsThis::add( itemText, tr( "<b>Change the text of the item.</b><p>The text will be changed in the current column of the selected item.</p>" ) );
    QToolTip::add( itemColumn, tr( "Change column" ) );
    QWhatsThis::add( itemColumn, tr( "<b>Select the current column.</b><p>The item's text and pixmap will be changed for the current column</p>" ) );
    Label4->setText( tr( "Colu&mn:" ) );
    itemPixmap->setText( tr( "Label4" ) );
    itemDeletePixmap->setText( QString::null );
    QToolTip::add( itemDeletePixmap, tr( "Delete Pixmap" ) );
    QWhatsThis::add( itemDeletePixmap, tr( "<b>Delete the selected item's pixmap.</b><p>The pixmap in the current column of the selected item will be deleted.</p>" ) );
    itemChoosePixmap->setText( tr( "..." ) );
    QToolTip::add( itemChoosePixmap, tr( "Select a Pixmap" ) );
    QWhatsThis::add( itemChoosePixmap, tr( "<b>Select a pixmap file for the item.</b><p>The pixmap will be changed in the current column of the selected item.</p>" ) );
    itemNew->setText( tr( "&New Item" ) );
    QToolTip::add( itemNew, tr( "Add an item" ) );
    QWhatsThis::add( itemNew, tr( "<b>Adds a new item to the list.</b><p>The item will be inserted at the top of the list and can be moved using the up- and down-buttons.</p>" ) );
    QWhatsThis::add( itemsPreview, tr( "The list of items." ) );
    itemNewSub->setText( tr( "New &Subitem" ) );
    QToolTip::add( itemNewSub, tr( "Add a subitem" ) );
    QWhatsThis::add( itemNewSub, tr( "<b>Create a new sub-item for the selected item.</b><p>New sub-items are inserted at the top of the list of sub-items, and new levels are created automatically.</p>" ) );
    itemUp->setText( QString::null );
    QToolTip::add( itemUp, tr( "Move up" ) );
    QWhatsThis::add( itemUp, tr( "<b>Move the selected item up.</b><p>The item will be moved within its level in the hierarchy.</p>" ) );
    itemDown->setText( QString::null );
    QToolTip::add( itemDown, tr( "Move down" ) );
    QWhatsThis::add( itemDown, tr( "<b>Move the selected item down.</b><p>The item will be moved within its level in the hierarchy.</p>" ) );
    itemLeft->setText( QString::null );
    QToolTip::add( itemLeft, tr( "Move left" ) );
    QWhatsThis::add( itemLeft, tr( "<b>Move the selected item one level up.</b><p>This will also change the level of the item's sub-items.</p>" ) );
    itemRight->setText( QString::null );
    QToolTip::add( itemRight, tr( "Move right" ) );
    QWhatsThis::add( itemRight, tr( "<b>Move the selected item one level down.</b><p>This will also change the level of the item's sub-items.</p>" ) );
    tabWidget->changeTab( Widget10, tr( "&Items" ) );
    GroupBox1_2->setTitle( tr( "Column Properties" ) );
    Label2_2->setText( tr( "&Pixmap:" ) );
    colPixmap->setText( tr( "Label4" ) );
    colDeletePixmap->setText( QString::null );
    QToolTip::add( colDeletePixmap, tr( "Delete Pixmap" ) );
    QWhatsThis::add( colDeletePixmap, tr( "Delete the pixmap of the selected column." ) );
    colChoosePixmap->setText( tr( "..." ) );
    QToolTip::add( colChoosePixmap, tr( "Select a Pixmap" ) );
    QWhatsThis::add( colChoosePixmap, tr( "<b>Select a pixmap file for the selected column.</b><p>The pixmap will be displayed in the header of the listview.</p>" ) );
    Label1_2->setText( tr( "&Text:" ) );
    QToolTip::add( colText, tr( "Enter column text" ) );
    QWhatsThis::add( colText, tr( "<b>Enter the text for the selected column.</b><p>The text will be displayed in the header of the listview.</p>" ) );
    colClickable->setText( tr( "Clicka&ble" ) );
    QWhatsThis::add( colClickable, tr( "If this option is checked, the selected column will react to mouse clicks on the header." ) );
    colResizable->setText( tr( "Re&sizable" ) );
    QWhatsThis::add( colResizable, tr( "The column's width will be resizable if this option is checked." ) );
    colDelete->setText( tr( "&Delete Column" ) );
    QToolTip::add( colDelete, tr( "Delete column" ) );
    QWhatsThis::add( colDelete, tr( "Deletes the selected Column." ) );
    colDown->setText( QString::null );
    QToolTip::add( colDown, tr( "Move down" ) );
    QWhatsThis::add( colDown, tr( "<b>Move the selected item down.</b><p>The top-most column will be the first column in the list.</p>" ) );
    colNew->setText( tr( "&New Column" ) );
    QToolTip::add( colNew, tr( "Add a Column" ) );
    QWhatsThis::add( colNew, tr( "<b>Create a new column.</b><p>New columns are appended at the end of (right of) the list and may be moved using the up- and down-buttons.</p>" ) );
    colUp->setText( QString::null );
    QToolTip::add( colUp, tr( "Move up" ) );
    QWhatsThis::add( colUp, tr( "<b>Move the selected item up.</b><p>The top-most column will be the first column in the list.</p>" ) );
    QWhatsThis::add( colPreview, tr( "The list of columns." ) );
    tabWidget->changeTab( Widget11, tr( "Co&lumns" ) );
    helpButton->setText( tr( "&Help" ) );
    applyButton->setText( tr( "&Apply" ) );
    QWhatsThis::add( applyButton, tr( "Apply all changes." ) );
    okButton->setText( tr( "&OK" ) );
    QWhatsThis::add( okButton, tr( "Close the dialog and apply all the changes." ) );
    cancelButton->setText( tr( "&Cancel" ) );
    QWhatsThis::add( cancelButton, tr( "Close the dialog and discard any changes." ) );
}
Пример #26
0
salesOrderList::salesOrderList( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) : QDialog( parent, name, modal, fl )
{
  if ( !name )
    setName( "salesOrderList" );

  _soheadid = -1;
  _type = (cSoOpen | cSoClosed | cSoReleased);

  setCaption(tr("Sales Orders"));

  Q3VBoxLayout *mainLayout = new Q3VBoxLayout(this, 5, 5, "mainLayout"); 
  Q3VBoxLayout *warehouseLayout = new Q3VBoxLayout(0, 0, 0, "warehouseLayout"); 
  Q3HBoxLayout *topLayout = new Q3HBoxLayout( 0, 0, 7, "topLayout"); 
  Q3VBoxLayout *buttonsLayout = new Q3VBoxLayout(0, 0, 5, "buttonsLayout");
  Q3VBoxLayout *listLayout = new Q3VBoxLayout( 0, 0, 0, "listLayout"); 

  _warehouse = new WarehouseGroup(this, "_warehouse");
  warehouseLayout->addWidget(_warehouse);

  QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred);
  warehouseLayout->addItem(spacer);
  topLayout->addLayout(warehouseLayout);

  QSpacerItem* spacer_2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
  topLayout->addItem(spacer_2);

  _close = new QPushButton(tr("&Cancel"), this, "_close");
  buttonsLayout->addWidget(_close);

  _select = new QPushButton(tr("&Select"), this, "_select");
  _select->setEnabled( FALSE );
  _select->setDefault( TRUE );
  buttonsLayout->addWidget(_select);
  topLayout->addLayout(buttonsLayout);
  mainLayout->addLayout(topLayout);

  QLabel *_salesOrdersLit = new QLabel(tr("Sales Orders:"), this, "_salesOrdersLit");
  listLayout->addWidget(_salesOrdersLit);

  _so = new XTreeWidget(this);
  _so->setName("_so");
  listLayout->addWidget(_so);
  mainLayout->addLayout(listLayout);

  resize( QSize(490, 390).expandedTo(minimumSizeHint()) );

  connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) );
  connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) );
  connect( _so, SIGNAL( itemSelected(int) ), _select, SLOT( animateClick() ) );
  connect( _so, SIGNAL( valid(bool) ), _select, SLOT( setEnabled(bool) ) );
  connect( _warehouse, SIGNAL(updated()), this, SLOT( sFillList() ) );

  _so->addColumn(tr("Order #"),   _orderColumn, Qt::AlignLeft   );
  _so->addColumn(tr("Customer"),  -1,           Qt::AlignLeft   );
  _so->addColumn(tr("P/O #"),     _orderColumn, Qt::AlignLeft   );
  _so->addColumn(tr("Ordered"),   _dateColumn,  Qt::AlignCenter );
  _so->addColumn(tr("Scheduled"), _dateColumn,  Qt::AlignCenter );

  setTabOrder(_warehouse, _so);
  setTabOrder(_so, _select);
  setTabOrder(_select, _close);
  setTabOrder(_close, _warehouse);
  _warehouse->setFocus();
}
Пример #27
0
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
bool AdActor::loadBuffer(byte *buffer, bool complete) {
	TOKEN_TABLE_START(commands)
	TOKEN_TABLE(ACTOR)
	TOKEN_TABLE(X)
	TOKEN_TABLE(Y)
	TOKEN_TABLE(TEMPLATE)
	TOKEN_TABLE(NAME)
	TOKEN_TABLE(SCALABLE)
	TOKEN_TABLE(REGISTRABLE)
	TOKEN_TABLE(INTERACTIVE)
	TOKEN_TABLE(SHADOWABLE)
	TOKEN_TABLE(COLORABLE)
	TOKEN_TABLE(ACTIVE)
	TOKEN_TABLE(WALK)
	TOKEN_TABLE(STAND)
	TOKEN_TABLE(TALK_SPECIAL)
	TOKEN_TABLE(TALK)
	TOKEN_TABLE(TURN_LEFT)
	TOKEN_TABLE(TURN_RIGHT)
	TOKEN_TABLE(EVENTS)
	TOKEN_TABLE(FONT)
	TOKEN_TABLE(CURSOR)
	TOKEN_TABLE(SCRIPT)
	TOKEN_TABLE(SOUND_VOLUME)
	TOKEN_TABLE(SOUND_PANNING)
	TOKEN_TABLE(CAPTION)
	TOKEN_TABLE(PROPERTY)
	TOKEN_TABLE(BLOCKED_REGION)
	TOKEN_TABLE(WAYPOINTS)
	TOKEN_TABLE(IGNORE_ITEMS)
	TOKEN_TABLE(ROTABLE)
	TOKEN_TABLE(ROTATABLE)
	TOKEN_TABLE(ALPHA_COLOR)
	TOKEN_TABLE(SCALE)
	TOKEN_TABLE(RELATIVE_SCALE)
	TOKEN_TABLE(ALPHA)
	TOKEN_TABLE(EDITOR_PROPERTY)
	TOKEN_TABLE(ANIMATION)
	TOKEN_TABLE_END

	byte *params;
	int cmd;
	BaseParser parser;

	if (complete) {
		if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ACTOR) {
			_gameRef->LOG(0, "'ACTOR' keyword expected.");
			return STATUS_FAILED;
		}
		buffer = params;
	}

	AdGame *adGame = (AdGame *)_gameRef;
	AdSpriteSet *spr = NULL;
	int ar = 0, ag = 0, ab = 0, alpha = 0;
	while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
		switch (cmd) {
		case TOKEN_TEMPLATE:
			if (DID_FAIL(loadFile((char *)params))) {
				cmd = PARSERR_GENERIC;
			}
			break;

		case TOKEN_X:
			parser.scanStr((char *)params, "%d", &_posX);
			break;

		case TOKEN_Y:
			parser.scanStr((char *)params, "%d", &_posY);
			break;

		case TOKEN_NAME:
			setName((char *)params);
			break;

		case TOKEN_CAPTION:
			setCaption((char *)params);
			break;

		case TOKEN_FONT:
			setFont((char *)params);
			break;

		case TOKEN_SCALABLE:
			parser.scanStr((char *)params, "%b", &_zoomable);
			break;

		case TOKEN_ROTABLE:
		case TOKEN_ROTATABLE:
			parser.scanStr((char *)params, "%b", &_rotatable);
			break;

		case TOKEN_REGISTRABLE:
		case TOKEN_INTERACTIVE:
			parser.scanStr((char *)params, "%b", &_registrable);
			break;

		case TOKEN_SHADOWABLE:
		case TOKEN_COLORABLE:
			parser.scanStr((char *)params, "%b", &_shadowable);
			break;

		case TOKEN_ACTIVE:
			parser.scanStr((char *)params, "%b", &_active);
			break;

		case TOKEN_WALK:
			delete _walkSprite;
			_walkSprite = NULL;
			spr = new AdSpriteSet(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texWalkLifeTime, CACHE_HALF))) {
				cmd = PARSERR_GENERIC;
			} else {
				_walkSprite = spr;
			}
			break;

		case TOKEN_TALK:
			spr = new AdSpriteSet(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) {
				cmd = PARSERR_GENERIC;
			} else {
				_talkSprites.add(spr);
			}
			break;

		case TOKEN_TALK_SPECIAL:
			spr = new AdSpriteSet(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) {
				cmd = PARSERR_GENERIC;
			} else {
				_talkSpritesEx.add(spr);
			}
			break;

		case TOKEN_STAND:
			delete _standSprite;
			_standSprite = NULL;
			spr = new AdSpriteSet(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texStandLifeTime))) {
				cmd = PARSERR_GENERIC;
			} else {
				_standSprite = spr;
			}
			break;

		case TOKEN_TURN_LEFT:
			delete _turnLeftSprite;
			_turnLeftSprite = NULL;
			spr = new AdSpriteSet(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadBuffer(params, true))) {
				cmd = PARSERR_GENERIC;
			} else {
				_turnLeftSprite = spr;
			}
			break;

		case TOKEN_TURN_RIGHT:
			delete _turnRightSprite;
			_turnRightSprite = NULL;
			spr = new AdSpriteSet(_gameRef, this);
			if (!spr || DID_FAIL(spr->loadBuffer(params, true))) {
				cmd = PARSERR_GENERIC;
			} else {
				_turnRightSprite = spr;
			}
			break;

		case TOKEN_SCRIPT:
			addScript((char *)params);
			break;

		case TOKEN_CURSOR:
			delete _cursor;
			_cursor = new BaseSprite(_gameRef);
			if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
				delete _cursor;
				_cursor = NULL;
				cmd = PARSERR_GENERIC;
			}
			break;

		case TOKEN_SOUND_VOLUME:
			parser.scanStr((char *)params, "%d", &_sFXVolume);
			break;

		case TOKEN_SCALE: {
			int s;
			parser.scanStr((char *)params, "%d", &s);
			_scale = (float)s;

		}
		break;

		case TOKEN_RELATIVE_SCALE: {
			int s;
			parser.scanStr((char *)params, "%d", &s);
			_relativeScale = (float)s;

		}
		break;

		case TOKEN_SOUND_PANNING:
			parser.scanStr((char *)params, "%b", &_autoSoundPanning);
			break;

		case TOKEN_PROPERTY:
			parseProperty(params, false);
			break;

		case TOKEN_BLOCKED_REGION: {
			delete _blockRegion;
			delete _currentBlockRegion;
			_blockRegion = NULL;
			_currentBlockRegion = NULL;
			BaseRegion *rgn = new BaseRegion(_gameRef);
			BaseRegion *crgn = new BaseRegion(_gameRef);
			if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) {
				delete _blockRegion;
				delete _currentBlockRegion;
				_blockRegion = NULL;
				_currentBlockRegion = NULL;
				cmd = PARSERR_GENERIC;
			} else {
				_blockRegion = rgn;
				_currentBlockRegion = crgn;
				_currentBlockRegion->mimic(_blockRegion);
			}
		}
		break;

		case TOKEN_WAYPOINTS: {
			delete _wptGroup;
			delete _currentWptGroup;
			_wptGroup = NULL;
			_currentWptGroup = NULL;
			AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef);
			AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef);
			if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) {
				delete _wptGroup;
				delete _currentWptGroup;
				_wptGroup = NULL;
				_currentWptGroup = NULL;
				cmd = PARSERR_GENERIC;
			} else {
				_wptGroup = wpt;
				_currentWptGroup = cwpt;
				_currentWptGroup->mimic(_wptGroup);
			}
		}
		break;

		case TOKEN_IGNORE_ITEMS:
			parser.scanStr((char *)params, "%b", &_ignoreItems);
			break;

		case TOKEN_ALPHA_COLOR:
			parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab);
			break;

		case TOKEN_ALPHA:
			parser.scanStr((char *)params, "%d", &alpha);
			break;

		case TOKEN_EDITOR_PROPERTY:
			parseEditorProperty(params, false);
			break;

		case TOKEN_ANIMATION: {
			AdSpriteSet *anim = new AdSpriteSet(_gameRef, this);
			if (!anim || DID_FAIL(anim->loadBuffer(params, false))) {
				cmd = PARSERR_GENERIC;
			} else {
				_anims.add(anim);
			}
		}
		break;
		}
	}
	if (cmd == PARSERR_TOKENNOTFOUND) {
		_gameRef->LOG(0, "Syntax error in ACTOR definition");
		return STATUS_FAILED;
	}
	if (cmd == PARSERR_GENERIC) {
		if (spr) {
			delete spr;
		}
		_gameRef->LOG(0, "Error loading ACTOR definition");
		return STATUS_FAILED;
	}

	if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
		ar = ag = ab = 255;
	}
	_alphaColor = BYTETORGBA(ar, ag, ab, alpha);
	_state = _nextState = STATE_READY;

	return STATUS_OK;
}
Пример #28
0
accountList::accountList(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) :
  QDialog(parent, name, modal, fl)
{
  if ( !name )
    setName( "accountList" );

  _accntid = -1;
  _type = GLCluster::cUndefined;

  setCaption(tr("Account Numbers"));

  Q3HBoxLayout *accountListLayout = new Q3HBoxLayout( this, 5, 7, "accountListLayout"); 
  Q3VBoxLayout *Layout68 = new Q3VBoxLayout( 0, 0, 0, "Layout68"); 
  Q3VBoxLayout *layout305 = new Q3VBoxLayout( 0, 0, 5, "layout305"); 

  QLabel *accountsLit = new QLabel(tr("Chart of Accounts:"), this, "accountsLit");
  Layout68->addWidget(accountsLit);

  _accnt = new XTreeWidget(this);
  _accnt->setName("_accnt");
  Layout68->addWidget( _accnt );
  accountListLayout->addLayout( Layout68 );

  _close = new QPushButton(tr("&Cancel"), this, "_close");
  layout305->addWidget( _close );

  _select = new QPushButton(tr("&Select"), this, "_select");
  _select->setAutoDefault( TRUE );
  _select->setDefault( TRUE );
  layout305->addWidget( _select );

  _clear = new QPushButton(tr("C&lear"), this, "_clear");
  layout305->addWidget( _clear );
  QSpacerItem* spacer = new QSpacerItem( 20, 269, QSizePolicy::Minimum, QSizePolicy::Expanding );
  layout305->addItem( spacer );
  accountListLayout->addLayout( layout305 );

  resize( QSize(571, 351).expandedTo(minimumSizeHint()) );
  //clearWState( WState_Polished );

  connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) );
  connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) );
  connect( _accnt, SIGNAL( itemSelected(int) ), this, SLOT( sSelect() ) );
  connect( _clear, SIGNAL( clicked() ), this, SLOT( sClear() ) );

  if (_x_metrics)
  {
    if (_x_metrics->value("GLCompanySize").toInt() > 0)
      _accnt->addColumn(tr("Company"), 50, Qt::AlignCenter);

    if (_x_metrics->value("GLProfitSize").toInt() > 0)
      _accnt->addColumn(tr("Profit"), 50, Qt::AlignCenter);
  }

  _accnt->addColumn(tr("Account Number"), 100, Qt::AlignCenter);

  if (_x_metrics)
  {
    if (_x_metrics->value("GLSubaccountSize").toInt() > 0)
      _accnt->addColumn(tr("Sub."), 50, Qt::AlignCenter);
  }

  _accnt->addColumn(tr("Description"), -1, Qt::AlignLeft);
}
Пример #29
0
/*
 * This is the constructor for the main widget. It sets up the menu and the
 * TaskMan widget.
 */
TopLevel::TopLevel(QWidget *parent, const char *name, int sfolder)
	: KTMainWindow(name)
{
	/*
	 * create main menu
	 */

	menubar = new MainMenu(this, "MainMenu");
	connect(menubar, SIGNAL(quit()), this, SLOT(quitSlot()));
	// register the menu bar with KTMainWindow
	setMenu(menubar);

	statusbar = new KStatusBar(this, "statusbar");
	statusbar->insertItem(i18n("88888 Processes"), 0);
	statusbar->insertItem(i18n("Memory: 888888 kB used, "
							   "888888 kB free"), 1);
	statusbar->insertItem(i18n("Swap: 888888 kB used, "
							   "888888 kB free"), 2);
	setStatusBar(statusbar);
	// call timerEvent to fill the status bar with real values
	timerEvent(0);

	assert(Kapp);
	setCaption(i18n("KDE Task Manager"));

	// create the tab dialog
	taskman = new TaskMan(this, "", sfolder);

	// register the tab dialog with KTMainWindow as client widget
	setView(taskman);

	connect(taskman, SIGNAL(enableRefreshMenu(bool)),
			menubar, SLOT(enableRefreshMenu(bool)));

	setMinimumSize(KTOP_MIN_W, KTOP_MIN_H);

	/*
	 * Restore size of the dialog box that was used at end of last session.
	 * Due to a bug in Qt we need to set the width to one more than the
	 * defined min width. If this is not done the widget is not drawn
	 * properly the first time. Subsequent redraws after resize are no problem.
	 *
	 * I need to implement some propper session management some day!
	 */
	QString t = Kapp->getConfig()->readEntry(QString("G_Toplevel"));
	if(!t.isNull())
	{
		if (t.length() == 19)
		{ 
			int xpos, ypos, ww, wh;
			sscanf(t.data(), "%04d:%04d:%04d:%04d", &xpos, &ypos, &ww, &wh);
			setGeometry(xpos, ypos,
						ww <= KTOP_MIN_W ? KTOP_MIN_W + 1 : ww,
						wh <= KTOP_MIN_H ? KTOP_MIN_H : wh);
		}
	}

	readProperties(Kapp->getConfig());

	timerID = startTimer(2000);

	// show the dialog box
    show();

	// switch to the selected startup page
    taskman->raiseStartUpPage();
}
Пример #30
0
EditSchedCode::EditSchedCode(QString schedCode,QString description,QWidget *parent,const char *name) : QDialog(parent,name,true)
{
  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  schedCode_code=new QString(schedCode);
  schedCode_description=new QString(description);
  
  setCaption(tr("Scheduler Code: ")+schedCode);

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Text Validators
  //
  RDTextValidator *validator=new RDTextValidator(this,"validator");
  //
  // Code Name
  //
  schedCode_name_edit=new QLineEdit(this,"schedCode_name_edit");
  schedCode_name_edit->setGeometry(125,11,100,19);
  schedCode_name_edit->setMaxLength(10);
  schedCode_name_edit->setReadOnly(true);
  QLabel *schedCode_name_label=new QLabel(schedCode_name_edit,tr("Scheduler Code:"),this,"schedCode_name_label");
  schedCode_name_label->setGeometry(10,11,110,19);
  schedCode_name_label->setFont(font);
  schedCode_name_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Code Description
  //
  schedCode_description_edit=new QLineEdit(this,"schedCode_description_edit");
  schedCode_description_edit->setGeometry(125,32,sizeHint().width()-135,19);
  schedCode_description_edit->setMaxLength(255);
  schedCode_description_edit->setValidator(validator);
  QLabel *schedCode_description_label=new QLabel(schedCode_description_edit,
					     tr("Code Description:"),this,
					     "schedCode_description_label");
  schedCode_description_label->setGeometry(10,32,110,19);
  schedCode_description_label->setFont(font);
  schedCode_description_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  //  Ok Button
  //
  QPushButton *ok_button=new QPushButton(this,"ok_button");
  ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  ok_button->setDefault(true);
  ok_button->setFont(font);
  ok_button->setText(tr("&OK"));
  connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  //  Cancel Button
  //
  QPushButton *cancel_button=new QPushButton(this,"cancel_button");
  cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  cancel_button->setFont(font);
  cancel_button->setText(tr("&Cancel"));
  connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Populate Fields
  //
  schedCode_name_edit->setText(*schedCode_code);
  schedCode_description_edit->setText(*schedCode_description);
}