summaryrefslogtreecommitdiff
path: root/plugins/Themes/Oxygen/interface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Themes/Oxygen/interface.cpp')
-rwxr-xr-xplugins/Themes/Oxygen/interface.cpp124
1 files changed, 67 insertions, 57 deletions
diff --git a/plugins/Themes/Oxygen/interface.cpp b/plugins/Themes/Oxygen/interface.cpp
index e080737..f01b811 100755
--- a/plugins/Themes/Oxygen/interface.cpp
+++ b/plugins/Themes/Oxygen/interface.cpp
@@ -10,7 +10,7 @@
#include "interface.h"
#include "ui_interface.h"
-Themes::Themes(bool checkBoxShowSpeed,FacilityInterface * facilityEngine) :
+Themes::Themes(bool checkBoxShowSpeed,FacilityInterface * facilityEngine,bool moreButtonPushed) :
ui(new Ui::interfaceCopy())
{
this->facilityEngine=facilityEngine;
@@ -28,8 +28,7 @@ Themes::Themes(bool checkBoxShowSpeed,FacilityInterface * facilityEngine) :
menu=new QMenu(this);
ui->add->setMenu(menu);
on_checkBoxShowSpeed_toggled(ui->checkBoxShowSpeed->isChecked());
- currentSpeed = -1;
- updateSpeed();
+ currentSpeed = 0;
storeIsInPause = false;
isInPause(false);
modeIsForced = false;
@@ -64,7 +63,7 @@ Themes::Themes(bool checkBoxShowSpeed,FacilityInterface * facilityEngine) :
newLanguageLoaded();
//unpush the more button
- ui->moreButton->setChecked(false);
+ ui->moreButton->setChecked(moreButtonPushed);
on_moreButton_toggled(false);
/// \note important for drag and drop, \see dropEvent()
@@ -132,6 +131,12 @@ Themes::Themes(bool checkBoxShowSpeed,FacilityInterface * facilityEngine) :
ui->shutdown->setVisible(shutdown);
selectionModel=ui->TransferList->selectionModel();
+
+ #ifdef ULTRACOPIER_PLUGIN_DEBUG
+ connect(&transferModel,SIGNAL(debugInformation(DebugLevel,QString,QString,QString,int)),this,SIGNAL(debugInformation(DebugLevel,QString,QString,QString,int)));
+ #endif
+
+ updateSpeed();
}
Themes::~Themes()
@@ -145,10 +150,14 @@ Themes::~Themes()
void Themes::uiUpdateSpeed()
{
- if(!ui->checkBoxShowSpeed->isChecked())
- emit newSpeedLimitation(0);
+ if(ui->checkBoxShowSpeed->isChecked())
+ return;
+ if(!ui->checkBox_limitSpeed->isChecked())
+ currentSpeed=0;
else
- emit newSpeedLimitation(ui->limitSpeed->value());
+ currentSpeed=ui->limitSpeed->value();
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("emit newSpeedLimitation(%1)").arg(currentSpeed));
+ emit newSpeedLimitation(currentSpeed);
}
QWidget * Themes::getOptionsEngineWidget()
@@ -159,7 +168,7 @@ QWidget * Themes::getOptionsEngineWidget()
void Themes::getOptionsEngineEnabled(bool isEnabled)
{
if(isEnabled)
- ui->tabWidget->addTab(&optionEngineWidget,tr("Copy engine"));
+ ui->tabWidget->addTab(&optionEngineWidget,facilityEngine->translateText("Copy engine"));
}
void Themes::closeEvent(QCloseEvent *event)
@@ -222,7 +231,7 @@ void Themes::actionInProgess(EngineActionInProgress action)
case CopyingAndListing:
ui->pauseButton->setEnabled(true);
haveStarted=true;
- ui->cancelButton->setText(tr("Quit"));
+ ui->cancelButton->setText(facilityEngine->translateText("Quit"));
break;
case Idle:
ui->pauseButton->setEnabled(false);
@@ -246,13 +255,16 @@ void Themes::detectedSpeed(const quint64 &speed)//in byte per seconds
void Themes::remainingTime(const int &remainingSeconds)
{
+ QString labelTimeRemaining("<html><body style=\"white-space:nowrap;\">"+facilityEngine->translateText("Time remaining:")+" ");
if(remainingSeconds==-1)
- ui->labelTimeRemaining->setText("<html><body>&#8734;</body></html>");
+ labelTimeRemaining+="&#8734;";
else
{
TimeDecomposition time=facilityEngine->secondsToTimeDecomposition(remainingSeconds);
- ui->labelTimeRemaining->setText(QString::number(time.hour)+":"+QString::number(time.minute)+":"+QString::number(time.second));
+ labelTimeRemaining+=QString::number(time.hour)+":"+QString::number(time.minute)+":"+QString::number(time.second);
}
+ labelTimeRemaining+="</body></html>";
+ ui->labelTimeRemaining->setText(labelTimeRemaining);
}
void Themes::newCollisionAction(const QString &action)
@@ -298,9 +310,9 @@ void Themes::setGeneralProgression(const quint64 &current,const quint64 &total)
void Themes::setFileProgression(const QList<ProgressionItem> &progressionList)
{
- transferModel.setFileProgression(progressionList);
+ QList<ProgressionItem> progressionListBis=progressionList;
+ transferModel.setFileProgression(progressionListBis);
updateCurrentFileInformation();
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"Unable to found the file");
}
void Themes::setCollisionAction(const QList<QPair<QString,QString> > &list)
@@ -338,10 +350,13 @@ void Themes::getActionOnList(const QList<returnActionOnCopyList> &returnActions)
currentFile+=returnValue[2];
if(transferModel.rowCount()==0)
{
+ ui->skipButton->setEnabled(false);
ui->progressBar_all->setValue(65535);
ui->progressBar_file->setValue(65535);
currentSize=totalSize;
}
+ else
+ ui->skipButton->setEnabled(true);
updateOverallInformation();
ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"transferModel.rowCount(): "+QString::number(transferModel.rowCount()));
}
@@ -390,7 +405,10 @@ void Themes::isInPause(bool isInPause)
else
{
ui->pauseButton->setIcon(player_pause);
- ui->pauseButton->setText(facilityEngine->translateText("Pause"));
+ if(haveStarted)
+ ui->pauseButton->setText(facilityEngine->translateText("Pause"));
+ else
+ ui->pauseButton->setText(facilityEngine->translateText("Start"));
}
}
@@ -402,16 +420,22 @@ void Themes::updateCurrentFileInformation()
ui->from->setText(transfertItem.from);
ui->to->setText(transfertItem.to);
ui->current_file->setText(transfertItem.current_file);
- ui->progressBar_file->setValue(transfertItem.progressBar_file);
+ if(transfertItem.progressBar_file!=-1)
+ {
+ ui->progressBar_file->setRange(0,65535);
+ ui->progressBar_file->setValue(transfertItem.progressBar_file);
+ }
+ else
+ ui->progressBar_file->setRange(0,0);
}
else
{
ui->from->setText("");
ui->to->setText("");
ui->current_file->setText("-");
- if(haveStarted)
+ if(haveStarted && transferModel.rowCount()==0)
ui->progressBar_file->setValue(65535);
- else
+ else if(!haveStarted)
ui->progressBar_file->setValue(0);
}
}
@@ -506,12 +530,14 @@ void Themes::on_cancelButton_clicked()
void Themes::on_checkBoxShowSpeed_toggled(bool checked)
{
- if(checked==checked)
- updateSpeed();
+ Q_UNUSED(checked);
+ updateSpeed();
}
void Themes::on_SliderSpeed_valueChanged(int value)
{
+ if(!ui->checkBoxShowSpeed->isChecked())
+ return;
switch(value)
{
case 0:
@@ -533,33 +559,26 @@ void Themes::on_SliderSpeed_valueChanged(int value)
currentSpeed=1024*128;
break;
}
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("value: %1").arg(value));
emit newSpeedLimitation(currentSpeed);
+ updateSpeed();
}
void Themes::updateSpeed()
{
- bool checked;
- if(currentSpeed==-1)
- {
- ui->checkBoxShowSpeed->setEnabled(false);
- checked=false;
- }
- else
- {
- ui->checkBoxShowSpeed->setEnabled(true);
- checked=ui->checkBox_limitSpeed->isChecked();
- }
- ui->label_Slider_speed->setVisible(checked);
- ui->SliderSpeed->setVisible(checked);
- ui->label_SpeedMaxValue->setVisible(checked);
- ui->checkBox_limitSpeed->setEnabled(checked);
- if(checked)
+ 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(tr("Unlimited"));
+ ui->label_SpeedMaxValue->setText(facilityEngine->translateText("Unlimited"));
}
else if(currentSpeed<=1024)
{
@@ -622,25 +641,6 @@ void Themes::updateSpeed()
}
}
-void Themes::on_limitSpeed_valueChanged(int value)
-{
- currentSpeed=value;
- emit newSpeedLimitation(currentSpeed);
-}
-
-void Themes::on_checkBox_limitSpeed_clicked()
-{
- if(ui->checkBox_limitSpeed->isChecked())
- {
- if(ui->checkBoxShowSpeed->isChecked())
- on_SliderSpeed_valueChanged(ui->SliderSpeed->value());
- else
- on_limitSpeed_valueChanged(ui->limitSpeed->value());
- }
- else
- currentSpeed=0;
-}
-
void Themes::on_pauseButton_clicked()
{
ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
@@ -652,12 +652,22 @@ void Themes::on_pauseButton_clicked()
void Themes::on_skipButton_clicked()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
TransferModel::currentTransfertItem transfertItem=transferModel.getCurrentTransfertItem();
if(transfertItem.haveItem)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("skip at running: %1").arg(transfertItem.id));
emit skip(transfertItem.id);
+ }
else
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"unable to skip the transfer, because no transfer running");
+ {
+ if(transferModel.rowCount()>1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("skip at idle: %1").arg(transferModel.firstId()));
+ emit skip(transferModel.firstId());
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"unable to skip the transfer, because no transfer running");
+ }
}
void Themes::updateModeAndType()