aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/help
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2008-01-15 00:44:02 +0000
committerGravatar Szymon Tomasz Stefanek2008-01-15 00:44:02 +0000
commitf366793158b096ece7ca23a742c5ae9ed8688f65 (patch)
tree7cf67714b1af2a4e9e520b8c8b8ba1b77332fb20 /src/modules/help
parentmodified Makefiles to accept new Croatian translation files (diff)
downloadKVIrc-f366793158b096ece7ca23a742c5ae9ed8688f65.tar.gz
KVIrc-f366793158b096ece7ca23a742c5ae9ed8688f65.tar.bz2
KVIrc-f366793158b096ece7ca23a742c5ae9ed8688f65.zip
More alternate port to Qt4: no longer relying on Qt collection classes
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1085 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/help')
-rw-r--r--src/modules/help/helpwidget.cpp4
-rw-r--r--src/modules/help/helpwindow.cpp4
-rwxr-xr-xsrc/modules/help/index.cpp109
-rwxr-xr-xsrc/modules/help/index.h10
-rw-r--r--src/modules/help/libkvihelp.cpp8
5 files changed, 16 insertions, 119 deletions
diff --git a/src/modules/help/helpwidget.cpp b/src/modules/help/helpwidget.cpp
index c416b714e..b35c1d1a0 100644
--- a/src/modules/help/helpwidget.cpp
+++ b/src/modules/help/helpwidget.cpp
@@ -39,8 +39,8 @@
#include <qclipboard.h>
extern Index * g_pDocIndex;
-extern KviPtrList<KviHelpWindow> * g_pHelpWindowList;
-extern KviPtrList<KviHelpWidget> * g_pHelpWidgetList;
+extern KviPointerList<KviHelpWindow> * g_pHelpWindowList;
+extern KviPointerList<KviHelpWidget> * g_pHelpWidgetList;
KviHelpWidget::KviHelpWidget(QWidget * par,KviFrame * lpFrm,bool bIsStandalone)
: QWidget(par,"help_widget")
diff --git a/src/modules/help/helpwindow.cpp b/src/modules/help/helpwindow.cpp
index 197e9e811..a1a8a6dec 100644
--- a/src/modules/help/helpwindow.cpp
+++ b/src/modules/help/helpwindow.cpp
@@ -41,8 +41,8 @@
#include "kvi_valuelist.h"
extern Index * g_pDocIndex;
-extern KviPtrList<KviHelpWindow> * g_pHelpWindowList;
-extern KviPtrList<KviHelpWidget> * g_pHelpWidgetList;
+extern KviPointerList<KviHelpWindow> * g_pHelpWindowList;
+extern KviPointerList<KviHelpWidget> * g_pHelpWidgetList;
bool g_bIndexingDone = FALSE;
KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name)
diff --git a/src/modules/help/index.cpp b/src/modules/help/index.cpp
index d1c629793..659ff44cb 100755
--- a/src/modules/help/index.cpp
+++ b/src/modules/help/index.cpp
@@ -1,75 +1,14 @@
-/**********************************************************************
-
-** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
-
-**
-
-** This file is part of the Qt Assistant.
-
-**
-
-** This file may be distributed and/or modified under the terms of the
-
-** GNU General Public License version 2 as published by the Free Software
-
-** Foundation and appearing in the file LICENSE.GPL included in the
-
-** packaging of this file.
-
-**
-
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-
-** licenses may use this file in accordance with the Qt Commercial License
-
-** Agreement provided with the Software.
-
-**
-
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-**
-
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-
-** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-
-** information about Qt Commercial License Agreements.
-
-**
-
-** Contact info@trolltech.com if any conditions of this licensing are
-
-** not clear to you.
-
-**
-
-**********************************************************************/
-
-
-
#include "index.h"
-
-
#include "kvi_file.h"
-
#include <qdir.h>
-
#include <qstringlist.h>
-
-#include "kvi_dict.h"
-
+#include "kvi_pointerhashtable.h"
#include <qapplication.h>
-
#include <qtextstream.h>
-
#include <ctype.h>
-
int kvi_compare(const Term * p1,const Term * p2)
{
if(p1->frequency == p2->frequency)
@@ -79,49 +18,29 @@ int kvi_compare(const Term * p1,const Term * p2)
return 1;
}
-
QDataStream &operator>>( QDataStream &s, Document &l )
-
{
-
s >> l.docNumber;
-
s >> l.frequency;
-
return s;
-
}
-
-
QDataStream &operator<<( QDataStream &s, const Document &l )
-
{
-
s << (Q_INT16)l.docNumber;
-
s << (Q_INT16)l.frequency;
-
return s;
-
}
-
-
Index::Index( const QString &dp, const QString &hp )
: QObject( 0, 0 ), dict( 8999 ), docPath( dp )
{
-
alreadyHaveDocList = FALSE;
-
lastWindowClosed = FALSE;
-
connect( qApp, SIGNAL( lastWindowClosed() ),
-
this, SLOT( setLastWinClosed() ) );
-
}
@@ -131,17 +50,11 @@ Index::Index( const QStringList &dl, const QString &hp )
: QObject( 0, 0 ), dict( 8999 )
{
-
docList = dl;
-
alreadyHaveDocList = TRUE;
-
lastWindowClosed = FALSE;
-
connect( qApp, SIGNAL( lastWindowClosed() ),
-
this, SLOT( setLastWinClosed() ) );
-
}
@@ -220,37 +133,21 @@ void Index::setupDocumentList()
void Index::insertInDict( const QString &str, int docNum )
-
{
-
if ( strcmp( str, "amp" ) == 0 || strcmp( str, "nbsp" ) == 0 )
-
return;
-
Entry *e = 0;
-
if ( dict.count() )
-
e = dict[ str ];
-
-
if ( e ) {
-
if ( e->documents.first().docNumber != docNum )
-
e->documents.prepend( Document( docNum, 1 ) );
-
else
-
e->documents.first().frequency++;
-
} else {
-
dict.insert( str, new Entry( docNum ) );
-
}
-
}
@@ -329,7 +226,7 @@ void Index::writeDict()
{
- KviDictIterator<Entry> it( dict );
+ KviPointerHashTableIterator<QString,Entry> it( dict );
KviFile f( dictFile );
@@ -596,7 +493,7 @@ QStringList Index::getWildcardTerms( const QString &term )
#endif
- KviDictIterator<Entry> it( dict );
+ KviPointerHashTableIterator<QString,Entry> it( dict );
for( ; it.current(); ++it ) {
diff --git a/src/modules/help/index.h b/src/modules/help/index.h
index 3d2abd996..9debcb3e9 100755
--- a/src/modules/help/index.h
+++ b/src/modules/help/index.h
@@ -30,8 +30,8 @@
#define INDEX_H
#include <qstringlist.h>
-#include "kvi_dict.h"
-#include "kvi_list.h"
+#include "kvi_pointerhashtable.h"
+#include "kvi_pointerlist.h"
#include "kvi_valuelist.h"
#include <qdatastream.h>
#include <qobject.h>
@@ -99,8 +99,8 @@ private:
void buildMiniDict( const QString& );
QStringList docList;
QStringList titleList;
- KviDict<Entry> dict;
- KviDict<PosEntry> miniDict;
+ KviPointerHashTable<QString,Entry> dict;
+ KviPointerHashTable<QString,PosEntry> miniDict;
uint wordNum;
QString docPath;
QString dictFile, docListFile;
@@ -118,7 +118,7 @@ struct Term {
-#define TermList KviPtrList<Term>
+#define TermList KviPointerList<Term>
#endif
diff --git a/src/modules/help/libkvihelp.cpp b/src/modules/help/libkvihelp.cpp
index 5f1c30f02..5bf4737c7 100644
--- a/src/modules/help/libkvihelp.cpp
+++ b/src/modules/help/libkvihelp.cpp
@@ -39,8 +39,8 @@
#include <qsplitter.h>
Index * g_pDocIndex = 0;
-KviPtrList<KviHelpWidget> * g_pHelpWidgetList = 0;
-KviPtrList<KviHelpWindow> * g_pHelpWindowList = 0;
+KviPointerList<KviHelpWidget> * g_pHelpWidgetList = 0;
+KviPointerList<KviHelpWindow> * g_pHelpWindowList = 0;
/*
@doc: help.search
@@ -197,9 +197,9 @@ static bool help_module_init(KviModule * m)
- g_pHelpWidgetList = new KviPtrList<KviHelpWidget>;
+ g_pHelpWidgetList = new KviPointerList<KviHelpWidget>;
g_pHelpWidgetList->setAutoDelete(false);
- g_pHelpWindowList = new KviPtrList<KviHelpWindow>;
+ g_pHelpWindowList = new KviPointerList<KviHelpWindow>;
g_pHelpWindowList->setAutoDelete(false);
KVSM_REGISTER_SIMPLE_COMMAND(m,"open",help_kvs_cmd_open);