completion.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. ktigcc - TIGCC IDE for KDE
  3. Copyright (C) 2006 Kevin Kofler
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #pragma once
  17. #include <qobject.h>
  18. #include <q3popupmenu.h>
  19. #include <qmap.h>
  20. #include <qstring.h>
  21. #include <qstringlist.h>
  22. #include <q3valuelist.h>
  23. //Added by qt3to4:
  24. #include <QEvent>
  25. #include <kate/view.h>
  26. struct CompletionInfo {
  27. CompletionInfo() : dirty(false), searched(false) {}
  28. bool dirty;
  29. bool searched;
  30. QStringList includedSystem;
  31. QStringList included;
  32. QMap<QString,unsigned> lineNumbers;
  33. Q3ValueList<KTextEditor::CompletionEntry> entries;
  34. };
  35. // Maps file name to a CompletionInfo.
  36. extern QMap<QString,CompletionInfo> systemHeaderCompletion, projectCompletion;
  37. class MainForm;
  38. bool findSymbolInFile(const QString &symbol,
  39. const QString &fileText,
  40. const QString &fileName,
  41. MainForm *mainForm,
  42. QString &symbolFile,
  43. unsigned &symbolLine,
  44. bool &systemHeader);
  45. bool completionEntriesForFile(const QString &fileText,
  46. const QString &fileName,
  47. MainForm *mainForm,
  48. Q3ValueList<KTextEditor::CompletionEntry> &result);
  49. class QWidget;
  50. bool parseHelpSources(QWidget *parent, const QString &directory,
  51. QMap<QString,CompletionInfo> &sysHdrCompletion);
  52. bool parseSystemHeaders(QWidget *parent, const QString &directory,
  53. QMap<QString,CompletionInfo> &sysHdrCompletion);
  54. void loadSystemHeaderCompletion(void);
  55. void saveSystemHeaderCompletion(void);
  56. class TemplatePopup : public Q3PopupMenu {
  57. Q_OBJECT
  58. public:
  59. TemplatePopup(Kate::View *parent);
  60. virtual ~TemplatePopup() {}
  61. private slots:
  62. void QPopupMenu_activated(int id);
  63. private:
  64. Kate::View *view;
  65. };
  66. class QEvent;
  67. class QWidget;
  68. class CompletionPopup : public QObject {
  69. Q_OBJECT
  70. public:
  71. CompletionPopup(Kate::View *parent, const QString &fileName,
  72. MainForm *mainForm, QObject *receiver);
  73. virtual ~CompletionPopup() {}
  74. private slots:
  75. void slotDone();
  76. signals:
  77. void closed();
  78. protected:
  79. bool eventFilter(QObject *o, QEvent *e);
  80. private:
  81. bool done;
  82. QWidget *completionPopup;
  83. };
  84. class ArgHintPopup : public QObject {
  85. Q_OBJECT
  86. public:
  87. ArgHintPopup(Kate::View *parent, const QString &fileName,
  88. MainForm *mainForm);
  89. virtual ~ArgHintPopup() {}
  90. private slots:
  91. void slotDone();
  92. protected:
  93. bool eventFilter(QObject *o, QEvent *e);
  94. private:
  95. bool done;
  96. QWidget *argHintPopup;
  97. };