Changeset View
Changeset View
Standalone View
Standalone View
plugins/scratchpad/scratchpad.h
- This file was added.
1 | /* This file is part of KDevelop | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright 2018 Amish K. Naidu <amhndu@gmail.com> | ||||
4 | * | ||||
5 | * This program is free software; you can redistribute it and/or | ||||
6 | * modify it under the terms of the GNU General Public License | ||||
7 | * as published by the Free Software Foundation; either version 2 | ||||
8 | * of the License, or (at your option) any later version. | ||||
9 | * | ||||
10 | * This program is distributed in the hope that it will be useful, | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
13 | * GNU General Public License for more details. | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU General Public License | ||||
16 | * along with this program; if not, write to the Free Software | ||||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||||
18 | * 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | #ifndef SCRATCHPAD_H | ||||
22 | #define SCRATCHPAD_H | ||||
23 | | ||||
24 | #include <interfaces/iplugin.h> | ||||
25 | | ||||
26 | #include <QFileIconProvider> | ||||
27 | | ||||
28 | class ScratchpadToolViewFactory; | ||||
29 | | ||||
30 | class QStandardItemModel; | ||||
31 | class QModelIndex; | ||||
32 | class QFileInfo; | ||||
33 | class QString; | ||||
34 | | ||||
35 | class Scratchpad | ||||
36 | : public KDevelop::IPlugin | ||||
37 | { | ||||
38 | Q_OBJECT | ||||
39 | | ||||
40 | public: | ||||
41 | Scratchpad(QObject* parent, const QVariantList& args); | ||||
42 | | ||||
43 | QStandardItemModel* model(); | ||||
44 | | ||||
45 | static QString dataDirectory(); | ||||
46 | | ||||
47 | enum ExtraRoles { | ||||
48 | FullPathRole = Qt::UserRole + 1, | ||||
49 | }; | ||||
50 | | ||||
51 | public Q_SLOTS: | ||||
52 | void openScratch(const QModelIndex& index); | ||||
53 | void runScratch(const QModelIndex& scratchIndex, const QString& compiler, const QString& command); | ||||
54 | void removeScratch(const QModelIndex& index); | ||||
55 | void createScratch(); | ||||
56 | void renameScratch(const QModelIndex& index, const QString& previousName); | ||||
57 | | ||||
58 | Q_SIGNALS: | ||||
59 | void actionFailed(const QString& message); | ||||
60 | | ||||
61 | private: | ||||
62 | void addFileToModel(const QFileInfo& fileInfo); | ||||
63 | | ||||
64 | ScratchpadToolViewFactory* m_factory; | ||||
65 | QStandardItemModel* m_model; | ||||
66 | QFileIconProvider m_iconProvider; | ||||
67 | }; | ||||
68 | | ||||
69 | #endif // SCRATCHPAD_H |