void RecipeExtrasWidget::changed(QMetaProperty prop, QVariant /*val*/) { if( sender() != recipe ) return; showChanges(&prop); }
void InstructionWidget::changed(QMetaProperty prop, QVariant /*val*/) { if( sender() != insObs ) return; showChanges(); }
void TimerWidget::setTimer(QString text) { QStringList strList = text.split(":", QString::SkipEmptyParts); bool conversionOk = true; if( strList.size() == 1 ) { seconds = strList[0].toUInt(&conversionOk); if( ! conversionOk ) seconds = 0; hours = 0; minutes = 0; } else if( strList.size() == 2 ) { minutes = strList[0].toUInt(&conversionOk); if( ! conversionOk ) minutes = 0; seconds = strList[1].toUInt(&conversionOk); if( ! conversionOk ) seconds = 0; hours = 0; } else if( strList.size() == 3 ) { hours = strList[0].toUInt(&conversionOk); if( ! conversionOk ) hours = 0; minutes = strList[1].toUInt(&conversionOk); if( ! conversionOk ) minutes = 0; seconds = strList[2].toUInt(&conversionOk); if( ! conversionOk ) seconds = 0; } else { hours = 0; minutes = 0; seconds = 0; } if( seconds >= 60 ) { minutes += seconds/(unsigned int)60; seconds = seconds % 60; } if( minutes >= 60 ) { hours += minutes/(unsigned int)60; minutes = minutes % 60; } showChanges(); }
void InstructionWidget::setInstruction(Instruction* ins) { if( insObs ) disconnect( insObs, 0, this, 0 ); insObs = ins; if( insObs ) connect( insObs, SIGNAL(changed(QMetaProperty,QVariant)), this, SLOT(changed(QMetaProperty,QVariant)) ); showChanges(); }
void FermentableEditor::setFermentable( Fermentable* f ) { if( obsFerm ) disconnect( obsFerm, 0, this, 0 ); obsFerm = f; if( obsFerm ) { connect( obsFerm, SIGNAL(changed(QMetaProperty,QVariant)), this, SLOT(changed(QMetaProperty,QVariant)) ); showChanges(); } }
void HopEditor::setHop( Hop* h ) { if( obsHop ) disconnect( obsHop, 0, this, 0 ); obsHop = h; if( obsHop ) { connect( obsHop, SIGNAL(changed(QMetaProperty,QVariant)), this, SLOT(changed(QMetaProperty,QVariant)) ); showChanges(); } }
void MashEditor::setMash(Mash* mash) { if( mashObs ) disconnect( mashObs, 0, this, 0 ); mashObs = mash; if( mashObs ) { connect( mashObs, SIGNAL(changed(QMetaProperty,QVariant)), this, SLOT(changed(QMetaProperty,QVariant)) ); showChanges(); } }
void RecipeExtrasWidget::setRecipe(Recipe* rec) { if( recipe ) disconnect( recipe, 0, this, 0 ); if( rec ) { recipe = rec; connect( recipe, SIGNAL(changed(QMetaProperty,QVariant)), this, SLOT(changed(QMetaProperty,QVariant)) ); showChanges(); } }
void MiscEditor::setMisc( Misc* m ) { if( obsMisc ) disconnect( obsMisc, 0, this, 0 ); obsMisc = m; if( obsMisc ) { connect( obsMisc, SIGNAL(changed(QMetaProperty,QVariant)), this, SLOT(changed(QMetaProperty,QVariant)) ); showChanges(); } }
void StyleEditor::setStyle( Style* s ) { if( obsStyle ) disconnect( obsStyle, 0, this, 0 ); obsStyle = s; if( obsStyle ) { connect( obsStyle, SIGNAL(changed(QMetaProperty,QVariant)), this, SLOT(changed(QMetaProperty,QVariant)) ); showChanges(); } styleComboBox->setCurrentIndex(styleListModel->indexOf(obsStyle)); }
void EquipmentEditor::setEquipment( Equipment* e ) { if( e ) { obsEquip = e; // Make sure the combo box gets set to the right place. QModelIndex modelIndex(equipmentListModel->find(e)); QModelIndex viewIndex(equipmentSortProxyModel->mapFromSource(modelIndex)); if( viewIndex.isValid() ) equipmentComboBox->setCurrentIndex(viewIndex.row()); showChanges(); } }
void TimerWidget::subtractOneSecond() { if( seconds == 0 ) { if( minutes == 0 && hours == 0 ) emit timerDone(); else { subtractOneMinute(); seconds = 59; } } else seconds--; showChanges(); }
TimerWidget::TimerWidget(QWidget* parent) : QWidget(parent), hours(0), minutes(0), seconds(0), start(true), timer(new QTimer(this)), flashTimer(new QTimer(this)), paletteOld(), paletteNew(), mediaPlayer(new QMediaPlayer(this)), playlist(new QMediaPlaylist(mediaPlayer)), oldColors(true) { doLayout(); // One second between timeouts. timer->setInterval(1000); flashTimer->setInterval(500); playlist->setPlaybackMode(QMediaPlaylist::Loop); mediaPlayer->setVolume(100); mediaPlayer->setPlaylist(playlist); paletteOld = lcdNumber->palette(); paletteNew = QPalette(paletteOld); // Swap colors. paletteNew.setColor(QPalette::Active, QPalette::WindowText, paletteOld.color(QPalette::Active, QPalette::Window)); paletteNew.setColor(QPalette::Active, QPalette::Window, paletteOld.color(QPalette::Active, QPalette::WindowText)); connect( timer, SIGNAL(timeout()), this, SLOT(subtractOneSecond()) ); connect( flashTimer, SIGNAL(timeout()), this, SLOT(flash()) ); connect( this, SIGNAL(timerDone()), this, SLOT(endTimer()) ); connect( pushButton_set, SIGNAL(clicked()), this, SLOT(setTimer()) ); connect( pushButton_startStop, SIGNAL(clicked()), this, SLOT(startStop()) ); connect( pushButton_sound, SIGNAL(clicked()), this, SLOT(getSound()) ); showChanges(); }
void Nim::playNim() { if (_vm->_wonNim) { // Already won the game. _vm->_dialogs->displayScrollChain('Q', 6); return; } if (!_vm->_askedDogfoodAboutNim) { _vm->_dialogs->displayScrollChain('Q', 84); return; } _vm->_dialogs->displayScrollChain('Q', 3); _playedNim++; _vm->_graphics->saveScreen(); _vm->fadeOut(); CursorMan.showMouse(false); setup(); board(); //CursorMan.showMouse(true); do { startMove(); if (_dogfoodsTurn) dogFood(); else { CursorMan.showMouse(true); takeSome(); CursorMan.showMouse(false); } _stones[_row] -= _number; showChanges(); } while (_stonesLeft != 0); endOfGame(); // Winning sequence is A1, B3, B1, C1, C1, btw. _vm->fadeOut(); _vm->_graphics->restoreScreen(); _vm->_graphics->removeBackup(); _vm->fadeIn(); CursorMan.showMouse(true); if (_dogfoodsTurn) { // Dogfood won - as usual. if (_playedNim == 1) // Your first game. _vm->_dialogs->displayScrollChain('Q', 4); // Goody! Play me again? else _vm->_dialogs->displayScrollChain('Q', 5); // Oh, look at that! I've won again! _vm->decreaseMoney(4); // And you've just lost 4d! } else { // You won - strange! _vm->_dialogs->displayScrollChain('Q', 7); _vm->_objects[kObjectLute - 1] = true; _vm->refreshObjectList(); _vm->_wonNim = true; _vm->_background->draw(-1, -1, 0); // Show the settle with no lute on it. // 7 points for winning! _vm->incScore(7); } if (_playedNim == 1) { // 3 points for playing your 1st game. _vm->incScore(3); } }
void EquipmentEditor::changed(QMetaProperty /*prop*/, QVariant /*val*/) { if( sender() == obsEquip ) showChanges(); }
void MiscEditor::changed(QMetaProperty prop, QVariant /*val*/) { if( sender() == obsMisc ) showChanges(&prop); }
void MashEditor::changed(QMetaProperty prop, QVariant /*val*/) { if( sender() == mashObs ) showChanges(&prop); }
void MashEditor::showEditor() { showChanges(); setVisible(true); }
void OptionDialog::show() { showChanges(); setVisible(true); }
void FermentableEditor::changed(QMetaProperty prop, QVariant /*val*/) { if( sender() == obsFerm ) showChanges(&prop); }
void StyleEditor::changed(QMetaProperty prop, QVariant /*val*/) { showChanges(&prop); }