Esempio n. 1
0
Car::Car(QString name, CarManager *parent) : QObject(parent), _manager(parent), _name(name), _nbtire(0),_buyingprice(0),_sellingprice(0),_lifetime(0)
{
    this->db_init();
    db_loading=false;
    while(this->db_get_version() < DB_VERSION)
    {
        qDebug() << "Update configuation database " << this->db_get_version() << " >> " << DB_VERSION;
        if(this->db_get_version() < 2)
        {
            db_upgrade_to_2();
        }
        if(this->db_get_version() < 3)
        {
            db_upgrade_to_3();
        }
        if(this->db_get_version() < 4)
        {
            db_upgrade_to_4();
        }
    }
    qDebug() << "Database version " << this->db_get_version();

    this->db_load();

    this->_stationlist.append(new Station);
    qSort(_stationlist.begin(), _stationlist.end(), sortStationByQuantity);
    this->_fueltypelist.append(new Fueltype);
    qSort(_fueltypelist.begin(), _fueltypelist.end(), sortFueltypeById);
    this->_costtypelist.append(new Costtype);
    qSort(_costtypelist.begin(), _costtypelist.end(), sortCosttypeById);
    nbtire();
    buyingprice();
    sellingprice();
    lifetime();
}
Esempio n. 2
0
Car::Car(QString name, CarManager *parent) : QObject(parent), _manager(parent), _name(name)
{
    this->db_init();
    while(this->db_get_version() < DB_VERSION)
    {
        qDebug() << "Update configuation database " << this->db_get_version() << " >> " << DB_VERSION;
        if(this->db_get_version() < 2)
        {
            db_upgrade_to_2();
        }
    }
    qDebug() << "Database version " << this->db_get_version();

    this->db_load();

    this->_stationlist.append(new Station);
    qSort(_stationlist.begin(), _stationlist.end(), sortStationById);
}