Ejemplo n.º 1
0
CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
              : QLabel( parent ), p_intf( _p_i )
{
    setContextMenuPolicy( Qt::ActionsContextMenu );
    CONNECT( this, updateRequested(), this, askForUpdate() );

    setMinimumHeight( 128 );
    setMinimumWidth( 128 );
    setMaximumHeight( 128 );
    setScaledContents( false );
    setAlignment( Qt::AlignCenter );

    QList< QAction* > artActions = actions();
    QAction *action = new QAction( qtr( "Download cover art" ), this );
    CONNECT( action, triggered(), this, askForUpdate() );
    addAction( action );

    input_item_t *p_item = THEMIM->currentInputItem();
    if( p_item )
    {
        showArtUpdate( THEMIM->getIM()->decodeArtURL( p_item ) );
    }
    else
        showArtUpdate( "" );
}
Ejemplo n.º 2
0
CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
    : QLabel( parent ), p_intf( _p_i ), p_item( NULL )
{
    setContextMenuPolicy( Qt::ActionsContextMenu );
    CONNECT( THEMIM->getIM(), artChanged( input_item_t * ),
             this, showArtUpdate( input_item_t * ) );

    setMinimumHeight( 128 );
    setMinimumWidth( 128 );
    setScaledContents( false );
    setAlignment( Qt::AlignCenter );

    QAction *action = new QAction( qtr( "Download cover art" ), this );
    CONNECT( action, triggered(), this, askForUpdate() );
    addAction( action );

    action = new QAction( qtr( "Add cover art from file" ), this );
    CONNECT( action, triggered(), this, setArtFromFile() );
    addAction( action );

    p_item = THEMIM->currentInputItem();
    if( p_item )
        showArtUpdate( p_item );
    else
        showArtUpdate( "" );
}
Ejemplo n.º 3
0
/**
 * Tries to open a window from the the size of the input image.
 */
CanvasView::CanvasView( ImageModel *model, QWidget *parent ): QWidget(parent), _model(model) {
   _currentPosX=0;
   _currentPosY=0;
   _pixmap=new QPixmap(QPixmap::fromImage(_model->getImagePhysic(),Qt::ColorOnly));
   this->resize ((int)(_pixmap->width()),(int)(_pixmap->height()));
   connect(_model,SIGNAL(askForUpdate()),this,SLOT(update()));
   connect(_model,SIGNAL(draw()),this,SLOT(repaint()));
}
Ejemplo n.º 4
0
ProfileView::ProfileView( const ImageModel *model, bool row ): _model(model), _row(row) {
   const ImageSource *ims=_model->getImageSource();
   bool colored=ims->isColored();
   
   setAttribute(Qt::WA_QuitOnClose,false);
   Qt::WindowFlags flags = this->windowFlags();
   this->setWindowFlags(flags|Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);

   QFont f=font();
   f.setPointSize(10);
   setFont(f);

   _hFont=font().pointSize();
   if (_hFont==-1)
      _hFont=font().pixelSize();
   else
      _hFont+=2;

   if (_row) {
      setMinimumWidth(ims->Width()+10);
      if (colored) {
	 _h=64;
	 setMinimumHeight(_h*3+20+_hFont);
      } else {
	 _h=128;
	 setMinimumHeight(_h+10);}
   } else {
      setMinimumHeight(ims->Height()+10+_hFont);
      if (colored) {
	 _h=64;
	 setMinimumWidth(_h*3+20);
      } else {
	 _h=128;
	 setMinimumWidth(_h+10);
      }
   }
   
   _title=_model->windowTitle()+" - Profile";
   
   setWindowTitle(QString(_title));
   connect(_model,SIGNAL(askForUpdate()), this,SLOT(update()));
}