예제 #1
0
	void FileSharingWidget::connectImageDownloadedSignal(const bool isConnected)
	{
		connectCoreSignal(
			SIGNAL(imageDownloaded(qint64, QString, QPixmap, QString)),
			SLOT(imageDownloaded(qint64, QString, QPixmap, QString)),
			isConnected);
	}
예제 #2
0
void KryptoniteJobCoverDiscogs::parseImagesHtml( const QByteArray &data, const QVariant &payload )
{
   emit message( tr( "Parsing discogs.com images page" ), data );
   // <div class="image"><a href="/viewimages?release=753791"><img src="http://s.pixogs.com/image/R-150-753791-1155372972.jpeg" alt="Revolverheld - Revolverheld" />
   QRegExp imgRe1( ".*<img[^>]*class=\"shadow image_frame\"[^>]*src=\"([^\"]*)\".*" );
   QRegExp imgRe2( ".*<div class=\"image\">.*<img[^>]*src=\"([^\"]*)\".*" );
   QString s( QString::fromUtf8(data.constData()) );
   QStringList l( s.split("\n", QString::SkipEmptyParts) );
   foreach( s, l )
   {
      if( s.contains( imgRe1 ) )
      {
         QUrl imgUrl( QString(s).replace( imgRe1, "\\1" ) );
         emit requestDownload( this, SIGNAL(imageDownloaded(QByteArray,QVariant)), imgUrl, payload );
         return;
      }
      else if( s.contains( imgRe2 ) )
      {
         QUrl imgUrl( QString(s).replace( imgRe2, "\\1" ) );
         emit requestDownload( this, SIGNAL(imageDownloaded(QByteArray,QVariant)), imgUrl, payload );
         return;
      }
   }
}
예제 #3
0
파일: MainWidget.cpp 프로젝트: SvOlli/SLART
MainWidget::MainWidget( QWidget *parent )
: QSplitter( Qt::Horizontal, parent )
, mpKryptonite( new Kryptonite() )
, mpAmazonDE( new KryptoniteJobCoverAmazonDE( mpKryptonite ) )
, mpDiscogs( new KryptoniteJobCoverDiscogs( mpKryptonite ) )
, mpLayout( new QGridLayout( this ) )
, mpFileSysTree( new QTreeView( this ) )
, mpFileSysModel( new QFileSystemModel( this ) )
, mpLineEdit( new QLineEdit( this ) )
, mpFollowPartyman( new QCheckBox( tr("Follow Partyman"), this ) )
, mpCopyBuffer( new QPushButton( tr("Copy debug buffer to clipboard"), this ) )
, mpImage( new DropImageWidget( this ) )
, mpInfo( new QListWidget( this ) )
, mpSignalMapper( new QSignalMapper( this ) )
, mDataMap()
, mCacheMap()
, mDebugData()
{
   mpKryptonite->setObjectName( "Downloader");
   mpAmazonDE->setObjectName( "Amazon" );
   mpDiscogs->setObjectName( "Discogs" );
   mpFileSysTree->setObjectName( "FileSysTree" );
   mpFileSysModel->setObjectName( "FileSysModel" );
   mpLineEdit->setObjectName( "LineInput" );
   mpFollowPartyman->setObjectName( "FollowPartyman" );
   mpFollowPartyman->setChecked( true );
   mpCopyBuffer->setObjectName( "CopyBuffer" );
   mpImage->setObjectName( "Image" );
   mpInfo->setObjectName( "Info" );
   QThread *t = new QThread();
   connect( qApp, SIGNAL(aboutToQuit()),
            t, SLOT(quit()) );
   ProxyWidget::setProxy( mpKryptonite->networkAccessManager() );
   mpKryptonite->moveToThread( t );
   mpAmazonDE->moveToThread( t );
   mpDiscogs->moveToThread( t );
   t->setObjectName( "DownloadThread" );
   t->start();
   QWidget *w = 0;
   mpFileSysTree->setModel( mpFileSysModel );
   mpFileSysModel->setRootPath( "/" );
   mpFileSysModel->setFilter( QDir::NoDotAndDotDot | QDir::AllDirs );
   const QString current( Settings::value( Settings::RubberbandmanRootDirectory ) );
   QModelIndex qmi( mpFileSysModel->index( current ) );
   if( qmi.isValid() )
   {
      mpFileSysTree->setRootIndex( qmi );
      mpFileSysTree->setCurrentIndex( mpFileSysModel->index( current ) );
   }
   mpFileSysTree->header()->hide();
   mpFileSysTree->setColumnHidden( 1, true );
   mpFileSysTree->setColumnHidden( 2, true );
   mpFileSysTree->setColumnHidden( 3, true );

   QSplitter *s = new QSplitter( Qt::Vertical, this );
   w = new QWidget( this );
   QVBoxLayout *v = new QVBoxLayout( w );
   v->addWidget( mpFileSysTree );
   v->addWidget( mpLineEdit );
   QHBoxLayout *h = new QHBoxLayout();
   v->addLayout( h );
   h->addWidget( mpFollowPartyman );
   h->addWidget( mpCopyBuffer );
   s->addWidget( w );
   w = new QWidget( this );
   w->setLayout( mpLayout );
   s->addWidget( w );
   addWidget( s );
   w = new QWidget( this );
   v = new QVBoxLayout( w );
   v->addWidget( mpImage );
   v->addWidget( mpInfo );
   addWidget( w );
   v->setStretch( 0, 1 );
   Satellite *satellite = Satellite::get();

   connect( mpImage, SIGNAL(droppedUrl(QUrl)),
            this, SLOT(saveImage(QUrl)) );
   connect( mpCopyBuffer, SIGNAL(clicked()),
            this, SLOT(debugBufferToClipboard()) );
   connect( mpLineEdit, SIGNAL(returnPressed()),
            this, SLOT(requestFromLine()) );
   connect( mpFileSysTree, SIGNAL(clicked(QModelIndex)),
            this, SLOT(entryClicked(QModelIndex)) );
   connect( mpSignalMapper, SIGNAL(mapped(QWidget*)),
            this, SLOT(saveImage(QWidget*)) );
   connect( this, SIGNAL(requestSearch(QString)),
            mpDiscogs, SLOT(requestList(QString)) );
   connect( mpDiscogs, SIGNAL(imageFound(QByteArray,QVariant)),
            this, SLOT(addThumbnail(QByteArray,QVariant)) );
   connect( mpDiscogs, SIGNAL(imageDownloaded(QByteArray,QVariant)),
            this, SLOT(showImage(QByteArray,QVariant)) );
   connect( mpDiscogs, SIGNAL(message(QString,QByteArray)),
            this, SLOT(message(QString,QByteArray)) );
   connect( this, SIGNAL(requestSearch(QString)),
            mpAmazonDE, SLOT(requestList(QString)) );
   connect( mpAmazonDE, SIGNAL(imageFound(QByteArray,QVariant)),
            this, SLOT(addThumbnail(QByteArray,QVariant)) );
   connect( mpAmazonDE, SIGNAL(imageDownloaded(QByteArray,QVariant)),
            this, SLOT(showImage(QByteArray,QVariant)) );
   connect( mpAmazonDE, SIGNAL(message(QString,QByteArray)),
            this, SLOT(message(QString,QByteArray)) );
   connect( satellite, SIGNAL(received(QByteArray)),
            this, SLOT(handleSatelliteMessage(QByteArray)) );

   QList<int> sizes;
   sizes << 30 << 300;
   s->setSizes( sizes );
}