2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-06-17 00:01:27 +10:00
|
|
|
** contact the sales department at http://www.qtsoftware.com/contact.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef OUTPUTWINDOW_H
|
|
|
|
|
#define OUTPUTWINDOW_H
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/ioutputpane.h>
|
|
|
|
|
#include <texteditor/plaintexteditor.h>
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QHash>
|
|
|
|
|
#include <QtCore/QBasicTimer>
|
|
|
|
|
#include <QtGui/QAbstractScrollArea>
|
|
|
|
|
#include <QtGui/QToolButton>
|
|
|
|
|
#include <QtGui/QPlainTextEdit>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QTabWidget;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
|
|
|
|
class RunControl;
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class OutputWindow;
|
|
|
|
|
|
|
|
|
|
class OutputPane : public Core::IOutputPane
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2009-01-20 17:14:00 +01:00
|
|
|
OutputPane();
|
2008-12-02 12:01:29 +01:00
|
|
|
~OutputPane();
|
|
|
|
|
|
|
|
|
|
QWidget *outputWidget(QWidget *);
|
2009-04-07 16:59:48 +02:00
|
|
|
QList<QWidget*> toolBarWidgets() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
QString name() const;
|
|
|
|
|
int priorityInStatusBar() const;
|
|
|
|
|
void clearContents();
|
|
|
|
|
void visibilityChanged(bool);
|
|
|
|
|
bool canFocus();
|
|
|
|
|
bool hasFocus();
|
|
|
|
|
void setFocus();
|
|
|
|
|
|
2009-04-30 12:50:52 +02:00
|
|
|
bool canNext();
|
|
|
|
|
bool canPrevious();
|
|
|
|
|
void goToNext();
|
|
|
|
|
void goToPrev();
|
|
|
|
|
bool canNavigate();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void appendOutput(const QString &out);
|
|
|
|
|
|
|
|
|
|
// ApplicationOutputspecifics
|
2009-01-09 11:06:36 +01:00
|
|
|
void createNewOutputWindow(RunControl *rc);
|
|
|
|
|
void appendOutput(RunControl *rc, const QString &out);
|
2009-01-15 14:30:49 +01:00
|
|
|
void appendOutputInline(RunControl *rc, const QString &out);
|
2009-01-09 11:06:36 +01:00
|
|
|
void showTabFor(RunControl *rc);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void projectRemoved();
|
2009-02-16 15:23:49 +01:00
|
|
|
void coreAboutToClose();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void insertLine();
|
|
|
|
|
void reRunRunControl();
|
|
|
|
|
void stopRunControl();
|
|
|
|
|
void closeTab(int index);
|
|
|
|
|
void tabChanged(int);
|
|
|
|
|
void runControlStarted();
|
|
|
|
|
void runControlFinished();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
RunControl *runControlForTab(int index) const;
|
|
|
|
|
|
|
|
|
|
QWidget *m_mainWidget;
|
|
|
|
|
QTabWidget *m_tabWidget;
|
|
|
|
|
QHash<RunControl *, OutputWindow *> m_outputWindows;
|
2009-01-09 12:58:02 +01:00
|
|
|
QAction *m_stopAction;
|
2008-12-02 12:01:29 +01:00
|
|
|
// QToolButton *m_insertLineButton;
|
|
|
|
|
QToolButton *m_reRunButton;
|
|
|
|
|
QToolButton *m_stopButton;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OutputWindow : public QPlainTextEdit
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2009-01-09 11:06:36 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
|
|
|
|
OutputWindow(QWidget *parent = 0);
|
|
|
|
|
~OutputWindow();
|
|
|
|
|
|
|
|
|
|
void appendOutput(const QString &out);
|
2009-01-15 14:30:49 +01:00
|
|
|
void appendOutputInline(const QString &out);
|
2008-12-02 12:01:29 +01:00
|
|
|
void insertLine();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
class OutputWindow
|
|
|
|
|
: public QAbstractScrollArea
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
int max_lines;
|
|
|
|
|
bool same_height;
|
|
|
|
|
int width_used;
|
|
|
|
|
bool block_scroll;
|
|
|
|
|
QStringList lines;
|
|
|
|
|
QBasicTimer autoscroll_timer;
|
|
|
|
|
int autoscroll;
|
|
|
|
|
QPoint lastMouseMove;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Selection {
|
|
|
|
|
Selection():line(0), pos(0){}
|
|
|
|
|
int line;
|
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
|
|
bool operator==(const Selection &other) const
|
|
|
|
|
{ return line == other.line && pos == other.pos; }
|
|
|
|
|
bool operator!=(const Selection &other) const
|
|
|
|
|
{ return !(*this == other); }
|
|
|
|
|
bool operator<(const Selection &other) const
|
|
|
|
|
{ return line < other.line || (line == other.line && pos < other.pos); }
|
|
|
|
|
bool operator>=(const Selection &other) const
|
|
|
|
|
{ return !(*this < other); }
|
|
|
|
|
bool operator<=(const Selection &other) const
|
|
|
|
|
{ return line < other.line || (line == other.line && pos == other.pos); }
|
|
|
|
|
bool operator>(const Selection &other) const
|
|
|
|
|
{ return !(*this <= other); }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Selection selection_start, selection_end;
|
|
|
|
|
void changed();
|
|
|
|
|
bool getCursorPos(int *lineNumber, int *position, const QPoint &pos);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
OutputWindow(QWidget *parent = 0);
|
|
|
|
|
~OutputWindow();
|
|
|
|
|
|
|
|
|
|
void setNumberOfLines(int max);
|
|
|
|
|
int numberOfLines() const;
|
|
|
|
|
|
|
|
|
|
bool hasSelectedText() const;
|
|
|
|
|
void clearSelection();
|
|
|
|
|
|
|
|
|
|
QString selectedText() const;
|
|
|
|
|
|
|
|
|
|
void appendOutput(const QString &out);
|
|
|
|
|
void insertLine() {
|
|
|
|
|
appendOutput(QChar(QChar::ParagraphSeparator));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void clear();
|
|
|
|
|
void copy();
|
|
|
|
|
void selectAll();
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void showPage();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void scrollContentsBy(int dx, int dy);
|
|
|
|
|
void keyPressEvent(QKeyEvent *e);
|
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
|
void mousePressEvent(QMouseEvent *e);
|
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e);
|
|
|
|
|
void mouseMoveEvent(QMouseEvent *e);
|
|
|
|
|
void timerEvent(QTimerEvent *e);
|
|
|
|
|
void contextMenuEvent(QContextMenuEvent * e);
|
|
|
|
|
};
|
|
|
|
|
#endif // 0
|
2008-12-02 16:19:05 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ProjectExplorer
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2008-12-02 16:19:05 +01:00
|
|
|
#endif // OUTPUTWINDOW_H
|