Revert "CP/W' Solver Part 1 of 3"

.. line endings inadvertently set to MSDOS, causes all change history
   in the file to be lost, so reverting and will push again.
This commit is contained in:
Mark Liversedge
2016-03-11 15:53:12 +00:00
parent 3d741aea3f
commit 9fb184c748
5 changed files with 2653 additions and 2994 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,301 +1,300 @@
/*
* Copyright (c) 2006 Sean C. Rhea (srhea@srhea.net)
* Copyright (c) 2012 Mark Liversedge (liversedge@gmail.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _GC_MainWindow_h
#define _GC_MainWindow_h 1
#include "GoldenCheetah.h"
#include <QDir>
#include <QSqlDatabase>
#include <QtGui>
#include <QMainWindow>
#include <QStackedWidget>
#include "RideItem.h"
#include "TimeUtils.h"
#include "DragBar.h"
#ifdef GC_HAS_CLOUD_DB
#include "CloudDBChart.h"
#endif
#ifdef Q_OS_MAC
// What versions are supported by this SDK?
#include <AvailabilityMacros.h>
#endif
class QTFullScreen;
class QtMacSegmentedButton;
class QtMacButton;
class GcToolBar;
class GcScopeBar;
class Library;
class QtSegmentControl;
class SaveSingleDialogWidget;
class ChooseCyclistDialog;
class SearchFilterBox;
class MainWindow;
class Athlete;
class Context;
class Tab;
extern QList<MainWindow *> mainwindows; // keep track of all the MainWindows we have open
extern QDesktopWidget *desktop; // how many screens / res etc
extern QString gcroot; // root directory for gc
class MainWindow : public QMainWindow
{
Q_OBJECT
G_OBJECT
public:
MainWindow(const QDir &home);
~MainWindow(); // temp to zap db - will move to tab //
void byebye() { close(); } // go bye bye for a restart
bool init; // if constructor has completed set to true
// when loading athlete
QLabel *progress;
int loading;
protected:
// used by ChooseCyclistDialog to see which athletes
// have already been opened
friend class ::ChooseCyclistDialog;
QMap<QString,Tab*> tabs;
virtual void resizeEvent(QResizeEvent*);
virtual void moveEvent(QMoveEvent*);
virtual void closeEvent(QCloseEvent*);
virtual void dragEnterEvent(QDragEnterEvent *);
virtual void dropEvent(QDropEvent *);
// working with splash screens
QWidget *splash;
void setSplash(bool first=false);
void clearSplash();
public slots:
bool eventFilter(QObject*,QEvent*);
// GUI
void toggleFullScreen();
void aboutDialog();
void helpWindow();
void helpView();
void logBug();
void support();
void actionClicked(int);
// search box gets and loses focus - make big/small
void searchFocusIn();
void searchFocusOut();
// open and closing windows and tabs
void closeAll(); // close all windows and tabs
void setOpenWindowMenu(); // set the Open Window menu
void newCyclistWindow(); // create a new Cyclist
void openWindow(QString name);
void closeWindow();
void setOpenTabMenu(); // set the Open Tab menu
void newCyclistTab(); // create a new Cyclist
void openTab(QString name);
void closeTabClicked(int index); // user clicked to close tab
bool closeTab(); // close current, might not if the user
// changes mind if there are unsaved changes.
void removeTab(Tab*); // remove without question
void switchTab(int index); // for switching between one tab and another
// Athlete Backup
void setBackupAthleteMenu();
void backupAthlete(QString name);
// Search / Filter
void setFilter(QStringList);
void clearFilter();
void selectHome();
void selectDiary();
void selectAnalysis();
void selectTrain();
void selectInterval();
void setChartMenu();
void setSubChartMenu();
void setChartMenu(QMenu *);
void addChart(QAction*);
void showOptions();
void toggleSidebar();
void showSidebar(bool want);
void showToolbar(bool want);
void showTabbar(bool want);
void resetWindowLayout();
void toggleStyle();
void setToolButtons(); // set toolbar buttons to match tabview
void setStyleFromSegment(int); // special case for linux/win qtsegmentcontrol toggline
void toggleLowbar();
void showLowbar(bool want);
// Analysis View
void showEstimateCP();
void showSolveCP();
void showRhoEstimator();
void showVDOTCalculator();
// Training View
void addDevice();
void downloadErgDB();
void manageLibrary();
void showWorkoutWizard();
void importWorkout();
// Diary View
void refreshCalendar();
#ifdef GC_HAVE_ICAL
void uploadCalendar(); // upload ride to calendar
#endif
// Measures View
void downloadMeasures();
// Activity Collection
void addIntervals(); // pass thru to tab
bool saveRideSingleDialog(Context *, RideItem *);
void saveSilent(Context *, RideItem *);
void downloadRide();
void manualRide();
void exportRide();
void exportBatch();
void generateHeatMap();
void exportMetrics();
#ifdef GC_HAVE_KQOAUTH
void tweetRide();
#endif
void share();
void manualProcess(QString);
#ifdef GC_HAVE_SOAP
void uploadTP();
void downloadTP();
#endif
#if QT_VERSION > 0x050000
void uploadDropbox();
void syncDropbox();
void uploadGoogleDrive();
void syncGoogleDrive();
#endif
void uploadLocalFileStore();
void syncLocalFileStore();
void importFile();
void splitRide();
void mergeRide();
void deleteRide();
void saveRide(); // save current ride menu item
void revertRide();
bool saveRideExitDialog(Context *); // save dirty rides on exit dialog
// autoload rides from athlete specific directory (preferences)
void ridesAutoImport();
#ifdef GC_HAS_CLOUD_DB
// CloudDB actions
void cloudDBuserEditChart();
void cloudDBcuratorEditChart();
void cloudDBshowStatus();
#endif
// save and restore state to context
void saveGCState(Context *);
void restoreGCState(Context *);
void configChanged(qint32);
private:
GcScopeBar *scopebar;
Tab *currentTab;
QList<Tab*> tabList;
#ifndef Q_OS_MAC
QTFullScreen *fullScreen;
#endif
QPropertyAnimation *anim;
SearchFilterBox *searchBox;
#ifdef Q_OS_MAC
// Mac Native Support
QtMacButton *sidebar, *lowbar;
QtMacSegmentedButton *styleSelector;
QToolBar *head;
#else
// Not on Mac so use other types
QPushButton *sidebar, *lowbar;
QtSegmentControl *styleSelector;
GcToolBar *head;
// the icons
QIcon sidebarIcon, lowbarIcon, tabbedIcon, tiledIcon;
#endif
// tab bar (that supports swtitching on drag and drop)
DragBar *tabbar;
QStackedWidget *tabStack;
// window and tab menu
QMenu *openWindowMenu, *openTabMenu;
QSignalMapper *windowMapper, *tabMapper;
// backup
QMenu *backupAthleteMenu;
QSignalMapper *backupMapper;
// chart menus
QMenu *chartMenu;
QMenu *subChartMenu;
// Toolbar state checkables in View menu / context
QAction *styleAction;
QAction *showhideSidebar;
QAction *showhideLowbar;
#if (!defined Q_OS_MAC) || (QT_VERSION >= 0x50201) // not on a Mac
QAction *showhideToolbar;
#endif
QAction *showhideTabbar;
QAction *tweetAction;
QAction *shareAction;
// Miscellany
QSignalMapper *toolMapper;
#if (defined Q_OS_MAC) && (QT_VERSION >= 0x50201)
QWidget *blackline;
#endif
};
#endif // _GC_MainWindow_h
/*
* Copyright (c) 2006 Sean C. Rhea (srhea@srhea.net)
* Copyright (c) 2012 Mark Liversedge (liversedge@gmail.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _GC_MainWindow_h
#define _GC_MainWindow_h 1
#include "GoldenCheetah.h"
#include <QDir>
#include <QSqlDatabase>
#include <QtGui>
#include <QMainWindow>
#include <QStackedWidget>
#include "RideItem.h"
#include "TimeUtils.h"
#include "DragBar.h"
#ifdef GC_HAS_CLOUD_DB
#include "CloudDBChart.h"
#endif
#ifdef Q_OS_MAC
// What versions are supported by this SDK?
#include <AvailabilityMacros.h>
#endif
class QTFullScreen;
class QtMacSegmentedButton;
class QtMacButton;
class GcToolBar;
class GcScopeBar;
class Library;
class QtSegmentControl;
class SaveSingleDialogWidget;
class ChooseCyclistDialog;
class SearchFilterBox;
class MainWindow;
class Athlete;
class Context;
class Tab;
extern QList<MainWindow *> mainwindows; // keep track of all the MainWindows we have open
extern QDesktopWidget *desktop; // how many screens / res etc
extern QString gcroot; // root directory for gc
class MainWindow : public QMainWindow
{
Q_OBJECT
G_OBJECT
public:
MainWindow(const QDir &home);
~MainWindow(); // temp to zap db - will move to tab //
void byebye() { close(); } // go bye bye for a restart
bool init; // if constructor has completed set to true
// when loading athlete
QLabel *progress;
int loading;
protected:
// used by ChooseCyclistDialog to see which athletes
// have already been opened
friend class ::ChooseCyclistDialog;
QMap<QString,Tab*> tabs;
virtual void resizeEvent(QResizeEvent*);
virtual void moveEvent(QMoveEvent*);
virtual void closeEvent(QCloseEvent*);
virtual void dragEnterEvent(QDragEnterEvent *);
virtual void dropEvent(QDropEvent *);
// working with splash screens
QWidget *splash;
void setSplash(bool first=false);
void clearSplash();
public slots:
bool eventFilter(QObject*,QEvent*);
// GUI
void toggleFullScreen();
void aboutDialog();
void helpWindow();
void helpView();
void logBug();
void support();
void actionClicked(int);
// search box gets and loses focus - make big/small
void searchFocusIn();
void searchFocusOut();
// open and closing windows and tabs
void closeAll(); // close all windows and tabs
void setOpenWindowMenu(); // set the Open Window menu
void newCyclistWindow(); // create a new Cyclist
void openWindow(QString name);
void closeWindow();
void setOpenTabMenu(); // set the Open Tab menu
void newCyclistTab(); // create a new Cyclist
void openTab(QString name);
void closeTabClicked(int index); // user clicked to close tab
bool closeTab(); // close current, might not if the user
// changes mind if there are unsaved changes.
void removeTab(Tab*); // remove without question
void switchTab(int index); // for switching between one tab and another
// Athlete Backup
void setBackupAthleteMenu();
void backupAthlete(QString name);
// Search / Filter
void setFilter(QStringList);
void clearFilter();
void selectHome();
void selectDiary();
void selectAnalysis();
void selectTrain();
void selectInterval();
void setChartMenu();
void setSubChartMenu();
void setChartMenu(QMenu *);
void addChart(QAction*);
void showOptions();
void toggleSidebar();
void showSidebar(bool want);
void showToolbar(bool want);
void showTabbar(bool want);
void resetWindowLayout();
void toggleStyle();
void setToolButtons(); // set toolbar buttons to match tabview
void setStyleFromSegment(int); // special case for linux/win qtsegmentcontrol toggline
void toggleLowbar();
void showLowbar(bool want);
// Analysis View
void showTools();
void showRhoEstimator();
void showVDOTCalculator();
// Training View
void addDevice();
void downloadErgDB();
void manageLibrary();
void showWorkoutWizard();
void importWorkout();
// Diary View
void refreshCalendar();
#ifdef GC_HAVE_ICAL
void uploadCalendar(); // upload ride to calendar
#endif
// Measures View
void downloadMeasures();
// Activity Collection
void addIntervals(); // pass thru to tab
bool saveRideSingleDialog(Context *, RideItem *);
void saveSilent(Context *, RideItem *);
void downloadRide();
void manualRide();
void exportRide();
void exportBatch();
void generateHeatMap();
void exportMetrics();
#ifdef GC_HAVE_KQOAUTH
void tweetRide();
#endif
void share();
void manualProcess(QString);
#ifdef GC_HAVE_SOAP
void uploadTP();
void downloadTP();
#endif
#if QT_VERSION > 0x050000
void uploadDropbox();
void syncDropbox();
void uploadGoogleDrive();
void syncGoogleDrive();
#endif
void uploadLocalFileStore();
void syncLocalFileStore();
void importFile();
void splitRide();
void mergeRide();
void deleteRide();
void saveRide(); // save current ride menu item
void revertRide();
bool saveRideExitDialog(Context *); // save dirty rides on exit dialog
// autoload rides from athlete specific directory (preferences)
void ridesAutoImport();
#ifdef GC_HAS_CLOUD_DB
// CloudDB actions
void cloudDBuserEditChart();
void cloudDBcuratorEditChart();
void cloudDBshowStatus();
#endif
// save and restore state to context
void saveGCState(Context *);
void restoreGCState(Context *);
void configChanged(qint32);
private:
GcScopeBar *scopebar;
Tab *currentTab;
QList<Tab*> tabList;
#ifndef Q_OS_MAC
QTFullScreen *fullScreen;
#endif
QPropertyAnimation *anim;
SearchFilterBox *searchBox;
#ifdef Q_OS_MAC
// Mac Native Support
QtMacButton *sidebar, *lowbar;
QtMacSegmentedButton *styleSelector;
QToolBar *head;
#else
// Not on Mac so use other types
QPushButton *sidebar, *lowbar;
QtSegmentControl *styleSelector;
GcToolBar *head;
// the icons
QIcon sidebarIcon, lowbarIcon, tabbedIcon, tiledIcon;
#endif
// tab bar (that supports swtitching on drag and drop)
DragBar *tabbar;
QStackedWidget *tabStack;
// window and tab menu
QMenu *openWindowMenu, *openTabMenu;
QSignalMapper *windowMapper, *tabMapper;
// backup
QMenu *backupAthleteMenu;
QSignalMapper *backupMapper;
// chart menus
QMenu *chartMenu;
QMenu *subChartMenu;
// Toolbar state checkables in View menu / context
QAction *styleAction;
QAction *showhideSidebar;
QAction *showhideLowbar;
#if (!defined Q_OS_MAC) || (QT_VERSION >= 0x50201) // not on a Mac
QAction *showhideToolbar;
#endif
QAction *showhideTabbar;
QAction *tweetAction;
QAction *shareAction;
// Miscellany
QSignalMapper *toolMapper;
#if (defined Q_OS_MAC) && (QT_VERSION >= 0x50201)
QWidget *blackline;
#endif
};
#endif // _GC_MainWindow_h

View File

@@ -1,265 +0,0 @@
/*
* Copyright (c) Mark Liversedge (liversedge@gmail.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "SolveCPDialog.h"
#include "HelpWhatsThis.h"
#include "Settings.h"
#include "Context.h"
#include "Athlete.h"
#include "RideCache.h"
#include "RideItem.h"
#include <QFont>
#include <QFontMetrics>
SolveCPDialog::SolveCPDialog(QWidget *parent, Context *context) : QDialog(parent), context(context)
{
setWindowTitle(tr("Critical Power Solver"));
setAttribute(Qt::WA_DeleteOnClose);
setMinimumSize(QSize(730, 370));
//
// Widget creation
//
QFont bolden;
bolden.setWeight(QFont::Bold);
dataLabel = new QLabel(tr("Activity Selection"), this);
dataLabel->setAlignment(Qt::AlignHCenter);
dataLabel->setFont(bolden);
selectCheckBox = new QCheckBox(tr("Select/Deselect All"), this);
// list all the activities that contain exhaustion points
dataTable = new QTreeWidget(this);
progressLabel = new QLabel(tr("Progress"), this);
progressLabel->setAlignment(Qt::AlignHCenter);
progressLabel->setFont(bolden);
// headings
itLabel = new QLabel(tr("Iteration"));
cpLabel = new QLabel(tr("CP"));
wLabel = new QLabel(tr("W'"));
tLabel = new QLabel(tr("tau"));
sumLabel = new QLabel("ΣW'bal²");
currentLabel = new QLabel(tr("Current"));
bestLabel = new QLabel(tr("Best"));
// current value
citLabel = new QLabel(tr(""));
ccpLabel = new QLabel(tr(""));
cwLabel = new QLabel(tr(""));
ctLabel = new QLabel(tr(""));
csumLabel = new QLabel("");
// best so far
bitLabel = new QLabel(tr(""));
bcpLabel = new QLabel(tr(""));
bwLabel = new QLabel(tr(""));
btLabel = new QLabel(tr(""));
bsumLabel = new QLabel("");
// fix the label heights and alignment
QFont def;
QFontMetrics fm(def);
currentLabel->setFixedHeight(fm.height());
bestLabel->setFixedHeight(fm.height());
itLabel->setFixedHeight(fm.height());
cpLabel->setFixedHeight(fm.height());
wLabel->setFixedHeight(fm.height());
tLabel->setFixedHeight(fm.height());
sumLabel->setFixedHeight(fm.height());
citLabel->setFixedHeight(fm.height());
ccpLabel->setFixedHeight(fm.height());
cwLabel->setFixedHeight(fm.height());
ctLabel->setFixedHeight(fm.height());
csumLabel->setFixedHeight(fm.height());
bitLabel->setFixedHeight(fm.height());
bcpLabel->setFixedHeight(fm.height());
bwLabel->setFixedHeight(fm.height());
btLabel->setFixedHeight(fm.height());
bsumLabel->setFixedHeight(fm.height());
itLabel->setAlignment(Qt::AlignHCenter);
cpLabel->setAlignment(Qt::AlignHCenter);
wLabel->setAlignment(Qt::AlignHCenter);
tLabel->setAlignment(Qt::AlignHCenter);
sumLabel->setAlignment(Qt::AlignHCenter);
citLabel->setAlignment(Qt::AlignHCenter);
ccpLabel->setAlignment(Qt::AlignHCenter);
cwLabel->setAlignment(Qt::AlignHCenter);
ctLabel->setAlignment(Qt::AlignHCenter);
csumLabel->setAlignment(Qt::AlignHCenter);
bitLabel->setAlignment(Qt::AlignHCenter);
bcpLabel->setAlignment(Qt::AlignHCenter);
bwLabel->setAlignment(Qt::AlignHCenter);
btLabel->setAlignment(Qt::AlignHCenter);
bsumLabel->setAlignment(Qt::AlignHCenter);
citLabel->setText("-");
ccpLabel->setText("-");
cwLabel->setText("-");
ctLabel->setText("-");
csumLabel->setText("-");
bitLabel->setText("-");
bcpLabel->setText("-");
bwLabel->setText("-");
btLabel->setText("-");
bsumLabel->setText("-");
// visualise
solverDisplay = new QWidget(this);
solverDisplay->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
solverDisplay->setBackgroundRole(QPalette::Light);
solve = new QPushButton(tr("Solve"));
close = new QPushButton(tr("Close"));
//
// Layout the widget
//
// main widget with buttons at the bottom
QVBoxLayout *fullLayout = new QVBoxLayout(this);
QHBoxLayout *mainLayout = new QHBoxLayout;
QHBoxLayout *buttonLayout = new QHBoxLayout;
fullLayout->addLayout(mainLayout);
fullLayout->addLayout(buttonLayout);
// data on left, progress on the right
QVBoxLayout *dataLayout = new QVBoxLayout;
QVBoxLayout *progressLayout = new QVBoxLayout;
mainLayout->addLayout(dataLayout);
mainLayout->addLayout(progressLayout);
mainLayout->setStretchFactor(dataLayout,10);
mainLayout->setStretchFactor(progressLayout,15);
// data layout on left
dataLayout->addWidget(dataLabel);
dataLayout->addWidget(selectCheckBox);
dataLayout->addWidget(dataTable);
// progress layout, labels then progress viz
progressLayout->addWidget(progressLabel);
QGridLayout *gridLayout = new QGridLayout;
progressLayout->addLayout(gridLayout);
progressLayout->addWidget(solverDisplay);
// all the labels...
gridLayout->addWidget(itLabel, 0, 1);
gridLayout->addWidget(cpLabel, 0, 2);
gridLayout->addWidget(wLabel, 0, 3);
gridLayout->addWidget(tLabel, 0, 4);
gridLayout->addWidget(sumLabel, 0, 5);
gridLayout->addWidget(currentLabel, 1, 0);
gridLayout->addWidget(citLabel, 1, 1);
gridLayout->addWidget(ccpLabel, 1, 2);
gridLayout->addWidget(cwLabel, 1, 3);
gridLayout->addWidget(ctLabel, 1, 4);
gridLayout->addWidget(csumLabel, 1, 5);
gridLayout->addWidget(bestLabel, 2, 0);
gridLayout->addWidget(bitLabel, 2, 1);
gridLayout->addWidget(bcpLabel, 2, 2);
gridLayout->addWidget(bwLabel, 2, 3);
gridLayout->addWidget(btLabel, 2, 4);
gridLayout->addWidget(bsumLabel, 2, 5);
// buttons
buttonLayout->addStretch();
buttonLayout->addWidget(solve);
buttonLayout->addWidget(close);
//
// Connect the dots
//
connect(selectCheckBox, SIGNAL(stateChanged(int)), this, SLOT(selectAll()));
//
// Prepare
//
QStringList headers;
headers << " " << "Date" << "Min W'bal" << "Solved";
dataTable->setColumnCount(4);
dataTable->setHeaderLabels(headers);
dataTable->headerItem()->setTextAlignment(0, Qt::AlignLeft);
dataTable->headerItem()->setTextAlignment(1, Qt::AlignHCenter);
dataTable->headerItem()->setTextAlignment(2, Qt::AlignHCenter);
dataTable->headerItem()->setTextAlignment(3, Qt::AlignHCenter);
// get a list
foreach(RideItem *item, context->athlete->rideCache->rides()) {
int te = item->getForSymbol("ride_te");
if (te) items<<item;
}
// most recent first !
for (int k=items.count()-1; k>=0; k--) {
RideItem *item = items[k];
// we have one
QTreeWidgetItem *t = new QTreeWidgetItem(dataTable);
t->setText(1, item->dateTime.date().toString("dd MMM yy"));
t->setText(2, item->getStringForSymbol("skiba_wprime_low"));
t->setText(3, "-");
t->setTextAlignment(0, Qt::AlignLeft);
t->setTextAlignment(1, Qt::AlignHCenter);
t->setTextAlignment(2, Qt::AlignHCenter);
t->setTextAlignment(3, Qt::AlignHCenter);
// remember which rideitem this is for
t->setData(0, Qt::UserRole, qVariantFromValue(static_cast<void*>(item)));
// checkbox
QCheckBox *check = new QCheckBox(this);
dataTable->setItemWidget(t, 0, check);
}
dataTable->setColumnWidth(0,50);
dataTable->resizeColumnToContents(1);
dataTable->resizeColumnToContents(2);
dataTable->resizeColumnToContents(3);
#ifdef Q_OS_MAC
dataTable->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
}
void
SolveCPDialog::selectAll()
{
for (int i=0; i<dataTable->invisibleRootItem()->childCount(); i++) {
QTreeWidgetItem *it = const_cast<QTreeWidgetItem*>(dataTable->invisibleRootItem()->child(i));
QCheckBox *check = static_cast<QCheckBox*>(dataTable->itemWidget(it,0));
check->setChecked(selectCheckBox->isChecked());
}
}
void
SolveCPDialog::solveClicked()
{
}
void
SolveCPDialog::closeClicked()
{
}

View File

@@ -1,67 +0,0 @@
/*
* Copyright (c) 2016 Mark Liversedge (liversedge@gmail.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GoldenCheetah.h"
#include <QDialog>
#include <QLabel>
#include <QCheckBox>
#include <QWidget>
#include <QTreeWidget>
class Context;
class SolveCPDialog : public QDialog
{
Q_OBJECT
G_OBJECT
public:
SolveCPDialog(QWidget *parent, Context *);
private:
// General labels
QLabel *dataLabel, *progressLabel, *bestLabel, *currentLabel;
// data side of the dialog
QCheckBox *selectCheckBox;
QTreeWidget *dataTable;
// progress update side
// headings
QLabel *itLabel, *cpLabel, *wLabel, *tLabel, *sumLabel;
// current
QLabel *citLabel, *ccpLabel, *cwLabel, *ctLabel, *csumLabel;
// best so far
QLabel *bitLabel, *bcpLabel, *bwLabel, *btLabel, *bsumLabel;
// visualise
QWidget *solverDisplay; // need to create a custom widget for this
QPushButton *solve, *close;
Context *context;
QList<RideItem*> items;
private slots:
void selectAll();
void solveClicked();
void closeClicked();
};

View File

@@ -593,7 +593,7 @@ HEADERS += Gui/AboutDialog.h Gui/AddIntervalDialog.h Gui/AnalysisSidebar.h Gui/C
Gui/DragBar.h Gui/EstimateCPDialog.h Gui/GcCrashDialog.h Gui/GcScopeBar.h Gui/GcSideBarItem.h Gui/GcToolBar.h Gui/GcWindowLayout.h \
Gui/GcWindowRegistry.h Gui/GenerateHeatMapDialog.h Gui/GProgressDialog.h Gui/HelpWhatsThis.h Gui/HelpWindow.h \
Gui/IntervalTreeView.h Gui/LTMSidebar.h Gui/MainWindow.h Gui/NewCyclistDialog.h Gui/Pages.h Gui/RideNavigator.h Gui/RideNavigatorProxy.h \
Gui/SaveDialogs.h Gui/SearchBox.h Gui/SearchFilterBox.h Gui/SolveCPDialog.h Gui/Tab.h Gui/TabView.h Gui/ToolsRhoEstimator.h \
Gui/SaveDialogs.h Gui/SearchBox.h Gui/SearchFilterBox.h Gui/Tab.h Gui/TabView.h Gui/ToolsRhoEstimator.h \
Gui/Views.h Gui/BatchExportDialog.h Gui/DownloadRideDialog.h Gui/ManualRideDialog.h Gui/BestIntervalDialog.h \
Gui/MergeActivityWizard.h Gui/RideImportWizard.h Gui/SplitActivityWizard.h
@@ -669,7 +669,7 @@ SOURCES += Gui/AboutDialog.cpp Gui/AddIntervalDialog.cpp Gui/AnalysisSidebar.cpp
Gui/DragBar.cpp Gui/EstimateCPDialog.cpp Gui/GcCrashDialog.cpp Gui/GcScopeBar.cpp Gui/GcSideBarItem.cpp Gui/GcToolBar.cpp Gui/GcWindowLayout.cpp \
Gui/GcWindowRegistry.cpp Gui/GenerateHeatMapDialog.cpp Gui/GProgressDialog.cpp Gui/HelpWhatsThis.cpp Gui/HelpWindow.cpp \
Gui/IntervalTreeView.cpp Gui/LTMSidebar.cpp Gui/MainWindow.cpp Gui/NewCyclistDialog.cpp Gui/Pages.cpp Gui/RideNavigator.cpp Gui/SaveDialogs.cpp \
Gui/SearchBox.cpp Gui/SearchFilterBox.cpp Gui/SolveCPDialog.cpp Gui/Tab.cpp Gui/TabView.cpp Gui/ToolsRhoEstimator.cpp Gui/Views.cpp \
Gui/SearchBox.cpp Gui/SearchFilterBox.cpp Gui/Tab.cpp Gui/TabView.cpp Gui/ToolsRhoEstimator.cpp Gui/Views.cpp \
Gui/BatchExportDialog.cpp Gui/DownloadRideDialog.cpp Gui/ManualRideDialog.cpp Gui/BestIntervalDialog.cpp Gui/EditUserMetricDialog.cpp \
Gui/MergeActivityWizard.cpp Gui/RideImportWizard.cpp Gui/SplitActivityWizard.cpp