# HG changeset patch # User viric@llimona # Date 1147986301 -7200 # Node ID 04114bce8fd06f6dff1c9c7a3d3c12d279920453 Initial from sourceforge's cvs. diff -r 000000000000 -r 04114bce8fd0 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,3 @@ +^yagl$ +^html/ +^Makefile$ diff -r 000000000000 -r 04114bce8fd0 AUTHORS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AUTHORS Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,1 @@ +Lluís Batlle i Rossell diff -r 000000000000 -r 04114bce8fd0 ChangeLog --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ChangeLog Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,3 @@ + +-- 23/08/2003 -- viric +* Added MDI workspace diff -r 000000000000 -r 04114bce8fd0 Doxyfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Doxyfile Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,204 @@ +# Doxyfile 1.3 + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = yagl +PROJECT_NUMBER = 1 +OUTPUT_DIRECTORY = +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +BRIEF_MEMBER_DESC = NO +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +SHORT_NAMES = NO +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ALIASES = +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +SHOW_USED_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = src +FILE_PATTERNS = +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 2 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = doxygen/html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_SCHEMA = +XML_DTD = +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO +CGI_NAME = search.cgi +CGI_URL = +DOC_URL = +DOC_ABSPATH = +BIN_ABSPATH = /usr/local/bin/ +EXT_DOC_PATHS = diff -r 000000000000 -r 04114bce8fd0 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,26 @@ += WHAT'S YAGL? = + +yagl stands for Yet Another GUI Ledger. It's an accounting program. + + += INSTALLATION = + +To run the program, just follow these steps under a sh shell: + +$ qmake +$ make + +and then you'll get the final binary: "yagl", in this directory. + + += DATABASE = + +You need the database structure inside some kind of DBMS (MySQL for example). +The tables are inside sql/ directory from the root of yagl. + + += REQUIREMENTS = + +- QT Libs 3.1.2 +- gnu make +- gcc diff -r 000000000000 -r 04114bce8fd0 TODO --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TODO Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,8 @@ +General +* Fer form de quadre de comptes +* Fer form d'assentaments +* Idear combo-boxes de taules relacionades amb les comptes (nou widget) + +DB +* Que l'entrada de menú Conexió/Desconnexió es posin en gris segons calgui. + * Per fer això, cal fer el menú amb Actions. diff -r 000000000000 -r 04114bce8fd0 doc/ENGLISH_TERMS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/ENGLISH_TERMS Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,12 @@ +Els termes apareixen en dues columnes separades per un tabulador: +Si modifiqueu la mida del tabulador (30 espais per exemple), veureu les taules +bé. + +Català Anglès +---------------- ----------------- +Assentament Transaction +Moviment Movement +Compte Account +Quadre de comptes Chart of Accounts +Comptabilitat Accounting +Comptable Accountant, Ledger diff -r 000000000000 -r 04114bce8fd0 doc/GaladrielCodingStyle.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/GaladrielCodingStyle.txt Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,303 @@ + Galadriel coding style + + Lluís Batlle i Rossell + viric@vicerveza.homeunix.net + + Iniciat el 11/08/2003 + + +Aquest és un petit document que descriu l'estil d'escriptura de codi pel +projecte Galadriel. L'estil d'escriptura és molt personal, i no s'han de forçar +aquestes idees sobre ningú, però ja que és una cosa que hem de mantenir entre +tots, seria bo que l'estil no ens dificultés aquesta feina. Així que, si més no, +tingueu en compte els punts que aquí es mencionen. + +Aquest document no està ni revisat ni acabat. En alguns llocs hi ha comentaris +de la forma (MAJUSCULES ?!), que significa que no sé què posar-hi, i algú de +vosaltres segur que ho sabrà millor i abans que jo. + +Aquest document també està molt influenciat per la guia de Linus Torvalds: +"Linux kernel coding style". El google us donarà la referència a aquest escrit. + +Espero comentaris ben aviat... + + + 1. Indentació (sagnat) + +Els tabuladors estan pensats per ser d'una longitud de 8 caràcters. Si volem +respectar a la resta de món, aquest és l'esquema que hauriem de seguir. Però +segur que s'aixecarà protestant molta gent si pretenem tabulacions d'aquesta +mida. Això és perquè molta gent troba excessius 8 caràcters per a indentar; bé, +indentar serveix per diferenciar quan comença i acaba un bloc de control, així +que si fem indentacions grans diferenciarem molt més aquests blocs, sobretot +quan alguns de nosaltres portem més de 15 hores davant de codi. + +Molts direu, tot i això, que 8 caràcters és una indentació massa gran, i que +mouen el codi massa cap a la dreta... bé, tal com diu el senyor Torvalds, "if +you need more than 3 levels of indentation, you're screwed anyway, and should +fix your program". Això vol dir que utilitzar 8 caràcters també ens dóna una +idea de quant bo és el nostre codi. + +Fer servir tabuladors de menys de 8 caràcters també porta problemes entre +editors... sobretot per discernir quan s'indenta amb tabuladors o bé amb espais. + +De tota manera, podem justificar l'ús d'indentacions més petites perquè no és el +mateix escriure en C++ que amb C; sembla una excusa, però és amb l'únic que ens +podem recolzar. Queda doncs establert, tal com es va decidir a l'explicació d'en +Shadow el dissabte, que s'utilitzarà indentació amb espais de 3 caràcters. + + + 2. Ample de pantalla + +Molts utilitzem GUIs per escriure el nostre codi, i el fet d'estar allunyat de +l'antic mode de 80x25, tenir resolucions més grans i fonts més petites ens ha +permès arribar a pantalles de 170x60. De tota manera, tot i que ens pensem que +la majoria de gent ja utilitza resolucions superiors a 1024x768, no és bo +imposar als programadors la nostra manera d'escriure codi. Encara són molts els +que programen en 80x25, més que res perquè són les dimensions dels terminals més +comuns. Són amb la que els terminals VT servien les lletres més grans +(ideals per programadors cansats), les que ens dóna la BIOS abans de l'arrencada +del sistema, i la de la majoria d'emuladors de terminal de X. A més a més, +facilita molt el tenir diferents porcions de codi a la pantalla alhora. I donat +que suposem que tothom disposa de monitors de diagonal poc superior a 14", les +mides de caràcter no són massa petites per passar llargues hores davant la +pantalla. + + + 3. Claus {} + +Un altre assumpte que sol portar confusions i incomoditats només perquè hi ha +diferents estils d'escriptura de codi és la col·locació de les claus d'inici i +fi de bloc. Seguint les indicacions de Kernighan i Ritchie, l'estil preferit és +el de posar la clau d'obertura a final de línia, i la de tancament indentada a +la mateixa columna que el que ha iniciat el bloc: + + if (x == 1) { + printf("Hola"); + } + +Tot i això hi ha un cas especial, les funcions. Tenen la clau d'obertura a +l'inici de la següent línia, així: + + int funcio(int x) + { + return 2*x; + } + +A molts no ens agrada aquesta aquesta inconsistència, però té una justificació: +les funcions no es poden aniuar. El fet d'utilitzar sempre l'obertura de clau a +la pròxima línia també fa que en aquesta línia no hi hagi res més escrit mai, i +porta a problemes de lectura, com en els casos: + + do + { + printf( "%i\n", i ); + } + while( i < 10 ); + +o bé, + + if( i > 10 ) + { + printf( "i gran\n" ); + } + else + { + printf( "i petita\n" ); + } + +coses que evidentment queden molt més clares així: + + do { + printf( "%i\n", i ); + } while( i < 10 ); + +o bé + + if( i > 10 ) { + printf( "i gran\n" ); + } else { + printf( "i petita\n" ); + } + +El més important és que no quedin línies buides, ja que hem de pensar en les 25 +línies, a part de les 80 columnes. Al deixar menys línies buides permet +reaprofitar aquestes línies de pantalla que no perdem per a afegir comentaris. + + + 4. Espaiat d'expressions + +Les expressions poden arribar a ser molt críptiques si no estan ben espaiades (o +gens). Per tant, adoptarem la regla general de posar un espai entre cada valor +(immediat o variable) i el seu operador binari, i no posar cap espai entre un +operador unari i el valor a què afecta. Si les variables no fan servir caràcters +més enllà dels alfanumèrics, això no hauria de suposar cap problema de lectura. + +El pas de paràmetres en una crida a una funció, així com a la seva definició, es +farà enganxant el parèntesi d'obertura al nom de la funció, i els paràmetres el +seguiran començant amb un espai de separació entre aquest parèntesi i el primer, +i els següents aniran succeint com si d'un text redactat es tractés. Entre +l'últim paràmetre i el parèntesi de tancament hi haurà, com en l'obertura, un +espai de separació. + +En el cas de no haver-hi paràmetres, podem utilitzar () enganxat al nom de la +funció. + + + 5. Definició de variables + +Alguns caràcters especials defineixen variables com a punters o referències als +tipus de dades amb què les declarem. Considerarem que aquests caràcters no són +operadors unaris, i són una dada més alhora de definir el paràmetre. Per tant, +s'escriuran un espai després del tipus de dades a què apunten o referencien, i +separats tans espais com calgui del nom de la variable (en el cas que alineem +definicions). Això s'aplicarà tan al cos de les funcions com a la declaració +dels seus paràmetres o valors de retorn. + + + 6. Nomenclatura + +Queda clar que totes les funcions i variables han de tenir noms clarament +descriptius. Això sol implicar que aquests noms estiguin composats de més d'una +paraula. Seguint l'estil dels de QT, utilitzarem la tècnica de que les paraules +que composen el nom d'una class comencen totes amb majúscula (Amb una G +majúscula de Galadriel a davant en el codi del kernel). Els mètodes +s'escriuran igual que les classes, però amb la lletra de la primera paraula en +minúscula. Les variables, igual que els mètodes (moltes vegades, en programació +a objectes, no sabem si referenciem a mètodes o a variables. Això ha de +mantenir-se transparent). + + class Tree + { + int * firstLeaf; + + public: + void addLeaf(); + }; + +En el cas de parlar de comptadors o altres estructures de codi en què l'ús de +les variables queda molt clar, podem utilitzar variables d'una sola lletra (i, +j, k, ...), preferiblement comptant per la i i sempre en minúscula. + +En implementar algoritmes matemàtics també podem utilitzar variables d'una sola +lletra sempre i quan hi hagi un extens comentari amb el codi expressat +matemàticament. + + + 7. Classes i estructures + +Entenem l'idea de Classe amb C++ com a una definició d'objectes que conté +variables i -indispensablement- mètodes. Si ens trobem davant del típic ús de C +d'una 'struct', ho declararem com a 'struct'. Queda despreciada l'estructura: + + class MyClass + { + public: + int a; + int b; + int * c; + } + +Evidentment, només utilitzarem aquest concepte d'estructura si la idea d'una +"classe amb els seus mètodes" fa complicat l'ús d'aquestes dades. També hem de +preveure si farà o no falta una futura encapsulació; en aquest cas declararem +una classe amb mètodes senzills. + +El tipus de definicions (public, protected o private, així com slots i signals) +es faran al nivell d'indentació de la funció, ja que la indentació serveix per +indicar 'blocs', i això és el que volem aquí. Podem utilitzar vàris entorns de +public, protected o private per afegir claredat a la definició de la classe, +utilitzant-los de separadors en les definicions de membres. + +Quan declarem una classe també espaiarem el nom de la classe, els +dobles dos punts i el nom del mètode. Igualment amb l'herència en la definició +de classes i en la crida a constructors de la mare. + + + 8. Mètodes senzills + +És fàcil trobar-nos amb mètodes (i sobretot constructors) que simplement +assignen els valors dels paràmetres a variables privades de la classe. Per +evitar codi redundant, utilitzarem el mètode ja disponible en C i que s'ha +arrossegat fins a la crida de constructors de classes mare. Així que +utilitzarem: + + void MyClass :: Constructor( int _myVar ) + : mother( _myVar ), classVar( _myVar ), + { + //.... codi (si cal!).... + } + +Aquestes declaracions es poden fer fins i tot (preferiblement) -inline- dins +la definició de la classe. + +La nomenclatura dels paràmetres de mètodes d'aquest tipus es farà utilitzant +exactament el mateix nom que la variable interna, fet amb què s'evitarà +utilitzar caràcters no alfanumèrics en la definició de variables (o altres +invents) i s'aconseguirà l'ús de l'estructura anterior. En qualsevol altre cas, +s'utilitzaran recursos de 'namespace' per diferenciarles (que és el que realment +fem mentalment quan llegim codi que no compleix això). + + + 9. Funcions + +Igual que amb l'indentació, hem d'evitar les funcions amb molts de paràmetres, +ja que la definició i les crides ocuparien moltes columnes. +Això significa que la funció és molt complexa; s'ha de derivar en funcions més +senzilles. Qualsevol ha de poder entendre una funció pel seu nom, i qualsevol +funció ha de ser prou senzilla com per ser reutilitzada al màxim. En casos en +què necessitem un codi molt ràpid, podem demanar al compilador que ens posi les +funcions 'inline'. + +Una funció ha de ser prou senzilla com per tenir poques variables locals. Masses +variables locals indiquen que estem fent una funció que fa masses coses. Hem de +tenir en compte que una funció és una cosa que el nostre cap ha de poder +entendre al 100% en un mateix instant; no val a haver d'entendre el codi d'una +funció per parts. El límit de variables locals el posa el nostre cervell. +A més, sempre ens ho hem d'imaginar amb la perspectiva amb què veiem un codi fet +fa dues setmanes, no amb la del moment d'escriure'l. + + + 10. Comentaris + +És molt bo que hi hi hagi comentaris en el que escrivim, sobretot per +ajudar-nos a entendre què fa un tall de codi. Això és molt important si volem +agafar una idea de com resol un problema una funció, sense haver d'entendre al +100% com ho fa. + +És molt típic el problema de posar més comentaris del compte, sobretot en +programadors novells. Només s'ha de tenir en compte una regla: no expliqueu COM +resol el problema el vostre tall de codi. Simplement expliqueu QUÈ resol, o fins +i tot doneu una referència a un mètode conegut. Però sobretot, no expliqueu mai +COM ho feu. El codi ha de ser prou bo com perquè el que vulgui saber COM es fa, +ho entengui llegint-lo. + +(MANIES DE FER LLARGS SEPARADORS HORITZONTALS ENTRE COSES !? ) +(CAPÇALERES DE FITXERS, GPL, ... ) + + + 11. Definicions i doxygen + +Tots els comentaris del doxygen (així com els comentaris de mètodes, variables, +funcions, classes i enumeracions) estaran a les definicions o prototipus. +Aquests seran els més restrictius; inclouran els paràmetres per defecte, i +altres informacions sobre les funcions: virtuals, estàtiques, constants... + +Tots els mètodes que siguin correctes en un objecte constant, ho indicaran. Les +definicions dels que siguin reimplementables en herència, indicaran virtualitat. +I les que no depenguin de les dades, indicaran estàtica. + +(EXPLICIT ?) + +Tots els mètodes i variables que puguin ser utilitzats en herència, seran +declarats sota 'protected' en comptes de 'private' +(possiblement serà en la majoria de casos). + + + 12. Encoding + +Tot el codi que escrivim ha d'estar en ASCII. +Això significa oblidar els accents i caràcters per l'estil. De tota manera, de +moment podem ser menys restrictius en els comentaris i les sortides de texte; en +aquest cas utilitzarem ISO-8859-1 (aka Latin1), i totes les sortides de texte +aniran dins del pertinent mètode estàtic 'tr' de QObject (mirar docs de QT). diff -r 000000000000 -r 04114bce8fd0 doc/KNOWLEDGE_BASE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/KNOWLEDGE_BASE Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,194 @@ + + Base de coneixement per desenvolupar YAGL + ----------------------------------------- + + Lluís Batlle i Rossell + viric@users.sourceforge.net + + Iniciat el 12/08/2003 + + + 1. Introducció als conceptes que hi ha al voltant de la comptabilitat + +Els programes de comptabilitat serveixen perquè la gent pugui treure conclusions +del funcionament de l'empresa a partir de dades que introdueix el comptable. + +Aquestes dades tenen forma d'assentaments, i fan referència als moviments de +diners que fan referència a l'empresa: compres, vendes, inversions, crèdits, ... + +En un moviment de diners hi ha un origen i un destí; aquests es localitzen en el +que anomenem "comptes". Els comptes són entitats que poden donar i rebre diners, +i estan catalogats en quatre tipus: Actiu, Passiu, Ingressos i Despeses. Això +significa que els origens i els destins dels diners han de ser per força +d'aquests quatre tipus. + +Un assentament fa referència a un conjunt de moviments concret i quadrat. Això +vol dir que tots els diners que algunes comptes dónen han d'anar a parar +íntegrament a altres comptes. Per exemple, en un assentament el compte de +"clients" pot donar diners a "ventes" i a "IVA". +Els diners que "clients" dóna representen deutes de clients. Quan els clients +ens paguin, tindrem que + +Hi ha el que s'anomenen 'subcomptes' que són comptes fets pel comptable que +l'ajuden a tenir més diferenciats els moviments. Això es sol fer per obtenir +conclusions sobre elements més particulars, i per a tenir valors precalculats. +Per exemple, si tenim subcomptes d'IVA per cada percentatge aplicat, podem +calcular els valors a presentar en un informe d'IVA. + + + 2. Dades poc utilitzades + +Molts programes de comptabilitat permeten vincular subcomptes de clients a dades +de persones o empreses. Això només és pels que utilitzen el programa de +comptabilitat com a base de dades de clients; no te res a veure amb informes que +es puguin generar. + +El mateix passa amb els proveidors. + +Les dades de l'empresa a qui portem els comptes són més importants, però només +es necessiten pels informes + + + 3. Informació a guardar + + + 3.1 Comptes + +Els comptes es divideixen, segons el Pla General Comptable, en Grups, Subgrups i +Comptes, a més d'alguns casos on apareixen Subcomptes. Cada un s'identifica per +1, 2, 3 i 4 dígits respectivament. A més, com que és una estructura d'arbre, en +un subcompte de 4 dígits, els tres primers coincidiran amb els del compte a què +pertany, i així també amb els subgrups i els grups. + +Seguint aquesta regla, podem tenir subcomptes de tants de dígits com volem. Es +solen fer subcomptes personals de vuit dígits, donant marge per exemple fins a +100000 clients. +Alguns programes de comptabilitat assumeixen que la compta 1 és la mateixa que +la 10, i també la mateixa que la 100... i no tenen en compte els aniuaments que +hi ha (la 10 és el conjunt de totes les que comencen amb 10, i això és diferent +que la 100). Suposo que tenen tots els grups i subgrups "hardcoded"; de fet, no +són programes massa flexibles. + +Cada compte pot ser de quatre tipus, com hem dit abans. És el que anomenarem +categoria. A més, cada compte té una descripció associada. També podem mantenir +un camp anomenat "link" (idea del SQL-Ledger) que ens permeti vincular cada +compta a diferents tipus de quadres de diàleg; quan tinguem assentaments +tipificats (compres amb IVA, vendes, ...), ens indicarà en quins tipus +d'assentaments té a veure cada compte. + + + 3.2 Assentaments + +Cada assentament està composat per diferents moviments, cadascun referint-se a +un compte únic en aquell assentament (CERT?). Un assentament té a veure amb un +tipus d'intercanvi de bens, i per tant un assentament té un "Concepte" +associat. Podem fins i tot tenir un camp de "Document" que ens indiqui a quin +document fa referència l'assentament (Factura, ...). Tot això podria estar de +tota manera inclòs en el concepte. + +Si pensem implementar cerques per "concepte" sèries, podriem separar-ho i tenir +els camps "Tipus de document" (ComboBox) i "Número de document". Fins i tot +podem guardar la "Data del document". + +La "data" de l'assentament és important per situar l'intercanvi de bens en +el temps. Segurament serà igual que la data del document. + + + 3.3 Moviments + +Un moviment es fa en una compta, i està vinculat a un assentament. No sol tenir +cap camp de concepte o descripció, ja que un moviment per si sol no té massa +valor. L'entitat que representa un canvi de bens és l'assentament. + +De tota manera ens pot interessar tenir els moviments guardats en el mateix +ordre que van ser entrats; així faria falta un camp de "index". +Podem tenir una clau primària múltiple (ES DIU AIXÍ?) aquí, que sigui per +assentament i número de compta. Sempre i quan sigui cert que en un sol +assentament només hi pot haver un moviment com a màxim per cada compta. Això +permetria no haver de tenir una clau primària autonumèrica, i ajudaria molt als +motors de bases de dades. + + + 4. Diagrama Entitat-Relació bàsic + ++-----+ 1 N +---------+ N 1 +------------+ +|chart|---<>---|movements|---<>---|transactions| ++-----+ +---------+ +------------+ + | | | +/-----------\ /-----------\ /----------\ +|account_num| |trans_ID | | ID | +\-----------/ |account_num| \----------/ + \-----------/ + +La traducció dels termes de comptabilitat està al fitxer ENGLISH_TERMS. + + + 5. Informes a generar + + + 5.1. Balanç de saldos + +El que corre més pressa és el balanç de saldos. Això vol dir calcular el Deure, +l'Haver i la seva diferència per cada compta, i mostrar-ho en una taula. És dels +més senzills que haurem de generar. + + 5.2. Balanç de guanys + +Ens indica la diferència entre ingressos i despeses. Simplement és la diferència +entre el grup d'ingressos i el de despeses. + + 5.3. Balanç de situació + +Aquest és un document més complexe... la llei catalana/espanyola suggereix dos +tipus de balanços de situació: el normal i el reduit. Els dos inclouen totes les +comptes d'actiu i passiu de forma diferenciada, i les seves línies no estan +composades per les "comptes", sinó per conjunts de comptes amb un nom concret. + +Els càlculs de les diferents parts del balanç s'obtenen mitjançant sumes dels +conjunts anomenats... per tant, o tenim un bon disseny de base de dades (una +taula nova que vinculi els conjunts de comptes a els comptes), o bé tenim una +configuració de l'informe de balanç en XML on ens ajudem del QSA. + +Els ingressos o despeses són necessàries per quadrar el balanç de situació. + + + 6. Primers passos al GUI + +El primer que hem de poder fer és modificar el quadre de comptes. Llavors, poder +insertar/modificar/eliminar assentaments. D'alguna manera (al quadre de comptes +mateix) hauriem de poder llistar els "haver" i "deure" de cada compta. + +Més endavant, haurem de generar un informe de balanç de saldos. Aquí entrarà la +part XML per primera vegada. Un cop tinguem això, podem continuar per afegir +nous informes / noves funcionalitats. Tot tinguent en compte la portabilitat a +altres llengües / països. + + + 7. Eines + +Tot es programarà en C++, utilitzant les QT a l'extrem; hem d'aprofitar-les al +màxim. Això significa cedir feina als de Trolltech; com menys feina tinguem +millor. + +El motor de base de dades de prova serà MySQL, ja que és el que sol venir +compilat per defecte amb les QT. Si volem portabilitat de DBMS, només hauriem de +fer servir les funcions de Relational DBMS; si ens vinculem als objectes de +PostgreSQL només podrem utilitzar aquest o Oracle, i de moment sembla que no és +pas millor que anar amb taules relacionades. + + + 8. Primers passos de disseny i programació + +Primer de tot s'ha d'elaborar i aprovar el disseny de la base de dades. Llavors, +construir les taules amb SQL (creant fitxers amb codi SQL que ens faci aquesta +feina, de moment). + +Llavors, decidir el disseny del GUI. Més endavant un diagrama de classes, i +posteriorment començar a implementar un cop ens haguem repartit la feina. + +De moment, s'aplicaran les normes d'escriptura de codi de Galadriel Parts +(GaladrielCodingStyle.txt). + +S'ha de pensar com guardarem diferents empreses.... altres programes ho solen +fer en diferents bases de dades. Cada una té les seves taules. Així sembla que +és la millor idea. diff -r 000000000000 -r 04114bce8fd0 doxygen/html/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/.cvsignore Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,1 @@ +* diff -r 000000000000 -r 04114bce8fd0 doxygen/html/annotated.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/annotated.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,21 @@ + + +Annotated Index + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

yagl Compound List

Here are the classes, structs, unions and interfaces with brief descriptions: + + + + + +
DBConfigureForm
InfoLabel
InputCombo
InputField
MainPanel
+
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/chartwindow_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/chartwindow_8h-source.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,34 @@ + + +chartwindow.h Source File + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

chartwindow.h

00001 #ifndef CHARTWINDOW_H
+00002 #define CHARTWINDOW_H
+00003 
+00004 
+00005 #include <qmainwindow.h>
+00006 
+00007 class QListView;
+00008 
+00011 class ChartWindow : public QMainWindow
+00012 {
+00013 
+00014 private: // Variables
+00015         QListView       *accountsList;
+00016 
+00017 public:
+00018         ChartWindow(QWidget *parent = 0, const char *name = 0);
+00019         ~ChartWindow();
+00020 };
+00021 
+00022 #endif //CHARTWINDOW_H
+

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classDBConfigureForm-members.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classDBConfigureForm-members.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,20 @@ + + +Member List + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

DBConfigureForm Member List

This is the complete list of members for DBConfigureForm, including all inherited members. + + + + + +
acceptChanges()DBConfigureForm [slot]
DBConfigureForm(Tdb_config *mydbconfig, QWidget *parent=0, const char *name=0)DBConfigureForm
setFormChanged()DBConfigureForm [slot]
setFormNoChanged()DBConfigureForm [slot]
updateVariables()DBConfigureForm [slot]

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classDBConfigureForm.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classDBConfigureForm.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,196 @@ + + +DBConfigureForm class Reference + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

DBConfigureForm Class Reference

#include <dbconfigureform.h> +

+List of all members. + + + + + + + +

Public Slots

void acceptChanges ()
int updateVariables ()
void setFormChanged ()
void setFormNoChanged ()

Public Methods

 DBConfigureForm (Tdb_config *mydbconfig, QWidget *parent=0, const char *name=0)
+


Detailed Description

+DataBase configuration form, which asks for enough information to connect to a database. The information is stored in a structure given in the constructor.
+See also:
+DBConfigureForm()
+

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
DBConfigureForm::DBConfigureForm Tdb_config *   mydbconfig,
QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs the configuration form using mydbconfig for storing the form values.

+Parameters:
+ + +
mydbconfig  +The structure used to store the database information
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
void DBConfigureForm::acceptChanges   [slot]
+
+ + + + + +
+   + + +

+Accept the changes made in the form. It also closes the dialog.

+

+ + + + +
+ + + + + + + + + +
void DBConfigureForm::setFormChanged   [slot]
+
+ + + + + +
+   + + +

+Sets the state of the Apply button to Enabled

+

+ + + + +
+ + + + + + + + + +
void DBConfigureForm::setFormNoChanged   [slot]
+
+ + + + + +
+   + + +

+Sets the state of the Apply button to Disabled

+

+ + + + +
+ + + + + + + + + +
int DBConfigureForm::updateVariables   [slot]
+
+ + + + + +
+   + + +

+Updates the contents of the db_config structure using the actual values of the input fields Returns 0 if no error, error happened otherwise.

+


The documentation for this class was generated from the following files: +
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classInfoLabel-members.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classInfoLabel-members.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,22 @@ + + +Member List + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

InfoLabel Member List

This is the complete list of members for InfoLabel, including all inherited members. + + + + + + + +
InfoLabel(QWidget *parent=0, const char *name=0)InfoLabel
InfoLabel(const QString &mytitle, QWidget *parent=0, const char *name=0)InfoLabel
InfoLabel(const QString &mytitle, const QString &myvalue, QWidget *parent=0, const char *name=0)InfoLabel
setTitle(const QString &str)InfoLabel [slot]
setValue(const QString &str)InfoLabel [slot]
title() constInfoLabel
value() constInfoLabel

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classInfoLabel.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classInfoLabel.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,296 @@ + + +InfoLabel class Reference + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

InfoLabel Class Reference

#include <infolabel.h> +

+List of all members. + + + + + + + + + +

Public Slots

void setTitle (const QString &str)
void setValue (const QString &str)

Public Methods

 InfoLabel (QWidget *parent=0, const char *name=0)
 InfoLabel (const QString &mytitle, QWidget *parent=0, const char *name=0)
 InfoLabel (const QString &mytitle, const QString &myvalue, QWidget *parent=0, const char *name=0)
QString title () const
QString value () const
+


Detailed Description

+Class which defines an information label. It usually tells the user information about some configuration parameter or result (label title). It's usually shown as a title in bold and a colon, followed by its value. +

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
InfoLabel::InfoLabel QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InfoLabel with no title or value

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
InfoLabel::InfoLabel const QString &   mytitle,
QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InfoLabel with title

+Parameters:
+ + + +
mytitle  +and void result
mytitle  +Title of the InfoLabel
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
InfoLabel::InfoLabel const QString &   mytitle,
const QString &   myvalue,
QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InfoLabel with title param mytitle and result param myvalue

+Parameters:
+ + + +
mytitle  +Title of the InfoLabel
myvalue  +Value of the information labeled as the title set
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void InfoLabel::setTitle const QString &   str [slot]
+
+ + + + + +
+   + + +

+Sets the title of the label

+

+ + + + +
+ + + + + + + + + + +
void InfoLabel::setValue const QString &   str [slot]
+
+ + + + + +
+   + + +

+Sets the value shown as the title's value

+

+ + + + +
+ + + + + + + + + +
QString InfoLabel::title   const
+
+ + + + + +
+   + + +

+Returns the title of the information label

+

+ + + + +
+ + + + + + + + + +
QString InfoLabel::value   const
+
+ + + + + +
+   + + +

+Returns the value set for the information

+


The documentation for this class was generated from the following files: +
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classInputCombo-members.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classInputCombo-members.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,23 @@ + + +Member List + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

InputCombo Member List

This is the complete list of members for InputCombo, including all inherited members. + + + + + + + + +
InputCombo(QWidget *parent=0, const char *name=0)InputCombo
InputCombo(const QString &mylabel, QWidget *parent=0, const char *name=0)InputCombo
InputCombo(const QString &mylabel, const QStringList &mystrings, QWidget *parent=0, const char *name=0)InputCombo
label() constInputCombo
qComboBox()InputCombo
qLabel()InputCombo
setLabel(QString &str)InputCombo [slot]
text() constInputCombo

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classInputCombo.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classInputCombo.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,326 @@ + + +InputCombo class Reference + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

InputCombo Class Reference

#include <inputcombo.h> +

+List of all members. + + + + + + + + + + +

Public Slots

void setLabel (QString &str)

Public Methods

 InputCombo (QWidget *parent=0, const char *name=0)
 InputCombo (const QString &mylabel, QWidget *parent=0, const char *name=0)
 InputCombo (const QString &mylabel, const QStringList &mystrings, QWidget *parent=0, const char *name=0)
QString text () const
QString label () const
QLabel * qLabel ()
QComboBox * qComboBox ()
+


Detailed Description

+A class for making input fields of type "Label: ComboBox" +

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
InputCombo::InputCombo QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InputCombo with no label or combobox content

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
InputCombo::InputCombo const QString &   mylabel,
QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InputCombo with label

+Parameters:
+ + + +
mylabel  +and void combobox
mylabel  +Label of the InputCombo
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
InputCombo::InputCombo const QString &   mylabel,
const QStringList &   mystrings,
QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InputCombo with label

+Parameters:
+ + + + +
mylabel  +and an initialized combobox
mylabel  +Label of the InputCombo
mystrings  +Content of the combobox
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
QString InputCombo::label   const
+
+ + + + + +
+   + + +

+Returns the label of the input field

+

+ + + + +
+ + + + + + + + + +
QComboBox * InputCombo::qComboBox  
+
+ + + + + +
+   + + +

+Returns the QComboBox

+

+ + + + +
+ + + + + + + + + +
QLabel * InputCombo::qLabel  
+
+ + + + + +
+   + + +

+Returns the QLabel

+

+ + + + +
+ + + + + + + + + + +
void InputCombo::setLabel QString &   str [slot]
+
+ + + + + +
+   + + +

+Sets the label of the input field

+

+ + + + +
+ + + + + + + + + +
QString InputCombo::text   const
+
+ + + + + +
+   + + +

+Returns the contents of the textbox

+


The documentation for this class was generated from the following files: +
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classInputField-members.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classInputField-members.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,24 @@ + + +Member List + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

InputField Member List

This is the complete list of members for InputField, including all inherited members. + + + + + + + + + +
InputField(QWidget *parent=0, const char *name=0)InputField
InputField(const QString &mylabel, QWidget *parent=0, const char *name=0)InputField
InputField(const QString &mylabel, const QString &mytext, QWidget *parent=0, const char *name=0)InputField
label() constInputField
qLabel()InputField
qLineEdit()InputField
setLabel(QString &str)InputField [slot]
setText(QString &str)InputField [slot]
text() constInputField

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classInputField.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classInputField.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,356 @@ + + +InputField class Reference + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

InputField Class Reference

#include <inputfield.h> +

+List of all members. + + + + + + + + + + + +

Public Slots

void setText (QString &str)
void setLabel (QString &str)

Public Methods

 InputField (QWidget *parent=0, const char *name=0)
 InputField (const QString &mylabel, QWidget *parent=0, const char *name=0)
 InputField (const QString &mylabel, const QString &mytext, QWidget *parent=0, const char *name=0)
QString text () const
QString label () const
QLabel * qLabel ()
QLineEdit * qLineEdit ()
+


Detailed Description

+A class for making input fields of type "Label: Textbox" +

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
InputField::InputField QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InputField with no label or textbox content

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
InputField::InputField const QString &   mylabel,
QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InputField with label

+Parameters:
+ + + +
mylabel  +and void textbox
mylabel  +Label of the InputField
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
InputField::InputField const QString &   mylabel,
const QString &   mytext,
QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructs an InputField with label

+Parameters:
+ + + + +
mylabel  +and a textbox with content
mylabel  +Label of the InputField
mytext  +Initial content of the textbox
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
QString InputField::label   const
+
+ + + + + +
+   + + +

+Returns the label of the input field

+

+ + + + +
+ + + + + + + + + +
QLabel * InputField::qLabel  
+
+ + + + + +
+   + + +

+Returns the QLabel

+

+ + + + +
+ + + + + + + + + +
QLineEdit * InputField::qLineEdit  
+
+ + + + + +
+   + + +

+Returns the QLineEdit

+

+ + + + +
+ + + + + + + + + + +
void InputField::setLabel QString &   str [slot]
+
+ + + + + +
+   + + +

+Sets the label of the input field

+

+ + + + +
+ + + + + + + + + + +
void InputField::setText QString &   str [slot]
+
+ + + + + +
+   + + +

+Sets the contents of the textbox

+

+ + + + +
+ + + + + + + + + +
QString InputField::text   const
+
+ + + + + +
+   + + +

+Returns the contents of the textbox

+


The documentation for this class was generated from the following files: +
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classMainPanel-members.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classMainPanel-members.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,22 @@ + + +Member List + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

MainPanel Member List

This is the complete list of members for MainPanel, including all inherited members. + + + + + + + +
accountChart()MainPanel [slot]
accountChartRemoved() (defined in MainPanel)MainPanel [slot]
dbConfigure()MainPanel [slot]
dbConnect()MainPanel [slot]
dbDisconnect()MainPanel [slot]
MainPanel(QWidget *parent=0, const char *name=0)MainPanel
transactions()MainPanel [slot]

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classMainPanel.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classMainPanel.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,213 @@ + + +MainPanel class Reference + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

MainPanel Class Reference

#include <mainpanel.h> +

+List of all members. + + + + + + + + + +

Public Slots

void transactions ()
void accountChart ()
+void accountChartRemoved ()
void dbConnect ()
void dbDisconnect ()
void dbConfigure ()

Public Methods

 MainPanel (QWidget *parent=0, const char *name=0)
+


Detailed Description

+Offers the main window of the YAGL application. It holds the database connection information, and controls the actions in this main window. +

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
MainPanel::MainPanel QWidget *   parent = 0,
const char *   name = 0
+
+ + + + + +
+   + + +

+Constructor of the main window application

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
void MainPanel::accountChart   [slot]
+
+ + + + + +
+   + + +

+Opens a dialog for managing the Chart of Accounts

+

+ + + + +
+ + + + + + + + + +
void MainPanel::dbConfigure   [slot]
+
+ + + + + +
+   + + +

+Opens a dialog prompting for database connection configuration

+

+ + + + +
+ + + + + + + + + +
void MainPanel::dbConnect   [slot]
+
+ + + + + +
+   + + +

+Connects to the database configured

+

+ + + + +
+ + + + + + + + + +
void MainPanel::dbDisconnect   [slot]
+
+ + + + + +
+   + + +

+Disconnects from the database configured

+

+ + + + +
+ + + + + + + + + +
void MainPanel::transactions   [slot]
+
+ + + + + +
+   + + +

+Opens a dialog for managing transactions.

+


The documentation for this class was generated from the following files: +
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/classes.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/classes.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,20 @@ + + +Alphabetical index + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

yagl Compound Index

+ + + + +
  D  
InputCombo   
DBConfigureForm   InputField   
  I  
  M  
InfoLabel   MainPanel   
+
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/dbconfigureform_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/dbconfigureform_8h-source.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,40 @@ + + +dbconfigureform.h Source File + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

dbconfigureform.h

00001 #include <qdialog.h>
+00002 #include <tdbconfig.h>
+00003 
+00004 class InputField;
+00005 class InputCombo;
+00006 
+00013 class DBConfigureForm : public QDialog
+00014 {
+00015         Q_OBJECT
+00016 
+00017 private:
+00018         InputField *host, *username, *database, *password;
+00019         InputCombo *driver;
+00020         Tdb_config *db_config;
+00021         QPushButton *apply_button;
+00022 
+00023 public slots:
+00027         void acceptChanges();
+00033         int updateVariables();
+00037         void setFormChanged();
+00041         void setFormNoChanged();
+00042 
+00043 public:
+00049         DBConfigureForm(Tdb_config *mydbconfig,
+00050                 QWidget *parent=0, const char *name=0);
+00051 };
+

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/doxygen.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/doxygen.css Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,49 @@ +H1 { text-align: center; } +CAPTION { font-weight: bold } +A.qindex {} +A.qindexRef {} +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code { text-decoration: none; font-weight: normal; color: #4444ee } +A.codeRef { font-weight: normal; color: #4444ee } +A:hover { text-decoration: none; background-color: #f2f2ff } +DL.el { margin-left: -1cm } +DIV.fragment { width: 100%; border: none; background-color: #eeeeee } +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } +TD.md { background-color: #f2f2ff; font-weight: bold; } +TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; } +TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; } +DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } +DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } +BODY { background: white } +TD.indexkey { + background-color: #eeeeff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} +TD.indexvalue { + background-color: #eeeeff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} +FONT.keyword { color: #008000 } +FONT.keywordtype { color: #604020 } +FONT.keywordflow { color: #e08000 } +FONT.comment { color: #800000 } +FONT.preprocessor { color: #806020 } +FONT.stringliteral { color: #002080 } +FONT.charliteral { color: #008080 } diff -r 000000000000 -r 04114bce8fd0 doxygen/html/doxygen.png Binary file doxygen/html/doxygen.png has changed diff -r 000000000000 -r 04114bce8fd0 doxygen/html/files.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/files.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,23 @@ + + +File Index + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

yagl File List

Here is a list of all documented files with brief descriptions: + + + + + + + +
chartwindow.h [code]
dbconfigureform.h [code]
infolabel.h [code]
inputcombo.h [code]
inputfield.h [code]
mainpanel.h [code]
tdbconfig.h [code]
+
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/functions.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/functions.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,41 @@ + + +Compound Member Index + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

yagl Compound Members

Here is a list of all documented class members with links to the classes they belong to: +
Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/index.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,16 @@ + + +Main Page + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

yagl Documentation

+

+

1


Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/infolabel_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/infolabel_8h-source.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,51 @@ + + +infolabel.h Source File + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

infolabel.h

00001 #ifndef INFOLABEL_H
+00002 #define INFOLABEL_H
+00003 
+00004 
+00005 #include <qlabel.h>
+00006 
+00007 class QString;
+00008 class QLineEdit;
+00009 
+00015 class InfoLabel : public QLabel
+00016 {
+00017         Q_OBJECT
+00018 
+00019 private:
+00020         QString *titlevar, *valuevar;
+00021         
+00022         void initWidget();
+00023 
+00024 public slots:
+00028         void setTitle(const QString &str);
+00032         void setValue(const QString &str);
+00033 
+00034 public:
+00038         InfoLabel(QWidget *parent=0, const char *name=0);
+00039 
+00045         InfoLabel(const QString &mytitle, QWidget *parent=0,
+00046                         const char *name=0);
+00047 
+00054         InfoLabel(const QString &mytitle, const QString &myvalue,
+00055                         QWidget *parent=0, const char *name=0);
+00056 
+00060         QString title() const;
+00061 
+00065         QString value() const;
+00066 };
+00067 
+00068 #endif // INFOLABEL_H
+

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/inputcombo_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/inputcombo_8h-source.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,52 @@ + + +inputcombo.h Source File + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

inputcombo.h

00001 #ifndef INPUTCOMBO_H
+00002 #define INPUTCOMBO_H
+00003 
+00004 #include <qhbox.h>
+00005 
+00006 class QString;
+00007 class QStringList;
+00008 class QLabel;
+00009 class QComboBox;
+00010 
+00014 class InputCombo : public QHBox
+00015 {
+00016         Q_OBJECT
+00017 
+00018 private:
+00019         QLabel *labelbox;
+00020         QComboBox *combobox;
+00021         
+00022         void initWidget();
+00023 
+00024 public slots:
+00028         void setLabel(QString &str);
+00029 
+00030 public:
+00034         InputCombo(QWidget *parent=0, const char *name=0);
+00040         InputCombo(const QString &mylabel, QWidget *parent=0,
+00041                         const char *name=0);
+00048         InputCombo(const QString &mylabel, const QStringList &mystrings,
+00049                         QWidget *parent=0, const char *name=0);
+00050 
+00054         QString text() const;
+00058         QString label() const;
+00059 
+00063         QLabel* qLabel();
+00067         QComboBox* qComboBox();
+00068 };
+00069 
+00070 #endif // INPUTCOMBO_H
+

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/inputfield_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/inputfield_8h-source.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,52 @@ + + +inputfield.h Source File + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

inputfield.h

00001 #ifndef INPUTFIELD_H
+00002 #define INPUTFIELD_H
+00003 
+00004 #include <qhbox.h>
+00005 
+00006 class QString;
+00007 class QLabel;
+00008 class QLineEdit;
+00009 
+00013 class InputField : public QHBox
+00014 {
+00015         Q_OBJECT
+00016 
+00017 private:
+00018         QLabel *labelbox;
+00019         QLineEdit *textbox;
+00020         
+00021         void initWidget();
+00022 
+00023 public slots:
+00027         void setText(QString &str);
+00031         void setLabel(QString &str);
+00032 
+00033 public:
+00037         InputField(QWidget *parent=0, const char *name=0);
+00043         InputField(const QString &mylabel, QWidget *parent=0,
+00044                         const char *name=0);
+00051         InputField(const QString &mylabel, const QString &mytext,
+00052                         QWidget *parent=0, const char *name=0);
+00053 
+00057         QString text() const;
+00061         QString label() const;
+00062 
+00066         QLabel* qLabel();
+00070         QLineEdit* qLineEdit();
+00071 };
+00072 
+00073 #endif // INPUTFIELD_H
+

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/mainpanel_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/mainpanel_8h-source.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,55 @@ + + +mainpanel.h Source File + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

mainpanel.h

00001 #ifndef MAINPANEL_H
+00002 #define MAINPANEL_H
+00003 
+00004 
+00005 #include <qmainwindow.h>
+00006 #include <qsqldatabase.h>
+00007 #include "tdbconfig.h"
+00008 //#include "infolabel.h"
+00009 
+00010 class QWorkspace;
+00011 class QDialog;
+00012 class InfoLabel;
+00013 class ChartWindow;
+00014 
+00019 class MainPanel : public QMainWindow
+00020 {
+00021         Q_OBJECT
+00022 
+00023 private: // Variables
+00024         Tdb_config db_config;
+00025         QWorkspace *workspace;
+00026         InfoLabel *info_connected;
+00027 
+00028         QSqlDatabase *our_database;
+00029 
+00030         InfoLabel *transactionsD;
+00031         ChartWindow *chartW;
+00032 
+00033 public: // Methods
+00037         MainPanel( QWidget *parent=0, const char *name = 0);
+00038 
+00039 public slots:
+00043         void transactions();
+00047         void accountChart();
+00048         void accountChartRemoved();
+00052         void dbConnect();
+00056         void dbDisconnect();
+00060         void dbConfigure();
+00061 };
+00062 
+00063 #endif //MAINPANEL_H
+

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 doxygen/html/tdbconfig_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doxygen/html/tdbconfig_8h-source.html Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,27 @@ + + +tdbconfig.h Source File + + + +
+Main Page   Alphabetical List   Compound List   File List   Compound Members  
+

tdbconfig.h

00001 #ifndef TDB_CONFIG_H
+00002 #define TDB_CONFIG_H
+00003 
+00004 struct Tdb_config
+00005 {
+00006         QString host;
+00007         QString username;
+00008         QString password;
+00009         QString database;
+00010         QString driver;
+00011 };
+00012 
+00013 #endif // TDB_CONFIG_H
+

Generated on Mon Nov 3 19:26:24 2003 for yagl by + +doxygen1.2.16
+ + diff -r 000000000000 -r 04114bce8fd0 sql/account_chart.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sql/account_chart.sql Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,51 @@ +INSERT INTO chart (account_num, + name, + description, + general, + account, + enabled, + type, + links) + VALUES ('1', + 'Finançament Bàsic', + 'Totes les comptes de finançament bàsic', + 1, + 0, + 0, + NULL, + NULL); + + +INSERT INTO chart (account_num, + name, + description, + general, + account, + enabled, + type, + links) + VALUES ('100', + 'Capital Social', + 'Capital posat pels socis', + 1, + 1, + 1, + 'A', + NULL); + +INSERT INTO chart (account_num, + name, + description, + general, + account, + enabled, + type, + links) + VALUES ('101', + 'Fons Social', + 'Fondos', + 1, + 1, + 1, + 'A', + NULL); diff -r 000000000000 -r 04114bce8fd0 sql/tables-mysql.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sql/tables-mysql.sql Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,51 @@ +drop table if exists chart; + +create table chart ( +-- Fem que sigui 'char' per fer cerques bé amb wildcards ('30%' per exemple) + account_num char(10) not null, +-- Nom de la compta (una línia) + name tinytext default NULL, +-- Explica què s'ha de comptar en aquest compte + description text default NULL, +-- Marca si forma part del pla general comptable o no + general tinyint default 0, +-- Bool de si és un compte o no. Podria ser un títol, o una marca en els +-- comptes. + account tinyint default 0, +-- Bool de si la volem veure als diàlegs o no + enabled tinyint default 0, +-- Actiu, Passiu, Ingressos, Despeses + type enum("A","P","I","D") default NULL, +-- Aquest set augmentarà més endavant + links set("Venda","Compra") default NULL, +-- Profunditat (número de caràcters a "number") +-- no és necessària, perquè es poden fer cerques amb ?, ??, ... +-- level tinyint default 0, + + primary key (account_num) +) TYPE=MyISAM; + + +drop table if exists transactions; + +create table transactions ( + id int(11) auto_increment not null, + t_date date, + concept tinytext, +-- doc_type set('Factura', ...') +-- doc_number char(11) + primary key (id) +) TYPE=MyISAM; + + +drop table if exists movements; + + +create table movements ( + transaction_id int(11) not null, + account_num int(11) not null, + amount float(20,2), + primary key (transaction_id,account_num) +-- foreign key transaction_id (transactions.id), +-- foreign key account_num (chart.accout_num) +) TYPE=MyISAM; diff -r 000000000000 -r 04114bce8fd0 src/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/.cvsignore Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,2 @@ +moc_* +obj/* diff -r 000000000000 -r 04114bce8fd0 src/chartwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/chartwindow.cpp Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,69 @@ +#include +#include +#include +#include "chartwindow.h" +#include "mainpanel.h" + + +ChartWindow::ChartWindow(QWidget *parent, const char *name) + : QMainWindow(parent, name, WDestructiveClose) +{ + //QVBoxLayout *mainlayout = new QVBoxLayout(this, 0); + + // Only the listview in the window + accountsList = new QListView(this); + + accountsList->addColumn( tr("Number") ); + accountsList->addColumn( tr("Name") ); + accountsList->addColumn( tr("Description") ); + accountsList->addColumn( tr("General") ); + accountsList->addColumn( tr("Is Account") ); + accountsList->addColumn( tr("Enabled") ); + accountsList->addColumn( tr("Type") ); + accountsList->addColumn( tr("Links") ); + + accountsList->setAllColumnsShowFocus( true ); + + + // We get the data to be shown + QSqlQuery q; + + q.prepare("SELECT account_num, name, description, general, account, " + "enabled, type, links FROM chart"); + if(q.exec()) + { + while(q.next()) { + new QListViewItem( accountsList, + q.value(0).toString(), // account_num + q.value(1).toString(), // name + q.value(2).toString(), // description + q.value(3).toBool()?"True":"False", // general + q.value(4).toBool()?"True":"False", // account + q.value(5).toBool()?"True":"False", // enabled + q.value(6).toString(), // type + q.value(7).toString()); // links + } + } + else + qDebug("Query failed when trying to get Chart of accounts"); + + + // Prepare this main window + setFocusProxy( accountsList ); + setCentralWidget( accountsList ); + + setCaption( tr("Accounts Chart") ); + + // Show Status Bar + + // Needed? + statusBar()->clear(); + + statusBar()->message( tr("Click with right button over any accout to" + " perform any action") ); + +} + +ChartWindow::~ChartWindow() +{ +} diff -r 000000000000 -r 04114bce8fd0 src/chartwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/chartwindow.h Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,22 @@ +#ifndef CHARTWINDOW_H +#define CHARTWINDOW_H + + +#include + +class QListView; + +/*! + */ +class ChartWindow : public QMainWindow +{ + +private: // Variables + QListView *accountsList; + +public: + ChartWindow(QWidget *parent = 0, const char *name = 0); + ~ChartWindow(); +}; + +#endif //CHARTWINDOW_H diff -r 000000000000 -r 04114bce8fd0 src/dbconfigureform.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/dbconfigureform.cpp Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,141 @@ +#include +#include +#include +#include +#include +#include +#include +#include "dbconfigureform.h" +#include "inputfield.h" +#include "inputcombo.h" +#include +#include +#include + +DBConfigureForm :: DBConfigureForm( Tdb_config *mydb_config, + QWidget *parent, const char *name ) + : QDialog( parent, name, TRUE) +{ + QVBoxLayout *mainlayout = new QVBoxLayout( this ,10 ); + + // We store the pointer to the data we should set + db_config = mydb_config; + + // Data InputFields + QVGroupBox *fields = new QVGroupBox( "Data", this ); + + host = new InputField( tr("Host:"), db_config->host, fields); + database = new InputField( tr("Database:"), db_config->database, + fields); + username = new InputField( tr("Username:"), + db_config->username, fields); + password = new InputField( tr("Password:"), db_config->password, + fields); + driver = new InputCombo( tr("Driver:"), QSqlDatabase::drivers(), + fields); + + // Password echo mode for password input field. + password->qLineEdit()->setEchoMode(QLineEdit::Password); + // Set the default setting in driver combo + driver->qComboBox()->setCurrentText(db_config->driver); + + mainlayout->addWidget( fields ); + + + // Apply button + apply_button = new QPushButton( tr("Apply"), this, + "ApplyButton"); + // Accept button + QPushButton *accept_button = new QPushButton( tr("Accept"), this, + "AcceptButton"); + // Cancel button + QPushButton *cancel_button = new QPushButton( tr("Cancel"), + this, "CancelButton"); + + // Main form buttons + QHBoxLayout *buttons = new QHBoxLayout( mainlayout, 10 ); + buttons->addWidget(apply_button); + buttons->addWidget(accept_button); + buttons->addWidget(cancel_button); + + accept_button->setDefault(TRUE); + + setCaption( tr("DB Configure Form") ); + + // Connects: buttons + connect( apply_button, SIGNAL(clicked()), this, + SLOT(updateVariables()) ); + connect( accept_button, SIGNAL(clicked()), this, + SLOT(acceptChanges()) ); + connect( cancel_button, SIGNAL(clicked()), this, SLOT(reject()) ); + + // Connects: textboxes + connect( host->qLineEdit(), SIGNAL(textChanged(const QString&)), this, + SLOT(setFormChanged()) ); + connect( database->qLineEdit(), SIGNAL(textChanged(const QString&)), + this, SLOT(setFormChanged()) ); + connect( username->qLineEdit(), SIGNAL(textChanged(const QString&)), + this, SLOT(setFormChanged()) ); + connect( password->qLineEdit(), SIGNAL(textChanged(const QString&)), + this, SLOT(setFormChanged()) ); + connect( driver->qComboBox(), SIGNAL(activated(int)), + this, SLOT(setFormChanged()) ); + + // Initial state of the form + setFormNoChanged(); + + // Validators for InputFields + host->qLineEdit()->setValidator( + new QRegExpValidator( QRegExp( "[0-9a-z_\\-\\.]*" ), + host->qLineEdit() )); + username->qLineEdit()->setValidator( + new QRegExpValidator( QRegExp( "[0-9a-zA-Z_\\-\\.]+" ), + host->qLineEdit() )); + password->qLineEdit()->setValidator( + new QRegExpValidator( QRegExp( "[0-9a-zA-Z_\\-\\.]*" ), + host->qLineEdit() )); + database->qLineEdit()->setValidator( + new QRegExpValidator( QRegExp( "[0-9a-zA-Z_\\-\\.]+" ), + host->qLineEdit() )); + +} + + +int DBConfigureForm :: updateVariables( ) +{ + /* + // ** Check if data is correct. Don't let it end if sth's wrong. + if (host->text().find( QRegExp( "[^a-z_\\-\\.]" ) ) != -1 ) + { + // *** A Message Box should be shown + qWarning("Host isn't good."); + return 1; // ERROR + } + */ + + // Save data + db_config->host = host->text(); + db_config->username = username->text(); + db_config->database = database->text(); + db_config->password = password->text(); + db_config->driver = driver->text(); + + setFormNoChanged(); + + return 0; // OK +} + +void DBConfigureForm :: acceptChanges( ) +{ + if (!updateVariables()) + accept(); +} + +void DBConfigureForm :: setFormChanged() +{ + apply_button->setEnabled(true); +} +void DBConfigureForm :: setFormNoChanged() +{ + apply_button->setEnabled(false); +} diff -r 000000000000 -r 04114bce8fd0 src/dbconfigureform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/dbconfigureform.h Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,51 @@ +#include +#include + +class InputField; +class InputCombo; + +/*! + DataBase configuration form, which asks for enough information to connect to a + database. + The information is stored in a structure given in the constructor. + \sa DBConfigureForm() + */ +class DBConfigureForm : public QDialog +{ + Q_OBJECT + +private: + InputField *host, *username, *database, *password; + InputCombo *driver; + Tdb_config *db_config; + QPushButton *apply_button; + +public slots: + /*! + Accept the changes made in the form. It also closes the dialog. + */ + void acceptChanges(); + /*! + Updates the contents of the #db_config structure using the actual + values of the input fields + Returns 0 if no error, error happened otherwise. + */ + int updateVariables(); + /*! + Sets the state of the Apply button to Enabled + */ + void setFormChanged(); + /*! + Sets the state of the Apply button to Disabled + */ + void setFormNoChanged(); + +public: + /*! + Constructs the configuration form using #mydbconfig for storing + the form values. + \param mydbconfig The structure used to store the database information + */ + DBConfigureForm(Tdb_config *mydbconfig, + QWidget *parent=0, const char *name=0); +}; diff -r 000000000000 -r 04114bce8fd0 src/infolabel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/infolabel.cpp Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,55 @@ +#include +#include +#include +#include "infolabel.h" + + +InfoLabel::InfoLabel( QWidget *parent, const char *name ) + : QLabel( parent, name ) +{ + initWidget(); +} + +InfoLabel::InfoLabel( const QString &mytitle, + QWidget *parent, const char *name ) : QLabel( parent, name ) +{ + initWidget(); + setTitle( mytitle ); +} + +InfoLabel::InfoLabel( const QString &mytitle, const QString &myvalue, + QWidget *parent, const char *name ) : QLabel( parent, name ) +{ + initWidget(); + setTitle( mytitle ); + setValue( myvalue ); +} + + +void InfoLabel::initWidget() +{ + titlevar = new QString; + valuevar = new QString; +} + +void InfoLabel::setTitle(const QString &str) +{ + *titlevar = str; + setText( "" + *titlevar + ": " + *valuevar); +} + +void InfoLabel::setValue(const QString &str) +{ + *valuevar = str; + setText( "" + *titlevar + ": " + *valuevar); +} + +QString InfoLabel::title() const +{ + return *titlevar; +} + +QString InfoLabel::value() const +{ + return *valuevar; +} diff -r 000000000000 -r 04114bce8fd0 src/infolabel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/infolabel.h Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,68 @@ +#ifndef INFOLABEL_H +#define INFOLABEL_H + + +#include + +class QString; +class QLineEdit; + +/*! + Class which defines an information label. It usually tells the user + information about some configuration parameter or result (label title). + It's usually shown as a title in bold and a colon, followed by its value. + */ +class InfoLabel : public QLabel +{ + Q_OBJECT + +private: + QString *titlevar, *valuevar; + + void initWidget(); + +public slots: + /*! + * Sets the title of the label + */ + void setTitle(const QString &str); + /*! + * Sets the value shown as the title's value + */ + void setValue(const QString &str); + +public: + /*! + * Constructs an InfoLabel with no title or value + */ + InfoLabel(QWidget *parent=0, const char *name=0); + + /*! + * Constructs an InfoLabel with title \param mytitle and + * void result + * \param mytitle Title of the InfoLabel + */ + InfoLabel(const QString &mytitle, QWidget *parent=0, + const char *name=0); + + /*! + * Constructs an InfoLabel with title #param mytitle and + * result #param myvalue + * \param mytitle Title of the InfoLabel + * \param myvalue Value of the information labeled as the title set + */ + InfoLabel(const QString &mytitle, const QString &myvalue, + QWidget *parent=0, const char *name=0); + + /*! + * Returns the title of the information label + */ + QString title() const; + + /*! + * Returns the value set for the information + */ + QString value() const; +}; + +#endif // INFOLABEL_H diff -r 000000000000 -r 04114bce8fd0 src/inputcombo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/inputcombo.cpp Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,64 @@ +#include +#include +#include +#include "inputcombo.h" +#include + + +InputCombo::InputCombo( QWidget *parent, const char *name ) + : QHBox( parent, name ) +{ + labelbox = new QLabel( this ); + combobox = new QComboBox( this ); + initWidget(); +} + +InputCombo::InputCombo( const QString &mylabel, + QWidget *parent, const char *name ) : QHBox( parent, name ) +{ + labelbox = new QLabel( mylabel, this ); + combobox = new QComboBox( this ); + initWidget(); +} + +InputCombo::InputCombo( const QString &mylabel, const QStringList &mystrings, + QWidget *parent, const char *name ) : QHBox( parent, name ) +{ + labelbox = new QLabel( mylabel, this ); + combobox = new QComboBox( this ); + combobox->insertStringList(mystrings); + initWidget(); +} + +void InputCombo::initWidget() +{ + // Init widget config + setStretchFactor( labelbox, 0 ); + setStretchFactor( combobox, 1 ); + setSpacing( 10 ); +} + +void InputCombo::setLabel(QString &str) +{ + labelbox->setText(str); +} + +QString InputCombo::text() const +{ + return combobox->currentText(); +} + +QString InputCombo::label() const +{ + return labelbox->text(); +} + +QLabel* InputCombo::qLabel() +{ + return labelbox; +} + +QComboBox* InputCombo::qComboBox() +{ + return combobox; +} diff -r 000000000000 -r 04114bce8fd0 src/inputcombo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/inputcombo.h Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,70 @@ +#ifndef INPUTCOMBO_H +#define INPUTCOMBO_H + +#include + +class QString; +class QStringList; +class QLabel; +class QComboBox; + +/*! + * A class for making input fields of type "Label: ComboBox" +*/ +class InputCombo : public QHBox +{ + Q_OBJECT + +private: + QLabel *labelbox; + QComboBox *combobox; + + void initWidget(); + +public slots: + /*! + * Sets the label of the input field + */ + void setLabel(QString &str); + +public: + /*! + * Constructs an InputCombo with no label or combobox content + */ + InputCombo(QWidget *parent=0, const char *name=0); + /*! + * Constructs an InputCombo with label \param mylabel and + * void combobox + * \param mylabel Label of the InputCombo + */ + InputCombo(const QString &mylabel, QWidget *parent=0, + const char *name=0); + /*! + * Constructs an InputCombo with label \param mylabel and + * an initialized combobox + * \param mylabel Label of the InputCombo + * \param mystrings Content of the combobox + */ + InputCombo(const QString &mylabel, const QStringList &mystrings, + QWidget *parent=0, const char *name=0); + + /*! + * Returns the contents of the textbox + */ + QString text() const; + /*! + * Returns the label of the input field + */ + QString label() const; + + /*! + * Returns the QLabel + */ + QLabel* qLabel(); + /*! + * Returns the QComboBox + */ + QComboBox* qComboBox(); +}; + +#endif // INPUTCOMBO_H diff -r 000000000000 -r 04114bce8fd0 src/inputfield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/inputfield.cpp Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,67 @@ +#include +#include +#include +#include "inputfield.h" + + +InputField::InputField( QWidget *parent, const char *name ) + : QHBox( parent, name ) +{ + labelbox = new QLabel( this ); + textbox = new QLineEdit( this ); + initWidget(); +} + +InputField::InputField( const QString &mylabel, + QWidget *parent, const char *name ) : QHBox( parent, name ) +{ + labelbox = new QLabel( mylabel, this ); + textbox = new QLineEdit( this ); + initWidget(); +} + +InputField::InputField( const QString &mylabel, const QString &mytext, + QWidget *parent, const char *name ) : QHBox( parent, name ) +{ + labelbox = new QLabel( mylabel, this ); + textbox = new QLineEdit( mytext, this ); + initWidget(); +} + +void InputField::initWidget() +{ + // Init widget config + setStretchFactor( labelbox, 0 ); + setStretchFactor( textbox, 1 ); + setSpacing( 10 ); +} + +void InputField::setText(QString &str) +{ + textbox->setText(str); +} + +void InputField::setLabel(QString &str) +{ + labelbox->setText(str); +} + +QString InputField::text() const +{ + return textbox->text(); +} + +QString InputField::label() const +{ + return labelbox->text(); +} + +QLabel* InputField::qLabel() +{ + return labelbox; +} + +QLineEdit* InputField::qLineEdit() +{ + return textbox; +} diff -r 000000000000 -r 04114bce8fd0 src/inputfield.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/inputfield.h Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,73 @@ +#ifndef INPUTFIELD_H +#define INPUTFIELD_H + +#include + +class QString; +class QLabel; +class QLineEdit; + +/*! + * A class for making input fields of type "Label: Textbox" +*/ +class InputField : public QHBox +{ + Q_OBJECT + +private: + QLabel *labelbox; + QLineEdit *textbox; + + void initWidget(); + +public slots: + /*! + * Sets the contents of the textbox + */ + void setText(QString &str); + /*! + * Sets the label of the input field + */ + void setLabel(QString &str); + +public: + /*! + * Constructs an InputField with no label or textbox content + */ + InputField(QWidget *parent=0, const char *name=0); + /*! + * Constructs an InputField with label \param mylabel and + * void textbox + * \param mylabel Label of the InputField + */ + InputField(const QString &mylabel, QWidget *parent=0, + const char *name=0); + /*! + * Constructs an InputField with label \param mylabel and + * a textbox with content + * \param mylabel Label of the InputField + * \param mytext Initial content of the textbox + */ + InputField(const QString &mylabel, const QString &mytext, + QWidget *parent=0, const char *name=0); + + /*! + * Returns the contents of the textbox + */ + QString text() const; + /*! + * Returns the label of the input field + */ + QString label() const; + + /*! + * Returns the QLabel + */ + QLabel* qLabel(); + /*! + * Returns the QLineEdit + */ + QLineEdit* qLineEdit(); +}; + +#endif // INPUTFIELD_H diff -r 000000000000 -r 04114bce8fd0 src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main.cpp Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,27 @@ +#include +#include +#include "mainpanel.h" + +int main(int argc, char **argv) +{ + QApplication a( argc, argv); + QTranslator translator( 0 ); + + if (translator.isEmpty()) + qWarning("El traductor és buit. (Normal)"); + + translator.load( "yagl_en.qm", "." ); + + //a.installTranslator( &translator ); + + if (translator.isEmpty()) + qWarning(a.tr("El traductor és buit.")); + else + qWarning(a.tr("El traductor no és buit (OK).")); + + MainPanel p; + + a.setMainWidget(&p); + p.show(); + return a.exec(); +} diff -r 000000000000 -r 04114bce8fd0 src/mainpanel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mainpanel.cpp Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,170 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mainpanel.h" +#include "chartwindow.h" +#include "dbconfigureform.h" +#include "infolabel.h" + + +MainPanel::MainPanel( QWidget *parent, const char *name ) + : QMainWindow( parent, name ) +{ + // Initialize the Menu bar + QPopupMenu *file = new QPopupMenu( this ); + QPopupMenu *actions = new QPopupMenu( this ); + QPopupMenu *database = new QPopupMenu( this ); + + database->insertItem( tr("&Connect"), this, + SLOT(dbConnect())); + database->insertItem( tr("&Disconnect"), this, + SLOT(dbDisconnect())); + database->insertSeparator(); + database->insertItem( tr("Confi&gure"), this, + SLOT(dbConfigure())); + + file->insertItem( tr("&Quit"), qApp, + SLOT(quit()), + tr("Ctrl+Q", "Quit")); + + actions->insertItem( tr("&Chart of Accounts"), this, + SLOT(accountChart()), + tr("Ctrl+C", "Action: Chart of Accounts")); + actions->insertItem( tr("&Transactions"), this, + SLOT(transactions()), + tr("Ctrl+T", "Action: Transactions")); + + menuBar()->insertItem( tr("&File"), file ); + menuBar()->insertItem( tr("&Actions"), actions ); + menuBar()->insertItem( tr("&Data Base"), database ); + + // Initialize the database configuration + db_config.host = "localhost"; + db_config.username = "yagl_user"; + db_config.password = "prova"; + db_config.database = "yagl1"; + db_config.driver = "QMYSQL3"; + + // Initialize this window (main) + setCaption( tr("Yet Another GUI Ledger") ); + + + workspace = new QWorkspace( this ); + + setCentralWidget(workspace); + + // Status Bar + info_connected = new InfoLabel( tr("Database"), + tr("disconnected"), this ); + statusBar()->addWidget( info_connected ); + + // Database pointer + our_database = NULL; + + // Dialog pointers + chartW = NULL; + +} + +void MainPanel::transactions( ) +{ + /* + if (!transactionsD) + transactionsD = new InfoLabel( tr("Prova"), + tr("Transactions"), workspace); + */ +} + +void MainPanel::accountChart( ) +{ + if (chartW==NULL) + { + chartW = new ChartWindow(workspace); + chartW->show(); + connect(chartW, SIGNAL(destroyed()), this, + SLOT(accountChartRemoved())); + } + qDebug("end of try to opening chartW"); +} + +void MainPanel::accountChartRemoved( ) +{ + chartW = NULL; + qDebug("chartW to null."); +} + +void MainPanel::dbConnect( ) +{ + our_database = QSqlDatabase::addDatabase( db_config.driver ); + our_database->setDatabaseName( db_config.database ); + our_database->setUserName( db_config.username ); + our_database->setPassword( db_config.password ); + our_database->setHostName( db_config.host ); + + /* + // Do we really need that ??!??!!? + if ( db_config.driver == "QMYSQL3" ) + our_database->setPort(3306); + */ + + qWarning( "Opening database connection..." ); + + if ( !our_database->open() ) + { + QString error_text( + tr("Database could not connect.\n Driver: ", + "db_connect_error_text") + + our_database->lastError().driverText() + + tr("\n Database: ", "db_connect_errortext") + + our_database->lastError().databaseText()); + + qWarning( error_text ); + QMessageBox::warning( this, tr("Database connection error"), + error_text, + QMessageBox::Ok || QMessageBox::Default, + QMessageBox::NoButton, + QMessageBox::NoButton); + } + else + { + qWarning( " connection opened." ); + // Let the status bar know + info_connected->setValue("connected"); + } + +} + +void MainPanel::dbDisconnect( ) +{ + if (our_database) + { + qWarning( "Closing database connection..." ); + our_database->close(); + qWarning( " connection closed." ); + // Let the status bar know + info_connected->setValue("disconnected"); + + } + else + qWarning( "We're not connected" ); +} + + +void MainPanel::dbConfigure( ) +{ + DBConfigureForm form(&db_config, this ); + + form.exec(); +} diff -r 000000000000 -r 04114bce8fd0 src/mainpanel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mainpanel.h Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,63 @@ +#ifndef MAINPANEL_H +#define MAINPANEL_H + + +#include +#include +#include "tdbconfig.h" +//#include "infolabel.h" + +class QWorkspace; +class QDialog; +class InfoLabel; +class ChartWindow; + +/*! + Offers the main window of the YAGL application. It holds the database + connection information, and controls the actions in this main window. + */ +class MainPanel : public QMainWindow +{ + Q_OBJECT + +private: // Variables + Tdb_config db_config; + QWorkspace *workspace; + InfoLabel *info_connected; + + QSqlDatabase *our_database; + + InfoLabel *transactionsD; + ChartWindow *chartW; + +public: // Methods + /*! + Constructor of the main window application + */ + MainPanel( QWidget *parent=0, const char *name = 0); + +public slots: + /*! + Opens a dialog for managing transactions. + */ + void transactions(); + /*! + Opens a dialog for managing the Chart of Accounts + */ + void accountChart(); + void accountChartRemoved(); + /*! + Connects to the database configured + */ + void dbConnect(); + /*! + Disconnects from the database configured + */ + void dbDisconnect(); + /*! + Opens a dialog prompting for database connection configuration + */ + void dbConfigure(); +}; + +#endif //MAINPANEL_H diff -r 000000000000 -r 04114bce8fd0 src/tdbconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/tdbconfig.h Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,13 @@ +#ifndef TDB_CONFIG_H +#define TDB_CONFIG_H + +struct Tdb_config +{ + QString host; + QString username; + QString password; + QString database; + QString driver; +}; + +#endif // TDB_CONFIG_H diff -r 000000000000 -r 04114bce8fd0 yagl Binary file yagl has changed diff -r 000000000000 -r 04114bce8fd0 yagl.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yagl.pro Thu May 18 23:05:01 2006 +0200 @@ -0,0 +1,26 @@ +###################################################################### +# Automatically generated by qmake (1.05a) Tue Aug 5 23:52:10 2003 +###################################################################### + +TEMPLATE = app +DEPENDPATH += src +INCLUDEPATH += src +OBJECTS_DIR = src/obj +DESTDIR = . + + +# Input +HEADERS += src/dbconfigureform.h \ + src/infolabel.h \ + src/inputcombo.h \ + src/inputfield.h \ + src/mainpanel.h \ + src/tdbconfig.h \ + src/chartwindow.h +SOURCES += src/dbconfigureform.cpp \ + src/infolabel.cpp \ + src/inputcombo.cpp \ + src/inputfield.cpp \ + src/main.cpp \ + src/mainpanel.cpp \ + src/chartwindow.cpp