Browse Source

fixes #199, #309 : Ajout de la possibilité d'afficher le log pour un fichier (pas aussi poussé que ce que peux faire TortoiseSVN mais c'est une première version).

master
Ulrich Van Den Hekke 12 years ago
parent
commit
f784d35015
  1. 54
      framework/versioncontrol/logdialog.ui
  2. 48
      framework/versioncontrol/logdialogimpl.cpp
  3. 3
      framework/versioncontrol/logdialogimpl_p.h
  4. 5
      framework/versioncontrol/rcsproxy.cpp
  5. 6
      plugins/svnplugin/rcs_svn.cpp

54
framework/versioncontrol/logdialog.ui

@ -15,37 +15,17 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;From : </string>
</property>
<property name="buddy">
<cstring>fromRevision</cstring>
</property>
</widget>
</item>
<item>
<widget class="XinxLineEdit" name="fromRevision"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;To :</string>
</property>
<property name="buddy">
<cstring>toRevision</cstring>
</property>
</widget>
</item>
<item>
<widget class="XinxLineEdit" name="toRevision"/>
</item>
<item>
<widget class="XinxLineEdit" name="searchText"/>
</item>
</layout>
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Filter :</string>
</property>
<property name="buddy">
<cstring>searchText</cstring>
</property>
</widget>
</item>
<item>
<widget class="XinxLineEdit" name="searchText"/>
</item>
<item>
<widget class="QLabel" name="label_3">
@ -70,11 +50,6 @@
<string>Revision</string>
</property>
</column>
<column>
<property name="text">
<string>Actions</string>
</property>
</column>
<column>
<property name="text">
<string>Author</string>
@ -159,6 +134,13 @@
<header location="global">xinxlineedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>searchText</tabstop>
<tabstop>logList</tabstop>
<tabstop>logMessage</tabstop>
<tabstop>logPath</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>

48
framework/versioncontrol/logdialogimpl.cpp

@ -30,12 +30,53 @@ LogDialogImplPrivate::~LogDialogImplPrivate()
{
}
void LogDialogImplPrivate::updateLogEntries()
{
QRegExp filterRegExp(_ui->searchText->text());
int index = 0;
_ui->logList->clear();
foreach(const LogEntry & entry, _logEntries)
{
if (_ui->searchText->text().isEmpty() || filterRegExp.exactMatch(entry.message))
{
QTreeWidgetItem * item = new QTreeWidgetItem(_ui->logList, QStringList() << entry.revision << entry.author << entry.dateTime.toString(Qt::SystemLocaleShortDate) << QString(entry.message).remove("\n"));
item->setData(0, Qt::UserRole, QVariant(index));
}
index++;
}
}
void LogDialogImplPrivate::updateLogEntry()
{
QTreeWidgetItem * item = _ui->logList->currentItem();
if (item)
{
int index = item->data(0, Qt::UserRole).toInt();
LogEntry entry = _logEntries.at(index);
_ui->logMessage->setPlainText(entry.message);
_ui->logPath->clear();
foreach(const LogPath & path, entry.changedPath)
{
new QTreeWidgetItem(_ui->logPath, QStringList() << QString() << path.path << path.informations);
}
}
}
/* LogDialogImpl */
LogDialogImpl::LogDialogImpl(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f), d(new LogDialogImplPrivate)
{
d->_ui->setupUi(this);
d->_ui->logPath->hide();
d->_ui->label_5->hide();
connect(d->_ui->searchText, SIGNAL(textChanged(QString)), d.data(), SLOT(updateLogEntries()));
connect(d->_ui->logList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), d.data(), SLOT(updateLogEntry()));
}
LogDialogImpl::~LogDialogImpl()
@ -46,12 +87,7 @@ LogDialogImpl::~LogDialogImpl()
void LogDialogImpl::setLogEntries(const LogEntries& log)
{
d->_logEntries = log;
d->_ui->logList->clear();
foreach(const LogEntry & entry, log)
{
new QTreeWidgetItem(d->_ui->logList, QStringList() << entry.revision << QString() << entry.author << entry.dateTime.toString() << QString(entry.message).remove("\n"));
}
d->updateLogEntries();
}
const LogEntries& LogDialogImpl::logEntries() const

3
framework/versioncontrol/logdialogimpl_p.h

@ -33,6 +33,9 @@ public:
QScopedPointer<Ui::LogDialog> _ui;
LogEntries _logEntries;
public slots:
void updateLogEntries();
void updateLogEntry();
};
#endif // LOGDIALOGIMPLP_H

5
framework/versioncontrol/rcsproxy.cpp

@ -307,8 +307,13 @@ void RCSProxy::log(const QString& path, QWidget * parent)
{
Q_ASSERT(m_rcs);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
LogDialogImpl dlg(parent);
dlg.setLogEntries(m_rcs->log(path));
QApplication::restoreOverrideCursor();
dlg.exec();
}

6
plugins/svnplugin/rcs_svn.cpp

@ -389,7 +389,7 @@ RCS_SVN::~RCS_SVN()
RCS::rcsFeatures RCS_SVN::features() const
{
return RCS::RcsFeatureAdd | RCS::RcsFeatureRemove | RCS::RcsFeatureUpdateAndCommit | RCS::RcsFeatureBlame | RCS::RcsFeatureRevert | RCS::RcsFeatureLog;
return RCS::RcsFeatureAdd | RCS::RcsFeatureRemove | RCS::RcsFeatureUpdateAndCommit /*| RCS::RcsFeatureBlame*/ | RCS::RcsFeatureRevert | RCS::RcsFeatureLog;
}
RCS::rcsState RCS_SVN::svnStateToRcsState(svn_wc_status_kind textState, svn_wc_status_kind reposTextStatus)
@ -702,7 +702,7 @@ LogEntries RCS_SVN::log(const QString& path, const QString& revisionStart, const
svnRevisionEnd = stringToRevision(revisionEnd);
}
const svn::LogEntries* logs = m_client->log(qPrintable(path), svnRevisionStart, svnRevisionEnd);
const svn::LogEntries* logs = m_client->log(qPrintable(path), svnRevisionStart, svnRevisionEnd, false);
svn::LogEntries::const_iterator it = logs->begin();
while (it != logs->end())
@ -715,6 +715,7 @@ LogEntries RCS_SVN::log(const QString& path, const QString& revisionStart, const
logEntry.message = QString::fromStdString(logLine.message);
logEntry.revision = QString::number(logLine.revision);
/*
std::list< svn::LogChangePathEntry >::iterator pathIt = logLine.changedPaths.begin();
while (pathIt != logLine.changedPaths.end())
{
@ -725,6 +726,7 @@ LogEntries RCS_SVN::log(const QString& path, const QString& revisionStart, const
logEntry.changedPath.append(logPath);
}
*/
result.append(logEntry);
it++;

Loading…
Cancel
Save