Esempio n. 1
0
FancyLabel::FancyLabel(QWidget *parent) :
    QWidget(parent,  Qt::FramelessWindowHint) {

    //Tells Qt we'll paint with translucent colors
    setAttribute(Qt::WA_TranslucentBackground);
    m_generated = true;
    m_flat = false;
    setGen();
}
Esempio n. 2
0
bool Team::loadFromFile(const QString &path)
{
    m_path = path;

    QFile file(path);
    if (!file.open(QFile::ReadOnly))
    {
        return false;
    }
    QDomDocument document;
    QString msg;
    int line,col;
    if(!document.setContent(&file,&msg,&line,&col))
    {
        QMessageBox::information(0,QObject::tr("Load Team"),QObject::tr("Error while loading the team."));
        return false;
    }
    QDomElement team = document.firstChildElement("Team");
    if(team.isNull())
    {
        QMessageBox::information(0,QObject::tr("Load Team"),QObject::tr("Error while loading the team."));
        return false;
    }
    int version = team.attribute("version", "0").toInt();

    if (version > 1) {
        QMessageBox::information(0,QObject::tr("Load Team"),QObject::tr("Error while loading the team, the client is outdated."));
        return false;
    }

    int gen = team.attribute("gen", QString::number(GenInfo::GenMax())).toInt();
    if (gen < GEN_MIN || gen > GenInfo::GenMax())
        gen = GenInfo::GenMax();
    setGen(Pokemon::gen(team.attribute("gen", QString::number(GenInfo::GenMax())).toInt(),
                        team.attribute("subgen", QString::number(GenInfo::NumberOfSubgens(team.attribute("gen", QString::number(GenInfo::GenMax())).toInt())-1)).toInt()));
    defaultTier() = team.attribute("defaultTier");

    QDomElement poke = team.firstChildElement("Pokemon");
    int cpt = 0;
    while(!poke.isNull())
    {
        this->poke(cpt).loadFromXml(poke, version);

        cpt++;
        poke = poke.nextSiblingElement("Pokemon");
    }
    return true;
}
Esempio n. 3
0
PointGroup3D :: PointGroup3D (int p, int q, bool pbar, bool qbar, bool bbar) : Group(){
				
	mNumFrame = 3;
	
	mNumGen = bbar ? 1 : (p==1) ? 1 : ( (q==0) ? ( pbar ? 1 : 2 ) : ( pbar ? (qbar ? 1 : 2 ) : (qbar ? 2 : 3 ) ) ); 
		
	mExp[0] = p; mExp[1] = q;
    
	mBar[0] = pbar; mBar[1] = qbar; mBar[2] = bbar;
					
	Rot r1 = Rot::e12( theta(p) /2.0 ); 
	Rot r2 = Rot::e23( theta(q) /2.0 );
		
	mVersor[0] = Vec::x;
	mVersor[1] = Op::sp(v.a, r1);
	mVersor[2] = Op::sp(v.b, r2);
	
	setFrame(v); setGen();
}
Esempio n. 4
0
void PokeTeam::loadFromXml(const QDomElement &poke, int version)
{
    if (poke.hasAttribute("Gen")) {
        setGen(Pokemon::gen(poke.attribute("Gen", QString::number(GenInfo::GenMax())).toInt(),
                            poke.attribute("SubGen", QString::number(GenInfo::NumberOfSubgens(poke.attribute("Gen", QString::number(GenInfo::GenMax())).toInt())-1)).toInt()));
    }

    reset();

    /* Code to import old teams which had different formes registered as different pokemon numbers */
    int num = poke.attribute("Num").toInt();
    int forme = poke.attribute("Forme").toInt();

    if (gen().num == 4 && num > 493 && forme == 0 && !PokemonInfo::Exists(Pokemon::uniqueId(num, 0), 4)) {
        //Old way
        int indexes[] = {
            479,479,479,479,479,386,386,386,413,413,492,487
        };
        int formes[] = {
            1,2,3,4,5,1,2,3,1,2,1,1
        };

        int i = num - 494;

        setNum(Pokemon::uniqueId(indexes[i], formes[i]));
    } else {
        setNum(Pokemon::uniqueId(num, forme));
    }

    bool outdated = gen() < 5 && version < 1;

    load();
    nickname() = poke.attribute("Nickname");
    item() = poke.attribute("Item").toInt();
    ability() = poke.attribute("Ability").toInt();
    if (outdated) {
        ability() = AbilityInfo::ConvertFromOldAbility(ability());
    }
    nature() = poke.attribute("Nature").toInt();
    gender() = poke.attribute("Gender").toInt();
    shiny() = QVariant(poke.attribute("Shiny")).toBool();
    happiness() = poke.attribute("Happiness").toInt();
    level() = poke.attribute("Lvl").toInt();

    int cptMove=0;

    QDomElement moveElement = poke.firstChildElement("Move");
    while(!moveElement.isNull())
    {
        int movenum = moveElement.text().toInt();
        if (outdated) {
            movenum = MoveInfo::ConvertFromOldMove(movenum);
        }
        setMove(movenum,cptMove,false);
        cptMove++;
        moveElement = moveElement.nextSiblingElement("Move");
    }
    int cptDV=0;
    QDomElement DVElement = poke.firstChildElement("DV");
    while(!DVElement.isNull())
    {
        setDV(outdated ? NatureInfo::ConvertToStat(cptDV) : cptDV,DVElement.text().toInt());
        cptDV++;
        DVElement = DVElement.nextSiblingElement("DV");
    }
    int cptEV=0;
    QDomElement EVElement = poke.firstChildElement("EV");
    while(!EVElement.isNull())
    {
        setEV(outdated ? NatureInfo::ConvertToStat(cptEV) : cptEV,EVElement.text().toInt());
        cptEV++;
        EVElement = EVElement.nextSiblingElement("EV");
    }
}
Esempio n. 5
0
PokeTeam::PokeTeam()
{
    setNum(Pokemon::uniqueId(Pokemon::NoPoke));
    setGen(Pokemon::gen(GenInfo::GenMax(), GenInfo::NumberOfSubgens(GenInfo::GenMax())-1));
}
PokeTeam::PokeTeam()
{
    setNum(Pokemon::uniqueId(Pokemon::NoPoke));
    setGen(GEN_MAX);
}
Esempio n. 7
0
void FancyLabel::move(const QPoint p)
{
    QWidget::move(p);
    qDebug() << "FancyLabel::move" << p;
    setGen();
}
Esempio n. 8
0
void FancyLabel::resize(QSize sz){
    QWidget::resize(sz);
    qDebug() << "FancyLabel::resize" << sz;
    setGen();
}
Esempio n. 9
0
void FancyLabel::setGeometry(QRect r){
    QWidget::setGeometry(r);
    qDebug() << "FancyLabel::setGeometry" << r;
    setGen();

}