src/qvcore/qvapplication.h

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007. 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 <QList>
00030 #include <QString>
00031 #include <QStringList>
00032 #include <QApplication>
00033 #include <qvcore/qvdefines.h>
00034 
00035 class QVGUI;
00036 class QVPropertyContainer;
00037 
00038 #define qvApp ((QVApplication*) qApp)
00039 
00049 class QVApplication : public QApplication
00050 {
00051         Q_OBJECT
00052 public:
00066         QVApplication (int &argc, char **argv,
00067                                    QString info = QString(), bool GUIenabled = TRUE);
00068 
00084         int exec();
00085 
00093         void setTerminateOnLastWorker(bool terminate) { terminateOnLastWorker=terminate; };
00094 
00107         void setArgumentAsUsed(QString argument);
00108 
00118         QStringList getUnusedArguments();
00119 
00122         bool isRunning() { return isRunningFlag; };
00123 
00126         bool forHelp() { return forHelpFlag; };
00127 
00130         static QVApplication* instance() { return dynamic_cast<QVApplication*>(qApp); }
00131 
00132 #ifndef DOXYGEN_IGNORE_THIS
00133         void registerQVPropertyContainer(QVPropertyContainer *qvp);
00134         void deregisterQVPropertyContainer(QVPropertyContainer *qvp);
00135         void registerGUI(QVGUI *visionInterface);
00136         QSet<QVPropertyContainer *> getQVPropertyContainers() { return qvps; };
00137 
00138 signals:
00139         void inited();
00140 
00141 private slots:
00142         void initWorkers();
00143 #endif
00144 
00145 public slots:
00151         void quit();
00152 
00153 private slots:
00154         void workerFinished();
00155 
00156 private:
00157         QString info;
00158         QStringList unusedArguments;
00159         QSet<QVPropertyContainer *> qvps;
00160         QVGUI *visionInterface;
00161         bool isRunningFlag;
00162         int workerCount;
00163         bool terminateOnLastWorker, forHelpFlag;
00164 
00165         void printHelp() const;
00166 };
00167 #endif // QVAPPLICATION_H

Generated on Thu Jul 17 17:23:27 2008 for QVision by  doxygen 1.5.3