| 20 | #include <KSharedConfig> |
| 21 | |
| 22 | SynchronizeDialog::SynchronizeDialog(QWidget *parent, |
| 23 | Synchronizer *sync, |
| 24 | int pleftCopyNr, |
| 25 | KIO::filesize_t pleftCopySize, |
| 26 | int prightCopyNr, |
| 27 | KIO::filesize_t prightCopySize, |
| 28 | int pdeleteNr, |
| 29 | KIO::filesize_t pdeleteSize, |
| 30 | int parThreads) |
| 31 | : QDialog(parent) |
| 32 | , synchronizer(sync) |
| 33 | , leftCopyNr(pleftCopyNr) |
| 34 | , leftCopySize(pleftCopySize) |
| 35 | , rightCopyNr(prightCopyNr) |
| 36 | , rightCopySize(prightCopySize) |
| 37 | , deleteNr(pdeleteNr) |
| 38 | , deleteSize(pdeleteSize) |
| 39 | , parallelThreads(parThreads) |
| 40 | , isPause(true) |
| 41 | , syncStarted(false) |
| 42 | { |
| 43 | setWindowTitle(i18n("Krusader::Synchronize")); |
| 44 | setModal(true); |
| 45 | |
| 46 | auto *layout = new QVBoxLayout(this); |
| 47 | layout->setContentsMargins(11, 11, 11, 11); |
| 48 | layout->setSpacing(6); |
| 49 | |
| 50 | cbRightToLeft = new QCheckBox(i18np("Right to left: Copy 1 file", "Right to left: Copy %1 files", leftCopyNr) + ' ' |
| 51 | + i18np("(1 byte)", "(%1 bytes)", KrPermHandler::parseSize(leftCopySize).trimmed().toInt()), |
| 52 | this); |
| 53 | cbRightToLeft->setChecked(leftCopyNr != 0); |
| 54 | cbRightToLeft->setEnabled(leftCopyNr != 0); |
| 55 | layout->addWidget(cbRightToLeft); |
| 56 | |
| 57 | lbRightToLeft = |
| 58 | new QLabel(i18np("\tReady: %2/1 file, %3/%4", "\tReady: %2/%1 files, %3/%4", leftCopyNr, 0, 0, KrPermHandler::parseSize(leftCopySize).trimmed()), this); |
| 59 | lbRightToLeft->setEnabled(leftCopyNr != 0); |
| 60 | layout->addWidget(lbRightToLeft); |
| 61 | |
| 62 | cbLeftToRight = new QCheckBox(i18np("Left to right: Copy 1 file", "Left to right: Copy %1 files", rightCopyNr) + ' ' |
| 63 | + i18np("(1 byte)", "(%1 bytes)", KrPermHandler::parseSize(rightCopySize).trimmed().toInt()), |
| 64 | this); |
| 65 | cbLeftToRight->setChecked(rightCopyNr != 0); |
| 66 | cbLeftToRight->setEnabled(rightCopyNr != 0); |
| 67 | layout->addWidget(cbLeftToRight); |
| 68 | |
| 69 | lbLeftToRight = |
| 70 | new QLabel(i18np("\tReady: %2/1 file, %3/%4", "\tReady: %2/%1 files, %3/%4", rightCopyNr, 0, 0, KrPermHandler::parseSize(rightCopySize).trimmed()), |
| 71 | this); |
| 72 | lbLeftToRight->setEnabled(rightCopyNr != 0); |
| 73 | layout->addWidget(lbLeftToRight); |
| 74 | |
| 75 | cbDeletable = new QCheckBox(i18np("Left: Delete 1 file", "Left: Delete %1 files", deleteNr) + ' ' |
| 76 | + i18np("(1 byte)", "(%1 bytes)", KrPermHandler::parseSize(deleteSize).trimmed().toInt()), |
| 77 | this); |
| 78 | cbDeletable->setChecked(deleteNr != 0); |
| 79 | cbDeletable->setEnabled(deleteNr != 0); |