StatisticsDisplayWidget::StatisticsDisplayWidget(const std::string& title,QWidget* parent) : QDockWidget(parent), _tabWidget(0), _title(QString::fromStdString(title)), _updatePending(false) { //create tab widget with one tab for each input image this->setObjectName(QString("Statistics")) ; _tabWidget = new QTabWidget(this) ; _tabWidget->setUsesScrollButtons(true) ; _tabWidget->setTabPosition(QTabWidget::East) ; _tabWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum) ; this->setWidget(_tabWidget) ; this->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea) ; this->setWindowTitle(QString("StatisticsDisplay [") + _title + QString("]") ) ; this->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable) ; connect(this, SIGNAL(statsUpdated()), this, SLOT(_updateStats()), Qt::QueuedConnection) ; }
SearchPage::SearchPage(QWidget *p) : QWidget(p) , state(-1) , model(this) , proxy(this) { setupUi(this); addToPlayQueue->setDefaultAction(StdActions::self()->addToPlayQueueAction); replacePlayQueue->setDefaultAction(StdActions::self()->replacePlayQueueAction); locateAction=new Action(Icon("edit-find"), i18n("Locate In Library"), this); view->allowTableView(new SearchTableView(view)); view->addAction(StdActions::self()->addToPlayQueueAction); view->addAction(StdActions::self()->replacePlayQueueAction); view->addAction(StdActions::self()->addWithPriorityAction); view->addAction(StdActions::self()->addToStoredPlaylistAction); #ifdef TAGLIB_FOUND #ifdef ENABLE_DEVICES_SUPPORT view->addAction(StdActions::self()->copyToDeviceAction); #endif #endif // TAGLIB_FOUND view->addAction(locateAction); connect(this, SIGNAL(add(const QStringList &, bool, quint8)), MPDConnection::self(), SLOT(add(const QStringList &, bool, quint8))); connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &))); connect(&model, SIGNAL(searching()), view, SLOT(showSpinner())); connect(&model, SIGNAL(searched()), view, SLOT(hideSpinner())); connect(&model, SIGNAL(statsUpdated(int, quint32)), this, SLOT(statsUpdated(int, quint32))); connect(view, SIGNAL(itemsSelected(bool)), this, SLOT(controlActions())); connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &))); connect(view, SIGNAL(searchItems()), this, SLOT(searchItems())); connect(MPDConnection::self(), SIGNAL(stateChanged(bool)), this, SLOT(setSearchCategories())); connect(locateAction, SIGNAL(triggered()), SLOT(locateSongs())); proxy.setSourceModel(&model); view->setModel(&proxy); view->setMode(ItemView::Mode_List); view->setPermanentSearch(); setSearchCategories(); view->setSearchCategory(Settings::self()->searchCategory()); statsUpdated(0, 0); }
/** * Listens to clients * @param server */ void createClient(int server, char * document_root) { int socket_client; // BOUCLE POUR ECOUTER TOUUUUT LES CLIENTS while (1) { //printf("Waiting for client %d\n", CLIENT_ID); socket_client = accept(server, NULL, NULL); CLIENT_ID++; beforeUpdateStats(); get_stats()->served_connections++; statsUpdated(); if (socket_client == -1) { perror("accept"); /* traitement d’erreur */ printf("Server error..."); } pid_t pid = fork(); // Call client if (pid == 0) { clientLoop(socket_client, document_root); } else { close(socket_client); } } }
PokeEdit::PokeEdit(TeamBuilderWidget *master, PokeTeam *poke, QAbstractItemModel *pokeModel, QAbstractItemModel *itemsModel, QAbstractItemModel *natureModel) : ui(new Ui::PokeEdit), pokemonModel(pokeModel), m_poke(poke), master(master) { ui->setupUi(this); ui->itemSprite->raise(); ui->item->setModel(itemsModel); ui->nature->setModel(natureModel); ui->levelSettings->setPoke(poke); ui->evbox->setPoke(poke); ui->ivbox->setPoke(poke); if (0) { master->getDock(EVDock)->setWidget(ui->evbox); master->getDock(IVDock)->setWidget(ui->ivbox); master->getDock(LevelDock)->setWidget(ui->levelSettings); master->getDock(MoveDock)->setWidget(ui->moveContainer); } else { QCloseDockWidget *hi = new QCloseDockWidget(tr("Advanced"), this); hi->setObjectName("AdvancedTab"); hi->setWidget(ui->ivbox); hi->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable); ui->horizontalMove->addWidget(hi); if (advancedWindowClosed) { hi->close(); } connect(hi, SIGNAL(closed()), SIGNAL(closeAdvanced())); // QDockWidget *hi2 = new QDockWidget(tr("Level"), this); // hi2->setWidget(ui->levelSettings); // hi2->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable); // ui->horizontalPoke->addWidget(hi2); } QSortFilterProxyModel *pokeFilter = new QSortFilterProxyModel(this); pokeFilter->setFilterRegExp("."); pokeFilter->setSourceModel(pokemonModel); QCompleter *completer = new QCompleter(pokeFilter, ui->nickname); completer->setCompletionColumn(1); completer->setCompletionRole(Qt::DisplayRole); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setCompletionMode(QCompleter::PopupCompletion); ui->nickname->setCompleter(completer); connect(completer, SIGNAL(activated(QString)), SLOT(setNum(QString))); /* 20 characters for the name. Longest name: Vivillon-Archipelago = 20 characters */ ui->nickname->setValidator(new QNickValidator(ui->nickname, 20)); fillMoves(); connect(ui->levelSettings, SIGNAL(levelUpdated()), this, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(levelUpdated()), ui->ivbox, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), ui->levelSettings, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(shinyUpdated()), SLOT(updatePicture())); connect(ui->happiness, SIGNAL(valueChanged(int)), this, SLOT(changeHappiness(int))); connect(ui->nature, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNature(int))); connect(ui->item, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeItem(QString))); connect(ui->evbox, SIGNAL(natureChanged(int)), this, SLOT(setNature(int))); connect(ui->evbox, SIGNAL(natureBoostChanged()), ui->ivbox, SLOT(updateStats())); connect(ui->ivbox, SIGNAL(statsUpdated()), ui->evbox, SLOT(updateEVs())); updateAll(); }
PokeEdit::PokeEdit(PokeTeam *poke, QAbstractItemModel *pokeModel, QAbstractItemModel *itemsModel, QAbstractItemModel *natureModel) : ui(new Ui::PokeEdit), pokemonModel(pokeModel), m_poke(poke) { ui->setupUi(this); ui->itemSprite->raise(); ui->item->setModel(itemsModel); ui->nature->setModel(natureModel); ui->levelSettings->setPoke(poke); ui->evbox->setPoke(poke); ui->ivbox->setPoke(poke); movesModel = new PokeMovesModel(poke->num(), poke->gen(), this); QSortFilterProxyModel *filter = new QSortFilterProxyModel(this); filter->setSourceModel(movesModel); ui->moveChoice->setModel(filter); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::PP, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Pow, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Acc, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Name, QHeaderView::Fixed); ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Name, 125); ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Type, Theme::TypePicture(Type::Normal).width()+5); ui->moveChoice->setIconSize(Theme::TypePicture(Type::Normal).size()); ui->moveChoice->sortByColumn(PokeMovesModel::Name, Qt::AscendingOrder); m_moves[0] = ui->move1; m_moves[1] = ui->move2; m_moves[2] = ui->move3; m_moves[3] = ui->move4; connect(ui->speciesLabel, SIGNAL(clicked()), SLOT(on_pokemonFrame_clicked())); connect(ui->moveChoice, SIGNAL(activated(QModelIndex)), SLOT(moveEntered(QModelIndex))); /* the four move choice items */ for (int i = 0; i < 4; i++) { QCompleter *completer = new QCompleter(m_moves[i]); completer->setModel(ui->moveChoice->model()); completer->setCompletionColumn(PokeMovesModel::Name); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setCompletionRole(Qt::DisplayRole); m_moves[i]->setCompleter(completer); completer->setProperty("move", i); m_moves[i]->setProperty("move", i); connect(completer, SIGNAL(activated(QString)), SLOT(changeMove())); connect(m_moves[i], SIGNAL(returnPressed()), SLOT(changeMove())); connect(m_moves[i], SIGNAL(editingFinished()), SLOT(changeMove())); } connect(ui->levelSettings, SIGNAL(levelUpdated()), this, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(levelUpdated()), ui->ivbox, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(shinyUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), ui->levelSettings, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(shinyUpdated()), SLOT(updatePicture())); connect(ui->ivbox, SIGNAL(shinyUpdated()), ui->levelSettings, SLOT(updateShiny())); connect(ui->happiness, SIGNAL(valueChanged(int)), this, SLOT(changeHappiness(int))); connect(ui->nature, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNature(int))); connect(ui->item, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeItem(QString))); connect(ui->evbox, SIGNAL(natureChanged(int)), this, SLOT(setNature(int))); connect(ui->evbox, SIGNAL(natureBoostChanged()), ui->ivbox, SLOT(updateStats())); connect(ui->ivbox, SIGNAL(statsUpdated()), ui->evbox, SLOT(updateEVs())); updateAll(); }
void WidgetSearchResults::on_tabWidgetSearch_currentChanged(int index) { WidgetSearchTemplate* pWg = qobject_cast<WidgetSearchTemplate*>(ui->tabWidgetSearch->currentWidget()); emit searchTabChanged(pWg); emit statsUpdated( pWg ); }
void CallStatsModel::updateStats(LinphoneCall *call) { if (!call) { return; } float quality = linphone_call_get_current_quality(call); if (quality >= 4) { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_4.png"; } else if (quality >= 3) { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_3.png"; } else if (quality >= 2) { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_2.png"; } else if (quality >= 1) { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_1.png"; } else { _currentCallQualityIcon = "/images/statusbar/call_quality_indicator_0.png"; } const LinphoneCallParams *params = linphone_call_get_current_params(call); if (!params) { return; } LinphoneMediaEncryption encryption = linphone_call_params_get_media_encryption(params); _currentCallSecurityIcon = "/images/statusbar/security_ko.png"; if (encryption == LinphoneMediaEncryptionSRTP || encryption == LinphoneMediaEncryptionDTLS) { _currentCallSecurityIcon = "/images/statusbar/security_ok.png"; } else if (encryption == LinphoneMediaEncryptionZRTP) { _callSecurityToken = tr("ZRTP token is %1.\r\nYou should only accept if you have the same token as your correspondent.").arg(linphone_call_get_authentication_token(call)); bool isAuthTokenVerified = linphone_call_get_authentication_token_verified(call); if (isAuthTokenVerified) { _currentCallSecurityIcon = "/images/statusbar/security_ok.png"; } else { _currentCallSecurityIcon = "/images/statusbar/security_pending.png"; } emit zrtpUpdated(); } const LinphoneCallStats *audioStats = linphone_call_get_audio_stats(call); if (audioStats) { _iceStatus = IceStateToString(linphone_call_stats_get_ice_state(audioStats)); _downloadAudioBandwidth = QString("<html>↓ %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_download_bandwidth(audioStats))); _uploadAudioBandwidth = QString("<html>↑ %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_upload_bandwidth(audioStats))); } const LinphonePayloadType *audioPayload = linphone_call_params_get_used_audio_codec(params); if (audioPayload) { _audioCodec = QString(linphone_payload_type_get_mime_type(audioPayload)) + "/" + QString::number(payload_type_get_rate(audioPayload)) + "/" + QString::number(linphone_payload_type_get_channels(audioPayload)); } if (linphone_call_params_video_enabled(params)) { const LinphoneCallStats *videoStats = linphone_call_get_video_stats(call); if (videoStats) { _downloadVideoBandwidth = QString("<html>↓ %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_download_bandwidth(videoStats))); _uploadVideoBandwidth = QString("<html>↑ %1 kbits/s</html>").arg(QString::number((int)linphone_call_stats_get_upload_bandwidth(videoStats))); } const LinphonePayloadType *videoPayload = linphone_call_params_get_used_video_codec(params); if (videoPayload) { _videoCodec = QString(linphone_payload_type_get_mime_type(videoPayload)); } MSVideoSize sentVideoSize = linphone_call_params_get_sent_video_size(params); float framerate = linphone_call_params_get_sent_framerate(params); _sentVideoSize = QString("%1x%2 @ %3 fps").arg(QString::number(sentVideoSize.width), QString::number(sentVideoSize.height), QString::number((int)framerate)); MSVideoSize receivedVideoSize = linphone_call_params_get_received_video_size(params); framerate = linphone_call_params_get_received_framerate(params); _receivedVideoSize = QString("%1x%2 @ %3 fps").arg(QString::number(receivedVideoSize.width), QString::number(receivedVideoSize.height), QString::number((int)framerate)); } emit statsUpdated(); }