2
This plugin is part of KDevelop.
4
Copyright (C) 2010 Milian Wolff <mail@milianw.de>
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef EXTERNALSCRIPTITEM_H
22
#define EXTERNALSCRIPTITEM_H
24
#include <QStandardItemModel>
29
* NOTE: use @c text() and @c setText() to define the label/name of the external script.
31
class ExternalScriptItem : public QStandardItem
37
* @return The command to execute. Working dir will be that of the active document.
39
QString command() const;
41
* Sets the command to execute. Working dir will be that of the active document.
43
void setCommand( const QString& command );
46
/// Nothing needs to be saved.
48
/// Currently active document gets saved.
50
/// All opened documents get saved.
54
* @return @c SaveMode that decides what document should be saved before executing this script.
56
SaveMode saveMode() const;
58
* Sets the @c SaveMode that decides what document should be saved before executing this script.
60
void setSaveMode( SaveMode mode );
62
/// Defines what should be done with the @c STDOUT of a script run.
64
/// Ignore output and do nothing.
66
/// Output gets inserted at the cursor position of the current document.
68
/// Current selection gets replaced in the active document.
69
/// If no selection exists, the output will get inserted at the
70
/// current cursor position in the active document view.
71
OutputReplaceSelectionOrInsertAtCursor,
72
/// Current selection gets replaced in the active document.
73
/// If no selection exists, the whole document gets replaced.
74
OutputReplaceSelectionOrDocument,
75
/// The whole contents of the active document gets replaced.
76
OutputReplaceDocument,
77
/// Create a new file from the output.
81
* @return @c OutputMode that decides what parts of the active document should be replaced by the
82
* @c STDOUT of the @c command() execution.
84
OutputMode outputMode() const;
86
* Sets the @c OutputMode that decides what parts of the active document should be replaced by the
87
* @c STDOUT of the @c command() execution.
89
void setOutputMode( OutputMode mode );
91
/// Defines what should be done with the @c STDERR of a script run.
93
/// Ignore errors and do nothing.
95
/// Merge with @c STDOUT and use @c OutputMode.
97
/// Errors get inserted at the cursor position of the current document.
99
/// Current selection gets replaced in the active document.
100
/// If no selection exists, the output will get inserted at the
101
/// current cursor position in the active document view.
102
ErrorReplaceSelectionOrInsertAtCursor,
103
/// Current selection gets replaced in the active document.
104
/// If no selection exists, the whole document gets replaced.
105
ErrorReplaceSelectionOrDocument,
106
/// The whole contents of the active document gets replaced.
107
ErrorReplaceDocument,
108
/// Create a new file from the errors.
113
* @return @c ErrorMode that decides what parts of the active document should be replaced by the
114
* @c STDERR of the @c command() execution.
116
ErrorMode errorMode() const;
118
* Sets the @c ErrorMode that decides what parts of the active document should be replaced by the
119
* @c STDERR of the @c command() execution.
121
void setErrorMode( ErrorMode mode );
124
/// Nothing gets streamed to the @c STDIN of the external script.
126
/// Current selection gets streamed into the @c STDIN of the external script.
127
/// If no selection exists, nothing gets streamed.
128
InputSelectionOrNone,
129
/// Current selection gets streamed into the @c STDIN of the external script.
130
/// If no selection exists, the whole document gets streamed.
131
InputSelectionOrDocument,
132
/// The whole contents of the active document get streamed into the @c STDIN of the external script.
136
* @return @c InputMode that decides what parts of the active document should be streamded into
137
* the @c STDIN of the external script.
139
InputMode inputMode() const;
141
* Sets the @c InputMode that decides what parts of the active document should be streamded into
142
* the @c STDIN of the external script.
144
void setInputMode( InputMode mode );
147
* Action to trigger insertion of this snippet.
152
* @return True when this command should have its output shown, false otherwise.
154
bool showOutput() const;
156
* Set @p show to true when the output of this command shout be shown, false otherwise.
158
void setShowOutput( bool show );
161
///TODO: mimetype / language filter
162
///TODO: kate commandline integration
163
///TODO: filter for local/remote files
166
* Saves this item after changes.
172
OutputMode m_outputMode;
173
ErrorMode m_errorMode;
174
InputMode m_inputMode;
179
Q_DECLARE_METATYPE(ExternalScriptItem*)
181
#endif // EXTERNALSCRIPTITEM_H
183
// kate: indent-mode cstyle; space-indent on; indent-width 2; replace-tabs on;