mainwindow.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. This file is part of QTau
  3. Copyright (C) 2013-2018 Tobias "Tomoko" Platen <tplaten@posteo.de>
  4. Copyright (C) 2013 digited <https://github.com/digited>
  5. Copyright (C) 2010-2013 HAL@ShurabaP <https://github.com/haruneko>
  6. QTau is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. SPDX-License-Identifier: GPL-3.0+
  17. */
  18. #ifndef MAINWINDOW_H
  19. #define MAINWINDOW_H
  20. #include <QMainWindow>
  21. #include <QUrl>
  22. #include "PluginInterfaces.h"
  23. #include "Utils.h"
  24. #include "tempomap.h"
  25. class qtauController;
  26. class qtauSession;
  27. class qtauEvent;
  28. class qtauPiano;
  29. class qtauNoteEditor;
  30. class qtauMeterBar;
  31. class qtauDynDrawer;
  32. class qtauDynLabel;
  33. class qtauWaveform;
  34. class MeterBarLineEdit;
  35. class QAction;
  36. class QScrollBar;
  37. class QSlider;
  38. class QToolBar;
  39. class QTabWidget;
  40. class QTextEdit;
  41. class QToolBar;
  42. class QSplitter;
  43. class QComboBox;
  44. class QLabel;
  45. class QLineEdit;
  46. namespace Ui {
  47. class MainWindow;
  48. }
  49. class MainWindow : public QMainWindow
  50. {
  51. Q_OBJECT
  52. public:
  53. explicit MainWindow(QWidget *parent = 0);
  54. ~MainWindow();
  55. bool setController(qtauController &c, qtauSession &s);
  56. private:
  57. Ui::MainWindow *ui;
  58. private:
  59. void updateUndoRedoTexts();
  60. void updateTMap();
  61. signals:
  62. void loadUST (QString fileName);
  63. void saveUST (QString fileName, bool rewrite);
  64. void saveAudio(QString fileName, bool rewrite);
  65. void loadAudio(QString fileName);
  66. void setVolume(int);
  67. public slots:
  68. void onLog(const QString&, ELog);
  69. void updateRecentFileActions();
  70. void onOpenUST();
  71. void onSaveUST();
  72. void onSaveUSTAs();
  73. void notesVScrolled(int);
  74. void notesHScrolled(int);
  75. void vertScrolled(int);
  76. void horzScrolled(int);
  77. void onEditorRMBScrolled(QPoint, QPoint);
  78. void onEditorRequestOffset(QPoint);
  79. void onPianoHeightChanged (int newHeight);
  80. void onNoteEditorWidthChanged(int newWidth);
  81. void onUndo();
  82. void onRedo();
  83. void onDelete();
  84. void onEditMode(bool);
  85. void onGridSnap(bool);
  86. void onQuantizeSelected(int);
  87. void onNotelengthSelected(int);
  88. void dynBtnLClicked();
  89. void dynBtnRClicked();
  90. void onTabSelected(int);
  91. void onZoomed(int);
  92. void onEditorZoomed(int);
  93. void onSingerSelected(int);
  94. void onDocReloaded();
  95. void onDocStatus(bool);
  96. void onUndoStatus(bool);
  97. void onRedoStatus(bool);
  98. void onDocEvent(qtauEvent*);
  99. void onTransportPositionChanged(float pos);
  100. void onMIDIImport();
  101. void onMIDIExport();
  102. void onActionJackTriggered();
  103. void markOverlappingNotes(quint64 id1,quint64 id2);
  104. void updateNoteColors();
  105. void meter_barClicked(int bar, tmlabel mode);
  106. void mbe_keyPressHooked(int key);
  107. protected:
  108. qtauSession *_doc;
  109. qtauController *_ctrl;
  110. SNoteSetup _ns;
  111. QTabWidget *_tabs;
  112. QComboBox* _voiceNameCbo;
  113. qtauPiano *_piano;
  114. qtauNoteEditor *_noteEditor;
  115. qtauDynDrawer *_drawZone;
  116. qtauMeterBar *_meter;
  117. MeterBarLineEdit* _mbe;
  118. QLabel* _mbl;
  119. QAction* _recentFileActs[MAXRECENTFILES];
  120. QWidget *_wavePanel; // used to switch its visibility, hidden by default
  121. QWidget *_drawZonePanel;
  122. QSplitter *_editorSplitter;
  123. qtauDynLabel *_fgDynLbl;
  124. qtauDynLabel *_bgDynLbl;
  125. QScrollBar *_hscr;
  126. QScrollBar *_vscr;
  127. QSlider *_zoom;
  128. QComboBox* _singerSelect;
  129. QTextEdit *_logpad;
  130. QList<QToolBar*> _toolbars;
  131. void enableToolbars(bool enable = true);
  132. QColor _logTabTextColor;
  133. int _logNewMessages;
  134. bool _logHasErrors;
  135. bool _showNewLogNumber;
  136. QString _docName;
  137. QString _lastScoreDir;
  138. QString _lastAudioDir;
  139. QString _audioExt;
  140. int _current_bar;
  141. tmlabel _current_mode=TM_ALL;
  142. QMenu* _menuPlugins;
  143. void updateSetup();
  144. void dragEnterEvent (QDragEnterEvent*);
  145. void dragMoveEvent (QDragMoveEvent *);
  146. void dropEvent (QDropEvent *);
  147. void closeEvent (QCloseEvent *);
  148. private slots:
  149. void on_actionPhoneme_Transformation_triggered();
  150. void openRecentFile();
  151. void on_actionSave_Last_Play_triggered();
  152. void on_actionMusicXML_triggered();
  153. void on_actionUST_triggered();
  154. void on_actionEdit_Tempo_Time_Signature_triggered();
  155. public:
  156. void addPluginAction(QAction*);
  157. struct selectionRange getSelectionRange();
  158. TempoMap* getTempoMap(){return _ns.tmap;}
  159. };
  160. #endif // MAINWINDOW_H