# HG changeset patch # User Jacob Dawid # Date 1327319417 -3600 # Node ID 9712f29c97de1e0b6e2180c9706feb026e48cf3e # Parent e32ff0a000a85a5157530db0320d6c29cbe0da39 Compiles again. diff --git a/libqterminal/QTerminal.cpp b/libqterminal/QTerminal.cpp new file mode 100644 --- /dev/null +++ b/libqterminal/QTerminal.cpp @@ -0,0 +1,269 @@ +/* Copyright (C) 2008 e_k (e_k@users.sourceforge.net) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#include "QTerminal.h" + +#include "Session.h" +#include "TerminalDisplay.h" + +using namespace Konsole; + +void *createTermWidget(int startnow, void *parent) +{ + return (void*) new QTerminal(startnow, (QWidget*)parent); +} + +struct TermWidgetImpl +{ + TermWidgetImpl(QWidget* parent = 0); + + TerminalDisplay *m_terminalDisplay; + Session *m_session; + + Session* createSession(); + TerminalDisplay* createTerminalDisplay(Session *session, QWidget* parent); +}; + +TermWidgetImpl::TermWidgetImpl(QWidget* parent) +{ + this->m_session = createSession(); + this->m_terminalDisplay = createTerminalDisplay(this->m_session, parent); +} + + +Session *TermWidgetImpl::createSession() +{ + Session *session = new Session(); + + session->setTitle(Session::NameRole, "QTermWidget"); + session->setProgram("/bin/bash"); + QStringList args(""); + session->setArguments(args); + session->setAutoClose(true); + + session->setCodec(QTextCodec::codecForName("UTF-8")); + + session->setFlowControlEnabled(true); + session->setHistoryType(HistoryTypeBuffer(1000)); + + session->setDarkBackground(true); + + session->setKeyBindings(""); + return session; +} + +TerminalDisplay *TermWidgetImpl::createTerminalDisplay(Session *session, QWidget* parent) +{ +// TerminalDisplay* display = new TerminalDisplay(this); + TerminalDisplay* display = new TerminalDisplay(parent); + + display->setBellMode(TerminalDisplay::NotifyBell); + display->setTerminalSizeHint(true); + display->setTripleClickMode(TerminalDisplay::SelectWholeLine); + display->setTerminalSizeStartup(true); + + display->setRandomSeed(session->sessionId() * 31); + + return display; +} + + +QTerminal::QTerminal(int startnow, QWidget *parent) +:QWidget(parent) +{ + m_impl = new TermWidgetImpl(this); + + init(); + + if (startnow && m_impl->m_session) { + m_impl->m_session->run(); + } + + this->setFocus( Qt::OtherFocusReason ); + m_impl->m_terminalDisplay->resize(this->size()); + + this->setFocusProxy(m_impl->m_terminalDisplay); +} + +void QTerminal::startShellProgram() +{ + if ( m_impl->m_session->isRunning() ) + return; + + m_impl->m_session->run(); +} + +void QTerminal::init() +{ + m_impl->m_terminalDisplay->setSize(80, 40); + + QFont font = QApplication::font(); + font.setFamily("Monospace"); + font.setPointSize(10); + font.setStyleHint(QFont::TypeWriter); + setTerminalFont(font); + setScrollBarPosition(NoScrollBar); + + m_impl->m_session->addView(m_impl->m_terminalDisplay); + + connect(m_impl->m_session, SIGNAL(finished()), this, SLOT(sessionFinished())); +} + + +QTerminal::~QTerminal() +{ + emit destroyed(); +} + + +void QTerminal::setTerminalFont(QFont &font) +{ + if (!m_impl->m_terminalDisplay) + return; + m_impl->m_terminalDisplay->setVTFont(font); +} + +void QTerminal::setShellProgram(const QString &progname) +{ + if (!m_impl->m_session) + return; + m_impl->m_session->setProgram(progname); +} + +void QTerminal::setWorkingDirectory(const QString& dir) +{ + if (!m_impl->m_session) + return; + m_impl->m_session->setInitialWorkingDirectory(dir); +} + +void QTerminal::setArgs(QStringList &args) +{ + if (!m_impl->m_session) + return; + m_impl->m_session->setArguments(args); +} + +void QTerminal::setTextCodec(QTextCodec *codec) +{ + if (!m_impl->m_session) + return; + m_impl->m_session->setCodec(codec); +} + +void QTerminal::setColorScheme(int scheme) +{ + switch(scheme) { + case COLOR_SCHEME_WHITE_ON_BLACK: + m_impl->m_terminalDisplay->setColorTable(whiteonblack_color_table); + break; + case COLOR_SCHEME_GREEN_ON_BLACK: + m_impl->m_terminalDisplay->setColorTable(greenonblack_color_table); + break; + case COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW: + m_impl->m_terminalDisplay->setColorTable(blackonlightyellow_color_table); + break; + default: //do nothing + break; + }; +} + +void QTerminal::setSize(int h, int v) +{ + if (!m_impl->m_terminalDisplay) + return; + m_impl->m_terminalDisplay->setSize(h, v); +} + +void QTerminal::setHistorySize(int lines) +{ + if (lines < 0) + m_impl->m_session->setHistoryType(HistoryTypeFile()); + else + m_impl->m_session->setHistoryType(HistoryTypeBuffer(lines)); +} + +void QTerminal::setScrollBarPosition(ScrollBarPosition pos) +{ + if (!m_impl->m_terminalDisplay) + return; + m_impl->m_terminalDisplay->setScrollBarPosition((TerminalDisplay::ScrollBarPosition)pos); +} + +void QTerminal::sendText(QString &text) +{ + m_impl->m_session->sendText(text); +} + +void QTerminal::setReadOnly(bool readonly) +{ + m_impl->m_terminalDisplay->setReadOnly(readonly); +} + +void QTerminal::resizeEvent(QResizeEvent*) +{ +//qDebug("global window resizing...with %d %d", this->size().width(), this->size().height()); + m_impl->m_terminalDisplay->resize(this->size()); +} + + +void QTerminal::sessionFinished() +{ + emit finished(); +} + + +void QTerminal::copyClipboard() +{ + m_impl->m_terminalDisplay->copyClipboard(); +} + +void QTerminal::pasteClipboard() +{ + m_impl->m_terminalDisplay->pasteClipboard(); +} + +void QTerminal::setFlowControlEnabled(bool enabled) +{ + m_impl->m_session->setFlowControlEnabled(enabled); +} + +bool QTerminal::flowControlEnabled(void) +{ + return m_impl->m_session->flowControlEnabled(); +} + +void QTerminal::setFlowControlWarningEnabled(bool enabled) +{ + if(flowControlEnabled()) { + // Do not show warning label if flow control is disabled + m_impl->m_terminalDisplay->setFlowControlWarningEnabled(enabled); + } +} + +void QTerminal::setEnvironment(const QStringList& environment) +{ + m_impl->m_session->setEnvironment(environment); +} + +void* QTerminal::getTerminalDisplay() +{ + return static_cast(m_impl->m_terminalDisplay); +} + diff --git a/libqterminal/QTerminal.h b/libqterminal/QTerminal.h new file mode 100644 --- /dev/null +++ b/libqterminal/QTerminal.h @@ -0,0 +1,139 @@ +/* Copyright (C) 2008 e_k (e_k@users.sourceforge.net) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#ifndef _Q_TERM_WIDGET +#define _Q_TERM_WIDGET + +#include + +struct TermWidgetImpl; + +enum COLOR_SCHEME { COLOR_SCHEME_WHITE_ON_BLACK = 1, + COLOR_SCHEME_GREEN_ON_BLACK, + COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW }; + +class QTerminal : public QWidget +{ + Q_OBJECT +public: + + enum ScrollBarPosition + { + /** Do not show the scroll bar. */ + NoScrollBar=0, + /** Show the scroll bar on the left side of the display. */ + ScrollBarLeft=1, + /** Show the scroll bar on the right side of the display. */ + ScrollBarRight=2 + }; + + + //Creation of widget + QTerminal(int startnow = 1, //start shell programm immediatelly + QWidget *parent = 0); + ~QTerminal(); + + //start shell program if it was not started in constructor + void startShellProgram(); + + //look-n-feel, if you don`t like defaults + + // Terminal font + // Default is application font with family Monospace, size 10 + // USE ONLY FIXED-PITCH FONT! + // otherwise symbols' position could be incorrect + void setTerminalFont(QFont &font); + + //environment + void setEnvironment(const QStringList& environment); + + // Shell program, default is /bin/bash + void setShellProgram(const QString &progname); + + //working directory + void setWorkingDirectory(const QString& dir); + + // Shell program args, default is none + void setArgs(QStringList &args); + + //Text codec, default is UTF-8 + void setTextCodec(QTextCodec *codec); + + //Color scheme, default is white on black + void setColorScheme(int scheme); + + //set size + void setSize(int h, int v); + + // History size for scrolling + void setHistorySize(int lines); //infinite if lines < 0 + + // Presence of scrollbar + void setScrollBarPosition(ScrollBarPosition); + + // Send some text to terminal + void sendText(QString &text); + + // Sets whether flow control is enabled + void setFlowControlEnabled(bool enabled); + + // Returns whether flow control is enabled + bool flowControlEnabled(void); + + /** + * Sets whether the flow control warning box should be shown + * when the flow control stop key (Ctrl+S) is pressed. + */ + void setFlowControlWarningEnabled(bool enabled); + + // Sets read-only mode to terminal + void setReadOnly(bool); + +signals: + void finished(); + +public slots: + // Paste clipboard content to terminal + void copyClipboard(); + + // Copies selection to clipboard + void pasteClipboard(); + +protected: + virtual void resizeEvent(QResizeEvent *); + void *getTerminalDisplay(); + +protected slots: + void sessionFinished(); + +private: + void init(); + TermWidgetImpl *m_impl; +}; + + +//Maybe useful, maybe not + +#ifdef __cplusplus +extern "C" +#endif +void *createTermWidget(int startnow, void *parent); + +#endif + diff --git a/libqterminal/libqterminal.pro b/libqterminal/libqterminal.pro --- a/libqterminal/libqterminal.pro +++ b/libqterminal/libqterminal.pro @@ -1,48 +1,53 @@ TEMPLATE = lib VERSION = 0.1.0 -DESTDIR = .. +DESTDIR = . +TARGET = qterminal -TARGET = qtermwidget - -CONFIG += qt debug_and_release warn_on build_all dll staticlib #dll +CONFIG += staticlib QT += core gui -MOC_DIR = ../.moc - -CONFIG(debug, debug|release) { - OBJECTS_DIR = ../.objs_d - TARGET = qtermwidget_d -} else { - OBJECTS_DIR = ../.objs - TARGET = qtermwidget -} - DEFINES += HAVE_POSIX_OPENPT #or DEFINES += HAVE_GETPT -HEADERS = TerminalCharacterDecoder.h Character.h CharacterColor.h \ +HEADERS = TerminalCharacterDecoder.h \ + Character.h \ + CharacterColor.h \ KeyboardTranslator.h \ ExtendedDefaultTranslator.h \ - Screen.h History.h BlockArray.h konsole_wcwidth.h \ + Screen.h \ + History.h \ + BlockArray.h \ + konsole_wcwidth.h \ ScreenWindow.h \ Emulation.h \ - Vt102Emulation.h TerminalDisplay.h Filter.h LineFont.h \ - Pty.h kpty.h kpty_p.h k3process.h k3processcontroller.h \ - Session.h ShellCommand.h \ - qtermwidget.h + Vt102Emulation.h \ + TerminalDisplay.h \ + Filter.h LineFont.h \ + Pty.h \ + kpty.h \ + kpty_p.h \ + k3process.h \ + k3processcontroller.h \ + Session.h \ + ShellCommand.h \ + QTerminal.h SOURCES = TerminalCharacterDecoder.cpp \ KeyboardTranslator.cpp \ - Screen.cpp History.cpp BlockArray.cpp konsole_wcwidth.cpp \ + Screen.cpp \ + History.cpp \ + BlockArray.cpp \ + konsole_wcwidth.cpp \ ScreenWindow.cpp \ Emulation.cpp \ - Vt102Emulation.cpp TerminalDisplay.cpp Filter.cpp \ - Pty.cpp kpty.cpp k3process.cpp k3processcontroller.cpp \ - Session.cpp ShellCommand.cpp \ - qtermwidget.cpp - - - - - \ No newline at end of file + Vt102Emulation.cpp \ + TerminalDisplay.cpp \ + Filter.cpp \ + Pty.cpp \ + kpty.cpp \ + k3process.cpp \ + k3processcontroller.cpp \ + Session.cpp \ + ShellCommand.cpp \ + QTerminal.cpp diff --git a/libqterminal/qtermwidget.cpp b/libqterminal/qtermwidget.cpp deleted file mode 100644 --- a/libqterminal/qtermwidget.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* Copyright (C) 2008 e_k (e_k@users.sourceforge.net) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "qtermwidget.h" - -#include "Session.h" -#include "TerminalDisplay.h" - -using namespace Konsole; - -void *createTermWidget(int startnow, void *parent) -{ - return (void*) new QTermWidget(startnow, (QWidget*)parent); -} - -struct TermWidgetImpl -{ - TermWidgetImpl(QWidget* parent = 0); - - TerminalDisplay *m_terminalDisplay; - Session *m_session; - - Session* createSession(); - TerminalDisplay* createTerminalDisplay(Session *session, QWidget* parent); -}; - -TermWidgetImpl::TermWidgetImpl(QWidget* parent) -{ - this->m_session = createSession(); - this->m_terminalDisplay = createTerminalDisplay(this->m_session, parent); -} - - -Session *TermWidgetImpl::createSession() -{ - Session *session = new Session(); - - session->setTitle(Session::NameRole, "QTermWidget"); - session->setProgram("/bin/bash"); - QStringList args(""); - session->setArguments(args); - session->setAutoClose(true); - - session->setCodec(QTextCodec::codecForName("UTF-8")); - - session->setFlowControlEnabled(true); - session->setHistoryType(HistoryTypeBuffer(1000)); - - session->setDarkBackground(true); - - session->setKeyBindings(""); - return session; -} - -TerminalDisplay *TermWidgetImpl::createTerminalDisplay(Session *session, QWidget* parent) -{ -// TerminalDisplay* display = new TerminalDisplay(this); - TerminalDisplay* display = new TerminalDisplay(parent); - - display->setBellMode(TerminalDisplay::NotifyBell); - display->setTerminalSizeHint(true); - display->setTripleClickMode(TerminalDisplay::SelectWholeLine); - display->setTerminalSizeStartup(true); - - display->setRandomSeed(session->sessionId() * 31); - - return display; -} - - -QTermWidget::QTermWidget(int startnow, QWidget *parent) -:QWidget(parent) -{ - m_impl = new TermWidgetImpl(this); - - init(); - - if (startnow && m_impl->m_session) { - m_impl->m_session->run(); - } - - this->setFocus( Qt::OtherFocusReason ); - m_impl->m_terminalDisplay->resize(this->size()); - - this->setFocusProxy(m_impl->m_terminalDisplay); -} - -void QTermWidget::startShellProgram() -{ - if ( m_impl->m_session->isRunning() ) - return; - - m_impl->m_session->run(); -} - -void QTermWidget::init() -{ - m_impl->m_terminalDisplay->setSize(80, 40); - - QFont font = QApplication::font(); - font.setFamily("Monospace"); - font.setPointSize(10); - font.setStyleHint(QFont::TypeWriter); - setTerminalFont(font); - setScrollBarPosition(NoScrollBar); - - m_impl->m_session->addView(m_impl->m_terminalDisplay); - - connect(m_impl->m_session, SIGNAL(finished()), this, SLOT(sessionFinished())); -} - - -QTermWidget::~QTermWidget() -{ - emit destroyed(); -} - - -void QTermWidget::setTerminalFont(QFont &font) -{ - if (!m_impl->m_terminalDisplay) - return; - m_impl->m_terminalDisplay->setVTFont(font); -} - -void QTermWidget::setShellProgram(const QString &progname) -{ - if (!m_impl->m_session) - return; - m_impl->m_session->setProgram(progname); -} - -void QTermWidget::setWorkingDirectory(const QString& dir) -{ - if (!m_impl->m_session) - return; - m_impl->m_session->setInitialWorkingDirectory(dir); -} - -void QTermWidget::setArgs(QStringList &args) -{ - if (!m_impl->m_session) - return; - m_impl->m_session->setArguments(args); -} - -void QTermWidget::setTextCodec(QTextCodec *codec) -{ - if (!m_impl->m_session) - return; - m_impl->m_session->setCodec(codec); -} - -void QTermWidget::setColorScheme(int scheme) -{ - switch(scheme) { - case COLOR_SCHEME_WHITE_ON_BLACK: - m_impl->m_terminalDisplay->setColorTable(whiteonblack_color_table); - break; - case COLOR_SCHEME_GREEN_ON_BLACK: - m_impl->m_terminalDisplay->setColorTable(greenonblack_color_table); - break; - case COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW: - m_impl->m_terminalDisplay->setColorTable(blackonlightyellow_color_table); - break; - default: //do nothing - break; - }; -} - -void QTermWidget::setSize(int h, int v) -{ - if (!m_impl->m_terminalDisplay) - return; - m_impl->m_terminalDisplay->setSize(h, v); -} - -void QTermWidget::setHistorySize(int lines) -{ - if (lines < 0) - m_impl->m_session->setHistoryType(HistoryTypeFile()); - else - m_impl->m_session->setHistoryType(HistoryTypeBuffer(lines)); -} - -void QTermWidget::setScrollBarPosition(ScrollBarPosition pos) -{ - if (!m_impl->m_terminalDisplay) - return; - m_impl->m_terminalDisplay->setScrollBarPosition((TerminalDisplay::ScrollBarPosition)pos); -} - -void QTermWidget::sendText(QString &text) -{ - m_impl->m_session->sendText(text); -} - -void QTermWidget::setReadOnly(bool readonly) -{ - m_impl->m_terminalDisplay->setReadOnly(readonly); -} - -void QTermWidget::resizeEvent(QResizeEvent*) -{ -//qDebug("global window resizing...with %d %d", this->size().width(), this->size().height()); - m_impl->m_terminalDisplay->resize(this->size()); -} - - -void QTermWidget::sessionFinished() -{ - emit finished(); -} - - -void QTermWidget::copyClipboard() -{ - m_impl->m_terminalDisplay->copyClipboard(); -} - -void QTermWidget::pasteClipboard() -{ - m_impl->m_terminalDisplay->pasteClipboard(); -} - -void QTermWidget::setFlowControlEnabled(bool enabled) -{ - m_impl->m_session->setFlowControlEnabled(enabled); -} - -bool QTermWidget::flowControlEnabled(void) -{ - return m_impl->m_session->flowControlEnabled(); -} - -void QTermWidget::setFlowControlWarningEnabled(bool enabled) -{ - if(flowControlEnabled()) { - // Do not show warning label if flow control is disabled - m_impl->m_terminalDisplay->setFlowControlWarningEnabled(enabled); - } -} - -void QTermWidget::setEnvironment(const QStringList& environment) -{ - m_impl->m_session->setEnvironment(environment); -} - -void* QTermWidget::getTerminalDisplay() -{ - return static_cast(m_impl->m_terminalDisplay); -} - diff --git a/libqterminal/qtermwidget.h b/libqterminal/qtermwidget.h deleted file mode 100644 --- a/libqterminal/qtermwidget.h +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright (C) 2008 e_k (e_k@users.sourceforge.net) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#ifndef _Q_TERM_WIDGET -#define _Q_TERM_WIDGET - -#include - -struct TermWidgetImpl; - -enum COLOR_SCHEME { COLOR_SCHEME_WHITE_ON_BLACK = 1, - COLOR_SCHEME_GREEN_ON_BLACK, - COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW }; - -class QTermWidget : public QWidget -{ - Q_OBJECT -public: - - enum ScrollBarPosition - { - /** Do not show the scroll bar. */ - NoScrollBar=0, - /** Show the scroll bar on the left side of the display. */ - ScrollBarLeft=1, - /** Show the scroll bar on the right side of the display. */ - ScrollBarRight=2 - }; - - - //Creation of widget - QTermWidget(int startnow = 1, //start shell programm immediatelly - QWidget *parent = 0); - ~QTermWidget(); - - //start shell program if it was not started in constructor - void startShellProgram(); - - //look-n-feel, if you don`t like defaults - - // Terminal font - // Default is application font with family Monospace, size 10 - // USE ONLY FIXED-PITCH FONT! - // otherwise symbols' position could be incorrect - void setTerminalFont(QFont &font); - - //environment - void setEnvironment(const QStringList& environment); - - // Shell program, default is /bin/bash - void setShellProgram(const QString &progname); - - //working directory - void setWorkingDirectory(const QString& dir); - - // Shell program args, default is none - void setArgs(QStringList &args); - - //Text codec, default is UTF-8 - void setTextCodec(QTextCodec *codec); - - //Color scheme, default is white on black - void setColorScheme(int scheme); - - //set size - void setSize(int h, int v); - - // History size for scrolling - void setHistorySize(int lines); //infinite if lines < 0 - - // Presence of scrollbar - void setScrollBarPosition(ScrollBarPosition); - - // Send some text to terminal - void sendText(QString &text); - - // Sets whether flow control is enabled - void setFlowControlEnabled(bool enabled); - - // Returns whether flow control is enabled - bool flowControlEnabled(void); - - /** - * Sets whether the flow control warning box should be shown - * when the flow control stop key (Ctrl+S) is pressed. - */ - void setFlowControlWarningEnabled(bool enabled); - - // Sets read-only mode to terminal - void setReadOnly(bool); - -signals: - void finished(); - -public slots: - // Paste clipboard content to terminal - void copyClipboard(); - - // Copies selection to clipboard - void pasteClipboard(); - -protected: - virtual void resizeEvent(QResizeEvent *); - void *getTerminalDisplay(); - -protected slots: - void sessionFinished(); - -private: - void init(); - TermWidgetImpl *m_impl; -}; - - -//Maybe useful, maybe not - -#ifdef __cplusplus -extern "C" -#endif -void *createTermWidget(int startnow, void *parent); - -#endif - diff --git a/qterminal.pro b/qterminal.pro --- a/qterminal.pro +++ b/qterminal.pro @@ -1,4 +1,2 @@ TEMPLATE = subdirs SUBDIRS = libqterminal qterminal - -OPTIONS += ordered diff --git a/qterminal/main.cpp b/qterminal/main.cpp --- a/qterminal/main.cpp +++ b/qterminal/main.cpp @@ -21,29 +21,29 @@ #include #include -#include "qtermwidget.h" +#include "QTerminal.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow *mainWindow = new QMainWindow(); - QTermWidget *console = new QTermWidget(); + QTerminal *terminal = new QTerminal(); QFont font = QApplication::font(); font.setFamily("Monospace"); font.setPointSize(12); - console->setTerminalFont(font); + terminal->setTerminalFont(font); //console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW); - console->setScrollBarPosition(QTermWidget::ScrollBarRight); + terminal->setScrollBarPosition(QTerminal::ScrollBarRight); //console->setReadOnly(true); - mainWindow->setCentralWidget(console); + mainWindow->setCentralWidget(terminal); mainWindow->resize(902, 810); - QObject::connect(console, SIGNAL(finished()), mainWindow, SLOT(close())); + QObject::connect(terminal, SIGNAL(finished()), mainWindow, SLOT(close())); mainWindow->show(); return app.exec(); diff --git a/qterminal/qterminal.pro b/qterminal/qterminal.pro --- a/qterminal/qterminal.pro +++ b/qterminal/qterminal.pro @@ -1,28 +1,13 @@ TEMPLATE = app -DESTDIR = .. - -CONFIG += qt debug_and_release warn_on build_all +DESTDIR = . QT += core gui -MOC_DIR = ../.moc +SOURCES = main.cpp +INCLUDEPATH = ../libqterminal -CONFIG(debug, debug|release) { - OBJECTS_DIR = ../.objs_d - TARGET = consoleq_d - LIBS += -L.. ../libqtermwidget_d.a -# LIBS += -lqtermwidget -} else { - OBJECTS_DIR = ../.objs - TARGET = consoleq - LIBS += -L.. ../libqtermwidget.a -} - -SOURCES = main.cpp - -INCLUDEPATH = ../lib - -#LIBS += -L.. -lqtermwidget +LIBS += -L../libqterminal -lqterminal - \ No newline at end of file + +