Ejemplo n.º 1
0
void Themes::on_SliderSpeed_valueChanged(int value)
{
	if(!ui->checkBoxShowSpeed->isChecked())
		return;
	switch(value)
	{
		case 0:
			currentSpeed=0;
		break;
		case 1:
			currentSpeed=1024;
		break;
		case 2:
			currentSpeed=1024*4;
		break;
		case 3:
			currentSpeed=1024*16;
		break;
		case 4:
			currentSpeed=1024*64;
		break;
		case 5:
			currentSpeed=1024*128;
		break;
	}
	ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("value: %1").arg(value));
	emit newSpeedLimitation(currentSpeed);
	updateSpeed();
}
Ejemplo n.º 2
0
void Themes::uiUpdateSpeed()
{
	if(ui->checkBoxShowSpeed->isChecked())
		return;
	if(!ui->checkBox_limitSpeed->isChecked())
		currentSpeed=0;
	else
		currentSpeed=ui->limitSpeed->value();
	ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("emit newSpeedLimitation(%1)").arg(currentSpeed));
	emit newSpeedLimitation(currentSpeed);
}
Ejemplo n.º 3
0
/** \brief support speed limitation */
void Themes::setSupportSpeedLimitation(const bool &supportSpeedLimitationBool)
{
    if(!supportSpeedLimitationBool)
    {
        ui->label_Slider_speed->setVisible(false);
        ui->SliderSpeed->setVisible(false);
        ui->label_SpeedMaxValue->setVisible(false);
        uiOptions->labelShowSpeedAsMain->setVisible(false);
        uiOptions->checkBoxShowSpeed->setVisible(false);
    }
    else
        emit newSpeedLimitation(currentSpeed);
}
Ejemplo n.º 4
0
void Themes::updateSpeed()
{
	ui->groupBoxSpeedLimit->setVisible(!ui->checkBoxShowSpeed->isChecked());
	ui->label_Slider_speed->setVisible(ui->checkBoxShowSpeed->isChecked());
	ui->SliderSpeed->setVisible(ui->checkBoxShowSpeed->isChecked());
	ui->label_SpeedMaxValue->setVisible(ui->checkBoxShowSpeed->isChecked());

	if(ui->checkBoxShowSpeed->isChecked())
	{
		ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"checked");
		ui->limitSpeed->setEnabled(false);
		if(currentSpeed==0)
		{
			ui->SliderSpeed->setValue(0);
			ui->label_SpeedMaxValue->setText(facilityEngine->translateText("Unlimited"));
		}
		else if(currentSpeed<=1024)
		{
			if(currentSpeed!=1024)
			{
				currentSpeed=1024;
				emit newSpeedLimitation(currentSpeed);
			}
			ui->SliderSpeed->setValue(1);
			ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*1));
		}
		else if(currentSpeed<=1024*4)
		{
			if(currentSpeed!=1024*4)
			{
				currentSpeed=1024*4;
				emit newSpeedLimitation(currentSpeed);
			}
			ui->SliderSpeed->setValue(2);
			ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*4));
		}
		else if(currentSpeed<=1024*16)
		{
			if(currentSpeed!=1024*16)
			{
				currentSpeed=1024*16;
				emit newSpeedLimitation(currentSpeed);
			}
			ui->SliderSpeed->setValue(3);
			ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*16));
		}
		else if(currentSpeed<=1024*64)
		{
			if(currentSpeed!=1024*64)
			{
				currentSpeed=1024*64;
				emit newSpeedLimitation(currentSpeed);
			}
			ui->SliderSpeed->setValue(4);
			ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*64));
		}
		else
		{
			if(currentSpeed!=1024*128)
			{
				currentSpeed=1024*128;
				emit newSpeedLimitation(currentSpeed);
			}
			ui->SliderSpeed->setValue(5);
			ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*128));
		}
	}
	else
	{
		ui->checkBox_limitSpeed->setChecked(currentSpeed>0);
		if(currentSpeed>0)
			ui->limitSpeed->setValue(currentSpeed);
		ui->checkBox_limitSpeed->setEnabled(currentSpeed!=-1);
		ui->limitSpeed->setEnabled(ui->checkBox_limitSpeed->isChecked());
	}
}
Ejemplo n.º 5
0
//speed limitation
bool Themes::setSpeedLimitation(const qint64 &speedLimitation)
{
    if(speedLimitation>0)
        emit newSpeedLimitation(0);
    return true;
}