void BrowseTableModel::removeTrack(const QModelIndex& index) { if (!index.isValid()) { return; } QStringList trackLocations; trackLocations.append(getTrackLocation(index)); removeTracks(trackLocations); }
void BrowseTableModel::removeTracks(const QModelIndexList& indices) { QStringList trackLocations; foreach (QModelIndex index, indices) { if (!index.isValid()) { continue; } trackLocations.append(getTrackLocation(index)); } removeTracks(trackLocations); }
GpxTreeWidget::GpxTreeWidget(GpxFile *gpx) : _gpx(gpx) { // _gpxTree = new QTreeWidget; QStringList columns = QStringList() << tr("Track #") << tr("Name") << tr("Length\n(miles)") << tr("# Pts") << tr("Duration") << tr("Max Speed\n(mph)") << tr("Avg. Speed\n(mph)"); setColumnCount(columns.size()); setHeaderLabels(columns); for (int i=0; i<6; ++i) { header()->setResizeMode(i, QHeaderView::Stretch); } setSelectionMode(QAbstractItemView::ExtendedSelection); mergeAction = new QAction(this); mergeAction->setText(tr("Merge")); mergeAction->setToolTip(tr("Merge the selected tracks into one.")); mergeAction->setDisabled(true); removeAction = new QAction(this); removeAction->setText(tr("Remove")); removeAction->setToolTip(tr("Remove the selected tracks.")); removeAction->setDisabled(true); splitAction = new QAction(this); splitAction->setText(tr("Split")); splitAction->setToolTip(tr("Split selected track into seperate file.")); splitAction->setDisabled(true); multiContextMenu = new QMenu(tr("Multi-selection Track Menu")); multiContextMenu->addAction(mergeAction); multiContextMenu->addAction(removeAction); singleContextMenu = new QMenu(tr("Single selection Track Menu")); singleContextMenu->addAction(splitAction); singleContextMenu->addAction(removeAction); connect(mergeAction, SIGNAL(triggered()), this, SLOT(mergeTracks())); connect(removeAction, SIGNAL(triggered()), this, SLOT(removeTracks())); connect(splitAction, SIGNAL(triggered()), this, SLOT(splitTrack())); if (_gpx) { buildTree(); } }
bool RDLog::remove(RDStation *station,RDUser *user,RDConfig *config) const { QString sql; RDSqlQuery *q; QString name=log_name; name.replace(" ","_"); if(removeTracks(station,user,config)<0) { return false; } sql=QString().sprintf("drop table `%s_LOG`",(const char *)name); q=new RDSqlQuery(sql); delete q; sql=QString().sprintf("delete from LOGS where (NAME=\"%s\" && TYPE=0)", (const char *)RDEscapeString(log_name)); q=new RDSqlQuery(sql); delete q; return true; }