Example #1
0
void TagGameStateManager::loop() {
    switch(state) {
        case NOT_IT:
            if ((*checkTagged)()) {
                beTagged();
            }
            time_since_it_i ++;
            break;
        case IT:
            if ((*checkUnTagged)()) {
                beUnTagged();
            }
           
            break;
        case FROZEN:
            if ((*checkUnTagged)()) {
                beUnTagged();
                time_since_it_i = 0;
            }

            break;
    }

    if (checkIt()) {
        state = IT;
    }

    if (checkNotPlaying()) {
        state = NOT_PLAYING;
    }
}
// 一开始把图片添加到每个block上,然后排列到mainlayout上面
void BlockAreaCatch::set_block_area() {
    mainLayout = new QVBoxLayout(this);
    hLayout = new QHBoxLayout();
    QLabel *text = new QLabel("剩余时间: ");
    QFont labelFont;
    labelFont.setPointSize(14);
    text->setFont(labelFont);
    bar = new QProgressBar();
    bar->resize(600, 30);
    hLayout->addWidget(text);
    hLayout->addWidget(bar);
    gridLayout = new QGridLayout();
    for(int i = 0; i < myRow; ++i){
        for(int j = 0; j < myColumn; ++j){
            Block *bb = new Block;
            w = bb->width();
            h = bb->height();
            bb->setNumber(i, j);
            originalState(bb);
            bb->setPixmap(QPixmap(":/image/0.png"));
            gridLayout->addWidget(bb, i, j, Qt::AlignCenter);
            connect(bb, SIGNAL(userAction(onePointPosition)), this, SLOT(checkIt(onePointPosition)));
        }
    }
    mainLayout->addLayout(hLayout);
    mainLayout->addLayout(gridLayout);
    bar->setMaximum(counter);
    timer.setInterval(100);
    connect(&timer, SIGNAL(timeout()), this, SLOT(updateProgressbar()));
    timer.start();
}
PriceChecker::PriceChecker( QWidget *parent )
: KDialog( parent )
{
  setWindowFlags(Qt::Dialog|Qt::FramelessWindowHint);
  ui = new PriceCheckerUI( this );
  setMainWidget( ui );
  setCaption( i18n("Price Checker") );
  setButtons( KDialog::NoDefault );
  ui->titleTop->setText(i18nc("Price-Checker dialog", "Price")); //FIXME: translation problems!!!!!!
  ui->titleBottom->setText(i18nc("Price-Checker dialog", "Checker")); //FIXME: translation problems!!!!!!
  ui->labelPCCode->setText(i18n("&Code:"));
  ui->labelPCClose->setText(i18n("Press ESC to Close"));
  ui->labelPClPrice->setText(i18n("Regular price:"));
  ui->labelPClTotal->setText(i18n("Final price:"));
  ui->labelPClDiscount->setText(i18n("Discount:"));
  QString path = KStandardDirs::locate("appdata", "styles/");
  QPixmap pix = QPixmap(path + Settings::styleName() + "/priceCheckerBack.png");
  resize(517,309);
  setMask( pix.mask() );
  pix = QPixmap(path + Settings::styleName() + "/pricechecker.png");
  ui->titleImg->setPixmap(pix);

  //connect( ui->editCode, SIGNAL(textEdited(const QString &)),this, SLOT(checkIt()) );
  //NOTE: There are some issues when having the 'textEdited' signal connected to ckeckIt(),
  //      When you want to use the barcode reader, it sends an enter and then the code is ready to be searched.
  //      Then if you want to read another code to search, the edit line is not cleared. it makes difficult to use it.
  //      So we need to execute the query when the 'enter' event is rised and clean the code input line to let it ready for another search.
  //      With textEdited the code is searched every single number is entered (when not using barcode reader)
  //      causing many database queries to be executed.
  connect( ui->editCode, SIGNAL(returnPressed()),this, SLOT(checkIt()) );
  
//  QRegExp regexpC("[0-9]{1,13}");
//  QRegExpValidator * validator = new QRegExpValidator(regexpC, this);
//  ui->editCode->setValidator(validator);

  ui->editCode->setFocus();

  myDb = new Azahar;
}
Example #4
0
void 
BaseTestCase::testUsingCheckIt()
{
  checkIt();
}
Example #5
0
int main (void)
{
  IPC_initialize();

  checkIt(NULL, NULL);
  checkIt("", "");
  checkIt(NULL, "");
  checkIt(INT_FORMAT, INT_FORMAT);
  checkIt(STRING_FORMAT, STRING_FORMAT);
  checkIt(SAMPLE_FORMAT, SAMPLE_FORMAT);
  checkIt(MATRIX_LIST_FORMAT, MATRIX_LIST_FORMAT);
  checkIt(MATRIX_FORMAT, MATRIX_FORMAT);
  checkIt(PTR1_FORMAT, PTR1_FORMAT);
  checkIt(T1_FORMAT, T1_FORMAT);
  checkIt(T2_FORMAT, T2_FORMAT);

  fprintf(stderr, "\n");

  checkIt(INT_FORMAT, STRING_FORMAT);
  checkIt(INT_FORMAT, SAMPLE_FORMAT);
  checkIt(SAMPLE_FORMAT, MATRIX_LIST_FORMAT);
  checkIt(SAMPLE_FORMAT, MATRIX_FORMAT);
  checkIt(PTR1_FORMAT, PTR2_FORMAT);
  checkIt(T1_FORMAT, T1A_FORMAT);
  checkIt(T1_FORMAT, T1B_FORMAT);
  checkIt(T2_FORMAT, T2A_FORMAT);
  checkIt(T2_FORMAT, T2B_FORMAT);
  return 0;
}