File indexing completed on 2024-04-21 04:35:56
0001 /* 0002 * This file is part of KDevelop 0003 * 0004 * Copyright (C) 2014-2015 Miquel Sabaté Solà <mikisabate@gmail.com> 0005 * 0006 * This program is free software: you can redistribute it and/or modify 0007 * it under the terms of the GNU General Public License as published by 0008 * the Free Software Foundation, either version 3 of the License, or 0009 * (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef RAILS_QUICKOPEN_DATA_H 0021 #define RAILS_QUICKOPEN_DATA_H 0022 0023 #include <language/interfaces/quickopendataprovider.h> 0024 #include <language/interfaces/quickopenfilter.h> 0025 0026 #include <rails/export.h> 0027 0028 namespace ruby { 0029 namespace rails { 0030 0031 /* 0032 * TODO: maybe KDevPlatform will pick KDevelop::Path when moving away 0033 * from KUrl. If this is the case, these two attributes will be of type 0034 * KDevelop::Path too. 0035 */ 0036 struct KDEVRUBYRAILS_EXPORT QuickOpenItem { 0037 // The path of the view or test 0038 QUrl url; 0039 0040 // The path of the file for which we show views/tests 0041 QUrl originUrl; 0042 }; 0043 0044 /** 0045 * @class QuickOpenData 0046 * 0047 * The class being used to feed data to QuickOpen regarding Rails stuff. 0048 */ 0049 class KDEVRUBYRAILS_EXPORT QuickOpenData : public KDevelop::QuickOpenDataBase 0050 { 0051 public: 0052 QuickOpenData(const QuickOpenItem &item, const QString &explanation); 0053 0054 protected: 0055 QString text() const override; 0056 QString htmlDescription() const override; 0057 0058 bool execute(QString &filterText) override; 0059 0060 bool isExpandable() const override; 0061 QWidget * expandingWidget() const override; 0062 0063 QIcon icon() const override; 0064 0065 QList<QVariant> highlighting() const override; 0066 0067 private: 0068 QuickOpenItem m_item; 0069 QString m_explanation; 0070 }; 0071 0072 } 0073 } 0074 0075 #endif // RAILS_QUICKOPEN_DATA_H 0076