Browse Source

[EVO] Start dialog box to log RCS

master
Ulrich Van Den Hekke 12 years ago
parent
commit
8f751d6889
  1. 2
      framework/project/projectdirectorywidgetimpl.cpp
  2. 197
      framework/versioncontrol/logdialog.ui
  3. 60
      framework/versioncontrol/logdialogimpl.cpp
  4. 41
      framework/versioncontrol/logdialogimpl.h
  5. 38
      framework/versioncontrol/logdialogimpl_p.h
  6. 30
      framework/versioncontrol/logentry.cpp
  7. 43
      framework/versioncontrol/logentry.h
  8. 30
      framework/versioncontrol/logpath.cpp
  9. 44
      framework/versioncontrol/logpath.h
  10. 3
      framework/versioncontrol/rcs.h
  11. 11
      framework/versioncontrol/rcsproxy.cpp
  12. 2
      framework/versioncontrol/rcsproxy.h
  13. 54
      plugins/svnplugin/rcs_svn.cpp
  14. 4
      plugins/svnplugin/rcs_svn.h

2
framework/project/projectdirectorywidgetimpl.cpp

@ -505,7 +505,7 @@ void PrivateProjectDirectoryWidgetImpl::showLogTriggered()
XinxProject::ProjectPtr project = _model->fileProject(rows.at(0));
Q_ASSERT(! project->projectRCS().isEmpty() && project->rcsProxy() && project->rcsProxy()->currentRCSInterface());
project->rcsProxy()->currentRCSInterface()->log(_model->filePath(rows.at(0)));
project->rcsProxy()->log(_model->filePath(rows.at(0)), _parent);
}
void PrivateProjectDirectoryWidgetImpl::doubleClicked(const QModelIndex & index)

197
framework/versioncontrol/logdialog.ui

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LogDialog</class>
<widget class="QDialog" name="LogDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>610</width>
<height>411</height>
</rect>
</property>
<property name="windowTitle">
<string>Log</string>
</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>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>&amp;Log :</string>
</property>
<property name="buddy">
<cstring>logList</cstring>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="logList">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Revision</string>
</property>
</column>
<column>
<property name="text">
<string>Actions</string>
</property>
</column>
<column>
<property name="text">
<string>Author</string>
</property>
</column>
<column>
<property name="text">
<string>Date</string>
</property>
</column>
<column>
<property name="text">
<string>Message</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&amp;Message :</string>
</property>
<property name="buddy">
<cstring>logMessage</cstring>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="logMessage"/>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>&amp;Changed path :</string>
</property>
<property name="buddy">
<cstring>logPath</cstring>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="logPath">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Action</string>
</property>
</column>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
<column>
<property name="text">
<string>Informations</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>XinxLineEdit</class>
<extends>QLineEdit</extends>
<header location="global">xinxlineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>LogDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>222</x>
<y>396</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>LogDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>290</x>
<y>402</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

60
framework/versioncontrol/logdialogimpl.cpp

@ -0,0 +1,60 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "logdialogimpl_p.h"
/* LogDialogImplPrivate */
LogDialogImplPrivate::LogDialogImplPrivate() : _ui(new Ui::LogDialog)
{
}
LogDialogImplPrivate::~LogDialogImplPrivate()
{
}
/* LogDialogImpl */
LogDialogImpl::LogDialogImpl(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f), d(new LogDialogImplPrivate)
{
d->_ui->setupUi(this);
}
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"));
}
}
const LogEntries& LogDialogImpl::logEntries() const
{
return d->_logEntries;
}

41
framework/versioncontrol/logdialogimpl.h

@ -0,0 +1,41 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOGDIALOGIMPL_H
#define LOGDIALOGIMPL_H
#include <QDialog>
#include <versioncontrol/rcs.h>
class LogDialogImplPrivate;
class LogDialogImpl : public QDialog
{
Q_OBJECT
public:
LogDialogImpl(QWidget* parent = 0, Qt::WindowFlags f = 0);
virtual ~LogDialogImpl();
void setLogEntries(const LogEntries & log);
const LogEntries & logEntries() const;
private:
QScopedPointer<LogDialogImplPrivate> d;
};
#endif // LOGDIALOGIMPL_H

38
framework/versioncontrol/logdialogimpl_p.h

@ -0,0 +1,38 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOGDIALOGIMPLP_H
#define LOGDIALOGIMPLP_H
#include <QObject>
#include "ui_logdialog.h"
#include "logdialogimpl.h"
class LogDialogImplPrivate : public QObject
{
Q_OBJECT
public:
LogDialogImplPrivate();
virtual ~LogDialogImplPrivate();
QScopedPointer<Ui::LogDialog> _ui;
LogEntries _logEntries;
};
#endif // LOGDIALOGIMPLP_H

30
framework/versioncontrol/logentry.cpp

@ -0,0 +1,30 @@
/*
XINX
Copyright (C) 2007-2010 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "logentry.h"
LogEntry::LogEntry()
{
}
LogEntry::~LogEntry()
{
}

43
framework/versioncontrol/logentry.h

@ -0,0 +1,43 @@
/*
XINX
Copyright (C) 2007-2010 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOGENTRY_H
#define LOGENTRY_H
#include <versioncontrol/logpath.h>
#include <QList>
#include <QDateTime>
class LogEntry
{
public:
LogEntry();
~LogEntry();
QString revision;
QString author;
QDateTime dateTime;
QList<LogPath> changedPath;
QString message;
};
typedef QList<LogEntry> LogEntries;
#endif // LOGENTRY_H

30
framework/versioncontrol/logpath.cpp

@ -0,0 +1,30 @@
/*
XINX
Copyright (C) 2007-2010 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "logpath.h"
LogPath::LogPath()
{
}
LogPath::~LogPath()
{
}

44
framework/versioncontrol/logpath.h

@ -0,0 +1,44 @@
/*
XINX
Copyright (C) 2007-2010 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOGPATH_H
#define LOGPATH_H
#include <QString>
#include <QStringList>
class LogPath
{
public:
enum logPathState
{
STATE_ADD,
STATE_REMOVE,
STATE_MODIFY
};
LogPath();
~LogPath();
enum logPathState state;
QString path;
QStringList informations;
};
#endif // LOGPATH_H

3
framework/versioncontrol/rcs.h

@ -24,6 +24,7 @@
// Xinx header
#include <core/lib-config.h>
#include <core/xinxcore.h>
#include <versioncontrol/logentry.h>
// Qt header
#include <QMetaType>
@ -109,7 +110,7 @@ public:
virtual void update(const QStringList & paths) {}
virtual void updateToRevision(const QString & path, const QString & revision, QByteArray * content = 0) {}
virtual void commit(const QStringList & paths, const QString & message) {}
virtual void log(const QString & path) {}
virtual LogEntries log(const QString & path, const QString & revisionStart = QString(), const QString & revisionEnd = QString()) { return LogEntries(); }
virtual void blame(const QString & path) {}
/* Operation on file of the working copy */

11
framework/versioncontrol/rcsproxy.cpp

@ -32,6 +32,7 @@
/*!
* \defgroup RCS Revision Control System
*/
#include "logdialogimpl.h"
namespace VersionControl
{
@ -301,6 +302,16 @@ void RCSProxy::updateToRevision(const QString & path, const QString & revision,
VersionControl::Manager::self()->updateRevision(m_rcs, path, revision, content);
}
//! Get the log of a path
void RCSProxy::log(const QString& path, QWidget * parent)
{
Q_ASSERT(m_rcs);
LogDialogImpl dlg(parent);
dlg.setLogEntries(m_rcs->log(path));
dlg.exec();
}
//! Abort all the opreration
void RCSProxy::abort()
{

2
framework/versioncontrol/rcsproxy.h

@ -72,6 +72,8 @@ public slots:
void updateToRevision(const QString & path, const QString & revision, QByteArray * content = 0);
void log(const QString& path, QWidget* parent);
void abort();
signals:
void stateChange(const QString & filename, RCS::struct_rcs_infos informations);

54
plugins/svnplugin/rcs_svn.cpp

@ -668,19 +668,65 @@ void RCS_SVN::revert(const QStringList & paths)
}
}
void RCS_SVN::log(const QString & path)
svn::Revision RCS_SVN::stringToRevision(const QString& rev)
{
bool intConvert;
svn_revnum_t revnumber = svn_revnum_t(rev.toInt(&intConvert));
if (intConvert) return svn::Revision(revnumber);
QDateTime dateTime = QDateTime::fromString(rev, Qt::DefaultLocaleShortDate);
if (dateTime.isValid())
{
return svn::Revision(apr_time_t(dateTime.toTime_t() * 1000000));
}
return svn::Revision::UNSPECIFIED;
}
LogEntries RCS_SVN::log(const QString& path, const QString& revisionStart, const QString& revisionEnd)
{
_listener->_cancel = false;
LogEntries result;
try
{
const svn::LogEntries* logs = m_client->log(qPrintable(path), svn::Revision::START, svn::Revision::WORKING);
svn::Revision svnRevisionStart = svn::Revision::START;
svn::Revision svnRevisionEnd = svn::Revision::HEAD;
if (! revisionStart.isEmpty())
{
svnRevisionStart = stringToRevision(revisionStart);
}
if (! revisionEnd.isEmpty())
{
svnRevisionEnd = stringToRevision(revisionEnd);
}
const svn::LogEntries* logs = m_client->log(qPrintable(path), svnRevisionStart, svnRevisionEnd);
svn::LogEntries::const_iterator it = logs->begin();
while (it != logs->end())
{
LogEntry logEntry;
svn::LogEntry logLine = *it;
emit alert(RCS::LogNormal, QString("%1 - %2").arg(QString::fromStdString(logLine.author)).arg(QString::fromStdString(logLine.message)));
logEntry.dateTime = QDateTime::fromTime_t (quint64(logLine.date / 1000000));
logEntry.author = QString::fromStdString(logLine.author);
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())
{
LogPath logPath;
svn::LogChangePathEntry logPathLine = *pathIt;
logPath.path = QString::fromStdString(logPathLine.path);
logPath.informations.append(QString("%1 (rev %2)").arg(QString::fromStdString(logPathLine.copyFromPath)).arg(QString::number(logPathLine.copyFromRevision)));
logEntry.changedPath.append(logPath);
}
result.append(logEntry);
it++;
}
@ -690,6 +736,8 @@ void RCS_SVN::log(const QString & path)
{
emit alert(RCS::LogError, e.message());
}
return result;
}
void RCS_SVN::blame(const QString & path)

4
plugins/svnplugin/rcs_svn.h

@ -107,7 +107,7 @@ public:
virtual void revert(const QStringList & paths);
virtual void updateToRevision(const QString & path, const QString & revision, QByteArray * content = 0);
virtual void log(const QString & path);
virtual LogEntries log(const QString & path, const QString & revisionStart, const QString & revisionEnd = QString());
virtual void blame(const QString & path);
public slots:
virtual void abort();
@ -117,6 +117,8 @@ private:
RCS::rcsState svnStateToRcsState(svn_wc_status_kind state, svn_wc_status_kind reposTextStatus);
RCS::struct_rcs_infos svnInfoToRcsInfos(svn::Status infos);
svn::Revision stringToRevision(const QString & rev);
SubVersionContextListener * _listener;
svn::Context * m_context;
svn::Client * m_client;

Loading…
Cancel
Save