SelectMovieDialog::SelectMovieDialog(QWidget *parent,const QString &content)
        :QDialog(parent)
{    
    setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
    QVBoxLayout *layout=new QVBoxLayout;

     QRegExp rx("<a class=\"all\" href=\"/level/1/film/(\\d+)/sr/1/\">(.*)</a>,&nbsp;<a.*>(\\d+)</a>");
     rx.setMinimal(true);
     QString str = content;
     int pos = 0;
     bool empty=true;
     while ((pos = rx.indexIn(str, pos)) != -1) {
         QCommandLinkButton *btn=new QCommandLinkButton(this);
         btn->setText(QString("%1 (%2)").arg(rx.cap(2)).arg(rx.cap(3)));
         btn->setObjectName(rx.cap(1));
         connect(btn,SIGNAL(clicked()),this,SLOT(selectMovie()));
         layout->addWidget(btn);

         empty=false;
         pos += rx.matchedLength();
     }
     if(empty){
        QLabel* lab = new QLabel(tr("Nothing Found :("), this);
        layout->addWidget(lab);
    }


     setLayout(layout);
}
Exemplo n.º 2
0
frmCorrect::frmCorrect(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
{
    ui.setupUi(this);

    setAttribute(Qt::WA_QuitOnClose, false);
    
    connect(ui.pbMovieSelect, SIGNAL(clicked()), this, SLOT(selectMovie()));
    connect(ui.pbSubtitlesSelect, SIGNAL(clicked()), this, SLOT(selectSubtitles()));
    connect(ui.leMovieSelect, SIGNAL(textChanged(QString)), this, SLOT(checkPostEnable()));
    connect(ui.leSubtitlesSelect, SIGNAL(textChanged(QString)), this, SLOT(checkPostEnable()));
    connect(ui.teComment, SIGNAL(textChanged()), this, SLOT(checkPostEnable()));
    connect(ui.pbPost, SIGNAL(clicked()), this, SLOT(pbPostClicked()));
    connect(&postThread, SIGNAL(postFinished(bool)), this, SLOT(postFinished(bool)));
    connect(&postThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass()));

    // workaround dla compiza?
    move((QApplication::desktop()->width() - width()) / 2, 
        (QApplication::desktop()->height() - height()) / 2);
}