void InterfaceThread::run() { DownloadThread *download = new DownloadThread(data); MainWindow *w = mainWindow(); connect(download, SIGNAL(finished()), w, SLOT(refreshDisplay())); download->start(); while (download->isRunning()) { msleep(200); updateInterface(progress_bar_fraction *100); } updateInterface(100); }
std::shared_ptr<InterfaceMap> ThriftConfigApplier::updateInterfaces() { auto origIntfs = orig_->getInterfaces(); InterfaceMap::NodeContainer newIntfs; bool changed = false; // Process all supplied interface configs size_t numExistingProcessed = 0; for (const auto& interfaceCfg : cfg_->interfaces) { InterfaceID id(interfaceCfg.intfID); auto origIntf = origIntfs->getInterfaceIf(id); shared_ptr<Interface> newIntf; auto newAddrs = getInterfaceAddresses(&interfaceCfg); if (origIntf) { newIntf = updateInterface(origIntf, &interfaceCfg, newAddrs); ++numExistingProcessed; } else { newIntf = createInterface(&interfaceCfg, newAddrs); } updateVlanInterfaces(newIntf ? newIntf.get() : origIntf.get()); changed |= updateMap(&newIntfs, origIntf, newIntf); } if (numExistingProcessed != origIntfs->size()) { // Some existing interfaces were removed. CHECK_LT(numExistingProcessed, origIntfs->size()); changed = true; } if (!changed) { return nullptr; } return origIntfs->clone(std::move(newIntfs)); }
void Notebook::editContent() { oldTitle = titleLine->text(); oldContent = contentText->toPlainText(); updateInterface(EditingMode); }
void AddressBook::editContact() { oldName = nameLine->text(); oldAddress = addressText->toPlainText(); updateInterface(EditingMode); }
void AddressBook::editContact() { oldName = nameLine->text(); // Сохраняет детали старого контакта перед переключением в режим EditingMode oldAddress = addressText->toPlainText(); // updateInterface(EditingMode); }
/** * Runs the game! WHOO! */ int Game::start() { game_running = true; while(window.isOpen()) { while(game_running) { sf::Event event; while(window.pollEvent(event)) { if(event.type == sf::Event::Closed) { window.close(); game_running = false; game_over = true; } } bullets = p.getBullets(); spawnEnemies(); checkInput(); checkBorderCollision(p); checkEntityCollision(); checkDeath(); updateAnimations(); updateScore(); updateInterface(); updateGameClocks(); for(std::vector<Enemy*>::iterator iter = enemies.begin(); iter != enemies.end(); ++iter) { Enemy *eni = *iter; eni->stalkPlayer(p); } window.clear(sf::Color(0,230,0)); Sword * s = p.getSword(); if(s->isSwung()) { window.draw(s->shape); } window.draw(p.shape); for(std::vector<Enemy*>::iterator iter = enemies.begin(); iter != enemies.end(); ++iter) { Enemy *eni = *iter; window.draw(eni->shape); } for(std::vector<Bullet*>::iterator iter = bullets.begin(); iter != bullets.end(); ++iter) { Bullet *b = *iter; window.draw(b->shape); } for(std::vector<sf::Drawable*>::iterator iter = interface.begin(); iter != interface.end(); ++iter) { sf::Drawable *d = *iter; window.draw(*d); } window.display(); } setupEntities(); game_running = true; } return 0; }
MainToolBar::MainToolBar(KActionCollection* collection, QWidget* parent): KToolBar( parent) { setToolButtonStyle(Qt::ToolButtonIconOnly); toolBarCollection = collection; addAction( toolBarCollection->action("aim")); addAction( toolBarCollection->action("record")); addAction( toolBarCollection->action("play")); addAction( toolBarCollection->action("pause")); addAction( toolBarCollection->action("playAfterPause")); addAction( toolBarCollection->action("stop")); addSeparator(); timeSlider = new QSlider(this); timeSlider->setOrientation(Qt::Horizontal); timeSlider->setMinimum( 0 ); this->addWidget(timeSlider); this->addSeparator(); updateInterface( Default ); }
void AddressBook::loadFromFile() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open Address Book"), "", tr("Address Book (*.abk);;All Files (*)")); if (fileName.isEmpty()) return; else { QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); return; } QDataStream in(&file); in.setVersion(QDataStream::Qt_4_3); contacts.empty(); // empty existing contacts in >> contacts; QMap<QString, QString>::iterator i = contacts.begin(); nameLine->setText(i.key()); addressText->setText(i.value()); } updateInterface(NavigationMode); }
void AddressBook::chargerFichier() { QString nomFichier = QFileDialog::getOpenFileName(this, tr ("Charger depuis un fichier"), "", tr ("Carnet d'adresse (*.abk);;Tous les fichiers (*)")); if (nomFichier.isEmpty()) return; else { QFile fichier (nomFichier); if (!fichier.open(QIODevice::ReadOnly)) { QMessageBox::information(this, tr ("Erreur de chargement"), fichier.errorString()); return; } QDataStream in (&fichier); in.setVersion(QDataStream::Qt_4_7); listeContacts.empty(); in >> listeContacts; if (listeContacts.isEmpty()) { QMessageBox::information (this , tr ("Pas de contacts"), tr ("Aucun contact à importer dans le fichier")); } else { QMap<QString , QString>::iterator i = listeContacts.begin(); nomLineEdit->setText(i.key()); adresseTextEdit->setText(i.value()); } } updateInterface(NavigationMode); }
void MathOperatorPlugin::changedParam( const OFX::InstanceChangedArgs &args, const std::string ¶mName ) { if( paramName == kMathOperatorType ) { updateInterface(); } }
void AddressBook::cancel() { ui->nameLine->setText(oldName); ui->nameLine->setReadOnly(true); updateInterface(NavigationMode); }
void AddressBook::loadFromFile() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open Address Book"), "C:/Users/Max/Google Диск", tr("Address Book (*.txt);;AllFiles (*)")); if (fileName.isEmpty()) return; else { QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); return; } QDataStream in(&file); in.setVersion(QDataStream::Qt_5_5); contacts.empty(); // очищаем существующие контакты in >> contacts; // загрузка if (contacts.isEmpty()) { QMessageBox::information(this, tr("Нет контактов в файле"), tr("Файл который вы пытантесь открыть не содержит контактов.")); } else { QMap<QString, QString>::iterator i = contacts.begin(); // последовательно выводим контакты nameLine->setText(i.key()); addressText->setText(i.value()); } updateInterface(NavigationMode); } }
CameraWnd::CameraWnd() : QWidget() { setMinimumSize( 160, 120 ); //preparation of the vlc command const char * const vlc_args[] = { "-I", "dummy", /* Don't use any interface */ "--ignore-config", /* Don't use VLC's config */ "--extraintf=logger", //log anything "--verbose=2", //be much more verbose then normal for debugging purpose "--plugin-path=./plugins/" }; #ifdef Q_WS_X11 _videoWidget=new QX11EmbedContainer(this); #else _videoWidget=new QFrame(this); #endif // [20101215 JG] If KDE is used like unique desktop environment, only use _videoWidget=new QFrame(this); _volumeSlider=new QSlider(Qt::Horizontal,this); _volumeSlider->setMaximum(100); //the volume is between 0 and 100 _volumeSlider->setToolTip("Audio slider"); _volumeSlider->setVisible( false ); // Note: if you use streaming, there is no ability to use the position slider _positionSlider=new QSlider(Qt::Horizontal,this); _positionSlider->setMaximum(POSITION_RESOLUTION); _positionSlider->setVisible( false ); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(_videoWidget); layout->addWidget(_positionSlider); layout->addWidget(_volumeSlider); setLayout(layout); _isPlaying=false; poller=new QTimer(this); //Initialize an instance of vlc //a structure for the exception is neede for this initalization //libvlc_exception_init(&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. //create a new libvlc instance _vlcinstance=libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); //tricky calculation of the char space used //_vlcinstance=libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args,&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. //raise (&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. // Create a media player playing environement _mp = libvlc_media_player_new (_vlcinstance); //_mp = libvlc_media_player_new (_vlcinstance, &_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. //raise (&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. //connect the two sliders to the corresponding slots (uses Qt's signal / slots technology) connect(poller, SIGNAL(timeout()), this, SLOT(updateInterface())); connect(_positionSlider, SIGNAL(sliderMoved(int)), this, SLOT(changePosition(int))); connect(_volumeSlider, SIGNAL(sliderMoved(int)), this, SLOT(changeVolume(int))); poller->start(100); //start timer to trigger every 100 ms the updateInterface slot }
nite::SkeletonState yarp::dev::OpenNI2DeviceDriverServer::getSkeletonState(int userID) { updateInterface(); #ifdef OPENNI2_DRIVER_USES_NITE2 return OpenNI2SkeletonTracker::getSensor()->userSkeleton[userID-1].skeletonState; #else return 0; #endif }
/////////// Slots ////////// void AddressBook::ajouterContact() { oldNom = nomLineEdit->text(); oldAdresse = adresseTextEdit->toPlainText(); nomLineEdit->clear(); adresseTextEdit->clear(); updateInterface(AddingMode); }
void AvatarDialog::changeAvatar() { QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Avatar"), 128, 128); if (img.isNull()) return; ui->avatarLabel->setPixmap(img); updateInterface(); }
void BusInterfaceItem::setName( const QString& name ) { beginUpdateConnectionNames(); busInterface_->setName(name); updateInterface(); emit contentChanged(); endUpdateConnectionNames(); }
void AddressBook::addContact() { oldName = nameLine->text(); oldAddress = addressText->toPlainText(); nameLine->clear(); addressText->clear(); updateInterface(AddingMode); }
void Notebook::addNote() { oldTitle = titleLine->text(); oldContent = contentText->toPlainText(); titleLine->clear(); contentText->clear(); updateInterface(AddingMode); }
void AddressBook::submitContact() { QString name = ui->nameLine->text(); QString address = ui->addressText->toPlainText(); if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); updateInterface(NavigationMode); return; } if (currentMode == AddingMode) { if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), tr("\"%1\" has been added to your address book.").arg(name)); } else { QMessageBox::information(this, tr("Add Unsuccessful"), tr("Sorry, \"%1\" is already in your address book.").arg(name)); } } else if (currentMode == EditingMode) { if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), tr("\"%1\" has been edited in your address book.").arg(oldName)); contacts.remove(oldName); contacts.insert(name, address); } else { QMessageBox::information(this, tr("Edit Unsuccessful"), tr("Sorry, \"%1\" is already in your address book.").arg(name)); } } else if (oldAddress != address) { QMessageBox::information(this, tr("Edit Successful"), tr("\"%1\" has been edited in your address book.").arg(name)); contacts[name] = address; } } updateInterface(NavigationMode); }
void AddressBook::addContact() // функция добовления контакта { oldName = nameLine->text(); // сохранения последнего имени контакта oldAddress = addressText->toPlainText(); // сохранение последнего адреса контакта nameLine->clear(); // очищение поля имени addressText->clear(); // очищение поля адреса updateInterface(AddingMode); }
//------------------------------------------------------- // POI_Editor: Constructor for edit an existing POI //------------------------------------------------------- POI_Editor::POI_Editor(POI *poi_, QWidget *parent) : QDialog(parent) { setupUi(this); setModal(false); setAttribute(Qt::WA_DeleteOnClose); this->poi = poi_; modeCreation = false; setWindowTitle(tr("Point of interest: ")+poi->getName()); updateInterface(); }
/** * \brief Initialization * * Initializes the TabsApplet with default parameters */ void TabsApplet::init() { // applet base initialization Context::Applet::init(); // create the header label enableHeader( true ); setHeaderText( i18nc( "Guitar tablature", "Tabs" ) ); // creates the tab view m_tabsView = new TabsView( this ); // Set the collapse size setCollapseOffHeight( -1 ); setCollapseHeight( m_header->height() ); setMinimumHeight( collapseHeight() ); setPreferredHeight( collapseHeight() ); // create the reload icon QAction* reloadAction = new QAction( this ); reloadAction->setIcon( KIcon( "view-refresh" ) ); reloadAction->setVisible( true ); reloadAction->setEnabled( true ); reloadAction->setText( i18nc( "Guitar tablature", "Reload tabs" ) ); m_reloadIcon = addLeftHeaderAction( reloadAction ); m_reloadIcon.data()->setEnabled( false ); connect( m_reloadIcon.data(), SIGNAL(clicked()), this, SLOT(reloadTabs()) ); // create the settings icon QAction* settingsAction = new QAction( this ); settingsAction->setIcon( KIcon( "preferences-system" ) ); settingsAction->setEnabled( true ); settingsAction->setText( i18n( "Settings" ) ); QWeakPointer<Plasma::IconWidget> settingsIcon = addRightHeaderAction( settingsAction ); connect( settingsIcon.data(), SIGNAL(clicked()), this, SLOT(showConfigurationInterface()) ); m_layout = new QGraphicsLinearLayout( Qt::Vertical ); m_layout->addItem( m_header ); m_layout->addItem( m_tabsView ); setLayout( m_layout ); // read configuration data and update the engine. KConfigGroup config = Amarok::config("Tabs Applet"); m_fetchGuitar = config.readEntry( "FetchGuitar", true ); m_fetchBass = config.readEntry( "FetchBass", true ); Plasma::DataEngine *engine = dataEngine( "amarok-tabs" ); engine->setProperty( "fetchGuitarTabs", m_fetchGuitar ); engine->setProperty( "fetchBassTabs", m_fetchBass ); engine->connectSource( "tabs", this ); updateInterface( InitState ); }
Player::Player() : QWidget() { //preparation of the vlc command const char * const vlc_args[] = { "--sout=#transcode{vcodec=DIV3,vb=800,scale=1,acodec=mp3,ab=128,channels=2,samplerate=44100}:duplicate{dst=http{mux=asf,dst=:8983/},dst=display}",// to stream video with codec div3 & mp3 on port number 8983 "--sout-keep", "sout-all"}; //output each stream //#ifdef Q_WS_X11 // _videoWidget=new QX11EmbedContainer(this); //#else _videoWidget=new QFrame(this); //#endif // [20101215 JG] If KDE is used like unique desktop environment, only use _videoWidget=new QFrame(this); _volumeSlider=new QSlider(Qt::Horizontal,this); _volumeSlider->setMaximum(100); //the volume is between 0 and 100 _volumeSlider->setToolTip("Audio slider"); // Note: if you use streaming, there is no ability to use the position slider _positionSlider=new QSlider(Qt::Horizontal,this); _positionSlider->setMaximum(POSITION_RESOLUTION); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(_videoWidget); layout->addWidget(_positionSlider); layout->addWidget(_volumeSlider); setLayout(layout); _isPlaying=false; poller=new QTimer(this); //Initialize an instance of vlc //a structure for the exception is neede for this initalization //libvlc_exception_init(&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. //create a new libvlc instance _vlcinstance=libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); //tricky calculation of the char space used //_vlcinstance=libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args,&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. //raise (&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. // Create a media player playing environement _mp = libvlc_media_player_new (_vlcinstance); //_mp = libvlc_media_player_new (_vlcinstance, &_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. //raise (&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0. //connect the two sliders to the corresponding slots (uses Qt's signal / slots technology) connect(poller, SIGNAL(timeout()), this, SLOT(updateInterface())); connect(_positionSlider, SIGNAL(sliderMoved(int)), this, SLOT(changePosition(int))); connect(_volumeSlider, SIGNAL(sliderMoved(int)), this, SLOT(changeVolume(int))); poller->start(100); //start timer to trigger every 100 ms the updateInterface slot }
void MainWindow::load() { QString filename = QFileDialog::getOpenFileName(this, "Load Video",QString()); if(!filename.isNull()) { siftObj = new SiftObj(); siftObj->setFilename(filename.toStdString()); _currentFrame = 1; updateInterface(); } }
//------------------------------------------------------- // POI_Editor: Constructor for edit and create a new POI //------------------------------------------------------- POI_Editor::POI_Editor(uint code, double lon, double lat, Projection *proj, QWidget *ownerMeteotable, QWidget *parentWindow) : QDialog(parentWindow) { setupUi(this); modeCreation = true; setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("New Point of interest")); this->poi = new POI(code, tr("Point %1").arg(code), lon, lat, proj, ownerMeteotable, parentWindow); assert(this->poi); updateInterface(); }
//----------------------------------------------------------------------------- // Function: BusInterfaceItem() //----------------------------------------------------------------------------- BusInterfaceItem::BusInterfaceItem(LibraryInterface* lh, QSharedPointer<Component> component, QSharedPointer<BusInterface> busIf, QGraphicsItem *parent) : HWConnectionEndpoint(parent, busIf == 0, QVector2D(1.0f, 0.0f)), lh_(lh), nameLabel_("", this), busInterface_(), component_(component), oldColumn_(0), oldPos_(), oldInterfacePositions_(), offPageConnector_(0), portsCopied_(false) { setType(ENDPOINT_TYPE_BUS); setTypeLocked(busIf != 0 && busIf->getInterfaceMode() != General::INTERFACE_MODE_COUNT); busInterface_ = busIf; int squareSize = GridSize; QPolygonF shape; shape << QPointF(-squareSize/2, squareSize / 2) << QPointF(-squareSize/2, -squareSize) << QPointF(squareSize/2, -squareSize) << QPointF(squareSize/2, squareSize / 2) << QPointF(0, squareSize); setPolygon(shape); QFont font = nameLabel_.font(); font.setPointSize(8); nameLabel_.setFont(font); nameLabel_.setRotation(-rotation()); nameLabel_.setFlag(ItemStacksBehindParent); QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect; shadow->setXOffset(0); shadow->setYOffset(0); shadow->setBlurRadius(5); nameLabel_.setGraphicsEffect(shadow); setFlag(ItemIsMovable); setFlag(ItemIsSelectable); setFlag(ItemSendsGeometryChanges); setFlag(ItemSendsScenePositionChanges); // Create the off-page connector. offPageConnector_ = new OffPageConnectorItem(this); offPageConnector_->setPos(0.0, -GridSize * 3); offPageConnector_->setFlag(ItemStacksBehindParent); offPageConnector_->setVisible(false); updateInterface(); }
void main(void) { INIT_SHARC; initInterface(); while(1) { updateInterface(); } }
// returns false if the user skeleton is not being tracked bool yarp::dev::OpenNI2DeviceDriverServer::getSkeletonPosition(Vector *vectorArray, float *confidence, int userID) { updateInterface(); #ifdef OPENNI2_DRIVER_USES_NITE2 if(OpenNI2SkeletonTracker::getSensor()->userSkeleton[userID].skeletonState != nite::SKELETON_TRACKED) return false; #endif for(int i = 0; i < TOTAL_JOINTS; i++) { vectorArray[i].resize(3); vectorArray[i].zero(); vectorArray[i] = OpenNI2SkeletonTracker::getSensor()->userSkeleton[userID].skeletonPointsPos[i]; confidence[i] = (double)OpenNI2SkeletonTracker::getSensor()->userSkeleton[userID].skeletonPosConfidence[i]; } return true; }
void AddressBook::soumettreContact() { QString nom (nomLineEdit->text()); QString adresse (adresseTextEdit->toPlainText()); if (nom.isEmpty() || adresse.isEmpty()) { QMessageBox::information(this , tr("Champs obligatoires") , tr ("Veuillez remplir le nom et l'adresse.")); return; } if (currentMode == AddingMode) { if (! listeContacts.contains(nom)) { listeContacts.insert(nom , adresse); QMessageBox::information(this , tr("Contact ajouté") , tr ("Le contact \"%1\" a bien été ajouté").arg(nom)); } else { QMessageBox::information (this , tr ("Contact existant") , tr ("Un contact portant ce nom existe déjà")); return; } } else if (currentMode == EditingMode) { if (oldNom != nom) { if (!listeContacts.contains(nom)) { QMessageBox::information(this , tr("Contact modifié") , tr("Modification du contact \"%1\"").arg(oldNom)); listeContacts.remove(oldNom); listeContacts.insert(nom , adresse); } else { QMessageBox::information (this , tr ("Erreur modification") , tr ("\"%1\" figure déjà dans vos contacts.").arg(nom)); } } else if (oldAdresse != adresse){ QMessageBox::information(this , tr("Contact modifié") , tr("Modification du contact \"%1\"").arg(nom)); listeContacts[nom] = adresse; } } updateInterface(NavigationMode); }