Eneboo - Documentación para desarrolladores
src/qt/tools/linguist/linguist/trwindow.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 TRWINDOW_H
00028 #define TRWINDOW_H
00029 
00030 #include "phrase.h"
00031 
00032 #include <metatranslator.h>
00033 
00034 #include <qmainwindow.h>
00035 #include <qptrlist.h>
00036 #include <qdict.h>
00037 #include <qprinter.h>
00038 #include <qstringlist.h>
00039 #include <qpixmap.h>
00040 #include <qlistview.h>
00041 
00042 class QAction;
00043 class QDialog;
00044 class QLabel;
00045 class QListView;
00046 class QListViewItem;
00047 class QPrinter;
00048 
00049 class Action;
00050 class FindDialog;
00051 class MessageEditor;
00052 
00053 class PhraseLV;
00054 class ContextLVI;
00055 class Statistics;
00056 
00057 class TrWindow : public QMainWindow
00058 {
00059     Q_OBJECT
00060 public:
00061     static QPixmap * pxOn;
00062     static QPixmap * pxOff;
00063     static QPixmap * pxObsolete;
00064     static QPixmap * pxDanger;
00065     static const QPixmap pageCurl();
00066 
00067     TrWindow();
00068     ~TrWindow();
00069 
00070     void openFile( const QString& name );
00071 
00072 protected:
00073     void readConfig();
00074     void writeConfig();
00075     void closeEvent( QCloseEvent * );
00076 
00077 signals:
00078     void statsChanged( int w, int c, int cs, int w2, int c2, int cs2 );
00079     
00080 private slots:
00081     void doneAndNext();
00082     void prev();
00083     void next();
00084     void recentFileActivated( int );
00085     void setupRecentFilesMenu();
00086     void open();
00087     void save();
00088     void saveAs();
00089     void release();
00090     void print();
00091     void find();
00092     void findAgain();
00093     void replace();
00094     void newPhraseBook();
00095     void openPhraseBook();
00096     void closePhraseBook( int id );
00097     void editPhraseBook( int id );
00098     void printPhraseBook( int id );
00099     void manual();
00100     void revertSorting();
00101     void about();
00102     void aboutQt();
00103 
00104     void setupPhrase();
00105     bool maybeSave();
00106     void updateCaption();
00107     void showNewScope( QListViewItem *item );
00108     void showNewCurrent( QListViewItem *item );
00109     void updateTranslation( const QString& translation );
00110     void updateFinished( bool finished );
00111     void toggleFinished( QListViewItem *item, const QPoint& p, int column );
00112     void prevUnfinished();
00113     void nextUnfinished();
00114     void findNext( const QString& text, int where, bool matchCase );
00115     void revalidate();
00116     void toggleGuessing();
00117     void focusSourceList();
00118     void focusPhraseList();
00119     void updateClosePhraseBook();
00120     void toggleStatistics();
00121     void updateStatistics();
00122 
00123 private:
00124     typedef QPtrList<PhraseBook> PBL;
00125     typedef QDict<PhraseBook> PBD;
00126 
00127     static QString friendlyString( const QString& str );
00128 
00129     void addRecentlyOpenedFile( const QString & fn, QStringList & lst );
00130     void setupMenuBar();
00131     void setupToolBars();
00132     void setCurrentContextItem( QListViewItem *item );
00133     void setCurrentMessageItem( QListViewItem *item );
00134     QString friendlyPhraseBookName( int k );
00135     bool openPhraseBook( const QString& name );
00136     bool savePhraseBook( QString& name, const PhraseBook& pb );
00137     void updateProgress();
00138     void updatePhraseDict();
00139     PhraseBook getPhrases( const QString& source );
00140     bool danger( const QString& source, const QString& translation,
00141                  bool verbose = FALSE );
00142 
00143     int itemToIndex( QListView * view, QListViewItem * item );
00144     QListViewItem * indexToItem( QListView * view, int index );
00145     bool searchItem( const QString & searchWhat, QListViewItem * j,
00146                      QListViewItem * k );
00147     void countStats( QListViewItem * ci, QListViewItem * mi, int& trW, int& trC, int& trCS );
00148     void doCharCounting( const QString& text, int& trW, int& trC, int& trCS );
00149     
00150     QListView     * plv;
00151     QListView     * lv;
00152     QListView     * slv;
00153     MessageEditor * me;
00154     QLabel        * progress;
00155     QLabel        * modified;
00156     MetaTranslator tor;
00157     bool dirty;
00158     bool messageIsShown;
00159     int  numFinished;
00160     int  numNonobsolete;
00161     int  numMessages;
00162     int  dirtyItem;
00163     QStringList recentFiles;
00164     QString     filename;
00165 
00166     PBD phraseDict;
00167     PBL phraseBooks;
00168     QStringList phraseBookNames;
00169 
00170     QPrinter printer;
00171 
00172     FindDialog *f;
00173     FindDialog *h;
00174     QString findText;
00175     int findWhere;
00176     bool findMatchCase;
00177     int foundItem;
00178     QListViewItem *foundScope;
00179     int foundWhere;
00180     int foundOffset;
00181 
00182     QPopupMenu * phrasep;
00183     QPopupMenu * closePhraseBookp;
00184     QPopupMenu * editPhraseBookp;
00185     QPopupMenu * printPhraseBookp;
00186     QPopupMenu * recentFilesMenu;
00187     int closePhraseBookId;
00188     int editPhraseBookId;
00189     int printPhraseBookId;
00190     Action *openAct;
00191     Action *saveAct;
00192     Action *saveAsAct;
00193     Action *releaseAct;
00194     Action *printAct;
00195     Action *exitAct;
00196     Action *undoAct;
00197     Action *redoAct;
00198     Action *cutAct;
00199     Action *copyAct;
00200     Action *pasteAct;
00201     Action *selectAllAct;
00202     Action *findAct;
00203     Action *findAgainAct;
00204     Action *replaceAct;
00205     Action *newPhraseBookAct;
00206     Action *openPhraseBookAct;
00207     Action *acceleratorsAct;
00208     Action *endingPunctuationAct;
00209     Action *phraseMatchesAct;
00210     Action *revertSortingAct;
00211     Action *aboutAct;
00212     Action *aboutQtAct;
00213     Action *manualAct;
00214     Action *whatsThisAct;
00215     Action *beginFromSourceAct;
00216     Action *prevAct;
00217     Action *nextAct;
00218     Action *prevUnfinishedAct;
00219     Action *nextUnfinishedAct;
00220     Action *doneAndNextAct;
00221     QAction *doneAndNextAlt;
00222     Action *doGuessesAct;
00223     Action *toggleStats;
00224     Statistics * stats;
00225     int  srcWords;
00226     int  srcChars;
00227     int  srcCharsSpc;
00228 };
00229 
00230 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'