void KasTaskItem::startAutoThumbnail() { if ( thumbTimer ) return; if ( !kasbar()->thumbnailsEnabled() ) return; if ( kasbar()->thumbnailUpdateDelay() > 0 ) { thumbTimer = new QTimer( this, "thumbTimer" ); connect( thumbTimer, SIGNAL( timeout() ), SLOT( refreshThumbnail() ) ); thumbTimer->start( kasbar()->thumbnailUpdateDelay() * 1000 ); } QTimer::singleShot( 200, this, SLOT( refreshThumbnail() ) ); }
GameRow::GameRow(QWidget *parent, Game game) : QWidget(parent), game(game) { QHBoxLayout* rowLayout = new QHBoxLayout; downloadButton = new QPushButton("Download"); imageHolder = new QLabel(); double ratio = double(Game::COVER_WIDTH) / Game::COVER_HEIGHT; imageHolder->setFixedWidth(int(COVER_HEIGHT * ratio)); imageHolder->setFixedHeight(COVER_HEIGHT); imageHolder->setScaledContents(true); imageHolder->setObjectName("imageHolder"); downloadProgress = new QProgressBar(); downloadProgress->setMinimum(0); downloadProgress->setMaximum(100); rowLayout->addWidget(imageHolder); rowLayout->addWidget(new QLabel(game.title), 1); rowLayout->addWidget(downloadButton, 0); setLayout(rowLayout); connect(downloadButton, SIGNAL(clicked()), SLOT(onClickDownload())); refreshThumbnail(); }
void KasTaskItem::refreshThumbnail() { if ( !kasbar()->thumbnailsEnabled() ) return; if ( !task_->isActive() ) return; // TODO: Check if the popup obscures the window KasItem *i = kasbar()->itemUnderMouse(); if ( i && i->isShowingPopup() ) { QTimer::singleShot( 200, this, SLOT( refreshThumbnail() ) ); return; } task_->setThumbnailSize( kasbar()->thumbnailSize() ); task_->updateThumbnail(); }