mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 08:08:42 +00:00
from Justin: more .pro file patches for Windows, plus ToolsDialog
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <qwt_data.h>
|
||||
|
||||
#include "DatePickerDialog.h"
|
||||
#include "ToolsDialog.h"
|
||||
|
||||
#define FOLDER_TYPE 0
|
||||
#define RIDE_TYPE 1
|
||||
@@ -377,9 +378,12 @@ MainWindow::MainWindow(const QDir &home) :
|
||||
SLOT (importTCX()));
|
||||
rideMenu->addAction(tr("Find &best intervals..."), this,
|
||||
SLOT(findBestIntervals()), tr ("Ctrl+B"));
|
||||
QMenu *optionsMenu = menuBar()->addMenu(tr("&Options"));
|
||||
QMenu *optionsMenu = menuBar()->addMenu(tr("&Tools"));
|
||||
optionsMenu->addAction(tr("&Options..."), this,
|
||||
SLOT(showOptions()), tr("Ctrl+O"));
|
||||
optionsMenu->addAction(tr("&Tools..."), this,
|
||||
SLOT(showTools()), tr("Ctrl+T"));
|
||||
|
||||
|
||||
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||
helpMenu->addAction(tr("&About GoldenCheetah"), this, SLOT(aboutDialog()));
|
||||
@@ -1069,3 +1073,10 @@ MainWindow::notesChanged()
|
||||
currentNotesChanged = true;
|
||||
}
|
||||
|
||||
void MainWindow::showTools()
|
||||
{
|
||||
ToolsDialog *td = new ToolsDialog();
|
||||
td->exec();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ class MainWindow : public QMainWindow
|
||||
void notesChanged();
|
||||
void saveNotes();
|
||||
void showOptions();
|
||||
void showTools();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
98
src/ToolsDialog.cpp
Normal file
98
src/ToolsDialog.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Justin F. Knotzke (jknotzke@shampoo.ca)
|
||||
*
|
||||
* 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 "ToolsDialog.h"
|
||||
#include <QtGui>
|
||||
|
||||
void ToolsDialog::setupUi(QDialog *ToolsDialog)
|
||||
{
|
||||
if (ToolsDialog->objectName().isEmpty())
|
||||
ToolsDialog->setObjectName(QString::fromUtf8("ToolsDialog"));
|
||||
ToolsDialog->setWindowModality(Qt::WindowModal);
|
||||
ToolsDialog->setAcceptDrops(false);
|
||||
ToolsDialog->setModal(true);
|
||||
|
||||
QGridLayout *mainGrid = new QGridLayout(this); // a 2 x n grid
|
||||
lblBest3Min = new QLabel("Your Best 3 Minutes:", this);
|
||||
lblBest3Min->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||
txtBest3Min = new QLineEdit(this);
|
||||
txtBest3Min->setInputMask("999");
|
||||
lblBest20Min = new QLabel("Your Best 20 Minutes:", this);
|
||||
lblBest20Min->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||
txtBest20Min = new QLineEdit(this);
|
||||
txtBest20Min->setInputMask("999");
|
||||
lblCP = new QLabel(this);
|
||||
lblCP->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||
lblCP->setText(QString("Critical Power:"));
|
||||
txtCP = new QLineEdit(this);
|
||||
txtCP->setEnabled(false);
|
||||
|
||||
btnOK = new QPushButton(this);
|
||||
btnCalculate = new QPushButton(this);
|
||||
mainGrid->addWidget(lblBest3Min, 0, 0);
|
||||
mainGrid->addWidget(lblBest3Min, 0, 0);
|
||||
mainGrid->addWidget(txtBest3Min, 0, 1);
|
||||
|
||||
mainGrid->addWidget(lblBest20Min, 1, 0);
|
||||
mainGrid->addWidget(txtBest20Min, 1, 1);
|
||||
|
||||
mainGrid->addWidget(lblCP, 2, 0);
|
||||
mainGrid->addWidget(txtCP, 2, 1);
|
||||
|
||||
mainGrid->addWidget(btnCalculate, 3, 0);
|
||||
mainGrid->addWidget(btnOK, 3, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
ToolsDialog->setWindowTitle(
|
||||
QApplication::translate("ToolsDialog", "Critical Power Calculator", 0,
|
||||
QApplication::UnicodeUTF8));
|
||||
|
||||
btnOK->setText(
|
||||
QApplication::translate("ToolsDialog", "OK", 0,
|
||||
QApplication::UnicodeUTF8));
|
||||
btnCalculate->setText(
|
||||
QApplication::translate("ToolsDialog", "Calculate", 0,
|
||||
QApplication::UnicodeUTF8));
|
||||
|
||||
connect(btnOK, SIGNAL(clicked()), this, SLOT(on_btnOK_clicked()));
|
||||
connect(btnCalculate, SIGNAL(clicked()), this, SLOT(on_btnCalculate_clicked()));
|
||||
|
||||
Q_UNUSED(ToolsDialog);
|
||||
}
|
||||
|
||||
ToolsDialog::ToolsDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
void ToolsDialog::on_btnOK_clicked()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
|
||||
void ToolsDialog::on_btnCalculate_clicked()
|
||||
{
|
||||
int CP = (txtBest20Min->text().toInt() * 20 * 60 - (txtBest3Min->text().toInt() * 3 * 60)) / (20 * 60 - 3 * 60);
|
||||
QString strCP;
|
||||
txtCP->setText(strCP.setNum(CP));
|
||||
|
||||
}
|
||||
|
||||
43
src/ToolsDialog.h
Normal file
43
src/ToolsDialog.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Justin F. Knotzke (jknotzke@shampoo.ca)
|
||||
*
|
||||
* 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 <QDateTime>
|
||||
#include <QtGui>
|
||||
|
||||
class ToolsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ToolsDialog(QWidget *parent = 0);
|
||||
QLabel *lblBest3Min;
|
||||
QLineEdit *txtBest3Min;
|
||||
QHBoxLayout *hboxLayout1;
|
||||
QLabel *lblBest20Min;
|
||||
QPushButton *btnCalculate;
|
||||
QLineEdit *txtBest20Min;
|
||||
QPushButton *btnOK;
|
||||
QLabel *lblCP;
|
||||
QLineEdit *txtCP;
|
||||
void setupUi(QDialog*);
|
||||
|
||||
private slots:
|
||||
void on_btnOK_clicked();
|
||||
void on_btnCalculate_clicked();
|
||||
};
|
||||
|
||||
22
src/src.pro
22
src/src.pro
@@ -7,27 +7,27 @@ CONFIG += static debug
|
||||
QT += xml
|
||||
LIBS += /usr/local/qwt/lib/libqwt.a
|
||||
LIBS += -lm -lz -lftd2xx
|
||||
QMAKE_CXXFLAGS = -DGC_BUILD_DATE="`date +'\"%a_%b_%d,_%Y\"'`"
|
||||
RC_FILE = images/gc.icns
|
||||
|
||||
macx {
|
||||
LIBS += -framework Carbon
|
||||
}
|
||||
|
||||
macx || unix {
|
||||
HEADERS += Serial.h
|
||||
SOURCES += Serial.cpp
|
||||
QMAKE_CXXFLAGS = -DGC_BUILD_DATE="`date +'\"%a_%b_%d,_%Y\"'`"
|
||||
RC_FILE = images/gc.icns
|
||||
}
|
||||
|
||||
win32 {
|
||||
win32 {
|
||||
HEADERS -= Serial.h
|
||||
HEADERS -= Serial.cpp
|
||||
LIBS = ..\lib\libregex.a \
|
||||
C:\qwt-5.1.0\lib\libqwtd5.a \
|
||||
-lws2_32 \
|
||||
C:\ftdi\libftd2xx.a
|
||||
QMAKE_LFLAGS = -Wl,--enable-runtime-pseudo-reloc \
|
||||
-Wl,--script,i386pe.x-no-rdata
|
||||
QMAKE_CXXFLAGS = -fdata-sections
|
||||
INCLUDEPATH += C:\qwt-5.1.0\include \
|
||||
QMAKE_CXXFLAGS += -fdata-sections
|
||||
INCLUDEPATH += C:\qwt-5.1.0\include\
|
||||
C:\boost
|
||||
RC_FILE -= images/gc.icns
|
||||
|
||||
}
|
||||
|
||||
HEADERS += \
|
||||
@@ -56,6 +56,7 @@ HEADERS += \
|
||||
LogTimeScaleEngine.h \
|
||||
Pages.h \
|
||||
PowerTap.h \
|
||||
ToolsDialog.h \
|
||||
Zones.h \
|
||||
cpint.h \
|
||||
srm.h
|
||||
@@ -89,6 +90,7 @@ SOURCES += \
|
||||
LogTimeScaleEngine.cpp \
|
||||
Pages.cpp \
|
||||
PowerTap.cpp \
|
||||
ToolsDialog.cpp \
|
||||
Zones.cpp \
|
||||
main.cpp \
|
||||
srm.cpp
|
||||
|
||||
Reference in New Issue
Block a user