コード例 #1
0
int main(int argc, char* argv[]) {
    char *dict[4960];
    char prefix[20];
    int size = 0;

    printf("Podaj slownik imion: \n");

    size = get_names(dict);

    printf("Wczytano %d imion\n",size);

    printf("Podaj prefiks szukanych imion: ");

    get_prefix(prefix);

    printf("Imiona zaczynajace sie na %s:\n",prefix);

    display_names(dict,prefix,size);

    return 0;
}
コード例 #2
0
Piano::Piano(QWidget *parent) :
    QWidget(parent)
{
    init_log();
    QPalette Pal(palette());
    Pal.setColor(QPalette::Background, QColor::fromRgb(240, 240, 240));
    setAutoFillBackground(true);
    setPalette(Pal);

    showing = false; //displaying the scorebox

    b_names_dip = false;
    b_racc_disp = false;
    notes = new QVector<Touche*>();
    notes_jouees = new QVector<QString>();
    setFixedSize(800, 310);

    QPushButton *raccButt= new QPushButton(QString(""),this);
    raccButt->setToolTip(QString("Affiche les raccourcis clavier pour le piano"));
    QPushButton *noteNames = new QPushButton(QString(""),this);
    noteNames->setToolTip(QString("Affiche le nom des notes sur le piano"));

    QCheckBox *checkB = new QCheckBox(QString("options affichage"),this);
    checkB->setToolTip(QString("Affiche/cache les options d'affiche du piano"));
    QPushButton *retour = new QPushButton(QString(""),this);
    checkB->setChecked(true);
    retour->move(740,0);
    retour->setStyleSheet("border-image: url(:/new/prefix1/undo.png)");
    retour->setToolTip(QString("Annule la dernière note jouée"));
    retour->resize(50,50);
    QPushButton *solution = new QPushButton(QString("Solution"),this);
    solution->setToolTip(QString("Aide: Indique la note suivante sur le piano"));
    solution->move(0,10);
    checkB->move(0,282);
    Touche* doM = new Touche(this, QString("tab"),QString("Do"));
    int sizeT= 38;//doM->width();
    //QMessageBox::information(new QWidget(),QString("taille "),QString::number(sizeT));

    int hauteur = 100;
    int nT =3;
    raccButt->move(0,hauteur+50);
    raccButt->setFixedSize(140,50);
    raccButt->setStyleSheet("border-image: url(:/img/clavier.svg.png);"
                            );



    noteNames->move(660,hauteur +50);
    noteNames->setFixedSize(140,50);
    noteNames->setStyleSheet("border-image: url(:/img/doremi);"
                            "border-width: 2px;");

    doM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* reM = new Touche(this, QString("A"),QString("Ré"));
    reM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* miM = new Touche(this, QString("Z"),QString("Mi"));
    miM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* faM = new Touche(this, QString("E"),QString("Fa"));
    faM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* solM = new Touche(this, QString("R"),QString("Sol"));
    solM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* laM = new Touche(this, QString("T"),QString("La"));
    laM->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* siM = new Touche(this, QString("Y"),QString("si"));
    siM->move(sizeT*nT,hauteur);
    nT+=1;

    Touche* dom = new Touche(this, QString("U"),QString("Do"));
    dom->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* rem = new Touche(this, QString("I"),QString("Ré"));
    rem->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* mim = new Touche(this, QString("O"),QString("Mi"));
    mim->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* fam = new Touche(this, QString("P"),QString("Fa"));
    fam->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* solm = new Touche(this, QString(/*"dead_circumflex"*/"16781906"),QString("Sol"));
    solm->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* lam = new Touche(this, QString("$"),QString("La"));
    lam->move(sizeT*nT,hauteur);
    nT+=1;
    Touche* sim = new Touche(this, QString("Return"),QString("si"));
    sim->move(sizeT*nT,hauteur);


    nT=4;


    Touche* doMD = new Touche(this, QString("&"),QString("Do#"));
    doMD->black();
    doMD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=1;
    Touche* reMD = new Touche(this, QString("é"),QString("Ré#"));
    reMD->black();
    reMD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=2;
    Touche* faMD = new Touche(this, QString("'"),QString("Fa#"));
    faMD->black();
    faMD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=1;
    Touche* solMD = new Touche(this, QString("("),QString("Sol#"));
    solMD->black();
    solMD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=1;
    Touche* laMD = new Touche(this, QString("-"),QString("La#"));
    laMD->black();
    laMD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=2;

    Touche* domD = new Touche(this, QString("_"),QString("Do#"));
    domD->black();
    domD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=1;
    Touche* remD = new Touche(this, QString("ç"),QString("Ré#"));
    remD->black();
    remD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=2;
    Touche* famD = new Touche(this, QString(")"),QString("Fa#"));
    famD->black();
    famD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=1;
    Touche* solmD = new Touche(this, QString("="),QString("Sol#"));
    solmD->black();
    solmD->move(sizeT*nT-sizeT/4,hauteur);
    nT+=1;
    Touche* lamD = new Touche(this, QString("Backspace"),QString("La#"));
    lamD->black();
    lamD->move(sizeT*nT-sizeT/4,hauteur);







     QObject::connect(doM, SIGNAL(clicked()), this, SLOT(play_doM()));notes->append(doM);
     QObject::connect(reM, SIGNAL(clicked()), this, SLOT(play_reM()));notes->append(reM);
     QObject::connect(miM, SIGNAL(clicked()), this, SLOT(play_miM()));notes->append(miM);
     QObject::connect(faM, SIGNAL(clicked()), this, SLOT(play_faM()));notes->append(faM);
     QObject::connect(solM, SIGNAL(clicked()), this, SLOT(play_solM()));notes->append(solM);
     QObject::connect(laM, SIGNAL(clicked()), this, SLOT(play_laM()));notes->append(laM);
     QObject::connect(siM, SIGNAL(clicked()), this, SLOT(play_siM()));notes->append(siM);

     QObject::connect(dom, SIGNAL(clicked()), this, SLOT(play_dom()));notes->append(dom);
     QObject::connect(rem, SIGNAL(clicked()), this, SLOT(play_rem()));notes->append(rem);
     QObject::connect(mim, SIGNAL(clicked()), this, SLOT(play_mim()));notes->append(mim);
     QObject::connect(fam, SIGNAL(clicked()), this, SLOT(play_fam()));notes->append(fam);
     QObject::connect(solm, SIGNAL(clicked()), this, SLOT(play_solm()));notes->append(solm);
     QObject::connect(lam, SIGNAL(clicked()), this, SLOT(play_lam()));notes->append(lam);
     QObject::connect(sim, SIGNAL(clicked()), this, SLOT(play_sim()));notes->append(sim);

     QObject::connect(doMD, SIGNAL(clicked()), this, SLOT(play_doMD()));notes->append(doMD);
     QObject::connect(reMD, SIGNAL(clicked()), this, SLOT(play_reMD()));notes->append(reMD);

     QObject::connect(faMD, SIGNAL(clicked()), this, SLOT(play_faMD()));notes->append(faMD);
     QObject::connect(solMD, SIGNAL(clicked()), this, SLOT(play_solMD()));notes->append(solMD);
     QObject::connect(laMD, SIGNAL(clicked()), this, SLOT(play_laMD()));notes->append(laMD);

     QObject::connect(domD, SIGNAL(clicked()), this, SLOT(play_domD()));notes->append(domD);
     QObject::connect(remD, SIGNAL(clicked()), this, SLOT(play_remD()));notes->append(remD);

     QObject::connect(famD, SIGNAL(clicked()), this, SLOT(play_famD()));notes->append(famD);
     QObject::connect(solmD, SIGNAL(clicked()), this, SLOT(play_solmD()));notes->append(solmD);
     QObject::connect(lamD, SIGNAL(clicked()), this, SLOT(play_lamD()));notes->append(lamD);


     QObject::connect(raccButt, SIGNAL(clicked()), this, SLOT(display_racc()));
     QObject::connect(noteNames, SIGNAL(clicked()), this, SLOT(display_names()));
     QObject::connect(checkB, SIGNAL(toggled(bool)), this, SLOT(checking(bool)));
     QObject::connect(retour, SIGNAL(clicked()), this, SLOT(retour_arriere()));



}