Merge branch 'master' of github.com:GoldenCheetah/GoldenCheetah

This commit is contained in:
Mark Liversedge
2012-12-24 19:14:38 +00:00
4 changed files with 31 additions and 6 deletions

View File

@@ -120,7 +120,7 @@ Library::importFiles(MainWindow *mainWindow, QStringList files)
if (!videos.count() && !workouts.count()) {
QMessageBox::warning(NULL, tr("Import Videos and Workouts"),
"No valid videos or workouts were found to import");
"No supported videos or workouts were found to import");
return;
}

View File

@@ -805,7 +805,7 @@ MainWindow::MainWindow(const QDir &home) :
QMenu *optionsMenu = menuBar()->addMenu(tr("&Tools"));
optionsMenu->addAction(tr("&Options..."), this, SLOT(showOptions()));
optionsMenu->addAction(tr("Critical Power Calculator..."), this, SLOT(showTools()));
optionsMenu->addAction(tr("Critical Power Estimator..."), this, SLOT(showTools()));
optionsMenu->addAction(tr("Air Density (Rho) Estimator..."), this, SLOT(showRhoEstimator()));
optionsMenu->addSeparator();

View File

@@ -59,9 +59,11 @@ QHBoxLayout *setupMinsSecs(ToolsDialog *dialog,
ToolsDialog::ToolsDialog(QWidget *parent) : QDialog(parent)
{
setWindowTitle(tr("Critical Power Calculator"));
setWindowTitle(tr("Critical Power Estimator"));
setAttribute(Qt::WA_DeleteOnClose);
setFixedSize(300, 240);
QVBoxLayout *mainVBox = new QVBoxLayout(this);
mainVBox->addWidget(new QLabel(tr("Your best short effort (3-5 min):")));
@@ -71,18 +73,22 @@ ToolsDialog::ToolsDialog(QWidget *parent) : QDialog(parent)
mainVBox->addWidget(new QLabel(tr("Your best long effort (15-60 min):")));
mainVBox->addLayout(setupMinsSecs(this, longMinsSpinBox, longSecsSpinBox,
longWattsSpinBox, 60.0, 20.0));
mainVBox->addStretch();
QHBoxLayout *cpHBox = new QHBoxLayout;
cpHBox->addWidget(new QLabel(tr("Your critical power:")));
txtCP = new QLineEdit(this);
txtCP->setAlignment(Qt::AlignRight);
txtCP->setReadOnly(true);
cpHBox->addWidget(txtCP);
cpHBox->addWidget(txtCP, Qt::AlignLeft);
mainVBox->addLayout(cpHBox);
mainVBox->addStretch();
QHBoxLayout *buttonHBox = new QHBoxLayout;
btnCalculate = new QPushButton(this);
btnCalculate->setText(tr("Calculate CP"));
btnCalculate->setText(tr("Estimate CP"));
buttonHBox->addStretch();
buttonHBox->addWidget(btnCalculate);
btnOK = new QPushButton(this);
btnOK->setText(tr("Done"));

View File

@@ -324,10 +324,10 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
#if defined Q_OS_MAC || defined GC_HAVE_VLC
connect(mediaTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
this, SLOT(mediaTreeWidgetSelectionChanged()));
connect(main, SIGNAL(selectMedia(QString)), this, SLOT(selectVideo(QString)));
#endif
connect(main, SIGNAL(configChanged()), this, SLOT(configChanged()));
connect(main, SIGNAL(selectWorkout(QString)), this, SLOT(selectWorkout(QString)));
connect(main, SIGNAL(selectMedia(QString)), this, SLOT(selectVideo(QString)));
connect(trainDB, SIGNAL(dataChanged()), this, SLOT(refresh()));
connect(workoutTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(workoutTreeWidgetSelectionChanged()));
@@ -384,10 +384,29 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
void
TrainTool::refresh()
{
int row;
#if defined Q_OS_MAC || defined GC_HAVE_VLC
// remember selection
row = mediaTree->currentIndex().row();
QString videoPath = mediaTree->model()->data(mediaTree->model()->index(row,0)).toString();
// refresh data
videoModel->select();
while (videoModel->canFetchMore(QModelIndex())) videoModel->fetchMore(QModelIndex());
// restore selection
selectVideo(videoPath);
#endif
row = workoutTree->currentIndex().row();
QString workoutPath = workoutTree->model()->data(workoutTree->model()->index(row,0)).toString();
workoutModel->select();
while (workoutModel->canFetchMore(QModelIndex())) workoutModel->fetchMore(QModelIndex());
// restore selection
selectWorkout(workoutPath);
}
void