Skip to content

Commit

Permalink
cbjeicjoe
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLortex committed Aug 25, 2014
1 parent b2f0fe9 commit 238bbad
Show file tree
Hide file tree
Showing 17 changed files with 371 additions and 203 deletions.
66 changes: 34 additions & 32 deletions FenPrincipale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,27 @@ FenPrincipale::FenPrincipale(Serial* _com) {
myDecoder = new CookieDecoder();
connect(myDecoder,SIGNAL(newValue(int,int,double)), sensormgr, SLOT(newValue(int,int,double)));
connect(myDecoder,SIGNAL(message(QString)),this,SLOT(log_decoder(QString)));
connect(myDecoder,SIGNAL(trame_erreur(int)),this, SLOT(incrementStatTramesEchouees(int)));
log_logger("[INFO] All started !");
// -----------------------------
// Prise en charge du port série
connect(com,SIGNAL(dataRead(QList<QByteArray>)),this,SLOT(informationsReceived(QList<QByteArray>)));
connect(com,SIGNAL(message(QString)),this,SLOT(log_serial(QString)));
connect(com, SIGNAL(nBytesRead(int)),this, SLOT(incrementStatBytesRecus(int)));
// -------------------
// Implémentation du chronoreader
h_depart = QDateTime::currentDateTime();
/* h_depart = QDateTime::currentDateTime();
chronoWidget = new ChronoReaderWidget;
chronolayout->addWidget(chronoWidget);
chronolayout->addWidget(chronoWidget);*/
// --------------------
// Lecture des paramètres enregistrés
QSettings *data_settings = new QSettings();
loadSettings();

QDateTime t = data_settings->value("datedepart",QDateTime::currentDateTime()).toDateTime();
heureLancement->setDateTime(t);
chronoWidget->laucherCounter(t.time());

mWebServicesManager = new WebServicesManager();
mWebServicesManager = new WebServicesManager(this);
connect(mWebServicesManager, SIGNAL(notification(int,QString)), this, SLOT(onWebServicesNotification(int,QString)));
connect(mWebServicesManager, SIGNAL(message(QString)), this, SLOT(log_webservices(QString)));

Expand All @@ -156,6 +157,12 @@ FenPrincipale::FenPrincipale(Serial* _com) {
//---------------------------



StagesManager* stmgr = new StagesManager(stageGraphicsView);

nTramesRecues = 0;
nTramesEchouees = 0;
nBytesRecus = 0;
}

FenPrincipale::~FenPrincipale(){
Expand Down Expand Up @@ -203,40 +210,14 @@ void FenPrincipale::onRangeStartUpdate(QDateTime range_start) {
*/
void FenPrincipale::syncTime() {
graphic_range_selector->setMaximumDate(QDateTime::currentDateTime());

int h,m,s;
h = QTime::currentTime().hour();
m = QTime::currentTime().minute();
s = QTime::currentTime().second();

if(s==42) {
QPalette palette = lcd_sec->palette();
palette.setColor(QPalette::Normal, QPalette::Foreground, Qt::red);
lcd_sec->setPalette(palette);
} else if((s>=42)&&(s<=45)) {
s = 42;
}else if(s == 46) {
lcd_sec->setPalette(lcd_hour->palette());
}


if(m==42) {
QPalette palette = lcd_min->palette();
palette.setColor(QPalette::Normal, QPalette::Foreground, Qt::red);
lcd_min->setPalette(palette);
} else if(m == 43) {
lcd_min->setPalette(lcd_hour->palette());
}

lcd_hour->display(QString("%1").arg(h, 10, 10, QChar('0').toUpper()));
lcd_min->display(QString("%1").arg(m, 10, 10, QChar('0').toUpper()));
lcd_sec->display(QString("%1").arg(s, 10, 10, QChar('0').toUpper()));
}

/*
* Gestion des données
*/
void FenPrincipale::informationsReceived(QList<QByteArray> trames) {
incrementStatTramesRecues(trames.size());

if(trames.size() > 0) {
for(int i=0;i<trames.size();i++) {
myDecoder->decodeString(trames[i]);
Expand Down Expand Up @@ -334,6 +315,23 @@ void FenPrincipale::log(int section, QString message) {
}
}


void FenPrincipale::incrementStatBytesRecus(int n) {
nBytesRecus += n;
stats_octets_recus->setText("Octets reçus: "+nBytesRecus);
}

void FenPrincipale::incrementStatTramesRecues(int n) {
nTramesRecues += n;
stats_octets_recus->setText("Trames reçues: "+nTramesRecues);
}

void FenPrincipale::incrementStatTramesEchouees(int n) {
nTramesEchouees += n;
stats_octets_recus->setText("Trames échouées: "+nTramesEchouees);
}


/*
* Gestion des actions du menu supérieur (tout comme le jambon)
*/
Expand Down Expand Up @@ -647,7 +645,11 @@ void FenPrincipale::konamify(bool enable) {
konami_4->setVisible(false);
konami_close->setVisible(false);

#ifdef TROLL
this->setWindowTitle("To log, or not to log ? Random compilation.");
#else
this->setWindowTitle("Logger 3.14");
#endif
}
}

Expand Down
16 changes: 14 additions & 2 deletions FenPrincipale.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include <QList>
#include <QPair>
#include <QMdiSubWindow>
#include <QMessageBox>

#include "ui_FenPrincipale.h"
#include "ChronoReader/chronoreaderwidget.h"
#include "InPut/sensormanager.h"
#include "InPut/cookiedecoder.h"
#include "InPut/serial.h"
Expand All @@ -29,6 +29,7 @@
#include "tablemgr.h"
#include "webservicesmanager.h"
#include "UI/timerangeselector.h"
#include "UI/stagesmanager.h"



Expand All @@ -37,6 +38,7 @@ class MapsView;
class BoardingTable;
class SensorManager;
class TableMgr;
class WebServicesManager;

class FenPrincipale : public QMainWindow, public Ui::FenPrincipale
{
Expand All @@ -60,6 +62,7 @@ class FenPrincipale : public QMainWindow, public Ui::FenPrincipale
void loadSettings();
void saveSettings();


protected:
void reinit_b();
void resizeEvent(QResizeEvent *);
Expand All @@ -76,7 +79,6 @@ class FenPrincipale : public QMainWindow, public Ui::FenPrincipale
BoardingTable* tableauBord;
MapsView* carte;
TableMgr* tableManager;
ChronoReaderWidget* chronoWidget;

QActionGroup* group_ports_name;
QVector<QTableView*> tableauxHist;
Expand All @@ -100,6 +102,10 @@ class FenPrincipale : public QMainWindow, public Ui::FenPrincipale
QList<int> konami;
QWebView* kwebview;

int nTramesRecues;
int nTramesEchouees;
int nBytesRecus;


public slots:
void onWebServicesNotification(int, QString);
Expand All @@ -122,6 +128,12 @@ class FenPrincipale : public QMainWindow, public Ui::FenPrincipale
void setIndicatorRx();


void incrementStatBytesRecus(int n);
void incrementStatTramesRecues(int n);
void incrementStatTramesEchouees(int n);



// Slots de type event sur ui
void on_b_param_clicked();
void on_b_table_clicked();
Expand Down
Loading

0 comments on commit 238bbad

Please sign in to comment.