Eneboo - Documentación para desarrolladores
src/flbase/FLApplication_p.h
Ir a la documentación de este archivo.
00001 /***************************************************************************
00002                             FLApplication_p.h
00003                           -------------------
00004  begin                : Mon Jul 2 2001
00005  copyright            : (C) 2001-2005 by InfoSiAL S.L.
00006  email                : mail@infosial.com
00007 ***************************************************************************/
00008 /***************************************************************************
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; version 2 of the License.               *
00012  ***************************************************************************/
00013 /***************************************************************************
00014    Este  programa es software libre. Puede redistribuirlo y/o modificarlo
00015    bajo  los  términos  de  la  Licencia  Pública General de GNU   en  su
00016    versión 2, publicada  por  la  Free  Software Foundation.
00017  ***************************************************************************/
00018 
00019 #ifndef FLAPPLICATION_P_H
00020 #define FLAPPLICATION_P_H
00021 
00022 #include <qapplication.h>
00023 #include <qworkspace.h>
00024 #include <qwhatsthis.h>
00025 #include <qtooltip.h>
00026 #include <qmessagebox.h>
00027 #include <qstring.h>
00028 #include <qpixmap.h>
00029 #include <qptrlist.h>
00030 #include <qpopupmenu.h>
00031 #include <qtoolbar.h>
00032 #include <qaction.h>
00033 #include <qstatusbar.h>
00034 #include <qvbox.h>
00035 #include <qlabel.h>
00036 #include <qsignalmapper.h>
00037 #include <qdict.h>
00038 #include <qstylefactory.h>
00039 #include <qstyle.h>
00040 #include <qfontdialog.h>
00041 #include <qmenubar.h>
00042 #include <qpainter.h>
00043 #include <qimage.h>
00044 #include <qtimer.h>
00045 #include <qdockarea.h>
00046 #include <qdockwindow.h>
00047 #include <qpushbutton.h>
00048 #include <qsinterpreter.h>
00049 #include <qsproject.h>
00050 #include <qsargument.h>
00051 #include <qtoolbox.h>
00052 #include <qsinputdialogfactory.h>
00053 #include <qsutilfactory.h>
00054 #include <qtextcodec.h>
00055 #include <qtextedit.h>
00056 #include <qprinter.h>
00057 #include <qpaintdevicemetrics.h>
00058 #include <qsimplerichtext.h>
00059 #include <qpalette.h>
00060 #include <qmutex.h>
00061 #include <qgroupbox.h>
00062 #include <qnetwork.h>
00063 #include <qlocale.h>
00064 #include <aqapplication.h>
00065 
00066 #define AQ_SET_MNGLOADER                 \
00067   bool noMngLoader = (mngLoader_ == 0);  \
00068   if (noMngLoader)                       \
00069     mngLoader_ = db()->managerModules();
00070 
00071 #define AQ_UNSET_MNGLOADER               \
00072   if (noMngLoader)                       \
00073     mngLoader_ = 0;
00074 
00075 class QSWorkbench;
00076 class FLAccessControlLists;
00077 class FLSqlDatabase;
00078 class FLWorkspace;
00079 class FLPopupWarn;
00080 class FLManagerModules;
00081 class QUrlOperator;
00082 class QNetworkOperation;
00083 
00089 class FLApplication: public AQ_DECL_APP
00090 {
00091   Q_OBJECT
00092 
00093 public:
00094 
00098   FLApplication(int &argc, char **argv);
00099 
00103   virtual ~FLApplication();
00104 
00122   virtual void init(const QString &n = QString::null, const QString &callFunction = QString::null,
00123                     const QString &arguments = QString::null, bool quitAfterCall = false, bool noMax = false);
00124 
00128   FLWorkspace *workspace() const;
00129 
00135   void setMainWidget(QWidget *w);
00136 
00142   void showMainWidget(QWidget *w);
00143 
00149   QSProject *project() const {
00150     return project_;
00151   }
00152 
00158   const QDateTime &timeUser() const;
00159 
00167   QSArgument call(const QString &function,
00168                   const QSArgumentList &arguments = QSArgumentList(),
00169                   QObject *objectContext = 0) const;
00170 
00178   QSArgument call(const QString &function,
00179                   const QSArgumentList &arguments = QSArgumentList(),
00180                   const QString &nameObjectContext = QString::null) const {
00181     return call(function, arguments, project_->object(nameObjectContext));
00182   }
00183 
00192   void setCaptionMainWidget(const QString &text);
00193 
00197   QString lastTextCaption() const {
00198     return lastTextCaption_;
00199   }
00200 
00204   void setNotExit(const bool &b);
00205 
00209   void setNoGUI(const bool &b);
00210 
00214   FLAccessControlLists *acl() const {
00215     return acl_;
00216   }
00217 
00223   void printTextEdit(QTextEdit *editor);
00224 
00228   void setPrintProgram(const QString &printProgram);
00229 
00233   const QString &printProgram() const;
00234 
00238   bool noGUI() const;
00239 
00247   bool addSysCode(const QString &code, const QString &scriptEntryFunction = QString::null);
00248 
00252   void setScriptEntryFunction(const QString &scriptEntryFunction);
00253 
00262   QString getTabWidgetPages(const QString &wN, const QString &n);
00263 
00272   QString getWidgetList(const QString &wN, const QString &c);
00273 
00277   FLSqlDatabase *db();
00278 
00299   void setDatabaseLockDetection(bool on = true, int msecLapsus = 30000, int limChecks = -1,
00300                                 bool showWarn = true, const QString &msgWarn = QString::null,
00301                                 const QString &connectionName = "default");
00302 
00310   void popupWarn(const QString &msgWarn,
00311                  const QMap<QString, QSArgumentList> & scriptCalls);
00312 
00318   void popupWarn(const QString &msgWarn);
00319 
00325   void saveGeometryForm(const QString &name, const QRect &geo);
00326   QRect geometryForm(const QString &name) const;
00327 
00331   QWidget *modMainWidget(const QString &idModulo) const;
00332 
00333 signals:
00334 
00338   void databaseLockDetected();
00339 
00340 public slots:
00341 
00345   bool queryExit();
00346 
00350   void statusHelpMsg(const QString &text);
00351 
00358   void openMasterForm(const QString &n, const QPixmap &p);
00359 
00365   void execMainScript(const QString &n);
00366 
00380   void activateModule(const QString &idM);
00381 
00386   void initToolBox();
00387 
00394   void loadScripts();
00395 
00401   void loadTranslations();
00402 
00410   QString trMulti(const QString &s, const QString &l);
00411 
00415   virtual QString translate(const char *context, const char *sourceText,
00416                             const char *comment = 0, Encoding encoding = DefaultCodec) const;
00417 
00429   void setMultiLang(bool enable = true, const QString &langid = QString::null);
00430 
00434   bool multiLangEnabled() const {
00435     return multiLangEnabled_;
00436   }
00437 
00441   QString multiLangId() const {
00442     return multiLangId_;
00443   }
00444 
00449   void showDocPage(const QString &url);
00450 
00457   virtual void reinit();
00458 
00462   void openQSWorkbench();
00463 
00470   void evaluateProject();
00471 
00475   void chooseFont();
00476 
00480   void aboutAbanQ();
00481 
00483   QTranslator *createSysTranslator(const QString &lang, bool loadDefault = false);
00484 
00486   void callScriptEntryFunction();
00487   QLocale localeSystem() const {
00488     return localeSystem_;
00489   }
00490   QChar commaSeparator() const {
00491     return commaSeparator_;
00492   }
00493 
00494 protected:
00495 
00496   QTranslator *createModTranslator(const QString &idM, const QString &lang,
00497                                    bool loadDefault = false) const;
00498   FLManagerModules *mngLoader_;
00499   QAsciiDict<bool> sysContexts_;
00500   QTranslator *sysTr_;
00501 
00505   void writeState();
00506 
00510   void writeStateModule();
00511 
00515   void readStateModule();
00516 
00520   bool eventFilter(QObject *obj, QEvent *ev);
00521 
00522 protected slots:
00523 
00527   void readState();
00528 
00532   void generalExit();
00533 
00540   void openDefaultForm();
00541 
00550   void execDefaultScript();
00551 
00555   void toggleToolBar(bool toggle);
00556 
00560   void toggleStatusBar(bool toggle);
00561 
00565   void helpIndex();
00566 
00571   void windowMenuAboutToShow();
00572 
00576   void windowMenuActivated(int id);
00577 
00581   void windowClose();
00582 
00586   void makeStyle(const QString &);
00587 
00591   void showStyles();
00592 
00596   void showToggleBars();
00597 
00604   void activateModule();
00605 
00612   void reinitP();
00613 
00617   void checkDatabaseLocks(QObject *timer = 0);
00618 
00623   void staticLoaderSetup();
00624 
00628   void loadModules();
00629   void exportModules();
00630   void importModules();
00631   void updateAbanQ();
00632   void dumpDatabase();
00633   void checkForUpdate();
00634   void checkForUpdateFinish(QNetworkOperation * op);
00635 
00636 private:
00637 
00641   void initActions();
00642 
00646   void initMenuBar();
00647 
00651   void initToolBar();
00652 
00656   void initStatusBar();
00657 
00661   void initView();
00662 
00666   void initStyles();
00667 
00671   void initMainWidget();
00672 
00678   void loadScriptsFromModule(const QString &idM);
00679 
00688   void loadTranslationFromModule(const QString &idM, const QString &lang);
00689 
00699   bool existsFormInMDI(const QString &id);
00700 
00704   void clearProject();
00705 
00706 protected:
00707 
00711   FLWorkspace *pWorkspace;
00712 
00716   QWidget *mainWidget_;
00717 
00721   QMainWindow *container;
00722 
00726   QToolBox *toolBox;
00727 
00731   QPushButton *exitButton;
00732 
00736   QPopupMenu *windowMenu;
00737   QAction *windowCascadeAction;
00738   QAction *windowTileAction;
00739   QAction *windowCloseAction;
00740 
00744   QPopupMenu *style;
00745 
00749   QPopupMenu *toggleBars;
00750 
00754   QPopupMenu *modulesMenu;
00755 
00759   QSProject *project_;
00760   QSWorkbench *wb_;
00761 
00770   QDict<QWidget> *dictMainWidgets;
00771 
00775   QDateTime timeUser_;
00776 
00780   QString lastTextCaption_;
00781 
00785   bool formAlone_;
00786 
00790   bool notExit_;
00791 
00795   FLAccessControlLists *acl_;
00796 
00800   QString printProgram_;
00801 
00805   bool noGUI_;
00806 
00810   QString scriptEntryFunction_;
00811 
00815   FLPopupWarn *popupWarn_;
00816 
00822   QMap<QString, QRect> mapGeometryForms_;
00823 
00827   bool multiLangEnabled_;
00828   QString multiLangId_;
00829 
00833   bool initializing_;
00834 
00838   QSObjectFactory *flFactory_;
00839   QLocale localeSystem_;
00840   QChar commaSeparator_;
00841   QUrlOperator *opCheckUpdate_;
00842   QString hashUpdate_;
00843 };
00844 
00845 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'