Commit 35468462 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Add config entry for showing num stat in status


Signed-off-by: Waqar Ahmed's avatarWaqar Ahmed <waqar.17a@gmail.com>
parent 0c26034c
......@@ -66,9 +66,17 @@ KateProjectConfigPage::KateProjectConfigPage(QWidget *parent, KateProjectPlugin
group->setLayout(vbox);
layout->addWidget(group);
layout->insertStretch(-1, 10);
/** Git specific **/
vbox = new QVBoxLayout;
group = new QGroupBox(i18nc("Groupbox title", "Git"), this);
m_cbGitStatusDiffNumStat = new QCheckBox(i18n("Show number of changed lines in git status"));
reset();
vbox->addWidget(m_cbGitStatusDiffNumStat);
vbox->addStretch(1);
group->setLayout(vbox);
layout->addWidget(group);
layout->insertStretch(-1, 10);
connect(m_cbAutoGit, &QCheckBox::stateChanged, this, &KateProjectConfigPage::slotMyChanged);
connect(m_cbAutoSubversion, &QCheckBox::stateChanged, this, &KateProjectConfigPage::slotMyChanged);
......@@ -78,6 +86,10 @@ KateProjectConfigPage::KateProjectConfigPage(QWidget *parent, KateProjectPlugin
connect(m_indexPath, &KUrlRequester::urlSelected, this, &KateProjectConfigPage::slotMyChanged);
connect(m_cbMultiProjectCompletion, &QCheckBox::stateChanged, this, &KateProjectConfigPage::slotMyChanged);
connect(m_cbMultiProjectGoto, &QCheckBox::stateChanged, this, &KateProjectConfigPage::slotMyChanged);
connect(m_cbGitStatusDiffNumStat, &QCheckBox::stateChanged, this, &KateProjectConfigPage::slotMyChanged);
reset();
}
QString KateProjectConfigPage::name() const
......@@ -108,6 +120,8 @@ void KateProjectConfigPage::apply()
m_cbAutoMercurial->checkState() == Qt::Checked);
m_plugin->setIndex(m_cbIndexEnabled->checkState() == Qt::Checked, m_indexPath->url());
m_plugin->setMultiProject(m_cbMultiProjectCompletion->checkState() == Qt::Checked, m_cbMultiProjectGoto->checkState() == Qt::Checked);
m_plugin->setGitStatusShowNumStat(m_cbGitStatusDiffNumStat->isChecked());
}
void KateProjectConfigPage::reset()
......@@ -119,6 +133,9 @@ void KateProjectConfigPage::reset()
m_indexPath->setUrl(m_plugin->getIndexDirectory());
m_cbMultiProjectCompletion->setCheckState(m_plugin->multiProjectCompletion() ? Qt::Checked : Qt::Unchecked);
m_cbMultiProjectGoto->setCheckState(m_plugin->multiProjectGoto() ? Qt::Checked : Qt::Unchecked);
m_cbGitStatusDiffNumStat->setChecked(m_plugin->showGitStatusWithNumStat());
m_changed = false;
}
......
......@@ -35,6 +35,8 @@ private Q_SLOTS:
void slotMyChanged();
private:
void setupGitConfigUI();
QCheckBox *m_cbAutoGit;
QCheckBox *m_cbAutoSubversion;
QCheckBox *m_cbAutoMercurial;
......@@ -42,6 +44,7 @@ private:
KUrlRequester *m_indexPath;
QCheckBox *m_cbMultiProjectCompletion;
QCheckBox *m_cbMultiProjectGoto;
QCheckBox *m_cbGitStatusDiffNumStat;
KateProjectPlugin *m_plugin;
bool m_changed = false;
};
......
......@@ -348,6 +348,17 @@ bool KateProjectPlugin::multiProjectGoto() const
return m_multiProjectGoto;
}
void KateProjectPlugin::setGitStatusShowNumStat(bool show)
{
m_gitNumStat = show;
writeConfig();
}
bool KateProjectPlugin::showGitStatusWithNumStat()
{
return m_gitNumStat;
}
void KateProjectPlugin::setMultiProject(bool completion, bool gotoSymbol)
{
m_multiProjectCompletion = completion;
......@@ -380,6 +391,8 @@ void KateProjectPlugin::readConfig()
m_multiProjectCompletion = config.readEntry("multiProjectCompletion", false);
m_multiProjectGoto = config.readEntry("multiProjectCompletion", false);
m_gitNumStat = config.readEntry("gitStatusNumStat", true);
Q_EMIT configUpdated();
}
......@@ -408,6 +421,8 @@ void KateProjectPlugin::writeConfig()
config.writeEntry("multiProjectCompletion", m_multiProjectCompletion);
config.writeEntry("multiProjectGoto", m_multiProjectGoto);
config.writeEntry("gitStatusNumStat", m_gitNumStat);
Q_EMIT configUpdated();
}
......
......@@ -102,6 +102,9 @@ public:
bool multiProjectCompletion() const;
bool multiProjectGoto() const;
void setGitStatusShowNumStat(bool show);
bool showGitStatusWithNumStat();
Q_SIGNALS:
/**
* Signal that a new project got created.
......@@ -185,6 +188,7 @@ private:
bool m_indexEnabled : 1;
bool m_multiProjectCompletion : 1;
bool m_multiProjectGoto : 1;
bool m_gitNumStat : 1;
QUrl m_indexDirectory;
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment