Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / QtCollider / LanguageClient.h
blob6d1b3de8dfea0dd423cea54ac6ecd050d571d880
1 /************************************************************************
3 * Copyright 2011 Jakob Leben (jakob.leben@gmail.com)
5 * This file is part of SuperCollider Qt GUI.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
22 #ifndef QC_LANGUAGE_CLIENT_H
23 #define QC_LANGUAGE_CLIENT_H
25 #include "SC_TerminalClient.h"
26 #include "QC_Export.h"
27 #include "Common.h"
29 #include <QObject>
30 #include <QBasicTimer>
31 #include <QEvent>
33 namespace QtCollider {
35 struct SCRequestEvent : public QEvent
37 SCRequestEvent( QtCollider::EventType type, const QVariant & d = QVariant() ) :
38 QEvent( (QEvent::Type) type ),
39 data( d )
42 QVariant data;
45 class LangClient : public QObject, public SC_TerminalClient
47 Q_OBJECT
48 public:
49 LangClient( const char* name );
50 virtual ~LangClient() {};
51 virtual void sendSignal( Signal );
52 private Q_SLOTS:
53 void doSchedule();
54 protected:
55 virtual void commandLoop();
56 virtual void daemonLoop();
58 virtual void onQuit( int exitCode );
59 virtual void onLibraryShutdown();
61 virtual void customEvent( QEvent * );
62 virtual void timerEvent( QTimerEvent * );
63 private:
64 void doInput();
66 QBasicTimer appClockTimer;
69 } // namespace QtCollider
71 #endif // QC_LANGUAGE_CLIENT_H