From bd56579c7d9de94c17287adefa118290e6b7ba33 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 23 Feb 2018 23:49:48 +0000 Subject: New upstream version 1.4.0.3 --- plugins/Themes/Oxygen/interface.cpp | 343 ++++++++++++++++++++++++------------ 1 file changed, 230 insertions(+), 113 deletions(-) (limited to 'plugins/Themes/Oxygen/interface.cpp') diff --git a/plugins/Themes/Oxygen/interface.cpp b/plugins/Themes/Oxygen/interface.cpp index 703f3b2..84b4dd6 100644 --- a/plugins/Themes/Oxygen/interface.cpp +++ b/plugins/Themes/Oxygen/interface.cpp @@ -8,7 +8,10 @@ #include #include #include +#include #include +#include +#include #ifdef Q_OS_WIN #ifndef NOMINMAX #define NOMINMAX @@ -158,6 +161,12 @@ Themes::Themes(const bool &alwaysOnTop, /// \note important for drag and drop, \see dropEvent() setAcceptDrops(true); + #ifdef SUPERCOPIER + const QString themePath=":/Themes/Supercopier/"; + #else + const QString themePath=":/Themes/Oxygen/"; + #endif + // try set the OS icon if(!iconLoaded) { @@ -166,10 +175,10 @@ Themes::Themes(const bool &alwaysOnTop, editDelete=QIcon::fromTheme(QStringLiteral("edit-delete")); player_pause=QIcon::fromTheme(QStringLiteral("media-playback-pause")); if(player_pause.isNull()) - player_pause=QIcon(QStringLiteral(":/Themes/Oxygen/resources/player_pause.png")); + player_pause=QIcon(themePath+QStringLiteral("resources/player_pause.png")); player_play=QIcon::fromTheme(QStringLiteral("media-playback-play")); if(player_play.isNull()) - player_play=QIcon(QStringLiteral(":/Themes/Oxygen/resources/player_play.png")); + player_play=QIcon(themePath+QStringLiteral("resources/player_play.png")); skinIcon=QIcon::fromTheme(QStringLiteral("media-skip-forward")); editFind=QIcon::fromTheme(QStringLiteral("edit-find")); documentOpen=QIcon::fromTheme(QStringLiteral("document-open")); @@ -208,14 +217,68 @@ Themes::Themes(const bool &alwaysOnTop, ui->actionAddFolderToMove->setIcon(listAdd); } #ifdef Q_OS_WIN32 - pixmapTop=QPixmap(QStringLiteral(":/Themes/Oxygen/resources/SystemTrayIcon/systray_Uncaught_Windows.png")); - pixmapBottom=QPixmap(QStringLiteral(":/Themes/Oxygen/resources/SystemTrayIcon/systray_Caught_Windows.png")); + pixmapTop=QPixmap(themePath+QStringLiteral("resources/SystemTrayIcon/systray_Uncaught_Windows.png")); + pixmapBottom=QPixmap(themePath+QStringLiteral("resources/SystemTrayIcon/systray_Caught_Windows.png")); #else - pixmapTop=QPixmap(QStringLiteral(":/Themes/Oxygen/resources/SystemTrayIcon/systray_Uncaught_Unix.png")); - pixmapBottom=QPixmap(QStringLiteral(":/Themes/Oxygen/resources/SystemTrayIcon/systray_Caught_Unix.png")); + pixmapTop=QPixmap(themePath+QStringLiteral("resources/SystemTrayIcon/systray_Uncaught_Unix.png")); + pixmapBottom=QPixmap(themePath+QStringLiteral("resources/SystemTrayIcon/systray_Caught_Unix.png")); #endif - shutdown=facilityEngine->haveFunctionality(QStringLiteral("shutdown")); + #ifdef SUPERCOPIER + /*QIcon icon; + icon.addFile(themePath+QStringLiteral("resources/main.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->interfaceCopy->setWindowIcon(icon);*/ + QIcon icon1; + icon1.addFile(themePath+QStringLiteral("resources/add.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->actionAddFile->setIcon(icon1); + QIcon icon2; + icon2.addFile(themePath+QStringLiteral("resources/SystemTrayIcon/exit.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->shutdown->setIcon(icon2); + QIcon icon3; + icon3.addFile(themePath+QStringLiteral("resources/moveDown.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->moreButton->setIcon(icon3); + ui->pushDown->setIcon(icon3); + if(!QFile::exists(themePath+QStringLiteral("resources/moveDown.png"))) + { + qDebug() << "File not found, can't continue: " << themePath+QStringLiteral("resources/moveDown.png"); + abort(); + } + QIcon icon4; + icon4.addFile(themePath+QStringLiteral("resources/player_pause.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->pauseButton->setIcon(icon4); + QIcon icon5; + icon5.addFile(themePath+QStringLiteral("resources/player_end.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->skipButton->setIcon(icon5); + QIcon icon6; + icon6.addFile(themePath+QStringLiteral("resources/cancel.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->cancelButton->setIcon(icon6); + QIcon icon7; + icon7.addFile(themePath+QStringLiteral("resources/putOnTop.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->putOnTop->setIcon(icon7); + QIcon icon8; + icon8.addFile(themePath+QStringLiteral("resources/moveUp.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->pushUp->setIcon(icon8); + QIcon icon9; + icon9.addFile(themePath+QStringLiteral("resources/putOnBottom.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->putOnBottom->setIcon(icon9); + QIcon icon10; + icon10.addFile(themePath+QStringLiteral("resources/remove.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->del->setIcon(icon10); + QIcon icon11; + icon11.addFile(themePath+QStringLiteral("resources/search.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->searchButton->setIcon(icon11); + QIcon icon12; + icon12.addFile(themePath+QStringLiteral("resources/export-transfer-list.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->exportTransferList->setIcon(icon12); + QIcon icon13; + icon13.addFile(themePath+QStringLiteral("resources/import-transfer-list.png"), QSize(), QIcon::Normal, QIcon::Off); + ui->importTransferList->setIcon(icon13); + QIcon icon14; + icon14.addFile(themePath+QStringLiteral("resources/main.png"), QSize(), QIcon::Normal, QIcon::Off); + this->setWindowIcon(icon14); + #endif + + shutdown=facilityEngine->haveFunctionality("shutdown"); ui->shutdown->setVisible(shutdown); selectionModel=ui->TransferList->selectionModel(); @@ -231,13 +294,43 @@ Themes::Themes(const bool &alwaysOnTop, uiOptions->alwaysOnTop->hide(); #endif*/ #ifdef ULTRACOPIER_VERSION_ULTIMATE - ui->ad_ultimate->hide(); + #ifdef SUPERCOPIER + ui->ad_ultimate->setText(tr("%1 is deprecated, Use %2").arg("SuperCopier").arg("Ultracopier")); + #else + #ifdef Q_OS_MACOS + ui->ad_ultimate->setText(tr("This will be the last version for Mac, but you can compile from source")); + #else + ui->ad_ultimate->hide(); + #endif + #endif #else - QString ultimateUrl=facilityEngine->ultimateUrl(); + QString ultimateUrl=QString::fromStdString(facilityEngine->ultimateUrl()); if(ultimateUrl.isEmpty()) ui->ad_ultimate->hide(); else - ui->ad_ultimate->setText(QStringLiteral("%2").arg(ultimateUrl).arg(tr("Buy the Ultimate version to fund development"))); + ui->ad_ultimate->setText( + #ifdef SUPERCOPIER + tr("%1 is deprecated, Use %2").arg("Supercopier").arg("Ultracopier
")+ + #endif + #ifdef Q_OS_MACOS + tr("This will be the last version for Mac, but you can compile from source")+ + #endif + QStringLiteral("%2").arg(ultimateUrl).arg(tr("Buy the Ultimate version to fund development"))); + #endif + + #ifdef SUPERCOPIER + uiOptions->labelDualProgression->hide(); + uiOptions->showDualProgression->hide(); + ui->progressBar_all->setMaximumHeight(17); + ui->progressBar_file->setMaximumHeight(17); + ui->progressBarCurrentSpeed->setMaximumHeight(17); + ui->progressBar_all->setMinimumHeight(17); + ui->progressBar_file->setMinimumHeight(17); + ui->progressBarCurrentSpeed->setMinimumHeight(17); + ui->progressBar_all->setStyleSheet(QStringLiteral("QProgressBar{color:#fff;font-weight:bold;border:1px solid black;text-align:center;background-image:url(:/Themes/Supercopier/resources/progressbarright.png);}QProgressBar::chunk{background-image: url(:/Themes/Supercopier/resources/progressbarleft.png);}")); + ui->progressBar_file->setStyleSheet(QStringLiteral("QProgressBar{color:#fff;font-weight:bold;border:1px solid black;text-align:center;background-image:url(:/Themes/Supercopier/resources/progressbarright.png);}QProgressBar::chunk{background-image: url(:/Themes/Supercopier/resources/progressbarleft.png);}")); + ui->progressBarCurrentSpeed->setStyleSheet(QStringLiteral("QProgressBar{color:#fff;font-weight:bold;border:1px solid black;text-align:center;background-image:url(:/Themes/Supercopier/resources/progressbarright.png);}QProgressBar::chunk{background-image: url(:/Themes/Supercopier/resources/progressbarleft.png);}")); + this->setWindowTitle("Supercopier"); #endif show(); @@ -248,7 +341,7 @@ Themes::Themes(const bool &alwaysOnTop, Themes::~Themes() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); //disconnect(ui->actionAddFile); //disconnect(ui->actionAddFolder); delete selectionModel; @@ -268,14 +361,14 @@ void Themes::getOptionsEngineEnabled(const bool &isEnabled) QScrollArea *scrollArea=new QScrollArea(ui->tabWidget); scrollArea->setWidgetResizable(true); scrollArea->setWidget(&optionEngineWidget); - ui->tabWidget->addTab(scrollArea,facilityEngine->translateText(QStringLiteral("Copy engine"))); + ui->tabWidget->addTab(scrollArea,QString::fromStdString(facilityEngine->translateText("Copy engine"))); } } void Themes::closeEvent(QCloseEvent *event) { event->ignore(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); this->hide(); if(uiOptions->minimizeToSystray->isChecked()) { @@ -290,7 +383,7 @@ void Themes::updateSysTrayIcon() { if(totalSize==0) { - sysTrayIcon->setIcon(dynaIcon(0,QStringLiteral("-"))); + sysTrayIcon->setIcon(dynaIcon(0,"-")); return; } quint64 currentNew=currentSize*100; @@ -307,12 +400,17 @@ void Themes::updateOverallInformation() { if(uiOptions->showProgressionInTheTitle->isChecked()) updateTitle(); - ui->overall->setText(tr("File %1/%2, size: %3/%4").arg(currentFile).arg(totalFile).arg(facilityEngine->sizeToString(currentSize)).arg(facilityEngine->sizeToString(totalSize))); + ui->overall->setText(tr("File %1/%2, size: %3/%4") + .arg(currentFile) + .arg(totalFile) + .arg(QString::fromStdString(facilityEngine->sizeToString(currentSize))) + .arg(QString::fromStdString(facilityEngine->sizeToString(totalSize))) + ); } void Themes::actionInProgess(const Ultracopier::EngineActionInProgress &action) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("start: ")+QString::number(action)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"start: "+std::to_string(action)); this->action=action; switch(action) { @@ -332,7 +430,7 @@ void Themes::actionInProgess(const Ultracopier::EngineActionInProgress &action) { if(shutdown && ui->shutdown->isChecked()) { - facilityEngine->callFunctionality(QStringLiteral("shutdown")); + facilityEngine->callFunctionality("shutdown"); return; } switch(uiOptions->comboBox_copyEnd->currentIndex()) @@ -352,9 +450,16 @@ void Themes::actionInProgess(const Ultracopier::EngineActionInProgress &action) stat = status_stopped; if(durationStarted) { - Ultracopier::TimeDecomposition time=facilityEngine->secondsToTimeDecomposition(duration.elapsed()/1000); - ui->labelTimeRemaining->setText(QStringLiteral("")+facilityEngine->translateText(QStringLiteral("Completed in %1")).arg( - QString::number(time.hour)+QStringLiteral(":")+QString::number(time.minute).rightJustified(2,'0')+QStringLiteral(":")+QString::number(time.second).rightJustified(2,'0') + Ultracopier::TimeDecomposition time=facilityEngine->secondsToTimeDecomposition( + (std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()- + duration) + /1000); + ui->labelTimeRemaining->setText(QStringLiteral("")+ + QString::fromStdString(facilityEngine->translateText("Completed in %1")).arg( + QString::number(time.hour)+QStringLiteral(":")+ + QString::number(time.minute).rightJustified(2,'0')+ + QStringLiteral(":")+ + QString::number(time.second).rightJustified(2,'0') )+QStringLiteral("")); } } @@ -370,11 +475,11 @@ void Themes::actionInProgess(const Ultracopier::EngineActionInProgress &action) ui->pauseButton->setEnabled(true); if(!durationStarted) { - duration.start(); + duration=std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); durationStarted=true; } haveStarted=true; - ui->cancelButton->setText(facilityEngine->translateText(QStringLiteral("Quit"))); + ui->cancelButton->setText(QString::fromStdString(facilityEngine->translateText("Quit"))); updatePause(); break; case Ultracopier::Listing: @@ -389,17 +494,17 @@ void Themes::actionInProgess(const Ultracopier::EngineActionInProgress &action) } } -void Themes::newFolderListing(const QString &path) +void Themes::newFolderListing(const std::string &path) { - QString newPath=path; + QString newPath=QString::fromStdString(path); if(newPath.size()>(64+3)) newPath=newPath.mid(0,32)+QStringLiteral("...")+newPath.mid(newPath.size()-32,32); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); if(action==Ultracopier::Listing) ui->from->setText(newPath); } -void Themes::detectedSpeed(const quint64 &speed)//in byte per seconds +void Themes::detectedSpeed(const uint64_t &speed)//in byte per seconds { if(uiOptions->speedWithProgressBar->isChecked()) { @@ -408,19 +513,23 @@ void Themes::detectedSpeed(const quint64 &speed)//in byte per seconds tempSpeed=999999999; if(tempSpeed>(quint64)ui->progressBarCurrentSpeed->maximum()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("set max speed to: %1").arg(tempSpeed)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"set max speed to: "+std::to_string(tempSpeed)); ui->progressBarCurrentSpeed->setMaximum(tempSpeed); } ui->progressBarCurrentSpeed->setValue(tempSpeed); - ui->progressBarCurrentSpeed->setFormat(facilityEngine->speedToString(speed)); + ui->progressBarCurrentSpeed->setFormat(QString::fromStdString(facilityEngine->speedToString(speed))); } else - ui->currentSpeed->setText(facilityEngine->speedToString(speed)); + ui->currentSpeed->setText(QString::fromStdString(facilityEngine->speedToString(speed))); } void Themes::remainingTime(const int &remainingSeconds) { - QString labelTimeRemaining(QStringLiteral("")+facilityEngine->translateText(QStringLiteral("Time remaining:"))+QStringLiteral(" ")); + QString labelTimeRemaining(QStringLiteral( + "")+ + QString::fromStdString(facilityEngine->translateText("Time remaining:"))+ + QStringLiteral(" ") + ); if(remainingSeconds==-1) labelTimeRemaining+=QStringLiteral("∞"); else @@ -438,9 +547,13 @@ void Themes::errorDetected() } /// \brief new error -void Themes::errorToRetry(const QString &source,const QString &destination,const QString &error) +void Themes::errorToRetry(const std::string &source,const std::string &destination,const std::string &error) { - ui->errorList->addTopLevelItem(new QTreeWidgetItem(QStringList() << source << destination << error)); + ui->errorList->addTopLevelItem(new QTreeWidgetItem(QStringList() + << QString::fromStdString(source) + << QString::fromStdString(destination) + << QString::fromStdString(error) + )); } /** \brief support speed limitation */ @@ -459,7 +572,7 @@ void Themes::setSupportSpeedLimitation(const bool &supportSpeedLimitationBool) } //get information about the copy -void Themes::setGeneralProgression(const quint64 ¤t,const quint64 &total) +void Themes::setGeneralProgression(const uint64_t ¤t,const uint64_t &total) { currentSize=current; totalSize=total; @@ -477,22 +590,22 @@ void Themes::setGeneralProgression(const quint64 ¤t,const quint64 &total) updateSysTrayIcon(); } -void Themes::setFileProgression(const QList &progressionList) +void Themes::setFileProgression(const std::vector &progressionList) { - QList progressionListBis=progressionList; + std::vector progressionListBis=progressionList; transferModel.setFileProgression(progressionListBis); updateCurrentFileInformation(); } //edit the transfer list /// \todo check and re-enable to selection -void Themes::getActionOnList(const QList &returnActions) +void Themes::getActionOnList(const std::vector &returnActions) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, returnActions.size(): ")+QString::number(returnActions.size())); - QList returnValue=transferModel.synchronizeItems(returnActions); - totalFile+=returnValue.first(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, returnActions.size(): "+std::to_string(returnActions.size())); + std::vector returnValue=transferModel.synchronizeItems(returnActions); + totalFile+=returnValue.front(); totalSize+=returnValue.at(1); - currentFile+=returnValue.last(); + currentFile+=returnValue.back(); if(transferModel.rowCount()==0) { ui->skipButton->setEnabled(false); @@ -505,19 +618,19 @@ void Themes::getActionOnList(const QList &r else ui->skipButton->setEnabled(true); updateOverallInformation(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("transferModel.rowCount(): ")+QString::number(transferModel.rowCount())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"transferModel.rowCount(): "+std::to_string(transferModel.rowCount())); } void Themes::setCopyType(const Ultracopier::CopyType &type) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); this->type=type; updateModeAndType(); } void Themes::forceCopyMode(const Ultracopier::CopyMode &mode) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); modeIsForced=true; this->mode=mode; if(mode==Ultracopier::Copy) @@ -536,13 +649,13 @@ void Themes::setTransferListOperation(const Ultracopier::TransferListOperation & void Themes::haveExternalOrder() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); // ui->moreButton->toggle(); } void Themes::isInPause(const bool &isInPause) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("isInPause: ")+QString::number(isInPause)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"isInPause: "+std::to_string(isInPause)); //resume in auto the pause storeIsInPause=isInPause; updatePause(); @@ -554,14 +667,14 @@ void Themes::updatePause() { ui->pauseButton->setIcon(player_play); if(stat == status_started) - ui->pauseButton->setText(facilityEngine->translateText(QStringLiteral("Resume"))); + ui->pauseButton->setText(QString::fromStdString(facilityEngine->translateText("Resume"))); else - ui->pauseButton->setText(facilityEngine->translateText(QStringLiteral("Start"))); + ui->pauseButton->setText(QString::fromStdString(facilityEngine->translateText("Start"))); } else { ui->pauseButton->setIcon(player_pause); - ui->pauseButton->setText(facilityEngine->translateText(QStringLiteral("Pause"))); + ui->pauseButton->setText(QString::fromStdString(facilityEngine->translateText("Pause"))); } } @@ -570,15 +683,15 @@ void Themes::updateCurrentFileInformation() TransferModel::currentTransfertItem transfertItem=transferModel.getCurrentTransfertItem(); if(transfertItem.haveItem) { - QString newPath=transfertItem.from; + QString newPath=QString::fromStdString(transfertItem.from); if(newPath.size()>(64+3)) newPath=newPath.mid(0,32)+QStringLiteral("...")+newPath.mid(newPath.size()-32,32); ui->from->setText(newPath); - newPath=transfertItem.to; + newPath=QString::fromStdString(transfertItem.to); if(newPath.size()>(64+3)) newPath=newPath.mid(0,32)+QStringLiteral("...")+newPath.mid(newPath.size()-32,32); ui->to->setText(newPath); - ui->current_file->setText(transfertItem.current_file); + ui->current_file->setText(QString::fromStdString(transfertItem.current_file)); if(transfertItem.progressBar_read!=-1) { ui->progressBar_file->setRange(0,65535); @@ -624,14 +737,14 @@ void Themes::updateCurrentFileInformation() void Themes::on_putOnTop_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); selectedItems=selectionModel->selectedRows(); - QList ids; + std::vector ids; int index=0; const int &loop_size=selectedItems.size(); while(index0) @@ -640,14 +753,14 @@ void Themes::on_putOnTop_clicked() void Themes::on_pushUp_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); selectedItems=selectionModel->selectedRows(); - QList ids; + std::vector ids; int index=0; const int &loop_size=selectedItems.size(); while(index0) @@ -656,14 +769,14 @@ void Themes::on_pushUp_clicked() void Themes::on_pushDown_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); selectedItems=selectionModel->selectedRows(); - QList ids; + std::vector ids; int index=0; const int &loop_size=selectedItems.size(); while(index0) @@ -672,14 +785,14 @@ void Themes::on_pushDown_clicked() void Themes::on_putOnBottom_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); selectedItems=selectionModel->selectedRows(); - QList ids; + std::vector ids; int index=0; const int &loop_size=selectedItems.size(); while(index0) @@ -688,14 +801,14 @@ void Themes::on_putOnBottom_clicked() void Themes::on_del_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); selectedItems=selectionModel->selectedRows(); - QList ids; + std::vector ids; int index=0; const int &loop_size=selectedItems.size(); while(index0) @@ -704,7 +817,7 @@ void Themes::on_del_clicked() void Themes::on_cancelButton_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); this->hide(); emit cancel(); } @@ -712,7 +825,7 @@ void Themes::on_cancelButton_clicked() void Themes::speedWithProgressBar_toggled(bool checked) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); ui->progressBarCurrentSpeed->setVisible(checked); ui->currentSpeed->setVisible(!checked); } @@ -720,13 +833,13 @@ void Themes::speedWithProgressBar_toggled(bool checked) void Themes::showDualProgression_toggled(bool checked) { Q_UNUSED(checked); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); updateProgressionColorBar(); } void Themes::checkBoxShowSpeed_toggled(bool checked) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); Q_UNUSED(checked); updateSpeed(); } @@ -756,7 +869,7 @@ void Themes::on_SliderSpeed_valueChanged(int value) currentSpeed=1024*128; break; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("value: %1").arg(value)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"value: "+std::to_string(value)); emit newSpeedLimitation(currentSpeed); updateSpeed(); } @@ -769,7 +882,7 @@ void Themes::uiUpdateSpeed() currentSpeed=0; else currentSpeed=uiOptions->limitSpeed->value(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("emit newSpeedLimitation(%1)").arg(currentSpeed)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"emit newSpeedLimitation"+std::to_string(currentSpeed)); emit newSpeedLimitation(currentSpeed); } @@ -783,12 +896,12 @@ void Themes::updateSpeed() if(uiOptions->checkBoxShowSpeed->isChecked()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("checked, currentSpeed: %1").arg(currentSpeed)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"checked, currentSpeed: "+std::to_string(currentSpeed)); uiOptions->limitSpeed->setEnabled(false); if(currentSpeed==0) { ui->SliderSpeed->setValue(0); - ui->label_SpeedMaxValue->setText(facilityEngine->translateText(QStringLiteral("Unlimited"))); + ui->label_SpeedMaxValue->setText(QString::fromStdString(facilityEngine->translateText("Unlimited"))); } else if(currentSpeed<=1024) { @@ -798,7 +911,7 @@ void Themes::updateSpeed() emit newSpeedLimitation(currentSpeed); } ui->SliderSpeed->setValue(1); - ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*1)); + ui->label_SpeedMaxValue->setText(QString::fromStdString(facilityEngine->speedToString((double)(1024*1024)*1))); } else if(currentSpeed<=1024*4) { @@ -808,7 +921,7 @@ void Themes::updateSpeed() emit newSpeedLimitation(currentSpeed); } ui->SliderSpeed->setValue(2); - ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*4)); + ui->label_SpeedMaxValue->setText(QString::fromStdString(facilityEngine->speedToString((double)(1024*1024)*4))); } else if(currentSpeed<=1024*16) { @@ -818,7 +931,7 @@ void Themes::updateSpeed() emit newSpeedLimitation(currentSpeed); } ui->SliderSpeed->setValue(3); - ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*16)); + ui->label_SpeedMaxValue->setText(QString::fromStdString(facilityEngine->speedToString((double)(1024*1024)*16))); } else if(currentSpeed<=1024*64) { @@ -828,7 +941,7 @@ void Themes::updateSpeed() emit newSpeedLimitation(currentSpeed); } ui->SliderSpeed->setValue(4); - ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*64)); + ui->label_SpeedMaxValue->setText(QString::fromStdString(facilityEngine->speedToString((double)(1024*1024)*64))); } else { @@ -838,7 +951,7 @@ void Themes::updateSpeed() emit newSpeedLimitation(currentSpeed); } ui->SliderSpeed->setValue(5); - ui->label_SpeedMaxValue->setText(facilityEngine->speedToString((double)(1024*1024)*128)); + ui->label_SpeedMaxValue->setText(QString::fromStdString(facilityEngine->speedToString((double)(1024*1024)*128))); } } else @@ -853,7 +966,7 @@ void Themes::updateSpeed() void Themes::on_pauseButton_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); if(storeIsInPause) emit resume(); else @@ -865,14 +978,14 @@ void Themes::on_skipButton_clicked() TransferModel::currentTransfertItem transfertItem=transferModel.getCurrentTransfertItem(); if(transfertItem.haveItem) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("skip at running: %1").arg(transfertItem.id)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"skip at running: "+std::to_string(transfertItem.id)); emit skip(transfertItem.id); } else { if(transferModel.rowCount()>1) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("skip at idle: %1").arg(transferModel.firstId())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"skip at idle: "+std::to_string(transferModel.firstId())); emit skip(transferModel.firstId()); } else @@ -903,43 +1016,43 @@ void Themes::updateModeAndType() void Themes::forcedModeAddFile() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); emit userAddFile(mode); } void Themes::forcedModeAddFolder() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); emit userAddFolder(mode); } void Themes::forcedModeAddFileToCopy() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); emit userAddFile(Ultracopier::Copy); } void Themes::forcedModeAddFolderToCopy() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); emit userAddFolder(Ultracopier::Copy); } void Themes::forcedModeAddFileToMove() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); emit userAddFile(Ultracopier::Move); } void Themes::forcedModeAddFolderToMove() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); emit userAddFolder(Ultracopier::Move); } void Themes::newLanguageLoaded() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); if(modeIsForced) forceCopyMode(mode); ui->retranslateUi(this); @@ -954,7 +1067,8 @@ void Themes::newLanguageLoaded() updateOverallInformation(); updateSpeed(); if(ui->tabWidget->count()>=4) - ui->tabWidget->setTabText(ui->tabWidget->count()-1,facilityEngine->translateText(QStringLiteral("Copy engine"))); + ui->tabWidget->setTabText(ui->tabWidget->count()-1, + QString::fromStdString(facilityEngine->translateText("Copy engine"))); on_moreButton_toggled(ui->moreButton->isChecked()); } @@ -995,7 +1109,7 @@ void Themes::searchBoxShortcut() //hilight the search void Themes::hilightTheSearch(bool searchNext) { - int result=transferModel.search(ui->lineEditSearch->text(),searchNext); + int result=transferModel.search(ui->lineEditSearch->text().toStdString(),searchNext); if(ui->lineEditSearch->text().isEmpty()) ui->lineEditSearch->setStyleSheet(""); else @@ -1017,7 +1131,7 @@ void Themes::hilightTheSearchSlot() void Themes::on_pushButtonSearchPrev_clicked() { - int result=transferModel.searchPrev(ui->lineEditSearch->text()); + int result=transferModel.searchPrev(ui->lineEditSearch->text().toStdString()); if(ui->lineEditSearch->text().isEmpty()) ui->lineEditSearch->setStyleSheet(""); else @@ -1075,24 +1189,27 @@ void dragLeaveEvent(QDragLeaveEvent* event); */ void Themes::dropEvent(QDropEvent *event) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); const QMimeData* mimeData = event->mimeData(); if(mimeData->hasUrls()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("hasUrls")); - emit urlDropped(mimeData->urls()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"hasUrls"); + std::vector urls; + foreach (QUrl url, mimeData->urls()) + urls.push_back(url.toString().toStdString()); + emit urlDropped(urls); event->acceptProposedAction(); } } void Themes::dragEnterEvent(QDragEnterEvent* event) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); // if some actions should not be usable, like move, this code must be adopted const QMimeData* mimeData = event->mimeData(); if(mimeData->hasUrls()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("hasUrls")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"hasUrls"); event->acceptProposedAction(); } } @@ -1107,7 +1224,7 @@ void Themes::dragMoveEvent(QDragMoveEvent* event) void Themes::dragLeaveEvent(QDragLeaveEvent* event) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); event->accept(); } @@ -1184,7 +1301,7 @@ void Themes::alwaysOnTop_clicked(bool reshow) flags=flags | Qt::WindowStaysOnTopHint; else flags=flags & ~Qt::WindowStaysOnTopHint; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"uiOptions->alwaysOnTop->isChecked(): "+QString::number(uiOptions->alwaysOnTop->isChecked())+", flags: "+QString::number(flags)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"uiOptions->alwaysOnTop->isChecked(): "+std::to_string(uiOptions->alwaysOnTop->isChecked())+", flags: "+std::to_string(flags)); setWindowFlags(flags); if(reshow) show(); @@ -1197,7 +1314,7 @@ void Themes::alwaysOnTop_clickedSlot() void Themes::updateProgressionColorBar() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); uiOptions->labelProgressionColor->setVisible(uiOptions->showDualProgression->isChecked()); uiOptions->frameProgressionColor->setVisible(uiOptions->showDualProgression->isChecked()); if(!uiOptions->showDualProgression->isChecked()) @@ -1230,25 +1347,25 @@ void Themes::updateTitle() if(uiOptions->showProgressionInTheTitle->isChecked() && totalSize>0) { if(!modeIsForced) - this->setWindowTitle(tr("%1 %2% of %3").arg(facilityEngine->translateText(QStringLiteral("Transfer"))).arg((currentSize*100)/totalSize).arg(facilityEngine->sizeToString(totalSize))+QStringLiteral(" - ")+facilityEngine->softwareName()); + this->setWindowTitle(tr("%1 %2% of %3").arg(QString::fromStdString(facilityEngine->translateText("Transfer"))).arg((currentSize*100)/totalSize).arg(QString::fromStdString(facilityEngine->sizeToString(totalSize)))+QStringLiteral(" - ")+QString::fromStdString(facilityEngine->softwareName())); else { if(mode==Ultracopier::Copy) - this->setWindowTitle(tr("%1 %2% of %3").arg(facilityEngine->translateText(QStringLiteral("Copy"))).arg((currentSize*100)/totalSize).arg(facilityEngine->sizeToString(totalSize))+QStringLiteral(" - ")+facilityEngine->softwareName()); + this->setWindowTitle(tr("%1 %2% of %3").arg(QString::fromStdString(facilityEngine->translateText("Copy"))).arg((currentSize*100)/totalSize).arg(QString::fromStdString(facilityEngine->sizeToString(totalSize)))+QStringLiteral(" - ")+QString::fromStdString(facilityEngine->softwareName())); else - this->setWindowTitle(tr("%1 %2% of %3").arg(facilityEngine->translateText(QStringLiteral("Move"))).arg((currentSize*100)/totalSize).arg(facilityEngine->sizeToString(totalSize))+QStringLiteral(" - ")+facilityEngine->softwareName()); + this->setWindowTitle(tr("%1 %2% of %3").arg(QString::fromStdString(facilityEngine->translateText("Move"))).arg((currentSize*100)/totalSize).arg(QString::fromStdString(facilityEngine->sizeToString(totalSize)))+QStringLiteral(" - ")+QString::fromStdString(facilityEngine->softwareName())); } } else { if(!modeIsForced) - this->setWindowTitle(QStringLiteral("%1").arg(facilityEngine->translateText(QStringLiteral("Transfer")))+QStringLiteral(" - ")+facilityEngine->softwareName()); + this->setWindowTitle(QStringLiteral("%1").arg(QString::fromStdString(facilityEngine->translateText("Transfer")))+QStringLiteral(" - ")+QString::fromStdString(facilityEngine->softwareName())); else { if(mode==Ultracopier::Copy) - this->setWindowTitle(QStringLiteral("%1").arg(facilityEngine->translateText(QStringLiteral("Copy")))+QStringLiteral(" - ")+facilityEngine->softwareName()); + this->setWindowTitle(QStringLiteral("%1").arg(QString::fromStdString(facilityEngine->translateText("Copy")))+QStringLiteral(" - ")+QString::fromStdString(facilityEngine->softwareName())); else - this->setWindowTitle(QStringLiteral("%1").arg(facilityEngine->translateText(QStringLiteral("Move")))+QStringLiteral(" - ")+facilityEngine->softwareName()); + this->setWindowTitle(QStringLiteral("%1").arg(QString::fromStdString(facilityEngine->translateText("Move")))+QStringLiteral(" - ")+QString::fromStdString(facilityEngine->softwareName())); } } } @@ -1263,7 +1380,7 @@ Do by mongaulois, remake by alpha_one_x86. \return QIcon of the final image \note Can be used as it: dynaIcon(75,"...") */ -QIcon Themes::dynaIcon(int percent,QString text) const +QIcon Themes::dynaIcon(int percent,std::string text) const { #ifdef ULTRACOPIER_PLUGIN_DEBUG if(pixmapTop.isNull() || pixmapBottom.isNull()) @@ -1320,13 +1437,13 @@ QIcon Themes::dynaIcon(int percent,QString text) const qint8 textxOffset=0; qint8 textyOffset=0; - if(text.isEmpty()) + if(text.empty()) { if(percent!=100) - text=QString::number(percent); + text=std::to_string(percent); else { - text=QStringLiteral(":)"); + text=":)"; #ifdef Q_OS_WIN32 textyOffset-=2; #else @@ -1352,9 +1469,9 @@ QIcon Themes::dynaIcon(int percent,QString text) const textyOffset+=3; #endif painter.setPen(QPen(Qt::black)); - painter.drawText(3+textxOffset,13+textyOffset,text); + painter.drawText(3+textxOffset,13+textyOffset,QString::fromStdString(text)); painter.setPen(QPen(Qt::white)); - painter.drawText(2+textxOffset,12+textyOffset,text); + painter.drawText(2+textxOffset,12+textyOffset,QString::fromStdString(text)); } return QIcon(resultImage); } @@ -1371,7 +1488,7 @@ void Themes::catchAction(QSystemTrayIcon::ActivationReason reason) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Double Click detected"); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("reason: %1").arg(reason)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"reason: "+std::to_string(reason)); } void Themes::on_exportErrorToTransferList_clicked() -- cgit v1.2.3