Mercurial > hg > octave-lyh
changeset 15662:5758e0013246
Enable compilation on Win32-native platform.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Thu, 02 Feb 2012 15:01:22 +0000 |
parents | ccef87280af6 |
children | 0af1a3d65264 |
files | .gitignore libqterminal/QTerminal.h libqterminal/QTerminalInterface.h libqterminal/libqterminal.pro libqterminal/unix/QUnixTerminalImpl.cpp libqterminal/unix/QUnixTerminalImpl.h libqterminal/win32/QTerminalColors.cpp libqterminal/win32/QWinTerminalImpl.cpp libqterminal/win32/QWinTerminalImpl.h qterminal/qterminal.pro |
diffstat | 10 files changed, 77 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/libqterminal/QTerminal.h +++ b/libqterminal/QTerminal.h @@ -23,7 +23,9 @@ #ifndef QTERMINAL_H #define QTERMINAL_H -#ifdef __WIN32 +#include <QtGlobal> + +#ifdef Q_OS_WIN32 #include "win32/QWinTerminalImpl.h" class QTerminal : public QWinTerminalImpl {
--- a/libqterminal/QTerminalInterface.h +++ b/libqterminal/QTerminalInterface.h @@ -32,18 +32,13 @@ QTerminalInterface(QWidget *parent = 0) : QWidget(parent) { } virtual ~QTerminalInterface() { } - virtual void setTerminalFont(QFont &font) = 0; + virtual void setTerminalFont(const QFont& font) = 0; virtual void setSize(int h, int v) = 0; - virtual void sendText(QString text) = 0; + virtual void sendText(const QString& text) = 0; public slots: virtual void copyClipboard() = 0; virtual void pasteClipboard() = 0; - -protected: - virtual void focusInEvent(QFocusEvent *focusEvent) = 0; - virtual void showEvent(QShowEvent *) = 0; - virtual void resizeEvent(QResizeEvent *) = 0; }; #endif // QTERMINALINTERFACE_H
--- a/libqterminal/libqterminal.pro +++ b/libqterminal/libqterminal.pro @@ -7,6 +7,8 @@ QT += core gui +INCLUDEPATH += . + unix { DEFINES += HAVE_POSIX_OPENPT
--- a/libqterminal/unix/QUnixTerminalImpl.cpp +++ b/libqterminal/unix/QUnixTerminalImpl.cpp @@ -93,7 +93,7 @@ emit destroyed(); } -void QUnixTerminalImpl::setTerminalFont(QFont &font) +void QUnixTerminalImpl::setTerminalFont(const QFont &font) { if(!m_terminalView) return; @@ -107,7 +107,7 @@ m_terminalView->setSize(h, v); } -void QUnixTerminalImpl::sendText(QString text) +void QUnixTerminalImpl::sendText(const QString& text) { m_terminalModel->sendText(text); }
--- a/libqterminal/unix/QUnixTerminalImpl.h +++ b/libqterminal/unix/QUnixTerminalImpl.h @@ -34,9 +34,9 @@ QUnixTerminalImpl(QWidget *parent = 0); virtual ~QUnixTerminalImpl(); - void setTerminalFont(QFont &font); + void setTerminalFont(const QFont &font); void setSize(int h, int v); - void sendText(QString text); + void sendText(const QString& text); public slots: void copyClipboard();
--- a/libqterminal/win32/QTerminalColors.cpp +++ b/libqterminal/win32/QTerminalColors.cpp @@ -22,7 +22,7 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> -#include "win32/QTerminalColors.h" +#include "QTerminalColors.h" //////////////////////////////////////////////////////////////////////////////
--- a/libqterminal/win32/QWinTerminalImpl.cpp +++ b/libqterminal/win32/QWinTerminalImpl.cpp @@ -39,8 +39,8 @@ #include <windows.h> #include <cstring> -#include "win32/QWinTerminalImpl.h" -#include "win32/QTerminalColors.h" +#include "QWinTerminalImpl.h" +#include "QTerminalColors.h" // Uncomment to log activity to LOGFILENAME // #define DEBUG_QCONSOLE @@ -48,6 +48,10 @@ // Uncomment to create hidden console window #define HIDDEN_CONSOLE +#ifdef _MSC_VER +# pragma warning(disable : 4996) +#endif + ////////////////////////////////////////////////////////////////////////////// class QConsoleView : public QWidget @@ -86,7 +90,7 @@ friend class QWinTerminalImpl; public: - QConsolePrivate (QUnixTerminalImpl* parent, const QString& cmd = QString ()); + QConsolePrivate (QWinTerminalImpl* parent, const QString& cmd = QString ()); ~QConsolePrivate (void); void updateConsoleSize (bool sync = false); @@ -135,7 +139,7 @@ ////////////////////////////////////////////////////////////////////////////// -QConsolePrivate::QConsolePrivate (QUnixTerminalImpl* parent, const QString& cmd) +QConsolePrivate::QConsolePrivate (QWinTerminalImpl* parent, const QString& cmd) : q (parent), m_command (cmd), m_process (NULL), m_inWheelEvent (false) { log (NULL); @@ -342,6 +346,8 @@ FILE* flog = fopen (LOGFILENAME, "w"); fclose (flog); } +#else + Q_UNUSED (fmt); #endif } @@ -599,7 +605,12 @@ void QConsolePrivate::startCommand (void) { - if (! m_command.isEmpty ()) + QString cmd = m_command; + + if (cmd.isEmpty ()) + cmd = qgetenv ("COMSPEC").constData (); + + if (! cmd.isEmpty ()) { STARTUPINFO si; PROCESS_INFORMATION pi; @@ -609,7 +620,7 @@ ZeroMemory (&pi, sizeof (pi)); if (CreateProcessW (NULL, - (LPWSTR)m_command.unicode (), + (LPWSTR)cmd.unicode (), NULL, NULL, TRUE, @@ -687,14 +698,14 @@ ////////////////////////////////////////////////////////////////////////////// QWinTerminalImpl::QWinTerminalImpl (QWidget* parent) - : d (new QConsolePrivate (this)) + : QTerminalInterface (parent), d (new QConsolePrivate (this)) { } ////////////////////////////////////////////////////////////////////////////// QWinTerminalImpl::QWinTerminalImpl (const QString& cmd, QWidget* parent) - : d (new QConsolePrivate (this, cmd)) + : QTerminalInterface (parent), d (new QConsolePrivate (this, cmd)) { } @@ -872,3 +883,29 @@ d->sendConsoleText (s); } +////////////////////////////////////////////////////////////////////////////// + +void QWinTerminalImpl::setTerminalFont (const QFont& f) +{ + Q_UNUSED (f); +} + +////////////////////////////////////////////////////////////////////////////// + +void QWinTerminalImpl::setSize (int columns, int lines) +{ + Q_UNUSED (columns); + Q_UNUSED (lines); +} + +////////////////////////////////////////////////////////////////////////////// + +void QWinTerminalImpl::copyClipboard (void) +{ +} + +////////////////////////////////////////////////////////////////////////////// + +void QWinTerminalImpl::pasteClipboard (void) +{ +}
--- a/libqterminal/win32/QWinTerminalImpl.h +++ b/libqterminal/win32/QWinTerminalImpl.h @@ -48,8 +48,14 @@ QWinTerminalImpl (const QString& cmd, QWidget* parent = 0); ~QWinTerminalImpl (void); + void setTerminalFont (const QFont& font); + void setSize (int columns, int lines); void sendText (const QString& s); +public slots: + void copyClipboard (void); + void pasteClipboard (void); + signals: void terminated (void); void titleChanged (const QString&);
--- a/qterminal/qterminal.pro +++ b/qterminal/qterminal.pro @@ -6,8 +6,14 @@ SOURCES = main.cpp INCLUDEPATH = ../libqterminal -LIBS += -L../libqterminal -lqterminal -lutil - - - - +win32 { + win32-msvc* { + debug: LIBS += -L../libqterminal/debug + release: LIBS += -L../libqterminal/release + } else { + LIBS += -L../libqterminal + } + LIBS += -lqterminal -luser32 -lkernel32 +} else { + LIBS += -L../libqterminal -lqterminal -lutil +}