Commit a80b75e5 authored by Richard Moore's avatar Richard Moore

Imported cervisia (patched for Qt 3

svn path=/trunk/kdesdk/cervisia/; revision=112947
parents
This diff is collapsed.
THE Q PUBLIC LICENSE
version 1.0
Copyright (C) 1999-2000 Trolltech AS, Norway.
Everyone is permitted to copy and
distribute this license document.
The intent of this license is to establish freedom to share and change the
software regulated by this license under the open source model.
This license applies to any software containing a notice placed by the
copyright holder saying that it may be distributed under the terms of
the Q Public License version 1.0. Such software is herein referred to as
the Software. This license covers modification and distribution of the
Software, use of third-party application programs based on the Software,
and development of free software which uses the Software.
Granted Rights
1. You are granted the non-exclusive rights set forth in this license
provided you agree to and comply with any and all conditions in this
license. Whole or partial distribution of the Software, or software
items that link with the Software, in any form signifies acceptance of
this license.
2. You may copy and distribute the Software in unmodified form provided
that the entire package, including - but not restricted to - copyright,
trademark notices and disclaimers, as released by the initial developer
of the Software, is distributed.
3. You may make modifications to the Software and distribute your
modifications, in a form that is separate from the Software, such as
patches. The following restrictions apply to modifications:
a. Modifications must not alter or remove any copyright notices in
the Software.
b. When modifications to the Software are released under this
license, a non-exclusive royalty-free right is granted to the
initial developer of the Software to distribute your modification
in future versions of the Software provided such versions remain
available under these terms in addition to any other license(s) of
the initial developer.
4. You may distribute machine-executable forms of the Software or
machine-executable forms of modified versions of the Software, provided
that you meet these restrictions:
a. You must include this license document in the distribution.
b. You must ensure that all recipients of the machine-executable forms
are also able to receive the complete machine-readable source code
to the distributed Software, including all modifications, without
any charge beyond the costs of data transfer, and place prominent
notices in the distribution explaining this.
c. You must ensure that all modifications included in the
machine-executable forms are available under the terms of this
license.
5. You may use the original or modified versions of the Software to
compile, link and run application programs legally developed by you
or by others.
6. You may develop application programs, reusable components and other
software items that link with the original or modified versions of the
Software. These items, when distributed, are subject to the following
requirements:
a. You must ensure that all recipients of machine-executable forms of
these items are also able to receive and use the complete
machine-readable source code to the items without any charge
beyond the costs of data transfer.
b. You must explicitly license all recipients of your items to use
and re-distribute original and modified versions of the items in
both machine-executable and source code forms. The recipients must
be able to do so without any charges whatsoever, and they must be
able to re-distribute to anyone they choose.
c. If the items are not available to the general public, and the
initial developer of the Software requests a copy of the items,
then you must supply one.
Limitations of Liability
In no event shall the initial developers or copyright holders be liable
for any damages whatsoever, including - but not restricted to - lost
revenue or profits or other direct, indirect, special, incidental or
consequential damages, even if they have been advised of the possibility
of such damages, except to the extent invariable law, if any, provides
otherwise.
No Warranty
The Software and this license document are provided AS IS with NO WARRANTY
OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE.
Choice of Law
This license is governed by the Laws of Norway. Disputes shall be settled
by Oslo City Court.
INCLUDES = $(all_includes)
LDFLAGS = $(all_libraries) $(KDE_RPATH)
CXXFLAGS = -UQT_NO_COMPAT
bin_PROGRAMS = cervisia
lib_LTLIBRARIES = libcervisia.la
libcervisia_la_SOURCES = updateview.cpp protocolview.cpp watchdlg.cpp \
settingsdlg.cpp changelogdlg.cpp historydlg.cpp repositorydlg.cpp \
repositorysettingsdlg.cpp commitdlg.cpp checkoutdlg.cpp updatedlg.cpp \
tagdlg.cpp mergedlg.cpp \
logdlg.cpp logtree.cpp loglist.cpp diffdlg.cpp resolvedlg.cpp diffview.cpp \
annotatedlg.cpp annotateview.cpp \
cvsprogressdlg.cpp tiplabel.cpp listview.cpp multilinelabel.cpp \
cvsdir.cpp repositories.cpp misc.cpp cervisiapart.cpp
noinst_HEADERS = updateview.h protocolview.h watchdlg.h \
settingsdlg.h changelogdlg.h historydlg.h repositorydlg.h repositorysettingsdlg.h \
commitdlg.h checkoutdlg.h updatedlg.h tagdlg.h mergedlg.h \
logdlg.h logtree.h loglist.h diffdlg.h resolvedlg.h diffview.h \
annotatedlg.h annotateview.h \
cvsprogressdlg.h tiplabel.h listview.h multilinelabel.h \
cvsdir.h repositories.h misc.h
cervisia_SOURCES = main.cpp cervisiashell.cpp
cervisia_LDFLAGS = $(all_libraries) $(KDE_RPATH)
cervisia_LDADD = libcervisia.la
libcervisia_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -no-undefined
libcervisia_la_LIBADD = $(LIB_KFILE) $(LIB_KPARTS)
METASOURCES = AUTO
EXTRA_DIST = cervisia.desktop cervisia.png cervisia-small.png
apps_DATA = cervisia.desktop
appsdir = $(kde_appsdir)/Development
rcdir = $(kde_datadir)/cervisia
rc_DATA = cervisiaui.rc cervisiashellui.rc
partdir = $(kde_datadir)/cervisia
part_DATA = cervisiaui.rc cervisiashellui.rc
messages:
$(XGETTEXT) -C -ki18n -x $(kde_includes)/kde.pot $(cervisia_SOURCES) \
$(libcervisia_la_SOURCES) \
&& mv messages.po ../po/cervisia.pot
install-data-local:
$(mkinstalldirs) $(DESTDIR)/$(kde_icondir)/hicolor/32x32/apps
$(INSTALL_DATA) $(srcdir)/cervisia.png $(DESTDIR)/$(kde_icondir)/hicolor/32x32/apps/cervisia.png
$(mkinstalldirs) $(DESTDIR)/$(kde_icondir)/hicolor/16x16/apps
$(INSTALL_DATA) $(srcdir)/cervisia-small.png $(DESTDIR)/$(kde_icondir)/hicolor/16x16/apps/cervisia.png
srcdoc:
$(kde_bindir)/kdoc -a -p -d classdocs -n 'Cervisia' *.h -lqt -lkdecore -lkdeui -lkparts
Cervisia requires cvs 1.10 on the cvs server. With
cvs 1.9, diffs don't work! As this old version has a
y2k bug, switching is advisable anyway.
From version 1.1 on, Cervisia implements the menu item
File->Revert. This hands over the command 'cvs update -C'
to the cvs client. This works only for cvs >= 1.11.
A mailing list is available at sourceforge. In order to
subscribe, fill out and submit the form
http://lists.sourceforge.net/lists/listinfo/cervisia-user
Bug reports are welcome. My time is limited, so don't
expect wonders. If you have made a binary package, other
users may be interested in it.
If you want to contribute bugfixes or improvements,
check out the source code from anonymous cvs (follow
on the respective link Cervisia's homepage). In order
to bootstrap the package, you have to
'make -f Makefile.cvs' there. Then you can make patches
either by using 'cvs diff -u' or by using the 'Create
patch' menu item in Cervisia.
Bernd Gehrmann <bernd@physik.hu-berlin.de>
Ideas in no special order
* Configurable popup menu
* Per-repository settings like compression,
enabling of watch/edit/lock features
* Make change log font configurable
* Log dialog option: Show only tagged revisions
* Log dialog option: Show only your revisions
* Log dialog: Allow to select latest on branch
* Multi Log view
* Diff against HEAD
* Diff between any revision and the sandbox
* Implement "Add to .cvsignore"
* Make colors customizable
* cvs init
* Checkout by tag
* Implement a nice workaround for $CVSROOT/CVSROOT/cvsignore
/*
* Copyright (C) 1999-2001 Bernd Gehrmann
* bernd@physik.hu-berlin.de
*
* This program may be distributed under the terms of the Q Public
* License as defined by Trolltech AS of Norway and appearing in the
* file LICENSE.QPL included in the packaging of this file.
*
* 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.
*/
#include <qfileinfo.h>
#include <qframe.h>
#include <qlayout.h>
#include <kapp.h>
#include <kbuttonbox.h>
#include <kconfig.h>
#include <klocale.h>
#include <kprocess.h>
#include "annotateview.h"
#include "cvsprogressdlg.h"
#include "misc.h"
#include "annotatedlg.h"
#include "annotatedlg.moc"
AnnotateDialog::Options *AnnotateDialog::options = 0;
AnnotateDialog::AnnotateDialog(QWidget *parent, const char *name)
: QDialog(parent, name, false,
WStyle_Customize|WStyle_NormalBorder|WStyle_Title|WStyle_MinMax)
{
QBoxLayout *layout = new QVBoxLayout(this, 10);
annotate = new AnnotateView(this);
layout->addWidget(annotate, 10);
QFrame *frame = new QFrame(this);
frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
frame->setMinimumHeight(frame->sizeHint().height());
layout->addWidget(frame, 0);
KButtonBox *buttonbox = new KButtonBox(this);
buttonbox->addStretch();
connect( buttonbox->addButton(i18n("&Close")), SIGNAL(clicked()),
SLOT(reject()) );
buttonbox->layout();
layout->addWidget(buttonbox, 0);
QFontMetrics fm(fontMetrics());
setMinimumSize(fm.width("0123456789")*12,
fm.lineSpacing()*30);
layout->activate();
if (options)
resize(options->size);
}
void AnnotateDialog::done(int res)
{
if (!options)
options = new Options;
options->size = size();
QDialog::done(res);
delete this;
}
void AnnotateDialog::loadOptions(KConfig *config)
{
if (!config->readEntry("Customized"))
return;
options = new Options;
options->size = config->readSizeEntry("Size");
}
void AnnotateDialog::saveOptions(KConfig *config)
{
if (!options)
return;
config->writeEntry("Customized", true);
config->writeEntry("Size", options->size);
}
bool AnnotateDialog::parseCvsAnnotate(const QString &sandbox, const QString &repository,
const QString &filename, const QString &annorev)
{
QStringList strlist;
QString rev, date, author, comment, content;
QMap<QString, QString> logmap;
enum { Begin, Tags, Admin, Revision,
Author, Branches, Comment, Finished } state;
setCaption("CVS Annotate: " + filename);
QString cmdline = cvsClient(repository);
cmdline += " log ";
cmdline += KShellProcess::quote(filename);
cmdline += " && ";
cmdline += cvsClient(repository);
cmdline += " annotate ";
if (!annorev.isEmpty())
{
cmdline += " -r ";
cmdline += annorev;
}
cmdline += " ";
cmdline += KShellProcess::quote(filename);
// Hack because the string Annotations for blabla is
// printed to stderr even with option -Q. Arg!
cmdline += " 2>&1";
CvsProgressDialog l("Annotate", this);
l.setCaption("CVS Annotate");
if (!l.execCommand(sandbox, repository, cmdline, "annotate"))
return false;
//
// First the log output...
//
state = Begin;
QCString line;
while (l.getOneLine(&line))
{
switch (state)
{
case Begin:
if (line == "symbolic names:")
state = Tags;
break;
case Tags:
if (line[0] != '\t')
state = Admin;
break;
case Admin:
if (line == "----------------------------")
state = Revision;
break;
case Revision:
strlist = splitLine(line);
rev = strlist[1];
state = Author;
break;
case Author:
state = Branches;
break;
case Branches:
if (line.left(9) != "branches:")
{
state = Comment;
comment = line;
}
break;
case Comment:
if (line == "----------------------------")
state = Revision;
else if (line == "=============================================================================")
state = Finished;
if (state == Comment)
comment += QString("\n") + QString(line);
else
logmap[rev] = comment;
break;
case Finished:
;
}
if (state == Finished)
break;
}
//
// ... then the annotate output.
//
for (int i = 0; i < 2; ++i)
l.getOneLine(&line);
bool odd = false;
QString oldRevision = "";
while ( l.getOneLine(&line) )
{
rev = line.left(13).stripWhiteSpace();
comment = logmap[rev];
author = line.mid(14, 8).stripWhiteSpace();
date = line.mid(23, 9);
content = line.mid(35, line.length()-35);
if (comment.isNull())
comment = "";
if (rev == oldRevision)
{
author = QString::null;
rev = QString::null;
}
else
{
oldRevision = rev;
odd = !odd;
}
annotate->addLine(rev, author, date, content, comment, odd);
}
return true; // successful
}
// Local Variables:
// c-basic-offset: 4
// End:
/*
* Copyright (C) 1999-2001 Bernd Gehrmann
* bernd@physik.hu-berlin.de
*
* This program may be distributed under the terms of the Q Public
* License as defined by Trolltech AS of Norway and appearing in the
* file LICENSE.QPL included in the packaging of this file.
*
* 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.
*/
#ifndef _ANNOTATEDLG_H_
#define _ANNOTATEDLG_H_
#include <qdialog.h>
class AnnotateView;
class AnnotateDialog : public QDialog
{
Q_OBJECT
public:
AnnotateDialog( QWidget *parent=0, const char *name=0 );
bool parseCvsAnnotate(const QString &sandbox, const QString &repository,
const QString &filename, const QString &rev);
static void loadOptions(KConfig *config);
static void saveOptions(KConfig *config);
protected slots:
virtual void done(int res);
private:
struct Options {
QSize size;
};
static Options *options;
AnnotateView *annotate;
};
#endif
// Local Variables:
// c-basic-offset: 4
// End:
/*
* Copyright (C) 1999-2001 Bernd Gehrmann
* bernd@physik.hu-berlin.de
*
* This program may be distributed under the terms of the Q Public
* License as defined by Trolltech AS of Norway and appearing in the
* file LICENSE.QPL included in the packaging of this file.
*
* 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.
*/
#include <qpainter.h>
#include <kapp.h>
#include <kconfig.h>
#include "tiplabel.h"
#include "misc.h"
#include "cervisiapart.h"
#include "annotateview.h"
#include "annotateview.moc"
static const int BORDER = 4;
class AnnotateViewItem
{
public:
QString rev;
QString author;
QString date;
QString content;
QString comment;
bool odd;
};
AnnotateView::AnnotateView( QWidget *parent, const char *name )
: QTableView(parent, name, WNorthWestGravity | WRepaintNoErase | WResizeNoErase)
{
setNumRows(0);
setNumCols(3);
setTableFlags( Tbl_autoVScrollBar|Tbl_autoHScrollBar|
Tbl_smoothVScrolling );
setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
setBackgroundMode(PaletteBase);
setMouseTracking(true);
KConfig *config = CervisiaPart::config();
config->setGroup("LookAndFeel");
setFont(config->readFontEntry("AnnotateFont"));
QFontMetrics fm(font());
setCellHeight(fm.lineSpacing());
setCellWidth(0);
currentRow = -1;
currentLabel = 0;
items.setAutoDelete(true);
}
AnnotateView::~AnnotateView()
{
delete currentLabel;
}
void AnnotateView::setFont(const QFont &font)
{
QTableView::setFont(font);
QFontMetrics fm(font);
setCellHeight(fm.lineSpacing());
}
void AnnotateView::addLine(const QString &rev, const QString &author, const QString &date,
const QString &content, const QString &comment, bool odd)
{
AnnotateViewItem *item = new AnnotateViewItem;
item->rev = rev;
item->author = author;
item->date = date;
item->content = content;
item->comment = comment;
item->odd = odd;
items.append(item);
setNumRows(numRows()+1);
}
int AnnotateView::cellWidth(int col)
{
QFontMetrics fm(font());
switch (col)
{
case 0: return fm.width("10000");
case 1: return fm.width("1.0.1.0.1 gehrmab");
case 2: { int rest = cellWidth(0)+cellWidth(1); return viewWidth()-rest; }
default: return 0; // should not occur
}
}
QSize AnnotateView::sizeHint() const
{
QFontMetrics fm(font());
AnnotateView *that = const_cast<AnnotateView*>(this);
return QSize( that->cellWidth(0) + that->cellWidth(1) + 8*fm.width("0123456789"),
fm.lineSpacing()*8 );
}
void AnnotateView::paintCell(QPainter *p, int row, int col)
{
AnnotateViewItem *item = items.at(row);
int width = cellWidth(col);
int height = cellHeight();
QColor backgroundColor;
int innerborder;
QString str;
if (col == 0)
{
backgroundColor = QColor(222, 222, 222);
innerborder = 0;
str.setNum(row+1);
}
else if (col == 1)
{