| 34 | }; |
| 35 | |
| 36 | VcsCommitDialog::VcsCommitDialog( IPatchSource *patchSource, QWidget *parent ) |
| 37 | : QDialog(parent) |
| 38 | , d_ptr(new VcsCommitDialogPrivate()) |
| 39 | { |
| 40 | Q_D(VcsCommitDialog); |
| 41 | |
| 42 | d->ui.setupUi(this); |
| 43 | |
| 44 | KDevelop::restoreAndAutoSaveGeometry(*this, QStringLiteral("VCS"), QStringLiteral("CommitDialog")); |
| 45 | |
| 46 | QWidget *customWidget = patchSource->customWidget(); |
| 47 | if( customWidget ) |
| 48 | { |
| 49 | d->ui.verticalLayout->insertWidget(0, customWidget); |
| 50 | } |
| 51 | |
| 52 | auto okButton = d->ui.buttonBox->button(QDialogButtonBox::Ok); |
| 53 | okButton->setDefault(true); |
| 54 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); |
| 55 | connect(d->ui.buttonBox, &QDialogButtonBox::accepted, this, &VcsCommitDialog::accept); |
| 56 | connect(d->ui.buttonBox, &QDialogButtonBox::rejected, this, &VcsCommitDialog::reject); |
| 57 | |
| 58 | d->m_patchSource = patchSource; |
| 59 | d->m_model = new VcsFileChangesModel( this, true ); |
| 60 | d->ui.files->setModel( d->m_model ); |
| 61 | |
| 62 | // Resize columns asynchronously because the contents is not ready yet. |
| 63 | QMetaObject::invokeMethod( |
| 64 | this, |
| 65 | [d] { |
| 66 | for (auto c = 0, columnCount = d->m_model->columnCount(); c != columnCount; ++c) { |
| 67 | d->ui.files->resizeColumnToContents(c); |
| 68 | } |
| 69 | }, |
| 70 | Qt::QueuedConnection); |
| 71 | } |
| 72 | |
| 73 | VcsCommitDialog::~VcsCommitDialog() = default; |
| 74 |
nothing calls this directly
no test coverage detected