| 36 | // OpenDialog ************************************************************** |
| 37 | |
| 38 | OpenDialog::OpenDialog( |
| 39 | KDiff3App* pParent, const QString& n1, const QString& n2, const QString& n3, |
| 40 | bool bMerge, const QString& outputName) |
| 41 | : QDialog(pParent) |
| 42 | { |
| 43 | dialogUi.setupUi(this); |
| 44 | setModal(true); |
| 45 | //Abort if verticalLayout is not the immediate child of the dialog. This interferes with re-sizing. |
| 46 | assert(dialogUi.virticalLayout->parent() == this); |
| 47 | |
| 48 | dialogUi.lineA->insertItems(0, gOptions->getRecentFilesA()); |
| 49 | dialogUi.lineA->setEditText(n1); |
| 50 | |
| 51 | QPushButton* button = dialogUi.fileSelectA; |
| 52 | chk_connect_a(button, &QPushButton::clicked, this, &OpenDialog::selectFileA); |
| 53 | QPushButton* button2 = dialogUi.folderSelectA; |
| 54 | chk_connect_a(button2, &QPushButton::clicked, this, &OpenDialog::selectDirA); |
| 55 | chk_connect_a(dialogUi.lineA, &QComboBox::editTextChanged, this, &OpenDialog::inputFilenameChanged); |
| 56 | |
| 57 | dialogUi.lineB->setEditable(true); |
| 58 | dialogUi.lineB->insertItems(0, gOptions->getRecentFilesB()); |
| 59 | dialogUi.lineB->setEditText(n2); |
| 60 | |
| 61 | dialogUi.lineB->setMinimumWidth(200); |
| 62 | button = dialogUi.fileSelectB; |
| 63 | chk_connect_a(button, &QPushButton::clicked, this, &OpenDialog::selectFileB); |
| 64 | button2 = dialogUi.folderSelectB; |
| 65 | chk_connect_a(button2, &QPushButton::clicked, this, &OpenDialog::selectDirB); |
| 66 | chk_connect_a(dialogUi.lineB, &QComboBox::editTextChanged, this, &OpenDialog::inputFilenameChanged); |
| 67 | |
| 68 | dialogUi.lineC->setEditable(true); |
| 69 | dialogUi.lineC->insertItems(0, gOptions->getRecentFilesC()); |
| 70 | dialogUi.lineC->setEditText(n3); |
| 71 | dialogUi.lineC->setMinimumWidth(200); |
| 72 | button = dialogUi.fileSelectC; |
| 73 | chk_connect_a(button, &QPushButton::clicked, this, &OpenDialog::selectFileC); |
| 74 | button2 = dialogUi.folderSelectC; |
| 75 | chk_connect_a(button2, &QPushButton::clicked, this, &OpenDialog::selectDirC); |
| 76 | chk_connect_a(dialogUi.lineC, &QComboBox::editTextChanged, this, &OpenDialog::inputFilenameChanged); |
| 77 | |
| 78 | button = dialogUi.swapCopy; |
| 79 | |
| 80 | QMenu* m = new QMenu(this); |
| 81 | m->addAction(i18n("Swap %1<->%2", QStringLiteral("A"), QStringLiteral("B"))); |
| 82 | m->addAction(i18n("Swap %1<->%2", QStringLiteral("B"), QStringLiteral("C"))); |
| 83 | m->addAction(i18n("Swap %1<->%2", QStringLiteral("C"), QStringLiteral("A"))); |
| 84 | m->addAction(i18n("Copy %1->Output", QStringLiteral("A"))); |
| 85 | m->addAction(i18n("Copy %1->Output", QStringLiteral("B"))); |
| 86 | m->addAction(i18n("Copy %1->Output", QStringLiteral("C"))); |
| 87 | m->addAction(i18n("Swap %1<->Output", QStringLiteral("A"))); |
| 88 | m->addAction(i18n("Swap %1<->Output", QStringLiteral("B"))); |
| 89 | m->addAction(i18n("Swap %1<->Output", QStringLiteral("C"))); |
| 90 | chk_connect_a(m, &QMenu::triggered, this, &OpenDialog::slotSwapCopyNames); |
| 91 | button->setMenu(m); |
| 92 | |
| 93 | dialogUi.lineOut->insertItems(0, gOptions->getRecentOutputFiles()); |
| 94 | dialogUi.lineOut->setEditText(outputName); |
| 95 | |