コード例 #1
0
ファイル: main.cpp プロジェクト: alecadair/Simon
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    SimonModel simon;
    //GameEngine engine(w,simon);

    w.show();

    QObject::connect(&w, SIGNAL(RedButtonPushed()), &simon, SLOT(RedPushed()));
    QObject::connect(&w, SIGNAL(BlueButtonPushed()), &simon, SLOT(BluePushed()));
    QObject::connect(&w, SIGNAL(StartButtonPushed()), &simon, SLOT(StartPushed()));
    QObject::connect(&simon, SIGNAL(Highlight(bool, int)), &w, SLOT(ButtonToHighlight(bool, int)));
    QObject::connect(&simon, SIGNAL(DisableStart()), &w, SLOT(disableStart()));
    QObject::connect(&simon, SIGNAL(playersTurn()), &w, SLOT(playersTurn()));
    QObject::connect(&simon, SIGNAL(computersTurn()), &w, SLOT(computersTurn()));
    QObject::connect(&simon, SIGNAL(HighlightDone()), &w, SLOT(HighlightDone()));
    QObject::connect(&simon,SIGNAL(updateStartTime(int)), &w, SLOT(updateStartTime(int)));
    QObject::connect(&simon, SIGNAL(updateProgress(int, int)), &w, SLOT(updateProgress(int, int)));
    QObject::connect(&simon, SIGNAL(wrongMove()), &w, SLOT(wrongMove()));
    QObject::connect(&w, SIGNAL(restart2()), &simon, SLOT(restartSlot()));
    QObject::connect(&simon, SIGNAL(restartSig()), &w, SLOT(restartForModel()));
    QObject::connect(&simon, SIGNAL(updateTextSig(QString)), &w, SLOT(updateText(QString)));
    return a.exec();
}
コード例 #2
0
ファイル: spikeFSPulseGUI.cpp プロジェクト: kemerelab/NSpike2
PulseFileTab::PulseFileTab (QWidget *parent)
  : QWidget(parent)
{
    /*
     * =========================================================
     * Drive laser using a file specifying pulses to use
     * =========================================================
     */
    Q3GridLayout *grid0 = new Q3GridLayout(this, 10, 6, 0, 0, "grid 1");

    /* create a menu bar  */
    menuBar = new QMenuBar(this);
    fileMenu = new Q3PopupMenu(this);
    openFileID = fileMenu->insertItem( "&Open File", this, SLOT(open()));
    saveFileID= fileMenu->insertItem( "Save File", this, SLOT(save()));
    closeFileID = fileMenu->insertItem( "&Close File", this, SLOT(close())); 
    sendFileID = fileMenu->insertItem( "&Send File to FS Program", this, SLOT(send())); 
    menuBar->insertItem( "&File", fileMenu );
    grid0->addMultiCellWidget(menuBar, 0, 1, 0, 4);

    textEdit = new Q3TextEdit(this);
    textEdit->setTextFormat( Qt::PlainText ); 
    connect(textEdit, SIGNAL(textChanged()), this, SLOT(disableStart()));
    connect(daq_io_widget, SIGNAL(pulseFileLineExecuted(int)), this, SLOT(lineExecuted(int)));
    
    grid0->addMultiCellWidget(textEdit, 1, 7, 0, 2);

    QLabel *readme = new QLabel("readme", this, 0);
    readme->setText("Text file format: <p> pulse number pulse freq pause");
    grid0->addMultiCellWidget(readme, 4, 8, 4, 5);

    pulseStart = new QPushButton("Start", this, "start");
    pulseStart->setToggleButton(TRUE);
    /* start with this disabled so that we can only start once we've send the
     * text to the user program */
    pulseStart->setEnabled(false);
    connect(pulseStart, SIGNAL(toggled(bool)), this, SLOT(startPulseSeq(bool)));
    grid0->addMultiCellWidget(pulseStart, 9, 9, 1, 1);

    pulseStop = new QPushButton("Stop", this, "stop");
    pulseStop->setToggleButton(TRUE);
    pulseStop->setOn(true);
    connect(pulseStop, SIGNAL(toggled(bool)), this, SLOT(stopPulseSeq(bool)));
    grid0->addMultiCellWidget(pulseStop, 9, 9, 4, 4); 

    fileOpen = 0;
}