StaticPage::StaticPage(QWidget *parent) :
        QStackedWidget(parent),
        ui(new Ui::StaticPage)
{
    ui->setupUi(this);

    m_ykConfig = 0;
    m_keyPresent = false;
    clearState();

    //Connect pages
    connectPages();

    //Connect help buttons
    connectHelpButtons();

    //Connect other signals and slots
    connect(YubiKeyFinder::getInstance(), SIGNAL(keyFound(bool, bool*, int)),
            this, SLOT(keyFound(bool, bool*)));

    connect(ui->quickResetBtn, SIGNAL(clicked()),
            this, SLOT(resetQuickPage()));
    connect(ui->advResetBtn, SIGNAL(clicked()),
            this, SLOT(resetAdvPage()));

    ui->quickResultsWidget->resizeColumnsToContents();
    ui->advResultsWidget->resizeColumnsToContents();

    QRegExp rxScan("[A-Fa-f0-9]{,76}");
    ui->quickScanCodesTxt->setValidator(new QRegExpValidator(rxScan, this));

    QRegExp rxText("(\\\\[tn\\\\]|.){,38}");
    ui->quickStaticTxt->setValidator(new QRegExpValidator(rxText, this));

    scanedit = NULL;
}
Esempio n. 2
0
QMap<QString,QPair<QPointF,QString> > GraphicsWorkflow::getXmlIds(const QString& xml) {
     QMap<QString,QPair<QPointF,QString> > result;
     int current = 0, currentp = 0;
     QString keyitem;
     int posnextid;
     QRegExp rx("id\\s*=\\s*\"([a-zA-Z0-9]+)\"");
     QRegExp rxPoints("(points|d)\\s*=\\s*\"([0-9\\-\\.,MCe\\s]+)\"");
     QRegExp rxEllipse("<ellipse\\s+([a-zA-Z0-9#\\.e=\"\\-,;\\:\\s]+)/>");
     QRegExp rxText("<text[a-zA-Z0-9#\\.=\"\\-,;\\:\\s_]*>([a-zA-Z0-9#\\.\\-_]+)</text>");
     while ( true ) {
           current = xml.indexOf( rx, current);
           if ( current != -1) {
               QString namenode = rx.cap(1);
               current += namenode.length();
               if ( namenode.startsWith("graph")) {
                        continue;
                }
               currentp = xml.indexOf( rxPoints, current);
               posnextid = xml.indexOf("id=",current);               
               if ( currentp != -1 ) {
                   QPair<QPointF,QString> pair;
                   // **** Para chequear los operadores JOIN
                   int currentText = current;
                   while( true ) {
                       currentText = xml.indexOf(rxText,currentText);
                       if (currentText == -1 )  {
                           break;
                       }
                       currentText += (rxText.cap(0).length()+1);
                       QString mytext = rxText.cap(1);
                       if ( SafetYAWL::PATTERNS.split(",").contains(mytext) ) {
                           continue;
                       }
                       keyitem = rxText.cap(1);
                       break;
                   }
                   // **** Para chequear los operadores JOIN

                 if ( posnextid == -1 || (posnextid > currentp) ) {
                   QString points = rxPoints.cap(2);
                   QPointF topleft = topLeftFromPoints(points);
                   pair.first = topleft;
                   pair.second = keyitem;
                   result [ namenode ] = pair;
                  }
                 else {
                     currentp = xml.indexOf( rxEllipse, current);
                     if ( currentp != -1) {
                         QString points = rxEllipse.cap(1);
                         qDebug("nodo:|%s|....rxEllipse:|%s|",qPrintable(namenode),qPrintable(points));
                         QPointF topleft = topLeftFromEllipse(points);
                         pair.first = topleft;
                         pair.second = keyitem;
                         result [ namenode ] = pair;
                     }
                     else {
                         qDebug("ERROR DE ELLIPSE");
                     }

                 }
               }

           }
           else {
               break;
           }

     }
     //result.append("graph0");
     return result;

}