Shellp

qtiosystem.h

00001 /*
00002     
00003   This file is a part of Shellp, a 'shell helper' library.
00004   
00005   Copyright (C) 2011-2012 Jori Liesenborgs
00006   
00007   Contact: jori.liesenborgs@gmail.com
00008 
00009   This library is free software; you can redistribute it and/or
00010   modify it under the terms of the GNU Lesser General Public
00011   License as published by the Free Software Foundation; either
00012   version 2.1 of the License, or (at your option) any later version.
00013 
00014   This library is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017   Lesser General Public License for more details.
00018 
00019   You should have received a copy of the GNU Lesser General Public
00020   License along with this library; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  
00022   USA
00023 
00024 */
00025 
00026 #ifndef SHELLP_QTIOSYSTEM_H
00027 
00028 #define SHELLP_QTIOSYSTEM_H
00029 
00030 #include "shellconfig.h"
00031 #include "iosystem.h"
00032 #include "signalwaiter.h"
00033 #include <jthread/jmutex.h>
00034 #include <string>
00035 #include <list>
00036 
00037 namespace shellp
00038 {
00039 
00040 class ShellMainWin;
00041 
00042 class QtIOSystem : public IOSystem
00043 {
00044 public:
00045         QtIOSystem(ShellMainWin *pMainWin);
00046         ~QtIOSystem();
00047 
00048         void writeOutputLine(const std::string &line, bool newline = true);
00049         void setPercentageFeedback(double pct);
00050         
00051         bool supports2DPlot() const;
00052         bool supports3DPlot() const;
00053         bool plot2D(int id, const std::string &title,
00054                             const std::string &xLabel, const std::string &yLabel,
00055                             const std::vector<double> &xPoints, const std::vector<double> &yPoints,
00056                             bool forceShow);
00057         bool plot3D(int id, const std::string &title, 
00058                           const std::string &xLabel, const std::string &yLabel,
00059                           const std::string &zLabel,
00060                           double xOff, double yOff, double xDist, double yDist,
00061                           double xMultiplier, double yMultiplier, double zMultiplier,
00062                           const std::vector<double> &data, int numX, int numY, bool forceShow);
00063 
00064         void writeStatusLine(const std::string &str);
00065 
00066         void enterInputLine(const std::string &line);
00067 private:
00068         bool readInputLineInternal(std::string &line);
00069 
00070         SignalWaiter m_waiter;
00071         jthread::JMutex m_mutex;
00072         std::list<std::string> m_enteredLines;
00073         ShellMainWin *m_pMainWin;
00074 };
00075 
00076 } // end namespace
00077 
00078 #endif // SHELLP_QTIOSYSTEM_H