void WVuMeter::onConnectedControlChanged(double dParameter, double dValue) { Q_UNUSED(dValue); m_iPos = static_cast<int>(dParameter * m_iNoPos); // Range check if (m_iPos > m_iNoPos) { m_iPos = m_iNoPos; } else if (m_iPos < 0) { m_iPos = 0; } if (dParameter > 0.) { setPeak(m_iPos); } else { // A 0.0 value is very unlikely except when the VU Meter is disabled m_iPeakPos = 0; } // TODO: use something much more lightweight than currentTime. QTime currentTime = QTime::currentTime(); int msecsElapsed = m_lastUpdate.msecsTo(currentTime); m_lastUpdate = currentTime; updateState(msecsElapsed); }
bool Button::keyStateChangedCallback() { if (! isEnabled()) return false; const bool wasDown = isKeyDown; isKeyDown = isShortcutPressed(); if (autoRepeatDelay >= 0 && (isKeyDown && ! wasDown)) callbackHelper->startTimer (autoRepeatDelay); updateState(); if (isEnabled() && wasDown && ! isKeyDown) { internalClickCallback (ModifierKeys::getCurrentModifiers()); // (return immediately - this button may now have been deleted) return true; } return wasDown || isKeyDown; }
void YaDiskRVFSDriver::connectHandler(PluginSettings& pluginSettings) { QMutexLocker locker(&m_driverMutex); if(m_state == RemoteDriver::eNotConnected) { GeneralSettings generalSettings; WebMounter::getSettingStorage()->getData(generalSettings); WebMounter::getSettingStorage()->addSettings(pluginSettings); m_httpConnector->setSettings( pluginSettings.m_userName , pluginSettings.m_userPassword , generalSettings.m_proxyAddress , generalSettings.m_proxyLogin + ":" + generalSettings.m_proxyPassword , pluginSettings.m_isOAuthUsing , pluginSettings.m_oAuthToken ); if(m_state != eSyncStopping) { updateState(0, eAuthInProgress); } /*if(pluginSettings.isOAuthUsing && pluginSettings.oAuthToken != "") { updateState(100, eAuthorized); start(); // run sync thread } else { updateState(0, eAuthInProgress); }*/ } }
void createNikolayReachProblem(soc::SocSystem_Ors& sys, ors::Graph& _ors, SwiftModule& _swift, uint trajectory_length, const arr& endeffector_target, const char* endeffector_name, const arr& W){ static soc::SocSystem_Ors_Workspace WS; //setup the workspace //WS.vars = globalSpace; sys.ors=&_ors; sys.ors->getJointState(WS.q0,WS.v0); WS.T=trajectory_length; WS.W=W; sys.swift=&_swift; //set task variables TaskVariable *x0,*x1; x0 = new TaskVariable("finger-tip",*sys.ors,posTVT ,endeffector_name,"",0,0,0); x1 = new TaskVariable("collision", *sys.ors,collTVT,0,0,0,0,0); sys.vars = TUPLE(x0,x1); updateState(sys.vars); //reportAll(globalSpace,cout); x0->y_prec=1e3; x0->setGainsAsAttractor(30.); x0->y_target = endeffector_target; x0->setTrajectory(WS.T,0,1e10); x0->setPrecisionTrajectoryFinal(WS.T,1e1,1e4); x1->y_prec=1e6; x1->setGainsAsAttractor(30.); x1->y_target = 0.; x1->setTrajectory(WS.T,0); x1->setPrecisionTrajectoryConstant(WS.T,1e5); sys.WS=&WS; sys.dynamic=false; }
status_t MidiFile::start() { LOGV("MidiFile::start"); Mutex::Autolock lock(mMutex); if (!mEasHandle) { return ERROR_NOT_OPEN; } // resuming after pause? if (mPaused) { if (EAS_Resume(mEasData, mEasHandle) != EAS_SUCCESS) { return ERROR_EAS_FAILURE; } mPaused = false; updateState(); } mRender = true; // wake up render thread LOGV(" wakeup render thread"); mCondition.signal(); return NO_ERROR; }
void Simulator::threadProcRobot() { while (1) { pcRobotState pcrs = m_pRobot->getState(); float v, w, th; if (pcrs->mode == OM_Following || pcrs->mode == OM_Calibrating || pcrs->mode == OM_Manual) { m_pRobot->calcControl(&v, &w); } else { v = 0; w = 0; } updateState(v, w); m_iStepCounterRobot++; std::this_thread::sleep_for(std::chrono::milliseconds(m_iStepLengthRobot / m_iSpeedUpFactor)); } }
void CaptureDialog::grabImage() { int thumbWidth = m_width/3 -20; int thumbHeight = (int) thumbWidth*m_aspect; switch(m_state) { case Empty: imgPhase1 = copyFrame(); setPixmap(ui->phase1Thumb,imgPhase1,thumbWidth,thumbHeight); break; case Await1: imgPhase2 = copyFrame(); setPixmap(ui->phase2Thumb,imgPhase2,thumbWidth,thumbHeight); break; case Await2: imgPhase3 = copyFrame(); setPixmap(ui->phase3Thumb,imgPhase3,thumbWidth,thumbHeight); break; } updateState(); }
NetworkStateNotifier::NetworkStateNotifier() : m_isOnLine(false) , m_networkStateChangedFunction(0) , m_networkStateChangeTimer(this, &NetworkStateNotifier::networkStateChangeTimerFired) { SCDynamicStoreContext context = { 0, this, 0, 0, 0 }; m_store.adoptCF(SCDynamicStoreCreate(0, CFSTR("com.apple.WebCore"), dynamicStoreCallback, &context)); if (!m_store) return; RetainPtr<CFRunLoopSourceRef> configSource = SCDynamicStoreCreateRunLoopSource(0, m_store.get(), 0); if (!configSource) return; CFRunLoopAddSource(CFRunLoopGetMain(), configSource.get(), kCFRunLoopCommonModes); RetainPtr<CFMutableArrayRef> keys(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks)); RetainPtr<CFMutableArrayRef> patterns(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks)); RetainPtr<CFStringRef> key; RetainPtr<CFStringRef> pattern; key.adoptCF(SCDynamicStoreKeyCreateNetworkGlobalEntity(0, kSCDynamicStoreDomainState, kSCEntNetIPv4)); CFArrayAppendValue(keys.get(), key.get()); pattern.adoptCF(SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4)); CFArrayAppendValue(patterns.get(), pattern.get()); key.adoptCF(SCDynamicStoreKeyCreateNetworkGlobalEntity(0, kSCDynamicStoreDomainState, kSCEntNetDNS)); CFArrayAppendValue(keys.get(), key.get()); SCDynamicStoreSetNotificationKeys(m_store.get(), keys.get(), patterns.get()); updateState(); }
void baseFlicker(LedGroup* group, int intensity) { for(int i=0; i<group->selectionLen; i++) { switch(group->pixelState[i]) { case 0: flickerSelectColor(group, i, 2, 9); group->pixelState[i]++; break; case 2: setProportionalTargetColor(group, i, intensity); group->pixelState[i]++; break; case 4: selectFlickerLeds(group, i); group->pixelState[i] = 0; break; default: updateState(group, i, i); } } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { qRegisterMetaType<StateForTimestep>("StateForTimestep&"); ui->setupUi(this); modelController = new FieldModelController(); udpServer = new UdpServer(); modeManager = new ModeManager(); recorder = new Recorder(); player = new RecordPlayer(); connect(udpServer, SIGNAL(messageRecieved(QString)),modelController, SLOT(updateState(QString))); connect(modelController, SIGNAL(updateScene(StateForTimestep&)), modeManager, SLOT(on_updateScene_live(StateForTimestep&))); connect(modeManager, SIGNAL(updateScene(StateForTimestep&)), ui->rosoFieldWdgt, SLOT(on_updateScene(StateForTimestep&))); connect(modelController,SIGNAL(updateScene(StateForTimestep&)), recorder, SLOT(on_updateScene(StateForTimestep&))); connect(recorder, SIGNAL(recordsUpdated()), this, SLOT(on_recordsUpdated())); connect(player,SIGNAL(updateScene(StateForTimestep&)), modeManager, SLOT(on_updateScene_replay(StateForTimestep&))); connect(player, SIGNAL(recordPlayingFinished()),this,SLOT(on_player_finished())); ui->record_ListView->setModel(&recordListModel); on_liveMode_radioButton_toggled(true); ui->record_ListView->setSelectionMode(QListView::SingleSelection); }
void CollocationsDialogController::sl_searchClicked() { resultsList->clear(); assert(usedNames.size() >= 2); CollocationsAlgorithmSettings cfg; cfg.distance = regionSpin->value(); assert(task == NULL); const QList<AnnotationTableObject*>& aObjects = ctx->getAnnotationObjects().toList(); cfg.searchRegion = U2Region(0, ctx->getSequenceLength()); if (!wholeAnnotationsBox->isChecked()) { cfg.st = CollocationsAlgorithm::PartialSearch; } if(rbDirect->isChecked()){ cfg.strand = StrandOption_DirectOnly; }else if(rbComplement->isChecked()){ cfg.strand = StrandOption_ComplementOnly; }else if (rbBoth->isChecked()){ cfg.strand = StrandOption_Both; } task = new CollocationSearchTask(aObjects, usedNames, cfg); AppContext::getTaskScheduler()->registerTopLevelTask(task); timer->start(400); updateState(); }
/** Connects the 0MQ sockets */ bool QApplicationLauncher::connectSockets() { m_context = new PollingZMQContext(this, 1); connect(m_context, SIGNAL(pollError(int,QString)), this, SLOT(pollError(int,QString))); m_context->start(); m_commandSocket = m_context->createSocket(ZMQSocket::TYP_DEALER, this); m_commandSocket->setLinger(0); m_commandSocket->setIdentity(QString("%1-%2").arg(m_commandIdentity).arg(QCoreApplication::applicationPid()).toLocal8Bit()); m_subscribeSocket = m_context->createSocket(ZMQSocket::TYP_SUB, this); m_subscribeSocket->setLinger(0); try { m_commandSocket->connectTo(m_commandUri); m_subscribeSocket->connectTo(m_subscribeUri); } catch (const zmq::error_t &e) { QString errorString; errorString = QString("Error %1: ").arg(e.num()) + QString(e.what()); updateState(Service::Error, Service::SocketError, errorString); return false; } connect(m_subscribeSocket, SIGNAL(messageReceived(QList<QByteArray>)), this, SLOT(subscribeMessageReceived(QList<QByteArray>))); connect(m_commandSocket, SIGNAL(messageReceived(QList<QByteArray>)), this, SLOT(commandMessageReceived(QList<QByteArray>))); #ifdef QT_DEBUG DEBUG_TAG(1, m_commandIdentity, "sockets connected" << m_subscribeUri << m_commandUri) #endif return true; }
void PluginViewerController::createWindow() { assert(mdiWindow == NULL); mdiWindow = new MWMDIWindow(tr("Plugin Viewer")); ui.setupUi(mdiWindow); ui.treeWidget->setColumnWidth(1, 200); //todo: save geom if (!showServices) { ui.treeWidget->hideColumn(0); } QList<int> sizes; sizes<<200<<500; //ui.splitter->setSizes(sizes); ui.licenseLabel->hide(); ui.licenseView->hide(); ui.acceptLicenseButton->hide(); ui.showLicenseButton->setDisabled(true); ui.treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); connectVisualActions(); buildItems(); ui.treeWidget->setSortingEnabled(true); ui.treeWidget->sortByColumn(1, Qt::AscendingOrder); mdiWindow->installEventFilter(this); MWMDIManager* mdiManager = AppContext::getMainWindow()->getMDIManager(); mdiManager->addMDIWindow(mdiWindow); if(ui.treeWidget->topLevelItemCount() > 0){ ui.treeWidget->setCurrentItem(ui.treeWidget->findItems("",Qt::MatchContains).first()); } updateState(); }
//______________________________________________ bool EnableData::eventFilter( QObject* object, QEvent* event ) { if( !enabled() ) return WidgetStateData::eventFilter( object, event ); // check event type switch( event->type() ) { // enter event case QEvent::EnabledChange: { if( QWidget* widget = qobject_cast<QWidget*>( object ) ) { updateState( widget->isEnabled() ); } break; } default: break; } return WidgetStateData::eventFilter( object, event ); }
void hackerLeds(void *rgb1, void *rgb2, void *rgb3) { switch(counter) { case 0: updateState(); configure(rgb1,2,redIs,greenIs,90); set(rgb1,ON); counter++; break; case 1: updateState(); configure(rgb1,1,redIs,greenIs,90); set(rgb1,ON); counter++; break; case 2: updateState(); configure(rgb2,1,redIs,greenIs,90); set(rgb2,ON); counter++; break; case 3: updateState(); configure(rgb3,1,redIs,greenIs,90); set(rgb3,ON); counter++; break; case 4: updateState(); configure(rgb3,2,redIs,greenIs,90); set(rgb3,ON); counter++; break; case 5: updateState(); configure(rgb2,2,redIs,greenIs,90); set(rgb2,ON); counter = 0; break; } }
void KitOptionsPageWidget::makeDefaultKit() { m_model->setDefaultKit(currentIndex()); updateState(); }
void sipQSequentialAnimationGroup::sipProtectVirt_updateState(bool sipSelfWasArg,QAbstractAnimation::State a0,QAbstractAnimation::State a1) { (sipSelfWasArg ? QSequentialAnimationGroup::updateState(a0,a1) : updateState(a0,a1)); }
void PincodeManager::wrongPin() { mState = PincodeState::Ask; updateState(); }
Document::Document(const QString& filename, int& current_wordcount, int& current_time, const QString& theme, QWidget* parent) : QWidget(parent), m_index(0), m_always_center(false), m_rich_text(false), m_cached_block_count(-1), m_cached_current_block(-1), m_page_type(0), m_page_amount(0), m_accurate_wordcount(true), m_current_wordcount(current_wordcount), m_current_time(current_time) { setMouseTracking(true); m_stats = &m_document_stats; m_hide_timer = new QTimer(this); m_hide_timer->setInterval(5000); m_hide_timer->setSingleShot(true); connect(m_hide_timer, SIGNAL(timeout()), this, SLOT(hideMouse())); // Set up text area m_text = new Editor(this); m_text->installEventFilter(this); m_text->setMouseTracking(true); m_text->setFrameStyle(QFrame::NoFrame); m_text->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_text->viewport()->setMouseTracking(true); m_text->viewport()->installEventFilter(this); QTextDocument* document = new QTextDocument(m_text); document->setUndoRedoEnabled(false); // Read file bool unknown_rich_text = false; if (!filename.isEmpty()) { m_rich_text = isRichTextFile(filename.toLower()); m_filename = QFileInfo(filename).canonicalFilePath(); updateState(); if (!m_rich_text) { QFile file(filename); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream stream(&file); stream.setCodec(QTextCodec::codecForName("UTF-8")); stream.setAutoDetectUnicode(true); QTextCursor cursor(document); while (!stream.atEnd()) { cursor.insertText(stream.read(8192)); QApplication::processEvents(); } file.close(); } } else { PROSEUP::Reader reader; reader.read(filename, document); if (reader.hasError()) { QMessageBox::warning(this, tr("Sorry"), reader.errorString()); } } } // Set text area contents document->setUndoRedoEnabled(true); document->setModified(false); m_text->setDocument(document); m_text->setTabStopWidth(50); document->setIndentWidth(50); m_dictionary = new Dictionary(this); m_highlighter = new Highlighter(m_text, m_dictionary); connect(m_dictionary, SIGNAL(changed()), this, SLOT(dictionaryChanged())); if (m_filename.isEmpty()) { findIndex(); unknown_rich_text = true; } else { m_text->setReadOnly(!QFileInfo(m_filename).isWritable()); } // Set up scroll bar m_text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_scrollbar = m_text->verticalScrollBar(); m_scrollbar->setPalette(QApplication::palette()); m_scrollbar->setAutoFillBackground(true); m_scrollbar->setVisible(false); connect(m_scrollbar, SIGNAL(actionTriggered(int)), this, SLOT(scrollBarActionTriggered(int))); connect(m_scrollbar, SIGNAL(rangeChanged(int,int)), this, SLOT(scrollBarRangeChanged(int,int))); scrollBarRangeChanged(m_scrollbar->minimum(), m_scrollbar->maximum()); // Lay out window m_layout = new QGridLayout(this); m_layout->setSpacing(0); m_layout->setMargin(0); m_layout->addWidget(m_text, 0, 1); m_layout->addWidget(m_scrollbar, 0, 2, Qt::AlignRight); // Load settings Preferences preferences; if (unknown_rich_text) { m_rich_text = preferences.richText(); } m_text->setAcceptRichText(m_rich_text); loadPreferences(preferences); loadTheme(theme); if(m_rich_text) { m_text->setUndoRedoEnabled(false); cleanUpDocument(); m_text->setUndoRedoEnabled(true); m_text->document()->setModified(false); } calculateWordCount(); connect(m_text->document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded())); connect(m_text->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(updateWordCount(int,int,int))); connect(m_text, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); connect(m_text, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); }
int ParticleModel::slidingMotion() { updateState(); moveConstAccel(); return 1; }
void Widget::clearFlags(int flags) { updateState(_flags, _flags & ~flags); _flags &= ~flags; }
void Widget::setFlags(int flags) { updateState(_flags, _flags | flags); _flags |= flags; }
void Button::visibilityChanged() { needsToRelease = false; updateState(); }
void Button::focusLost (FocusChangeType) { updateState(); repaint(); }
void KMultiTabBarTab::setState(bool b) { setOn(b); updateState(); }
KitOptionsPageWidget::KitOptionsPageWidget() : m_model(0), m_selectionModel(0), m_currentWidget(0) { m_kitsView = new QTreeView(this); m_kitsView->setUniformRowHeights(true); m_kitsView->header()->setStretchLastSection(true); m_kitsView->setSizePolicy(m_kitsView->sizePolicy().horizontalPolicy(), QSizePolicy::Ignored); m_addButton = new QPushButton(KitOptionsPage::tr("Add"), this); m_cloneButton = new QPushButton(KitOptionsPage::tr("Clone"), this); m_delButton = new QPushButton(KitOptionsPage::tr("Remove"), this); m_makeDefaultButton = new QPushButton(KitOptionsPage::tr("Make Default"), this); auto buttonLayout = new QVBoxLayout; buttonLayout->setSpacing(6); buttonLayout->setContentsMargins(0, 0, 0, 0); buttonLayout->addWidget(m_addButton); buttonLayout->addWidget(m_cloneButton); buttonLayout->addWidget(m_delButton); buttonLayout->addWidget(m_makeDefaultButton); buttonLayout->addStretch(); auto horizontalLayout = new QHBoxLayout; horizontalLayout->addWidget(m_kitsView); horizontalLayout->addLayout(buttonLayout); auto verticalLayout = new QVBoxLayout(this); verticalLayout->setSizeConstraint(QLayout::SetMinimumSize); verticalLayout->addLayout(horizontalLayout); m_model = new Internal::KitModel(verticalLayout, this); connect(m_model, &Internal::KitModel::kitStateChanged, this, &KitOptionsPageWidget::updateState); verticalLayout->setStretch(0, 1); verticalLayout->setStretch(1, 0); m_kitsView->setModel(m_model); m_kitsView->header()->setSectionResizeMode(0, QHeaderView::Stretch); m_kitsView->expandAll(); m_selectionModel = m_kitsView->selectionModel(); connect(m_selectionModel, &QItemSelectionModel::selectionChanged, this, &KitOptionsPageWidget::kitSelectionChanged); connect(KitManager::instance(), &KitManager::kitAdded, this, &KitOptionsPageWidget::kitSelectionChanged); connect(KitManager::instance(), &KitManager::kitRemoved, this, &KitOptionsPageWidget::kitSelectionChanged); connect(KitManager::instance(), &KitManager::kitUpdated, this, &KitOptionsPageWidget::kitSelectionChanged); // Set up add menu: connect(m_addButton, &QAbstractButton::clicked, this, &KitOptionsPageWidget::addNewKit); connect(m_cloneButton, &QAbstractButton::clicked, this, &KitOptionsPageWidget::cloneKit); connect(m_delButton, &QAbstractButton::clicked, this, &KitOptionsPageWidget::removeKit); connect(m_makeDefaultButton, &QAbstractButton::clicked, this, &KitOptionsPageWidget::makeDefaultKit); updateState(); }
void KMultiTabBarTab::slotClicked() { updateState(); KMultiTabBarButton::slotClicked(); }
//============================================================================== void Button::mouseEnter (const MouseEvent&) { updateState (true, false); }
void KMultiTabBarTab::setSize(int size) { m_expandedSize=size; updateState(); }
void Button::mouseExit (const MouseEvent&) { updateState (false, false); }