void LadspaControlDialog::updateEffectView( LadspaControls * _ctl )
{
	QList<QGroupBox *> list = findChildren<QGroupBox *>();
	for( QList<QGroupBox *>::iterator it = list.begin(); it != list.end();
									++it )
	{
		delete *it;
	}

	m_effectControls = _ctl;


	const int cols = static_cast<int>( sqrt( 
		static_cast<double>( _ctl->m_controlCount /
						_ctl->m_processors ) ) );
	for( ch_cnt_t proc = 0; proc < _ctl->m_processors; proc++ )
	{
		control_list_t & controls = _ctl->m_controls[proc];
		int row = 0;
		int col = 0;
		buffer_data_t last_port = NONE;

		QGroupBox * grouper;
		if( _ctl->m_processors > 1 )
		{
			grouper = new QGroupBox( tr( "Channel " ) +
						QString::number( proc + 1 ),
								this );
		}
		else
		{
			grouper = new QGroupBox( this );
		}

		QGridLayout * gl = new QGridLayout( grouper );
		grouper->setLayout( gl );
		grouper->setAlignment( Qt::Vertical );

		for( control_list_t::iterator it = controls.begin(); 
						it != controls.end(); it++ )
		{
			if( (*it)->port()->proc == proc )
			{
				if( last_port != NONE &&
					(*it)->port()->data_type == TOGGLED &&
					!( (*it)->port()->data_type == TOGGLED && 
							last_port == TOGGLED ) )
				{
					++row;
					col = 0;
				}
				gl->addWidget( new LadspaControlView( grouper, *it ), row, col );
				if( ++col == cols )
				{
					++row;
					col = 0;
				}
				last_port = (*it)->port()->data_type;
			}
		}

		m_effectLayout->addWidget( grouper );
	}

	if( _ctl->m_processors > 1 && m_stereoLink != NULL )
	{
		m_stereoLink->setModel( &_ctl->m_stereoLinkModel );
	}

	connect( _ctl, SIGNAL( effectModelChanged( LadspaControls * ) ),
				this, SLOT( updateEffectView( LadspaControls * ) ),
							Qt::DirectConnection );
}
void SingleWeatherParamWidget::initUI(){
    QWidget *scrollWidget = new QWidget;
    QVBoxLayout *scrollLayout = new QVBoxLayout;
    QLabel *infoLabel = new QLabel;
    infoLabel->setText("<font color='#E10000'>大于等于左侧阀值,小于右侧阀值.<br>如果左侧阀值为空,则大于等于无穷小.<br>如果右侧阀值为空,则小于无穷大.</font>");
    scrollLayout->addWidget(infoLabel);

    editHash.clear();
    QRegExp regExp("^-?(\\d+(\\.\\d{1,2})?)$");
    QRegExpValidator *validator = new QRegExpValidator(regExp, this);
    for(WeatherParam weatherParam : weatherParamList){
        QList<QLineEdit *> editList;
        int key = weatherParam.id();

        QString title = weatherParam.name();
        title = getTitle(title);
        int limitType = weatherParam.limit_type();
        QGridLayout *gridLayout = new QGridLayout;
        //不可飞
        QLabel *bkfLabel = new QLabel;
        bkfLabel->setText("不可飞");
        QLineEdit *bkfLeftEdit = new QLineEdit;
        bkfLeftEdit->setValidator(validator);
        editList.append(bkfLeftEdit);
        QLineEdit *bkfRightEdit = new QLineEdit;
        bkfRightEdit->setValidator(validator);
        editList.append(bkfRightEdit);
        gridLayout->addWidget(bkfLabel, 0, 0);
        gridLayout->addWidget(bkfLeftEdit, 0, 1);
        gridLayout->addWidget(bkfRightEdit, 0, 2);
        //限制可飞
        QLabel *xzkfLabel = new QLabel;
        xzkfLabel->setText("限制可飞");
        QLineEdit *xzkfLeftEdit = new QLineEdit;
        xzkfLeftEdit->setValidator(validator);
        editList.append(xzkfLeftEdit);
        QLineEdit *xzkfRightEdit = new QLineEdit;
        xzkfRightEdit->setValidator(validator);
        editList.append(xzkfRightEdit);
        gridLayout->addWidget(xzkfLabel, 1, 0);
        gridLayout->addWidget(xzkfLeftEdit, 1, 1);
        gridLayout->addWidget(xzkfRightEdit, 1, 2);
        //完全可飞
        QLabel *wqkfLabel = new QLabel;
        wqkfLabel->setText("完全可飞");
        QLineEdit *wqkfLeftEdit = new QLineEdit;
        wqkfLeftEdit->setValidator(validator);
        editList.append(wqkfLeftEdit);
        QLineEdit *wqkfRightEdit = new QLineEdit;
        wqkfRightEdit->setValidator(validator);
        editList.append(wqkfRightEdit);
        gridLayout->addWidget(wqkfLabel, 2, 0);
        gridLayout->addWidget(wqkfLeftEdit, 2, 1);
        gridLayout->addWidget(wqkfRightEdit, 2, 2);

        if (limitType == 2){
            //限制可飞
            QLabel *xzkfLabel = new QLabel;
            xzkfLabel->setText("限制可飞");
            QLineEdit *xzkfLeftEdit = new QLineEdit;
            xzkfLeftEdit->setValidator(validator);
            editList.append(xzkfLeftEdit);
            QLineEdit *xzkfRightEdit = new QLineEdit;
            xzkfRightEdit->setValidator(validator);
            editList.append(xzkfRightEdit);
            gridLayout->addWidget(xzkfLabel, 3, 0);
            gridLayout->addWidget(xzkfLeftEdit, 3, 1);
            gridLayout->addWidget(xzkfRightEdit, 3, 2);
            //不可飞
            QLabel *bkfLabel = new QLabel;
            bkfLabel->setText("不可飞");
            QLineEdit *bkfLeftEdit = new QLineEdit;
            bkfLeftEdit->setValidator(validator);
            editList.append(bkfLeftEdit);
            QLineEdit *bkfRightEdit = new QLineEdit;
            bkfRightEdit->setValidator(validator);
            editList.append(bkfRightEdit);
            gridLayout->addWidget(bkfLabel, 4, 0);
            gridLayout->addWidget(bkfLeftEdit, 4, 1);
            gridLayout->addWidget(bkfRightEdit, 4, 2);
        }
        //group
        QGroupBox *groupBox = new QGroupBox;
        groupBox->setTitle(title);
        groupBox->setAlignment(Qt::AlignLeft);
        groupBox->setLayout(gridLayout);
        //添加group
        scrollLayout->addWidget(groupBox);
        //添加hash
        editHash[key] = editList;
    }

    scrollWidget->setLayout(scrollLayout);
    QScrollArea *scrollArea = new QScrollArea;
    scrollArea->setWidget(scrollWidget);

    confirmButton = new QPushButton;
    confirmButton->setText("确定");

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(scrollArea);
    mainLayout->addWidget(confirmButton);
    this->setLayout(mainLayout);
}
示例#3
0
void BodyLinkViewImpl::setupWidgets()
{
    QHBoxLayout* hbox;
    QVBoxLayout* vbox;
    QGridLayout* grid;

    QWidget* topWidget = new QWidget();
    topWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
    
    QVBoxLayout* topVBox = new QVBoxLayout();
    //topVBox->setContentsMargins(4);
    topWidget->setLayout(topVBox);

    scrollArea.setFrameShape(QFrame::NoFrame);
    scrollArea.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollArea.setWidget(topWidget);
    QVBoxLayout* baseLayout = new QVBoxLayout();
    scrollArea.setWidgetResizable(true);
    baseLayout->addWidget(&scrollArea);
    self->setLayout(baseLayout);

    //nameLabel.setAlignment(Qt::AlignCenter);
    nameLabel.setTextInteractionFlags(Qt::TextSelectableByMouse);
    topVBox->addWidget(&nameLabel, 0, Qt::AlignCenter);
    topVBox->addSpacing(4);

    QFrame* frame = new QFrame();
    topVBox->addWidget(frame);

    grid = new QGridLayout();
    //grid->setContentsMargins(4);
    grid->setVerticalSpacing(4);
    grid->setColumnStretch(1, 1);
    grid->setColumnStretch(3, 1);
    grid->addWidget(new QLabel(_("Index:")), 0, 0);
    grid->addWidget(&linkIndexLabel, 0, 1);
    grid->addWidget(new QLabel(_("Joint ID:")), 0, 2);
    grid->addWidget(&jointIdLabel, 0, 3);
    grid->addWidget(new QLabel(_("Joint Type:")), 1, 0);
    jointTypeLabel.setTextInteractionFlags(Qt::TextSelectableByMouse);
    grid->addWidget(&jointTypeLabel, 1, 1, 1, 3);
    grid->addWidget(new QLabel(_("Joint Axis:")), 2, 0);
    jointAxisLabel.setTextInteractionFlags(Qt::TextSelectableByMouse);
    grid->addWidget(&jointAxisLabel, 2, 1, 1, 3);
    frame->setLayout(grid);

    topVBox->addSpacing(4);

    QGroupBox* linkBox = new QGroupBox();
    linkBox->setTitle(_("Link Position [m],[deg]"));
    linkBox->setAlignment(Qt::AlignCenter);
    vbox = new QVBoxLayout();
    linkBox->setLayout(vbox);

    grid = new QGridLayout();
    //grid->setContentsMargins(4);
    grid->setVerticalSpacing(4);
    vbox->addLayout(grid);
   
    static const char* xyzLabels[] = {"X", "Y", "Z"};

    for(int i=0; i < 3; ++i){
        grid->addWidget(new QLabel(xyzLabels[i], frame), 0, i, Qt::AlignCenter);
        grid->addWidget(&xyzSpin[i], 1, i);

        //xyzSpin[i].set_width_chars(7);
        xyzSpin[i].setAlignment(Qt::AlignCenter);
        xyzSpin[i].setDecimals(4);
        xyzSpin[i].setRange(-99.9999, 99.9999);
        xyzSpin[i].setSingleStep(0.0001);
        
        stateWidgetConnections.add(
            xyzSpin[i].sigValueChanged().connect(
                boost::bind(&BodyLinkViewImpl::onXyzChanged, this)));
    }

    static const char* rpyLabels[] = {"R", "P", "Y"};

    for(int i=0; i < 3; ++i){
        grid->addWidget(new QLabel(rpyLabels[i], frame), 2, i, Qt::AlignCenter);
        grid->addWidget(&rpySpin[i], 3, i);

        rpySpin[i].setAlignment(Qt::AlignCenter);
        rpySpin[i].setDecimals(1);
        rpySpin[i].setRange(-360.0, 360.0);
        rpySpin[i].setSingleStep(0.1);

        stateWidgetConnections.add(
            rpySpin[i].sigValueChanged().connect(
                boost::bind(&BodyLinkViewImpl::onRpyChanged, this)));
    }

    attMatrixCheck.setText(_("Matrix"));
    attMatrixCheck.sigToggled().connect(
        boost::bind(&BodyLinkViewImpl::onAttMatrixCheckToggled, this));
    vbox->addWidget(&attMatrixCheck, 0, Qt::AlignCenter);

    grid = new QGridLayout();
    grid->setHorizontalSpacing(10);
    //grid->setContentsMargins(4);
    grid->setVerticalSpacing(4);

    hbox = new QHBoxLayout();
    attMatrixBox.setLayout(hbox);
    hbox->addStretch();
    hbox->addWidget(new QLabel("R = "));
    hbox->addWidget(new VSeparator());
    hbox->addLayout(grid);
    hbox->addWidget(new VSeparator());
    hbox->addStretch();
    for(int i=0; i < 3; ++i){
        for(int j=0; j < 3; ++j){
            grid->addWidget(&attLabels[i][j], i, j);
            attLabels[i][j].setText("0.0");
        }
    }
    vbox->addWidget(&attMatrixBox);
    attMatrixBox.hide();

    topVBox->addWidget(linkBox);
    topVBox->addSpacing(4);

    qBox.setAlignment(Qt::AlignHCenter);
    topVBox->addWidget(&qBox);
    
    vbox = new QVBoxLayout();
    //vbox->setContentsMargins(4);
    qBox.setLayout(vbox);
    hbox = new QHBoxLayout();
    vbox->addLayout(hbox);
    hbox->addStretch();
    hbox->addWidget(&qMinLabel);
    qSpin.setAlignment(Qt::AlignCenter);
    hbox->addWidget(&qSpin);
    hbox->addWidget(&qMaxLabel);
    hbox->addStretch();

    qSlider.setOrientation(Qt::Horizontal);
    vbox->addWidget(&qSlider);

    stateWidgetConnections.add(
        qSpin.sigValueChanged().connect(
            boost::bind(&BodyLinkViewImpl::on_qSpinChanged, this, _1)));
    
    stateWidgetConnections.add(
        qSlider.sigValueChanged().connect(
            boost::bind(&BodyLinkViewImpl::on_qSliderChanged, this, _1)));

    topVBox->addSpacing(4);
    
    dqBox.setAlignment(Qt::AlignHCenter);
    topVBox->addWidget(&dqBox);
    hbox = new QHBoxLayout();
    //hbox->setContentsMargins(4);

    // min velocity spin
    hbox->addStretch();
    hbox->addWidget(new QLabel(_("min")));
    dqMaxSpin.setAlignment(Qt::AlignCenter);
    hbox->addWidget(&dqMinSpin);

    // velocity label
    hbox->addWidget(&dqLabel);

    // max velocity spin
    dqMinSpin.setAlignment(Qt::AlignCenter);
    hbox->addWidget(&dqMaxSpin);
    hbox->addWidget(new QLabel(_("max")));
    hbox->addStretch();
    dqBox.setLayout(hbox);
    
    propertyWidgetConnections.add(
        dqMinSpin.sigValueChanged().connect(
            boost::bind(&BodyLinkViewImpl::on_dqLimitChanged, this, true)));
    propertyWidgetConnections.add(
        dqMaxSpin.sigValueChanged().connect(
            boost::bind(&BodyLinkViewImpl::on_dqLimitChanged, this, false)));
    
    topVBox->addSpacing(4);

    QGroupBox* collisionBox = new QGroupBox();
    collisionBox->setTitle(_("Collisions"));
    collisionBox->setAlignment(Qt::AlignCenter);
    collisionBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    vbox = new QVBoxLayout();
    collisionBox->setLayout(vbox);
    //vbox->setContentsMargins(4);
    vbox->setSpacing(4);

    worldCollisionsLabel.setTextInteractionFlags(Qt::TextSelectableByMouse);
    worldCollisionsLabel.setAlignment(Qt::AlignCenter);
    worldCollisionsLabel.setWordWrap(true);
    vbox->addWidget(&worldCollisionsLabel);

    hbox = new QHBoxLayout();
    hbox->setSpacing(4);
    hbox->addWidget(new HSeparator(), 1);
    hbox->addWidget(new QLabel(_("Self-Collisions")), 0);
    hbox->addWidget(new HSeparator(), 1);
    vbox->addLayout(hbox);

    selfCollisionsLabel.setTextInteractionFlags(Qt::TextSelectableByMouse);
    selfCollisionsLabel.setAlignment(Qt::AlignCenter);
    selfCollisionsLabel.setWordWrap(true);
    vbox->addWidget(&selfCollisionsLabel);

    topVBox->addWidget(collisionBox);
    topVBox->addSpacing(4);
    
    zmpBox.setTitle(_("ZMP [m]"));
    zmpBox.setAlignment(Qt::AlignCenter);
    
    grid = new QGridLayout();
    //grid->setContentsMargins(4);
    grid->setVerticalSpacing(2);
    zmpBox.setLayout(grid);
   
    for(int i=0; i < 3; ++i){
        grid->addWidget(new QLabel(xyzLabels[i]), 0, i, Qt::AlignCenter);
        grid->addWidget(&zmpXyzSpin[i], 1, i);

        //zmpXyzSpin[i].set_width_chars(7);
        zmpXyzSpin[i].setAlignment(Qt::AlignCenter);
        zmpXyzSpin[i].setDecimals(4);
        zmpXyzSpin[i].setRange(-99.9999, 99.9999);
        zmpXyzSpin[i].setSingleStep(0.0001);

        stateWidgetConnections.add(
            zmpXyzSpin[i].sigValueChanged().connect(
                boost::bind(&BodyLinkViewImpl::onZmpXyzChanged, this)));
    }

    topVBox->addWidget(&zmpBox);
    zmpBox.hide();
}
示例#4
0
MainWindow::MainWindow(QWidget *parent){
    this->setStyleSheet("background:qlineargradient(x1:0 y1:0, x2:0 y2:1,stop:0  #3498db, stop:1 #2980b9); color:white; width:200px;" );
    this->setGeometry(500,250,0,0);
    QVBoxLayout*layout=new QVBoxLayout;
    QLabel* titolo=new QLabel("LinQedIn");
    titolo->setAlignment(Qt::AlignHCenter);
    titolo->setStyleSheet("font: 20pt \"FontAwesome\";" "font-weight:bold;" "background:transparent;" "margin-bottom:20px;" "margin-top:20px;" );

    QGroupBox *groupBoxUtente = new QGroupBox("Login Lato Client");
    groupBoxUtente->setStyleSheet("background:transparent;");
    groupBoxUtente->setAlignment(Qt::AlignHCenter);
    groupBoxUtente->setContentsMargins(5,0,5,0);
    QLabel* labelusernameU=new QLabel(tr("Username"));
    labelusernameU->setAlignment(Qt::AlignHCenter);
    labelusernameU->setStyleSheet("font: 12pt \"Times\";" "margin-top:20px;" "background:transparent;" );
    caselladitestoUserU=new QLineEdit();
    caselladitestoUserU->setStyleSheet("background:white;" "color:black;" );
    QLabel* labelPasswordU=new QLabel(tr("Password"));
    labelPasswordU->setAlignment(Qt::AlignHCenter);
    labelPasswordU->setStyleSheet("font: 12pt \"Times\";" "margin-top:0px;" "background:transparent;" );
    caselladitestoPwU=new QLineEdit();
    caselladitestoPwU->setStyleSheet("background:white;" "color:black;"  "margin-bottom:10px;");
    caselladitestoPwU->setEchoMode(QLineEdit::Password);
    QPushButton* accediU=new QPushButton("Accedi");
    accediU->setStyleSheet("background:#0082b6;");
    QVBoxLayout *vboxU = new QVBoxLayout;
    vboxU->addWidget(labelusernameU);
    vboxU->addWidget(caselladitestoUserU);
    vboxU->addWidget(labelPasswordU);
    vboxU->addWidget(caselladitestoPwU);
    vboxU->addWidget(accediU);
    groupBoxUtente->setLayout(vboxU);

    QGroupBox *groupBoxAdmin = new QGroupBox(tr("Login Lato Admin"));
    groupBoxAdmin->setStyleSheet("background:transparent;");
    QLabel* labelusernameA=new QLabel(tr("Username"));
    labelusernameA->setAlignment(Qt::AlignHCenter);
    labelusernameA->setStyleSheet("font: 12pt \"Times\";" "margin-top:20px;" "background:transparent;" );
    caselladitestoUserA=new QLineEdit();
    caselladitestoUserA->setStyleSheet("background:white;" "color:black;" );
    QLabel* labelPasswordA=new QLabel(tr("Password"));
    labelPasswordA->setAlignment(Qt::AlignHCenter);
    labelPasswordA->setStyleSheet("font: 12pt \"Times\";" "margin-top:0px;" "background:transparent;" );
    caselladitestoPwA=new QLineEdit();
    caselladitestoPwA->setStyleSheet("background:white;" "color:black;"  "margin-bottom:10px;");
    caselladitestoPwA->setEchoMode(QLineEdit::Password);
    QPushButton* accediA=new QPushButton(("Accedi"));
    accediA->setStyleSheet("background:#0082b6;");
    QVBoxLayout *vboxA = new QVBoxLayout;
          vboxA->addWidget(labelusernameA);
          vboxA->addWidget(caselladitestoUserA);
          vboxA->addWidget(labelPasswordA);
          vboxA->addWidget(caselladitestoPwA);
          vboxA->addWidget(accediA);
          groupBoxAdmin->setLayout(vboxA);

    QGridLayout *grid = new QGridLayout;

    grid->addWidget(groupBoxUtente, 0, 0);
    grid->addWidget(groupBoxAdmin, 0, 1);
    connect(accediU,SIGNAL(clicked()),this,SLOT(SlotAutenticationUser()));
    connect(accediA,SIGNAL(clicked()),this,SLOT(SlotAutenticationAdmin()));
    layout->addWidget(titolo);
    layout->addLayout(grid);
    layout -> setMargin(0);
    layout -> setContentsMargins (0,0,0,0);
    layout->setSizeConstraint(QLayout::SetFixedSize);
    setLayout(layout);
}
示例#5
0
MainWindow::MainWindow( QWidget *parent ) :
    QWidget(parent),
    adChannel(0),
    psthLength(1000),
    psthBinw(20),
    spikeThres(1),
    psthOn(0),
    spikeDetected(false),
    time(0),
    linearAverage(0)
{
  // initialize comedi
  const char *filename = "/dev/comedi0";

  /* open the device */
  if( (dev = comedi_open(filename)) == 0 )
  {
    comedi_perror(filename);
    exit(1);
  }

  // do not produce NAN for out of range behaviour
  comedi_set_global_oor_behavior(COMEDI_OOR_NUMBER); 

  maxdata = comedi_get_maxdata(dev, COMEDI_SUB_DEVICE, 0);
  crange = comedi_get_range(dev,COMEDI_SUB_DEVICE,0,0);
  numChannels = comedi_get_n_channels(dev, COMEDI_SUB_DEVICE);

  chanlist = new unsigned[numChannels];

  /* Set up channel list */
  for( int i=0; i<numChannels; i++ )
    chanlist[i] = CR_PACK(i, COMEDI_RANGE_ID, AREF_GROUND);

  int ret = comedi_get_cmd_generic_timed( dev,
                                          COMEDI_SUB_DEVICE,
                                          &comediCommand,
                                          numChannels,
                                          (int)(1e9/(SAMPLING_RATE)) );

  if(ret < 0)
  {
    printf("comedi_get_cmd_generic_timed failed\n");
    exit(-1);
  }

  /* Modify parts of the command */
  comediCommand.chanlist = chanlist;
  comediCommand.stop_src = TRIG_NONE;
  comediCommand.stop_arg = 0;

  /* comedi_command_test() tests a command to see if the
   * trigger sources and arguments are valid for the subdevice.
   * If a trigger source is invalid, it will be logically ANDed
   * with valid values (trigger sources are actually bitmasks),
   * which may or may not result in a valid trigger source.
   * If an argument is invalid, it will be adjusted to the
   * nearest valid value.  In this way, for many commands, you
   * can test it multiple times until it passes.  Typically,
   * if you can't get a valid command in two tests, the original
   * command wasn't specified very well. */
  ret = comedi_command_test(dev, &comediCommand);

  if(ret < 0)
  {
    comedi_perror("comedi_command_test");
    exit(-1);
  }

  fprintf(stderr, "first test returned %d\n", ret);

  ret = comedi_command_test(dev, &comediCommand);
  if(ret < 0)
  {
    comedi_perror("comedi_command_test");
    exit(-1);
  }

  fprintf(stderr, "second test returned %d\n", ret);

  if(ret != 0)
  {
    fprintf(stderr,"Error preparing command\n");
    exit(-1);
  }

  // the timing is done channel by channel
  // this means that the actual sampling rate is divided by
  // number of channels
  if ((comediCommand.convert_src ==  TRIG_TIMER)&&(comediCommand.convert_arg)) {
	  sampling_rate=(((double)1E9 / comediCommand.convert_arg)/numChannels);
  }
  
  // the timing is done scan by scan (all channels at once)
  // the sampling rate is equivalent of the scan_begin_arg
  if ((comediCommand.scan_begin_src ==  TRIG_TIMER)&&(comediCommand.scan_begin_arg)) {
	  sampling_rate=(double)1E9 / comediCommand.scan_begin_arg;
  }

  // 50Hz or 60Hz mains notch filter
  iirnotch = new Iir::Butterworth::BandStop<IIRORDER>;
  assert( iirnotch != NULL );
  iirnotch->setup (IIRORDER, sampling_rate, NOTCH_F, NOTCH_F/10.0);

  /* start the command */
  ret = comedi_command(dev, &comediCommand);
  if(ret < 0)
  {
    comedi_perror("comedi_command");
    exit(1);
  }

  int subdev_flags = comedi_get_subdevice_flags(dev, COMEDI_SUB_DEVICE);

  if( (sigmaBoard = subdev_flags & SDF_LSAMPL) )
    readSize = sizeof(lsampl_t) * numChannels;
  else
    readSize = sizeof(sampl_t) * numChannels;

  //  Initialize data for plots
  for(int i=0; i<MAX_PSTH_LENGTH; i++)
  {
    xData[i] = i;     // time axis
    yData[i] = 0;
    timeData[i] = double(i)*psthBinw; // psth time axis
    spikeCountData[i] = 0;
    psthData[i] = 0;
  }

  // the gui, straight forward QT/Qwt
  resize(640,420);
  QHBoxLayout *mainLayout = new QHBoxLayout( this );

  QVBoxLayout *controlLayout = new QVBoxLayout;
  mainLayout->addLayout(controlLayout);

  QVBoxLayout *plotLayout = new QVBoxLayout;
  plotLayout->addStrut(400);
  mainLayout->addLayout(plotLayout);

  // two plots
  RawDataPlot = new DataPlot(xData, yData, psthLength, 
			     crange->max, crange->min, this);
  plotLayout->addWidget(RawDataPlot);
  RawDataPlot->show();

  plotLayout->addSpacing(20);

  MyPsthPlot = new PsthPlot(timeData, psthData, psthLength/psthBinw, this);
  plotLayout->addWidget(MyPsthPlot);
  MyPsthPlot->show();

  /*---- Buttons ----*/

  // AD group
  QGroupBox   *ADcounterGroup = new QGroupBox( "A/D Channel", this );
  QVBoxLayout *ADcounterLayout = new QVBoxLayout;

  ADcounterGroup->setLayout(ADcounterLayout);
  ADcounterGroup->setAlignment(Qt::AlignJustify);
  ADcounterGroup->setSizePolicy( QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed) );
  controlLayout->addWidget( ADcounterGroup );

  QwtCounter *cntChannel = new QwtCounter(ADcounterGroup);
  cntChannel->setRange(0, numChannels-1, 1);
  cntChannel->setValue(adChannel);
  ADcounterLayout->addWidget(cntChannel);
  connect(cntChannel, SIGNAL(valueChanged(double)), SLOT(slotSetChannel(double)));

  filter50HzCheckBox = new QCheckBox( "50Hz filter" );
  filter50HzCheckBox->setEnabled( true );
  ADcounterLayout->addWidget(filter50HzCheckBox);

  // psth functions
  QGroupBox   *PSTHfunGroup  = new QGroupBox( "Actions", this );
  QVBoxLayout *PSTHfunLayout = new QVBoxLayout;

  PSTHfunGroup->setLayout(PSTHfunLayout);
  PSTHfunGroup->setAlignment(Qt::AlignJustify);
  PSTHfunGroup->setSizePolicy( QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed) );
  controlLayout->addWidget( PSTHfunGroup );

  averagePsth = new QComboBox(PSTHfunGroup);
  averagePsth->addItem(tr("PSTH"));
  averagePsth->addItem(tr("VEP"));
  PSTHfunLayout->addWidget(averagePsth);
  connect( averagePsth, SIGNAL(currentIndexChanged(int)), SLOT(slotAveragePsth(int)) );

  triggerPsth = new QPushButton(PSTHfunGroup);
  triggerPsth->setText("PSTH on");
  triggerPsth->setCheckable(true);
  PSTHfunLayout->addWidget(triggerPsth);
  connect(triggerPsth, SIGNAL(clicked()), SLOT(slotTriggerPsth()));

  QPushButton *clearPsth = new QPushButton(PSTHfunGroup);
  clearPsth->setText("clear data");
  PSTHfunLayout->addWidget(clearPsth);
  connect(clearPsth, SIGNAL(clicked()), SLOT(slotClearPsth()));

  QPushButton *savePsth = new QPushButton(PSTHfunGroup);
  savePsth->setText("save data");
  PSTHfunLayout->addWidget(savePsth);
  connect(savePsth, SIGNAL(clicked()), SLOT(slotSavePsth()));

  // psth params
  QGroupBox   *PSTHcounterGroup = new QGroupBox( "Parameters", this );
  QVBoxLayout *PSTHcounterLayout = new QVBoxLayout;

  PSTHcounterGroup->setLayout(PSTHcounterLayout);
  PSTHcounterGroup->setAlignment(Qt::AlignJustify);
  PSTHcounterGroup->setSizePolicy( QSizePolicy(QSizePolicy::Fixed,
					       QSizePolicy::Fixed) );
  controlLayout->addWidget( PSTHcounterGroup );

  QLabel *psthLengthLabel = new QLabel("Sweep length", PSTHcounterGroup);
  PSTHcounterLayout->addWidget(psthLengthLabel);

  QwtCounter *cntSLength = new QwtCounter(PSTHcounterGroup);
  cntSLength->setNumButtons(2);
  cntSLength->setIncSteps(QwtCounter::Button1, 10);
  cntSLength->setIncSteps(QwtCounter::Button2, 100);
  cntSLength->setRange(1, MAX_PSTH_LENGTH, 1);
  cntSLength->setValue(psthLength);
  PSTHcounterLayout->addWidget(cntSLength);
  connect(cntSLength, 
	  SIGNAL(valueChanged(double)), 
	  SLOT(slotSetPsthLength(double)));

  QLabel *binwidthLabel = new QLabel("Binwidth", PSTHcounterGroup);
  PSTHcounterLayout->addWidget(binwidthLabel);

  cntBinw = new QwtCounter(PSTHcounterGroup);
  cntBinw->setNumButtons(2);
  cntBinw->setIncSteps(QwtCounter::Button1, 1);
  cntBinw->setIncSteps(QwtCounter::Button2, 10);
  cntBinw->setRange(1, 100, 1);
  cntBinw->setValue(psthBinw);
  PSTHcounterLayout->addWidget(cntBinw);
  connect(cntBinw, SIGNAL(valueChanged(double)), SLOT(slotSetPsthBinw(double)));

  QLabel *thresholdLabel = new QLabel("Spike Threshold", PSTHcounterGroup);
  PSTHcounterLayout->addWidget(thresholdLabel);

  editSpikeT = new QTextEdit("0");
  QFont editFont("Courier",14);
  QFontMetrics editMetrics(editFont);
  editSpikeT->setMaximumHeight ( editMetrics.height()*1.2 );
  editSpikeT->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  editSpikeT->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  editSpikeT->setFont(editFont);
  PSTHcounterLayout->addWidget(editSpikeT);
  connect(editSpikeT, SIGNAL(textChanged()), SLOT(slotSetSpikeThres()));

  thresholdMarker = new QwtPlotMarker();
  thresholdMarker->setValue(0,0);
  thresholdMarker->attach(RawDataPlot);
  thresholdMarker->setLineStyle(QwtPlotMarker::HLine);

  // Generate timer event every 50ms
  (void)startTimer(50);

}
示例#6
0
EResumen::EResumen( QWidget *parent, tipo que )
: EVentana( parent )
{
 setObjectName( "selectorResumen" );
 setWindowTitle( "Seleccione el Resumen" );
 setAttribute( Qt::WA_DeleteOnClose );
 generar = que;
 QVBoxLayout *layoutPrincipal = new QVBoxLayout( this );
 layoutPrincipal->setMargin( 3 );
 layoutPrincipal->setSpacing( 3 );
 switch( que )
 {
  case diario:
  {
   QGroupBox *g = new QGroupBox( this );
   g->setTitle( "Elija la fecha del resumen" );
   g->setAlignment( Qt::AlignHCenter );
   g->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
   QVBoxLayout *v = new QVBoxLayout( g );
   CWfecha = new QCalendarWidget( g );
   CWfecha->setGridVisible( false );
   CWfecha->setMaximumDate( QDate::currentDate() );
   CWfecha->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
   v->addWidget( CWfecha );
   g->adjustSize();
   layoutPrincipal->addWidget( g );
   break;
  }
  case mensual:
  {
    QGroupBox *groupBox = new QGroupBox( this );
    groupBox->setObjectName(QString::fromUtf8("groupBox"));
    groupBox->setTitle( "Elija el mes para el resumen" );
    groupBox->setAlignment( Qt::AlignCenter );
    groupBox->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );

    QVBoxLayout *v = new QVBoxLayout(groupBox);
    v->setObjectName( "vLayout" );
    QHBoxLayout *h1 = new QHBoxLayout();
    h1->setObjectName("hLayout1");

    QLabel *Lmes = new QLabel(groupBox);
    Lmes->setObjectName(QString::fromUtf8("labelMes"));
    Lmes->setText( tr( "Mes:" ) );
    h1->addWidget(Lmes);

    CBMes = new QComboBox(groupBox);
    CBMes->setObjectName(QString::fromUtf8("CBMes"));
    // Inserto los meses
    QLocale locale;
    for( int i = 1; i<=12; i++ )
    {
     CBMes->insertItem( i, locale.monthName( i ) );
    }
    CBMes->setCurrentIndex( QDate::currentDate().month() );
    h1->addWidget(CBMes);


    v->addLayout(h1);

    QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
    horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));

    QLabel *Lano = new QLabel(groupBox);
    Lano->setObjectName(QString::fromUtf8("lano"));
    Lano->setText( tr( "Año:" ) );
    horizontalLayout_2->addWidget(Lano);

    SBAno = new QSpinBox(groupBox);
    SBAno->setObjectName(QString::fromUtf8("SBAno"));
    SBAno->setMaximum( QDate::currentDate().year() );
    SBAno->setSingleStep( 1 );
    SBAno->setValue( QDate::currentDate().year() );

    horizontalLayout_2->addWidget(SBAno);

    v->addLayout(horizontalLayout_2);

   layoutPrincipal->addWidget( groupBox );
   break;
  }
  case anual:
  {
   QHBoxLayout *layout = new QHBoxLayout( this );
   QLabel *etiqueta = new QLabel( this );
   etiqueta->setText( QString( "Año:" ) );
   seleccion = new QSpinBox( this );
   seleccion->setRange( 0, QDate::currentDate().year() );
   seleccion->setSingleStep( 1 );
   seleccion->setValue( QDate::currentDate().year() );
   layout->addWidget( etiqueta );
   layout->addWidget( seleccion );
   layoutPrincipal->addLayout( layout );
   break;
  }
  case semanal:
  {
   QGroupBox *g = new QGroupBox( this );
   g->setTitle( "Elija un dia de la semana para el resumen" );
   g->setAlignment( Qt::AlignHCenter );
   g->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
   QVBoxLayout *v = new QVBoxLayout( g );
   CWfecha = new QCalendarWidget( g );
   CWfecha->setGridVisible( true );
   CWfecha->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
   v->addWidget( CWfecha );
   g->adjustSize();
   layoutPrincipal->addWidget( g );
   break;
  }
  case entrefechas:
  {
    QHBoxLayout *horizontalLayout = new QHBoxLayout();
    horizontalLayout->setObjectName( "horizontalLayout" );
    horizontalLayout->setContentsMargins(0, 0, 0, 0);
    QLabel *LInicio = new QLabel(this);
    LInicio->setObjectName( "LInicio" );
    LInicio->setText( "Fecha de inicio:" );

    horizontalLayout->addWidget(LInicio);

    DEInicio = new QDateEdit(this);
    DEInicio->setObjectName( "DEInicio" );
    DEInicio->setCalendarPopup(true);

    horizontalLayout->addWidget(DEInicio);

    QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
    horizontalLayout_2->setObjectName( "horizontalLayout_2" );
    horizontalLayout_2->setContentsMargins(0, 0, 0, 0);
    QLabel *LFin = new QLabel(this);
    LFin->setObjectName( "LFin" );
    LFin->setText( "Fecha de Fin:" );

    horizontalLayout_2->addWidget(LFin);

    DEFin = new QDateEdit(this);
    DEFin->setObjectName( "DEFin" );
    DEFin->setCalendarPopup(true);
    DEFin->setMaximumDate( QDate::currentDate() );

    horizontalLayout_2->addWidget(DEFin);

    layoutPrincipal->addItem( horizontalLayout );
    layoutPrincipal->addItem( horizontalLayout_2 );
  }
 }
 QAction *ActGenerar = new QAction( "Generar Reporte", this );
 ActGenerar->setIcon( QIcon( ":/imagenes/reporte.png" ) );
 connect( ActGenerar, SIGNAL( triggered() ), this, SLOT( generarResumen() ) );
 addAction( ActGenerar );
 EActCerrar *ActCerrar = new EActCerrar( this );
 connect( ActCerrar, SIGNAL( triggered() ), this, SLOT( close() ) );
 addAction( ActCerrar );
 this->adjustSize();
}
MangaListWidget::MangaListWidget(QWidget* parent):
  QWidget(parent),
  _scansDirectory(Utils::getScansDirectory()),
  _currentChaptersListOnWeb(),
  _chaptersToCheck(),
  _currentIndex(),
  _editOn(false),
  _coverHasToBeSet(false) {


  /// Available chapters process

  _checkAvailableChaptersProcess = new QProcess(this);
  connect(_checkAvailableChaptersProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(checkAvailableChapterIsDone(int,QProcess::ExitStatus)));
  connect(_checkAvailableChaptersProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput()));


  /// Top buttons

  _markReadButton = new QPushButton;
  _markReadButton->setIcon(QIcon(Utils::getIconsPath()+"/check.gif"));
  _markReadButton->setFixedWidth(37);
  connect(_markReadButton, SIGNAL(clicked()), this, SLOT(markRead()));

  _markUnreadButton = new QPushButton;
  _markUnreadButton->setIcon(QIcon(Utils::getIconsPath()+"/uncheck.gif"));
  _markUnreadButton->setFixedWidth(37);
  connect(_markUnreadButton, SIGNAL(clicked()), this, SLOT(markUnread()));

  _downloadButton = new QPushButton;
  _downloadButton->setIcon(QIcon(Utils::getIconsPath()+"/download.gif"));
  _downloadButton->setFixedWidth(37);
  connect(_downloadButton, SIGNAL(clicked()), this, SLOT(goToDownload()));

  _addMangaButton = new QPushButton;
  _addMangaButton->setIcon(QIcon(Utils::getIconsPath()+"/plus.png"));
  _addMangaButton->setFixedWidth(37);
  connect(_addMangaButton, SIGNAL(clicked()), this, SLOT(addManga()));

  _checkNewChaptersButton = new QPushButton;
  _checkNewChaptersButton->setIcon(QIcon(Utils::getIconsPath()+"/checkChapters.png"));
  _checkNewChaptersButton->setFixedWidth(37);
  connect(_checkNewChaptersButton, SIGNAL(clicked()), this, SLOT(decorateMangaNames()));

  QHBoxLayout* buttonsLayout = new QHBoxLayout;
  buttonsLayout->addWidget(_markReadButton);
  buttonsLayout->addWidget(_markUnreadButton);
  buttonsLayout->addWidget(_downloadButton);
  buttonsLayout->addWidget(_addMangaButton);
  buttonsLayout->addWidget(_checkNewChaptersButton);
  buttonsLayout->setAlignment(Qt::AlignHCenter);


  /// Manga information

  QPixmap pixmap(Utils::getIconsPath()+"/setCover.png");

  _mangaPreviewLabel = new QLabel;
  _mangaPreviewLabel->setFixedHeight(400);
  _mangaPreviewLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
  _mangaPreviewLabel->setStyleSheet("margin: 20px;");
  _mangaPreviewLabel->setAttribute(Qt::WA_Hover);
  _mangaPreviewLabel->installEventFilter(this);
  _mangaPreviewLabel->setPixmap(pixmap);

  _genreLabel = new QLabel;
  _genreLabel->setFont(QFont("Monospace", 8));
  _authorLabel = new QLabel;
  _authorLabel->setFont(QFont("Monospace", 8));
  _artistLabel = new QLabel;
  _artistLabel->setFont(QFont("Monospace", 8));
  _publisherLabel = new QLabel;
  _publisherLabel->setFont(QFont("Monospace", 8));
  _magazineLabel = new QLabel;
  _magazineLabel->setFont(QFont("Monospace", 8));
  _startDateLabel = new QLabel;
  _startDateLabel->setFont(QFont("Monospace", 8));

  _editMangaInfoButton = new QPushButton("Edit");
  _editMangaInfoButton->setCheckable(true);
  _editMangaInfoButton->setFixedWidth(100);
  connect(_editMangaInfoButton, SIGNAL(toggled(bool)), this, SLOT(toggleEditMangaInfo(bool)));

  QFormLayout* genreLayout = new QFormLayout;
  genreLayout->addRow("Genre:", _genreLabel);
  QFormLayout* authorLayout = new QFormLayout;
  authorLayout->addRow("Author:", _authorLabel);
  QFormLayout* artistLayout = new QFormLayout;
  artistLayout->addRow("Artist:", _artistLabel);
  QFormLayout* publisherLayout = new QFormLayout;
  publisherLayout->addRow("Publisher:", _publisherLabel);
  QFormLayout* magazineLayout = new QFormLayout;
  magazineLayout->addRow("Magazine:", _magazineLabel);
  QFormLayout* startDateLayout = new QFormLayout;
  startDateLayout->addRow("Start date:", _startDateLabel);

  QVBoxLayout* mangaInfoLayout = new QVBoxLayout;
  mangaInfoLayout->addWidget(_mangaPreviewLabel);
  mangaInfoLayout->addLayout(genreLayout);
  mangaInfoLayout->addLayout(authorLayout);
  mangaInfoLayout->addLayout(artistLayout);
  mangaInfoLayout->addLayout(publisherLayout);
  mangaInfoLayout->addLayout(magazineLayout);
  mangaInfoLayout->addLayout(startDateLayout);
  mangaInfoLayout->addWidget(_editMangaInfoButton);
  mangaInfoLayout->setAlignment(Qt::AlignTop);

  QGroupBox* mangaInfoGroupBox = new QGroupBox("Information");
  mangaInfoGroupBox->setLayout(mangaInfoLayout);
  mangaInfoGroupBox->setFixedWidth(350);
  mangaInfoGroupBox->setAlignment(Qt::AlignLeft);


  /// Chapters model

  _model = new QStandardItemModel;
  initModel();


  /// Chapters view

  _chapterInfoWidget = new ChapterInfoWidget;

  _view = new QColumnView;
  QList<int> widths;
  widths << 300 << 400 << 400;
  _view->setColumnWidths(widths);
  _view->setResizeGripsVisible(false);
  _view->setFixedWidth(1102);
  _view->setSelectionMode(QAbstractItemView::ExtendedSelection);
  _view->setModel(_model);
  _view->setPreviewWidget(_chapterInfoWidget);
  connect(_view, SIGNAL(updatePreviewWidget(QModelIndex)), this, SLOT(updateChaptersInfo(QModelIndex)));
  connect(_view, SIGNAL(clicked(QModelIndex)), this, SLOT(updateMangaInfo(QModelIndex)));
  connect(_view, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(goToRead(QModelIndex)));

  QHBoxLayout* listLayout = new QHBoxLayout;
  listLayout->addWidget(mangaInfoGroupBox);
  listLayout->addWidget(_view);

  QStringList headerLabels;
  headerLabels << "Manga";
  _model->setHorizontalHeaderLabels(headerLabels);


  /// Set current index to first manga if any

  _view->setCurrentIndex(_model->index(0, 0));
  updateMangaInfo(_model->index(0, 0));


  /// Main layout

  QLabel* titleLabel = new QLabel("Manga List");
  titleLabel->setFont(QFont("", 18, 99));

  QVBoxLayout* mainLayout = new QVBoxLayout;
  mainLayout->addWidget(titleLabel);
  mainLayout->addLayout(buttonsLayout);
  mainLayout->addLayout(listLayout);

  setLayout(mainLayout);


  /// Schedule a new available manga check every thirty minutes

  QTimer* timer = new QTimer(this);
  connect(timer, SIGNAL(timeout()), this, SLOT(decorateMangaNames()));
  timer->start(1000*60*30);
}
UrlGeneratorJY::UrlGeneratorJY( QWidget* parent )
	: QDialog(parent)
{
	_txtCodec = QTextCodec::codecForName("Big5-ETen");
	setWindowTitle( _txtCodec->toUnicode("URL 產生器") );
	
	QVBoxLayout* vl = new QVBoxLayout;
    vl->setContentsMargins( 4, 4, 4, 4 );
    vl->setSpacing( 4 );
	/* Location IP */
	QHBoxLayout* hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	QLabel* lbl = new QLabel( _txtCodec->toUnicode("位置 IP:"), this );
	lbl->setFixedSize( 75, 22 );
	hl->addWidget( lbl );
	hl->addSpacing( 2 );
	_txtLoc = new QTextEdit( this );
	_txtLoc->setMinimumWidth( 200 );
	_txtLoc->setFixedHeight( 40 );
	hl->addWidget( _txtLoc );
	hl->addStretch();
	vl->addLayout( hl );
	/* Location IP */
    hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("我的最愛 ID:"), this );
	lbl->setFixedSize( 75, 22 );
	hl->addWidget( lbl );
	hl->addSpacing( 2 );
	_edFav = new QLineEdit( this );
	_edFav->setFixedWidth( 40 );
	hl->addWidget( _edFav );
	hl->addStretch();
	vl->addLayout( hl );
	/* Chart Related */
	QGroupBox* gpBox = new QGroupBox( _txtCodec->toUnicode("[圖樣相關]"), this );
	gpBox->setAlignment( Qt::AlignHCenter );
	QVBoxLayout* vlayout = new QVBoxLayout;
    vlayout->setContentsMargins( 0, 0, 0, 0 );
    vlayout->setSpacing( 2 );
	hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("類型:"), gpBox );
	lbl->setFixedSize( 75, 22 );
	hl->addWidget( lbl );
	hl->addSpacing( 2 );
	_rbLine = new QRadioButton( _txtCodec->toUnicode("趨勢圖"), gpBox );
	_rbLine->setChecked( true );
	hl->addWidget( _rbLine );
	hl->addSpacing( 2 );
	_rbCol = new QRadioButton( _txtCodec->toUnicode("直方圖"), gpBox );
	hl->addWidget( _rbCol );
	hl->addSpacing( 2 );
	_rbPie = new QRadioButton( _txtCodec->toUnicode("圓餅圖"), gpBox );
	hl->addWidget( _rbPie );
	hl->addSpacing( 2 );
	_rbStack = new QRadioButton( _txtCodec->toUnicode("堆疊圖"), gpBox );
	hl->addWidget( _rbStack );
	hl->addStretch();
	vlayout->addLayout( hl );
	hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("大小:"), gpBox );
	lbl->setFixedSize( 75, 22 );
	hl->addWidget( lbl );
	hl->addSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("(寬)"), gpBox );
	lbl->setFixedSize( 20, 22 );
	hl->addWidget( lbl );
	hl->addSpacing( 2 );
	_edWidth = new QLineEdit( this );
	_edWidth->setFixedWidth( 80 );
	_edWidth->setText( "640" );
	hl->addWidget( _edWidth );
	hl->addSpacing( 2 );
	lbl = new QLabel( tr("px"), this );
	lbl->setFixedSize( 20, 22 );
	hl->addWidget( lbl );
	hl->addStretch();
	lbl = new QLabel( _txtCodec->toUnicode("(高)"), gpBox );
	lbl->setFixedSize( 20, 22 );
	hl->addWidget( lbl );
	hl->addSpacing( 2 );
	_edHeight = new QLineEdit( this );
	_edHeight->setFixedWidth( 80 );
	_edHeight->setText( "480" );
	hl->addWidget( _edHeight );
	hl->addSpacing( 2 );
	lbl = new QLabel( tr("px"), this );
	lbl->setFixedSize( 20, 22 );
	hl->addWidget( lbl );
	hl->addStretch();
	vlayout->addLayout( hl );
	gpBox->setLayout( vlayout );
	vl->addWidget( gpBox );
	/* Time Related */
	gpBox = new QGroupBox( _txtCodec->toUnicode("[時間相關]"), this );
	gpBox->setAlignment( Qt::AlignHCenter );
	vlayout = new QVBoxLayout;
    vlayout->setContentsMargins( 0, 0, 0, 0 );
    vlayout->setSpacing( 2 );
    QWidget* twid = new QWidget( this );
	hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("時間區間:"), twid );
	lbl->setFixedSize( 75, 22 );
	hl->addWidget( lbl );
	hl->addSpacing( 2 );
    _rbMin = new QRadioButton( _txtCodec->toUnicode("分"), twid );
	hl->addWidget( _rbMin );
	hl->addSpacing( 2 );
    _rbHr = new QRadioButton( _txtCodec->toUnicode("時"), twid );
	hl->addWidget( _rbHr );
	hl->addSpacing( 2 );
    _rbDay = new QRadioButton( _txtCodec->toUnicode("日"), twid );
	_rbDay->setChecked( true );
	hl->addWidget( _rbDay );
	hl->addSpacing( 2 );
    _rbWeek = new QRadioButton( _txtCodec->toUnicode("週"), twid );
	hl->addWidget( _rbWeek );
	hl->addSpacing( 2 );
    _rbMon = new QRadioButton( _txtCodec->toUnicode("月"), twid );
	hl->addWidget( _rbMon );
	hl->addSpacing( 2 );
    _rbQtr = new QRadioButton( _txtCodec->toUnicode("季"), twid );
	hl->addWidget( _rbQtr );
	hl->addStretch();
	twid->setLayout( hl );
    vlayout->addWidget( twid );
	twid = new QWidget( this );
	hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
    _rbDef = new QRadioButton( _txtCodec->toUnicode("固定式"), twid );
	_rbDef->setFixedWidth( 200 );
	_rbDef->setChecked( true );
	connect( _rbDef, SIGNAL(clicked()), this, SLOT(_OnClickedMode()) );
	hl->addWidget( _rbDef );
	hl->addStretch();
    _rbMove = new QRadioButton( _txtCodec->toUnicode("移動式"), twid );
	_rbMove->setFixedWidth( 300 );
	connect( _rbMove, SIGNAL(clicked()), this, SLOT(_OnClickedMode()) );
	hl->addWidget( _rbMove );
	hl->addStretch();
	twid->setLayout( hl );
	vlayout->addWidget( twid );
	/* Group Box: Pre-defined */
	hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	_gpDef = new QGroupBox( gpBox );
	_gpDef->setAlignment( Qt::AlignHCenter );
    _gpDef->setFixedWidth( 200 );
	QVBoxLayout* vlgp = new QVBoxLayout;
    vlgp->setContentsMargins( 0, 0, 0, 0 );
    vlgp->setSpacing( 2 );
	QHBoxLayout* hlgp = new QHBoxLayout;
    hlgp->setContentsMargins( 2, 2, 2, 2 );
    hlgp->setSpacing( 2 );
	_dtStart = new QDateTimeEdit( QDateTime::currentDateTime().addDays(-1), _gpDef );
	_dtStart->setDisplayFormat( "yyyy-MM-dd HH:mm:ss" );
	_dtStart->setFixedWidth( 120 );
	hlgp->addWidget( _dtStart );
	hlgp->addSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("至"), _gpDef );
	lbl->setFixedSize( 20, 22 );
	hlgp->addWidget( lbl );
	hlgp->addStretch();
	vlgp->addLayout( hlgp );
    hlgp = new QHBoxLayout;
    hlgp->setContentsMargins( 2, 2, 2, 2 );
    hlgp->setSpacing( 2 );
	_dtEnd = new QDateTimeEdit( QDateTime::currentDateTime(), _gpDef );
    _dtEnd->setDisplayFormat( "yyyy-MM-dd HH:mm:ss" );
	_dtEnd->setFixedWidth( 120 );
	hlgp->addWidget( _dtEnd );
	hlgp->addStretch();
	vlgp->addLayout( hlgp );
	_gpDef->setLayout( vlgp );
	hl->addWidget( _gpDef );
	hl->addStretch();
	/* Group Box: Moving-Time-Axis */
	_gpMove = new QGroupBox( gpBox );
	_gpMove->setAlignment( Qt::AlignHCenter );
	_gpMove->setFixedWidth( 300 );
	_gpMove->setEnabled( false );
    vlgp = new QVBoxLayout;
    vlgp->setContentsMargins( 0, 0, 0, 0 );
    vlgp->setSpacing( 2 );
	hlgp = new QHBoxLayout;
    hlgp->setContentsMargins( 2, 2, 2, 2 );
    hlgp->setSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("基準點: 今日起"), _gpMove );
	lbl->setFixedSize( 135, 22 );
	hlgp->addWidget( lbl );
	hlgp->addSpacing( 2 );
    _rbFwd = new QRadioButton( _txtCodec->toUnicode("前"), _gpMove );
	_rbFwd->setChecked( true );
	hlgp->addWidget( _rbFwd );
    hlgp->addSpacing( 2 );
	_rbBack = new QRadioButton( _txtCodec->toUnicode("後"), _gpMove );
	hlgp->addWidget( _rbBack );
	hlgp->addSpacing( 2 );
	_spBase = new QSpinBox( _gpMove );
	hlgp->addWidget( _spBase );
	hlgp->addSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("日"), _gpMove );
	lbl->setFixedSize( 20, 22 );
	hlgp->addWidget( lbl );
	hlgp->addSpacing( 2 );
	_teBase = new QTimeEdit( _gpMove );
	_teBase->setDisplayFormat( "HH:mm" );
	hlgp->addWidget( _teBase );
	hlgp->addStretch();
	vlgp->addLayout( hlgp );
	hlgp = new QHBoxLayout;
    hlgp->setContentsMargins( 2, 2, 2, 2 );
    hlgp->setSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("回溯點: 基準點往前"), _gpMove );
	lbl->setFixedSize( 135, 22 );
	hlgp->addWidget( lbl );
	hlgp->addSpacing( 2 );
	_spBack = new QSpinBox( _gpMove );
	hlgp->addWidget( _spBack );
	hlgp->addSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("日"), _gpMove );
	lbl->setFixedSize( 20, 22 );
	hlgp->addWidget( lbl );
	hlgp->addSpacing( 2 );
	_teBack = new QTimeEdit( _gpMove );
    _teBack->setDisplayFormat( "HH:mm" );
	hlgp->addWidget( _teBack );
	hlgp->addStretch();
	vlgp->addLayout( hlgp );
	_gpMove->setLayout( vlgp );
	hl->addWidget( _gpMove );
	hl->addStretch();
	vlayout->addLayout( hl );
    twid = new QWidget( gpBox );
	hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	lbl = new QLabel( _txtCodec->toUnicode("更新率:"), gpBox );
	lbl->setFixedSize( 75, 22 );
	hl->addWidget( lbl );
	hl->addSpacing( 2 );
    _rbRefM = new QRadioButton( _txtCodec->toUnicode("分"), gpBox );
	_rbRefM->setChecked( true );
	connect( _rbRefM, SIGNAL(clicked()), this, SLOT(_OnClickedRefresh()) );
	hl->addWidget( _rbRefM );
	hl->addSpacing( 2 );
    _rbRefH = new QRadioButton( _txtCodec->toUnicode("時"), gpBox );
	connect( _rbRefH, SIGNAL(clicked()), this, SLOT(_OnClickedRefresh()) );
	hl->addWidget( _rbRefH );
	hl->addSpacing( 2 );
	_edRefresh = new QLineEdit( gpBox );
	_edRefresh->setFixedWidth( 40 );
	_edRefresh->setText( "10" );
	hl->addWidget( _edRefresh );
	hl->addSpacing( 2 );
	_lblRef = new QLabel( _txtCodec->toUnicode("分"), gpBox );
	_lblRef->setFixedSize( 20, 22 );
	hl->addWidget( _lblRef );
	hl->addStretch();
	twid->setLayout( hl );
	vlayout->addWidget( twid );
	gpBox->setLayout( vlayout );
	vl->addWidget( gpBox );
	_txtUrl = new QTextEdit( this );
	_txtUrl->setReadOnly( true );
	vl->addWidget( _txtUrl );
    QFrame* frmSep = new QFrame( this );
    frmSep->setFrameShape( QFrame::HLine );
    frmSep->setFrameShadow( QFrame::Sunken );
	vl->addWidget( frmSep );

	hl = new QHBoxLayout;
    hl->setContentsMargins( 2, 2, 2, 2 );
    hl->setSpacing( 2 );
	hl->addStretch();
	_btnGen = new QPushButton( _txtCodec->toUnicode("產生 URL"), this );
	_btnGen->setFixedSize( 80, 22 );
	_btnGen->setFocusPolicy( Qt::NoFocus );
	connect( _btnGen, SIGNAL(clicked()), this, SLOT(_OnGen()) );
	hl->addWidget( _btnGen );
	QPushButton* btn = new QPushButton( _txtCodec->toUnicode("關閉"), this );
	btn->setFixedSize( 60, 22 );
	btn->setFocusPolicy( Qt::NoFocus );
	connect( btn, SIGNAL(clicked()), this, SLOT(close()) );
	hl->addWidget( btn );
	vl->addLayout( hl );
	vl->addStretch();
	setLayout( vl );

	resize( 520, 250 );
	setMaximumSize( 750, 250 );
}
示例#9
0
TransferDialog::TransferDialog( MediaDevice *mdev )
        : KDialog( Amarok::mainWindow() )
{
    setModal( true );
    setButtons( Ok|Cancel );
    setDefaultButton( Ok );
    showButtonSeparator( true );

    m_dev = mdev;
    m_accepted = false;
    m_sort1LastIndex = m_sort2LastIndex = -1;

    kapp->setTopWidget( this );
    setCaption( KDialog::makeStandardCaption( i18n( "Transfer Queue to Device" ) ) );

    KVBox *vbox = new KVBox( this );
    setMainWidget( vbox );

    QString transferDir = mdev->getTransferDir();

    QGroupBox *location = new QGroupBox( i18n( "Music Location" ), vbox );
    location->setAlignment( Qt::Vertical );
    KVBox *locationLayout = new KVBox( location );

    new QLabel( i18n( "Your music will be transferred to:\n%1",
                    transferDir ),
                locationLayout );

    KVBox *vbox2 = new KVBox( vbox );
    QLayout *vlayout = vbox2->layout();
    if( vlayout )
        vlayout->addItem( new QSpacerItem( 0, 25 ) );

    new QLabel( i18n( "You can have your music automatically grouped in\n"
                      "a variety of ways. Each grouping will create\n"
                      "directories based upon the specified criteria.\n"), vbox );

    QGroupBox *sorting = new QGroupBox( i18n( "Groupings" ), vbox );
    sorting->setAlignment( Qt::Vertical );
    KVBox *sortingLayout = new KVBox( sorting );
    m_label1 = new QLabel( i18n( "Select first grouping:\n" ), sortingLayout );
    m_sort1  = new KComboBox( sortingLayout );
    m_label2 = new QLabel( i18n( "Select second grouping:\n" ), sortingLayout );
    m_sort2  = new KComboBox( sortingLayout );
    m_label3 = new QLabel( i18n( "Select third grouping:\n" ), sortingLayout );
    m_sort3  = new KComboBox( sortingLayout );

    m_combolist.append( m_sort1 );
    m_combolist.append( m_sort2 );
    m_combolist.append( m_sort3 );

    QListIterator<KComboBox *> it(m_combolist);
    while (it.hasNext()) {
        it.next()->addItem( i18n("None") );
        it.next()->addItem( i18n("Artist") );
        it.next()->addItem( i18n("Album") );
        it.next()->addItem( i18n("Genre") );
        it.next()->setCurrentItem( 0 );
    }

    m_sort1->setCurrentItem( mdev->m_firstSort );
    m_sort2->setCurrentItem( mdev->m_secondSort );
    m_sort3->setCurrentItem( mdev->m_thirdSort );

    m_label2->setDisabled( m_sort1->currentIndex() == 0 );
    m_sort2->setDisabled( m_sort1->currentIndex() == 0 );
    m_label3->setDisabled( m_sort2->currentIndex() == 0 );
    m_sort3->setDisabled( m_sort2->currentIndex() == 0 );

    connect( m_sort1, SIGNAL( activated(int) ), SLOT( sort1_activated(int)) );
    connect( m_sort2, SIGNAL( activated(int) ), SLOT( sort2_activated(int)) );

    KVBox *vbox3 = new KVBox( vbox );
    QLayout *vlayout2 = vbox3->layout();
    if( vlayout2 )
        vlayout2->addItem( new QSpacerItem( 0, 25 ) );

    QGroupBox *options = new QGroupBox( i18n( "Options" ), vbox );
    options->setAlignment( Qt::Vertical );
    KVBox *optionsLayout = new KVBox( options );

    QCheckBox *convertSpaces = new QCheckBox( i18n( "Convert spaces to underscores" ), optionsLayout );
    convertSpaces->setChecked( mdev->getSpacesToUnderscores() );

    connect( convertSpaces, SIGNAL( toggled(bool) ), this, SLOT( convertSpaces_toggled(bool) ) );
    connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
    connect(this,SIGNAL(cancelClicked()),this,SLOT(slotCancel()));
}