diff options
author | con <qtc-committer@nokia.com> | 2011-04-14 10:39:09 +0200 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2011-04-26 10:45:25 +0200 |
commit | ef771552913401428d01dc0ee4b56d4d07fc522b (patch) | |
tree | 20a944ef2594ca8c513d1cce4981c15f645de2c9 /src/plugins/projectexplorer/appoutputpane.h | |
parent | 2cf76ead26b39d93d339fe50c3f44ac63d13dda3 (diff) | |
download | qt-creator-ef771552913401428d01dc0ee4b56d4d07fc522b.tar.gz |
Make output window implementation reusable.
Removes the dependencies to project explorer and text editor plugins
and moves unrelated code to its own file.
Diffstat (limited to 'src/plugins/projectexplorer/appoutputpane.h')
-rw-r--r-- | src/plugins/projectexplorer/appoutputpane.h | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/appoutputpane.h b/src/plugins/projectexplorer/appoutputpane.h new file mode 100644 index 0000000000..75e6948991 --- /dev/null +++ b/src/plugins/projectexplorer/appoutputpane.h @@ -0,0 +1,142 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef APPOUTPUTPANE_H +#define APPOUTPUTPANE_H + +#include "outputwindow.h" + +#include <coreplugin/ioutputpane.h> + +QT_BEGIN_NAMESPACE +class QTabWidget; +class QToolButton; +class QAction; +QT_END_NAMESPACE + +namespace ProjectExplorer { + +class RunControl; +class Project; + +namespace Internal { + +class AppOutputPane : public Core::IOutputPane +{ + Q_OBJECT + +public: + enum CloseTabMode { + CloseTabNoPrompt, + CloseTabWithPrompt + }; + + AppOutputPane(); + virtual ~AppOutputPane(); + + QWidget *outputWidget(QWidget *); + QList<QWidget*> toolBarWidgets() const; + QString displayName() const; + int priorityInStatusBar() const; + void clearContents(); + void visibilityChanged(bool); + bool canFocus(); + bool hasFocus(); + void setFocus(); + + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); + + void createNewOutputWindow(RunControl *rc); + void showTabFor(RunControl *rc); + + bool aboutToClose() const; + bool closeTabs(CloseTabMode mode); + +signals: + void allRunControlsFinished(); + +public slots: + // ApplicationOutput specifics + void projectRemoved(); + + void appendMessage(ProjectExplorer::RunControl *rc, const QString &out, + Utils::OutputFormat format); + +private slots: + void reRunRunControl(); + void stopRunControl(); + bool closeTab(int index); + void tabChanged(int); + void runControlStarted(); + void runControlFinished(); + + void aboutToUnloadSession(); + void updateWordWrapMode(); + +private: + struct RunControlTab { + explicit RunControlTab(RunControl *runControl = 0, + OutputWindow *window = 0); + RunControl* runControl; + OutputWindow *window; + // Is the run control stopping asynchronously, close the tab once it finishes + bool asyncClosing; + }; + + bool isRunning() const; + bool closeTab(int index, CloseTabMode cm); + bool optionallyPromptToStop(RunControl *runControl); + + int indexOf(const RunControl *) const; + int indexOf(const QWidget *outputWindow) const; + int currentIndex() const; + RunControl *currentRunControl() const; + int tabWidgetIndexOf(int runControlIndex) const; + void handleOldOutput(OutputWindow *window) const; + + QWidget *m_mainWidget; + QTabWidget *m_tabWidget; + QList<RunControlTab> m_runControlTabs; + QAction *m_stopAction; + QToolButton *m_reRunButton; + QToolButton *m_stopButton; +}; + +} // namespace Internal +} // namespace ProjectExplorer + +#endif // APPOUTPUTPANE_H |