Esempio n. 1
1
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    QMenu *file;
    QMenu *edit;
    QMenu *effect;
    QMenu *tools;
    QMenu *help;
    QAction *newa = new QAction(tr("&New"), this);
    QAction *open = new QAction(tr("&Open"), this);
    QAction *save = new QAction(tr("&Save"), this);
    QAction *saveas = new QAction(tr("&Save as"), this);
    QAction *import = new QAction(tr("&Import sample"), this);
    QAction *quit = new QAction(tr("&Quit"), this);
    QAction *play = new QAction(tr("&Play"), this);
    QAction *stop = new QAction(tr("&Stop"), this);
    QAction *pause = new QAction(tr("&Pause"), this);
    QAction *record= new QAction(tr("&Record"), this);
    QAction *zoomin  = new QAction(tr("Zoom in"), this);
    QAction *zoomout = new QAction(tr("Zoom out"), this);
    QAction *settings = new QAction(tr("&Settings"), this);
    QToolBar *toolbar = addToolBar("Main ToolBar");
    QLCDNumber *lcd = new QLCDNumber();
    QLabel * play_v = new QLabel(), * rec_v = new QLabel();
    QSlider * play_slider = new QSlider(Qt::Horizontal), * rec_slider = new QSlider(Qt::Horizontal);
    wave = new Wave();
    fileName = "";
    changed = false;
    newa->setIcon(QIcon::fromTheme("document-new"));
    newa->setShortcut(tr("CTRL+N"));
    open->setIcon(QIcon::fromTheme("document-open"));
    open->setShortcut(tr("CTRL+O"));
    save->setIcon(QIcon::fromTheme("document-save"));
    save->setShortcut(tr("CTRL+S"));
    saveas->setIcon(QIcon::fromTheme("document-save-as"));
    import->setIcon(QIcon::fromTheme("audio-x-generic"));
    zoomin->setIcon(QIcon::fromTheme("zoom-in"));
    zoomin->setShortcut(tr("CTRL+Up"));
    zoomout->setIcon(QIcon::fromTheme("zoom-out"));
    zoomout->setShortcut(tr("CTRL+Down"));
    play->setIcon(QIcon::fromTheme("media-playback-start"));
    play->setShortcut(tr("Space"));
    play->setCheckable(true);
    stop->setIcon(QIcon::fromTheme("media-playback-stop"));
    pause->setIcon(QIcon::fromTheme("media-playback-pause"));
    record->setIcon(QIcon::fromTheme("media-record"));
    record->setShortcut(tr("Ctrl+Space"));
    record->setCheckable(true);
    quit->setIcon(QIcon::fromTheme("application-exit"));
    quit->setShortcut(tr("CTRL+Q"));
    lcd->setDigitCount(8);
    lcd->display("00:00:00");
    lcd->setStyleSheet("background: black; color: #00FF00");
    lcd->setFixedSize(100, 30);
    play_v->setText(tr("Playback volume:"));
    rec_v->setText(tr("Record volume:"));
    play_slider->setMaximumWidth(50);
    play_slider->setRange(0, 100);
    rec_slider->setMaximumWidth(50);
    rec_slider->setRange(0, 100);
    file = menuBar()->addMenu(tr("&File"));
    file->addAction(newa);
    file->addAction(open);
    file->addAction(save);
    file->addAction(saveas);
    file->addSeparator();
    file->addAction(import);
    file->addSeparator();
    file->addAction(quit);
    edit = menuBar()->addMenu(tr("&Edit"));
    effect = menuBar()->addMenu(tr("&Effects"));
    tools = menuBar()->addMenu(tr("&Tools"));
    settings->setIcon(QIcon::fromTheme("multimedia-volume-control"));
    tools->addAction(settings);
    help = menuBar()->addMenu(tr("&Help"));

    toolbar->addAction(newa);
    toolbar->addAction(open);
    toolbar->addAction(save);
    toolbar->addSeparator();
    toolbar->addAction(import);
    toolbar->addAction(zoomin);
    toolbar->addAction(zoomout);
    toolbar->addSeparator();
    toolbar->addAction(stop);
    toolbar->addAction(pause);
    toolbar->addAction(play);
    toolbar->addAction(record);
    toolbar->addSeparator();
    toolbar->addWidget(play_v);
    toolbar->addWidget(play_slider);
    toolbar->addWidget(rec_v);
    toolbar->addWidget(rec_slider);
    toolbar->addWidget(lcd);
    connect(newa, SIGNAL(triggered()), this, SLOT(newFile()));
    connect(open, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(save, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(saveas, SIGNAL(triggered()), this, SLOT(saveFileAs()));
    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));

    connect(zoomin, SIGNAL(triggered()), this, SLOT(zoomIn()));
    connect(zoomout, SIGNAL(triggered()), this, SLOT(zoomOut()));

    connect(settings, SIGNAL(triggered()), this, SLOT(settings()));
    setCentralWidget(wave);
    float * buffer;
    buffer = (float*)malloc(44100*sizeof(float));
    for (unsigned int i=0; i<44100; i++)
    {
        buffer[i]=sin(1*(2*M_PI)*i/44100);
    }
    wave->setSampleRate(44100);
    wave->setBytesPerSecond(1000);
    wave->setBuffer(buffer, 44100);
}
Esempio n. 2
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    Progress prog;
    QWidget wgt;

    QLabel* lbl = new QLabel("&Decimal value:");
    QSpinBox* box = new QSpinBox;
    box->setMaximum(1000);
    lbl->setBuddy(box);

    QLCDNumber* lcd = new QLCDNumber(12);
    lcd->setSegmentStyle(QLCDNumber::Flat);
    lcd->setBinMode();
    QLabel* lbl2 = new QLabel("Binary value:");
    QObject::connect(box, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));

    QLabel* lblurl = new QLabel("<a href=\"http://img12.nnm.me/7/b/a/8/7/7ba875b7bd80980f79ac6cae68418e77_full.jpg\">Нажми-ка!</a>");
    lblurl->setOpenExternalLinks(true);

    QVBoxLayout* layout = new QVBoxLayout;
    layout->addWidget(lbl);
    layout->addWidget(box);
    layout->addWidget(lbl2);
    layout->addWidget(lcd);
    layout->addWidget(lblurl);
    wgt.setLayout(layout);

    QSplitter split(Qt::Horizontal);
    split.addWidget(&prog);
    split.addWidget(&wgt);
    split.setGeometry(500,300,444,200);

    split.show();

    return a.exec();
}
Esempio n. 3
0
LCDRange::LCDRange(QWidget *parent)
    :QWidget(parent)
{
    QLCDNumber *lcd = new QLCDNumber(2);
    lcd->setSegmentStyle(QLCDNumber::Flat);
    //lcd->setSegmentStyle(QLCDNumber::Filled);
    lcd->setNumDigits(3);
    lcd->display(5);

    QSlider *slider = new QSlider(Qt::Horizontal);
    slider->setRange(0, 199);
    //slider->sizeHint();
    //slider->minimumSizeHint();
    slider->setValue(5);

    connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));
    connect(slider, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(lcd);
    layout->addWidget(slider);
    setLayout(layout);
}
Esempio n. 4
0
//! [2]
void LCDRange::init()
{
    QLCDNumber *lcd = new QLCDNumber(2);
    lcd->setSegmentStyle(QLCDNumber::Filled);

    slider = new QSlider(Qt::Horizontal);
    slider->setRange(0, 99);
    slider->setValue(0);
    label = new QLabel;
    label->setAlignment(Qt::AlignHCenter | Qt::AlignTop);

    connect(slider, SIGNAL(valueChanged(int)),
            lcd, SLOT(display(int)));
    connect(slider, SIGNAL(valueChanged(int)),
            this, SIGNAL(valueChanged(int)));

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(lcd);
    layout->addWidget(slider);
    layout->addWidget(label);
    setLayout(layout);

    setFocusProxy(slider);
}
Esempio n. 5
0
int main(int argc, char **argv) {
  QApplication app(argc, argv);

  QDial *dial = new QDial();
  dial->show();

  QLCDNumber *lcdnumber = new QLCDNumber();
  lcdnumber->display(12345);
  lcdnumber->show();

  QSlider *slider = new QSlider(Qt::Horizontal);
  slider->show();
  
  QHBoxLayout *hbox = new QHBoxLayout();
  QPushButton *button = new QPushButton("Push Me");
  QLineEdit *input = new QLineEdit();
  hbox->addWidget(button);
  hbox->addWidget(input);
  QWidget *widget = new QWidget();
  widget->setLayout(hbox);
  widget->show();

  return app.exec();
}
Esempio n. 6
0
FontPropertyWidget::FontPropertyWidget(FontProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
{
    groupBox_ = new QGroupBox(this);
    addWidget(groupBox_);

    QVBoxLayout* tgtFontLayout = new QVBoxLayout(groupBox_);
    tgtFontLayout->setContentsMargins(2,2,2,2);

    tgtFontType_ = new QComboBox();
    tgtFontType_->addItem("Bitmap", (int)tgt::Font::BitmapFont);
    tgtFontType_->addItem("Buffer", (int)tgt::Font::BufferFont);
    tgtFontType_->addItem("Extrude", (int)tgt::Font::ExtrudeFont);
    tgtFontType_->addItem("Outline", (int)tgt::Font::OutlineFont);
    tgtFontType_->addItem("Pixmap", (int)tgt::Font::PixmapFont);
    tgtFontType_->addItem("Polygon", (int)tgt::Font::PolygonFont);
    tgtFontType_->addItem("Texture", (int)tgt::Font::TextureFont);
    tgtFontLayout->addWidget(tgtFontType_);

    tgtFontName_ = new QComboBox();
    tgtFontName_->addItem("VeraMono", "VeraMono.ttf");
    tgtFontName_->addItem("Vera", "Vera.ttf");
    tgtFontLayout->addWidget(tgtFontName_);

    QLabel* fontSizeLabel = new QLabel("Fontsize:");
    tgtFontLayout->addWidget(fontSizeLabel);

    QWidget* tgtFontSize = new QWidget();
    QHBoxLayout* tgtFontSizeLayout = new QHBoxLayout(tgtFontSize);
    tgtFontSizeLayout->setContentsMargins(0,0,0,0);
    tgtFontSizeSlider_ = new QSlider(Qt::Horizontal);
    tgtFontSizeLayout->addWidget(tgtFontSizeSlider_);
    QLCDNumber* tgtFontSizeLCD = new QLCDNumber(2);
    tgtFontSizeLayout->addWidget(tgtFontSizeLCD);
    tgtFontLayout->addWidget(tgtFontSize);

    QLabel* lineWidthLabel = new QLabel("Line width:");
    tgtFontLayout->addWidget(lineWidthLabel);

    QWidget* tgtLineWidth = new QWidget();
    QHBoxLayout* tgtLineWidthLayout = new QHBoxLayout(tgtLineWidth);
    tgtLineWidthLayout->setContentsMargins(0,0,0,0);
    tgtLineWidthSlider_ = new QSlider(Qt::Horizontal);
    tgtLineWidthLayout->addWidget(tgtLineWidthSlider_);
    QLCDNumber* tgtLineWidthLCD = new QLCDNumber(3);
    tgtLineWidthLayout->addWidget(tgtLineWidthLCD);
    tgtFontLayout->addWidget(tgtLineWidth);

    tgtTextAlign_ = new QComboBox();
    tgtTextAlign_->addItem("Left", (int)tgt::Font::Left);
    tgtTextAlign_->addItem("Center", (int)tgt::Font::Center);
    tgtTextAlign_->addItem("Right", (int)tgt::Font::Right);
    tgtFontLayout->addWidget(tgtTextAlign_);

    tgtVerticalTextAlign_ = new QComboBox();
    tgtVerticalTextAlign_->addItem("Top", (int)tgt::Font::Top);
    tgtVerticalTextAlign_->addItem("Middle", (int)tgt::Font::Middle);
    tgtVerticalTextAlign_->addItem("Bottom", (int)tgt::Font::Bottom);
    tgtFontLayout->addWidget(tgtVerticalTextAlign_);

    tgtFontSizeLCD->setSegmentStyle(QLCDNumber::Filled);
    tgtLineWidthLCD->setSegmentStyle(QLCDNumber::Filled);

    tgtFontSizeSlider_->setMinimum(6);
    tgtFontSizeSlider_->setMaximum(36);

    tgtLineWidthSlider_->setMinimum(10);
    tgtLineWidthSlider_->setMaximum(999);

    connect(tgtFontType_,        SIGNAL(activated(int)),     this,            SLOT(updateProperty()));
    connect(tgtFontName_,        SIGNAL(activated(int)),     this,            SLOT(updateProperty()));
    connect(tgtFontSizeSlider_,  SIGNAL(valueChanged(int)),  this,            SLOT(updateProperty()));
    connect(tgtFontSizeSlider_,  SIGNAL(valueChanged(int)),  tgtFontSizeLCD,  SLOT(display(int)));
    connect(tgtLineWidthSlider_, SIGNAL(valueChanged(int)),  this,            SLOT(updateProperty()));
    connect(tgtLineWidthSlider_, SIGNAL(valueChanged(int)),  tgtLineWidthLCD, SLOT(display(int)));

    connect(tgtTextAlign_,        SIGNAL(currentIndexChanged(int)),     this,            SLOT(updateProperty()));
    connect(tgtVerticalTextAlign_,SIGNAL(currentIndexChanged(int)),     this,            SLOT(updateProperty()));

    updateFromProperty();
    addVisibilityControls();
}
Esempio n. 7
0
int main( int argc, char **argv )
{
    QApplication app( argc, argv );
#ifndef QSA_NO_EDITOR
    QWidget widget;
    QSProject project;
    QVBoxLayout *vboxLayout = new QVBoxLayout(&widget);

    // some help text
    QLabel *help = new QLabel("Right-click on any of the buttons to edit "
                              "its properties.");
    vboxLayout->addWidget(help);

    QWidget *hboxWidget = new QWidget;
    QHBoxLayout *hboxLayout = new QHBoxLayout(hboxWidget);
    vboxLayout->addWidget(hboxWidget);

    // create two sample widgets
    QGroupBox *lcdGroup = new QGroupBox( "lcd");
    hboxLayout->addWidget(lcdGroup);

    QVBoxLayout *lcdgroupLayout = new QVBoxLayout(lcdGroup);
    QLCDNumber *lcd = new QLCDNumber;
    lcd->setObjectName("lcd");
    lcdgroupLayout->addWidget(lcd);
    project.addObject(lcd);
    lcdgroupLayout->addWidget(new QLabel("Properties: <ul><li>value</li>"
                                         "<li>setHexMode()</li><li>...</li></ul>"));

    QGroupBox *editGroup = new QGroupBox( "edit");
    hboxLayout->addWidget(editGroup);

    QVBoxLayout *editgroupLayout = new QVBoxLayout(editGroup);
    QLineEdit *edit = new QLineEdit;
    edit->setObjectName("edit");
    edit->setText( "text" );
    editgroupLayout->addWidget(edit);
    project.addObject(edit);
    editgroupLayout->addWidget(new QLabel("Properties: <ul><li>text</li><li>maxLength</li>"
                                          "<li>clear()</li><li>...</li></ul>"));

    QWidget *buttonWidget = new QWidget;
    QVBoxLayout *buttonLayout = new QVBoxLayout(buttonWidget);
    hboxLayout->addWidget(buttonWidget);

    // add script buttons
    ScriptButton *button1 = new ScriptButton(&project, "Increase Counter", 0, "button1");
    buttonLayout->addWidget(button1);
    button1->setScriptCode( "Application.lcd.value++;" );

    ScriptButton *button2 = new ScriptButton(&project, "Reset Counter", 0, "button2");
    buttonLayout->addWidget(button2);
    button2->setScriptCode( "Application.lcd.value = 0;" );

    ScriptButton *button3 = new ScriptButton(&project, "Convert to uppercase", 0, "button3");
    buttonLayout->addWidget(button3);
    button3->setScriptCode( "Application.edit.text = Application.edit.text.upper();" );

    QPushButton *button4 = new QPushButton("&Quit");
    button4->setObjectName("button4");
    buttonLayout->addStretch(-1);
    buttonLayout->addWidget(button4);
    QObject::connect(button4, SIGNAL(clicked()), &app, SLOT(quit()));

    // teach interpreter about widgets
    project.interpreter()->addWrapperFactory( new WidgetWrapperFactory() );
    project.interpreter()->addObjectFactory( new QtNamespaceProvider() );

    widget.show();
#else
    QMessageBox::information( 0, "Disabled feature",
			      "QSA Editor has been disabled. Reconfigure to enable",
			      QMessageBox::Ok );
#endif

    return app.exec();
}
Esempio n. 8
0
TetrisWindow::TetrisWindow()
{
    board = new TetrisBoard;

    nextPieceLabel = new QLabel;
    nextPieceLabel->setFrameStyle(QFrame::Box | QFrame::Raised);
    nextPieceLabel->setAlignment(Qt::AlignCenter);
    nextPieceLabel->setMinimumHeight(100);
    board->setNextPieceLabel(nextPieceLabel);

    levelLcd = new QLCDNumber(7);
    levelLcd->setSegmentStyle(QLCDNumber::Filled);
    linesLcd = new QLCDNumber(7);
    linesLcd->setSegmentStyle(QLCDNumber::Filled);

    QLCDNumber* tetrominoesPlayedLCD = new QLCDNumber(5);
    tetrominoesPlayedLCD->setSegmentStyle(QLCDNumber::Filled);

    DigitalClock* digitalClock = new DigitalClock();


    startButton = new QPushButton(tr("&Start"));
    startButton->setFocusPolicy(Qt::NoFocus);
    quitButton = new QPushButton(tr("&Quit"));
    quitButton->setFocusPolicy(Qt::NoFocus);
    pauseButton = new QPushButton(tr("&Pause"));
    pauseButton->setFocusPolicy(Qt::NoFocus);
    pauseButton->setCheckable(true);

    QGroupBox *aiSelector = new QGroupBox(tr("Select AI"));

    QRadioButton *noneRadio = new QRadioButton(tr("None"));
    QRadioButton *greedyRadio = new QRadioButton(tr("Greedy"));
    QRadioButton *reinforcementRadio = new QRadioButton(tr("Reinforcement"));
    reinforcementRadio->setChecked(true);

    QCheckBox *autoPlayCheckBox = new QCheckBox(tr("Auto Play"));
    QCheckBox *lineDownCheckBox = new QCheckBox(tr("Line Down Timeout"));
    lineDownCheckBox->setChecked(true);
    QCheckBox *invisiblePlayCheckBox = new QCheckBox(tr("Play without gui"));
    QCheckBox *lookAheadCheckBox = new QCheckBox(tr("Use lookahead"));
    lookAheadCheckBox->setChecked(true);

    QCheckBox *autoStopCheckBox = new QCheckBox(tr("Auto stop after games:"));
    QLineEdit *numGamesBox = new QLineEdit();

    QSlider *speedSlider = new QSlider(Qt::Horizontal, 0);
    speedSlider->setRange(0,100);
    speedSlider->setValue(100);


    QVBoxLayout *aiSelectorLayout = new QVBoxLayout;
    aiSelectorLayout->addWidget(noneRadio);
    aiSelectorLayout->addWidget(greedyRadio);
    aiSelectorLayout->addWidget(reinforcementRadio);
    aiSelectorLayout->addWidget(autoPlayCheckBox);
    aiSelectorLayout->addWidget(invisiblePlayCheckBox);
    aiSelectorLayout->addWidget(lineDownCheckBox);
    aiSelectorLayout->addWidget(lookAheadCheckBox);
    aiSelectorLayout->addWidget(autoStopCheckBox);
    aiSelectorLayout->addWidget(numGamesBox);
    aiSelectorLayout->addWidget(speedSlider);

    //vbox->addStretch(1);

    aiSelector->setLayout(aiSelectorLayout);

    //statistics box
    QGroupBox *aiStatistics = new QGroupBox(tr("Statistics"));
    QLabel *numGamesDescription = new QLabel(tr("Games played"));
    QLCDNumber *numGames = new QLCDNumber(7);
    QLabel *totalMovesDescription = new QLabel(tr("Total moves"));
    QLCDNumber *totalMoves = new QLCDNumber(7);
    QLabel *maxLinesRemovedDescription = new QLabel(tr("Maximum lines removed"));
    QLCDNumber *maxLinesRemoved = new QLCDNumber(7);
    QLabel *avgLinesRemovedDescription = new QLabel(tr("Average lines removed"));
    QLCDNumber *avgLinesRemoved = new QLCDNumber(7);
    QLabel *movingAvgLinesRemovedDescription = new QLabel(tr("Moving average lines removed"));
    QLCDNumber *movingAvgLinesRemoved = new QLCDNumber(7);
    QGridLayout *aiStatisticsLayout = new QGridLayout;

    aiStatisticsLayout->addWidget(numGamesDescription, 0, 0);
    aiStatisticsLayout->addWidget(numGames, 0, 1);
    aiStatisticsLayout->addWidget(totalMovesDescription, 1, 0);
    aiStatisticsLayout->addWidget(totalMoves, 1, 1);
    aiStatisticsLayout->addWidget(maxLinesRemovedDescription, 2, 0);
    aiStatisticsLayout->addWidget(maxLinesRemoved, 2, 1);
    aiStatisticsLayout->addWidget(avgLinesRemovedDescription, 3, 0);
    aiStatisticsLayout->addWidget(avgLinesRemoved, 3, 1);
    aiStatisticsLayout->addWidget(movingAvgLinesRemovedDescription, 4, 0);
    aiStatisticsLayout->addWidget(movingAvgLinesRemoved, 4, 1);

    aiStatistics->setLayout(aiStatisticsLayout);

    //parameter loader
    QLineEdit *paramView = new QLineEdit("test");
    paramView->setReadOnly(true);
    QLineEdit *paramEdit = new QLineEdit;
    QGridLayout *paramBox = new QGridLayout;
    paramBox->addWidget(paramView, 0, 0);
    paramBox->addWidget(paramEdit, 1, 0);

    //tetris
    connect(startButton, SIGNAL(clicked()), board, SLOT(start()));
    connect(quitButton , SIGNAL(clicked()), qApp, SLOT(quit()));
    connect(pauseButton, SIGNAL(toggled(bool)), board, SLOT(pause(bool)));
    //connect(board, SIGNAL(scoreChanged(int)), scoreLcd, SLOT(display(int)));
    connect(board, SIGNAL(levelChanged(int)), levelLcd, SLOT(display(int)));
    connect(board, SIGNAL(linesRemovedChanged(int)), linesLcd, SLOT(display(int)));

    //connect ai stuff
    connect(speedSlider, SIGNAL(valueChanged(int)), board, SLOT(setAISpeed(int)));
    connect(autoPlayCheckBox, SIGNAL(toggled(bool)), board, SLOT(setAutoPlay(bool)));
    connect(invisiblePlayCheckBox, SIGNAL(toggled(bool)), board, SLOT(setInvisiblePlay(bool)));
    connect(lookAheadCheckBox, SIGNAL(toggled(bool)), board, SLOT(setLookAheadEnabled(bool)));
    connect(lineDownCheckBox, SIGNAL(toggled(bool)), board, SLOT(setLineDownTimeoutEnabled(bool)));
    connect(autoStopCheckBox, SIGNAL(toggled(bool)), board, SLOT(setAutoStopEnabled(bool)));
    connect(numGamesBox, SIGNAL(textEdited(QString)), board, SLOT(setAutoStopGames(QString)));
    connect(board, SIGNAL(gamesPlayedChanged(int)), numGames, SLOT(display(int)));
    connect(board, SIGNAL(totalMovesChanged(int)), totalMoves, SLOT(display(int)));
    connect(board, SIGNAL(maxLinesRemovedChanged(int)), maxLinesRemoved, SLOT(display(int)));
    connect(board, SIGNAL(avgLinesRemovedChanged(double)), avgLinesRemoved, SLOT(display(double)));
    connect(board, SIGNAL(movingAvgLinesChanged(double)), movingAvgLinesRemoved, SLOT(display(double)));
    connect(board, SIGNAL(parametersChanged(QString)), paramView, SLOT(setText(QString)));
    connect(paramEdit, SIGNAL(textEdited(QString)), board, SLOT(setParameters(QString)));

    //connect ai selector
    connect(noneRadio, SIGNAL(toggled(bool)), board, SLOT(setNoAI(bool)));
    connect(reinforcementRadio, SIGNAL(toggled(bool)), board, SLOT(setZuckerAI(bool)));
    connect(greedyRadio, SIGNAL(toggled(bool)), board, SLOT(setGreedyAI(bool)));

    //tetris
    QGridLayout *tetrisLayout = new QGridLayout;
    tetrisLayout->addWidget(board, 0, 0, 11, 1);

    int y=0;
    tetrisLayout->addWidget(createLabel(tr("TIME ELAPSED")), y++, 1);
    tetrisLayout->addWidget(digitalClock, y++, 1);
    tetrisLayout->addWidget(createLabel(tr("LEVEL")), y++, 1);
    tetrisLayout->addWidget(levelLcd, y++, 1);
    tetrisLayout->addWidget(createLabel(tr("LINES")), y++, 1);
    tetrisLayout->addWidget(linesLcd, y++, 1);
    tetrisLayout->addWidget(createLabel(tr("NEXT")), y++, 1);
    const int nextPieceRow = y;
    tetrisLayout->addWidget(nextPieceLabel, y++, 1);
    tetrisLayout->addWidget(quitButton, y++, 1);
    tetrisLayout->addWidget(pauseButton, y++, 1);
    tetrisLayout->addWidget(startButton, y++, 1);
    tetrisLayout->setColumnStretch(0, 2);
    tetrisLayout->setColumnStretch(1, 1);
    tetrisLayout->setRowMinimumHeight(nextPieceRow, 100);

    //our ai stuff
    QGridLayout *AILayout = new QGridLayout;
    AILayout->addWidget(aiSelector, 1, 0);
    AILayout->addWidget(aiStatistics, 2, 0);

    //combine layouts
    QGridLayout *boxLayout = new QGridLayout;
    boxLayout->addLayout(tetrisLayout, 0, 0);
    boxLayout->setColumnStretch(0, 3);
    boxLayout->addLayout(AILayout, 0, 1);
    boxLayout->setColumnStretch(1, 1);
    boxLayout->addLayout(paramBox, 1, 0, 1, 2);

    setLayout(boxLayout);

    setWindowTitle(tr("Restit"));
    resize(768, 576);
}
Esempio n. 9
0
void CSensorView::addWidget(QString var_name, QPoint var_pos)
{

    bool isExist=false;
    int indExistant=0;
    for(int ind=0;ind<listeAddedSignals.size();ind++)
        if(listeAddedSignals.at(ind)->addedSignalName.compare(var_name)==0)
        {
            isExist=true;
            indExistant=ind;
        }


    QVariant property_value=m_application->m_data_center->getDataProperty(var_name,"Type");
    QString mime_property=property_value.toString();
    int type;

    if(mime_property.isEmpty())
        type=mime_default;
    else if(mime_property.compare("sensor_tor")==0)
        type=mime_sensor_tor;
    else if(mime_property.compare("computed_signal")==0)
        type=mime_computed_signal;
    else
        type=mime_default;

    QLed * newLed;
    QLCDNumber * newLCDNumber;

    switch(type)
    {
        case mime_default:
        case mime_computed_signal:
            newLCDNumber =new QLCDNumber(m_ihm.ui.viewWidget);
            newLCDNumber->setObjectName(var_name);
            newLCDNumber->move(var_pos);
            newLCDNumber->setVisible(true);
            if (isExist)
            {
                listeAddedSignals.at(indExistant)->addedLCDNumber=newLCDNumber;
                listeAddedSignals.at(indExistant)->addedSignalPosition.setX(var_pos.x());
                listeAddedSignals.at(indExistant)->addedSignalPosition.setY(var_pos.y());
            }
            else
                listeAddedSignals << new viewWidget(var_name,var_pos,type,newLCDNumber);
            //qDebug() << "LCDNumber" << var_name << "ajouté";
            break;
        case mime_sensor_tor:
            newLed = new QLed(m_ihm.ui.viewWidget);
            newLed->setObjectName(var_name);
            newLed->setMinimumSize(20,20);
            newLed->setMaximumSize(20,20);
            newLed->setValue(true);
            newLed->move(var_pos);
            newLed->setVisible(true);
            if (isExist)
            {
                listeAddedSignals.at(indExistant)->addedLed=newLed;
                listeAddedSignals.at(indExistant)->addedSignalPosition.setX(var_pos.x());
                listeAddedSignals.at(indExistant)->addedSignalPosition.setY(var_pos.y());
            }
            else
                listeAddedSignals << new viewWidget(var_name,var_pos,type,newLed);
            //qDebug() << "Led" << var_name << "ajouté";
            break;
        default:
            break;
    }

}
Esempio n. 10
0
int main(int argc, char *argv[]) {
	QApplication app(argc, argv);

	/* 常數們 */
	int boardSize = BOARD_SIZE;
	int stoneSize = STONE_SIZE;
	int boardWidth = stoneSize*boardSize;

	/* 新視窗 */
	QWidget *window = new QMouseEventWindow;
	window->setWindowTitle("ReversiGrid");
	window->setFixedSize(boardWidth+200, boardWidth);
	QWidget *board = new QWidget(window);
	board->setFixedSize(boardWidth, boardWidth);

	/* 載入棋子圖片 */
	QPixmap *stoneWPix = new QPixmap(":/img/stoneW.png");
	QPixmap *stoneWPixS = new QPixmap;
	*stoneWPixS = stoneWPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneBPix = new QPixmap(":/img/stoneB.png");
	QPixmap *stoneBPixS = new QPixmap;
	*stoneBPixS = stoneBPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneWaPix = new QPixmap(":/img/stoneWa.png");
	QPixmap *stoneWaPixS = new QPixmap;
	*stoneWaPixS = stoneWaPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneBaPix = new QPixmap(":/img/stoneBa.png");
	QPixmap *stoneBaPixS = new QPixmap;
	*stoneBaPixS = stoneBaPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneWsPix = new QPixmap(":/img/stoneWs.png");
	QPixmap *stoneWsPixS = new QPixmap;
	*stoneWsPixS = stoneWsPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneBsPix = new QPixmap(":/img/stoneBs.png");
	QPixmap *stoneBsPixS = new QPixmap;
	*stoneBsPixS = stoneBsPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *nullPix = new QPixmap(":/img/null.png");


	/* 棋盤網格排版 */
	QGridLayout *grid = new QGridLayout;
	grid->setSpacing(0);
	grid->setMargin(0);
	grid->setGeometry(QRect(0, 0, 10, 100));

	/* 構建棋盤 */
	QLabel *square[BOARD_SIZE*BOARD_SIZE];
	for (int i=0; i<boardSize; i++) {
		for (int j=0; j<boardSize; j++) {
			square[i*BOARD_SIZE+j] = new QLabel;
			square[i*BOARD_SIZE+j]->setFrameStyle(QFrame::Panel + QFrame::Sunken);
			square[i*BOARD_SIZE+j]->setAlignment(Qt::AlignCenter);
			square[i*BOARD_SIZE+j]->setAttribute(Qt::WA_TranslucentBackground);
			// square[i*BOARD_SIZE+j]->setPixmap();
			square[i*BOARD_SIZE+j]->setAttribute(Qt::WA_TransparentForMouseEvents, true);
			grid->addWidget(square[i*BOARD_SIZE+j], i, j);
		}
	}
	QLabel *turnT = new QLabel(window);
	turnT->setGeometry(boardWidth, 20, 200, 14);
	turnT->setText("<center>Next move:</center>");
	QLabel *turn = new QLabel(window);
	turn->setGeometry(boardWidth+100-(STONE_SIZE/2), 45, STONE_SIZE, STONE_SIZE);
	turn->setFrameStyle(QFrame::Sunken);

	/* 遊戲物件 */
	game = new Game(square, turn,
		stoneWPixS, stoneBPixS,
		stoneWaPixS, stoneBaPixS,
		stoneWsPixS, stoneBsPixS,
		nullPix);

	/* UI */
	QCheckBox *hintCheckBox = new QCheckBox("Show hints");
	hintCheckBox->setParent(window);
	hintCheckBox->setGeometry(boardWidth+50, 210, 100, 20);
	QObject::connect(hintCheckBox, SIGNAL(stateChanged(int)), game, SLOT(hintSwitch(int)));

	QLabel *bScore = new QLabel(window);
	bScore->setGeometry(boardWidth, 100, 200, 14);
	bScore->setText("<center>Black</center>");
	QLabel *wScore = new QLabel(window);
	wScore->setGeometry(boardWidth, 150, 200, 14);
	wScore->setText("<center>White</center>");
	QLCDNumber *lcdB = new QLCDNumber(window);
	QLCDNumber *lcdW = new QLCDNumber(window);
	lcdB->setGeometry(boardWidth+50, 120, 100, 24);
	lcdW->setGeometry(boardWidth+50, 170, 100, 24);
	QObject::connect(game, SIGNAL(updateBScore(int)), lcdB, SLOT(display(int)));
	QObject::connect(game, SIGNAL(updateWScore(int)), lcdW, SLOT(display(int)));

	QCheckBox *aiBCheckBox = new QCheckBox("AI");
	aiBCheckBox->setParent(window);
	aiBCheckBox->setGeometry(boardWidth+140, 100, 50, 14);
	QObject::connect(aiBCheckBox, SIGNAL(stateChanged(int)), game, SLOT(aiBSwitch(int)));

	QCheckBox *aiWCheckBox = new QCheckBox("AI");
	aiWCheckBox->setParent(window);
	aiWCheckBox->setGeometry(boardWidth+140, 150, 50, 14);
	QObject::connect(aiWCheckBox, SIGNAL(stateChanged(int)), game, SLOT(aiWSwitch(int)));

	/* 按鍵 */
	QPushButton *undoBtn = new QPushButton("Undo");
	undoBtn->setParent(window);
	undoBtn->setGeometry(boardWidth+140, 64, 42, 22);
	undoBtn->setEnabled(false);
	QObject::connect(undoBtn, SIGNAL(clicked()), game, SLOT(undo()));
	QObject::connect(game, SIGNAL(undoAvai(bool)), undoBtn, SLOT(setEnabled(bool)));

	QPushButton *restartBtn = new QPushButton("Restart");
	restartBtn->setParent(window);
	restartBtn->setGeometry(boardWidth+50, 242, 100, 36);
	QObject::connect(restartBtn, SIGNAL(clicked()), game, SLOT(reset()));

	QPushButton *exitBtn = new QPushButton("Exit");
	exitBtn->setParent(window);
	exitBtn->setGeometry(boardWidth+50, 272, 100, 36);
	QObject::connect(exitBtn, SIGNAL(clicked()), &app, SLOT(quit()));

	/* 計時器 */
	QTimer *update = new QTimer;
	update->start(10);
	QObject::connect(update, SIGNAL(timeout()), game, SLOT(update()));

	/* 準備視窗 */
	board->setLayout(grid);
	window->setMouseTracking(true);
	window->show();

	game->reset();

	return app.exec();
}
Esempio n. 11
0
void LCDRange::resizeEvent( QResizeEvent * )
{
    sBar->setGeometry( 0, height() - 16, width(), 16 );
    lcd->resize( width(), sBar->y() - 5 );
}
Esempio n. 12
0
    void setupUi(QMainWindow *Detection)
    {
        if (Detection->objectName().isEmpty())
            Detection->setObjectName(QString::fromUtf8("Detection"));
        Detection->resize(729, 480);
        actionE_xit = new QAction(Detection);
        actionE_xit->setObjectName(QString::fromUtf8("actionE_xit"));
        action_Load_Map = new QAction(Detection);
        action_Load_Map->setObjectName(QString::fromUtf8("action_Load_Map"));
        action_Connect = new QAction(Detection);
        action_Connect->setObjectName(QString::fromUtf8("action_Connect"));
        action_Disconnect = new QAction(Detection);
        action_Disconnect->setObjectName(QString::fromUtf8("action_Disconnect"));
        centralWidget = new QWidget(Detection);
        centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
        gridLayoutWidget = new QWidget(centralWidget);
        gridLayoutWidget->setObjectName(QString::fromUtf8("gridLayoutWidget"));
        gridLayoutWidget->setGeometry(QRect(0, 0, 721, 421));
        gridLayout = new QGridLayout(gridLayoutWidget);
        gridLayout->setSpacing(6);
        gridLayout->setContentsMargins(11, 11, 11, 11);
        gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
        gridLayout->setSizeConstraint(QLayout::SetNoConstraint);
        gridLayout->setVerticalSpacing(5);
        gridLayout->setContentsMargins(0, 0, 0, 0);
        ugvFeedLabel = new QLabel(gridLayoutWidget);
        ugvFeedLabel->setObjectName(QString::fromUtf8("ugvFeedLabel"));
        QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(ugvFeedLabel->sizePolicy().hasHeightForWidth());
        ugvFeedLabel->setSizePolicy(sizePolicy);

        gridLayout->addWidget(ugvFeedLabel, 1, 2, 1, 1);

        connectionButton = new QCommandLinkButton(gridLayoutWidget);
        connectionButton->setObjectName(QString::fromUtf8("connectionButton"));

        gridLayout->addWidget(connectionButton, 0, 2, 1, 1);

        uavFeedLabel = new QLabel(gridLayoutWidget);
        uavFeedLabel->setObjectName(QString::fromUtf8("uavFeedLabel"));
        sizePolicy.setHeightForWidth(uavFeedLabel->sizePolicy().hasHeightForWidth());
        uavFeedLabel->setSizePolicy(sizePolicy);
        uavFeedLabel->setMaximumSize(QSize(16777215, 16777215));

        gridLayout->addWidget(uavFeedLabel, 1, 0, 1, 1);

        ugvMapLabel = new QLabel(gridLayoutWidget);
        ugvMapLabel->setObjectName(QString::fromUtf8("ugvMapLabel"));
        QSizePolicy sizePolicy1(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
        sizePolicy1.setHorizontalStretch(0);
        sizePolicy1.setVerticalStretch(0);
        sizePolicy1.setHeightForWidth(ugvMapLabel->sizePolicy().hasHeightForWidth());
        ugvMapLabel->setSizePolicy(sizePolicy1);

        gridLayout->addWidget(ugvMapLabel, 1, 3, 1, 1);

        horizontalLayout_4 = new QHBoxLayout();
        horizontalLayout_4->setSpacing(6);
        horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
        label_2 = new QLabel(gridLayoutWidget);
        label_2->setObjectName(QString::fromUtf8("label_2"));

        horizontalLayout_4->addWidget(label_2);

        uavTakeoffLandButton = new QPushButton(gridLayoutWidget);
        uavTakeoffLandButton->setObjectName(QString::fromUtf8("uavTakeoffLandButton"));

        horizontalLayout_4->addWidget(uavTakeoffLandButton);


        gridLayout->addLayout(horizontalLayout_4, 2, 0, 1, 1);

        horizontalLayout_2 = new QHBoxLayout();
        horizontalLayout_2->setSpacing(6);
        horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
        label = new QLabel(gridLayoutWidget);
        label->setObjectName(QString::fromUtf8("label"));

        horizontalLayout_2->addWidget(label);

        ugvSpeedLCD = new QLCDNumber(gridLayoutWidget);
        ugvSpeedLCD->setObjectName(QString::fromUtf8("ugvSpeedLCD"));
        ugvSpeedLCD->setFrameShape(QFrame::Box);

        horizontalLayout_2->addWidget(ugvSpeedLCD);


        gridLayout->addLayout(horizontalLayout_2, 4, 2, 1, 1);

        horizontalLayout_6 = new QHBoxLayout();
        horizontalLayout_6->setSpacing(6);
        horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6"));
        label_3 = new QLabel(gridLayoutWidget);
        label_3->setObjectName(QString::fromUtf8("label_3"));

        horizontalLayout_6->addWidget(label_3);

        ugvSpeakerButton = new QPushButton(gridLayoutWidget);
        ugvSpeakerButton->setObjectName(QString::fromUtf8("ugvSpeakerButton"));

        horizontalLayout_6->addWidget(ugvSpeakerButton);


        gridLayout->addLayout(horizontalLayout_6, 2, 2, 1, 1);

        verticalLayout = new QVBoxLayout();
        verticalLayout->setSpacing(6);
        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
        label_4 = new QLabel(gridLayoutWidget);
        label_4->setObjectName(QString::fromUtf8("label_4"));
        label_4->setAlignment(Qt::AlignCenter);

        verticalLayout->addWidget(label_4);

        sauverStatus = new QTextBrowser(gridLayoutWidget);
        sauverStatus->setObjectName(QString::fromUtf8("sauverStatus"));
        sauverStatus->setEnabled(true);
        QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Minimum);
        sizePolicy2.setHorizontalStretch(0);
        sizePolicy2.setVerticalStretch(0);
        sizePolicy2.setHeightForWidth(sauverStatus->sizePolicy().hasHeightForWidth());
        sauverStatus->setSizePolicy(sizePolicy2);
        sauverStatus->setMaximumSize(QSize(777215, 215));

        verticalLayout->addWidget(sauverStatus);


        gridLayout->addLayout(verticalLayout, 4, 3, 1, 1);

        label_5 = new QLabel(gridLayoutWidget);
        label_5->setObjectName(QString::fromUtf8("label_5"));

        gridLayout->addWidget(label_5, 0, 0, 1, 1);

        Detection->setCentralWidget(centralWidget);
        menuBar = new QMenuBar(Detection);
        menuBar->setObjectName(QString::fromUtf8("menuBar"));
        menuBar->setGeometry(QRect(0, 0, 729, 23));
        menuFile = new QMenu(menuBar);
        menuFile->setObjectName(QString::fromUtf8("menuFile"));
        menu_Tools = new QMenu(menuBar);
        menu_Tools->setObjectName(QString::fromUtf8("menu_Tools"));
        menu_Help = new QMenu(menuBar);
        menu_Help->setObjectName(QString::fromUtf8("menu_Help"));
        Detection->setMenuBar(menuBar);
        mainToolBar = new QToolBar(Detection);
        mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
        Detection->addToolBar(Qt::TopToolBarArea, mainToolBar);
        statusBar = new QStatusBar(Detection);
        statusBar->setObjectName(QString::fromUtf8("statusBar"));
        Detection->setStatusBar(statusBar);

        menuBar->addAction(menuFile->menuAction());
        menuBar->addAction(menu_Tools->menuAction());
        menuBar->addAction(menu_Help->menuAction());
        menuFile->addAction(action_Load_Map);
        menuFile->addAction(action_Disconnect);
        menuFile->addAction(actionE_xit);
        menu_Tools->addAction(action_Connect);

        retranslateUi(Detection);
        QObject::connect(actionE_xit, SIGNAL(activated()), Detection, SLOT(close()));
        QObject::connect(action_Connect, SIGNAL(activated()), connectionButton, SLOT(click()));

        QMetaObject::connectSlotsByName(Detection);
    } // setupUi
Esempio n. 13
0
QLCDNumber * GameBoard::createLCD()
{
    QLCDNumber * LCD = new QLCDNumber(2);
    LCD->setSegmentStyle(QLCDNumber::Filled);
    return LCD;
}
Esempio n. 14
0
void WifiWidget::setupDisplay()
{
    const int numRowsPerInterface = 6; 
    const int numDigits = 4;
    
    QGridLayout *globalLayout = new QGridLayout(this);
    globalLayout->setColumnStretch(0,0);
    globalLayout->setColumnStretch(1,1);
    globalLayout->setColumnStretch(2,1);
    
    for (unsigned int i=0; i<numInterfaces_; i++)
    {
        QLabel *interfaceLabel = new QLabel;
        interfaceLabel->setFont(QFont("Helvetica", 12, QFont::Bold));
        globalLayout->addWidget(interfaceLabel,numRowsPerInterface*i,0);
        interfaceLabels_.push_back( interfaceLabel );
        
        QLabel *accessPointLabel = new QLabel;
        accessPointLabel->setFont(QFont("Helvetica", 12, QFont::Bold));
        globalLayout->addWidget(accessPointLabel,numRowsPerInterface*i,1);
        accessPointLabels_.push_back( accessPointLabel );
        
        QLCDNumber *lcdSignalLevel = new QLCDNumber(numDigits, this);
        lcdSignalLevel->setSegmentStyle(QLCDNumber::Filled);
        lcdsSignal_.push_back(lcdSignalLevel);
        QLCDNumber *lcdMaxSignalLevel = new QLCDNumber(numDigits, this);
        lcdMaxSignalLevel->setSegmentStyle(QLCDNumber::Filled);
        lcdsMaxSignal_.push_back(lcdMaxSignalLevel);
        QLabel *signalLabel = new QLabel("Signal: ");
        globalLayout->addWidget( signalLabel,numRowsPerInterface*i+1,0);
        globalLayout->addWidget( lcdSignalLevel,numRowsPerInterface*i+1,1);
        globalLayout->addWidget( lcdMaxSignalLevel,numRowsPerInterface*i+1,2);
        
        QLCDNumber *lcdNoiseLevel = new QLCDNumber(numDigits, this);
        lcdNoiseLevel->setSegmentStyle(QLCDNumber::Filled);
        lcdsNoise_.push_back(lcdNoiseLevel);
        QLCDNumber *lcdMaxNoiseLevel = new QLCDNumber(numDigits, this);
        lcdMaxNoiseLevel->setSegmentStyle(QLCDNumber::Filled);
        lcdsMaxNoise_.push_back(lcdMaxNoiseLevel);
        QLabel *noiseLabel = new QLabel("Noise: ");
        globalLayout->addWidget( noiseLabel,numRowsPerInterface*i+2,0);
        globalLayout->addWidget( lcdNoiseLevel,numRowsPerInterface*i+2,1);
        globalLayout->addWidget( lcdMaxNoiseLevel,numRowsPerInterface*i+2,2);
        
        QLCDNumber *lcdLinkLevel = new QLCDNumber(numDigits, this);
        lcdLinkLevel->setSegmentStyle(QLCDNumber::Filled);
        lcdsLink_.push_back(lcdLinkLevel);
        QLCDNumber *lcdMaxLinkLevel = new QLCDNumber(numDigits, this);
        lcdMaxLinkLevel->setSegmentStyle(QLCDNumber::Filled);
        lcdsMaxLink_.push_back(lcdMaxLinkLevel);
        QLabel *linkLabel = new QLabel("Link quality: ");
        globalLayout->addWidget( linkLabel,numRowsPerInterface*i+3,0);
        globalLayout->addWidget( lcdLinkLevel,numRowsPerInterface*i+3,1);
        globalLayout->addWidget( lcdMaxLinkLevel,numRowsPerInterface*i+3,2);
                
        QLCDNumber *lcdBitrate = new QLCDNumber(numDigits, this);
        lcdBitrate->setSegmentStyle(QLCDNumber::Filled);
        lcdsBitrate_.push_back(lcdBitrate);
        QLabel *bitRateLabel = new QLabel("Bit rate (Mb/s): ");
        globalLayout->addWidget( bitRateLabel,numRowsPerInterface*i+4,0);
        globalLayout->addWidget( lcdBitrate,numRowsPerInterface*i+4,1);
        
        QProgressBar *overall = new QProgressBar;
        overall->setMinimum(0);
        overall->setMaximum(MAXIMUM_SNR);
        progressBars_.push_back(overall);
        QLabel *progressLabel = new QLabel("Overall signal level: ");
        QLabel *overallSigLabel = new QLabel;
        overallSigLabel->setFont(QFont("Helvetica", 12, QFont::Bold));
        overallSigLabels_.push_back( overallSigLabel );
        globalLayout->addWidget( progressLabel,numRowsPerInterface*i+5,0);
        globalLayout->addWidget( overall,numRowsPerInterface*i+5,1);
        globalLayout->addWidget( overallSigLabel,numRowsPerInterface*i+5,2);
    }
    setLayout(globalLayout);
}
void DataWidget::setValue(double value)
{
    switch (_dataDescription->widget)
    {
    case DATA_WIDGET_PLOT:
	{
            QwtPlot *widget = qobject_cast<QwtPlot*> (_internalWidget);
            if (widget != 0)
            {
                _curveData->xData->append(_mainWindow->effectiveRunningTime());
                _curveData->yData->append(value);
#if QWT_VERSION >= 0x060000
                _curve->setRawSamples(_curveData->xData->data(),
                                      _curveData->yData->data(), _curveData->xData->size());
#else
#  warning Old version of qwt being used, data aggregator will not work.
#endif
                widget->replot();
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_LCD:
	{
            QLCDNumber *widget = qobject_cast<QLCDNumber*> (_internalWidget);
            if (widget != 0)
            {
                widget->display(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_LEVEL:
	{
            QwtThermo *widget = qobject_cast<QwtThermo*> (_internalWidget);
            if (widget != 0)
            {
                widget->setValue(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_DIAL:
	{
            QwtDial *widget = qobject_cast<QwtDial*> (_internalWidget);
            if (widget != 0)
            {
                widget->setValue(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    default:
        ;
    }

    emit valueChanged(value, _dataDescription->id);
}