mainwindow.h 4.6 KB

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