From: Andrey Paskal Date: Thu, 1 Jan 2009 11:47:09 +0000 (+0300) Subject: Sync with CVS. X-Git-Url: https://gitweb.ananas.su/?a=commitdiff_plain;h=1eb27f51b293653ad7271883adcf3d64e39e46c3;p=projects%2Fananas-labs-qt4.git Sync with CVS. --- diff --git a/src/admin/main.cpp b/src/admin/main.cpp index db9ae79..5d77dc1 100644 --- a/src/admin/main.cpp +++ b/src/admin/main.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: main.cpp,v 1.4 2008/12/05 21:11:54 leader Exp $ +** $Id: main.cpp,v 1.5 2008/12/25 19:08:03 leader Exp $ ** ** Main file of Ananas Administrator application ** @@ -37,40 +37,30 @@ //QApplication *application = 0; //MainForm *mainform = 0; -//QTranslator *translator = 0, tr_app(0), tr_lib(0), tr_plugins(0); +QTranslator *translator = 0, tr_app(0), tr_lib(0), tr_plugins(0); QString lang="en", rcfile="", username="", userpassword=""; -int setTranslator(QString lang) +int setTranslator(QString langdir, QString lang) { - QString langdir; -#ifdef _Windows - langdir = qApp->applicationDirPath()+"/"; -#else - langdir = "/usr/share/ananas/translations/"; -#endif -// tr_app.load( langdir+"ananas-administrator-"+lang+".qm","."); -// tr_lib.load( langdir+"ananas-lib-"+lang+".qm","."); -// tr_plugins.load( langdir+"ananas-plugins-"+lang+".qm","."); + tr_app.load( langdir+"ananas-administrator-"+lang+".qm","."); + tr_lib.load( langdir+"ananas-lib-"+lang+".qm","."); + tr_plugins.load( langdir+"ananas-plugins-"+lang+".qm","."); return 0; } int -parseCommandLine( int argc, char **argv ) +parseCommandLine( AApplication *a ) { QString param, name, value; - int i; - char *s, locale[50]="en"; - - strncpy( locale, QTextCodec::locale(), sizeof( locale ) ); - s = strchr( locale, '_' ); - if ( s ) { - *s = 0; - } - lang = locale; - setTranslator( lang ); + int i, argc; + char **argv; + + argc = a->argc(); + argv = a->argv(); + setTranslator( a->langDir(), a->lang() ); // printf("locale=%s\n", locale ); QString str_ru=QString::null, str_en=QString::null; bool lang_setted = false; @@ -95,7 +85,7 @@ parseCommandLine( int argc, char **argv ) if (name == "--lang") { lang = value; lang_setted = true; - setTranslator( lang ); + setTranslator( a->langDir(), lang ); } if (name == "--rc") rcfile = value; } @@ -125,7 +115,7 @@ int main( int argc, char ** argv ) QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF8") ); qApp->addLibraryPath( qApp->applicationDirPath() ); - if ( parseCommandLine( argc, argv ) ) return 1; + if ( parseCommandLine( &a ) ) return 1; // qApp->installTranslator( &tr_app ); // qApp->installTranslator( &tr_lib ); // qApp->installTranslator( &tr_plugins ); diff --git a/src/ananas/main.cpp b/src/ananas/main.cpp index 84b0b96..c4fcdbd 100644 --- a/src/ananas/main.cpp +++ b/src/ananas/main.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: main.cpp,v 1.5 2008/12/10 21:05:14 leader Exp $ +** $Id: main.cpp,v 1.6 2008/12/25 19:08:03 leader Exp $ ** ** Main file of Ananas Engine application ** @@ -48,34 +48,28 @@ QString lang="en", username="", userpassword=""; -int setTranslator(QString lang) + +int +setTranslator(QString langdir, QString lang) { - QString langdir; -#ifdef _Windows - langdir = qApp->applicationDirPath()+"/translations/"; -#else - langdir = "/usr/share/ananas/translations/"; -#endif tr_app.load( langdir+"ananas-engine-"+lang.lower()+".qm","."); tr_lib.load( langdir+"ananas-lib-"+lang.lower()+".qm","."); tr_plugins.load( langdir+"ananas-plugins-"+lang.lower()+".qm","."); return 0; } + + int -parseCommandLine( int argc, char **argv ) +parseCommandLine( AApplication *a ) { QString param, name, value; - int i; - char *s, locale[50]="ru"; - - strncpy( locale, QTextCodec::locale(), sizeof( locale ) ); - s = strchr( locale, '_' ); - if ( s ) { - *s = 0; - } - lang = locale; - setTranslator( lang ); + int i, argc; + char **argv; + + argc = a->argc(); + argv = a->argv(); + setTranslator( a->langDir(), a->lang() ); // printf("locale=%s\n", locale ); QString str_ru=QString::null, str_en=QString::null; bool lang_setted = false; @@ -101,7 +95,7 @@ parseCommandLine( int argc, char **argv ) if (name == "--lang") { lang = value; lang_setted = true; - setTranslator( lang ); + setTranslator( a->langDir(), lang ); } if (name == "--rc") rcfile = value; } @@ -120,6 +114,8 @@ parseCommandLine( int argc, char **argv ) return 0; } + + int main( int argc, char ** argv ) { @@ -137,7 +133,7 @@ int main( int argc, char ** argv ) a.setOrganizationName("ananasgroup"); a.setApplicationName("ananas"); - if ( parseCommandLine( qApp->argc(), qApp->argv() ) ) return 1; + if ( parseCommandLine( &a ) ) return 1; qApp->installTranslator( &tr_app ); qApp->installTranslator( &tr_lib ); qApp->installTranslator( &tr_plugins ); diff --git a/src/designer/main.cpp b/src/designer/main.cpp index 97c73fe..2d62a91 100644 --- a/src/designer/main.cpp +++ b/src/designer/main.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: main.cpp,v 1.5 2008/12/05 21:11:54 leader Exp $ +** $Id: main.cpp,v 1.6 2008/12/25 19:08:03 leader Exp $ ** ** Main file of Ananas Designer application ** @@ -51,34 +51,40 @@ QString lang="en", userpassword=""; -int setTranslator(QString lang) +int setTranslator(QString langdir, QString lang) { - QString langdir; -#ifdef Q_OS_WIN32 - langdir = qApp->applicationDirPath()+"/translations/"; -#else - langdir = "/usr/share/ananas4/translations/"; -#endif +// QString langdir; +//#ifdef Q_OS_WIN32 +// langdir = qApp->applicationDirPath()+"/translations/"; +//#else +// langdir = "/usr/share/ananas4/translations/"; +//#endif tr_app.load( langdir+"ananas-designer-"+lang+".qm","."); tr_lib.load( langdir+"ananas-lib-"+lang+".qm","."); tr_plugins.load( langdir+"ananas-plugins-"+lang+".qm","."); return 0; } + + int -parseCommandLine( int argc, char **argv ) +parseCommandLine( AApplication *a ) { QString param, name, value; - int i; - char *s, locale[50]="en"; + int i, argc; + char **argv; + + argc = a->argc(); + argv = a->argv(); +// char *s, locale[50]="en"; - strncpy( locale, QTextCodec::locale(), sizeof( locale ) ); - s = strchr( locale, '_' ); - if ( s ) { - *s = 0; - } - lang = locale; - setTranslator( lang ); +// strncpy( locale, QTextCodec::locale(), sizeof( locale ) ); +// s = strchr( locale, '_' ); +// if ( s ) { +// *s = 0; +// } +// lang = locale; + setTranslator( a->langDir(), a->lang() ); // printf("locale=%s\n", locale ); QString str_ru=QString::null, str_en=QString::null; bool lang_setted = false; @@ -103,7 +109,7 @@ parseCommandLine( int argc, char **argv ) if (name == "--lang") { lang = value; lang_setted = true; - setTranslator( lang ); + setTranslator( a->langDir(), lang ); } if (name == "--rc") rcfile = value; } @@ -143,7 +149,7 @@ int main( int argc, char ** argv ) int rc; QPixmap pixmap; - if ( parseCommandLine( argc, argv ) ) return 1; + if ( parseCommandLine( &app ) ) return 1; qApp->installTranslator( &tr_lib ); qApp->installTranslator( &tr_plugins ); qApp->installTranslator( &tr_app ); diff --git a/src/lib/metadata/ametaaccregister.cpp b/src/lib/metadata/ametaaccregister.cpp new file mode 100644 index 0000000..8280560 --- /dev/null +++ b/src/lib/metadata/ametaaccregister.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** $Id: ametaaccregister.cpp,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Code file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader AccTech. All rights reserved. +** Copyright (C) Grigory Panov , Yoshkar-Ola. +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include "ametaaccregister.h" + +/*! + * \class AMetaAccRegister + * + */ +AMetaAccRegister::AMetaAccRegister( AMetaObject *parent ) +:AMetaObject("AccRegister", "", parent ) +{ + setId( lastId() ); + setName( QString("%1_%2").arg( tr("AccRegister") ).arg( id() ) ); + addChild( &v_fields ); + addChild( &v_gfields ); + addChild( &v_forms ); + +} + + +AMetaFields * +AMetaAccRegister::fields() +{ + return &v_fields; +} + + + +AMetaFields * +AMetaAccRegister::gfields() +{ + return &v_gfields; +} + + +AMetaForms * +AMetaAccRegister::forms() +{ + return &v_forms; +} + + + +/*! + * \class AMetaAccRegisters + * + */ +AMetaAccRegisters::AMetaAccRegisters() +:AMetaGroup("AccRegisters") +{ + +} diff --git a/src/lib/metadata/ametaaccregister.h b/src/lib/metadata/ametaaccregister.h new file mode 100644 index 0000000..2d1b59c --- /dev/null +++ b/src/lib/metadata/ametaaccregister.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** $Id: ametaaccregister.h,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Header file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader AccTech. All rights reserved. +** Copyright (C) Andrey Paskal , Yoshkar-Ola +** Copyright (C) 2003-2005 Grigory Panov , Yoshkar-Ola +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef AMETAACCREGISTER_H +#define AMETAACCREGISTER_H + +#include "ametaobject.h" +#include "ametaobjectgroup.h" +#include "ametafield.h" +#include "ametaform.h" + + +class AMetaAccRegister: public AMetaObject +{ +Q_OBJECT +public: + AMetaAccRegister( AMetaObject *parent = 0 ); + +public slots: + AMetaFields *fields(); + AMetaFields *gfields(); + AMetaForms *forms(); + +private: + AMetaFields v_fields; + AMetaFields v_gfields; + AMetaForms v_forms; +}; + + + +class AMetaAccRegisters: public AMetaGroup +{ +Q_OBJECT +public: + AMetaAccRegisters(); + + AMetaAccRegister *newAccRegister(){ return new AMetaAccRegister( this );}; + AMetaAccRegister *accReister( const QString &name ){ return (AMetaAccRegister*) child( name );}; + AMetaAccRegister *accRegister( int idx ){ return (AMetaAccRegister*) child( idx );}; + int accRegisterCount(){ return childCount(); }; + +public slots: + + +}; + +#endif diff --git a/src/lib/metadata/ametacatalogue.cpp b/src/lib/metadata/ametacatalogue.cpp new file mode 100644 index 0000000..aca7464 --- /dev/null +++ b/src/lib/metadata/ametacatalogue.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** $Id: ametacatalogue.cpp,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Code file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Grigory Panov , Yoshkar-Ola. +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include "ametacatalogue.h" + +/*! + * \class AMetaCatalogue + * + */ +AMetaCatalogue::AMetaCatalogue( AMetaObject *parent ) +:AMetaObject("Catalogue", "", parent ) +{ + setId( lastId() ); + setName( QString("%1_%2").arg( tr("Catalogue") ).arg( id() ) ); + addChild( &v_fields ); + addChild( &v_gfields ); + addChild( &v_forms ); + +} + + +AMetaFields * +AMetaCatalogue::fields() +{ + return &v_fields; +} + + + +AMetaFields * +AMetaCatalogue::gfields() +{ + return &v_gfields; +} + + +AMetaForms * +AMetaCatalogue::forms() +{ + return &v_forms; +} + + + +/*! + * \class AMetaCatalogues + * + */ +AMetaCatalogues::AMetaCatalogues() +:AMetaGroup("Catalogues") +{ + +} diff --git a/src/lib/metadata/ametacatalogue.h b/src/lib/metadata/ametacatalogue.h new file mode 100644 index 0000000..772ba2a --- /dev/null +++ b/src/lib/metadata/ametacatalogue.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** $Id: ametacatalogue.h,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Header file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Andrey Paskal , Yoshkar-Ola +** Copyright (C) 2003-2005 Grigory Panov , Yoshkar-Ola +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef AMETACATALOGUE_H +#define AMETACATALOGUE_H + +#include "ametaobject.h" +#include "ametaobjectgroup.h" +#include "ametafield.h" +#include "ametaform.h" + + +class AMetaCatalogue: public AMetaObject +{ +Q_OBJECT +public: + AMetaCatalogue( AMetaObject *parent = 0 ); + +public slots: + AMetaFields *fields(); + AMetaFields *gfields(); + AMetaForms *forms(); + +private: + AMetaFields v_fields; + AMetaFields v_gfields; + AMetaForms v_forms; +}; + + + +class AMetaCatalogues: public AMetaGroup +{ +Q_OBJECT +public: + AMetaCatalogues(); + + AMetaCatalogue *newCatalogue(){ return new AMetaCatalogue( this );}; + AMetaCatalogue *catalogue( const QString &name ){ return (AMetaCatalogue*) child( name );}; + AMetaCatalogue *catalogue( int idx ){ return (AMetaCatalogue*) child( idx );}; + int catalogueCount(){ return childCount(); }; + +public slots: + + +}; + +#endif diff --git a/src/lib/metadata/ametadata.cpp b/src/lib/metadata/ametadata.cpp index e819efa..7b3c1b8 100644 --- a/src/lib/metadata/ametadata.cpp +++ b/src/lib/metadata/ametadata.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametadata.cpp,v 1.5 2008/12/20 21:17:49 leader Exp $ +** $Id: ametadata.cpp,v 1.6 2008/12/24 16:19:38 leader Exp $ ** ** Code file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -83,7 +83,7 @@ AMetaData::clear() -ACataloguesGroup * +AMetaCatalogues * AMetaData::catalogues() { return &v_catalogues; @@ -91,28 +91,28 @@ AMetaData::catalogues() -ADocumentsGroup * +AMetaDocuments * AMetaData::documents() { return &v_documents; } -AReportsGroup * +AMetaReports * AMetaData::reports() { return &v_reports; } -AJournalsGroup * +AMetaJournals * AMetaData::journals() { return &v_journals; } -AInfoRegistersGroup * +AMetaInfoRegisters * AMetaData::inforegisters() { return &v_inforegisters; @@ -120,7 +120,7 @@ AMetaData::inforegisters() -AAccRegistersGroup * +AMetaAccRegisters * AMetaData::accregisters() { return &v_accregisters; diff --git a/src/lib/metadata/ametadata.h b/src/lib/metadata/ametadata.h index b4b18a2..1f91817 100644 --- a/src/lib/metadata/ametadata.h +++ b/src/lib/metadata/ametadata.h @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametadata.h,v 1.4 2008/12/20 21:17:49 leader Exp $ +** $Id: ametadata.h,v 1.5 2008/12/24 16:19:38 leader Exp $ ** ** Header file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -37,6 +37,13 @@ #include "ametaobject.h" #include "ametaobjectgroup.h" #include "ametadocument.h" +#include "ametacatalogue.h" +#include "ametainforegister.h" +#include "ametaaccregister.h" +#include "ametareport.h" +#include "ametajournal.h" +#include "ametainfo.h" +#include "ametaglobal.h" #ifdef __BORLANDC__ @@ -79,28 +86,28 @@ public: static AMetaData* metadata(); public slots: - AMetaDataInfo *info(){ return &v_info;}; - AMetaDataGlobal *global(){ return &v_global;}; + AMetaInfo *info(){ return &v_info;}; + AMetaGlobal *global(){ return &v_global;}; - ADocumentsGroup* documents(); - ACataloguesGroup* catalogues(); - AReportsGroup* reports(); - AJournalsGroup* journals(); - AInfoRegistersGroup* inforegisters(); - AAccRegistersGroup* accregisters(); + AMetaDocuments* documents(); + AMetaCatalogues* catalogues(); + AMetaReports* reports(); + AMetaJournals* journals(); + AMetaInfoRegisters* inforegisters(); + AMetaAccRegisters* accregisters(); QString test(){ return QString("AMETADATA TEST STRING");}; private: - AMetaDataInfo v_info; - AMetaDataGlobal v_global; + AMetaInfo v_info; + AMetaGlobal v_global; //groups - ACataloguesGroup v_catalogues; - ADocumentsGroup v_documents; - AReportsGroup v_reports; - AJournalsGroup v_journals; - AInfoRegistersGroup v_inforegisters; - AAccRegistersGroup v_accregisters; + AMetaCatalogues v_catalogues; + AMetaDocuments v_documents; + AMetaReports v_reports; + AMetaJournals v_journals; + AMetaInfoRegisters v_inforegisters; + AMetaAccRegisters v_accregisters; }; #endif diff --git a/src/lib/metadata/ametadataio.cpp b/src/lib/metadata/ametadataio.cpp index f94fe8f..1b15928 100644 --- a/src/lib/metadata/ametadataio.cpp +++ b/src/lib/metadata/ametadataio.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametadataio.cpp,v 1.2 2008/12/13 22:19:15 leader Exp $ +** $Id: ametadataio.cpp,v 1.3 2008/12/24 16:19:38 leader Exp $ ** ** Code file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -66,11 +66,11 @@ AMetaDataIO::write( const QString &name, AMetaData *md ) } -QObject * -AMetaDataIO::createObject( const QString &name ) +AMetaObject * +AMetaDataIO::createObject( const QString &className, AMetaObject *parent ) { - QObject *o = 0; - if ( name == "AMetaObject" ) return new AMetaObject(); + AMetaObject *o = 0; + if ( className == "AMetaObject" ) return new AMetaObject(); // if ( name == "AMetaObjectGroup" ) return new AMetaObjectGroup(); return o; diff --git a/src/lib/metadata/ametadataio.h b/src/lib/metadata/ametadataio.h index 1e904b8..5630cf5 100644 --- a/src/lib/metadata/ametadataio.h +++ b/src/lib/metadata/ametadataio.h @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametadataio.h,v 1.4 2008/12/19 20:15:50 leader Exp $ +** $Id: ametadataio.h,v 1.5 2008/12/24 16:19:38 leader Exp $ ** ** Header file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -40,7 +40,7 @@ public: ~AMetaDataIO(); virtual int read( const QString &name, AMetaData *md = 0); virtual int write( const QString &name, AMetaData *md = 0); - virtual QObject *createObject( const QString &name ); + virtual AMetaObject *createObject( const QString &className, AMetaObject *parent = 0 ); //virtual void storeGroup( AMetaObjectGroup *g ); // virtual void storeGroupBegin( AMetaObjectGroup *g ); diff --git a/src/lib/metadata/ametadataioxml.cpp b/src/lib/metadata/ametadataioxml.cpp index 3012b8f..acf690f 100644 --- a/src/lib/metadata/ametadataioxml.cpp +++ b/src/lib/metadata/ametadataioxml.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametadataioxml.cpp,v 1.5 2008/12/20 21:17:49 leader Exp $ +** $Id: ametadataioxml.cpp,v 1.7 2008/12/24 20:06:51 leader Exp $ ** ** Code file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -296,31 +296,6 @@ AMetaDataIOXML::write( const QString &name, AMetaData *md ) xml.appendChild( rootnode ); rootnode = xml.documentElement(); -// rootnode.appendChild( AMetaObjectToXML( md ) ); -/* - rootnode.appendChild( AMetaObjectToXML( md->info() ) ); - rootnode.appendChild( AMetaObjectToXML( md->global() ) ); - - int i; - for ( i = 0; i< md->groupCount(); i++ ){ - node = xml.createElement( md->group( i )->name() ); - rootnode.appendChild( node ); - } -*/ -/* node = xml.createElement( md_info ); - rootnode.appendChild( node ); - - - node = xml.createElement( md_interface ); - rootnode.appendChild( node ); - - node = xml.createElement( md_metadata ); - rootnode.appendChild( node ); - - node = xml.createElement( md_actions ); - rootnode.appendChild( node ); -*/ - if ( !file.open( QIODevice::WriteOnly ) ) return 1; QTextStream ts( &file ); xml.save( ts, 4 ); @@ -351,9 +326,12 @@ AMetaDataIOXML::XMLToAMetaObject( QDomElement e, AMetaObject *o ) if ( se.hasAttribute( "type" ) ) { t = se.attribute("type"); v.clear(); - v = se.text(); - if ( v.convert( QVariant::nameToType( t ) ) ) o->setAttr( se.tagName(), v ); + v = AMetaObject::strToVar( se.text(), QVariant::nameToType( t ) ); +// if ( v.convert( QVariant::nameToType( t ) ) ) o->setAttr( se.tagName(), v ); + if ( v.isValid() ) o->setAttr( se.tagName(), v ); } + if ( se.tagName() == "description" && + !o->inherits("AMetaGroup") ) o->setDescription( se.text() ); cur = cur.nextSibling(); } @@ -367,17 +345,21 @@ AMetaDataIOXML::AMetaObjectToXML( AMetaObject *o ) int i; QDomElement e, se; - e = xml.createElement( o->className() ); - if ( !o->inherits("AMetaObjectGroup") ){ + if ( !o ) return e; + e = xml.createElement( o->metaObject()->className() ); + if ( !o->inherits("AMetaGroup") ){ if ( !o->name().isEmpty() ) { e.setAttribute("name", o->name() ); if ( o->id() > 0 ) e.setAttribute("id", QString::number(o->id()) ); } + se = xml.createElement( "description" ); + se.appendChild( xml.createTextNode( o->description() ) ); + e.appendChild( se ); } for ( i=0; i< o->attrCount(); i++ ){ se = xml.createElement( o->attrName( i ) ); se.setAttribute("type", o->attr( i ).typeName() ); - se.appendChild( xml.createTextNode( o->attr( i ).toString() ) ); + se.appendChild( xml.createTextNode( AMetaObject::varToStr( o->attr( i ) ) ) ); e.appendChild( se ); } for ( i=0; i< o->childCount(); i++ ){ diff --git a/src/lib/metadata/ametadocument.cpp b/src/lib/metadata/ametadocument.cpp index b7678c5..ea21fba 100644 --- a/src/lib/metadata/ametadocument.cpp +++ b/src/lib/metadata/ametadocument.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametadocument.cpp,v 1.2 2008/12/20 21:17:49 leader Exp $ +** $Id: ametadocument.cpp,v 1.3 2008/12/24 16:19:38 leader Exp $ ** ** Code file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -72,7 +72,7 @@ AMetaDocument::forms() * \class ADocumentsGroup * */ -ADocumentsGroup::ADocumentsGroup() +AMetaDocuments::AMetaDocuments() :AMetaGroup("Documents") { diff --git a/src/lib/metadata/ametadocument.h b/src/lib/metadata/ametadocument.h index 9b10a54..94d51f1 100644 --- a/src/lib/metadata/ametadocument.h +++ b/src/lib/metadata/ametadocument.h @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametadocument.h,v 1.2 2008/12/20 21:17:49 leader Exp $ +** $Id: ametadocument.h,v 1.3 2008/12/24 16:19:38 leader Exp $ ** ** Header file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -56,11 +56,11 @@ private: -class ADocumentsGroup: public AMetaGroup +class AMetaDocuments: public AMetaGroup { Q_OBJECT public: - ADocumentsGroup(); + AMetaDocuments(); AMetaDocument *newDocument(){ return new AMetaDocument( this );}; AMetaDocument *document( const QString &name ){ return (AMetaDocument*) child( name );}; diff --git a/src/lib/metadata/ametaform.cpp b/src/lib/metadata/ametaform.cpp index 23bded5..f07a28e 100644 --- a/src/lib/metadata/ametaform.cpp +++ b/src/lib/metadata/ametaform.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametaform.cpp,v 1.2 2008/12/20 21:17:49 leader Exp $ +** $Id: ametaform.cpp,v 1.3 2008/12/24 20:06:51 leader Exp $ ** ** Code file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -34,9 +34,63 @@ * \class AMetaField * */ -AMetaForm::AMetaForm() -:AMetaObject("MetaForm") +AMetaForm::AMetaForm( AMetaObject *parent ) +:AMetaObject("MetaForm", "", parent ) { + setSourceCode( + "function on_formstart()\n{\n}\n\n" + "function on_formstop()\n{\n}\n\n" + "function on_button( name )\n{\n}\n\n" + "function on_valuechanged( name, value )\n{\n}\n\n" + "function on_tabupdate( row, col, tablename )\n{\n}\n\n" + "function on_tablerow( tablename )\n{\n}\n\n" + "function on_event( source, data )\n{\n}\n\n" + "function on_tabrowselected( tablename, uid )\n{\n}\n\n" + "function on_conduct()\n{\n}\n\n" + ); + setDefaultMode( 0 ); +} + + +QString +AMetaForm::sourceCode() +{ + return attr("sourcecode").toString(); +} + + +void +AMetaForm::setSourceCode( const QString &src ) +{ + setAttr( "sourcecode", src ); +} + + +int +AMetaForm::defaultMode() +{ + return attr("defaultmode").toInt(); +} + + +void +AMetaForm::setDefaultMode( int mode ) +{ + setAttr( "defaultmode", mode ); +} + + +QByteArray +AMetaForm::dialogue() +{ + return attr("dialogue").toByteArray(); +} + + +void +AMetaForm::setDialogue( const QByteArray &d ) +{ + setAttr( "dialogue", d ); } @@ -49,3 +103,4 @@ AMetaForms::AMetaForms() { } + diff --git a/src/lib/metadata/ametaform.h b/src/lib/metadata/ametaform.h index 65f4997..644ab9a 100644 --- a/src/lib/metadata/ametaform.h +++ b/src/lib/metadata/ametaform.h @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametaform.h,v 1.2 2008/12/20 21:17:49 leader Exp $ +** $Id: ametaform.h,v 1.3 2008/12/24 20:06:51 leader Exp $ ** ** Header file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -37,17 +37,32 @@ class AMetaForm: public AMetaObject { Q_OBJECT public: - AMetaForm(); + AMetaForm( AMetaObject *parent = 0 ); + + QString sourceCode(); + void setSourceCode( const QString &src ); + + int defaultMode(); + void setDefaultMode( int mode ); + + QByteArray dialogue(); + void setDialogue( const QByteArray &d ); + private: }; + class AMetaForms: public AMetaGroup { Q_OBJECT public: AMetaForms(); + AMetaForm * newForm(){ return new AMetaForm( this );}; + AMetaForm *form( const QString &name ){ return (AMetaForm*) child( name );}; + AMetaForm *form( int idx ){ return (AMetaForm*) child( idx );}; + int formCount(){ return childCount(); }; public slots: diff --git a/src/lib/metadata/ametaglobal.cpp b/src/lib/metadata/ametaglobal.cpp new file mode 100644 index 0000000..9024466 --- /dev/null +++ b/src/lib/metadata/ametaglobal.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** $Id: ametaglobal.cpp,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Code file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Grigory Panov , Yoshkar-Ola. +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include "ametaglobal.h" + + +/*! + * \class AMetaGlobal + * + */ +AMetaGlobal::AMetaGlobal() +:AMetaObject("Global") +{ + setSourceCode("function on_systemstart()\n{\n}\n"); +} + + +QString +AMetaGlobal::sourceCode() +{ + return attr("sourcecode").toString(); +} + + +void +AMetaGlobal::setSourceCode( const QString &src ) +{ + setAttr( "sourcecode", src ); +} + + + diff --git a/src/lib/metadata/ametaglobal.h b/src/lib/metadata/ametaglobal.h new file mode 100644 index 0000000..caa5fae --- /dev/null +++ b/src/lib/metadata/ametaglobal.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** $Id: ametaglobal.h,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Header file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Andrey Paskal , Yoshkar-Ola +** Copyright (C) 2003-2005 Grigory Panov , Yoshkar-Ola +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef AMETAGLOBAL_H +#define AMETAGLOBAL_H +#include "ametaobject.h" + +class AMetaGlobal: public AMetaObject +{ +Q_OBJECT +public: + AMetaGlobal(); + + QString sourceCode(); + void setSourceCode( const QString &src ); + +}; + +#endif diff --git a/src/lib/metadata/ametainfo.cpp b/src/lib/metadata/ametainfo.cpp new file mode 100644 index 0000000..f8d963e --- /dev/null +++ b/src/lib/metadata/ametainfo.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** $Id: ametainfo.cpp,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Code file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Grigory Panov , Yoshkar-Ola. +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include "ametainfo.h" + +/*! + * \class AMetaInfo + * + */ +AMetaInfo::AMetaInfo() +:AMetaObject("Info") +{ + setAppName("new"); + setAuthor("unknown"); + setDate( QDate::currentDate() ); + setLastId( 100 ); + +} + + +AMetaInfo::AMetaInfo( const AMetaInfo &info ) +:AMetaObject("Info") +{ +} + + +AMetaInfo::~AMetaInfo() +{ +} + + +AMetaInfo& +AMetaInfo::operator=(const AMetaInfo&) +{ + return *this; +} + + +QString +AMetaInfo::appName() +{ + return attr("name").toString(); +} + + +void +AMetaInfo::setAppName( const QString &name ) +{ + setAttr( "name", name ); +} + + +int +AMetaInfo::lastId() +{ + return attr( "lastid" ).toInt(); +} + + +void +AMetaInfo::setLastId( int id ) +{ + setAttr( "lastid", id ); +} + + +QString +AMetaInfo::author() +{ + return attr("author").toString(); +} + + +void +AMetaInfo::setAuthor( const QString &name ) +{ + setAttr( "author", name ); +} + + +QDate +AMetaInfo::date() +{ + return attr("date").toDate(); +} + + +void +AMetaInfo::setDate( QDate d ) +{ + setAttr( "date", d ); +} diff --git a/src/lib/metadata/ametainfo.h b/src/lib/metadata/ametainfo.h new file mode 100644 index 0000000..cc81698 --- /dev/null +++ b/src/lib/metadata/ametainfo.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** $Id: ametainfo.h,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Header file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Andrey Paskal , Yoshkar-Ola +** Copyright (C) 2003-2005 Grigory Panov , Yoshkar-Ola +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef AMETAINFO_H +#define AMETAINFO_H + +#include "ametaobject.h" + +class AMetaInfo: public AMetaObject +{ +Q_OBJECT +Q_PROPERTY( QString appname READ appName SCRIPTABLE true ) +Q_PROPERTY( QString author READ author SCRIPTABLE true ) +Q_PROPERTY( QDate date READ date SCRIPTABLE true ) +public: + AMetaInfo(); + AMetaInfo( const AMetaInfo &info ); + ~AMetaInfo(); + AMetaInfo& operator=(const AMetaInfo&); + + QString appName(); + void setAppName( const QString &name ); + int lastId(); + void setLastId( int id ); + QString author(); + void setAuthor( const QString &name ); + QDate date(); + void setDate( QDate d ); +}; + + +Q_DECLARE_METATYPE ( AMetaInfo ) + +//qRegisterMetaType("MetaDataInfo"); +//Q_DECLARE_METATYPE ( AMetaDataGlobal ) + + +#endif diff --git a/src/lib/metadata/ametainforegister.cpp b/src/lib/metadata/ametainforegister.cpp new file mode 100644 index 0000000..ada3ea5 --- /dev/null +++ b/src/lib/metadata/ametainforegister.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** $Id: ametainforegister.cpp,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Code file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Grigory Panov , Yoshkar-Ola. +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include "ametainforegister.h" + +/*! + * \class AMetaInfoRegister + * + */ +AMetaInfoRegister::AMetaInfoRegister( AMetaObject *parent ) +:AMetaObject("InfoRegister", "", parent ) +{ + setId( lastId() ); + setName( QString("%1_%2").arg( tr("InfoRegister") ).arg( id() ) ); + addChild( &v_fields ); + addChild( &v_gfields ); + addChild( &v_forms ); + +} + + +AMetaFields * +AMetaInfoRegister::fields() +{ + return &v_fields; +} + + + +AMetaFields * +AMetaInfoRegister::gfields() +{ + return &v_gfields; +} + + +AMetaForms * +AMetaInfoRegister::forms() +{ + return &v_forms; +} + + + +/*! + * \class AMetaInfoRegisters + * + */ +AMetaInfoRegisters::AMetaInfoRegisters() +:AMetaGroup("InfoRegisters") +{ + +} diff --git a/src/lib/metadata/ametainforegister.h b/src/lib/metadata/ametainforegister.h new file mode 100644 index 0000000..3a291e7 --- /dev/null +++ b/src/lib/metadata/ametainforegister.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** $Id: ametainforegister.h,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Header file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Andrey Paskal , Yoshkar-Ola +** Copyright (C) 2003-2005 Grigory Panov , Yoshkar-Ola +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef AMETAINFOREGISTER_H +#define AMETAINFOREGISTER_H + +#include "ametaobject.h" +#include "ametaobjectgroup.h" +#include "ametafield.h" +#include "ametaform.h" + + +class AMetaInfoRegister: public AMetaObject +{ +Q_OBJECT +public: + AMetaInfoRegister( AMetaObject *parent = 0 ); + +public slots: + AMetaFields *fields(); + AMetaFields *gfields(); + AMetaForms *forms(); + +private: + AMetaFields v_fields; + AMetaFields v_gfields; + AMetaForms v_forms; +}; + + + +class AMetaInfoRegisters: public AMetaGroup +{ +Q_OBJECT +public: + AMetaInfoRegisters(); + + AMetaInfoRegister *newInfoRegister(){ return new AMetaInfoRegister( this );}; + AMetaInfoRegister *infoReister( const QString &name ){ return (AMetaInfoRegister*) child( name );}; + AMetaInfoRegister *infoRegister( int idx ){ return (AMetaInfoRegister*) child( idx );}; + int infoRegisterCount(){ return childCount(); }; + +public slots: + + +}; + +#endif diff --git a/src/lib/metadata/ametajournal.cpp b/src/lib/metadata/ametajournal.cpp new file mode 100644 index 0000000..bba2cfb --- /dev/null +++ b/src/lib/metadata/ametajournal.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** $Id: ametajournal.cpp,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Code file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Grigory Panov , Yoshkar-Ola. +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include "ametajournal.h" + +/*! + * \class AMetaJournal + * + */ +AMetaJournal::AMetaJournal( AMetaObject *parent ) +:AMetaObject("Journal", "", parent ) +{ + setId( lastId() ); + setName( QString("%1_%2").arg( tr("Journal") ).arg( id() ) ); + addChild( &v_fields ); + addChild( &v_tables ); + addChild( &v_forms ); + +} + + +AMetaFields * +AMetaJournal::fields() +{ + return &v_fields; +} + + + +AMetaTables * +AMetaJournal::tables() +{ + return &v_tables; +} + + +AMetaForms * +AMetaJournal::forms() +{ + return &v_forms; +} + + + +/*! + * \class AMetaJournals + * + */ +AMetaJournals::AMetaJournals() +:AMetaGroup("Journals") +{ + +} + diff --git a/src/lib/metadata/ametajournal.h b/src/lib/metadata/ametajournal.h new file mode 100644 index 0000000..5dce392 --- /dev/null +++ b/src/lib/metadata/ametajournal.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** $Id: ametajournal.h,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Header file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Andrey Paskal , Yoshkar-Ola +** Copyright (C) 2003-2005 Grigory Panov , Yoshkar-Ola +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef AMETAJOURNAL_H +#define AMETAJOURNAL_H + +#include "ametaobject.h" +#include "ametaobjectgroup.h" +#include "ametafield.h" +#include "ametaform.h" + + +class AMetaJournal: public AMetaObject +{ +Q_OBJECT +public: + AMetaJournal( AMetaObject *parent = 0 ); + +public slots: + AMetaFields *fields(); + AMetaTables *tables(); + AMetaForms *forms(); + +private: + AMetaFields v_fields; + AMetaTables v_tables; + AMetaForms v_forms; +}; + + + +class AMetaJournals: public AMetaGroup +{ +Q_OBJECT +public: + AMetaJournals(); + + AMetaJournal *newJournal(){ return new AMetaJournal( this );}; + AMetaJournal *journal( const QString &name ){ return (AMetaJournal*) child( name );}; + AMetaJournal *journal( int idx ){ return (AMetaJournal*) child( idx );}; + int journalCount(){ return childCount(); }; + +public slots: + + +}; + +#endif diff --git a/src/lib/metadata/ametaobject.cpp b/src/lib/metadata/ametaobject.cpp index d4952de..71e539d 100644 --- a/src/lib/metadata/ametaobject.cpp +++ b/src/lib/metadata/ametaobject.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametaobject.cpp,v 1.5 2008/12/20 21:17:49 leader Exp $ +** $Id: ametaobject.cpp,v 1.7 2008/12/24 20:06:51 leader Exp $ ** ** Code file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -64,7 +64,6 @@ AMetaObject::AMetaObject(const QString &objectclass, setDescription(""); setId( 0 ); if ( parent ) parent->addChild( this ); -// if ( !this->inherits("AMetaObjectGroup") ) setId( lastId() ); } @@ -144,12 +143,14 @@ AMetaObject::setParentMetaObject( AMetaObject * parent ) QString AMetaObject::description() { +// return attr("description").toString(); return v_description; } void AMetaObject::setDescription( const QString &descr ) { +// setAttr( "description", descr ); v_description = descr; } @@ -271,131 +272,35 @@ AMetaObject::removeChild( AMetaObject * c ) } - -/*! - * \class AMetaCatalogue - * - */ -AMetaCatalogue::AMetaCatalogue() -:AMetaObject("Catalogue") -{ - setId( lastId() ); - setName( QString("%1_%2").arg( tr("Catalogue") ).arg( id() ) ); -} - - - -/*! - * \class AMetaDataInfo - * - */ -AMetaDataInfo::AMetaDataInfo() -:AMetaObject("Info") -{ - setAppName("new"); - setAuthor("unknown"); - setDate( QDate::currentDate() ); - setLastId( 100 ); - -} - - -AMetaDataInfo::AMetaDataInfo( const AMetaDataInfo &info ) -:AMetaObject("Info") -{ -} - - -AMetaDataInfo::~AMetaDataInfo() -{ -} - - -AMetaDataInfo& -AMetaDataInfo::operator=(const AMetaDataInfo&) -{ - return *this; -} - - -QString -AMetaDataInfo::appName() -{ - return attr("name").toString(); -} - - -void -AMetaDataInfo::setAppName( const QString &name ) -{ - setAttr( "name", name ); -} - - -int -AMetaDataInfo::lastId() +QString +AMetaObject::varToStr( QVariant v ) { - return attr( "lastid" ).toInt(); -} - - -void -AMetaDataInfo::setLastId( int id ) -{ - setAttr( "lastid", id ); -} - - -QString -AMetaDataInfo::author() -{ - return attr("author").toString(); -} - - -void -AMetaDataInfo::setAuthor( const QString &name ) -{ - setAttr( "author", name ); -} - - -QDate -AMetaDataInfo::date() -{ - return attr("date").toDate(); -} + QString s; - -void -AMetaDataInfo::setDate( QDate d ) -{ - setAttr( "date", d ); -} - - - -/*! - * \class AMetaDataGlobal - * - */ -AMetaDataGlobal::AMetaDataGlobal() -:AMetaObject("Global") -{ - setSourceCode("function on_systemstart()\n{\n}\n"); + switch ( v.type() ){ + case QVariant::ByteArray: + s = v.toByteArray().toHex(); + break; + default: + s = v.toString(); + } + return s; } -QString -AMetaDataGlobal::sourceCode() +QVariant +AMetaObject::strToVar( const QString &str, QVariant::Type t ) { - return attr("sourcecode").toString(); -} + QVariant v; - -void -AMetaDataGlobal::setSourceCode( const QString &src ) -{ - setAttr( "sourcecode", src ); + switch ( t ){ + case QVariant::ByteArray: + v = QByteArray::fromHex( str.toLatin1() ); + break; + default: + v = str; + } + if ( v.convert( t ) ) return v; + return QVariant(); } diff --git a/src/lib/metadata/ametaobject.h b/src/lib/metadata/ametaobject.h index 7499ea9..7114a32 100644 --- a/src/lib/metadata/ametaobject.h +++ b/src/lib/metadata/ametaobject.h @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametaobject.h,v 1.5 2008/12/20 21:17:49 leader Exp $ +** $Id: ametaobject.h,v 1.7 2008/12/24 20:06:51 leader Exp $ ** ** Header file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -87,8 +87,6 @@ public: bool attrExists( const QString &name ); int attrCount() const; - static int lastId(); - static void setLastId( int id ); int childCount(); AMetaObject *child( int idx ); @@ -96,6 +94,11 @@ public: void addChild( AMetaObject * c ); void removeChild( AMetaObject * c ); + static int lastId(); + static void setLastId( int id ); + static QString varToStr( QVariant v ); + static QVariant strToVar( const QString &str, QVariant::Type t ); + public slots: private: @@ -133,53 +136,4 @@ public: typedef AMetaGroupA AMetaGroupAXXX; - -class AMetaCatalogue: public AMetaObject -{ -Q_OBJECT -public: - AMetaCatalogue(); -}; - - - -class AMetaDataInfo: public AMetaObject -{ -Q_OBJECT -Q_PROPERTY( QString appname READ appName SCRIPTABLE true ) -Q_PROPERTY( QString author READ author SCRIPTABLE true ) -Q_PROPERTY( QDate date READ date SCRIPTABLE true ) -public: - AMetaDataInfo(); - AMetaDataInfo( const AMetaDataInfo &info ); - ~AMetaDataInfo(); - AMetaDataInfo& operator=(const AMetaDataInfo&); - - QString appName(); - void setAppName( const QString &name ); - int lastId(); - void setLastId( int id ); - QString author(); - void setAuthor( const QString &name ); - QDate date(); - void setDate( QDate d ); -}; - - -class AMetaDataGlobal: public AMetaObject -{ -Q_OBJECT -public: - AMetaDataGlobal(); - - QString sourceCode(); - void setSourceCode( const QString &src ); - -}; - -Q_DECLARE_METATYPE ( AMetaDataInfo ) - -//qRegisterMetaType("MetaDataInfo"); -//Q_DECLARE_METATYPE ( AMetaDataGlobal ) - #endif diff --git a/src/lib/metadata/ametaobjectgroup.cpp b/src/lib/metadata/ametaobjectgroup.cpp index a17128e..b4ed070 100644 --- a/src/lib/metadata/ametaobjectgroup.cpp +++ b/src/lib/metadata/ametaobjectgroup.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametaobjectgroup.cpp,v 1.4 2008/12/20 21:17:49 leader Exp $ +** $Id: ametaobjectgroup.cpp,v 1.5 2008/12/24 16:19:38 leader Exp $ ** ** Code file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -43,73 +43,6 @@ /*! - * \class AMetaGroup - * - */ - - - -/*! - * \class ACataloguesGroup - * - */ -ACataloguesGroup::ACataloguesGroup() -:AMetaGroup("Catalogues") -{ - -} - - - -/*! - * \class AReportsGroup - * - */ -AReportsGroup::AReportsGroup() -:AMetaGroup("Reports") -{ - -} - - - -/*! - * \class AReportsGroup - * - */ -AJournalsGroup::AJournalsGroup() -:AMetaGroup("Journals") -{ - -} - - - -/*! - * \class AInformationRegistersGroup - * - */ -AInfoRegistersGroup::AInfoRegistersGroup() -:AMetaGroup("InfoRegisters") -{ - -} - - - -/*! - * \class AInformationRegistersGroup - * - */ -AAccRegistersGroup::AAccRegistersGroup() -:AMetaGroup("AccRegisters") -{ - -} - - - -/*! * \class AMetaTables * */ diff --git a/src/lib/metadata/ametaobjectgroup.h b/src/lib/metadata/ametaobjectgroup.h index 6f26d46..d1e6463 100644 --- a/src/lib/metadata/ametaobjectgroup.h +++ b/src/lib/metadata/ametaobjectgroup.h @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: ametaobjectgroup.h,v 1.4 2008/12/20 21:17:49 leader Exp $ +** $Id: ametaobjectgroup.h,v 1.5 2008/12/24 16:19:38 leader Exp $ ** ** Header file of the Ananas configuration objects of Ananas ** Designer and Engine applications @@ -41,68 +41,6 @@ #include -class ACataloguesGroup: public AMetaGroup -{ -Q_OBJECT -public: - ACataloguesGroup(); - -public slots: - - -}; - - - -class AReportsGroup: public AMetaGroup -{ -Q_OBJECT -public: - AReportsGroup(); - -public slots: - - -}; - - - -class AJournalsGroup: public AMetaGroup -{ -Q_OBJECT -public: - AJournalsGroup(); - -public slots: - - -}; - - - -class AInfoRegistersGroup: public AMetaGroup -{ -Q_OBJECT -public: - AInfoRegistersGroup(); - -public slots: - - -}; - - - -class AAccRegistersGroup: public AMetaGroup -{ -Q_OBJECT -public: - AAccRegistersGroup(); - -public slots: - - -}; diff --git a/src/lib/metadata/ametareport.cpp b/src/lib/metadata/ametareport.cpp new file mode 100644 index 0000000..e044b1d --- /dev/null +++ b/src/lib/metadata/ametareport.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** $Id: ametareport.cpp,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Code file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Grigory Panov , Yoshkar-Ola. +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#include "ametareport.h" + +/*! + * \class AMetaReport + * + */ +AMetaReport::AMetaReport( AMetaObject *parent ) +:AMetaObject("Report", "", parent ) +{ + setId( lastId() ); + setName( QString("%1_%2").arg( tr("Report") ).arg( id() ) ); + addChild( &v_fields ); + addChild( &v_tables ); + addChild( &v_forms ); + +} + + +AMetaFields * +AMetaReport::fields() +{ + return &v_fields; +} + + + +AMetaTables * +AMetaReport::tables() +{ + return &v_tables; +} + + +AMetaForms * +AMetaReport::forms() +{ + return &v_forms; +} + + + +/*! + * \class AMetaReports + * + */ +AMetaReports::AMetaReports() +:AMetaGroup("Reports") +{ + +} + diff --git a/src/lib/metadata/ametareport.h b/src/lib/metadata/ametareport.h new file mode 100644 index 0000000..d21b9af --- /dev/null +++ b/src/lib/metadata/ametareport.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** $Id: ametareport.h,v 1.1 2008/12/24 16:19:38 leader Exp $ +** +** Header file of the Ananas configuration objects of Ananas +** Designer and Engine applications +** +** Created : 20031201 +** +** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. +** Copyright (C) Andrey Paskal , Yoshkar-Ola +** Copyright (C) 2003-2005 Grigory Panov , Yoshkar-Ola +** +** This file is part of the Library of the Ananas +** automation accounting system. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru +** See http://www.leaderit.ru/gpl/ for GPL licensing information. +** +** Contact org@leaderit.ru if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef AMETAREPORT_H +#define AMETAREPORT_H + +#include "ametaobject.h" +#include "ametaobjectgroup.h" +#include "ametafield.h" +#include "ametaform.h" + + +class AMetaReport: public AMetaObject +{ +Q_OBJECT +public: + AMetaReport( AMetaObject *parent = 0 ); + +public slots: + AMetaFields *fields(); + AMetaTables *tables(); + AMetaForms *forms(); + +private: + AMetaFields v_fields; + AMetaTables v_tables; + AMetaForms v_forms; +}; + + + +class AMetaReports: public AMetaGroup +{ +Q_OBJECT +public: + AMetaReports(); + + AMetaReport *newReport(){ return new AMetaReport( this );}; + AMetaReport *report( const QString &name ){ return (AMetaReport*) child( name );}; + AMetaReport *report( int idx ){ return (AMetaReport*) child( idx );}; + int reportCount(){ return childCount(); }; + +public slots: + + +}; + +#endif diff --git a/src/lib/metadata/metadata.pri b/src/lib/metadata/metadata.pri index d914a90..7dc7971 100644 --- a/src/lib/metadata/metadata.pri +++ b/src/lib/metadata/metadata.pri @@ -3,7 +3,14 @@ HEADERS += \ metadata/ametaobject.h \ metadata/ametaobjectgroup.h \ metadata/ametafield.h \ + metadata/ametainfo.h \ + metadata/ametaglobal.h \ metadata/ametadocument.h \ + metadata/ametacatalogue.h \ + metadata/ametainforegister.h \ + metadata/ametaaccregister.h \ + metadata/ametareport.h \ + metadata/ametajournal.h \ metadata/ametaform.h \ metadata/ametadataio.h \ metadata/ametadataioxml.h @@ -13,7 +20,14 @@ SOURCES += \ metadata/ametaobject.cpp \ metadata/ametaobjectgroup.cpp \ metadata/ametafield.cpp \ + metadata/ametainfo.cpp \ + metadata/ametaglobal.cpp \ metadata/ametadocument.cpp \ + metadata/ametacatalogue.cpp \ + metadata/ametainforegister.cpp \ + metadata/ametaaccregister.cpp \ + metadata/ametareport.cpp \ + metadata/ametajournal.cpp \ metadata/ametaform.cpp \ metadata/ametadataio.cpp \ metadata/ametadataioxml.cpp diff --git a/src/lib/sys/aapplication.cpp b/src/lib/sys/aapplication.cpp index 2e064c2..a7634e8 100644 --- a/src/lib/sys/aapplication.cpp +++ b/src/lib/sys/aapplication.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: aapplication.cpp,v 1.1 2008/11/09 21:08:09 leader Exp $ +** $Id: aapplication.cpp,v 1.3 2008/12/25 19:10:21 leader Exp $ ** ** Code file of the Ananas Library of Ananas ** Designer and Engine applications @@ -30,12 +30,14 @@ #include "aapplication.h" #include "dselectdb.h" #include "dlogin.h" +#include "QTextCodec" AApplication::AApplication( int & argc, char ** argv, AApplicationType aat ) :QApplication( argc, argv, true ) { v_aat = aat; + printf("langDir = %s\n", langDir().toUtf8().data() ); } int @@ -44,3 +46,33 @@ AApplication::applicationType() return v_aat; } + +QString +AApplication::applicationName() +{ + char *appN[] = {"unknown","ananas","designer","administrator","srv"}; + return QString(appN[v_aat]); +} + + +QString +AApplication::langDir() +{ +#ifdef _Windows + return applicationDirPath()+"/"; +#else + return "/usr/share/ananas4/translations/"; +#endif +} + + +QString +AApplication::lang() +{ + char *s, locale[50]="en"; + + strncpy( locale, QTextCodec::locale(), sizeof( locale ) ); + s = strchr( locale, '_' ); + if ( s ) *s = 0; + return QString( locale ); +} diff --git a/src/lib/sys/aapplication.h b/src/lib/sys/aapplication.h index 65a533f..fe1334f 100644 --- a/src/lib/sys/aapplication.h +++ b/src/lib/sys/aapplication.h @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: aapplication.h,v 1.2 2008/11/21 20:58:12 leader Exp $ +** $Id: aapplication.h,v 1.3 2008/12/25 19:08:03 leader Exp $ ** ** Header file of the Ananas Library of Ananas ** Designer and Engine applications @@ -47,6 +47,9 @@ public: AApplication( int & argc, char ** argv, AApplicationType aat = Unknown ); int applicationType(); + QString applicationName(); + QString langDir(); + QString lang(); private: int v_aat; diff --git a/src/plugins/engine.cpp b/src/plugins/engine.cpp index d094e09..3ee23e6 100644 --- a/src/plugins/engine.cpp +++ b/src/plugins/engine.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: engine.cpp,v 1.5 2008/12/23 20:15:32 leader Exp $ +** $Id: engine.cpp,v 1.6 2008/12/24 17:47:41 leader Exp $ ** ** Code file of the Ananas Engine of Ananas ** Engine applications @@ -81,10 +81,10 @@ aObjectsFactory::aObjectsFactory( aEngine *e ) registerClass("MetaObject",&AMetaObject::staticMetaObject); registerClass("MetaGroup",&AMetaGroup::staticMetaObject); - registerClass("DocumentsGroup",&ADocumentsGroup::staticMetaObject); - registerClass("CataloguesGroup",&ACataloguesGroup::staticMetaObject); - registerClass("MetaDataInfo",&AMetaDataInfo::staticMetaObject); - registerClass("MetaDataGlobal",&AMetaDataGlobal::staticMetaObject); + registerClass("Documents",&AMetaDocuments::staticMetaObject); + registerClass("Catalogues",&AMetaCatalogues::staticMetaObject); + registerClass("MetaInfo",&AMetaInfo::staticMetaObject); + registerClass("MetaGlobal",&AMetaGlobal::staticMetaObject); registerClass("PopupMenu",&Q3PopupMenu::staticMetaObject); diff --git a/src/test/testametadata.cpp b/src/test/testametadata.cpp index 64a0ed1..9560395 100644 --- a/src/test/testametadata.cpp +++ b/src/test/testametadata.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -** $Id: testametadata.cpp,v 1.8 2008/12/20 21:17:49 leader Exp $ +** $Id: testametadata.cpp,v 1.9 2008/12/24 20:06:51 leader Exp $ ** ** Tool for automatic running Ananas tests ** @@ -174,12 +174,17 @@ void TestAMetaData::testAMetaDataIOXML() { AMetaDataIOXML *o = new AMetaDataIOXML(); QString xml; + char c[]={0,1,2,3,4,5,6,7,8,9,10,'1','2','3','4','5','6','7','8','9','0'}; AMetaData *md = AMetaData::metadata(); AMetaDocument *d = md->documents()->newDocument(); AMetaField *f; + AMetaForm *form; f = d->fields()->newField(); f = d->fields()->newField(); + form = d->forms()->newForm(); +// form->setDialogue( QByteArray("1234567890\000\001\002\003\004\005\006\007\010\011\012") ); + form->setDialogue( QByteArray( c, sizeof(c) ) ); // delete d; QCOMPARE( o->write("test.cfg"), 0 );