[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevplatform/vcs
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2007-12-07 3:11:06
Message-ID: 1196997066.909799.11018.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 745798 by apaku:
Namespace and dpointerize the model classes
M +29 -9 models/vcsannotationmodel.cpp
M +13 -6 models/vcsannotationmodel.h
M +25 -7 models/vcseventmodel.cpp
M +9 -3 models/vcseventmodel.h
M +24 -7 models/vcsitemeventmodel.cpp
M +10 -5 models/vcsitemeventmodel.h
M +3 -2 widgets/vcsannotationwidget.cpp
M +1 -0 widgets/vcseventwidget.cpp
--- trunk/KDE/kdevplatform/vcs/models/vcsannotationmodel.cpp #745797:745798
@@ -20,27 +20,45 @@
#include "vcsannotationmodel.h"
+#include "../vcsrevision.h"
+#include "../vcsannotation.h"
+
#include <QDateTime>
#include <QtGlobal>
+#include <QBrush>
#include <kurl.h>
#include <klocale.h>
#include <kdebug.h>
-#include "vcsrevision.h"
+#include <QHash>
+
+
+namespace KDevelop
+{
+
+class VcsAnnotationModelPrivate
+{
+public:
+ KDevelop::VcsAnnotation m_annotation;
+ QHash<KDevelop::VcsRevision,QBrush> m_brushes;
+};
+
VcsAnnotationModel::VcsAnnotationModel( const KUrl& url )
+ : d( new VcsAnnotationModelPrivate )
{
- m_annotation.setLocation( url );
+ d->m_annotation.setLocation( url );
qsrand( QDateTime().toTime_t() );
}
VcsAnnotationModel::~VcsAnnotationModel()
{
+ delete d;
}
int VcsAnnotationModel::rowCount( const QModelIndex& ) const
{
- return m_annotation.lineCount();
+ return d->m_annotation.lineCount();
}
int VcsAnnotationModel::columnCount( const QModelIndex& ) const
@@ -57,10 +75,10 @@
if( idx.row() < 0 || idx.row() >= rowCount() || idx.column() < 0 || idx.column() >= columnCount() )
return QVariant();
- KDevelop::VcsAnnotationLine line = m_annotation.line( idx.row() );
+ KDevelop::VcsAnnotationLine line = d->m_annotation.line( idx.row() );
if( role == Qt::BackgroundRole )
{
- return QVariant( m_brushes[line.revision()] );
+ return QVariant( d->m_brushes[line.revision()] );
}else
{
switch( idx.column() )
@@ -124,21 +142,23 @@
beginInsertRows( QModelIndex(), rowCount(), list.count() );
foreach( KDevelop::VcsAnnotationLine l, list )
{
- if( !m_brushes.contains( l.revision() ) )
+ if( !d->m_brushes.contains( l.revision() ) )
{
int r = ( float(qrand()) / RAND_MAX ) * 255;
int g = ( float(qrand()) / RAND_MAX ) * 255;
int b = ( float(qrand()) / RAND_MAX ) * 255;
- m_brushes.insert( l.revision(), QBrush( QColor( r, g, b, 80 ) ) );
+ d->m_brushes.insert( l.revision(), QBrush( QColor( r, g, b, 80 ) ) );
}
- m_annotation.insertLine( l.lineNumber(), l );
+ d->m_annotation.insertLine( l.lineNumber(), l );
}
endInsertRows();
}
KDevelop::VcsAnnotation VcsAnnotationModel::annotation() const
{
- return m_annotation;
+ return d->m_annotation;
}
+}
+
#include "vcsannotationmodel.moc"
--- trunk/KDE/kdevplatform/vcs/models/vcsannotationmodel.h #745797:745798
@@ -22,12 +22,18 @@
#define VCSANNOTATIONMODEL_H
#include <QAbstractTableModel>
-#include "../vcsannotation.h"
-#include "../vcsrevision.h"
-#include <QHash>
-#include <QBrush>
#include "../vcsexport.h"
+class QModelIndex;
+template<typename T> class QList;
+class KUrl;
+
+namespace KDevelop
+{
+
+class VcsAnnotation;
+class VcsAnnotationLine;
+
class KDEVPLATFORMVCS_EXPORT VcsAnnotationModel : public QAbstractTableModel
{
Q_OBJECT
@@ -45,8 +51,9 @@
private:
- KDevelop::VcsAnnotation m_annotation;
- QHash<KDevelop::VcsRevision,QBrush> m_brushes;
+ class VcsAnnotationModelPrivate* const d;
};
+}
+
#endif
--- trunk/KDE/kdevplatform/vcs/models/vcseventmodel.cpp #745797:745798
@@ -23,19 +23,35 @@
#include <QModelIndex>
#include <QVariant>
#include <QDateTime>
+#include <QList>
#include <klocale.h>
-#include <vcsrevision.h>
+#include "../vcsevent.h"
+#include "../vcsrevision.h"
+namespace KDevelop
+{
+
+class VcsEventModelPrivate
+{
+public:
+ QList<KDevelop::VcsEvent> m_events;
+};
+
VcsEventModel::VcsEventModel( QObject* parent )
- : QAbstractTableModel( parent )
+ : QAbstractTableModel( parent ), d(new VcsEventModelPrivate)
{
}
+VcsEventModel::~VcsEventModel()
+{
+ delete d;
+}
+
int VcsEventModel::rowCount( const QModelIndex& ) const
{
- return m_events.count();
+ return d->m_events.count();
}
int VcsEventModel::columnCount( const QModelIndex& ) const
@@ -51,7 +67,7 @@
if( idx.row() < 0 || idx.row() >= rowCount() || idx.column() < 0 || idx.column() >= columnCount() )
return QVariant();
- KDevelop::VcsEvent ev = m_events.at( idx.row() );
+ KDevelop::VcsEvent ev = d->m_events.at( idx.row() );
switch( idx.column() )
{
case 0:
@@ -104,7 +120,7 @@
beginInsertRows( QModelIndex(), rowCount(), rowCount()+list.count()-1 );
else
beginInsertRows( QModelIndex(), rowCount(), list.count() );
- m_events += list;
+ d->m_events += list;
endInsertRows();
}
@@ -114,7 +130,7 @@
{
return KDevelop::VcsEvent();
}
- return m_events.at( idx.row() );
+ return d->m_events.at( idx.row() );
}
void VcsEventModel::clear()
@@ -123,8 +139,10 @@
beginRemoveRows( QModelIndex(), 0, 0 );
else
beginRemoveRows( QModelIndex(), 0, rowCount()-1 );
- m_events.clear();
+ d->m_events.clear();
endRemoveRows();
}
+}
+
#include "vcseventmodel.moc"
--- trunk/KDE/kdevplatform/vcs/models/vcseventmodel.h #745797:745798
@@ -22,16 +22,20 @@
#define VCSEVENTMODEL_H
#include <QAbstractTableModel>
-#include <QList>
-#include "../vcsevent.h"
#include "../vcsexport.h"
+namespace KDevelop
+{
+
+class VcsEvent;
+
class KDEVPLATFORMVCS_EXPORT VcsEventModel : public QAbstractTableModel
{
Q_OBJECT
public:
VcsEventModel( QObject* parent );
+ ~VcsEventModel();
int rowCount( const QModelIndex& = QModelIndex() ) const;
int columnCount( const QModelIndex& parent = QModelIndex() ) const;
QVariant data( const QModelIndex&, int role = Qt::DisplayRole ) const;
@@ -40,7 +44,9 @@
KDevelop::VcsEvent eventForIndex( const QModelIndex& ) const;
void clear();
private:
- QList<KDevelop::VcsEvent> m_events;
+ class VcsEventModelPrivate* const d;
};
+}
+
#endif
--- trunk/KDE/kdevplatform/vcs/models/vcsitemeventmodel.cpp #745797:745798
@@ -22,19 +22,35 @@
#include <QModelIndex>
#include <QVariant>
+#include <QList>
#include <klocale.h>
-#include <vcsrevision.h>
+#include "../vcsrevision.h"
+#include "../vcsevent.h"
+namespace KDevelop
+{
+
+class VcsItemEventModelPrivate
+{
+public:
+ QList<VcsItemEvent> m_itemEvents;
+};
+
VcsItemEventModel::VcsItemEventModel( QObject* parent )
- : QAbstractTableModel( parent )
+ : QAbstractTableModel( parent ), d( new VcsItemEventModelPrivate )
{
}
+VcsItemEventModel::~VcsItemEventModel()
+{
+ delete d;
+}
+
int VcsItemEventModel::rowCount( const QModelIndex& ) const
{
- return m_itemEvents.count();
+ return d->m_itemEvents.count();
}
int VcsItemEventModel::columnCount( const QModelIndex& ) const
@@ -51,7 +67,7 @@
|| idx.column() < 0 || idx.column() >= columnCount() )
return QVariant();
- KDevelop::VcsItemEvent ev = m_itemEvents.at( idx.row() );
+ KDevelop::VcsItemEvent ev = d->m_itemEvents.at( idx.row() );
switch( idx.column() )
{
case 0:
@@ -128,7 +144,7 @@
beginInsertRows( QModelIndex(), rowCount(), rowCount()+list.count()-1 );
else
beginInsertRows( QModelIndex(), rowCount(), list.count() );
- m_itemEvents += list;
+ d->m_itemEvents += list;
endInsertRows();
}
@@ -138,7 +154,7 @@
{
return KDevelop::VcsItemEvent();
}
- return m_itemEvents.at( idx.row() );
+ return d->m_itemEvents.at( idx.row() );
}
void VcsItemEventModel::clear()
@@ -147,9 +163,10 @@
beginRemoveRows( QModelIndex(), 0, 0 );
else
beginRemoveRows( QModelIndex(), 0, rowCount()-1 );
- m_itemEvents.clear();
+ d->m_itemEvents.clear();
endRemoveRows();
}
+}
#include "vcsitemeventmodel.moc"
--- trunk/KDE/kdevplatform/vcs/models/vcsitemeventmodel.h #745797:745798
@@ -23,16 +23,21 @@
#include <QAbstractTableModel>
-#include <QList>
-
-#include "../vcsevent.h"
#include "../vcsexport.h"
+template <typename T> class QList;
+
+
+namespace KDevelop
+{
+class VcsItemEvent;
+
class KDEVPLATFORMVCS_EXPORT VcsItemEventModel : public QAbstractTableModel
{
Q_OBJECT
public:
VcsItemEventModel( QObject* parent );
+ ~VcsItemEventModel();
int rowCount( const QModelIndex& parent = QModelIndex() ) const;
int columnCount( const QModelIndex& parent = QModelIndex() ) const;
QVariant data( const QModelIndex&, int role = Qt::DisplayRole ) const;
@@ -41,8 +46,8 @@
KDevelop::VcsItemEvent itemEventForIndex( const QModelIndex& ) const;
void clear();
private:
- QList<KDevelop::VcsItemEvent> m_itemEvents;
+ class VcsItemEventModelPrivate* const d;
};
+}
-
#endif
--- trunk/KDE/kdevplatform/vcs/widgets/vcsannotationwidget.cpp #745797:745798
@@ -24,9 +24,10 @@
#include <QSortFilterProxyModel>
#include <QHeaderView>
-#include "vcs/vcsjob.h"
+#include "../vcsjob.h"
-#include "vcs/models/vcsannotationmodel.h"
+#include "../models/vcsannotationmodel.h"
+#include "../vcsannotation.h"
#include "ui_vcsannotationwidget.h"
namespace KDevelop
--- trunk/KDE/kdevplatform/vcs/widgets/vcseventwidget.cpp #745797:745798
@@ -33,6 +33,7 @@
#include <interfaces/iplugin.h>
#include "../interfaces/ibasicversioncontrol.h"
#include "../vcsrevision.h"
+#include "../vcsevent.h"
#include "../vcslocation.h"
#include "../models/vcsitemeventmodel.h"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic