File indexing completed on 2025-01-05 04:26:45
0001 /**************************************************************************************** 0002 * Copyright (c) 2013 Anmol Ahuja <darthcodus@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef SCRIPTCONSOLE_COMPLETIONMODEL_H 0018 #define SCRIPTCONSOLE_COMPLETIONMODEL_H 0019 0020 #include <KTextEditor/CodeCompletionModel> 0021 #include <KTextEditor/CodeCompletionModelControllerInterface> 0022 0023 namespace KTextEditor { 0024 class View; 0025 } 0026 0027 namespace ScriptConsoleNS 0028 { 0029 class AmarokScriptCodeCompletionModel : public KTextEditor::CodeCompletionModelControllerInterface 0030 , public KTextEditor::CodeCompletionModel 0031 { 0032 public: 0033 explicit AmarokScriptCodeCompletionModel( QObject *parent ); 0034 ~AmarokScriptCodeCompletionModel() override; 0035 0036 private: 0037 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; 0038 void completionInvoked( KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType ) override; 0039 void executeCompletionItem( KTextEditor::View *view, const KTextEditor::Range &range, const QModelIndex &index ) const override; 0040 KTextEditor::Range completionRange( KTextEditor::View *view, const KTextEditor::Cursor &position ) override; 0041 bool shouldAbortCompletion( KTextEditor::View *view, const KTextEditor::Range &range, const QString ¤tCompletion ) override; 0042 0043 QStringList m_completionList; 0044 QStringList m_autoCompleteStrings; 0045 }; 0046 } 0047 0048 #endif // SCRIPTCONSOLE_COMPLETIONMODEL_H