bool anibutton::setani(QString sRes) { QMovie* pMovie = new QMovie(sRes); connect(pMovie,SIGNAL(frameChanged(int)),this,SLOT(setButtonIcon(int))); if (pMovie->loopCount() != -1) //if movie doesn't loop forever, force it to connect(pMovie,SIGNAL(finished()),pMovie,SLOT(start())); pMovie->start(); if(!pMovie->isValid()) { helpers::log("anibutton:setani NOT.ok("+sRes+"):"+QString::number(pMovie->isValid()), LOG_WRN, qApp, 0); qDebug()<<QImageReader::supportedImageFormats(); return false; } return true; }
Connecting::Connecting(QWidget *parent) : QWidget(parent), m_client(NULL), m_task(NULL), state(0), tries(0) { ui.setupUi(this); connect(&m_timer, SIGNAL(timeout()), this, SLOT(proceed())); connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(abort())); QMovie* movie = new QMovie(":/preloader/cube"); // Make sure the GIF was loaded correctly if (!movie->isValid()) { // Something went wrong :( ui.preloader->setText("Loading"); } else { // Play GIF ui.preloader->setMovie(movie); movie->start(); } m_try_limit = 6; QFont fnt(ui.btnCancel->font()); fnt.setFamily("Ubuntu Light"); fnt.setPointSize(16); ui.btnCancel->setFont(fnt); }
void AutoResizeImageLabel::setImage( QString fileName, int frameCount ) { _nativeUsed = false; _frameCount = frameCount; QMovie* movie = new QMovie( fileName ); if ( movie->isValid() && //image files have FrameCount -1 ( movie->frameCount() == 0 || movie->frameCount() > 1 ) ) { //PLease Do not Leave out this line of Code Crucial for Pixture animated gif differentiation connect( movie, SIGNAL( frameChanged( int ) ), this, SLOT( animationFrameChanged( int ) ) ); setMovie_internal( movie ); } else {
void ReceiveCoinsDialog::showBuyGuldenDialog() { #ifdef WIN32 if (WIN32) { QDesktopServices::openUrl(QUrl("https://gulden.com/purchase")); return; } #endif #if defined(HAVE_WEBENGINE_VIEW) || defined(HAVE_WEBKIT) ui->receiveCoinsStackedWidget->setCurrentIndex(1); ui->accountRequestPaymentButtonComposite->setVisible(false); ui->accountBuyGuldenButton->setVisible(false); ui->accountSaveQRButtonComposite->setVisible(false); ui->accountCopyToClipboardButtonComposite->setVisible(false); ui->cancelButton->setVisible(true); ui->closeButton->setVisible(false); ui->cancelButtonGroup->setVisible(true); ui->generateRequestButton->setVisible(false); ui->generateAnotherRequestButton->setVisible(false); ui->accountBuyButton->setVisible(true); QMovie* movie = new QMovie(":/Gulden/loading_animation"); if (movie && movie->isValid()) { ui->loadingAnimationLabel->setVisible(true); buyView->setVisible(false); movie->setScaledSize(QSize(30, 30)); ui->loadingAnimationLabel->setMovie(movie); movie->start(); } else { ui->loadingAnimationLabel->setVisible(false); buyView->setVisible(true); if (movie) delete movie; } buyView->load(QUrl("https://gulden.com/purchase")); #if defined(HAVE_WEBENGINE_VIEW) buyView->page()->setBackgroundColor(Qt::transparent); #else QPalette palette = buyView->palette(); palette.setBrush(QPalette::Base, Qt::transparent); buyView->page()->setPalette(palette); buyView->setAttribute(Qt::WA_OpaquePaintEvent, false); buyView->page()->setLinkDelegationPolicy(QWebPage::DontDelegateLinks); #endif connect(buyView, SIGNAL(loadFinished(bool)), this, SLOT(loadBuyViewFinished(bool))); #endif }
void VideoStackedWidget::setImageContentType( QString imageUrl ) { if( imageUrl.isEmpty() ) return; QMovie *animatedImage = new QMovie( imageUrl ); _origPixmap = QPixmap( imageUrl ); if( animatedImage->isValid() && ( animatedImage->frameCount() == 0 || animatedImage->frameCount() > 1 ) ) setAnimatedImage( animatedImage, false ); else setPixmap( _origPixmap, false ); }
void VideoStackedWidget::setBufferingAnimation( QString animationUrl, int frameCount ) { if( animationUrl.isEmpty() ) return; QMovie *animatedImage = new QMovie( animationUrl ); _origPixmap = QPixmap( animationUrl ); if( animatedImage->isValid() ) { _currentBufferingAnimation = animatedImage; _currentBufferingAnimationFrameCount = frameCount; connect( _currentBufferingAnimation, SIGNAL( frameChanged( int ) ), this, SLOT( animationFrameChangedSlot( int ) ) ); setAnimatedImage( animatedImage, true ); }
bool DataMediaWidget::updateWidget(const IDataMediaURI &AUri, const QByteArray &AData) { bool success = false; if (AUri.type == MEDIAELEM_TYPE_IMAGE) { QBuffer *buffer = new QBuffer(this); buffer->setData(AData); buffer->open(QIODevice::ReadOnly); QImageReader reader(buffer); if (reader.supportsAnimation()) { QMovie *movie = new QMovie(buffer,reader.format(),this); if (movie->isValid()) { success = true; setMovie(movie); movie->start(); } else { delete movie; } } else { QPixmap pixmap; pixmap.loadFromData(AData,reader.format()); if (!pixmap.isNull()) { success = true; setPixmap(pixmap); } } if (success) { setFrameShape(QLabel::NoFrame); setFrameShadow(QLabel::Plain); disconnect(FDataForms->instance()); emit mediaShown(); } else { delete buffer; } } return success; }
phoneInfo::phoneInfo(QWidget *parent) : QDialog(parent), ui(new Ui::phoneInfo) { setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint); setWindowOpacity(1); ui->setupUi(this); ui->label_show_gif->setHidden(true); ui->label_show_info->setHidden(true); QMovie *movie = new QMovie(":/wizard/pic/res/loading1.gif"); ui->label_show_gif->setMovie(movie); qDebug()<<movie->isValid(); // ui->label->setMinimumSize(); movie->start(); // ui->label->setHidden(true); }