void BarGraph::addEnergy(int value){ energy += value; if (energy > 10) energy = 10; updateBarGraph(); }
void BarGraph::subEnergy(int value){ energy -= value; if (energy < 0) energy = 0; updateBarGraph(); }
void BarGraph::presentation_up(){ for (int i = 0; i < 10; i++) { addEnergy(1); updateBarGraph(); delay(400); } }
void BarGraph::presentation_down(){ for (int i = 0; i < 10; i++){ subEnergy(1); updateBarGraph(); delay(400); } }
ThrustBar::ThrustBar(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(update())); connect(timer,SIGNAL(timeout()),this,SLOT(updateBarGraph())); timer->start(10); //updateBarGraph(); eng1 =0; eng2 =0; eng3 =0; eng4 =0; eng5 =0; eng6 =0; eng7 =0; eng8 =0; setWindowTitle(tr("Thrust Graphs")); }
void BarGraph::reset(){ energy = 0; updateBarGraph(); }
void BarGraph::begin(){ energy = 0; updateBarGraph(); }