00001
00002
00003
00004
00005
00014 #ifndef IMPROV_H
00015 #define IMPROV_H
00016
00017 #ifdef HAVE_CONFIG_H
00018 #include <config.h>
00019 #endif
00020
00021 #include <assert.h>
00022 #include <dirent.h>
00023 #include <dlfcn.h>
00024 #include <getopt.h>
00025 #include <math.h>
00026 #include <iostream>
00027 #include <string>
00028 #include <sys/types.h>
00029
00030
00031 #include <qaction.h>
00032 #include <qevent.h>
00033 #include <qpopupmenu.h>
00034 #include <qstatusbar.h>
00035 #include <qvaluelist.h>
00036
00037
00038 #include "AnimThread.h"
00039 #include "ParamWidget.h"
00040 #include "PluginMenu.h"
00041 #include "SeqWidget.h"
00042 #include "SrcWidget.h"
00043 #include "ImprovQTCamOpt.h"
00044
00045
00046
00047 #include "FW/labImage.h"
00048 #include "improv_plugin.h"
00049 #include "improvConfig.h"
00050 #include "imageSeq.h"
00051 #include "ipPlugin.h"
00052 #include "utils.h"
00053
00054 class Improv {
00055 friend class PluginMenu;
00056 friend class SeqWidget;
00057 friend class SrcWidget;
00058
00059 public:
00064 static Improv* Instance(int argc, char **argv);
00065
00067 ~Improv();
00068
00073 bool isPlaying(void);
00074
00079 bool isReady(void);
00080
00085 void setPlaying(bool opt);
00086
00092 void addSrcWidget(SrcWidget* sw);
00093
00099 SrcWidget* getSrcWidget(int sourceId);
00100
00107 int getWidgetCount(int sourceId, int position);
00108
00112 QValueList<SrcWidget*> getSrcWidgetList(void);
00113
00121 void addSeqWidget(SeqWidget* sw);
00122
00129
00130
00132 SeqWidget* getSeqWidget(int id);
00133
00135 SeqWidget* getSeqWidget(int sourceId, int position, int number=0);
00136
00140 QValueList<SeqWidget*> getSeqWidgetList(void);
00141
00147 QPopupMenu* getPluginMenu(void);
00148
00155 void setFPS(int fps);
00156
00160 void setUnlimitedFPS(bool toggle);
00161
00168 void copyPictures(Picture *pic);
00169
00173 void tick(int frames=1);
00174
00184 void process(Picture** in, Picture* out, int menuId, int inCount=1, int bufferId=-1, float* params = NULL);
00185
00187 int getPluginUniqueId(int id);
00188
00193 QString* getPluginName(int id);
00194
00196 int getPluginInputCount(int id);
00197
00203 int getPluginNumParams(int id);
00204
00206 QStringList* getPluginParamNames(int id);
00207
00209 void activateParamWidget(int numParams, QStringList* paramNames, float* params);
00211 void setParamWidget(ParamWidget* pw);
00213 void disableParamWidget(void);
00214
00216 void setStatusBar(QStatusBar* statusBar);
00218 bool statusBarReady(void);
00220 void setStatusMessage(const char* msg);
00222 void setStatusMessage(const char* msg, int ms);
00224 void setStatusFPSMessage(const char* msg);
00226 void setStatusResultMessage(const char* msg);
00228 const char *getStatusMessage(void);
00229
00231 void constructPluginMenu(void);
00232
00234 int getNumBuffers(void);
00236 void addFrameBuffer(int numFrames);
00238 void removeFrameBuffer(int bufferId, int menuId);
00239
00241 void setCamOptAction(QAction *action);
00243 void setCamOpt(ImprovQTCamOpt *options);
00245 ImprovQTCamOpt *getCamOpt(void);
00247 void setCamOptOpen(bool open);
00249 bool camOptIsOpen(void);
00251 void updateCamOpt(imageSeqType type, Camera *camera);
00252
00254 void clearSeqSelections(void);
00255
00257 improvConfig* config;
00258
00259 protected:
00261 Improv(int argc, char **argv);
00263 void setMenuId(int id);
00265 int getMenuId(void);
00267 int getMenuId(int uniqueId, char *functionName);
00268
00269 private:
00271 static Improv* _instance;
00273 AnimThread* animThread;
00275 bool playing;
00277 QValueList<Plugin*> pluginList;
00279 PluginMenu* pluginMenu;
00280
00284 QValueList<SrcWidget*> srcWidgetList;
00288 QValueList<SeqWidget*> seqWidgetList;
00289
00291 ParamWidget* paramWidget;
00292
00294 QStatusBar* statusBar;
00295
00297 const char *statusBarMsg;
00299 const char *fpsMsg;
00301 const char *resultMsg;
00302
00303
00304
00305
00307 QValueList<Picture**> frameBuffer;
00308
00309
00311 int seqId;
00313 int menuId;
00314
00316 ImprovQTCamOpt *camOptions;
00318 QAction *camOptionAction;
00320 bool camOptOpen;
00321
00323 static int seq_file_select(const struct dirent *entry);
00325 static int plugin_file_select(const struct dirent *entry);
00326
00327 };
00328
00329 #endif