1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
/* KDevelop Output View
*
* Copyright 2006-2007 Andreas Pakulat <apaku@gmx.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef KDEVPLATFORM_IOUTPUTVIEW_H
#define KDEVPLATFORM_IOUTPUTVIEW_H
#include <QMetaType>
#include <QFlags>
#include <QIcon>
#include "outputviewexport.h"
class QString;
class QAbstractItemModel;
class QModelIndex;
class QAbstractItemDelegate;
class QAction;
/**
@author Andreas Pakulat
*/
namespace KDevelop
{
class KDEVPLATFORMOUTPUTVIEW_EXPORT IOutputView
{
public:
enum Behaviour
{
AllowUserClose = 0x1 /**< allow the user to close the view */,
AlwaysShowView = 0x2 /**< always show the view */,
AutoScroll = 0x4 /**< automatically scroll the view */
};
Q_DECLARE_FLAGS(Behaviours, Behaviour)
enum Option
{
NoOptions = 0x0,
ShowItemsButton = 0x1 /**< show the two buttons (select and focus) */,
AddFilterAction = 0x2 /**< add a filter action */
};
Q_DECLARE_FLAGS(Options, Option)
enum ViewType
{
OneView = 0 /**< there's only one outputview, newly registered outputs will replace existing ones */,
HistoryView = 1 /**< The tool view will have a history with forward/backward buttons */,
MultipleView = 2 /**< show multiples outputs in a tool view at the same time */
};
enum StandardToolView
{
BuildView = 0 /**< the standard outputview for building output */,
RunView = 1 /**< the standard outputview for running apps */,
DebugView = 2 /**< the standard outputview for debugging apps */,
TestView = 4 /**< the standard outputview for verbose test output */,
VcsView = 8 /**< the standard outputview for VCS commands */
};
virtual ~IOutputView();
/**
* Fetch the identifier for one of the standard tool views.
* This will automatically create the tool view if it doesn't exist yet
* @param view the standard tool view to get the identifier for
* @returns the identifier for the standard tool view
*/
virtual int standardToolView( StandardToolView view ) = 0;
/**
* Register a new tool view for output with the given title, behaviour and type.
* If there already exists a tool view with this title and type return the existing id
* @param title the Title to be displayed on the tool view
* @param type the type of view that should be created
* @param icon the icon of the tool view
* @param option the options of the tool view
* @param actionList list of actions adding to the toolbar
* @returns an tool view id that identifies the new view and is used in the other
* methods
*/
virtual int registerToolView( const QString& title, ViewType type = OneView,
const QIcon& icon = QIcon(), Options option = ShowItemsButton,
const QList<QAction*>& actionList = QList<QAction*>()) = 0;
/**
* Register a new output view in a given tool view. How this new view is created depends
* on the type of the tool view.
* @param toolViewId the id of the tool view, created by registerToolView
* @param title the title to use for the new output in the tool view
* @param behaviour the Behaviour of the output
* @returns the id of the output to supply to the other methods
*/
virtual int registerOutputInToolView( int toolViewId, const QString& title,
Behaviours behaviour = AllowUserClose ) = 0;
/**
* Raise a given view
*/
virtual void raiseOutput( int outputId ) = 0;
virtual void scrollOutputTo( int outputId, const QModelIndex& ) = 0;
/**
* Sets the model of the registered output identified by @p outputId to @p model.
*
* Does nothing if the id doesn't exist. The output view takes ownership of the model.
*
* NOTE: Do not reuse the same model for different views.
*/
virtual void setModel( int outputId, QAbstractItemModel* model ) = 0;
/**
* Sets the item delegate of the registered output identified by @p outputId to @p delegate.
*
* Does nothing if the id doesn't exist. The output view takes ownership of the delegate.
*
* NOTE: Do not reuse the same delegate for different views.
*/
virtual void setDelegate( int outputId, QAbstractItemDelegate* model ) = 0;
/**
* Sets a @p title for the specified @p outputIds
*/
virtual void setTitle( int outputId, const QString& title ) = 0;
/**
* Remove a tool view, don't forget to emit toolViewRemoved when you implement this.
*
* @param toolViewId identifies the view to remove
*/
virtual void removeToolView(int toolViewId) = 0;
/**
* Remove an output view from a tool view. Don't forget to emit outputRemoved
* when you implement this.
* @param outputId the id of the outputview to remove
*/
virtual void removeOutput( int outputId ) = 0;
Q_SIGNALS:
/**
* Emitted after a tool view was removed.
*
* @param toolViewId identifies the removed tool view
*/
void toolViewRemoved(int toolViewId);
/**
* Emitted after a tool view was removed.
*
* @param toolViewId identifies the removed tool view
* @param outputId identifies the removed output
*/
void outputRemoved(int toolViewId, int outputId);
};
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
Q_DECLARE_OPERATORS_FOR_FLAGS(IOutputView::Behaviours)
Q_DECLARE_OPERATORS_FOR_FLAGS(IOutputView::Options)
#endif
} // namespace KDevelop
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
Q_DECLARE_OPERATORS_FOR_FLAGS(KDevelop::IOutputView::Behaviours)
Q_DECLARE_OPERATORS_FOR_FLAGS(KDevelop::IOutputView::Options)
#endif
Q_DECLARE_METATYPE(KDevelop::IOutputView::StandardToolView)
Q_DECLARE_INTERFACE( KDevelop::IOutputView, "org.kdevelop.IOutputView" )
#endif
|