PARP Research Group University of Murcia, Spain


src/qvcore/qvapplication.h

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008. 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 
00033 #include <qvdefines.h>
00034 
00035 class QVGUI;
00036 class QVPropertyContainer;
00037 class QVWorker;
00038 class QVImageCanvas;
00039 
00040 #define qvApp ((QVApplication*) qApp)
00041 
00051 class QVApplication : public QApplication
00052 {
00053         Q_OBJECT
00054 public:
00068         QVApplication (int &argc, char **argv,
00069                                    QString info = QString(), bool GUIenabled = TRUE);
00070 
00086         int exec();
00087 
00095         void setTerminateOnLastWorker(bool terminate) { terminateOnLastWorker=terminate; };
00096 
00109         void setArgumentAsUsed(QString argument);
00110 
00120         QStringList getUnusedArguments();
00121 
00124         bool isRunning() { return isRunningFlag; };
00125 
00128         bool forHelp() { return forHelpFlag; };
00129 
00132         static QVApplication* instance() { return dynamic_cast<QVApplication*>(qApp); }
00133 
00134 #ifndef DOXYGEN_IGNORE_THIS
00135         void registerQVPropertyContainer(QVPropertyContainer *qvp);
00136         void deregisterQVPropertyContainer(QVPropertyContainer *qvp);
00137         void registerGUI(QVGUI *visionInterface);
00138         void deregisterGUI();
00139         QSet<QVPropertyContainer *> getQVPropertyContainers() { return qvps; };
00140 #endif
00141 
00142 public slots:
00146         bool startItems();
00147 
00153         void quitItems();
00154 
00155         void quitWorker(QVWorker *worker);
00156 
00161         void quit();
00162 
00163 private slots:
00164         void workerFinished();
00165 
00166 private:
00167         QString info;
00168         QStringList unusedArguments;
00169         QSet<QVPropertyContainer *> qvps;
00170         QVGUI *visionInterface;
00171         bool isRunningFlag;
00172         int workerCount;
00173         bool terminateOnLastWorker, forHelpFlag;
00174 
00175         void printHelp() const;
00176 };
00177 #endif // QVAPPLICATION_H



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