mainwindow.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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 DynTableModel;
  36. class QAction;
  37. class QScrollBar;
  38. class QSlider;
  39. class QToolBar;
  40. class QTabWidget;
  41. class QTextEdit;
  42. class QToolBar;
  43. class QSplitter;
  44. class QComboBox;
  45. class QLabel;
  46. class QLineEdit;
  47. class QTableView;
  48. namespace Ui {
  49. class MainWindow;
  50. }
  51. class MainWindow : public QMainWindow {
  52. Q_OBJECT
  53. public:
  54. explicit MainWindow(QWidget *parent = 0);
  55. ~MainWindow();
  56. bool setController(qtauController &c, qtauSession &s);
  57. private:
  58. Ui::MainWindow *ui;
  59. private:
  60. void updateUndoRedoTexts();
  61. void updateTMap();
  62. signals:
  63. void loadUST(QString fileName);
  64. void saveUST(QString fileName, bool rewrite);
  65. void saveAudio(QString fileName, bool rewrite);
  66. void loadAudio(QString fileName);
  67. void setVolume(int);
  68. public slots:
  69. void onLog(const QString &, ELog);
  70. void updateRecentFileActions();
  71. void onOpenUST();
  72. void onSaveUST();
  73. void onSaveUSTAs();
  74. void notesVScrolled(int);
  75. void notesHScrolled(int);
  76. void vertScrolled(int);
  77. void horzScrolled(int);
  78. void onEditorRMBScrolled(QPoint, QPoint);
  79. void onEditorRequestOffset(QPoint);
  80. void onPianoHeightChanged(int newHeight);
  81. void onNoteEditorWidthChanged(int newWidth);
  82. void onUndo();
  83. void onRedo();
  84. void onDelete();
  85. void onEditMode(bool);
  86. void onGridSnap(bool);
  87. void onQuantizeSelected(int);
  88. void onNotelengthSelected(int);
  89. void dynBtnLClicked();
  90. void dynBtnRClicked();
  91. void onTabSelected(int);
  92. void onZoomed(int);
  93. void onEditorZoomed(int);
  94. void onSingerSelected(int);
  95. void onDocReloaded();
  96. void onDocStatus(bool);
  97. void onUndoStatus(bool);
  98. void onRedoStatus(bool);
  99. void onDocEvent(qtauEvent *);
  100. void onTransportPositionChanged(float pos);
  101. void onMIDIImport();
  102. void onMIDIExport();
  103. void onActionJackTriggered();
  104. void onSelectionChanged();
  105. void markOverlappingNotes(quint64 id1, quint64 id2);
  106. void updateNoteColors();
  107. void meter_barClicked(int bar, tmlabel mode);
  108. void mbe_keyPressHooked(int key);
  109. void voiceListChanged();
  110. protected:
  111. qtauSession *_doc=nullptr;
  112. qtauController *_ctrl=nullptr;
  113. SNoteSetup _ns;
  114. QTabWidget *_tabs=nullptr;
  115. QComboBox *_voiceNameCbo=nullptr;
  116. qtauPiano *_piano;
  117. qtauNoteEditor *_noteEditor=nullptr;
  118. qtauDynDrawer *_drawZone=nullptr;
  119. qtauMeterBar *_meter=nullptr;
  120. MeterBarLineEdit *_mbe=nullptr;
  121. QLabel *_mbl=nullptr;
  122. QAction *_recentFileActs[MAXRECENTFILES];
  123. QWidget *_wavePanel = nullptr; // used to switch its visibility, hidden by default
  124. QWidget *_drawZonePanel = nullptr;
  125. QSplitter *_editorSplitter = nullptr;
  126. //remove
  127. qtauDynLabel *_fgDynLbl = nullptr;
  128. qtauDynLabel *_bgDynLbl = nullptr;
  129. QScrollBar *_hscr=nullptr;
  130. QScrollBar *_vscr=nullptr;
  131. QSlider *_zoom=nullptr;
  132. QComboBox *_singerSelect=nullptr;
  133. QTextEdit *_logpad=nullptr;
  134. QList<QToolBar *> _toolbars;
  135. QTableView* _dynTable;
  136. DynTableModel* _dynTableModel;
  137. void enableToolbars(bool enable = true);
  138. QColor _logTabTextColor;
  139. int _logNewMessages= 0;
  140. bool _logHasErrors = false;
  141. bool _showNewLogNumber = false;
  142. QString _docName;
  143. QString _lastScoreDir;
  144. QString _lastAudioDir;
  145. QString _audioExt;
  146. int _current_bar;
  147. tmlabel _current_mode = TM_ALL;
  148. QMenu *_menuPlugins = nullptr;
  149. void updateSetup();
  150. void dragEnterEvent(QDragEnterEvent *);
  151. void dragMoveEvent(QDragMoveEvent *);
  152. void dropEvent(QDropEvent *);
  153. void closeEvent(QCloseEvent *);
  154. private slots:
  155. void on_actionPhoneme_Transformation_triggered();
  156. void openRecentFile();
  157. void on_actionSave_Last_Play_triggered();
  158. void on_actionMusicXML_triggered();
  159. void on_actionUST_triggered();
  160. void on_actionEdit_Tempo_Time_Signature_triggered();
  161. void on_actionConnect2Jack_triggered();
  162. public:
  163. void addPluginAction(QAction *);
  164. struct selectionRange getSelectionRange();
  165. TempoMap *getTempoMap() {
  166. return _ns.tmap;
  167. }
  168. };
  169. #endif // MAINWINDOW_H