/* * When a Track/Video/file on the right hand browse menu is selected(once) */ void browse::on_TrackList_clicked(const QModelIndex &index) { int selected = 0; selected = ui->TrackList->currentIndex().row(); emit selectionChanged(selected); /// submit new clicked listing if(MenuMode == 0){ /// listing local songs for(int i=0; i<=Song.getSize(); i++){ if(curSongID[selected] == Song.getID(i)){ emit trackChanged(Song.getName(i), Song.getPath(i), Song.getID(i), Song.getPar(i), MenuMode); } } } else if(MenuMode == 1){ /// listing local videos for(int i =0; i<=vidCount; i++){ if(curVidID[selected]== Video.getID(i)){ emit trackChanged(Video.getName(i), Video.getPath(i), Video.getID(i), Video.getPar(i), MenuMode); } } } else if(MenuMode == 2){ /// listing local videos for(int i =0; i<=radCount; i++){ if(curRadID[selected]== Radio.getID(i)){ emit trackChanged(Radio.getName(i), Radio.getPath(i), Radio.getID(i), Radio.getPar(i), MenuMode); } } } }
void Player::playTrack(Track *p) { Q_EMIT trackChanged(); Q_EMIT trackChanged(p); // Set PlayState for track p->setPlayState(); // Stop playing prev tack m_GstPlayer->stop(); setState(Player::Stoped); Q_EMIT newTitles(p->artist(), p->title()); m_GstPlayer->stop(); m_GstPlayer->setUri(p->url()); m_GstPlayer->play(); setState(Playing); m_bArtRequested = false; Q_EMIT changed(); if(p->metaLoaded()) Q_EMIT metaChanged(); }
Mpris2DBusHandler::Mpris2DBusHandler() : QObject( kapp ) { new Mpris2RootAdaptor( this ); new Mpris2PlayerAdaptor( this ); // amarok extensions: new Mpris2AmarokAppAdaptor( this ); new Mpris2AmarokPlayerAdaptor( this ); QDBusConnection::sessionBus().registerObject( MPRIS2_OBJECT_PATH, this ); connect( The::playlistActions(), SIGNAL( navigatorChanged() ), SLOT( updateTrackProgressionProperties() ) ); // changing the navigator may also affect whether there is a // next or previous track connect( The::playlistActions(), SIGNAL( navigatorChanged() ), SLOT( updatePlaylistProperties() ) ); connect( The::playlist()->qaim(), SIGNAL( rowsInserted(QModelIndex,int,int) ), SLOT( updatePlaylistProperties() ) ); connect( The::playlist()->qaim(), SIGNAL( rowsMoved(QModelIndex,int,int,QModelIndex,int) ), SLOT( updatePlaylistProperties() ) ); connect( The::playlist()->qaim(), SIGNAL( rowsRemoved(QModelIndex,int,int) ), SLOT( updatePlaylistProperties() ) ); connect( qobject_cast<Playlist::ProxyBase*>(The::playlist()->qaim()), SIGNAL( activeTrackChanged(const quint64) ), this, SLOT( playlistActiveTrackChanged(quint64) ) ); EngineController *engine = The::engineController(); connect( engine, SIGNAL( playbackStateChanged() ), this, SLOT( updatePlaybackStatusProperty() ) ); connect( engine, SIGNAL( trackChanged( Meta::TrackPtr ) ), this, SLOT( updatePlaylistProperties() ) ); connect( engine, SIGNAL( trackChanged( Meta::TrackPtr ) ), this, SLOT( updateTrackProperties() ) ); connect( engine, SIGNAL( trackPositionChanged( qint64, bool ) ), this, SLOT( trackPositionChanged( qint64, bool ) ) ); connect( engine, SIGNAL( seekableChanged( bool ) ), this, SLOT( seekableChanged( bool ) ) ); connect( engine, SIGNAL( volumeChanged( int ) ), this, SLOT( volumeChanged( int ) ) ); updateTrackProgressionProperties(); updatePlaybackStatusProperty(); updatePlaylistProperties(); updateTrackProperties(); setPropertyInternal( "Volume", static_cast<double>(The::engineController()->volume()) / 100.0 ); setPropertyInternal( "CanSeek", The::engineController()->phononMediaObject()->isSeekable() ); }
static void onPropertiesChanged(GDBusProxy *proxy, GVariant *changed_properties, const gchar* const *invalidated_properties, gpointer pp) { if (g_variant_n_children(changed_properties) > 0) { GVariantIter *iter; gchar *key; GVariant *value; debug(" *** Properties Changed:\n"); g_variant_get(changed_properties, "a{sv}", &iter); while (g_variant_iter_loop (iter, "{&sv}", &key, &value)) { gchar *value_str; value_str = g_variant_print(value, TRUE); g_print(" %s -> %s\n", key, value_str); g_free(value_str); if (strncmp(key, "Metadata",8) == 0) { trackChanged(value); } else if (strcmp(key, "PlaybackStatus") == 0) { playbackChanged(g_variant_dup_string(value, NULL)); } else if (strcmp(key, "LoopStatus") == 0) { loopChanged(g_variant_dup_string(value, NULL)); } else if (strcmp(key, "Shuffle") == 0) { shuffleChanged(g_variant_get_boolean(value)); } else if (strcmp(key, "Position") == 0) { positionChanged(g_variant_get_int64(value)); } else if (strcmp(key, "Volume") == 0) { volumeChanged(g_variant_get_double(value)); } } g_variant_iter_free (iter); } }
ScrobblerAdapter::ScrobblerAdapter( QObject *parent, const QString &clientId ) : QObject( parent ), m_scrobbler( new lastfm::Audioscrobbler( clientId ) ), m_clientId( clientId ), m_lastSaved( 0 ) { DEBUG_BLOCK resetVariables(); //HACK work around a bug in liblastfm---it doesn't create its config dir, so when it // tries to write the track cache, it fails silently. until we have a fixed version, do this // path finding code taken from liblastfm/src/misc.cpp QString lpath = QDir::home().filePath( ".local/share/Last.fm" ); QDir ldir = QDir( lpath ); if( !ldir.exists() ) { ldir.mkpath( lpath ); } connect( The::mainWindow(), SIGNAL( loveTrack( Meta::TrackPtr) ), SLOT( loveTrack( Meta::TrackPtr ) ) ); connect( The::mainWindow(), SIGNAL( banTrack() ), SLOT( banTrack() ) ); EngineController *engine = The::engineController(); connect( engine, SIGNAL( stopped( qint64, qint64 ) ), this, SLOT( stopped( qint64, qint64 ) ) ); connect( engine, SIGNAL( trackPositionChanged( qint64, bool ) ), this, SLOT( trackPositionChanged( qint64, bool ) ) ); //Use trackChanged instead of trackPlaying to prevent reset of current track after Unpausing. connect( engine, SIGNAL( trackChanged( Meta::TrackPtr ) ), this, SLOT( trackPlaying( Meta::TrackPtr ) ) ); connect( engine, SIGNAL( trackMetadataChanged( Meta::TrackPtr ) ), this, SLOT( trackMetadataChanged( Meta::TrackPtr ) ) ); }
void CMBaseAudioSource::setTrack(quint16 track) { if (m_track == track) return; m_track = track; emit trackChanged(track); }
void GUI_TrayIcon::timer_timed_out() { qDebug() << "Timed out"; _timer->stop(); if (_md_set) { trackChanged(_md); } }
void updateTrackProperty() { GVariant * metadata = updateProperty(mpris_data->player, "Metadata"); if (metadata == NULL) { return; } trackChanged(metadata); g_variant_unref(metadata); }
void PlayerControls::setupCover() { m_wSongInfo = new SongInfo(this); connect(ArtLoader::instance(), SIGNAL(artLoaded(bool)), m_wSongInfo, SLOT(onArtLoaded(bool))); connect(Player::instance(), SIGNAL(trackChanged()), m_wSongInfo, SLOT(clearCover())); m_mainLayout->addWidget(m_wSongInfo, 0, 0, 3, 1); m_mainLayout->setAlignment(m_wSongInfo, Qt::AlignBottom); m_mainLayout->setRowMinimumHeight(2, 43); }
Playlist::DynamicTrackNavigator::DynamicTrackNavigator() : m_playlist( 0 ) { connect( m_model->qaim(), SIGNAL(activeTrackChanged(quint64)), SLOT(trackChanged()) ); connect( m_model->qaim(), SIGNAL(modelReset()), SLOT(repopulate()) ); connect( Dynamic::DynamicModel::instance(), SIGNAL(activeChanged(int)), SLOT(activePlaylistChanged()) ); activePlaylistChanged(); }
AmarokEngineScript::AmarokEngineScript( QScriptEngine* ScriptEngine ) : QObject( kapp ) { Q_UNUSED( ScriptEngine ); connect( The::engineController(), SIGNAL( trackChanged( Meta::TrackPtr ) ), this, SIGNAL( trackChanged() ) ); connect( The::engineController(), SIGNAL( trackFinished() ), this, SIGNAL( trackFinished() ) ); connect( The::engineController(), SIGNAL( trackSeeked( int ) ), this, SIGNAL( trackSeeked( int ) ) ); connect( The::engineController(), SIGNAL( volumeChanged( int ) ), this, SIGNAL( volumeChanged( int ) ) ); connect( The::engineController(), SIGNAL( trackPlayPause( int ) ), this, SIGNAL( trackPlayPause( int ) ) ); }
void EngineController::endSession() { //only update song stats, when we're not going to resume it if ( !AmarokConfig::resumePlayback() && m_currentTrack ) { playbackEnded( trackPosition(), m_currentTrack->length(), EngineObserver::EndedQuit ); emit trackChanged( Meta::TrackPtr( 0 ) ); } }
CurrentTrackToolbar::CurrentTrackToolbar( QWidget * parent ) : QToolBar( parent ) { setToolButtonStyle( Qt::ToolButtonIconOnly ); setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ); //setIconDimensions( 16 ); setContentsMargins( 0, 0, 0, 0 ); EngineController *engine = The::engineController(); connect( engine, SIGNAL( trackChanged( Meta::TrackPtr ) ), this, SLOT( handleAddActions() ) ); }
void Scanner::next() { if(track<list.count()){ mediaPlayer->setMedia(QMediaContent(QUrl::fromLocalFile(list.at(track)))); emit trackChanged(); } else { QSqlDatabase database=QSqlDatabase::database("Music"); if(database.commit()){ deleteLater(); } } }
void Logger::positionChanged() { if ( !m_loggingEnabled ) return; const RoutingLogic::GPSInfo& gpsInfo = RoutingLogic::instance()->gpsInfo(); if ( !gpsInfo.position.IsValid() ) return; m_gpsInfoBuffer.append(gpsInfo); int flushSecondsPassed = m_lastFlushTime.secsTo( QDateTime::currentDateTime() ); if ( flushSecondsPassed >= 300 ) writeGpxLog(); emit trackChanged(); }
void QuickTrackInfo::setTrack(const sp::Track &track) { if (track != this->track()) { m_trackWatcher->watch(track); emit trackChanged(); if (track.isLoaded()) { onTrackLoaded(); } } }
// using namespace core; core::nplaylist::nplaylist() :playlist(), totalLength(0) { circle=true; qRegisterMetaType<nplList>("nplList"); KSharedConfigPtr config=core::config->configFile(); KConfigGroup group( config, "nowPlaylist" ); rememberPl=group.readEntry( "rememberPl", false); connect(engine(),SIGNAL(trackChanged(QString) ),this,SLOT(informTrack() ) ); connect(this,SIGNAL(tracksInserted(int,int)),this,SLOT(updateLengthInsert(int,int)) ); connect(this,SIGNAL(aboutToRemoveTracks(int,int)),this,SLOT(updateLengthRemove(int,int)) ); }
PlaylistWidget::PlaylistWidget(QWidget *parent) : QWidget(parent), ui(new Ui::PlaylistWidget) { ui->setupUi(this); m_delegate = new TrackDelegate(this); ui->listView->setItemDelegate(m_delegate); ui->listView->setAcceptDrops(true); m_model = new PlaylistModel(this); m_model->setTrackCycler(Player::instance()->cycler()); m_model->setMediaLibrary(Player::instance()->media()); m_model->setFavoritesManager(Player::instance()->favorites()); m_favFilterModel = new FavoritesFilterModel(this); m_favFilterModel->setSourceModel(m_model); m_favFilterModel->setDynamicSortFilter(true); connect(ui->listView, SIGNAL(showFavoritesToggled(bool)), this, SLOT(setFavoritesFilterEnabled(bool))); connect(m_favFilterModel, SIGNAL(enabledChanged(bool)), ui->listView, SLOT(toggleFavorites(bool))); m_sortModel = new QSortFilterProxyModel(this); m_sortModel->setSourceModel(m_favFilterModel); m_sortModel->setFilterRole(PlaylistModel::SearchRole); m_sortModel->setDynamicSortFilter(true); m_sortModel->setFilterCaseSensitivity(Qt::CaseInsensitive); ui->listView->setModel(m_sortModel); connect(ui->clearButton, SIGNAL(clicked()), ui->filterEdit, SLOT(clear())); connect(ui->filterEdit, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); TrackCycler * cycler = Player::instance()->cycler(); if (cycler != 0) { connect(cycler, SIGNAL(trackChanged(PlayId)), this, SLOT(onTrackChanged(PlayId))); } PlaylistHistory *history = Player::instance()->history(); if (history != 0) { connect(history,SIGNAL(currentChanged(Playlist*)), this, SLOT(setPlaylist(Playlist*))); connect(history,SIGNAL(countChanged()), this, SLOT(onPlaylistCountChanged())); setPlaylist(history->current()); }
void CTournamentBase::fillTournamentGUI() { if (m_bNetClient) return; m_pName->setText(m_pTournament?m_pTournament->getName():L"new tournament"); if (m_pTournament) for (u32 i=0; i<m_pTournament->getRaceCount(); i++) { CTournamentRaceGUI *pRace=new CTournamentRaceGUI(m_pDevice,m_lRaces.getSize(),m_pRaceTab,!m_bNetClient); pRace->setTrack(m_pTournament->getRace(i)->getTrack()); pRace->setLaps(m_pTournament->getRace(i)->getLaps()); m_lRaces.push_back(pRace); addTrack(i); trackChanged(i,stringc(m_pTournament->getRace(i)->getTrack()).c_str()); lapsChanged(i,m_pTournament->getRace(i)->getLaps()); } m_pRaceListButtons->setRelativePosition(position2di(5,5+m_lRaces.getSize()*25)); if (m_lRaces.getSize()>=20) m_pRaceListButtons->setVisible(false); }
void PlaylistModel::metaDataChanged(const KUrl &url) { if (!m_tracks.contains(url)) { return; } int index = -2; while (index != -1) { index = m_tracks.indexOf(url, (index + 1)); if (index >= 0) { emit trackChanged(index); } } emit layoutChanged(); }
MixxxLibraryFeature::MixxxLibraryFeature(Library* pLibrary, TrackCollection* pTrackCollection, UserSettingsPointer pConfig) : LibraryFeature(pLibrary), kMissingTitle(tr("Missing Tracks")), kHiddenTitle(tr("Hidden Tracks")), m_pLibrary(pLibrary), m_pMissingView(NULL), m_pHiddenView(NULL), m_trackDao(pTrackCollection->getTrackDAO()), m_pConfig(pConfig), m_pTrackCollection(pTrackCollection) { QStringList columns; columns << "library." + LIBRARYTABLE_ID << "library." + LIBRARYTABLE_PLAYED << "library." + LIBRARYTABLE_TIMESPLAYED //has to be up here otherwise Played and TimesPlayed are not show << "library." + LIBRARYTABLE_ALBUMARTIST << "library." + LIBRARYTABLE_ALBUM << "library." + LIBRARYTABLE_ARTIST << "library." + LIBRARYTABLE_TITLE << "library." + LIBRARYTABLE_YEAR << "library." + LIBRARYTABLE_RATING << "library." + LIBRARYTABLE_GENRE << "library." + LIBRARYTABLE_COMPOSER << "library." + LIBRARYTABLE_GROUPING << "library." + LIBRARYTABLE_TRACKNUMBER << "library." + LIBRARYTABLE_KEY << "library." + LIBRARYTABLE_KEY_ID << "library." + LIBRARYTABLE_BPM << "library." + LIBRARYTABLE_BPM_LOCK << "library." + LIBRARYTABLE_DURATION << "library." + LIBRARYTABLE_BITRATE << "library." + LIBRARYTABLE_REPLAYGAIN << "library." + LIBRARYTABLE_FILETYPE << "library." + LIBRARYTABLE_DATETIMEADDED << "track_locations.location" << "track_locations.fs_deleted" << "library." + LIBRARYTABLE_COMMENT << "library." + LIBRARYTABLE_MIXXXDELETED << "library." + LIBRARYTABLE_COVERART_SOURCE << "library." + LIBRARYTABLE_COVERART_TYPE << "library." + LIBRARYTABLE_COVERART_LOCATION << "library." + LIBRARYTABLE_COVERART_HASH; QSqlQuery query(pTrackCollection->getDatabase()); QString tableName = "library_cache_view"; QString queryString = QString( "CREATE TEMPORARY VIEW IF NOT EXISTS %1 AS " "SELECT %2 FROM library " "INNER JOIN track_locations ON library.location = track_locations.id") .arg(tableName, columns.join(",")); query.prepare(queryString); if (!query.exec()) { LOG_FAILED_QUERY(query); } // Strip out library. and track_locations. for (QStringList::iterator it = columns.begin(); it != columns.end(); ++it) { if (it->startsWith("library.")) { *it = it->replace("library.", ""); } else if (it->startsWith("track_locations.")) { *it = it->replace("track_locations.", ""); } } BaseTrackCache* pBaseTrackCache = new BaseTrackCache( pTrackCollection, tableName, LIBRARYTABLE_ID, columns, true); connect(&m_trackDao, SIGNAL(trackDirty(TrackId)), pBaseTrackCache, SLOT(slotTrackDirty(TrackId))); connect(&m_trackDao, SIGNAL(trackClean(TrackId)), pBaseTrackCache, SLOT(slotTrackClean(TrackId))); connect(&m_trackDao, SIGNAL(trackChanged(TrackId)), pBaseTrackCache, SLOT(slotTrackChanged(TrackId))); connect(&m_trackDao, SIGNAL(tracksAdded(QSet<TrackId>)), pBaseTrackCache, SLOT(slotTracksAdded(QSet<TrackId>))); connect(&m_trackDao, SIGNAL(tracksRemoved(QSet<TrackId>)), pBaseTrackCache, SLOT(slotTracksRemoved(QSet<TrackId>))); connect(&m_trackDao, SIGNAL(dbTrackAdded(TrackPointer)), pBaseTrackCache, SLOT(slotDbTrackAdded(TrackPointer))); m_pBaseTrackCache = QSharedPointer<BaseTrackCache>(pBaseTrackCache); pTrackCollection->setTrackSource(m_pBaseTrackCache); // These rely on the 'default' track source being present. m_pLibraryTableModel = new LibraryTableModel(this, pTrackCollection, "mixxx.db.model.library"); TreeItem* pRootItem = new TreeItem(); TreeItem* pmissingChildItem = new TreeItem(kMissingTitle, kMissingTitle, this, pRootItem); TreeItem* phiddenChildItem = new TreeItem(kHiddenTitle, kHiddenTitle, this, pRootItem); pRootItem->appendChild(pmissingChildItem); pRootItem->appendChild(phiddenChildItem); m_childModel.setRootItem(pRootItem); }
PaintWidget::PaintWidget(QWidget *parent) : QWidget( parent ), m_ui( new Ui::PaintWidget ) { m_ui->setupUi( this ); if ( MapData::instance()->loaded() ) { setAttribute( Qt::WA_OpaquePaintEvent, true ); setAttribute( Qt::WA_NoSystemBackground, true ); } #else PaintWidget::PaintWidget() { #endif m_lastMouseX = 0; m_lastMouseY = 0; m_wheelDelta = 0; m_fixed = false; setKeepPositionVisible( false ); m_mouseDown = false; m_drag = false; m_request.zoom = 0; m_request.center = RoutingLogic::instance()->source().ToProjectedCoordinate(); dataLoaded(); sourceChanged(); waypointsChanged(); trackChanged(); routeChanged(); connect( MapData::instance(), SIGNAL(dataLoaded()), this, SLOT(dataLoaded()) ); connect( RoutingLogic::instance(), SIGNAL(sourceChanged()), this, SLOT(sourceChanged()) ); connect( RoutingLogic::instance(), SIGNAL(routeChanged()), this, SLOT(routeChanged()) ); connect( RoutingLogic::instance(), SIGNAL(waypointsChanged()), this, SLOT(waypointsChanged()) ); connect( Logger::instance(), SIGNAL(trackChanged()), this, SLOT(trackChanged()) ); } PaintWidget::~PaintWidget() { #ifndef SAILFISH delete m_ui; #endif } void PaintWidget::paint(QPainter *painter) { if ( !isVisible() ) return; IRenderer* renderer = MapData::instance()->renderer(); if ( renderer == NULL ) return; if ( m_fixed ){ m_request.center = m_request.position.ToProjectedCoordinate(); if ( GlobalSettings::autoRotation() ) { //gradually change the screen rotation to match the heading double diff = m_request.rotation + m_request.heading; while ( diff <= -180 ) diff += 360; while ( diff >= 180 ) diff -=360; //to filter out noise stop when close enough if ( diff > 0 ) diff = std::max( 0.0, diff - 15 ); if ( diff < 0 ) diff = std::min( 0.0, diff + 15 ); m_request.rotation -= diff / 2; //normalize while ( m_request.rotation < 0 ) m_request.rotation += 360; while ( m_request.rotation >= 360 ) m_request.rotation -= 360; int radius = height() * 0.25; m_request.center = renderer->PointToCoordinate( 0, -radius, m_request ); } else { m_request.rotation = 0; } } else { m_request.rotation = 0; } if (m_keepPositionVisible) m_request.center = m_request.position.ToProjectedCoordinate(); Timer time; renderer->Paint( painter, m_request ); qDebug() << "Rendering:" << time.elapsed() << "ms"; } void PaintWidget::dataLoaded() { IRenderer* renderer = MapData::instance()->renderer(); if ( renderer == NULL ) return; #ifndef SAILFISH setAttribute( Qt::WA_OpaquePaintEvent, true ); setAttribute( Qt::WA_NoSystemBackground, true ); #endif renderer->SetUpdateSlot( this, SLOT(update()) ); update(); }
bool CTournamentBase::OnEvent (const SEvent &event) { bool bRet=false; if (event.EventType==EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown) { if (event.KeyInput.Key==KEY_ESCAPE) { if (m_pSndEngine) m_pSndEngine->play2D("data/sounds/menuback.ogg"); m_iSelect=1; bRet=true; } if (event.KeyInput.Key==KEY_RETURN) { printf("Start Tournament\n"); fillTournamentList(); bRet=startTournament(); } } if (event.EventType==EET_GUI_EVENT ) { if (event.GUIEvent.EventType==EGET_COMBO_BOX_CHANGED) { u32 id=event.GUIEvent.Caller->getID(); if (event.GUIEvent.Caller->getID()>=150) { lapsChanged(id-150,((IGUIComboBox *)event.GUIEvent.Caller)->getSelected()+2); } else if (id>=100) { list<CTournamentRaceGUI *>::Iterator it=m_lRaces.begin(); for (it=m_lRaces.begin(); it!=m_lRaces.end(); it++) { if (id-77==(*it)->getId()) { CTournamentRaceGUI *p=*it; trackChanged(id-100,stringc(p->getTrack()).c_str()); } } } } if (event.GUIEvent.EventType==EGET_ELEMENT_FOCUS_LOST) { if (event.GUIEvent.Caller==m_pName) tournamentNameChanged(); } if (event.GUIEvent.EventType==EGET_ELEMENT_FOCUSED) { IGUIElement *pCaller=event.GUIEvent.Caller,*pParent=pCaller->getParent(); while (pParent!=NULL) { pParent->bringToFront(pCaller); pCaller=pParent; pParent=pParent->getParent(); } } if (event.GUIEvent.EventType==EGET_CHECKBOX_CHANGED) { if (event.GUIEvent.Caller==m_pRecordReplay) { m_bRecordReplay=m_pRecordReplay->isChecked(); } } if (event.GUIEvent.EventType==EGET_BUTTON_CLICKED) { u32 id=event.GUIEvent.Caller->getID(); if (m_pSndEngine && id!=4) m_pSndEngine->play2D("data/sounds/menuchange.ogg"); if (id==1) { addTrack(m_lRaces.getSize()); CTournamentRaceGUI *pRace=new CTournamentRaceGUI(m_pDevice,m_lRaces.getSize(),m_pRaceTab,!m_bNetClient); m_lRaces.push_back(pRace); m_pRaceListButtons->setRelativePosition(position2di(5,5+m_lRaces.getSize()*25)); if (m_lRaces.getSize()>=20) m_pRaceListButtons->setVisible(false); } if (id==2) { list<CTournamentRaceGUI *>::Iterator it=m_lRaces.begin(); while (m_lRaces.getSize()>0) { CTournamentRaceGUI *p=*it; m_lRaces.erase(it); delete p; it=m_lRaces.begin(); } m_lRaces.clear(); m_pRaceListButtons->setRelativePosition(position2di(5,5+m_lRaces.getSize()*25)); clearList(); } if (id==3) { printf("Start Tournament\n"); fillTournamentList(); bRet=startTournament(); } if (id==4) { m_iSelect=1; if (m_pSndEngine) m_pSndEngine->play2D("data/sounds/menuback.ogg"); bRet=true; } if (id==5) { printf("\t\tload tournament\n"); c8 sFileName[0xFFF]; sprintf(sFileName,"data/tournaments/%s.trn",stringc(stringw(m_pTournaments->getText())).c_str()); while (m_lRaces.getSize()>0) { list<CTournamentRaceGUI *>::Iterator it=m_lRaces.begin(); CTournamentRaceGUI *p=*it; m_lRaces.erase(it); delete p; } clearList(); printf("loading tournament \"%s\"...\n",sFileName); IXMLReaderUTF8 *pXml=m_pDevice->getFileSystem()->createXMLReaderUTF8(sFileName); if (pXml) { bool bConfig=false; while (pXml->read()) { bConfig=bConfig || (!strcmp(pXml->getNodeName(),"settings") && pXml->getNodeType()==EXN_ELEMENT); if (bConfig) { CTournamentBase::readConfig(pXml); } } pXml->drop(); fillTournamentGUI(); } bRet=true; } if (id==6) { fillTournamentStructure(); c8 sFileName[0xFFF]; sprintf(sFileName,"data/tournaments/%s.trn",stringc(stringw(m_pName->getText())).c_str()); IXMLWriter *pXml=m_pDevice->getFileSystem()->createXMLWriter(sFileName); if (pXml) { pXml->writeXMLHeader(); pXml->writeElement(L"settings"); pXml->writeLineBreak(); writeConfig(pXml); pXml->writeClosingTag(L"settings"); pXml->writeLineBreak(); pXml->drop(); } bRet=true; } if (id>=23) { list<CTournamentRaceGUI *>::Iterator it; for (it=m_lRaces.begin(); it!=m_lRaces.end(); it++) { if (id==(*it)->getId()) { CTournamentRaceGUI *p=*it; m_lRaces.erase(it); delete p; u32 cnt=0; for (it=m_lRaces.begin(); it!=m_lRaces.end(); it++) (*it)->setId(cnt++); m_pRaceListButtons->setRelativePosition(position2di(5,5+m_lRaces.getSize()*25)); m_pRaceListButtons->setVisible(true); delTrack(id); return true; } } } } } return bRet; }
void AbstractGraphicsItem::setTrack( GraphicsTrack* track ) { setParentItem( track ); emit trackChanged( track ); }
bool Logger::readGpxLog() { m_gpsInfoBuffer.clear(); if ( !m_logFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) { return false; } QString lineBuffer; QString latString; QString lonString; QString eleString; QString timeString; QStringList tempList; bool insideTrackpoint = false; while ( !m_logFile.atEnd() ) { lineBuffer = m_logFile.readLine(); lineBuffer = lineBuffer.simplified(); if (!insideTrackpoint) { latString = ""; lonString = ""; eleString = ""; timeString = ""; } if (lineBuffer.contains("<trkpt")) { insideTrackpoint = true; tempList = lineBuffer.split("\""); latString = tempList.at(1); lonString = tempList.at(3); } if (lineBuffer.contains("<ele>")) { lineBuffer = lineBuffer.remove("<ele>"); lineBuffer = lineBuffer.remove("</ele>"); eleString = lineBuffer; } if (lineBuffer.contains("<time>")) { lineBuffer = lineBuffer.remove("<time>"); lineBuffer = lineBuffer.remove("</time>"); timeString = lineBuffer; } if (lineBuffer.contains("</trkpt>")) { RoutingLogic::GPSInfo gpsInfo; gpsInfo.position = UnsignedCoordinate( GPSCoordinate() ); gpsInfo.altitude = -1; gpsInfo.groundSpeed = -1; gpsInfo.verticalSpeed = -1; gpsInfo.heading = -1; gpsInfo.horizontalAccuracy = -1; gpsInfo.verticalAccuracy = -1; QDateTime invalidTime; gpsInfo.timestamp = invalidTime; gpsInfo.position = UnsignedCoordinate( GPSCoordinate( latString.toDouble(), lonString.toDouble() ) ); gpsInfo.altitude = eleString.toDouble(); gpsInfo.timestamp = QDateTime::fromString( timeString, "yyyy-MM-ddTHH:mm:ss" ); m_gpsInfoBuffer.append(gpsInfo); } if (lineBuffer.contains("</trkseg>")) { RoutingLogic::GPSInfo gpsInfo; gpsInfo.position = UnsignedCoordinate( GPSCoordinate() ); gpsInfo.altitude = -1; gpsInfo.groundSpeed = -1; gpsInfo.verticalSpeed = -1; gpsInfo.heading = -1; gpsInfo.horizontalAccuracy = -1; gpsInfo.verticalAccuracy = -1; QDateTime invalidTime; gpsInfo.timestamp = invalidTime; m_gpsInfoBuffer.append(gpsInfo); } } m_logFile.close(); emit trackChanged(); return true; }
void ViProjectLoader::analyseTrack(int index) { if(index >= 0) { mSelectedObject = index; ViAudio::Type resources = mObjects[index]->availableResources(); mUi->typeLabel->hide(); mUi->multiTypeContainer->hide(); mUi->singleTypeContainer->hide(); mUi->targetCheckBox->hide(); mUi->corruptedCheckBox->hide(); mUi->correctedCheckBox->hide(); mUi->targetRadioButton->hide(); mUi->corruptedRadioButton->hide(); mUi->correctedRadioButton->hide(); if(mTypeMode == ViProjectLoader::MultipleTypes) { mUi->typeLabel->show(); mUi->multiTypeContainer->show(); if(resources & ViAudio::Target) mUi->targetCheckBox->show(); if(resources & ViAudio::Corrupted) mUi->corruptedCheckBox->show(); if(resources & ViAudio::Corrected) mUi->correctedCheckBox->show(); } else if(mTypeMode == ViProjectLoader::SingleType) { mUi->typeLabel->show(); mUi->singleTypeContainer->show(); bool selected = false; mUi->targetRadioButton->blockSignals(true); mUi->corruptedRadioButton->blockSignals(true); mUi->correctedRadioButton->blockSignals(true); if(resources & ViAudio::Corrected) { mUi->correctedRadioButton->show(); mUi->correctedRadioButton->setChecked(true); selected = true; } if(resources & ViAudio::Corrupted) { mUi->corruptedRadioButton->show(); if(!selected) mUi->corruptedRadioButton->setChecked(true); } if(resources & ViAudio::Target) { mUi->targetRadioButton->show(); if(!selected) mUi->targetRadioButton->setChecked(true); } mUi->targetRadioButton->blockSignals(false); mUi->corruptedRadioButton->blockSignals(false); mUi->correctedRadioButton->blockSignals(false); } emit trackChanged(); emit typesChanged(); if(mTypeMode == ViProjectLoader::NoTypes) emit changed(); } }