File indexing completed on 2024-04-28 16:26:30

0001 /********************************************************************************
0002   Copyright (C) 2004-2007 by Holger Danielsson (holger.danielsson@versanet.de)
0003                 2010 by Michel Ludwig (michel.ludwig@liverpool.ac.uk)
0004  ********************************************************************************/
0005 
0006 /***************************************************************************
0007  *                                                                         *
0008  *   This program is free software; you can redistribute it and/or modify  *
0009  *   it under the terms of the GNU General Public License as published by  *
0010  *   the Free Software Foundation; either version 2 of the License, or     *
0011  *   (at your option) any later version.                                   *
0012  *                                                                         *
0013  ***************************************************************************/
0014 
0015 #ifndef CODECOMPLETIONCONFIGWIDGET_H
0016 #define CODECOMPLETIONCONFIGWIDGET_H
0017 
0018 #include <QWidget>
0019 
0020 #include "ui_codecompletionconfigwidget.h"
0021 
0022 class QCheckBox;
0023 class QLabel;
0024 class QSpinBox;
0025 class QTabWidget;
0026 class QTreeWidget;
0027 class QTreeWidgetItem;
0028 
0029 class KConfig;
0030 class QPushButton;
0031 class QTabWidget;
0032 class KDirWatch;
0033 
0034 class KileErrorHandler;
0035 
0036 class CodeCompletionConfigWidget : public QWidget, public Ui::KileWidgetCodeCompletionConfig
0037 {
0038     Q_OBJECT
0039 public:
0040     CodeCompletionConfigWidget(KConfig *config, KileErrorHandler *errorHandler, QWidget *parent = Q_NULLPTR, const char *name = Q_NULLPTR);
0041     ~CodeCompletionConfigWidget();
0042 
0043     void readConfig();
0044     void writeConfig();
0045 
0046 private:
0047     enum CompletionPage { TexPage = 0, DictionaryPage = 1, AbbreviationPage = 2, NumPages = 3 };
0048 
0049     KConfig *m_config;
0050     KileErrorHandler *m_errorHandler;
0051 
0052     // tabs, views, pages, wordlists
0053     QTreeWidget *m_listview[NumPages];
0054     QWidget *m_page[NumPages];
0055     QStringList m_wordlist[NumPages];
0056     QStringList m_dirname;
0057 
0058     QTreeWidget *getListview(QWidget *page);
0059     QString getListname(QWidget *page);
0060     void addPage(QTabWidget *tab, CompletionPage page, const QString &title, const QString &dirname);
0061 
0062     void setListviewEntries(CompletionPage page);
0063     bool getListviewEntries(CompletionPage page);
0064     QTreeWidgetItem* getListviewEntry(QTreeWidget *listview, const QString &filename);
0065     void updateColumnWidth(QTreeWidget *listview);
0066 
0067     bool m_configChanged;
0068     QString m_localCwlDir, m_globalCwlDir;
0069     KDirWatch *m_dirWatcher;
0070 
0071 private Q_SLOTS:
0072     void showPage(QWidget *page);
0073     void showPage(int index);
0074     void addClicked();
0075     void removeClicked();
0076     void slotSelectionChanged();
0077     void updateCompletionFilesTab(const QString& path);
0078 };
0079 
0080 #endif