Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
/home/iurt/rpm/BUILD/canorus-0.7.R1002/src/widgets/sourceviewport.h
Go to the documentation of this file.
00001 
00008 #ifndef SOURCEVIEWPORT_H_
00009 #define SOURCEVIEWPORT_H_
00010 
00011 #include <QTextEdit>
00012 
00013 #include "widgets/viewport.h"
00014 
00015 class QPushButton;
00016 class QGridLayout;
00017 
00018 class CADocument;
00019 class CAVoice;
00020 class CALyricsContext;
00021 
00022 class CASourceViewPort : public CAViewPort {
00023         Q_OBJECT
00024 
00025         enum CASourceViewPortType {
00026                 LilyPond,
00027                 CanorusML
00028         };
00029 
00030 public:
00031         CASourceViewPort(CADocument *doc, QWidget *parent=0);
00032         CASourceViewPort(CAVoice *voice, QWidget *parent=0);
00033         CASourceViewPort(CALyricsContext *lc, QWidget *parent=0);
00034         virtual ~CASourceViewPort();
00035 
00036         CASourceViewPort *clone();
00037         CASourceViewPort *clone(QWidget *parent);
00038 
00039         inline CASourceViewPortType sourceViewPortType() { return _sourceViewPortType; }
00040         inline void setSourceViewPortType( CASourceViewPortType t ) { _sourceViewPortType = t; }
00041 
00042         inline CADocument *document() { return _document; };
00043         inline CAVoice *voice() { return _voice; }
00044         inline CALyricsContext *lyricsContext() { return _lyricsContext; }
00045         inline void setDocument( CADocument *doc ) { _document = doc; }
00046         inline void setVoice( CAVoice *voice ) { _voice = voice; }
00047         inline void setLyricsContext( CALyricsContext *c ) { _lyricsContext = c; }
00048 
00049         inline void selectAll() { _textEdit->selectAll(); }
00050 signals:
00051         void CACommit( QString documentString );
00052 
00053 public slots:
00054         void rebuild();
00055 
00056 private slots:
00057         void on_commit_clicked();
00058 
00059 private:
00060         void setupUI();
00061 
00062         class CATextEdit;
00063         friend class CASourceViewPort::CATextEdit;
00064 
00066         // Widgets //
00068         QTextEdit *_textEdit;
00069         QPushButton *_commit;
00070         QPushButton *_revert;
00071         QGridLayout *_layout;
00072 
00074         // Properties //
00076         CASourceViewPortType _sourceViewPortType;
00077         CADocument *_document;
00078         CAVoice *_voice;
00079         CALyricsContext *_lyricsContext;
00080 };
00081 
00082 #endif /* SOURCEVIEWPORT_H_ */