コード例 #1
0
ファイル: PopupDropperItem.cpp プロジェクト: ErrAza/amarok
void PopupDropperItem::setElementId( const QString &id )
{
    //qDebug() << "Element ID being set: " << id;
    d->elementId = id;
    if( id.isEmpty() )
    {
        d->svgItem->hide();
        fullUpdate();
    }
    else if( d->svgItem && d->svgItem->renderer() && d->svgItem->renderer()->elementExists( id ))
    {
        d->svgItem->setElementId( id );
        d->svgItem->show();
        fullUpdate();
    }
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: timofonic/cr3
void MainWindow::fineUpdate()
{
    if ( 0 == updateInterval || --updateCounter > 0 )
        fastUpdate();
    else
        fullUpdate();
}
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: timofonic/cr3
void MainWindow::on_actionPosition_triggered()
{
    GoToDialog dlg(this, 1+ui->view->getCurPage(), ui->view->getPageCount());
    if ( dlg.exec() && dlg.getCurrentPage()-1 != ui->view->getCurPage() )
    {
        ui->view->GoToPage(dlg.getCurrentPage()-1);
        fullUpdate();
    }
}
コード例 #4
0
ファイル: mainwindow.cpp プロジェクト: timofonic/cr3
void MainWindow::on_actionTOC_triggered()
{
    TocDlg dlg(this, ui->view);
    if ( dlg.exec() )
    {
        ui->view->GoToPage( dlg.getPage() );
        fullUpdate();
    }
}
コード例 #5
0
ファイル: rtorrentclient.cpp プロジェクト: fuCtor/rwin
RTorrentClient::RTorrentClient(QObject *parent)
	: RITorrent(parent)
{
	RITorrent::command("view_list"); 
	get_info("get_download_rate");
	get_info("get_upload_rate");
	update();
	fullUpdate();
}
コード例 #6
0
ファイル: mainimpl.cpp プロジェクト: fuCtor/rwin
void MainDialogImpl::loaded(QString id){
	if(sender()==sys)
	{
		tray->connected();
		disconnect(sender(),0,this,0);
		rtc = new RTorrentClient(parent());
		//update rate value
		connect(rtc,SIGNAL(changeUpRate(double)),
			tray,SIGNAL(getUpRate(double)));
		connect(rtc,SIGNAL(changeDownRate(double)),
			tray,SIGNAL(getDownRate(double)));
		
		//set new rate limit value
		connect(tray,SIGNAL(setUploadRate(int)),
			rtc,SLOT(setUploadRate(int)));
		connect(tray,SIGNAL(setDownloadRate(int)),
			rtc,SLOT(setDownloadRate(int)));

		//update rate limit value
		connect(rtc,SIGNAL(changeUploadRate(int)),
			tray,SIGNAL(getUploadRate(int)));
		connect(rtc,SIGNAL(changeDownloadRate(int)),
			tray,SIGNAL(getDownloadRate(int)));


		//connect update on show/hide event
		connect(tray,SIGNAL(menuShow()),
			rtc, SLOT(fullUpdate()));
		connect(tray,SIGNAL(menuShow()),
			rtc, SLOT(enableAutoUpdate()));
		connect(tray,SIGNAL(menuHide()),
			rtc, SLOT(disableAutoUpdate()));
		
		//-------
		connect(rtc,SIGNAL(updated(QString)),
			this,SLOT(loaded(QString)));
	}
	QSettings settings;
	QString view = settings.value("view","incomplete").toString();
	if(sender()==rtc)
	{
		disconnect(sender(),0,this,0);
		rtc->using_views << view;
		rtc->loadUsingViews();
		connect(rtc->torrents[view],SIGNAL(updated(QString)),
			this,SLOT(loaded(QString)));
		
	}
	if(id == view){
		disconnect(sender(),0,this,0);
		int tc = rtc->torrents[view]->count();
		for(int i = 0; i < tc; i++)
			tray->addTorrent(&((*rtc->torrents[view])[i]));

	}
}
コード例 #7
0
ファイル: mainwindow.cpp プロジェクト: timofonic/cr3
void MainWindow::on_actionShowBookmarksList_triggered()
{
    BookmarkListDialog dlg(this, ui->view);
    if ( dlg.exec() )
    {
        CRBookmark* bm = dlg.selectedBookmark();
        if ( bm )
        {
            ui->view->goToBookmark(bm);
            fullUpdate();
        }
    }
}
コード例 #8
0
ファイル: PopupDropperItem.cpp プロジェクト: ErrAza/amarok
void PopupDropperItem::setSharedRenderer( QSvgRenderer *renderer )
{
    d->sharedRenderer = renderer;
    if( renderer && d->svgItem )
    {
        d->svgItem->setSharedRenderer( renderer );
        d->svgItem->setElementId( d->elementId );
        if( !d->svgItem->elementId().isEmpty() && d->svgItem->renderer()->elementExists( d->svgItem->elementId() ) )
        {
            d->svgItem->show();
            fullUpdate();
        }
    }
}
コード例 #9
0
ファイル: traymenu.cpp プロジェクト: fuCtor/rwin
void TrayMenu::addTorrent(RTorrent * torrent)
{
	no_torrent->setVisible(false);
	InfoAction * action = 0;
	QWidgetAction * waction = 0;
	QMenu * tmenu = new QMenu(menu);
	tmenu->setTitle(tr("Loading..."));

	//Add caption
	QLabel * lbl =  new QLabel(tr("<b>Torrent's info</b>"));
	lbl->setAlignment(Qt::AlignHCenter);
	waction = new QWidgetAction(tmenu);
	waction->setDefaultWidget(lbl);
	tmenu->addAction(waction);
	connect(torrent,SIGNAL(changeName(QString)),
		this,SLOT(changeName(QString)));

	//Add rate status
	action = new InfoAction(tmenu);
	action->setText(tr("%1, %2"));
	action->setText1(tr("UP: %1 kb/s"));
	action->setText2(tr("DOWN: %1 kb/s"));

	action->setParam1(tr("N/A"));
	action->setParam2(tr("N/A"));

	action->setIcon(QIcon(":/img/updown.png"));

	connect(torrent,SIGNAL(changeDownRate(double)),
		action,SLOT(setParam2(double)));

	connect(torrent,SIGNAL(changeUpRate(double)),
		action,SLOT(setParam1(double)));
	
	tmenu->addAction(action);

	//Add rateio status
	action = new InfoAction(tmenu);
	action->setText(tr("%1"));
	action->setText1(tr("Rateio: %1"));
	action->setParam1(tr("N/A"));

	connect(torrent,SIGNAL(changeRatio(double)),
		action,SLOT(setParam1(double)));
	tmenu->addAction(action);

	//Add progress
	QProgressBar * bar = new QProgressBar(tmenu);
	bar->setAlignment(Qt::AlignHCenter);
	waction = new QWidgetAction(tmenu);
	waction->setDefaultWidget(bar);
	tmenu->addAction(waction);

	connect(torrent,SIGNAL(changeCompletedChunks(int)),
		bar,SLOT(setValue(int)));

	connect(torrent,SIGNAL(changeSizeChunks(int)),
		bar,SLOT(setMaximum(int)));
	connect(torrent,SIGNAL(changeCompletedChunks(int)),
		this,SLOT(changeCompletedChunks(int)));

	//Add priority
	QComboBox * combo =  new QComboBox(tmenu);
	combo->addItem(QIcon(),tr("Idle"));
	combo->addItem(QIcon(),tr("Low"));
	combo->addItem(QIcon(),tr("Normal"));
	combo->addItem(QIcon(),tr("High"));
	combo->setEditable(false);

	waction = new QWidgetAction(tmenu);
	waction->setDefaultWidget(combo);
	tmenu->addAction(waction);

	connect(torrent,SIGNAL(changePriority(int)),
		combo,SLOT(setCurrentIndex (int)));
	connect(combo,SIGNAL(activated(int)),
		torrent,SLOT(setPriority(int)));
	
	//Other
	connect(torrent,SIGNAL(changeChunkSize(long)),
		this,SLOT(changeChunkSize(long)));
	connect(torrent,SIGNAL(changeState(int)),
		this,SLOT(changeState(int)));

	tmenu->addSeparator();
	QAction * command = 0;

	//control action
	command = tmenu->addAction(QIcon(":/img/close.png"),tr("Close"));
	connect(command,SIGNAL(triggered (bool)),
		torrent,SLOT(close(bool)));
	command = tmenu->addAction(QIcon(":/img/open.png"),tr("Start"));
	connect(command,SIGNAL(triggered (bool)),
		torrent,SLOT(start(bool)));
	command = tmenu->addAction(QIcon(":/img/stop.png"),tr("Stop"));
	connect(command,SIGNAL(triggered (bool)),
		torrent,SLOT(stop(bool)));
	command = tmenu->addAction(QIcon(":/img/rehash0.png"),tr("Rehash"));
	connect(command,SIGNAL(triggered (bool)),
		torrent,SLOT(check_hash(bool)));
	command = tmenu->addAction(QIcon(":/img/erase.png"),tr("Erase"));
	connect(command,SIGNAL(triggered (bool)),
		torrent,SLOT(erase(bool)));

	//connect AutoUpdate when menu visible
	connect(tmenu,SIGNAL(aboutToShow()),
		torrent, SLOT(fullUpdate()));
	connect(tmenu,SIGNAL(aboutToShow()),
		torrent,SLOT(enableAutoUpdate()));
	connect(tmenu,SIGNAL(aboutToHide()),
		torrent,SLOT(disableAutoUpdate()));

	torrents[torrent->getId()] = tmenu;
	menu->insertMenu(sep,tmenu);
}
コード例 #10
0
ファイル: mainwindow.cpp プロジェクト: timofonic/cr3
void MainWindow::on_actionToggleHeader_triggered()
{
    ui->view->toggleProperty(PROP_STATUS_LINE);
    fullUpdate();
}
コード例 #11
0
ファイル: mainwindow.cpp プロジェクト: timofonic/cr3
void MainWindow::on_actionToggleInversion_triggered()
{
    ui->view->toggleProperty(PROP_DISPLAY_INVERSE);
    fullUpdate();
}
コード例 #12
0
ファイル: mainwindow.cpp プロジェクト: timofonic/cr3
void MainWindow::on_actionLastPage_triggered()
{
    ui->view->doCommand( DCMD_END, 1 );
    fullUpdate();
}
コード例 #13
0
ファイル: mainwindow.cpp プロジェクト: timofonic/cr3
void MainWindow::on_actionFirstPage_triggered()
{
    ui->view->doCommand( DCMD_BEGIN, 1 );
    fullUpdate();
}
コード例 #14
0
ファイル: layercache.cpp プロジェクト: karottenreibe/FIFE
void LayerCache::update(Camera::Transform transform, RenderList& renderlist) {
    const double OVERDRAW = 2.5;
    renderlist.clear();
    m_needupdate = false;
    if(!m_layer->areInstancesVisible()) {
        FL_DBG(_log, "Layer instances hidden");
        return;
    }
    bool isWarped = transform == Camera::WarpedTransform;
    if( isWarped ) {
        fullUpdate();
    }

    Rect viewport = m_camera->getViewPort();
    Rect screen_viewport = viewport;
    double zoom = m_camera->getZoom();
    DoublePoint3D viewport_a = m_camera->screenToVirtualScreen(Point3D(viewport.x, viewport.y));
    DoublePoint3D viewport_b = m_camera->screenToVirtualScreen(Point3D(viewport.right(), viewport.bottom()));
    viewport.x = static_cast<int32_t>(std::min(viewport_a.x, viewport_b.x));
    viewport.y = static_cast<int32_t>(std::min(viewport_a.y, viewport_b.y));
    viewport.w = static_cast<int32_t>(std::max(viewport_a.x, viewport_b.x) - viewport.x);
    viewport.h = static_cast<int32_t>(std::max(viewport_a.y, viewport_b.y) - viewport.y);
    uint8_t layer_trans = m_layer->getLayerTransparency();

    double zmin = 0.0, zmax = 0.0;

    // FL_LOG(_log, LMsg("camera-update viewport") << viewport);
    std::vector<int32_t> index_list;
    collect(viewport, index_list);
    for(unsigned i=0; i!=index_list.size(); ++i) {
        Entry& entry = m_entries[index_list[i]];
        // NOTE
        // An update is forced if the item has an animation/action.
        // This update only happens if it is _already_ included in the viewport
        // Nevertheless: Moving instances - which might move into the viewport will be updated
        // By the layer change listener.
        if(entry.force_update || !isWarped) {
            updateEntry(entry);
        }

        RenderItem& item = m_instances[entry.instance_index];
        InstanceVisual* visual = item.instance->getVisual<InstanceVisual>();
        bool visible = (visual->isVisible() != 0);
        uint8_t instance_trans = visual->getTransparency();
        if(!item.image || !visible || (instance_trans == 255 && layer_trans == 0)
                || (instance_trans == 0 && layer_trans == 255)) {
            continue;
        }

        if(layer_trans != 0) {
            if(instance_trans != 0) {
                uint8_t calc_trans = layer_trans - instance_trans;
                if(calc_trans >= 0) {
                    instance_trans = calc_trans;
                } else {
                    instance_trans = 0;
                }
            } else {
                instance_trans = layer_trans;
            }
        }

        Point3D screen_point = m_camera->virtualScreenToScreen(item.screenpoint);
        // NOTE:
        // One would expect this to be necessary here,
        // however it works the same without, sofar
        // m_camera->calculateZValue(screen_point);
        // item.screenpoint.z = -screen_point.z;

        item.dimensions.x = screen_point.x;
        item.dimensions.y = screen_point.y;
        item.dimensions.w = item.bbox.w;
        item.dimensions.h = item.bbox.h;

        item.transparency = 255 - instance_trans;

        if (zoom != 1.0) {
            // NOTE: Due to image alignment, there is additional additions on image dimensions
            //       There's probabaly some better solution for this, but works "good enough" for now.
            //       In case additions are removed, gaps appear between tiles.
            item.dimensions.w = unsigned(double(item.bbox.w) * zoom + OVERDRAW);
            item.dimensions.h = unsigned(double(item.bbox.h) * zoom + OVERDRAW);
        }

        if (!m_need_sorting) {
            zmin = std::min(zmin, item.screenpoint.z);
            zmax = std::max(zmax, item.screenpoint.z);
        }

        if(item.dimensions.intersects(screen_viewport)) {
            renderlist.push_back(&item);
        }
    }

    if (m_need_sorting) {
        InstanceDistanceSort ids;
        std::stable_sort(renderlist.begin(), renderlist.end(), ids);
    } else {
        zmin -= 0.5;
        zmax += 0.5;

        // We want to put every z value in [-10,10] range.
        // To do it, we simply solve
        // { y1 = a*x1 + b
        // { y2 = a*x2 + b
        // where [y1,y2]' = [-10,10]' is required z range,
        // and [x1,x2]' is expected min,max z coords.
        double det = zmin - zmax;
        if (fabs(det) > FLT_EPSILON) {
            double det_a = -10.0 - 10.0;
            double det_b = 10.0 * zmin - (-10.0) * zmax;
            double a = static_cast<float>(det_a / det);
            double b = static_cast<float>(det_b / det);
            float estimate = sqrtf(static_cast<float>(renderlist.size()));
            float stack_delta = fabs(-10.0f - 10.0f) / estimate * 0.1f;

            RenderList::iterator it = renderlist.begin();
            for ( ; it != renderlist.end(); ++it) {
                double& z = (*it)->screenpoint.z;
                z = a * z + b;
                InstanceVisual* vis = (*it)->instance->getVisual<InstanceVisual>();
                z += vis->getStackPosition() * stack_delta;
            }
        }
    }
    //  FL_LOG(_log, LMsg("camera-update ") << " N=" <<renderlist.size() << "/" << m_instances.size() << "/" << index_list.size());
}
コード例 #15
0
ファイル: PopupDropperItem.cpp プロジェクト: ErrAza/amarok
void PopupDropperItem::setTextProtection( const TextProtection textProtection )
{
    d->textProtection = textProtection;
    fullUpdate();
}
コード例 #16
0
ファイル: PopupDropperItem.cpp プロジェクト: ErrAza/amarok
void PopupDropperItem::setOrientation( const Orientation orientation )
{
    d->orientation = orientation;
    fullUpdate();
}