texteditor.h
author insilmaril
Fri, 24 Jul 2009 08:55:40 +0000
branchrelease-1-12-maintained
changeset 72 b4f008d1ea01
parent 0 7a96bd401351
child 2 608f976aa7bb
child 106 4083860dd82e
permissions -rw-r--r--
Version bump to 1.12.3
     1 #ifndef TEXTEDITOR_H 
     2 #define TEXTEDITOR_H
     3 
     4 #include <qmainwindow.h>
     5 #include <qtextedit.h>
     6 #include <qaction.h>
     7 #include <qfontdatabase.h>
     8 #include <qcombobox.h>
     9 
    10 
    11 enum EditorState {inactiveEditor,emptyEditor,filledEditor};
    12 
    13 class TextEditor : public QMainWindow {
    14     Q_OBJECT
    15 public:
    16     TextEditor();
    17     ~TextEditor();
    18 
    19 	bool isEmpty();
    20 	void setShowWithMain (bool);
    21 	bool showWithMain ();
    22 	void setFontHint(const QString&);
    23 	QString getFontHint();
    24 	QString getFontHintDefault();
    25 	void setFilename (const QString&);
    26 	QString getFilename ();
    27 	bool findText(const QString &, const bool &); // find Text 
    28 
    29 protected:
    30 	void setupFileActions();
    31 	void setupEditActions();
    32 	void setupFormatActions();
    33 	void setupSettingsActions();
    34     void closeEvent( QCloseEvent* );
    35 	
    36 
    37 public:
    38 	QString getText();
    39 
    40 public slots:
    41 	void editorChanged();	// received when text() changed
    42 	void setText(QString);	// set Text (by MapEditor)
    43 	void setInactive();		// Nothing can be entered
    44 	void editCopyAll();
    45 
    46 signals:
    47 	void textHasChanged();
    48 	void fontFamilyHasChanged();
    49 	void fontSizeHasChanged();
    50 	
    51 private slots:
    52     void textLoad();
    53     void textSaveAs();
    54     void textSave();
    55 	void textConvertPar();
    56 	void textJoinLines();
    57 	QString textConvertToASCII(const QString &);
    58 	void textExportAsASCII();
    59     void textPrint();
    60 	void textEditUndo();
    61     void toggleFonthint();
    62     void setFixedFont();
    63     void setVarFont();
    64     void textBold();
    65     void textUnderline();
    66     void textItalic();
    67     void textFamily( const QString &f );
    68     void textSize( const QString &p );
    69 	void textColor();
    70 	void textAlign(QAction*);
    71     void fontChanged( const QFont &f );
    72     void colorChanged( const QColor &c );
    73     void alignmentChanged( int a );
    74 	void enableActions();
    75 	void disableActions();
    76 
    77 private:
    78     QPrinter *printer;
    79     QTextEdit *e;
    80 	QPoint lastPos;			// save last position of window
    81     QString filename;
    82 
    83 	QBrush emptyPaper;		// setting the background color
    84 	QBrush filledPaper;		// depending on the state
    85 	QBrush inactivePaper;	// depending on the state
    86 	EditorState state;
    87 	bool showwithmain;		// same visibility as mainwindow?
    88 
    89 	QFont varFont;
    90 	QFont fixedFont;
    91     QComboBox
    92 	*comboFont,
    93 	*comboSize;
    94 	
    95 	QAction *actionFileLoad,
    96 	*actionFileSave,
    97 	*actionFileSaveAs,
    98 	*actionFilePrint,
    99 	*actionEditUndo,
   100 	*actionEditRedo,
   101 	*actionEditCopy,
   102 	*actionEditCut,
   103 	*actionEditPaste,
   104 	*actionEditDeleteAll,
   105 	*actionEditConvertPar,
   106 	*actionEditJoinLines,
   107 	*actionFormatUseFixedFont,
   108 	*actionSettingsVarFont,
   109 	*actionSettingsFixedFont,
   110 	*actionSettingsFonthintDefault,
   111     *actionTextBold,
   112 	*actionTextUnderline,
   113 	*actionTextItalic,
   114 	*actionTextColor,
   115 	*actionAlignLeft,
   116 	*actionAlignCenter,
   117 	*actionAlignRight,
   118 	*actionAlignJustify;
   119 
   120 
   121 };
   122 
   123 #endif