/** * Compute full data (averages,histograms buffer and selection buffer) * @param clipSrc source of the plugin * @param time current time * @param renderScale current renderScale */ void OverlayData::computeFullData( OFX::Clip* clipSrc, const OfxTime time, const OfxPointD& renderScale, const bool selectionOnly ) { _isComputing = true; resetHistogramData(); resetHistogramSelectionData(); if( ! clipSrc->isConnected() ) { _isComputing = false; return; } //TUTTLE_TCOUT_INFOS; //TUTTLE_TCOUT_VAR( "computeHistogramBufferData - fetchImage " << time ); boost::scoped_ptr<OFX::Image> src( clipSrc->fetchImage(time, clipSrc->getCanonicalRod(time)) ); //scoped pointer of current source clip //TUTTLE_TCOUT_INFOS; //TUTTLE_TCOUT_VAR( clipSrc->getPixelRod(time, renderScale) ); //TUTTLE_TCOUT_VAR( clipSrc->getCanonicalRod(time, renderScale) ); // Compatibility tests if( !src.get() ) // source isn't accessible { _isComputing = false; std::cout << "src is not accessible" << std::endl; return; } // TUTTLE_TCOUT_VAR( src->getBounds() ); // TUTTLE_TCOUT_VAR( src->getRegionOfDefinition() ); if( src->getRowBytes() == 0 )//if source is wrong { BOOST_THROW_EXCEPTION( exception::WrongRowBytes() ); } OfxRectI srcPixelRod = clipSrc->getPixelRod( time, renderScale ); //get current RoD if( (clipSrc->getPixelDepth() != OFX::eBitDepthFloat) || (!clipSrc->getPixelComponents()) ) { BOOST_THROW_EXCEPTION( exception::Unsupported() << exception::user() + "Can't compute histogram data with the actual input clip format." ); return; } // TUTTLE_TCOUT_INFOS; // BOOST_ASSERT( srcPixelRod == src->getBounds() ); if( srcPixelRod != src->getBounds() ) { // the host does bad things ! // remove overlay... but do not crash. TUTTLE_COUT_WARNING( "Image RoD and image bounds are not the same (rod=" << srcPixelRod << " , bounds:" << src->getBounds() << ")." ); return; } // BOOST_ASSERT( srcPixelRod.x1 == src->getBounds().x1 ); // BOOST_ASSERT( srcPixelRod.y1 == src->getBounds().y1 ); // BOOST_ASSERT( srcPixelRod.x2 == src->getBounds().x2 ); // BOOST_ASSERT( srcPixelRod.y2 == src->getBounds().y2 ); // Compute if source is OK SView srcView = tuttle::plugin::getView<SView>( src.get(), srcPixelRod ); // get current view from source clip OfxPointI imgSize; imgSize.x = srcView.width(); imgSize.y = srcView.height(); // TUTTLE_TCOUT_INFOS; if( isImageSizeModified( imgSize ) ) { //TUTTLE_TCOUT_INFOS; clearAll( imgSize ); } //TUTTLE_TCOUT_INFOS; //Compute histogram buffer this->computeHistogramBufferData( _data, srcView, time); //TUTTLE_TCOUT_INFOS; //Compute selection histogram buffer this->computeHistogramBufferData( _selectionData, srcView, time, true ); //TUTTLE_TCOUT_INFOS; //Compute averages this->computeAverages(); _isComputing = false; _currentTime = time; //TUTTLE_TCOUT_INFOS; }
void OscilGen::defaults() { oldbasefunc = 0; oldbasepar = 64; oldhmagtype = 0; oldwaveshapingfunction = 0; oldwaveshaping = 64; oldbasefuncmodulation = 0; oldharmonicshift = 0; oldbasefuncmodulationpar1 = 0; oldbasefuncmodulationpar2 = 0; oldbasefuncmodulationpar3 = 0; oldmodulation = 0; oldmodulationpar1 = 0; oldmodulationpar2 = 0; oldmodulationpar3 = 0; for(int i = 0; i < MAX_AD_HARMONICS; ++i) { hmag[i] = 0.0f; hphase[i] = 0.0f; Phmag[i] = 64; Phphase[i] = 64; } Phmag[0] = 127; Phmagtype = 0; if(ADvsPAD) Prand = 127; //max phase randomness (usefull if the oscil will be imported to a ADsynth from a PADsynth else Prand = 64; //no randomness Pcurrentbasefunc = 0; Pbasefuncpar = 64; Pbasefuncmodulation = 0; Pbasefuncmodulationpar1 = 64; Pbasefuncmodulationpar2 = 64; Pbasefuncmodulationpar3 = 32; Pmodulation = 0; Pmodulationpar1 = 64; Pmodulationpar2 = 64; Pmodulationpar3 = 32; Pwaveshapingfunction = 0; Pwaveshaping = 64; Pfiltertype = 0; Pfilterpar1 = 64; Pfilterpar2 = 64; Pfilterbeforews = 0; Psatype = 0; Psapar = 64; Pamprandpower = 64; Pamprandtype = 0; Pharmonicshift = 0; Pharmonicshiftfirst = 0; Padaptiveharmonics = 0; Padaptiveharmonicspower = 100; Padaptiveharmonicsbasefreq = 128; Padaptiveharmonicspar = 50; clearAll(oscilFFTfreqs, synth.oscilsize); clearAll(basefuncFFTfreqs, synth.oscilsize); oscilprepared = 0; oldfilterpars = 0; oldsapars = 0; prepare(); }
/* * Get the oscillator function */ short int OscilGen::get(float *smps, float freqHz, int resonance) { if(needPrepare()) prepare(); fft_t *input = freqHz > 0.0f ? oscilFFTfreqs : pendingfreqs; int outpos = (int)((RND * 2.0f - 1.0f) * synth.oscilsize_f * (Prand - 64.0f) / 64.0f); outpos = (outpos + 2 * synth.oscilsize) % synth.oscilsize; clearAll(outoscilFFTfreqs, synth.oscilsize); int nyquist = (int)(0.5f * synth.samplerate_f / fabs(freqHz)) + 2; if(ADvsPAD) nyquist = (int)(synth.oscilsize / 2); if(nyquist > synth.oscilsize / 2) nyquist = synth.oscilsize / 2; //Process harmonics { int realnyquist = nyquist; if(Padaptiveharmonics != 0) nyquist = synth.oscilsize / 2; for(int i = 1; i < nyquist - 1; ++i) outoscilFFTfreqs[i] = input[i]; adaptiveharmonic(outoscilFFTfreqs, freqHz); adaptiveharmonicpostprocess(&outoscilFFTfreqs[1], synth.oscilsize / 2 - 1); nyquist = realnyquist; } if(Padaptiveharmonics) //do the antialiasing in the case of adaptive harmonics for(int i = nyquist; i < synth.oscilsize / 2; ++i) outoscilFFTfreqs[i] = fft_t(0.0f, 0.0f); // Randomness (each harmonic), the block type is computed // in ADnote by setting start position according to this setting if((Prand > 64) && (freqHz >= 0.0f) && (!ADvsPAD)) { const float rnd = PI * powf((Prand - 64.0f) / 64.0f, 2.0f); for(int i = 1; i < nyquist - 1; ++i) //to Nyquist only for AntiAliasing outoscilFFTfreqs[i] *= FFTpolar<fftw_real>(1.0f, (float)(rnd * i * RND)); } //Harmonic Amplitude Randomness if((freqHz > 0.1f) && (!ADvsPAD)) { unsigned int realrnd = prng(); sprng(randseed); float power = Pamprandpower / 127.0f; float normalize = 1.0f / (1.2f - power); switch(Pamprandtype) { case 1: power = power * 2.0f - 0.5f; power = powf(15.0f, power); for(int i = 1; i < nyquist - 1; ++i) outoscilFFTfreqs[i] *= powf(RND, power) * normalize; break; case 2: power = power * 2.0f - 0.5f; power = powf(15.0f, power) * 2.0f; float rndfreq = 2 * PI * RND; for(int i = 1; i < nyquist - 1; ++i) outoscilFFTfreqs[i] *= powf(fabs(sinf(i * rndfreq)), power) * normalize; break; } sprng(realrnd + 1); } if((freqHz > 0.1f) && (resonance != 0)) res->applyres(nyquist - 1, outoscilFFTfreqs, freqHz); rmsNormalize(outoscilFFTfreqs, synth.oscilsize); if((ADvsPAD) && (freqHz > 0.1f)) //in this case the smps will contain the freqs for(int i = 1; i < synth.oscilsize / 2; ++i) smps[i - 1] = abs(outoscilFFTfreqs, i); else { fft->freqs2smps(outoscilFFTfreqs, smps); for(int i = 0; i < synth.oscilsize; ++i) smps[i] *= 0.25f; //correct the amplitude } if(Prand < 64) return outpos; else return 0; }
void PsUpdateDownloader::fatalFail() { clearAll(); emit App::app()->updateFailed(); }
Albums::~Albums() { clearAll(); }
//-------------------------------------------------------------- void testApp::keyPressed (int key) { if (debugOutput) {printf("Pressed key number: %i\n", key);} if ( key == ' ' ) { if ( m_run ) { m_run = false; ofxOscMessage m; m.setAddress("/stop"); m.addIntArg(0); sender.sendMessage ( m ); setOscDebugMessage(m); } else { m_run = true; ofxOscMessage m; m.setAddress("/start"); m.addIntArg(1); sender.sendMessage ( m ); setOscDebugMessage(m); } } else if (key == 'r' || key == 'R') { m_numSamples[m_currentSample] = 0; m_sampleVector[m_currentSample].clear(); } else if (key == 'z') { if (m_numSamples[m_currentSample] > 0) { --m_numSamples[m_currentSample]; m_sampleVectorPopped[m_currentSample].push_back(m_sampleVector[m_currentSample].back()); m_sampleVector[m_currentSample].pop_back(); } } else if (key == 'Z') { if (m_sampleVectorPopped[m_currentSample].size() > 0) { m_sampleVector[m_currentSample].push_back(m_sampleVectorPopped[m_currentSample].back()); m_sampleVectorPopped[m_currentSample].pop_back(); ++m_numSamples[m_currentSample]; } } else if ( key == 'c' ) { // clear all samples for (int i = 0; i < MAX_SAMPLES; ++i) { m_numSamples[i] = 0; m_sampleVector[i].clear(); } } else if ( key == 'C' ) { clearAll(); } else if ( key == 'F' ) { isFullScreen = !isFullScreen; ofSetFullscreen(isFullScreen); } else if (key >= 48 && key <=57) { m_currentSample = key - 48; if (debugOutput) {printf("set sample: %i\n", m_currentSample);} } else if (key == 'd') { if (debugOutput) {printf("debug mode\n");} debugMode = !debugMode; } else if (key == 'f') { showColors = !showColors; } else if (key == 'g') { for (int i = 0; i < MAX_SAMPLES; ++i) { m_sampleColors[i].r = ofRandom(0, 255); m_sampleColors[i].g = ofRandom(0, 255); m_sampleColors[i].b = ofRandom(0, 255); m_sampleColors[i].a = 127; } } else if (key == 'h') { if (debugOutput) {printf("help mode\n");} helpMode = !helpMode; usageMode = false; } else if (key == 'm') { showOscDebugPosition = !showOscDebugPosition; } else if (key == OF_KEY_UP) { if (m_currentState == 0) { nPtsBackup = nPts; for (int i = 0; i < MAX_N_PTS; ++i) { ptsBackup[i] = 0; } for (int i = 0; i < nPts; ++i) { ptsBackup[i] = pts[i]; } for (int i = 0; i < MAX_SAMPLES; ++i) { m_sampleVectorBackup[i] = m_sampleVector[i]; m_numSamplesBackup[i] = m_numSamples[i]; m_playStatusesBackup[i] = m_playStatuses[i]; } } ++m_currentState; if (m_currentState > XMLstates.getNumTags("STATE")) { m_currentState = 0; } loadState(m_currentState); if (debugOutput) {printf("current state : %i\n", m_currentState);} } else if (key == OF_KEY_DOWN) { if (m_currentState == 0) { nPtsBackup = nPts; for (int i = 0; i < MAX_N_PTS; ++i) { ptsBackup[i] = 0; } for (int i = 0; i < nPts; ++i) { ptsBackup[i] = pts[i]; } for (int i = 0; i < MAX_SAMPLES; ++i) { m_sampleVectorBackup[i] = m_sampleVector[i]; m_numSamplesBackup[i] = m_numSamples[i]; m_playStatusesBackup[i] = m_playStatuses[i]; } } --m_currentState; if (m_currentState < 0) { m_currentState = XMLstates.getNumTags("STATE"); } loadState(m_currentState); if (debugOutput) {printf("current state : %i\n", m_currentState);} } else if (key == OF_KEY_RETURN) { usageMode = !usageMode; } else if (key == 'w') { if (debugMode) { saveCurrentState(); if (debugOutput) {printf("saved current state!\n");} buttonPushed = true; } } else if (key == 'e') { if (debugMode) { readStates(); } } else if (key >= 257 && key <= 266) { if (m_currentState == 0) { nPtsBackup = nPts; for (int i = 0; i < MAX_N_PTS; ++i) { ptsBackup[i] = 0; } for (int i = 0; i < nPts; ++i) { ptsBackup[i] = pts[i]; } for (int i = 0; i < MAX_SAMPLES; ++i) { m_sampleVectorBackup[i] = m_sampleVector[i]; m_numSamplesBackup[i] = m_numSamples[i]; m_playStatusesBackup[i] = m_playStatuses[i]; } } m_currentState = (key - 256) + stateTen; printf("current state %i\n", m_currentState); printf("lastTagNumber: %i\n", lastTagNumber); if (m_currentState > XMLstates.getNumTags("STATE")) { m_currentState = lastTagNumber; } loadState(m_currentState); stateTenMsg = ""; if (debugOutput) {printf("current state : %i\n", m_currentState);} } else if (key == OF_KEY_F11) { printf("bla %i",(XMLstates.getNumTags("STATE"))); if ((XMLstates.getNumTags("STATE") - stateTen) > 10 ) { stateTen += 10; std::stringstream str; str << ", +"; str << stateTen; str << "..."; stateTenMsg = str.str(); } // if (stateTen% <= XMLstates.getNumTags("STATE")) { // m_currentState += stateTen // } // m_currentState } else if (key == OF_KEY_F12) { if (stateTen != 0){ stateTen -= 10; std::stringstream str; str << ", -"; str << stateTen; str << "..."; stateTenMsg = str.str(); } } }
//! [0] Calculator::Calculator(QWidget *parent) : QWidget(parent) { sumInMemory = 0.0; sumSoFar = 0.0; factorSoFar = 0.0; waitingForOperand = true; //! [0] //! [1] display = new QLineEdit("0"); //! [1] //! [2] display->setReadOnly(true); display->setAlignment(Qt::AlignRight); display->setMaxLength(15); QFont font = display->font(); font.setPointSize(font.pointSize() + 8); display->setFont(font); //! [2] //! [4] for (int i = 0; i < NumDigitButtons; ++i) { digitButtons[i] = createButton(QString::number(i), SLOT(digitClicked())); } Button *pointButton = createButton(tr("."), SLOT(pointClicked())); Button *changeSignButton = createButton(tr("\261"), SLOT(changeSignClicked())); Button *backspaceButton = createButton(tr("Backspace"), SLOT(backspaceClicked())); Button *clearButton = createButton(tr("Clear"), SLOT(clear())); Button *clearAllButton = createButton(tr("Clear All"), SLOT(clearAll())); Button *clearMemoryButton = createButton(tr("MC"), SLOT(clearMemory())); Button *readMemoryButton = createButton(tr("MR"), SLOT(readMemory())); Button *setMemoryButton = createButton(tr("MS"), SLOT(setMemory())); Button *addToMemoryButton = createButton(tr("M+"), SLOT(addToMemory())); Button *divisionButton = createButton(tr("\367"), SLOT(multiplicativeOperatorClicked())); Button *timesButton = createButton(tr("\327"), SLOT(multiplicativeOperatorClicked())); Button *minusButton = createButton(tr("-"), SLOT(additiveOperatorClicked())); Button *plusButton = createButton(tr("+"), SLOT(additiveOperatorClicked())); Button *squareRootButton = createButton(tr("Sqrt"), SLOT(unaryOperatorClicked())); Button *powerButton = createButton(tr("x\262"), SLOT(unaryOperatorClicked())); Button *reciprocalButton = createButton(tr("1/x"), SLOT(unaryOperatorClicked())); Button *equalButton = createButton(tr("="), SLOT(equalClicked())); //! [4] //! [5] QGridLayout *mainLayout = new QGridLayout; //! [5] //! [6] #if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) mainLayout->setSizeConstraint(QLayout::SetNoConstraint); #else mainLayout->setSizeConstraint(QLayout::SetFixedSize); #endif mainLayout->addWidget(display, 0, 0, 1, 6); mainLayout->addWidget(backspaceButton, 1, 0, 1, 2); mainLayout->addWidget(clearButton, 1, 2, 1, 2); mainLayout->addWidget(clearAllButton, 1, 4, 1, 2); mainLayout->addWidget(clearMemoryButton, 2, 0); mainLayout->addWidget(readMemoryButton, 3, 0); mainLayout->addWidget(setMemoryButton, 4, 0); mainLayout->addWidget(addToMemoryButton, 5, 0); for (int i = 1; i < NumDigitButtons; ++i) { int row = ((9 - i) / 3) + 2; int column = ((i - 1) % 3) + 1; mainLayout->addWidget(digitButtons[i], row, column); } mainLayout->addWidget(digitButtons[0], 5, 1); mainLayout->addWidget(pointButton, 5, 2); mainLayout->addWidget(changeSignButton, 5, 3); mainLayout->addWidget(divisionButton, 2, 4); mainLayout->addWidget(timesButton, 3, 4); mainLayout->addWidget(minusButton, 4, 4); mainLayout->addWidget(plusButton, 5, 4); mainLayout->addWidget(squareRootButton, 2, 5); mainLayout->addWidget(powerButton, 3, 5); mainLayout->addWidget(reciprocalButton, 4, 5); mainLayout->addWidget(equalButton, 5, 5); setLayout(mainLayout); setWindowTitle(tr("Calculator")); }
/* ---------------------------------------------------------------------- * Author: Julian * Date: 27 January 2014 * Description: Handles the commands * ---------------------------------------------------------------------- */ void Console::newCommand(std::string command, std::string values) { std::transform(command.begin(), command.end(), command.begin(), ::tolower); std::vector<std::string> valueList; getValues(valueList, values, command); //========================================================================================================================== if(command == "clear_console" || // clear_console command == "clean_console") // clean_console clearAll(); //========================================================================================================================== else if(command == "exit") // exit context.renderWindow->close(); //========================================================================================================================== else if(command == "player_set_position") // player_set_position x:y { if(valueList.size() == 2) { const float xPos = stof(valueList[0]); const float yPos = stof(valueList[1]); context.player->setPosition(xPos, yPos); logInfo("Changed Player position to " + valueList[0] + " : " + valueList[1]); } else logError("Syntax is: player_set_position x:y"); } //========================================================================================================================== else if(command == "player_set_speed") // player_set_animation value { if(valueList.size() == 1) { context.player->setDefaultSpeed(stoi(valueList[0])); logInfo("Changed Player velocity to: " + valueList[0]); } else logError("Syntax is: player_set_speed value"); } //========================================================================================================================== else if(command == "player_play_animation") // player_play_animation value { if(valueList.size() == 1 && stoi(valueList[0]) <= TOTAL_ANIMATIONS) context.player->playAnimationOnce(stoi(valueList[0])); else if(valueList.size() == 1 && stoi(valueList[0]) == TOTAL_ANIMATIONS) logError("Your value is too large."); else logError("Syntax is: player_set_animation value"); } //========================================================================================================================== else if(command == "player_set_health") // player_set_health value { if(valueList.size() == 1) context.player->setHealth(stoi(valueList[0])); else logError("Syntax is: player_set_health value"); } //========================================================================================================================== else if(command == "show_collision") // show_collision value { if(valueList.size() == 1) context.player->showCollision(stoi(valueList[0]) !=0); // The !=0 is there in order to prevent a warning, ignore it else logError("Syntax is: show_collision value (1 or 0)"); } //========================================================================================================================== else if(command == "player_set_mana") // player_set_mana value { if(valueList.size() == 1) context.player->setMana(stoi(valueList[0])); else logError("Syntax is: player_set_mana value"); } //========================================================================================================================== else if(command == "player_get_position") // player_get_position { std::stringstream s, s2; s << context.player->getPosition().x / TILE_SIZE; s2 << (context.player->getPosition().y - TILE_SIZE/2) / TILE_SIZE; logInfo("You are at " + s.str() + ":" + s2.str()); } //========================================================================================================================== else if(command == "GFX_add" || command == "gfx_add") // GFX_add { if(valueList.size() == 1) { if(valueList[0] == "fade") context.effectManager->add(Effect(EffectType::FADE)); } else logError("Syntax is: GFX_add value (fade for example)"); } //========================================================================================================================== else if(command == "time_set") // time_set { if(valueList.size() == 3) { context.globalTime->setTime(std::stoi(valueList[0]), std::stoi(valueList[1]), std::stof(valueList[2])); std::stringstream stream; stream<<"Current time: "<<context.globalTime->getHours()<<":"<<context.globalTime->getMinutes()<<":"<<int(context.globalTime->getSeconds()); logInfo(stream.str()); } else logError("Syntax is: time_set hours:minutes:seconds"); } //========================================================================================================================== else if(command == "print") // print { if(valueList.size() == 1) logInfo(valueList[0]); else logError("Syntax is: print message"); } //========================================================================================================================== else if(command == "print_time") // print_time { if(valueList.size() == 0) { std::stringstream stream; stream<<"Current time: "<<context.globalTime->getHours()<<":"<<context.globalTime->getMinutes()<<":"<<int(context.globalTime->getSeconds()); logInfo(stream.str()); } else logError("Syntax is: print_time"); } //========================================================================================================================== else if(command == "help") // help { log(" clean_console\tclear_console\texit\tGFX_add <string>", {230, 200, 120}); log(" gfx_add <string>\titem_add <int>\titem_add <int:int>\tmap_load <string>", {230, 200, 120}); log(" map_reload\tplayer_get_position\tplayer_play_animation <int>", {230, 200, 120}); log(" player_set_health <int>\tplayer_set_mana <int>\tplayer_set_position <float:float>", {230, 200, 120}); log(" player_set_speed <int>\tplayer_set_sprite <string>\tprint <string>\tprint_time", {230, 200, 120}); log(" show_collision <int>\ttime_set <int:int:int>\ttoggle_gui", {230, 200, 120}); } //========================================================================================================================== else if (command == "toggle_gui") // toggle_gui { if (valueList.size() == 0) { context.player->setProperty("hideGUI", !context.player->getProperty("hideGUI")); } else logError("Syntax is: toggle_gui"); } //========================================================================================================================== else if(command == "map_load") // map_load name { if(valueList.size() == 1) { const std::string mapName = valueList[0] + ".tmx"; context.gameMap->loadMap(mapName); } else logError("Syntax is: map_load name"); } //========================================================================================================================== else if(command == "map_reload") // map_reload { if(valueList.size() == 0) { context.gameMap->reload(); logInfo("Updated the map with the latest changes."); } else logError("Syntax is: map_reload"); } //========================================================================================================================== else if(command == "player_set_sprite") // player_set_sprite { if(valueList.size() == 1) context.player->changeSprite(valueList[0]); else logError("Syntax is: player_set_sprite name"); } //========================================================================================================================== else if(command == "item_add") // item_add ID { if(valueList.size() == 2) context.player->getInventory().addItem(ItemID(stoi(valueList[0])), stoi(valueList[1])); else if(valueList.size() == 1) context.player->getInventory().addItem(ItemID(stoi(valueList[0]))); else logError("Syntax is: item_add ID AMMOUNT (amount is optional)"); } //========================================================================================================================== // No command is correct else logError("Unknown command."); }
Alignment& SymForceAligner::alignSentence(std::string e, std::string f) { clearAll(); addSentence(e, f); alignCorpus(); return m_alignments[0]; }
QgsPluginManager::QgsPluginManager( QgsPythonUtils* pythonUtils, QWidget * parent, Qt::WFlags fl ) : QDialog( parent, fl ) { setupUi( this ); mPythonUtils = pythonUtils; // set the default lib dir to the qgis install directory/lib (this info is // available from the provider registry so we use it here) QgsProviderRegistry *pr = QgsProviderRegistry::instance(); /* char **argv = qApp->argv(); QString appDir = argv[0]; int bin = appDir.findRev("/bin", -1, false); QString baseDir = appDir.left(bin); QString libDir = baseDir + "/lib"; */ lblPluginDir->setText( pr->libraryDirectory().path() ); setTable(); getPluginDescriptions(); getPythonPluginDescriptions(); mModelProxy->sort( 0, Qt::AscendingOrder ); // // Create the select all and clear all buttons and add them to the // buttonBox // QPushButton * btnSelectAll = new QPushButton( tr( "&Select All" ) ); QPushButton * btnClearAll = new QPushButton( tr( "&Clear All" ) ); buttonBox->addButton( btnSelectAll, QDialogButtonBox::ActionRole ); buttonBox->addButton( btnClearAll, QDialogButtonBox::ActionRole ); // connect the slot up to catch when a bookmark is deleted connect( btnSelectAll, SIGNAL( clicked() ), this, SLOT( selectAll() ) ); // connect the slot up to catch when a bookmark is zoomed to connect( btnClearAll, SIGNAL( clicked() ), this, SLOT( clearAll() ) ); leFilter->setFocus( Qt::MouseFocusReason ); qRegisterMetaType<QgsDetailedItemData>(); // disable plugin installer button for now until we resolve some problems [MD] btnPluginInstaller->hide(); #if 0 // add installer's icon QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/plugin_installer.png"; QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/plugin_installer.png"; if ( QFile::exists( myCurThemePath ) ) { btnPluginInstaller->setIcon( QIcon( myCurThemePath ) ); } else if ( QFile::exists( myDefThemePath ) ) { btnPluginInstaller->setIcon( QIcon( myDefThemePath ) ); } // check for plugin installer if ( checkForPluginInstaller() ) { connect( btnPluginInstaller, SIGNAL( clicked() ), this, SLOT( showPluginInstaller() ) ); } else { btnPluginInstaller->setEnabled( false ); } #endif }
void FormModifyWeight::chooseFunc(MtcKeyPressedEvent *mtcKeyEvent) { int nIndex = ui->tableWidget->currentRow(); if(nIndex < 0) { nIndex = 0; } if(mtcKeyEvent->isNumKey()) { mtcKeyEvent->setKeyType(KC_Number); int keyNum = mtcKeyEvent->getLogicKeyName().toInt(); switch(keyNum) { case 1: addNew(); break; case 2: modifyOne(); break; case 3: deleteOne(); break; case 4: split(); break; case 5: combine(); break; case 6: clearAll(); break; default: break; } } if(mtcKeyEvent->isFuncKey()) { switch(mtcKeyEvent->func()) { case KeyConfirm: setResult(1); break; case KeyEsc: setResult(0); break; case KeyUp: if(nIndex >= 0) { ui->tableWidget->selectRow(ui->tableWidget->currentRow() - 1); } break; case KeyDown: if(nIndex >= 0) { ui->tableWidget->selectRow(ui->tableWidget->currentRow() + 1); } break; default: break; } } }
void manageSerialSettings(void) { if(serialCmd.fingerNum != BLANK) { MYSERIAL.print("\n"); MYSERIAL.print("Finger "); MYSERIAL.println(serialCmd.fingerNum); MYSERIAL.print("Direction "); if(serialCmd.direction != BLANK) MYSERIAL.println(textString.open_close[serialCmd.direction]); else { int fingerDir = !finger[serialCmd.fingerNum].readDir(); MYSERIAL.println(textString.open_close[fingerDir]); } MYSERIAL.print("Stop Position "); if(serialCmd.stopPos != BLANK) MYSERIAL.println(serialCmd.stopPos); else MYSERIAL.println("None"); MYSERIAL.print("Speed "); if(serialCmd.speed != BLANK) MYSERIAL.println(serialCmd.speed); else MYSERIAL.println(finger[serialCmd.fingerNum].readTargetSpeed()); fingerControl(serialCmd.fingerNum, serialCmd.stopPos, serialCmd.direction, serialCmd.speed); } else if(serialCmd.gripNum != BLANK) { MYSERIAL.print("Grip "); MYSERIAL.println(textString.grips[serialCmd.gripNum]); MYSERIAL.print("Direction "); if(serialCmd.direction != BLANK) MYSERIAL.println(textString.open_close[serialCmd.direction]); else MYSERIAL.println("None"); MYSERIAL.print("Stop Position "); if(serialCmd.stopPos != BLANK) MYSERIAL.println(serialCmd.stopPos); else MYSERIAL.println((100 * serialCmd.direction)); MYSERIAL.print("Speed "); if(serialCmd.speed != BLANK) MYSERIAL.println(serialCmd.speed); else { int fingerToRead = (serialCmd.gripNum==THUMBSUP_GRIP)?FINGER0:FINGER1; MYSERIAL.println(finger[fingerToRead].readTargetSpeed()); } MYSERIAL.print("\n"); gripMovement(serialCmd.gripNum, serialCmd.stopPos, serialCmd.direction, serialCmd.speed); } else if(serialCmd.instructionsFlag != BLANK) { printInstructions(); } else if(serialCmd.advancedFlag != BLANK) { switch(serialCmd.advancedFlag) { case 0: // demo mode advancedSettings.demoFlag = !advancedSettings.demoFlag; // toggle flag demoFlag = advancedSettings.demoFlag; MYSERIAL.print("Demo mode toggled "); MYSERIAL.println(textString.off_on[advancedSettings.demoFlag]); // print ON/OFF break; case 1: // serial instructions advancedSettings.instructionsFlag = !advancedSettings.instructionsFlag; // toggle flag MYSERIAL.print("Initial serial instructions toggled "); MYSERIAL.println(textString.off_on[advancedSettings.instructionsFlag]); // print ON/OFF break; case 2: // muscle graph advancedSettings.muscleGraphFlag = !advancedSettings.muscleGraphFlag; // toggle flag MYSERIAL.print("Muscle graph mode toggled "); MYSERIAL.println(textString.off_on[advancedSettings.muscleGraphFlag]); // print ON/OFF break; case 3: // motor enable/disable advancedSettings.motorEnable = !advancedSettings.motorEnable; // toggle flag MYSERIAL.print("Motors "); MYSERIAL.println(textString.disabled_enabled[advancedSettings.motorEnable]); // print Disabled/Enabled for(int i=0;i<NUM_FINGERS;i++) { if(advancedSettings.motorEnable) finger[i].enableMotor(); else finger[i].disableMotor(); } break; case 5: // motors emergency stop stopMotors(); MYSERIAL.println("Stop Motors"); break; case 10: advancedSettings.researchFlag = !advancedSettings.researchFlag; MYSERIAL.print("Research mode 1 toggled "); MYSERIAL.println(textString.off_on[advancedSettings.researchFlag]); break; #ifdef HANDLE_EN case 11: advancedSettings.HANDle_en = !advancedSettings.HANDle_en; MYSERIAL.print("HANDle mode "); MYSERIAL.println(textString.disabled_enabled[advancedSettings.HANDle_en]); EEPROM_writeStruct(ADVANCED_CTRL_LOC, advancedSettings); break; case 12: toggleHANDleSerial(); break; #endif default: break; } EEPROM_writeStruct(ADVANCED_CTRL_LOC,advancedSettings); // save settings to EEPROM } else if(serialCmd.muscleCtrlFlag != BLANK) { switch(serialCmd.muscleCtrlFlag) { case -1: // default break; case 0: // muscle control off advancedSettings.muscleCtrlFlag = 0; MYSERIAL.println("Muscle control OFF "); digitalWrite(LED_KNUCKLE,LOW); // turn off muscle control LED in knuckle break; case 1: // standard muscle control advancedSettings.muscleCtrlFlag = 1; MYSERIAL.println("Standard muscle control ON"); digitalWrite(LED_KNUCKLE,HIGH); // turn on muscle control LED in knuckle break; case 2: // position muscle control advancedSettings.muscleCtrlFlag = 2; MYSERIAL.println("Muscle position control ON"); digitalWrite(LED_KNUCKLE,HIGH); // turn on muscle control LED in knuckle break; case 3: // print muscle readings if(advancedSettings.muscleCtrlFlag != 0) { printADCvals = !printADCvals; MYSERIAL.print("Display muscle readings "); MYSERIAL.println(textString.off_on[printADCvals]); // print ON/OFF } break; default: break; } EEPROM_writeStruct(ADVANCED_CTRL_LOC,advancedSettings); // store muscle mode in EEPROM } else if(serialCmd.handFlag != BLANK) // if 'H#' { if(serialCmd.handFlag != 0) { advancedSettings.handFlag = serialCmd.handFlag; IOconfig(); // reconfigure finger pins EEPROM_writeStruct(ADVANCED_CTRL_LOC,advancedSettings); // store hand in EEPROM } MYSERIAL.print("Hand is "); MYSERIAL.println(textString.right_left[advancedSettings.handFlag-1]); // print which hand is entered } else if(serialCmd.demoFlag == 0) // if 'D' { demoFlag = 1; MYSERIAL.println("Demo Mode"); MYSERIAL.println(" The hand is only responsive to serial commands\n at the end of each demo cycle"); } else if(serialCmd.sensitivityAdjust != BLANK) { if(serialCmd.sensitivityAdjust != 0) { userSettings.sensitivityOffset = serialCmd.sensitivityAdjust; EEPROM_writeStruct(USER_SETTINGS_LOC,userSettings); } MYSERIAL.print("Muscle sensor sensitivity "); MYSERIAL.println(userSettings.sensitivityOffset); } else if(serialCmd.noiseFloor != BLANK) { runNoiseFloorCalc(); } else if(serialCmd.holdTime != BLANK) { if(serialCmd.holdTime != 0) { userSettings.holdTime = serialCmd.holdTime; EEPROM_writeStruct(USER_SETTINGS_LOC,userSettings); } MYSERIAL.print("Grip change hold duration "); MYSERIAL.println(userSettings.holdTime); } // if research mode == 1, and no other command is recognised, use CSV string as target motor positions else if (advancedSettings.researchFlag == 1) // if 'A10' { researchMode_CSV_RX(serialCmd.cmdBuff); } clearAll(); // clear all serial commands (clear serialCmd.buffs) }
void MainWindow::newDB() { this->setEnabled(false); // Save changes before proceeding? bool cancelled = saveChangesBeforeProceeding(tr("New database"), true); if (cancelled) { this->setEnabled(true); return; } // Creating database ------------------------------------------------------- bool ok; QString db_name = QInputDialog::getText(this, tr("New database"), tr("Database name:"), QLineEdit::Normal, tr("Untitled database"), &ok); QString saveDBName; if (!ok) { this->setEnabled(true); return; } if (!db_name.isEmpty()) { saveDBName = QFileDialog::getSaveFileName(this, tr("Create database file"), tr("%1.itdb").arg(db_name), tr("iTest databases (*.itdb)")); } else { saveDBName = QFileDialog::getSaveFileName(this, tr("Create database file"), tr("untitled.itdb"), tr("iTest databases (*.itdb)")); } if (saveDBName.isNull() || saveDBName.isEmpty()) { this->setEnabled(true); return; } QFile file(saveDBName); if (!file.open(QFile::WriteOnly | QFile::Text)) { QMessageBox::critical(this, tr("Create database file"), tr("Cannot write file %1:\n%2.").arg(saveDBName).arg(file.errorString())); this->setWindowTitle(tr("iTestServer")); this->setEnabled(true); return; } bool itdb1_3 = saveDBName.endsWith(".it13.itdb"); clearAll(); setProgress(10); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> QTextStream sfile(&file); sfile.setCodec("UTF-8"); sfile << "[ITEST_VERSION]\n" << F_ITEST_VERSION << endl; sfile << "[ITEST_DB_VERSION]\n" << (itdb1_3 ? 1.3 : F_ITDB_VERSION) << endl; sfile << "[DB_NAME]\n" << db_name << endl; sfile << "[DB_DATE]\n" << endl; sfile << "[DB_DATE_ULSD]\ntrue" << endl; sfile << "[DB_COMMENTS]\n" << endl; sfile << "[DB_QNUM]\n0" << endl; sfile << "[DB_SNUM]\n0" << endl; if (!itdb1_3) sfile << "[DB_CNUM]\n0" << endl; sfile << "[DB_FLAGS]" << endl; sfile << "--------------------\n"; for (int i = 0; i < current_db_categories.size(); ++i) { sfile << "[DB_F" << i << "]\n" << endl; } sfile << "[DB_FLAGS_END]"; setProgress(50); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // APPLY setAllEnabled(true); current_db_file = saveDBName; current_db_open = true; addRecent(saveDBName); #ifdef Q_OS_MAC this->setWindowTitle(QString("%1[*]").arg(currentDatabaseName())); #else this->setWindowTitle(QString("%1[*] - iTestServer").arg(currentDatabaseName())); #endif this->setWindowModified(false); statusBar()->showMessage(tr("Ready"), 10000); setProgress(100); setProgress(-1); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>> actionEdit_questions->setChecked(true); setPage(actionEdit_questions); this->setEnabled(true); // ------------------------------------------------------------------------- }
void MainWindow::openDB(const QString &openDBName, bool useCP1250) { if (openDBName.isNull()) return; this->setEnabled(false); qApp->processEvents(); try { QFile file(openDBName); if (!file.open(QFile::ReadOnly | QFile::Text)) { QMessageBox::critical(this, tr("Open database"), tr("Cannot read file %1:\n%2.").arg(openDBName).arg(file.errorString())); this->setEnabled(true); return; } setProgress(3); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> QTextStream rfile(&file); if (useCP1250) { rfile.setCodec("CP 1250"); } else { rfile.setCodec("UTF-8"); } QString db_buffer; QStringList bufferlist; // --------------------------------------------------------------------- if (rfile.readLine() != "[ITEST_VERSION]") { throw xInvalidDBFile(0); } rfile.readLine(); if (rfile.readLine() != "[ITEST_DB_VERSION]") { throw xInvalidDBFile(1); } double db_version = rfile.readLine().toDouble(); if (db_version > F_ITDB_VERSION) { QMessageBox::critical(this, tr("iTest version notice"), tr("You need a newer version of iTest to open this database file.")); this->setEnabled(true); return; } if (!useCP1250) { if (db_version == 1.0) { openDB(openDBName, true); return; } } if (rfile.readLine() != "[DB_NAME]") { throw xInvalidDBFile(10); } // Database name QString db_name = rfile.readLine(); if (rfile.readLine() != "[DB_DATE]") { throw xInvalidDBFile(12); } // Database date QString db_date = rfile.readLine(); if (rfile.readLine() != "[DB_DATE_ULSD]") { throw xInvalidDBFile(14); } // Use last save date rfile.readLine(); if (rfile.readLine() != "[DB_COMMENTS]") { throw xInvalidDBFile(16); } // Database comments QString db_comments = rfile.readLine(); if (rfile.readLine() != "[DB_QNUM]") { throw xInvalidDBFile(18); } // Question number int db_qnum = rfile.readLine().toInt(); if (rfile.readLine() != "[DB_SNUM]") { throw xInvalidDBFile(20); } // Number of saved sessions int db_snum = rfile.readLine().toInt(); int db_cnum = 0; if (db_version >= 1.35) { if (rfile.readLine() != "[DB_CNUM]") { throw xInvalidDBFile(22); } // Number of classes db_cnum = rfile.readLine().toInt(); } if (rfile.readLine() != "[DB_FLAGS]") { throw xInvalidDBFile(50); } setProgress(6); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // Categories enabled db_buffer = rfile.readLine(); QVector<bool> db_categories_enabled(db_buffer.length()); for (int i = 0; i < db_categories_enabled.size(); ++i) { if (db_buffer.at(i) == '+') { db_categories_enabled[i] = true; } else if (db_buffer.at(i) == '-') { db_categories_enabled[i] = false; } else { throw xInvalidDBFile(52); } } // Categories QVector<QString> db_categories(db_buffer.length()); for (int i = 0; i < db_categories.size(); ++i) { if (rfile.readLine() != QString("[DB_F%1]").arg(i)) { throw xInvalidDBFile(54); } db_categories[i] = rfile.readLine(); } // End of categories if (rfile.readLine() != "[DB_FLAGS_END]") { throw xInvalidDBFile(59); } setProgress(10); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> int count = db_qnum + db_snum; // Questions QuestionItem *item; QStringList answers; for (int i = 0; i < db_qnum; ++i) { answers.clear(); // Question name if (rfile.readLine() != "[Q_NAME]") { throw xInvalidDBFile(100); } item = new QuestionItem (rfile.readLine()); // Category if (rfile.readLine() != "[Q_FLAG]") { throw xInvalidDBFile(102); } item->setCategory(rfile.readLine().toInt()); if (db_version >= 1.2) { // Question group if (rfile.readLine() != "[Q_GRP]") { throw xInvalidDBFile(104); } item->setGroup(rfile.readLine()); } // Difficulty if (db_version >= 1.2) { if (rfile.readLine() != "[Q_DIF]") { throw xInvalidDBFile(106); } } else { if (rfile.readLine() != "[Q_DIFFICULTY]") { throw xInvalidDBFile(108); } } item->setDifficulty(rfile.readLine().toInt()); // Question text if (rfile.readLine() != "[Q_TEXT]") { throw xInvalidDBFile(110); } item->setText(rfile.readLine()); if (db_version >= 1.35) { // Answers if (rfile.readLine() != "[Q_ANS]") { throw xInvalidDBFile(112); } item->setSelectionType((Question::SelectionType)rfile.readLine().toInt()); item->setCorrectAnswers((Question::Answer)rfile.readLine().toInt()); int numanswers = rfile.readLine().toInt(); for (int a = 0; a < numanswers; ++a) { answers << rfile.readLine(); } // Explanation if (rfile.readLine() != "[Q_EXPL]") { throw xInvalidDBFile(114); } item->setExplanation(rfile.readLine()); } else { // Answer A if (rfile.readLine() != "[Q_ANSA]") { throw xInvalidDBFile(116); } answers << rfile.readLine(); if (db_version < 1.2) { if (rfile.readLine() != "[Q_ANSA_C]") { throw xInvalidDBFile(118); } } item->setAnswerCorrect(Question::A, rfile.readLine() == "true"); // Answer B if (rfile.readLine() != "[Q_ANSB]") { throw xInvalidDBFile(120); } answers << rfile.readLine(); if (db_version < 1.2) { if (rfile.readLine() != "[Q_ANSB_C]") { throw xInvalidDBFile(122); } } item->setAnswerCorrect(Question::B, rfile.readLine() == "true"); // Answer C if (rfile.readLine() != "[Q_ANSC]") { throw xInvalidDBFile(124); } answers << rfile.readLine(); if (db_version < 1.2) { if (rfile.readLine() != "[Q_ANSC_C]") { throw xInvalidDBFile(126); } } item->setAnswerCorrect(Question::C, rfile.readLine() == "true"); // Answer D if (rfile.readLine() != "[Q_ANSD]") { throw xInvalidDBFile(128); } answers << rfile.readLine(); if (db_version < 1.2) { if (rfile.readLine() != "[Q_ANSD_C]") { throw xInvalidDBFile(130); } } item->setAnswerCorrect(Question::D, rfile.readLine() == "true"); } // Statistics if (db_version < 1.2) { if (rfile.readLine() != "[Q_ICNT]") { throw xInvalidDBFile(132); } } else { if (rfile.readLine() != "[Q_ICCNT]") { throw xInvalidDBFile(134); } } item->setIncorrectAnsCount(rfile.readLine().toUInt()); if (db_version < 1.2) { if (rfile.readLine() != "[Q_CCNT]") { throw xInvalidDBFile(136); } } item->setCorrectAnsCount(rfile.readLine().toUInt()); // Hidden if (db_version >= 1.2) { if (rfile.readLine() != "[Q_HID]") { throw xInvalidDBFile(138); } item->setHidden(rfile.readLine() == "true"); } if (db_version > 1.25) { // SVG if (rfile.readLine() != "[Q_SVG]") { throw xInvalidDBFile(140); } int numsvgitems = rfile.readLine().toInt(); for (int g = 0; g < numsvgitems; ++g) { db_buffer = rfile.readLine(); item->addSvgItem(new SvgItem(db_buffer, rfile.readLine())); } } // End if (db_version < 1.25) { if (rfile.readLine() != "[Q_END]") { throw xInvalidDBFile(199); } } // Add map entry item->setAnswers(answers); QListWidgetItem *q_item = new QListWidgetItem (item->group().isEmpty() ? item->name() : QString("[%1] %2").arg(item->group()).arg(item->name())); LQListWidget->addItem(q_item); current_db_questions.insert(q_item, item); setQuestionItemIcon(q_item, item->difficulty()); setQuestionItemColour(q_item, item->category()); hideQuestion(q_item, item); setProgress((85/(i+1)*count)+10); // PROGRESS >>>>>>>>>>>>>>>>>>>>>> } // Saved sessions int ans_category = -1; int ans_dif = 0; Question::Answer c_ans; Question::Answer ans; Question::SelectionType ans_selectiontype = Question::SingleSelection; for (int i = 0; i < db_snum; ++i) { if (rfile.atEnd()) break; if (rfile.readLine() != "[SESSION]") continue; Session *session = new Session; session->setName(rfile.readLine()); session->setDateTimeFromString(rfile.readLine()); if (db_version >= 1.2) { if (rfile.readLine() != "[PASSMARK]") { throw xInvalidDBFile(202); } PassMark pm(rfile.readLine().toInt()); int pm_count = rfile.readLine().toInt(); int pm_c, pm_v; for (int i = 0; i < pm_count; ++i) { pm_c = rfile.readLine().toInt(); pm_v = rfile.readLine().toInt(); pm.addCondition(pm_c, pm_v, pm_v); } session->setPassMark(pm); } else { session->setPassMark(PassMark(rfile.readLine().toInt())); } ScoringSystem sys; if (db_version >= 1.35) { db_buffer = rfile.readLine(); db_buffer.append("\n"); db_buffer.append(rfile.readLine()); db_buffer.append("\n"); db_buffer.append(rfile.readLine()); sys.loadData(db_buffer); } int s_snum = rfile.readLine().toInt(); int s_lenum = rfile.readLine().toInt(); for (int le = 0; le < s_lenum; ++le) { bufferlist.clear(); bufferlist = rfile.readLine().split(';'); if (bufferlist.count() == 6) { session->addLogEntry(bufferlist.at(0).toInt(), bufferlist.at(1).toInt(), bufferlist.at(2).toInt(), bufferlist.at(3).toInt(), bufferlist.at(4).toInt(), bufferlist.at(5).toInt(), rfile.readLine()); } else { session->addLogEntry(255, 255, 255, 0, 0, 0, rfile.readLine()); } } for (int s = 0; s < s_snum; ++s) { if (rfile.atEnd()) break; if (rfile.readLine() != "[STUDENT]") continue; Student *student = new Student(rfile.readLine()); student->setReady(rfile.readLine() == "true"); if (db_version >= 1.2) { student->setPassed(rfile.readLine() == "true"); } student->setNumber(rfile.readLine().toInt()); if (db_version < 1.35) { rfile.readLine(); // SCORE } int numresults = rfile.readLine().toInt(); QMap<QString, QuestionAnswer> *results = new QMap<QString, QuestionAnswer>; for (int a = 0; a < numresults; ++a) { db_buffer = rfile.readLine(); if (db_version >= 1.2) { ans_category = rfile.readLine().toInt(); } QuestionItem *item = NULL; QMapIterator<QListWidgetItem *, QuestionItem *> q(current_db_questions); while (q.hasNext()) { q.next(); if (q.value()->name() == db_buffer) { item = q.value(); break; } } if (db_version >= 1.35) { ans_dif = rfile.readLine().toInt(); ans_selectiontype = (Question::SelectionType)rfile.readLine().toInt(); } else { if (item == NULL) { if (db_version < 1.2) { ans_category = -1; } if (db_version < 1.35) { ans_dif = 0; ans_selectiontype = Question::SingleSelection; } } else { if (db_version < 1.2) { ans_category = item->category(); } if (db_version < 1.35) { ans_dif = item->difficulty(); ans_selectiontype = item->selectionType(); } } } if (db_version < 1.27) { ans = Question::convertOldAnsNumber(rfile.readLine().toInt()); c_ans = Question::convertOldAnsNumber(rfile.readLine().toInt()); } else { ans = (Question::Answer)rfile.readLine().toInt(); c_ans = (Question::Answer)rfile.readLine().toInt(); } QuestionAnswer qans(c_ans, ans, item ? item->numAnswers() : 9, ans_category, ans_dif, ans_selectiontype); results->insert(db_buffer, qans); } student->setResults(results); student->updateScore(sys); if (db_version < 1.2) { student->setPassed(session->passMark().check(student->results(), ¤t_db_questions, sys)); } session->addStudent(student); } session->setScoringSystem(sys); current_db_sessions.insert(session->dateTime(), session); QListWidgetItem *item = new QListWidgetItem (QString("%1 - %2").arg(session->dateTimeToString()).arg(session->name())); SVLSListWidget->insertItem(0, item); item->setData(Qt::UserRole, session->dateTime()); setProgress((85/(db_qnum+i+1)*count)+10); // PROGRESS >>>>>>>>>>>>>> } // Classes for (int i = 0; i < db_cnum; ++i) { if (rfile.atEnd()) break; if (rfile.readLine() != "[CLASS]") continue; Class *cl = new Class(rfile.readLine()); bufferlist = rfile.readLine().split("-", QString::SkipEmptyParts); cl->setFirstYear(bufferlist.at(0).toInt()); cl->setLastYear(bufferlist.at(1).toInt()); QStringList cl_sessions = rfile.readLine().split(";", QString::SkipEmptyParts); for (int s = 0; s < cl_sessions.count(); ++s) { cl->addSession(cl_sessions.at(s)); } int mnum = rfile.readLine().toInt(); for (int m = 0; m < mnum; ++m) { if (rfile.readLine() != "[MEM]") continue; ClassMember *mem = new ClassMember(rfile.readLine()); int msnum = rfile.readLine().toInt(); for (int ms = 0; ms < msnum; ++ms) { db_buffer = rfile.readLine(); mem->addSession(db_buffer, rfile.readLine().toInt()); } cl->addMember(mem); } QListWidgetItem *cl_item = new QListWidgetItem(QString("%1-%2: %3").arg(cl->firstYear()).arg(cl->lastYear()).arg(cl->name()), CLLCListWidget); current_db_classes.insert(cl_item, cl); } ECTextEdit->setHtml( db_comments ); // Set categories current_db_categories_enabled = db_categories_enabled; current_db_categories = db_categories; setProgress(97); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // Apply categories setCategories(); loadCategories(); setProgress(98); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // Enable All setAllEnabled(true); setProgress(99); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // Save values current_db_file = openDBName; current_db_comments = db_comments; current_db_open = true; #ifdef Q_OS_MAC this->setWindowTitle(QString("%1[*]").arg(currentDatabaseName())); #else this->setWindowTitle(QString("%1[*] - iTestServer").arg(currentDatabaseName())); #endif this->setWindowModified(false); statusBar()->showMessage(tr("Database open"), 10000); setProgress(100); setProgress(-1); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>> actionEdit_questions->setChecked(true); mainStackedWidget->setCurrentIndex(1); // --------------------------------------------------------------------- this->setEnabled(true); } catch (xInvalidDBFile e) { errorInvalidDBFile(tr("Open database"), openDBName, e.error()); } catch (...) { QMessageBox::critical(this, tr("iTestServer"), tr("Error opening database.")); clearAll(); setAllEnabled(false); current_db_open = false; this->setWindowTitle(tr("iTestServer")); this->setWindowModified(false); setProgress(-1); mainStackedWidget->setCurrentIndex(0); this->setEnabled(true); } }
byte conrad_get_dcf_data(byte* dcf_data) { byte i = 0; byte j = 0; byte secs; byte unmodulated; byte modulated; // Globale Interrupts verbieten fuer genauere Messung (die natuerlich immernoch ungenau ist ;)) cli(); // Minutenstart erkennen while (i < 155) { // DCF Signal unmoduliert if (DCF_VALUE != 0) { i++; j = 0; DBG_LED_OFF(); // DCF Signal moduliert } else { j++; // Fehlertoleranz, wenn ein Signal kleiner 90 ms erkannt wird if (j > 8) { i = 0; j = 0; DBG_LED_ON(); } } _delay_ms(10); } // Minutenanfang erkannt // Funkdaten auslesen for (secs = 0; secs < 60; secs++) { unmodulated = 0; modulated = 0; // Pausiere bis zum modulierten Signal while (DCF_VALUE != 0) ; // Gehe 90% der Sekunde durch (Rest ist Toleranz) und zaehle modulierte und unmodulierte Signale for (j = 0; j < 90; j++) { if (DCF_VALUE != 0) { unmodulated++; } else { if (j < 40) { modulated++; } } _delay_ms(10); } // Wenn mindestens 600 ms unmoduliert waren, deute Signal als gueltig, sonst ungueltig und abbrechen if (unmodulated > 60 && unmodulated < 130) { DBG_LED_OFF(); // Wenn moduliertes zwischen 60 und 130 ms liegt, liegt logisch 0 an if (modulated > 6 && modulated < 13) { dcf_data[secs] = 0; // Wenn moduliertes zwischen 160 und 230 ms liegt, liegt logisch 1 an } else if (modulated > 16 && modulated < 23) { dcf_data[secs] = 1; } } else { goto error; } } // Globale Interrupts wieder anschalten sei(); return 0; error: // Globale Interrupts wieder anschalten und mit Fehlerfall returnen sei(); clearAll(); return 1; }
void KviIrcConnectionRequestQueue::timerSlot() { if(m_channels.isEmpty()) { m_timer.stop(); } else { KviChannelWindow * pChan = m_channels.head(); QByteArray encodedChan = pChan->connection()->encodeText(pChan->target()).data(); /* The following switch will let the execution flow pass-through if any request type * is currently disabled (or not available on the server). Channel's "MODE" request is * the only mandatory request. */ switch(m_curType) { case BanException: if(pChan->serverInfo()->supportedListModes().contains('e') && !KVI_OPTION_BOOL(KviOption_boolDisableBanExceptionListRequestOnJoin) && !( pChan->serverInfo()->getNeedsOpToListModeseI() && !pChan->isMeOp() ) ) { if(!pChan->connection()->sendFmtData("MODE %s e",encodedChan.data())) clearAll(); // disconnected else pChan->setSentListRequest('e'); m_curType = Invite; break; } case Invite: if(pChan->serverInfo()->supportedListModes().contains('I') && !KVI_OPTION_BOOL(KviOption_boolDisableInviteListRequestOnJoin) && !( pChan->serverInfo()->getNeedsOpToListModeseI() && !pChan->isMeOp() ) ) { if(!pChan->connection()->sendFmtData("MODE %s I",encodedChan.data())) clearAll(); // disconnected else pChan->setSentListRequest('I'); m_curType = QuietBan; break; } case QuietBan: if(pChan->serverInfo()->supportedListModes().contains('q') && !KVI_OPTION_BOOL(KviOption_boolDisableQuietBanListRequestOnJoin)) { if(!pChan->connection()->sendFmtData("MODE %s q",encodedChan.data())) clearAll(); // disconnected else pChan->setSentListRequest('q'); m_curType = Who; break; } case Who: if(!KVI_OPTION_BOOL(KviOption_boolDisableWhoRequestOnJoin)) { // TODO: cleanup pChan->connection()->stateData()->setLastSentChannelWhoRequest(kvi_unixTime()); if(pChan->connection()->lagMeter()) { KviCString tmp; if(pChan->serverInfo()->supportsWhox()) tmp.sprintf("WHO %s %acdfhlnrsu",encodedChan.data()); else tmp.sprintf("WHO %s",encodedChan.data()); pChan->connection()->lagMeter()->lagCheckRegister(tmp.ptr(),60); } if(pChan->serverInfo()->supportsWhox()) { if(!pChan->connection()->sendFmtData("WHO %s %acdfhlnrsu",encodedChan.data())) clearAll(); // disconnected else pChan->setSentWhoRequest(); } else { if(!pChan->connection()->sendFmtData("WHO %s",encodedChan.data())) clearAll(); // disconnected else pChan->setSentWhoRequest(); } m_curType = Ban; break; } case Ban: if(!KVI_OPTION_BOOL(KviOption_boolDisableBanListRequestOnJoin)) { if(!pChan->connection()->sendFmtData("MODE %s b",encodedChan.data())) { clearAll(); // disconnected } else { pChan->setSentListRequest('b'); m_channels.dequeue(); } m_curType = Mode; break; } default: // we're at the end of the list m_channels.dequeue(); pChan->checkChannelSync(); m_curType = Mode; if(m_channels.isEmpty()) { m_timer.stop(); return; } pChan = m_channels.head(); encodedChan = pChan->connection()->encodeText(pChan->target()); case Mode: if(!pChan->connection()->sendFmtData("MODE %s",encodedChan.data())) { clearAll(); // disconnected break; } m_curType = BanException; break; } } }
void init() { sortedActions = false; active = false; clearAll(); }
Graph::~Graph() { clearAll(); }
//! [36] void Calculator::abortOperation() { clearAll(); display->setText(tr("####")); }
/* * Class: EnumAccel * Method: getResult * Signature: (II)V */ JNIEXPORT void JNICALL Java_EnumAccel_clearAll(JNIEnv *env, jobject jobj){ int c = clearAll(); }
ParticleManager::~ParticleManager() { clearAll(); }
ossimErrorCode ossimRpfToc::parseFile(const ossimFilename &fileName, bool keepFileHeader) { static const char MODULE[] = "ossimRpfToc::parseFile"; if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered....." << std::endl; } ossimRefPtr<ossimNitfFile> nitfFile = new ossimNitfFile; clearAll(); nitfFile->parseFile(fileName); m_nitfFileHeader = nitfFile->getHeader(); m_rpfHeader = 0; // ossimRefPtr if( !m_nitfFileHeader.valid() ) { nitfFile = 0; if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " leaving with no nitf header found....." << std::endl; } return ossimErrorCodes::OSSIM_ERROR; } ossimNitfTagInformation info; m_nitfFileHeader->getTag(info, "RPFHDR"); if(traceDebug() && (info.getTagName() == "RPFHDR") ) { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " nitf file header print\n"; m_nitfFileHeader->print( ossimNotify(ossimNotifyLevel_DEBUG) ); } if ( !keepFileHeader ) { // we no longer need access to the nitf header. We got what we needed. m_nitfFileHeader = 0; } nitfFile = 0; m_filename = fileName; if(info.getTagName() == "RPFHDR") { m_rpfHeader = new ossimRpfHeader; std::ifstream in(m_filename.c_str(), std::ios::in|std::ios::binary); // set the get pointer for the stream to the start // of the Rpf header data in.seekg(info.getTagDataOffset(), std::ios::beg); // now get the header data. We do not need to pass in the byte order. // this is grabbed from the first byte of the stream. To see this, // Look at the RpfHeader implementation. m_rpfHeader->parseStream(in); if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG: Found RPF HEADER tag\n"; m_rpfHeader->print( ossimNotify(ossimNotifyLevel_DEBUG) ); } } else { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimRpfToc::parseFile: Leaving No RPFHDR tag found" << "\n"; } return ossimErrorCodes::OSSIM_ERROR; } if( m_rpfHeader.valid() ) { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG: Building toc list" << "\n"; } buildTocEntryList( m_rpfHeader.get() ); } else { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimRpfToc::parseFile: Leaving no RPFHDR " << __LINE__ << "\n"; } return ossimErrorCodes::OSSIM_ERROR; } if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimRpfToc::parseFile: Returning with OK." << std::endl; } return ossimErrorCodes::OSSIM_OK; }
AnimationTrack::~AnimationTrack() { clearAll(); }
/// Default constructor ComputeLinear() { clearAll(); };
Calculator::Calculator(QWidget *parent) : QWidget(parent), ui(new Ui::Calculator), memory(0), result(0), currOperand(0), currOper("") { ui->setupUi(this); QSignalMapper *numberPressed = new QSignalMapper(this); { QObject::connect(ui->n0Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n1Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n2Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n3Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n4Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n5Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n6Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n7Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n8Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->n9Button, SIGNAL(clicked()), numberPressed, SLOT(map())); QObject::connect(ui->nDotButton, SIGNAL(clicked()), numberPressed, SLOT(map())); } { numberPressed->setMapping(ui->n0Button, "0"); numberPressed->setMapping(ui->n1Button, "1"); numberPressed->setMapping(ui->n2Button, "2"); numberPressed->setMapping(ui->n3Button, "3"); numberPressed->setMapping(ui->n4Button, "4"); numberPressed->setMapping(ui->n5Button, "5"); numberPressed->setMapping(ui->n6Button, "6"); numberPressed->setMapping(ui->n7Button, "7"); numberPressed->setMapping(ui->n8Button, "8"); numberPressed->setMapping(ui->n9Button, "9"); numberPressed->setMapping(ui->nDotButton, "."); } QObject::connect(numberPressed, SIGNAL(mapped(QString)), this, SLOT(appendToDisplayString(QString))); QObject::connect(this, SIGNAL(displayStringChanged(QString)), ui->lineEdit, SLOT(setText(QString))); QObject::connect(ui->cClearButton, SIGNAL(clicked()), this, SLOT(clearDisplayString())); QObject::connect(ui->cCEButton, SIGNAL(clicked()), this, SLOT(clearExpression())); QObject::connect(ui->cACButton, SIGNAL(clicked()), this, SLOT(clearAll())); QObject::connect(ui->cBackSpaceButton, SIGNAL(clicked()), this, SLOT(backSpace())); QSignalMapper *operatorPressed = new QSignalMapper; QObject::connect(ui->oDivButton, SIGNAL(clicked()), operatorPressed, SLOT(map())); QObject::connect(ui->oMultButton, SIGNAL(clicked()), operatorPressed, SLOT(map())); QObject::connect(ui->oPlusButton, SIGNAL(clicked()), operatorPressed, SLOT(map())); QObject::connect(ui->oMinusButton, SIGNAL(clicked()), operatorPressed, SLOT(map())); QObject::connect(ui->oEqButton, SIGNAL(clicked()), operatorPressed, SLOT(map())); operatorPressed->setMapping(ui->oDivButton, "/"); operatorPressed->setMapping(ui->oMultButton, "*"); operatorPressed->setMapping(ui->oPlusButton, "+"); operatorPressed->setMapping(ui->oMinusButton, "-"); operatorPressed->setMapping(ui->oEqButton, "="); QObject::connect(operatorPressed, SIGNAL(mapped(QString)), this, SLOT(operButtonPressed(QString))); QObject::connect(ui->nDotButton, SIGNAL(clicked(bool)), ui->nDotButton, SLOT(setEnabled(bool))); QObject::connect(ui->mClearButton, SIGNAL(clicked()), this, SLOT(clearMemory())); QObject::connect(ui->mReadButton, SIGNAL(clicked()), this, SLOT(memoryRead())); QObject::connect(ui->mPlusButton, SIGNAL(clicked()), this, SLOT(memoryAdd())); QObject::connect(ui->mMinusButton, SIGNAL(clicked()), this, SLOT(memoryDec())); }
/** Sets a linear combinations to be computed. * * @param linear Linear combination definition to compute. * * @warning All previous linear combinations will be deleted. */ virtual ComputeLinear& setLinearCombination( const gnssLinearCombination& linear ) { clearAll(); linearList.push_back(linear); return (*this); };
void OscilGen::prepare(fft_t *freqs) { if((oldbasepar != Pbasefuncpar) || (oldbasefunc != Pcurrentbasefunc) || DIFF(basefuncmodulation) || DIFF(basefuncmodulationpar1) || DIFF(basefuncmodulationpar2) || DIFF(basefuncmodulationpar3)) changebasefunction(); for(int i = 0; i < MAX_AD_HARMONICS; ++i) hphase[i] = (Phphase[i] - 64.0f) / 64.0f * PI / (i + 1); for(int i = 0; i < MAX_AD_HARMONICS; ++i) { const float hmagnew = 1.0f - fabs(Phmag[i] / 64.0f - 1.0f); switch(Phmagtype) { case 1: hmag[i] = expf(hmagnew * logf(0.01f)); break; case 2: hmag[i] = expf(hmagnew * logf(0.001f)); break; case 3: hmag[i] = expf(hmagnew * logf(0.0001f)); break; case 4: hmag[i] = expf(hmagnew * logf(0.00001f)); break; default: hmag[i] = 1.0f - hmagnew; break; } if(Phmag[i] < 64) hmag[i] = -hmag[i]; } //remove the harmonics where Phmag[i]==64 for(int i = 0; i < MAX_AD_HARMONICS; ++i) if(Phmag[i] == 64) hmag[i] = 0.0f; clearAll(freqs, synth.oscilsize); if(Pcurrentbasefunc == 0) //the sine case for(int i = 0; i < MAX_AD_HARMONICS - 1; ++i) { freqs[i + 1] = std::complex<float>(-hmag[i] * sinf(hphase[i] * (i + 1)) / 2.0f, hmag[i] * cosf(hphase[i] * (i + 1)) / 2.0f); } else for(int j = 0; j < MAX_AD_HARMONICS; ++j) { if(Phmag[j] == 64) continue; for(int i = 1; i < synth.oscilsize / 2; ++i) { int k = i * (j + 1); if(k >= synth.oscilsize / 2) break; freqs[k] += basefuncFFTfreqs[i] * FFTpolar<fftw_real>( hmag[j], hphase[j] * k); } } if(Pharmonicshiftfirst != 0) shiftharmonics(freqs); if(Pfilterbeforews) { oscilfilter(freqs); waveshape(freqs); } else { waveshape(freqs); oscilfilter(freqs); } modulation(freqs); spectrumadjust(freqs); if(Pharmonicshiftfirst == 0) shiftharmonics(freqs); clearDC(freqs); oldhmagtype = Phmagtype; oldharmonicshift = Pharmonicshift + Pharmonicshiftfirst * 256; oscilprepared = 1; }
/** Sets the list of linear combinations to be computed. * * @param list List of linear combination definitions to compute. * * @warning All previous linear combinations will be deleted. */ virtual ComputeLinear& setLinearCombination(const LinearCombList& list) { clearAll(); linearList = list; return (*this); };
int main(void) { int counter = 0; int delay=1000000; //Set the initial delay to 1 second int LEDIndex; int winVal; //Initialize all the modules LEDInit(); dipInit(); switchInit(); rngInit(); timerInit(); for(;;) { clearAll(); LEDIndex=0; winVal=getRandom(); //Get a random value to be the winning value for this round LEDPutVal(winVal,1); //Display that winning value timerDelay(delay); if(!getDipState()) { //Random Game while(!getSwitchState(0)) { //While the button is not pressed clearAll(); LEDIndex=getRandom(); LEDPutVal(LEDIndex,1); timerDelay(delay); } } else { //Sequence Game while(!getSwitchState(0)) { //While the button is not pressed clearAll(); LEDPutVal(LEDIndex++,1); //Increment the LED index so that it displays sequentially LEDIndex %= 4; //Keep the LED index within our domain timerDelay(delay); } //The following conditional statement is needed to bring the index back to the value that was clicked //We need this to compare to the winning value to see if the game has been won if(LEDIndex==0) { LEDIndex=3; } else { LEDIndex--; } } //If the chosen value is equal to the winning value if(LEDIndex==winVal) { winAnimation(); //If so, display the winning animation delay *= 0.85; //Decrease the delay } else { loseAnimation(); //Else, display the losing animation delay=1000000; //Reset the delay } } #if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT) printf("Hello World in C++ from MCF52259 derivative on TWR-MCF5225X board\n\r"); #endif for(;;) { counter++; } }
CalculatorScientific::CalculatorScientific(QWidget *parent) : QMainWindow(parent), ui(new Ui::CalculatorScientific) { setFixedSize(530,355); ui->setupUi(this); sumInMemory = 0.0; sumSoFar = 0.0; factorSoFar = 0.0; waitingForOperand = true; // ui->radioButton_10->setChecked(true); ui->radioButton_Angle->setChecked(true); //NumberKey connect(ui->pushButton_Zero, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_One, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Two, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Three, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Four, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Five, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Six, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Seven, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Eight, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Nine, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_A, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_B, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_C, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_D, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_E, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_F, SIGNAL(clicked()), this, SLOT(digitClicked())); connect(ui->pushButton_Pi, SIGNAL(clicked()), this, SLOT(digitClicked())); // connect(ui->pushButton_Point, SIGNAL(clicked()), this ,SLOT(pointClicked())); connect(ui->pushButton_PlusMinus, SIGNAL(clicked()), this, SLOT(changeSignClicked())); // connect(ui->pushButton_Backspace, SIGNAL(clicked()), this, SLOT(backspaceClicked())); connect(ui->pushButton_Clear, SIGNAL(clicked()), this, SLOT(clear())); connect(ui->pushButton_ClearAll, SIGNAL(clicked()), this, SLOT(clearAll())); //OperatorKey connect(ui->pushButton_Add, SIGNAL(clicked()), this, SLOT(additiveOperatorClicked())); connect(ui->pushButton_Sub, SIGNAL(clicked()), this, SLOT(additiveOperatorClicked())); connect(ui->pushButton_Mul, SIGNAL(clicked()), this, SLOT(multiplicativeOperatorClicked())); connect(ui->pushButton_Div, SIGNAL(clicked()), this, SLOT(multiplicativeOperatorClicked())); connect(ui->pushButton_Mod, SIGNAL(clicked()), this, SLOT(additiveOperatorClicked())); connect(ui->pushButton_And, SIGNAL(clicked()), this, SLOT(additiveOperatorClicked())); connect(ui->pushButton_Xor, SIGNAL(clicked()), this, SLOT(additiveOperatorClicked())); connect(ui->pushButton_X_y, SIGNAL(clicked()), this, SLOT(additiveOperatorClicked())); // connect(ui->pushButton_, SIGNAL(clicked()), this, SLOT(additiveOperatorClicked())); // connect(ui->pushButton_Sqrt, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_X_2, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_X_3, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Ln, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Log, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Sin,SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Sinh, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Cos, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Cosh, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Tan, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Tanh, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Fac, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_E_x, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_10_x, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Int, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Not, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Derivative, SIGNAL(clicked()), this, SLOT(unaryOperatorClicked())); connect(ui->pushButton_Equl, SIGNAL(clicked()), this, SLOT(equalClicked())); //M connect(ui->pushButton_MC, SIGNAL(clicked()), this, SLOT(clearMemory())); connect(ui->pushButton_MR, SIGNAL(clicked()), this, SLOT(readMemory())); connect(ui->pushButton_MS, SIGNAL(clicked()), this ,SLOT(setMemory())); connect(ui->pushButton_MPlus,SIGNAL(clicked()), this, SLOT(addToMemory())); connect(ui->pushButton_MMinus, SIGNAL(clicked()), this, SLOT(subToMemory())); }