mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Fix archiac weight glitch.. made cube even more annoying
This commit is contained in:
parent
582c70ef60
commit
1485afe17c
@ -2356,6 +2356,8 @@ void gGraphView::renderSomethingFun()
|
|||||||
// When I'm feeling more energetic, I'll change it to a textured sheep or something.
|
// When I'm feeling more energetic, I'll change it to a textured sheep or something.
|
||||||
static float rotqube=0;
|
static float rotqube=0;
|
||||||
|
|
||||||
|
static float xpos=0,ypos=7,spos=0;
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glAlphaFunc(GL_GREATER,0.1);
|
glAlphaFunc(GL_GREATER,0.1);
|
||||||
@ -2368,13 +2370,24 @@ void gGraphView::renderSomethingFun()
|
|||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
glTranslatef(0.0f, 0.0f,-7.0f);
|
double xx=sin(M_PI/180.0 * xpos)*2; // ((4.0/width()) * m_mouse.rx())-2.0;
|
||||||
|
double yy=cos(M_PI/180.0 * ypos)*2; //2-((4.0/height()) * m_mouse.ry());
|
||||||
|
xpos+=1;
|
||||||
|
ypos+=1.32;
|
||||||
|
if (xpos > 360) xpos-=360.0;
|
||||||
|
if (ypos > 360) ypos-=360.0;
|
||||||
|
|
||||||
|
|
||||||
|
//m_mouse.x();
|
||||||
|
glTranslatef(xx, 0.0f,-7.0f+yy);
|
||||||
glRotatef(rotqube,0.0f,1.0f,0.0f);
|
glRotatef(rotqube,0.0f,1.0f,0.0f);
|
||||||
glRotatef(rotqube,1.0f,1.0f,1.0f);
|
glRotatef(rotqube,1.0f,1.0f,1.0f);
|
||||||
|
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
cubetex=bindTexture(*cubeimg[0]);
|
cubetex=bindTexture(*cubeimg[0]);
|
||||||
|
|
||||||
//glBindTexture(GL_TEXTURE_2D, cubetex); //texid[i % imgcount]);
|
//glBindTexture(GL_TEXTURE_2D, cubetex); //texid[i % imgcount]);
|
||||||
i++;
|
i++;
|
||||||
glColor4f(1,1,1,1);
|
glColor4f(1,1,1,1);
|
||||||
@ -2426,8 +2439,8 @@ void gGraphView::renderSomethingFun()
|
|||||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
|
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
|
||||||
glEnd();
|
glEnd();
|
||||||
// Left Face
|
// Left Face
|
||||||
//bindTexture(*cubeimg[i % imgcount]);
|
//GLuint tex=bindTexture(*images["mask"]);
|
||||||
//glBindTexture(GL_TEXTURE_2D, texid[i % imgcount]);
|
//glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
i++;
|
i++;
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
|
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
|
||||||
@ -2753,12 +2766,23 @@ void gGraphView::paintGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
|
const int rs=10;
|
||||||
|
static double ring[rs]={0};
|
||||||
|
static int rp=0;
|
||||||
|
|
||||||
// Show FPS and draw time
|
// Show FPS and draw time
|
||||||
if (m_showsplitter && PROFILE.general->showDebug()) {
|
if (m_showsplitter && PROFILE.general->showDebug()) {
|
||||||
QString ss;
|
QString ss;
|
||||||
qint64 ela=time.nsecsElapsed();
|
qint64 ela=time.nsecsElapsed();
|
||||||
double ms=double(ela)/1000000.0;
|
double ms=double(ela)/1000000.0;
|
||||||
ss="Debug Mode "+QString::number(ms,'f',1)+"ms ("+QString::number(1000.0/float(ms),'f',1)+"fps)";
|
ring[rp++]=1000.0/ms;
|
||||||
|
rp %= rs;
|
||||||
|
double v=0;
|
||||||
|
for (int i=0;i<rs;i++) {
|
||||||
|
v+=ring[i];
|
||||||
|
}
|
||||||
|
double fps=v/double(rs);
|
||||||
|
ss="Debug Mode "+QString::number(ms,'f',1)+"ms ("+QString::number(fps,'f',1)+"fps)";
|
||||||
int w,h;
|
int w,h;
|
||||||
GetTextExtent(ss,w,h);
|
GetTextExtent(ss,w,h);
|
||||||
QColor col=Qt::white;
|
QColor col=Qt::white;
|
||||||
@ -2773,7 +2797,7 @@ void gGraphView::paintGL()
|
|||||||
|
|
||||||
if (this->isVisible()) {
|
if (this->isVisible()) {
|
||||||
if (m_limbo || m_inAnimation || (something_fun && !numgraphs)) {
|
if (m_limbo || m_inAnimation || (something_fun && !numgraphs)) {
|
||||||
redrawtimer->setInterval(20);
|
redrawtimer->setInterval(1000.0/50);
|
||||||
redrawtimer->setSingleShot(true);
|
redrawtimer->setSingleShot(true);
|
||||||
redrawtimer->start();
|
redrawtimer->start();
|
||||||
}
|
}
|
||||||
@ -2812,6 +2836,8 @@ void gGraphView::mouseMoveEvent(QMouseEvent * event)
|
|||||||
int x=event->x();
|
int x=event->x();
|
||||||
int y=event->y();
|
int y=event->y();
|
||||||
|
|
||||||
|
m_mouse=QPoint(x,y);
|
||||||
|
|
||||||
if (m_sizer_dragging) { // Resize handle being dragged
|
if (m_sizer_dragging) { // Resize handle being dragged
|
||||||
float my=y - m_sizer_point.y();
|
float my=y - m_sizer_point.y();
|
||||||
//qDebug() << "Sizer moved vertically" << m_sizer_index << my*m_scaleY;
|
//qDebug() << "Sizer moved vertically" << m_sizer_index << my*m_scaleY;
|
||||||
|
@ -1058,6 +1058,8 @@ protected:
|
|||||||
bool m_inAnimation;
|
bool m_inAnimation;
|
||||||
bool m_blockUpdates;
|
bool m_blockUpdates;
|
||||||
|
|
||||||
|
QPoint m_mouse;
|
||||||
|
|
||||||
QTime m_animationStarted;
|
QTime m_animationStarted;
|
||||||
|
|
||||||
//QVector<GLuint> texid;
|
//QVector<GLuint> texid;
|
||||||
|
51
daily.cpp
51
daily.cpp
@ -1202,7 +1202,7 @@ void Daily::Load(QDate date)
|
|||||||
void Daily::UnitsChanged()
|
void Daily::UnitsChanged()
|
||||||
{
|
{
|
||||||
double kg;
|
double kg;
|
||||||
if (PROFILE.general->unitSystem()==US_Metric) {
|
if (PROFILE.general->unitSystem()==US_Archiac) {
|
||||||
kg=ui->weightSpinBox->value();
|
kg=ui->weightSpinBox->value();
|
||||||
float ounces=(kg*1000.0)/ounce_convert;
|
float ounces=(kg*1000.0)/ounce_convert;
|
||||||
int pounds=ounces/16;
|
int pounds=ounces/16;
|
||||||
@ -1253,8 +1253,7 @@ void Daily::Unload(QDate date)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (journal->IsChanged()) {
|
if (journal->IsChanged()) {
|
||||||
|
// blah.. was updating overview graphs here.. Was too slow.
|
||||||
mainwin->getOverview()->ResetGraphs();
|
|
||||||
}
|
}
|
||||||
Machine *jm=PROFILE.GetMachine(MT_JOURNAL);
|
Machine *jm=PROFILE.GetMachine(MT_JOURNAL);
|
||||||
if (jm) jm->SaveSession(journal);
|
if (jm) jm->SaveSession(journal);
|
||||||
@ -1637,12 +1636,7 @@ void Daily::on_ZombieMeter_valueChanged(int action)
|
|||||||
journal->settings[Journal_ZombieMeter]=ui->ZombieMeter->value();
|
journal->settings[Journal_ZombieMeter]=ui->ZombieMeter->value();
|
||||||
journal->SetChanged(true);
|
journal->SetChanged(true);
|
||||||
|
|
||||||
gGraph *g;
|
if (mainwin->getOverview()) mainwin->getOverview()->ResetGraph("Zombie");
|
||||||
if (mainwin->getOverview()) {
|
|
||||||
g=mainwin->getOverview()->graphView()->findGraph("Zombie");
|
|
||||||
if (g) g->setDay(NULL);
|
|
||||||
//mainwin->getOverview()->RedrawGraphs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Daily::on_bookmarkTable_itemChanged(QTableWidgetItem *item)
|
void Daily::on_bookmarkTable_itemChanged(QTableWidgetItem *item)
|
||||||
@ -1650,8 +1644,26 @@ void Daily::on_bookmarkTable_itemChanged(QTableWidgetItem *item)
|
|||||||
Q_UNUSED(item);
|
Q_UNUSED(item);
|
||||||
update_Bookmarks();
|
update_Bookmarks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Daily::on_weightSpinBox_valueChanged(double arg1)
|
void Daily::on_weightSpinBox_valueChanged(double arg1)
|
||||||
{
|
{
|
||||||
|
// Update the BMI display
|
||||||
|
double kg;
|
||||||
|
if (PROFILE.general->unitSystem()==US_Archiac) {
|
||||||
|
kg=((arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert)) / 1000.0;
|
||||||
|
} else kg=arg1;
|
||||||
|
double height=PROFILE.user->height()/100.0;
|
||||||
|
if ((height>0) && (kg>0)) {
|
||||||
|
double bmi=kg/(height * height);
|
||||||
|
ui->BMI->display(bmi);
|
||||||
|
ui->BMI->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Daily::on_weightSpinBox_editingFinished()
|
||||||
|
{
|
||||||
|
double arg1=ui->weightSpinBox->value();
|
||||||
|
|
||||||
double height=PROFILE.user->height()/100.0;
|
double height=PROFILE.user->height()/100.0;
|
||||||
Session *journal=GetJournalSession(previous_date);
|
Session *journal=GetJournalSession(previous_date);
|
||||||
if (!journal) {
|
if (!journal) {
|
||||||
@ -1660,7 +1672,7 @@ void Daily::on_weightSpinBox_valueChanged(double arg1)
|
|||||||
|
|
||||||
double kg;
|
double kg;
|
||||||
if (PROFILE.general->unitSystem()==US_Archiac) {
|
if (PROFILE.general->unitSystem()==US_Archiac) {
|
||||||
kg=(arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert);
|
kg=((arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert)) / 1000.0;
|
||||||
} else {
|
} else {
|
||||||
kg=arg1;
|
kg=arg1;
|
||||||
}
|
}
|
||||||
@ -1683,17 +1695,30 @@ void Daily::on_weightSpinBox_valueChanged(double arg1)
|
|||||||
}
|
}
|
||||||
journal->SetChanged(true);
|
journal->SetChanged(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Daily::on_ouncesSpinBox_valueChanged(int arg1)
|
void Daily::on_ouncesSpinBox_valueChanged(int arg1)
|
||||||
{
|
{
|
||||||
|
// just update for BMI display
|
||||||
|
double height=PROFILE.user->height()/100.0;
|
||||||
|
double kg=((ui->weightSpinBox->value()*pound_convert) + (arg1*ounce_convert)) / 1000.0;
|
||||||
|
if ((height>0) && (kg>0)) {
|
||||||
|
double bmi=kg/(height * height);
|
||||||
|
ui->BMI->display(bmi);
|
||||||
|
ui->BMI->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Daily::on_ouncesSpinBox_editingFinished()
|
||||||
|
{
|
||||||
|
double arg1=ui->ouncesSpinBox->value();
|
||||||
Session *journal=GetJournalSession(previous_date);
|
Session *journal=GetJournalSession(previous_date);
|
||||||
if (!journal) {
|
if (!journal) {
|
||||||
journal=CreateJournalSession(previous_date);
|
journal=CreateJournalSession(previous_date);
|
||||||
}
|
}
|
||||||
double height=PROFILE.user->height()/100.0;
|
double height=PROFILE.user->height()/100.0;
|
||||||
double kg=(ui->weightSpinBox->value()*pound_convert) + (arg1*ounce_convert);
|
double kg=((ui->weightSpinBox->value()*pound_convert) + (arg1*ounce_convert)) / 1000.0;
|
||||||
journal->settings[Journal_Weight]=kg;
|
journal->settings[Journal_Weight]=kg;
|
||||||
|
|
||||||
|
|
||||||
gGraph *g;
|
gGraph *g;
|
||||||
if (mainwin->getOverview()) {
|
if (mainwin->getOverview()) {
|
||||||
g=mainwin->getOverview()->graphView()->findGraph(STR_TR_Weight);
|
g=mainwin->getOverview()->graphView()->findGraph(STR_TR_Weight);
|
||||||
@ -1712,7 +1737,9 @@ void Daily::on_ouncesSpinBox_valueChanged(int arg1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
journal->SetChanged(true);
|
journal->SetChanged(true);
|
||||||
|
if (mainwin->getOverview()) mainwin->getOverview()->ResetGraph("Weight");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Daily::GetDetailsText()
|
QString Daily::GetDetailsText()
|
||||||
{
|
{
|
||||||
ui->webView->triggerPageAction(QWebPage::SelectAll);
|
ui->webView->triggerPageAction(QWebPage::SelectAll);
|
||||||
|
32
daily.h
32
daily.h
@ -187,19 +187,6 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void on_bookmarkTable_itemChanged(QTableWidgetItem *item);
|
void on_bookmarkTable_itemChanged(QTableWidgetItem *item);
|
||||||
|
|
||||||
/*! \fn on_weightSpinBox_valueChanged(double arg1);
|
|
||||||
\brief Called when weight has changed.. Updates the BMI dislpay and journal objects.
|
|
||||||
|
|
||||||
Also Refreshes the Overview charts
|
|
||||||
*/
|
|
||||||
void on_weightSpinBox_valueChanged(double arg1);
|
|
||||||
|
|
||||||
/*! \fn on_ouncesSpinBox_valueChanged(int arg1);
|
|
||||||
\brief Called when weights ounces component has changed.. Updates the BMI dislpay and journal objects.
|
|
||||||
|
|
||||||
Also Refreshes the Overview charts
|
|
||||||
*/
|
|
||||||
void on_ouncesSpinBox_valueChanged(int arg1);
|
|
||||||
|
|
||||||
/*! \fn on_ouncesSpinBox_valueChanged(int arg1);
|
/*! \fn on_ouncesSpinBox_valueChanged(int arg1);
|
||||||
\brief Called when the zombie slider has been moved.. Updates the BMI dislpay and journal objects.
|
\brief Called when the zombie slider has been moved.. Updates the BMI dislpay and journal objects.
|
||||||
@ -216,6 +203,25 @@ private slots:
|
|||||||
|
|
||||||
void on_resetLayoutButton_clicked();
|
void on_resetLayoutButton_clicked();
|
||||||
|
|
||||||
|
/*! \fn on_weightSpinBox_editingFinished();
|
||||||
|
\brief Called when weight has changed.. Updates the BMI dislpay and journal objects.
|
||||||
|
|
||||||
|
Also Refreshes the Overview charts
|
||||||
|
*/
|
||||||
|
|
||||||
|
void on_weightSpinBox_editingFinished();
|
||||||
|
|
||||||
|
/*! \fn on_ouncesSpinBox_editingFinished();
|
||||||
|
\brief Called when weights ounces component has changed.. Updates the BMI dislpay and journal objects.
|
||||||
|
|
||||||
|
Also Refreshes the Overview charts
|
||||||
|
*/
|
||||||
|
void on_ouncesSpinBox_editingFinished();
|
||||||
|
|
||||||
|
void on_ouncesSpinBox_valueChanged(int arg1);
|
||||||
|
|
||||||
|
void on_weightSpinBox_valueChanged(double arg1);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
11
overview.cpp
11
overview.cpp
@ -331,6 +331,8 @@ void Overview::updateGraphCombo()
|
|||||||
|
|
||||||
void Overview::ResetGraphs()
|
void Overview::ResetGraphs()
|
||||||
{
|
{
|
||||||
|
//qint64 st,et;
|
||||||
|
//GraphView->GetXBounds(st,et);
|
||||||
QDate start=ui->dateStart->date();
|
QDate start=ui->dateStart->date();
|
||||||
QDate end=ui->dateEnd->date();
|
QDate end=ui->dateEnd->date();
|
||||||
GraphView->setDay(NULL);
|
GraphView->setDay(NULL);
|
||||||
@ -338,6 +340,15 @@ void Overview::ResetGraphs()
|
|||||||
if (start.isValid() && end.isValid()) {
|
if (start.isValid() && end.isValid()) {
|
||||||
setRange(start,end);
|
setRange(start,end);
|
||||||
}
|
}
|
||||||
|
//GraphView->SetXBounds(st,et);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Overview::ResetGraph(QString name)
|
||||||
|
{
|
||||||
|
gGraph *g=GraphView->findGraph(name);
|
||||||
|
if (!g) return;
|
||||||
|
g->setDay(NULL);
|
||||||
|
GraphView->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overview::RedrawGraphs()
|
void Overview::RedrawGraphs()
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
QVector<SummaryChart *> OverviewCharts;
|
QVector<SummaryChart *> OverviewCharts;
|
||||||
|
|
||||||
void updateGraphCombo();
|
void updateGraphCombo();
|
||||||
|
void ResetGraph(QString name);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// ! \brief Print button down the bottom, does the same as File->Print
|
// ! \brief Print button down the bottom, does the same as File->Print
|
||||||
|
Loading…
Reference in New Issue
Block a user