QrcEditor::QrcEditor(QWidget *parent) : QWidget(parent), m_treeview(new ResourceView(&m_history)), m_addFileAction(0) { m_ui.setupUi(this); QHBoxLayout *layout = new QHBoxLayout; layout->setSpacing(0); layout->setMargin(0); m_ui.centralWidget->setLayout(layout); m_treeview->enableContextMenu(false); layout->addWidget(m_treeview); connect(m_ui.removeButton, SIGNAL(clicked()), this, SLOT(onRemove())); // 'Add' button with menu QMenu *addMenu = new QMenu(this); m_addFileAction = addMenu->addAction(tr("Add Files"), this, SLOT(onAddFiles())); addMenu->addAction(tr("Add Prefix"), this, SLOT(onAddPrefix())); m_ui.addButton->setMenu(addMenu); connect(m_treeview, SIGNAL(addPrefixTriggered()), this, SLOT(onAddPrefix())); connect(m_treeview, SIGNAL(addFilesTriggered(QString)), this, SLOT(onAddFiles())); connect(m_treeview, SIGNAL(removeItem()), this, SLOT(onRemove())); connect(m_treeview, SIGNAL(currentIndexChanged()), this, SLOT(updateCurrent())); connect(m_treeview, SIGNAL(dirtyChanged(bool)), this, SIGNAL(dirtyChanged(bool))); m_treeview->setFocus(); connect(m_ui.aliasText, SIGNAL(textEdited(QString)), this, SLOT(onAliasChanged(QString))); connect(m_ui.prefixText, SIGNAL(textEdited(QString)), this, SLOT(onPrefixChanged(QString))); connect(m_ui.languageText, SIGNAL(textEdited(QString)), this, SLOT(onLanguageChanged(QString))); // Prevent undo command merging after a switch of focus: // (0) The initial text is "Green". // (1) The user appends " is a color." --> text is "Green is a color." // (2) The user clicks into some other line edit --> loss of focus // (3) The user gives focuse again and substitutes "Green" with "Red" // --> text now is "Red is a color." // (4) The user hits undo --> text now is "Green is a color." // Without calling advanceMergeId() it would have been "Green", instead. connect(m_ui.aliasText, SIGNAL(editingFinished()), m_treeview, SLOT(advanceMergeId())); connect(m_ui.prefixText, SIGNAL(editingFinished()), m_treeview, SLOT(advanceMergeId())); connect(m_ui.languageText, SIGNAL(editingFinished()), m_treeview, SLOT(advanceMergeId())); connect(m_treeview, SIGNAL(addFilesTriggered(const QString&)), this, SIGNAL(addFilesTriggered(const QString&))); connect(&m_history, SIGNAL(canRedoChanged(bool)), this, SLOT(updateHistoryControls())); connect(&m_history, SIGNAL(canUndoChanged(bool)), this, SLOT(updateHistoryControls())); connect(&m_history, SIGNAL(canRedoChanged(bool)), this, SLOT(updateCurrent())); connect(&m_history, SIGNAL(canUndoChanged(bool)), this, SLOT(updateCurrent())); updateHistoryControls(); updateCurrent(); }
NonlinearPropertyFactoryGroupBox::NonlinearPropertyFactoryGroupBox( AbstractNonlinearPropertyFactory *model, const QString & title, QWidget *parent) : QGroupBox(title, parent), m_model(model) { QGridLayout * layout = new QGridLayout; // Add push button QPushButton *pushButton = new QPushButton(QIcon(":/images/list-add.svg"), tr("Add")); connect(pushButton, SIGNAL(clicked()), this, SLOT(addRow())); layout->addWidget(pushButton, 0, 0); // Remove push button m_removeButton = new QPushButton(QIcon(":/images/list-remove.svg"), tr("Remove")); m_removeButton->setEnabled(false); connect(m_removeButton, SIGNAL(clicked()), this, SLOT(removeRow())); layout->addWidget(m_removeButton, 0, 1); // List view m_view = new QListView; m_view->setSelectionMode(QAbstractItemView::SingleSelection); m_view->setModel(m_model); connect(m_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateCurrent(QModelIndex,QModelIndex))); connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(modelsInserted(QModelIndex,int,int))); layout->addWidget(m_view, 1, 0, 1, 3); setLayout(layout); }
void Player::jumpTo(int i) { // Reset user delay m_userDelay = 0; bool playing = m_timer.isActive(); m_timer.stop(); // Get subtitle in script const Subtitle *subtitle = m_script->subtitleAt(i); qint64 start_mss = subtitle->msseStart(); setElapsedTime(start_mss); // Show it ! updateCurrent(start_mss + 1); // Continuous play, even while pause if (playing) { m_timer.start(); } else { m_pauseTotal = 0; if (m_pauseStart > 0) m_pauseStart = tick(); if (m_autoHideEnabled) { m_pauseStart = tick(); m_autoHideDuration = duration(subtitle); m_timerAutoHide.start(); } } }
void PathGroup::update(GameTimer* gt) { timer += gt->getDelta(); float d = getDuration(); if (timer >= d) { timer = d; } updateCurrent(); }
bool StaticAudioBufferNode::pullData(PullPacket &output, NCID this_id, NCID other_id) { bool pulled = false; if(this_id == OUTPUTS.AUDIO_ID) //Audio Packet { AudioPullPacket *audio_output = dynamic_cast<AudioPullPacket*>(&output); if(audio_output) { Cursor *pull_cursor = audio_output->pCursor; //Update this cursor to match parent if(pull_cursor) cursor.setTimeSamples(pull_cursor->getSampleRange().start); //Only update range if recording if(recording && !updateCurrent())//updateRange(globalCursor.getChunkRange(), globalCursor.getTimeRange())) return false; c_time c = cursor.getChunkRange().start; nodeLock.lockWait(); //Pass data switch(audio_output->method) { case TransferMethod::COPY: *audio_output->data = data(c); break; case TransferMethod::ADD: //Add data to output pointer *audio_output->data += data(c); break; case TransferMethod::DIRECT: //Return pointer to buffer data // WARNING: READ ONLY, DO NOT OVERWRITE!! BUFFER WILL BE OVERWRITTEN. audio_output->data = data[c]; break; } pulled = true; cursor.step(); nodeLock.unlock(); } } return pulled; }
void Q3DataBrowser::insert() { QSqlRecord* buf = d->frm.record(); Q3SqlCursor* cur = d->cur.cursor(); if (!buf || !cur) return; bool doIns = true; QSql::Confirm conf = QSql::Yes; switch (d->dat.mode()) { case QSql::Insert: if (autoEdit()) { if (confirmInsert()) conf = confirmEdit(QSql::Insert); switch (conf) { case QSql::Yes: insertCurrent(); break; case QSql::No: break; case QSql::Cancel: doIns = false; break; } } break; default: if (autoEdit() && currentEdited()) { if (confirmUpdate()) conf = confirmEdit(QSql::Update); switch (conf) { case QSql::Yes: updateCurrent(); break; case QSql::No: break; case QSql::Cancel: doIns = false; break; } } break; } if (doIns) { d->dat.setMode(QSql::Insert); sqlCursor()->primeInsert(); emit primeInsert(d->frm.record()); readFields(); } }
void PathGroup::renderCurve(const Color& c) { Renderer* g = ARK2D::getRenderer(); float ptimer = getTimer(); g->setDrawColor(c); setTimer(0.0f); updateCurrent(); float px = getLocation()->getX(); //paths.at(0)->subpaths.at(0)->points.at(0)->getX(); float py = getLocation()->getY();//paths.at(0)->subpaths.at(0)->points.at(0)->getY(); float du = getDuration(); for(float i = 0.05f; i <= du; i += 0.05f) { setTimer(i); updateCurrent(); Vector2<float>* f = getLocation(); g->drawLine(int(px), int(py), int(f->getX()), int(f->getY())); px = f->getX(); py = f->getY(); } setTimer(ptimer); updateCurrent(); }
void GOAPlanner::updateCurrent(void) { GetOwner()->GetTimers().Create(_interval, kTimerGroupGameplay) .Completed([=]{ // update the current world UpdateCurrentWorld(_current, _states, ++_itr_count); // Create a new plan for ourselves GOAPAstar::Plan(this); // recursively call this function updateCurrent(); }); }
TreeWidget::TreeWidget(const ProgramLoader& programLoader, QWidget *parent) : QWidget(parent) { setAcceptDrops(true); view = new TreeView(*this); model = new TreeModel("Tree", programLoader, view, this); view->setModel(model); delegate = new HTMLDelegate(this); view->setModel(model); view->setItemDelegate(delegate); setColumnsWidths(); filterWidget = new FilterWidget(this); statusBar = new QStatusBar(this); //Layout QGridLayout *layout = new QGridLayout; layout->addWidget(view, 0, 0, 1, 1); layout->addWidget(filterWidget, 1, 0, 1, 1); layout->addWidget(statusBar, 2, 0, 1, 1); layout->setContentsMargins(0,0,0,0); setLayout(layout); connect(view, SIGNAL(selected(QModelIndex)), model, SLOT(updateCurrent(QModelIndex))); connect(view, SIGNAL(expanded(QModelIndex)), model, SLOT(requestExpansion(QModelIndex))); connect(view, SIGNAL(selected(QModelIndex)), this, SLOT(updatePath(QModelIndex))); connect(view, SIGNAL(selected(QModelIndex)), this, SLOT(updatePosition(QModelIndex))); connect(model, SIGNAL(parsingStarted(QModelIndex)), this, SLOT(onParsingStarted(QModelIndex))); connect(model, SIGNAL(parsingFinished(QModelIndex)), this, SLOT(onParsingFinished(QModelIndex))); connect(model, SIGNAL(exploringStarted(QModelIndex, qint64)), this, SLOT(onExploringStarted(QModelIndex, qint64))); connect(model, SIGNAL(exploringFinished(QModelIndex, qint64)), this, SLOT(onExploringFinished(QModelIndex, qint64))); connect(model, SIGNAL(filterChanged(QString)), filterWidget, SLOT(changeText(QString))); connect(filterWidget, SIGNAL(textChanged(QString)), model, SLOT(updateFilter(QString))); connect(model, SIGNAL(invalidFilter()), filterWidget, SLOT(invalidateText())); // in the constructor view->setContextMenuPolicy(Qt::CustomContextMenu); connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayMenu(QPoint))); }
QgsMapLayerStyleManagerWidget::QgsMapLayerStyleManagerWidget( QgsMapLayer* layer, QgsMapCanvas *canvas, QWidget *parent ) : QgsMapStylePanel( layer, canvas, parent ) { mModel = new QStandardItemModel( this ); mStyleList = new QListView( this ); mStyleList->setModel( mModel ); mStyleList->setViewMode( QListView::ListMode ); mStyleList->setResizeMode( QListView::Adjust ); QToolBar* toolbar = new QToolBar( this ); QAction* addAction = toolbar->addAction( tr( "Add" ) ); connect( addAction, SIGNAL( triggered() ), this, SLOT( addStyle() ) ); QAction* removeAction = toolbar->addAction( tr( "Remove Current" ) ); connect( removeAction, SIGNAL( triggered() ), this, SLOT( removeStyle() ) ); connect( canvas, SIGNAL( mapCanvasRefreshed() ), this, SLOT( updateCurrent() ) ); connect( mStyleList, SIGNAL( clicked( QModelIndex ) ), this, SLOT( styleClicked( QModelIndex ) ) ); setLayout( new QVBoxLayout() ); layout()->setContentsMargins( 0, 0, 0, 0 ); layout()->addWidget( toolbar ); layout()->addWidget( mStyleList ); connect( mLayer->styleManager(), SIGNAL( currentStyleChanged( QString ) ), this, SLOT( currentStyleChanged( QString ) ) ); connect( mLayer->styleManager(), SIGNAL( styleAdded( QString ) ), this, SLOT( styleAdded( QString ) ) ); connect( mLayer->styleManager(), SIGNAL( styleremoved( QString ) ), this, SLOT( styleRemoved( QString ) ) ); connect( mLayer->styleManager(), SIGNAL( styleRenamed( QString, QString ) ), this, SLOT( styleRenamed( QString, QString ) ) ); mModel->clear(); Q_FOREACH ( const QString name, mLayer->styleManager()->styles() ) { QString stylename = name; if ( stylename.isEmpty() ) stylename = "(default)"; QStandardItem* item = new QStandardItem( stylename ); mModel->appendRow( item ); } QString active = mLayer->styleManager()->currentStyle(); currentStyleChanged( active ); }
bool Q3DataBrowser::preNav() { QSqlRecord* buf = d->frm.record(); Q3SqlCursor* cur = d->cur.cursor(); if (!buf || !cur) return false; if (!isReadOnly() && autoEdit() && currentEdited()) { bool ok = true; QSql::Confirm conf = QSql::Yes; switch (d->dat.mode()){ case QSql::Insert: if (confirmInsert()) conf = confirmEdit(QSql::Insert); switch (conf) { case QSql::Yes: ok = insertCurrent(); d->dat.setMode(QSql::Update); break; case QSql::No: d->dat.setMode(QSql::Update); break; case QSql::Cancel: return false; } break; default: if (confirmUpdate()) conf = confirmEdit(QSql::Update); switch (conf) { case QSql::Yes: ok = updateCurrent(); break; case QSql::No: break; case QSql::Cancel: return false; } } return ok; } return true; }
//删除当前的图像 void MeasureMarkersWindow::deleteImg() { if (mImgs.size() > 0) { //找到当前选择的文件名 int index = mSlider->value(); int name = mImgs[index - 1]; //删除对应的文件 QString n; n.sprintf("%d", name); QFile::remove(mMeasureFolder + "left_" + n + ".jpg"); QFile::remove(mMeasureFolder + "right_" + n + ".jpg"); QFile::remove(mMeasureFolder + "left_" + n + ".bmp"); QFile::remove(mMeasureFolder + "right_" + n + ".bmp"); QFile::remove(mMeasureFolder + n + ".txt"); mImgs.erase(mImgs.begin() + index - 1); updateButtonState(); updateCurrent(index); } }
void Q3DataBrowser::update() { QSqlRecord* buf = d->frm.record(); Q3SqlCursor* cur = d->cur.cursor(); if (!buf || !cur) return; QSql::Confirm conf = QSql::Yes; switch (d->dat.mode()){ case QSql::Insert: if (confirmInsert()) conf = confirmEdit(QSql::Insert); switch (conf) { case QSql::Yes: if (insertCurrent()) d->dat.setMode(QSql::Update); break; case QSql::No: d->dat.setMode(QSql::Update); cur->editBuffer(true); readFields(); break; case QSql::Cancel: break; } break; default: d->dat.setMode(QSql::Update); if (confirmUpdate()) conf = confirmEdit(QSql::Update); switch (conf) { case QSql::Yes: updateCurrent(); break; case QSql::No: case QSql::Cancel: break; } break; } }
SessionItem::SessionItem(Session* session) : AbstractSessionItem(session), m_closing(false) { setTitle(session->host()); setSubtitle(session->nickName()); connect(session, SIGNAL(hostChanged(QString)), this, SLOT(setTitle(QString))); connect(session, SIGNAL(nickNameChanged(QString)), this, SLOT(setSubtitle(QString))); connect(session, SIGNAL(socketError(QAbstractSocket::SocketError)), this, SLOT(updateState())); connect(session, SIGNAL(connectedChanged(bool)), this, SLOT(updateState())); connect(session, SIGNAL(activeChanged(bool)), this, SLOT(updateState())); setSession(session); m_handler.setSession(session); m_handler.setDefaultReceiver(this); m_handler.setCurrentReceiver(this); connect(&m_handler, SIGNAL(receiverToBeAdded(QString)), SLOT(addChild(QString))); connect(&m_handler, SIGNAL(receiverToBeRenamed(QString,QString)), SLOT(renameChild(QString,QString))); connect(&m_handler, SIGNAL(receiverToBeRemoved(QString)), SLOT(removeChild(QString))); updateCurrent(this); updateState(); }
void GOAPlanner::OnInitialize(void) { _states.SetOwner(GetOwner()); updateCurrent(); }
/** Update function @param dT Elapsed time */ void SceneNode::update(float dT) { assert(dT>0.f); updateCurrent(dT); updateChildren(dT); }
FileDialog::FileDialog(QWidget* parent, const QString& caption, const QString& directory, const QString& nameFilter, const QStringList& filter) { Q_UNUSED(nameFilter); Q_UNUSED(parent); m_Model = new QFileSystemModel(this); m_View = new FileListView(this); setWindowTitle(caption); setWindowFlags(Qt::Dialog); m_Model->setFilter(QDir::Files); m_Model->setNameFilters(filter); m_Model->setRootPath(directory); m_View->setIconSize(QSize(0, 0)); //todo check this hides the icons everywhere m_Model->setNameFilterDisables(false); m_View->setModel(m_Model); QVBoxLayout* layout = new QVBoxLayout; layout->addWidget(m_View); setLayout(layout); setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowTitleHint); m_View->setRootIndex(m_Model->index(directory)); m_View->setFocus(); m_View->setMinimumWidth(640); m_View->setMinimumHeight(480); connect(m_View, SIGNAL(selectedItemChanged(QModelIndex, QModelIndex)), this, SLOT(updateCurrent(QModelIndex, QModelIndex))); connect(m_View, SIGNAL(activated(QModelIndex)), this, SLOT(onFileSelected(QModelIndex))); connect(m_View, SIGNAL(clicked(QModelIndex)), this, SLOT(onSelectionChanged(QModelIndex))); }
void SceneNode::update(const double& dt) { updateChildren(dt); updateCurrent(dt); }
void SceneNode::update(sf::Time dt, CommandQueue& commands) { updateCurrent(dt, commands); updateChildren(dt, commands); }
int LoadLogfileCommand::execute(){ try { if (abort == true) { if (calledHelp) { return 0; } return 2; } m->mothurOutEndLine(); m->mothurOut("Extracting current files names..."); m->mothurOutEndLine(); m->mothurOutEndLine(); CommandFactory* cFactory; cFactory = CommandFactory::getInstance(); ifstream in; m->openInputFile(logfile, in); set<string> currentTypes = m->getCurrentTypes(); map<string, string> currentFiles; string commandName = ""; bool skip = false; string line = ""; while (!in.eof()) { if (m->control_pressed) { break; } if (!skip) { line = m->getline(in); m->gobble(in); } m->gobble(in); //look for "mothur >" int pos = line.find("mothur > "); //command line int pos2 = line.find("Output File "); //indicates command completed and we can update the current file int pos3 = line.find("/*****************"); //skipping over parts where a command runs another command if (pos3 != string::npos) { while (!in.eof()) { if (m->control_pressed) { break; } line = m->getline(in); m->gobble(in); int posTemp = line.find("/*****************"); if (posTemp != string::npos) { break; } } } if (pos != string::npos) { skip=false; //extract command name and option string string input = line.substr(pos+9); CommandOptionParser parser(input); commandName = parser.getCommandString(); string options = parser.getOptionString(); //parse out parameters in option string map<string,string> parameters; OptionParser optionParser(options, parameters); for (map<string, string>::iterator it = parameters.begin(); it != parameters.end(); it++) { if (currentTypes.count((it->first)) != 0) { //if this is a type we save if (it->second != "current") { currentFiles[it->first] = it->second; }//save the input file name as current } } }else if (pos2 != string::npos) { //read file output file names vector<string> theseOutputNames; while (!in.eof()) { if (m->control_pressed) { break; } line = m->getline(in); m->gobble(in); int pos = line.find("mothur > "); if (pos != string::npos) { skip = true; break; } else { theseOutputNames.push_back(line); } } //ask command for the output names for each type based on inputs Command* command = cFactory->getCommand(commandName); map<string, vector<string> > thisOutputTypes = command->getOutputFiles(); for (map<string, vector<string> >::iterator it = thisOutputTypes.begin(); it != thisOutputTypes.end(); it++) { if (currentTypes.count((it->first)) != 0) { //do we save this type //if yes whats its tag map<string, string>::iterator itCurrentFiles = currentFiles.find(it->first); string thisTypesCurrentFile = ""; if (itCurrentFiles != currentFiles.end()) { thisTypesCurrentFile = itCurrentFiles->second; } //outputfilename pattern for this input type string pattern = command->getOutputPattern(it->first); updateCurrent(pattern, it->first, thisTypesCurrentFile, theseOutputNames, currentFiles); //cout << "current=\n\n"; //for (map<string, string>::iterator itcc = currentFiles.begin(); itcc != currentFiles.end(); itcc++) { // cout << itcc->first << '\t' << itcc->second << endl; // } } } } } in.close(); if (m->control_pressed) { return 0; } //output results string inputString = ""; for (map<string, string>::iterator it = currentFiles.begin(); it != currentFiles.end(); it++) { inputString += it->first + "=" + it->second + ","; } if (inputString != "") { inputString = inputString.substr(0, inputString.length()-1); m->mothurOutEndLine(); m->mothurOut("/******************************************/"); m->mothurOutEndLine(); m->mothurOut("Running command: set.current(" + inputString + ")"); m->mothurOutEndLine(); m->mothurCalling = true; Command* currentCommand = new SetCurrentCommand(inputString); currentCommand->execute(); delete currentCommand; m->mothurCalling = false; m->mothurOut("/******************************************/"); m->mothurOutEndLine(); } return 0; } catch(exception& e) { m->errorOut(e, "LoadLogfileCommand", "execute"); exit(1); } }
void Player::timeout() { qint64 d = elapsedTime(); updateCurrent(d); emit pulse(d); }
void SceneNode::update(sf::Time dt, CommandQueue& commands) { updateCurrent(dt, commands); updateChildren(dt, commands); //recursively updates children (and any children it may have and so on) until all are drawn }
void Node::update(sf::Time dt, sf::Vector2f target, sf::Vector2f bounds) { updateCurrent(dt,target,bounds); updateChildren(dt,target,bounds); }
void SceneNode::update(sf::Time dt) { updateCurrent(dt); updateChildren(dt); }
PlaylistItem DubPlaylist::previous() { kdDebug(90010) << "dub: previous" << endl; dub->selectPreviousFile(); updateCurrent(); return currentItem; }
// Slot for 'Redo' button void QrcEditor::onRedo() { m_history.redo(); updateCurrent(); updateHistoryControls(); }
PlaylistItem DubPlaylist::next() { kdDebug(90010) << "dub: next" << endl; dub->selectNextFile(); updateCurrent(); return currentItem; }
settings.setValue("recentProjects", recentProjects); settings.endGroup(); } void EditorWindow::setupUI() { /* Connecting the tab bar signals */ QObject::connect(ui->editorTabs, SIGNAL(currentChanged(int)), this, SLOT(shiftTab(int))); QObject::connect(ui->editorTabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); /* Connecting the code gen button */ QObject::connect(ui->fromTree, SIGNAL(pressed()), this, SLOT(updateCurrent())); /* Connecting the preferences dialog */ QObject::connect(ui->actionPreferences, SIGNAL(triggered()), prefs, SLOT(exec())); /* Setting up the parse status label */ parseStatus = new QLabel(this); ui->statusbar->addPermanentWidget(parseStatus); /* Setting the selection for parse tree highlighting initially NULL */ parseTreeSelection = 0; /* Adding the skin viewer */ viewer = new SkinViewer(this); ui->skinPreviewLayout->addWidget(viewer);