void WMWindow::slotStartTransfer() { saveSettings(); KUrl::List urls = iface()->currentSelection().images(); QMap <QString,QMap <QString,QString> > imagesDesc=m_widget->allImagesDesc(); for (int i = 0; i < urls.size(); ++i) { QString caption; QString url; if(m_widget->resize()){ prepareImageForUpload(urls.at(i).path(), caption); ; imagesDesc.insert(m_tmpPath, imagesDesc.take(urls.at(i).path())); } } m_uploadJob->setImageMap(imagesDesc); m_widget->progressBar()->setRange(0, 100); m_widget->progressBar()->setValue(0); connect(m_uploadJob, SIGNAL(uploadProgress(int)), m_widget->progressBar(), SLOT(setValue(int))); connect(m_uploadJob, SIGNAL(endUpload()), this, SLOT(slotEndUpload())); m_widget->progressBar()->show(); m_widget->progressBar()->progressScheduled(i18n("Wiki Export"), true, true); m_widget->progressBar()->progressThumbnailChanged(KIcon("kipi").pixmap(22, 22)); m_uploadJob->begin(); }
void SmugWindow::uploadNextPhoto() { if (m_transferQueue.isEmpty()) { setUiInProgressState(false); return; } m_widget->m_imgList->processing(m_transferQueue.first()); QUrl imgPath = m_transferQueue.first(); KPImageInfo info(imgPath); m_widget->progressBar()->setMaximum(m_imagesTotal); m_widget->progressBar()->setValue(m_imagesCount); bool res; if (m_widget->m_resizeChB->isChecked()) { if (!prepareImageForUpload(imgPath.toLocalFile())) { slotAddPhotoDone(666, i18n("Cannot open file")); return; } res = m_talker->addPhoto(m_tmpPath, m_currentAlbumID, m_currentAlbumKey, info.description()); } else { m_tmpPath.clear(); res = m_talker->addPhoto(imgPath.toLocalFile(), m_currentAlbumID, m_currentAlbumKey, info.description()); } if (!res) { slotAddPhotoDone(666, i18n("Cannot open file")); return; } }
void DsWindow::uploadNextPhoto() { if (m_transferQueue.isEmpty()) { m_widget->progressBar()->hide(); return; } m_widget->m_imgList->processing(m_transferQueue.first()); QString imgPath = m_transferQueue.first().toLocalFile(); m_widget->progressBar()->setMaximum(m_imagesTotal); m_widget->progressBar()->setValue(m_imagesCount); // screenshots.debian.net only accepts PNG images, 800x600 max MassageType massageRequired = DsWindow::None; // check if format is PNG QImageReader imgReader(imgPath); QByteArray imgFormat = imgReader.format(); if( QString::compare(QString(imgFormat), QString("PNG"), Qt::CaseInsensitive) != 0 ) { massageRequired = DsWindow::NotPNG; } // check if image > 800x600 QImage img = imgReader.read(); if( (img.width() > maxWidth) || (img.height() > maxHeight) ) { massageRequired = DsWindow::ResizeRequired; } // check if we have to RAW file -> use preview image then if( KPMetadata::isRawFile(imgPath) ) { massageRequired = DsWindow::ImageIsRaw; } bool res; if (massageRequired) { if (!prepareImageForUpload(imgPath, massageRequired)) { slotAddScreenshotDone(666, i18n("Cannot open file")); return; } res = m_talker->addScreenshot(m_tmpPath, m_widget->m_pkgLineEdit->text(), m_widget->m_versionsComboBox->currentText(), m_widget->m_descriptionLineEdit->text()); } else { m_tmpPath.clear(); res = m_talker->addScreenshot(imgPath, m_widget->m_pkgLineEdit->text(), m_widget->m_versionsComboBox->currentText(), m_widget->m_descriptionLineEdit->text()); } if (!res) { slotAddScreenshotDone(666, i18n("Cannot open file")); return; } }
void SwWindow::uploadNextPhoto() { if (m_transferQueue.isEmpty()) { // done! m_progressDlg->hide(); if (m_imagesTotal > 0) { SwAlbum album = m_albumsList.at( m_widget->m_albumsCoB->currentIndex() ); KMessageBox::information(this, i18n("Upload complete. Visit \"<a href=\"%1\">%2</a>\" to view the album online and invite people.", album.albumUrl, album.title), i18n("Upload complete"), QString(), KMessageBox::AllowLink ); } return; } m_progressDlg->progressBar()->setMaximum(m_imagesTotal); m_progressDlg->progressBar()->setValue(m_imagesCount); QString imgPath = m_transferQueue.first().path(); QString caption; bool res; // check if we have to RAW file -> use preview image then bool isRAW = KPMetadata::isRawFile(QUrl::fromLocalFile(imgPath)); if (isRAW || m_widget->m_resizeChB->isChecked()) { if (!prepareImageForUpload(imgPath, isRAW, caption)) { slotAddPhotoDone(666, i18n("Cannot open file")); return; } res = m_connector->addPhoto(m_tmpPath, m_currentAlbumID, caption); } else { KPMetadata meta; if (meta.load(imgPath)) caption = getImageCaption(meta); else caption.clear(); m_tmpPath.clear(); res = m_connector->addPhoto(imgPath, m_currentAlbumID, caption); } if (!res) { slotAddPhotoDone(666, i18n("Cannot open file")); return; } m_progressDlg->setLabelText(i18n("Uploading file %1", m_transferQueue.first().path())); }