File indexing completed on 2024-05-26 07:31:04

0001 /*
0002     This file is part of Kiten, a KDE Japanese Reference Tool
0003     SPDX-FileCopyrightText: 2006 Joseph Kerian <jkerian@gmail.com>
0004     SPDX-FileCopyrightText: 2006 Eric Kjeldergaard <kjelderg@gmail.com>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KITEN_HISTORYPTRLIST_H
0010 #define KITEN_HISTORYPTRLIST_H
0011 
0012 #include <QStringList>
0013 
0014 #include "kiten_export.h"
0015 
0016 class EntryList;
0017 
0018 class KITEN_EXPORT HistoryPtrList
0019 {
0020 public:
0021     /**
0022      * Construct a HistoryPtrList, this should be done early on
0023      */
0024     HistoryPtrList();
0025     /**
0026      * Destructor... kill all lists before going
0027      */
0028     virtual ~HistoryPtrList();
0029     /**
0030      * Add an item to the end of the history list and set it as
0031      * the current displayed item.
0032      */
0033     void addItem(EntryList *newItem);
0034     /**
0035      * Return a list of the entries. Note that this is usually
0036      * just a QStringList of all of the EntryList's DictQuery->toString() calls.
0037      */
0038     QStringList toStringList();
0039     /**
0040      * Return a list of the entries prior to the current one (not including
0041      * the current entry.
0042      */
0043     QStringList toStringListPrev();
0044     /**
0045      * Return a summary list that only includes those after the current
0046      */
0047     QStringList toStringListNext();
0048     /**
0049      * Add one to the current location, convenient for 'forward' buttons
0050      */
0051     void next(int distance = 1);
0052     /**
0053      * Sub one from the current location, the counterpart to next()
0054      */
0055     void prev(int distance = 1);
0056     /**
0057      * Return the current numerical 0-based location
0058      */
0059     int index();
0060     /**
0061      * Return the item at the location given by the parameter, and set it
0062      * to be the current history list item.
0063      */
0064     /**
0065      * Return the current item
0066      */
0067     EntryList *current();
0068     /**
0069      * Set the current item
0070      */
0071     void setCurrent(int i);
0072     /**
0073      * Return the total number of items in the list
0074      */
0075     int count();
0076 
0077 private:
0078     class Private;
0079     Private *const d;
0080 };
0081 
0082 #endif