PARP Research Group University of Murcia, Spain


src/qvcore/qvapplication.h

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008, 2009. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #ifndef QVAPPLICATION_H
00026 #define QVAPPLICATION_H
00027 
00028 #include <QSet>
00029 #include <QString>
00030 #include <QStringList>
00031 #include <QApplication>
00032 #include <QMutex>
00033 
00034 #include <qvdefines.h>
00035 
00036 class QVGUI;
00037 class QVPropertyContainer;
00038 class QVWorker;
00039 class QVImageCanvas;
00040 
00041 #define qvApp ((QVApplication*) qApp)
00042 
00052 class QVApplication : public QApplication
00053 {
00054         Q_OBJECT
00055 public:
00069         QVApplication (int &argc, char **argv,
00070                                    QString info = QString(), bool GUIenabled = TRUE);
00071 
00087         int exec();
00088 
00096         void setTerminateOnLastWorker(bool terminate) { terminateOnLastWorker=terminate; };
00097 
00110         void setArgumentAsUsed(QString argument);
00111 
00121         QStringList getUnusedArguments();
00122 
00125         bool isRunning() { return isRunningFlag; };
00126 
00129         bool forHelp() { return forHelpFlag; };
00130 
00133         QString getHelp();
00134 
00137         static QVApplication* instance() { return dynamic_cast<QVApplication*>(qApp); }
00138 
00139 #ifndef DOXYGEN_IGNORE_THIS
00140         void registerQVPropertyContainer(QVPropertyContainer *qvp);
00141         void deregisterQVPropertyContainer(QVPropertyContainer *qvp);
00142         void registerGUI(QVGUI *visionInterface);
00143         void deregisterGUI();
00144         QSet<QVPropertyContainer *> getQVPropertyContainers() { return qvps; };
00145         QMutex mutex; // A global mutex
00146 #endif
00147 
00148 public slots:
00152         bool startItems();
00153 
00159         void quitItems();
00160 
00161         void quitWorker(QVWorker *worker);
00162 
00167         void quit();
00168 
00169 private slots:
00170         void workerFinished();
00171 
00172 private:
00173         QString info;
00174         QStringList unusedArguments;
00175         QSet<QVPropertyContainer *> qvps;
00176         QVGUI *visionInterface;
00177         bool isRunningFlag;
00178         int workerCount;
00179         bool terminateOnLastWorker, forHelpFlag;
00180 
00181         void printHelp();
00182 };
00183 #endif // QVAPPLICATION_H



QVision framework. PARP research group, copyright 2007, 2008.