diff --git a/src/Library.cpp b/src/Library.cpp index b7191c78c..2e4356d9f 100644 --- a/src/Library.cpp +++ b/src/Library.cpp @@ -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; } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index ac628f294..400c4c7da 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -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(); diff --git a/src/ToolsDialog.cpp b/src/ToolsDialog.cpp index 77823e7c4..1dffc661a 100644 --- a/src/ToolsDialog.cpp +++ b/src/ToolsDialog.cpp @@ -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")); diff --git a/src/TrainTool.cpp b/src/TrainTool.cpp index 6e3515fe0..74c86ef34 100644 --- a/src/TrainTool.cpp +++ b/src/TrainTool.cpp @@ -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