Eneboo - Documentación para desarrolladores
src/qt/tools/linguist/linguist/listviews.h
Ir a la documentación de este archivo.
00001 /**********************************************************************
00002 ** Copyright (C) 2000-2005 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qt Linguist.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00012 ** licenses may use this file in accordance with the Qt Commercial License
00013 ** Agreement provided with the Software.
00014 **
00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017 **
00018 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00019 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00020 **   information about Qt Commercial License Agreements.
00021 **
00022 ** Contact info@trolltech.com if any conditions of this licensing are
00023 ** not clear to you.
00024 **
00025 **********************************************************************/
00026 
00027 #ifndef LISTVIEWS_H
00028 #define LISTVIEWS_H
00029 
00030 #include "msgedit.h"
00031 
00032 #include <qstring.h>
00033 #include <qptrlist.h>
00034 #include <qregexp.h>
00035 #include <qlistview.h>
00036 
00037 class LVI : public QListViewItem
00038 {
00039 public:
00040     LVI( QListView *parent, QString text = QString::null );
00041     LVI( QListViewItem *parent, QString text = QString::null );
00042     virtual int compare( QListViewItem *other, int column,
00043                          bool ascending ) const;
00044     virtual bool danger() const { return FALSE; }
00045 
00046 protected:
00047     void drawObsoleteText( QPainter * p, const QColorGroup & cg, int column,
00048                            int width, int align );
00049 
00050 private:
00051     static int count;
00052 };
00053 
00054 class MessageLVI;
00055 class ContextLVI : public LVI
00056 {
00057 public:
00058     ContextLVI( QListView *lv, const QString& context );
00059 
00060     virtual bool danger() const { return dangerCount > 0; }
00061 
00062     void appendToComment( const QString& x );
00063     void incrementUnfinishedCount();
00064     void decrementUnfinishedCount();
00065     void incrementDangerCount();
00066     void decrementDangerCount();
00067     void incrementObsoleteCount();
00068     bool isContextObsolete();
00069     void updateStatus();
00070 
00071     QString context() const { return text( 1 ); }
00072     QString comment() const { return com; }
00073     QString fullContext() const;
00074     bool    finished() const { return unfinishedCount == 0; }
00075 
00076     MessageLVI * firstMessageItem() { return messageItems.first(); }
00077     MessageLVI * nextMessageItem() { return messageItems.next(); }
00078     MessageLVI * takeMessageItem( int i ) { return messageItems.take( i ); }
00079     void         appendMessageItem( QListView * lv, MessageLVI * i );
00080     void         instantiateMessageItem( QListView * lv, MessageLVI * i );
00081     int          messageItemsInList() { return messageItems.count(); }
00082 
00083     void paintCell( QPainter * p, const QColorGroup & cg, int column,
00084                     int width, int align );
00085 private:
00086     QPtrList<MessageLVI> messageItems;
00087     QString com;
00088     int unfinishedCount;
00089     int dangerCount;
00090     int obsoleteCount;
00091     int itemCount;
00092 };
00093 
00094 class MessageLVI : public LVI
00095 {
00096 public:
00097     MessageLVI( QListView *parent, const MetaTranslatorMessage & message,
00098                 const QString& text, const QString& comment, ContextLVI * c );
00099 
00100     virtual bool danger() const { return d; }
00101 
00102     void setTranslation( const QString& translation );
00103     void setFinished( bool finished );
00104     void setDanger( bool danger );
00105 
00106     void setContextLVI( ContextLVI * c ) { ctxt = c; }
00107     ContextLVI * contextLVI() const { return ctxt; }
00108     void updateTranslationText();
00109     
00110     QString context() const;
00111     QString sourceText() const { return tx; }
00112     QString comment() const { return com; }
00113     QString translation() const { return m.translation(); }
00114     bool finished() const { return fini; }
00115     MetaTranslatorMessage message() const;
00116 
00117     void paintCell( QPainter * p, const QColorGroup & cg, int column,
00118                     int width, int align );
00119 private:
00120     MetaTranslatorMessage m;
00121     QString tx;
00122     QString com;
00123     bool fini;
00124     bool d;
00125     ContextLVI * ctxt;
00126 };
00127 
00128 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'