Exemplo n.º 1
0
void SubmitEditorWidget::setFileModel(QAbstractItemModel *model)
{
    m_d->m_ui.fileView->clearSelection(); // trigger the change signals

    m_d->m_ui.fileView->setModel(model);

    if (model->rowCount()) {
        const int columnCount = model->columnCount();
        for (int c = 0; c < columnCount; c++) {
            m_d->m_ui.fileView->resizeColumnToContents(c);
        }
    }

    connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)),
            this, SLOT(updateSubmitAction()));
    connect(model, SIGNAL(modelReset()),
            this, SLOT(updateSubmitAction()));
    connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)),
            this, SLOT(updateSubmitAction()));
    connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int)),
            this, SLOT(updateSubmitAction()));
    connect(m_d->m_ui.fileView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
            this, SLOT(updateDiffAction()));
    updateActions();
}
Exemplo n.º 2
0
void SubmitEditorWidget::setEmptyFileListEnabled(bool e)
{
    if (e != d->m_emptyFileListEnabled) {
        d->m_emptyFileListEnabled = e;
        updateSubmitAction();
    }
}
SubmitEditorWidget::SubmitEditorWidget(QWidget *parent) :
    QWidget(parent),
    m_d(new SubmitEditorWidgetPrivate)
{
    m_d->m_ui.setupUi(this);
    m_d->m_ui.description->setContextMenuPolicy(Qt::CustomContextMenu);
    m_d->m_ui.description->setLineWrapMode(QTextEdit::NoWrap);
    m_d->m_ui.description->setWordWrapMode(QTextOption::WordWrap);
    connect(m_d->m_ui.description, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(editorCustomContextMenuRequested(QPoint)));
    connect(m_d->m_ui.description, SIGNAL(textChanged()),
            this, SLOT(updateSubmitAction()));

    // File List
    m_d->m_ui.fileView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_d->m_ui.fileView, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(fileListCustomContextMenuRequested(QPoint)));
    m_d->m_ui.fileView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_d->m_ui.fileView->setRootIsDecorated(false);
    connect(m_d->m_ui.fileView, SIGNAL(doubleClicked(QModelIndex)),
            this, SLOT(diffActivated(QModelIndex)));

    setFocusPolicy(Qt::StrongFocus);
    setFocusProxy(m_d->m_ui.description);
}
Exemplo n.º 4
0
void SubmitEditorWidget::descriptionTextChanged()
{
    d->m_description = cleanupDescription(d->m_ui.description->toPlainText());
    wrapDescription();
    trimDescription();
    // append field entries
    foreach (const SubmitFieldWidget *fw, d->m_fieldWidgets)
        d->m_description += fw->fieldValues();
    updateSubmitAction();
}
Exemplo n.º 5
0
void GitSubmitEditorWidget::authorInformationChanged()
{
    bool bothEmpty = m_gitSubmitPanelUi.authorLineEdit->text().isEmpty() &&
            m_gitSubmitPanelUi.emailLineEdit->text().isEmpty();

    m_gitSubmitPanelUi.invalidAuthorLabel->
            setVisible(m_gitSubmitPanelUi.authorLineEdit->text().isEmpty() && !bothEmpty);
    m_gitSubmitPanelUi.invalidEmailLabel->
            setVisible(!emailIsValid() && !bothEmpty);

    updateSubmitAction();
}
Exemplo n.º 6
0
void SubmitEditorWidget::descriptionTextChanged()
{
#if QT_VERSION < 0x050000 // Fix Qt-Bug, see QTCREATORBUG-5633 && QTCREATORBUG-6082
    static QString lastText;
    const QString text = d->m_ui.description->toPlainText();
    if (lastText != text)
        lastText = text;
    else
        return;
#endif
    updateSubmitAction();
}
Exemplo n.º 7
0
void SubmitEditorWidget::setUpdateInProgress(bool value)
{
    d->m_updateInProgress = value;
    updateSubmitAction();
}
Exemplo n.º 8
0
void SubmitEditorWidget::updateActions()
{
    updateSubmitAction();
    updateDiffAction();
    updateCheckAllComboBox();
}
Exemplo n.º 9
0
void GitSubmitEditorWidget::commitAndPushToGerritSlot()
{
    m_pushAction = PushToGerrit;
    updateSubmitAction();
}
Exemplo n.º 10
0
void GitSubmitEditorWidget::commitAndPushSlot()
{
    m_pushAction = NormalPush;
    updateSubmitAction();
}
Exemplo n.º 11
0
void GitSubmitEditorWidget::commitOnlySlot()
{
    m_pushAction = NoPush;
    updateSubmitAction();
}
Exemplo n.º 12
0
void SubmitEditorWidget::updateActions()
{
    updateSubmitAction();
    updateDiffAction();
}