| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef QUTECSOUND_H |
| 24 |
#define QUTECSOUND_H |
| 25 |
|
| 26 |
#include <QtWidgets> |
| 27 |
#ifdef USE_QT_GT_53 |
| 28 |
#include <QQuickWidget> |
| 29 |
#include <QQuickItem> |
| 30 |
#endif |
| 31 |
|
| 32 |
#include <QLocalServer> |
| 33 |
#include <QLocalSocket> |
| 34 |
|
| 35 |
#include "types.h" |
| 36 |
#include "configlists.h" |
| 37 |
|
| 38 |
#include "risset.h" |
| 39 |
|
| 40 |
#ifdef MACOSX_PRE_SNOW |
| 41 |
|
| 42 |
#include <Carbon/Carbon.h> |
| 43 |
#endif |
| 44 |
|
| 45 |
#define QCS_USE_NEW_ICON |
| 46 |
|
| 47 |
class QAction; |
| 48 |
class QMenu; |
| 49 |
class QTextEdit; |
| 50 |
|
| 51 |
class DockHelp; |
| 52 |
class WidgetPanel; |
| 53 |
class Inspector; |
| 54 |
#ifdef QCS_PYTHONQT |
| 55 |
class PythonConsole; |
| 56 |
#endif |
| 57 |
class DockConsole; |
| 58 |
class DebugPanel; |
| 59 |
class OpEntryParser; |
| 60 |
class Options; |
| 61 |
class ConfigLists; |
| 62 |
class DocumentPage; |
| 63 |
class UtilitiesDialog; |
| 64 |
class Curve; |
| 65 |
class GraphicWindow; |
| 66 |
class KeyboardShortcuts; |
| 67 |
class EventDispatcher; |
| 68 |
class EventSheet; |
| 69 |
class CsoundEngine; |
| 70 |
class MidiHandler; |
| 71 |
class MidiLearnDialog; |
| 72 |
class WidgetLayout; |
| 73 |
|
| 74 |
#if defined(QCS_QTHTML) |
| 75 |
class CsoundHtmlView; |
| 76 |
#endif |
| 77 |
|
| 78 |
class CsoundQt:public QMainWindow |
| 79 |
{ |
| 80 |
Q_OBJECT |
| 81 |
|
| 82 |
friend class WidgetPanel; |
| 83 |
friend class FileOpenEater; |
| 84 |
public: |
| 85 |
CsoundQt(QStringList fileNames); |
| 86 |
~CsoundQt(); |
| 87 |
static void utilitiesMessageCallback(CSOUND *csound, |
| 88 |
int , |
| 89 |
const char *fmt, |
| 90 |
va_list args); |
| 91 |
|
| 92 |
|
| 93 |
QString setDocument(int index); |
| 94 |
void insertText(QString text, int index = -1, int section = -1); |
| 95 |
void setCsd(QString text, int index = -1); |
| 96 |
void setFullText(QString text, int index = -1); |
| 97 |
void setOrc(QString text, int index = -1); |
| 98 |
void setSco(QString text, int index = -1); |
| 99 |
void setWidgetsText(QString text, int index = -1); |
| 100 |
void setPresetsText(QString text, int index = -1); |
| 101 |
void setOptionsText(QString text, int index = -1); |
| 102 |
int getDocument(QString name = ""); |
| 103 |
QString getTheme(); |
| 104 |
QString getSelectedText(int index = -1, int section = 0); |
| 105 |
QString getCsd(int index); |
| 106 |
QString getFullText(int index); |
| 107 |
QString getOrc(int index); |
| 108 |
QString getSco(int index); |
| 109 |
QString getWidgetsText(int index); |
| 110 |
QString getSelectedWidgetsText(int index); |
| 111 |
QString getPresetsText(int index); |
| 112 |
QString getOptionsText(int index); |
| 113 |
QString getFileName(int index); |
| 114 |
QString getFilePath(int index); |
| 115 |
|
| 116 |
void setChannelValue(QString channel, double value, int index = -1); |
| 117 |
double getChannelValue(QString channel, int index = -1); |
| 118 |
void setChannelString(QString channel, QString value, int index = -1); |
| 119 |
QString getChannelString(QString channel, int index = -1); |
| 120 |
void setWidgetProperty(QString widgetid, QString property, QVariant value, int index= -1); |
| 121 |
QVariant getWidgetProperty(QString widgetid, QString property, int index= -1); |
| 122 |
QString createNewLabel(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 123 |
QString createNewDisplay(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 124 |
QString createNewScrollNumber(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 125 |
QString createNewLineEdit(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 126 |
QString createNewSpinBox(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 127 |
QString createNewSlider(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 128 |
QString createNewButton(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 129 |
QString createNewKnob(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 130 |
QString createNewCheckBox(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 131 |
QString createNewMenu(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 132 |
QString createNewMeter(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 133 |
QString createNewConsole(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 134 |
QString createNewGraph(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 135 |
QString createNewScope(int x = -1, int y = -1, QString channel = QString(), int index = -1); |
| 136 |
|
| 137 |
|
| 138 |
QStringList getWidgetUuids(int index = -1); |
| 139 |
QStringList listWidgetProperties(QString widgetid, int index = -1); |
| 140 |
bool destroyWidget(QString widgetid, int index = -1); |
| 141 |
void loadPreset(int preSetIndex, int index); |
| 142 |
|
| 143 |
EventSheet* getSheet(int index = -1, int sheetIndex = -1); |
| 144 |
EventSheet* getSheet(int index = -1, QString sheetName = QString()); |
| 145 |
|
| 146 |
CsoundEngine *getEngine(int index = -1); |
| 147 |
OpEntryParser *m_opcodeTree; |
| 148 |
Risset *risset; |
| 149 |
void stkCheck(); |
| 150 |
|
| 151 |
bool startServer(); |
| 152 |
#if defined(QCS_QTHTML) |
| 153 |
void updateHtmlView(); |
| 154 |
#endif |
| 155 |
void changeFontSize(int change); |
| 156 |
|
| 157 |
public slots: |
| 158 |
int loadFile(QString fileName, bool runNow = false); |
| 159 |
int loadFileFromSystem(QString fileName); |
| 160 |
void newFile(); |
| 161 |
bool closeTab(bool forceCloseApp = false, int index = -1); |
| 162 |
bool saveFile(const QString &fileName, bool saveWidgets = true); |
| 163 |
void play(bool realtime = true, int index = -1); |
| 164 |
void runInTerm(bool realtime = true); |
| 165 |
void pause(int index = -1); |
| 166 |
void stop(int index = -1); |
| 167 |
void stopAll(); |
| 168 |
void stopAllOthers(); |
| 169 |
void markStopped(); |
| 170 |
void perfEnded(); |
| 171 |
void render(); |
| 172 |
void record(bool); |
| 173 |
void record(bool, int index); |
| 174 |
void sendEvent(QString eventLine, double delay = 0); |
| 175 |
void sendEvent(int index, QString line, double delay = 0); |
| 176 |
void changePage(int index); |
| 177 |
void pageLeft(); |
| 178 |
void pageRight(); |
| 179 |
void setWidgetTooltipsVisible(bool visible); |
| 180 |
void closeExtraPanels(); |
| 181 |
|
| 182 |
|
| 183 |
void openExample(); |
| 184 |
void openTemplate(); |
| 185 |
void logMessage(QString msg); |
| 186 |
void statusBarMessage(QString message); |
| 187 |
|
| 188 |
void evaluateCsound(QString code = QString()); |
| 189 |
void breakpointReached(); |
| 190 |
void setParsedUDOs(); |
| 191 |
void openExternalBrowser(QUrl url = QUrl()); |
| 192 |
|
| 193 |
void increaseFontSize(); |
| 194 |
void decreaseFontSize(); |
| 195 |
|
| 196 |
|
| 197 |
protected: |
| 198 |
virtual void closeEvent(QCloseEvent *event); |
| 199 |
|
| 200 |
private slots: |
| 201 |
void open(); |
| 202 |
void reload(); |
| 203 |
void openFromAction(); |
| 204 |
void openFromAction(QString fileName); |
| 205 |
void runScriptFromAction(); |
| 206 |
void runScript(QString fileName); |
| 207 |
void createCodeGraph(); |
| 208 |
void closeGraph(); |
| 209 |
bool save(); |
| 210 |
bool saveAs(); |
| 211 |
void createApp(); |
| 212 |
bool saveNoWidgets(); |
| 213 |
void info(); |
| 214 |
|
| 215 |
void copy(); |
| 216 |
void cut(); |
| 217 |
void paste(); |
| 218 |
void undo(); |
| 219 |
void redo(); |
| 220 |
void evaluateSection(); |
| 221 |
void evaluate(QString code = QString()); |
| 222 |
void evaluatePython(QString code = QString()); |
| 223 |
void evaluateString(QString evalCode); |
| 224 |
void setScratchPadMode(bool csdMode); |
| 225 |
void setWidgetEditMode(bool); |
| 226 |
void duplicate(); |
| 227 |
void print(); |
| 228 |
void findReplace(); |
| 229 |
void findString(); |
| 230 |
bool join(bool ask = true); |
| 231 |
void showUtilities(bool); |
| 232 |
void getToIn(); |
| 233 |
void inToGet(); |
| 234 |
void insertMidiControlInstrument(); |
| 235 |
void updateCsladspaText(); |
| 236 |
void updateCabbageText(); |
| 237 |
void saveWidgetsToQml(); |
| 238 |
void setCurrentAudioFile(const QString fileName); |
| 239 |
void openExternalEditor(); |
| 240 |
void openExternalPlayer(); |
| 241 |
void setEditorFocus(); |
| 242 |
void setHelpEntry(); |
| 243 |
void helpForEntry(QString text, bool external=false); |
| 244 |
void setFullScreen(bool full); |
| 245 |
void checkFullScreen(); |
| 246 |
void setEditorFullScreen(bool full); |
| 247 |
void setHtmlFullScreen(bool full); |
| 248 |
void setHelpFullScreen(bool full); |
| 249 |
void setWidgetsFullScreen(bool full); |
| 250 |
void showDebugger(bool show); |
| 251 |
void showVirtualKeyboard(bool show); |
| 252 |
void showTableEditor(bool show); |
| 253 |
void virtualKeyboardActOff(QObject *parent=0); |
| 254 |
void tableEditorActOff(QObject *parent=0); |
| 255 |
void showHtml5Gui(bool show); |
| 256 |
void splitView(bool split); |
| 257 |
void showMidiLearn(); |
| 258 |
void virtualMidiIn(QVariant on, QVariant note, QVariant channel, QVariant velocity); |
| 259 |
void virtualCCIn(int channel, int cc, int value); |
| 260 |
void handleTableSyntax(QString syntax); |
| 261 |
void openManualExample(QString fileName); |
| 262 |
|
| 263 |
void openPdfFile(QString name); |
| 264 |
void openFLOSSManual(); |
| 265 |
void openQuickRef(); |
| 266 |
void openOnlineDocumentation(); |
| 267 |
void showManualOnline(); |
| 268 |
void resetPreferences(); |
| 269 |
void reportBug(); |
| 270 |
void reportCsoundBug(); |
| 271 |
void openShortcutDialog(); |
| 272 |
void downloadManual(); |
| 273 |
void about(); |
| 274 |
void donate(); |
| 275 |
void documentWasModified(bool status=true); |
| 276 |
void configure(); |
| 277 |
void applySettings(); |
| 278 |
void setCurrentOptionsForPage(DocumentPage *p); |
| 279 |
void runUtility(QString flags); |
| 280 |
|
| 281 |
void updateInspector(); |
| 282 |
void updateCurrentPageTask(); |
| 283 |
void markInspectorUpdate(); |
| 284 |
void setDefaultKeyboardShortcuts(); |
| 285 |
void showNoPythonQtWarning(); |
| 286 |
void showOrc(bool); |
| 287 |
void showScore(bool); |
| 288 |
void showOptions(bool); |
| 289 |
void showFileB(bool); |
| 290 |
void showOther(bool); |
| 291 |
void showOtherCsd(bool); |
| 292 |
void showWidgetEdit(bool); |
| 293 |
void toggleLineArea(); |
| 294 |
void toggleParameterMode(); |
| 295 |
void autocomplete(); |
| 296 |
|
| 297 |
void onNewConnection(); |
| 298 |
void onReadyRead(); |
| 299 |
void disableInternalRtMidi(); |
| 300 |
void focusToTab(int tab); |
| 301 |
void ambiguosShortcut(); |
| 302 |
void testAudioSetup(); |
| 303 |
void checkSyntaxMenuAction(); |
| 304 |
void tabMoved(int to, int from); |
| 305 |
void openExamplesFolder(); |
| 306 |
void setLineAndColumn(int line, int column); |
| 307 |
|
| 308 |
DocumentPage *getCurrentDocumentPage() { |
| 309 |
if(curPage >= documentPages.size()) |
| 310 |
return nullptr; |
| 311 |
return documentPages[curPage]; |
| 312 |
} |
| 313 |
void gotoLineDialog(); |
| 314 |
|
| 315 |
#ifdef QCS_DEBUGGER |
| 316 |
void runDebugger(); |
| 317 |
void stopDebugger(); |
| 318 |
void pauseDebugger(); |
| 319 |
void continueDebugger(); |
| 320 |
void addBreakpoint(int line, int instr, int skip); |
| 321 |
void addInstrumentBreakpoint(double instr, int skip); |
| 322 |
void removeBreakpoint(int line, int instr); |
| 323 |
void removeInstrumentBreakpoint(double instr); |
| 324 |
#endif |
| 325 |
private: |
| 326 |
void createActions(); |
| 327 |
void setKeyboardShortcutsList(); |
| 328 |
void connectActions(); |
| 329 |
QString getExamplePath(QString dir); |
| 330 |
void createMenus(); |
| 331 |
void fillExampleMenu(); |
| 332 |
void fillExampleSubmenu(QDir dir, QMenu *m, int depth); |
| 333 |
void fillFileMenu(); |
| 334 |
void fillFavoriteMenu(); |
| 335 |
void fillFavoriteSubMenu(QDir dir, QMenu *m, int depth); |
| 336 |
void fillScriptsMenu(); |
| 337 |
void fillScriptsSubMenu(QDir dir, QMenu *m, int depth); |
| 338 |
void fillEditScriptsSubMenu(QDir dir, QMenu *m, int depth); |
| 339 |
void createToolBars(); |
| 340 |
void createStatusBar(); |
| 341 |
void readSettings(); |
| 342 |
void storeSettings(); |
| 343 |
void writeSettings(QStringList openFiles=QStringList(), int lastIndex = 0); |
| 344 |
void clearSettings(); |
| 345 |
void setToolbarIconSize(int size); |
| 346 |
int execute(QString executable, QString options); |
| 347 |
int startProcess(QString executable, const QStringList &args); |
| 348 |
|
| 349 |
bool makeNewPage(QString fileName, QString text); |
| 350 |
bool loadCompanionFile(const QString &fileName); |
| 351 |
void setCurrentFile(const QString &fileName); |
| 352 |
QString strippedName(const QString &fullFileName); |
| 353 |
QString generateScript(bool realtime = true, QString tempFileName = "", QString executable = ""); |
| 354 |
void getCompanionFileName(); |
| 355 |
void setWidgetPanelGeometry(); |
| 356 |
int isOpen(QString fileName); |
| 357 |
|
| 358 |
QString getSaveFileName(); |
| 359 |
void createQuickRefPdf(); |
| 360 |
void deleteTab(int index = -1); |
| 361 |
void openLogFile(); |
| 362 |
void showNewFormatWarning(); |
| 363 |
void setupEnvironment(); |
| 364 |
void openHtmlHelp(QString fileName, QString entry, bool external); |
| 365 |
|
| 366 |
ConfigLists m_configlists; |
| 367 |
QTabWidget *documentTabs; |
| 368 |
GraphicWindow *m_graphic; |
| 369 |
QVector<DocumentPage *> documentPages; |
| 370 |
Options *m_options; |
| 371 |
DockConsole *m_console; |
| 372 |
DockHelp *helpPanel; |
| 373 |
WidgetPanel *widgetPanel; |
| 374 |
QDockWidget *m_scratchPad; |
| 375 |
#ifdef USE_QT_GT_53 |
| 376 |
QQuickWidget *m_virtualKeyboard, *m_tableEditor; |
| 377 |
QPointer <QQuickWidget> m_virtualKeyboardPointer, m_tableEditorPointer; |
| 378 |
#endif |
| 379 |
#if defined(QCS_QTHTML) |
| 380 |
public: CsoundHtmlView *csoundHtmlView; |
| 381 |
#endif |
| 382 |
private: |
| 383 |
|
| 384 |
Inspector *m_inspector; |
| 385 |
#ifdef QCS_DEBUGGER |
| 386 |
DebugPanel *m_debugPanel; |
| 387 |
CsoundEngine *m_debugEngine; |
| 388 |
#endif |
| 389 |
#ifdef QCS_PYTHONQT |
| 390 |
PythonConsole *m_pythonConsole; |
| 391 |
#endif |
| 392 |
MidiHandler *midiHandler; |
| 393 |
MidiLearnDialog *m_midiLearn; |
| 394 |
QFile logFile; |
| 395 |
QVector<QAction *> m_keyActions; |
| 396 |
QMenu *fileMenu; |
| 397 |
QMenu *recentMenu; |
| 398 |
QMenu *templateMenu; |
| 399 |
QMenu *editMenu; |
| 400 |
QMenu *controlMenu; |
| 401 |
QMenu *viewMenu; |
| 402 |
QMenu *favoriteMenu; |
| 403 |
QMenu *scriptsMenu; |
| 404 |
QMenu *helpMenu; |
| 405 |
|
| 406 |
|
| 407 |
QToolBar *controlToolBar; |
| 408 |
QToolBar *configureToolBar; |
| 409 |
QAction *newAct; |
| 410 |
QAction *openAct; |
| 411 |
QAction *reloadAct; |
| 412 |
QAction *saveAct; |
| 413 |
QAction *saveAsAct; |
| 414 |
QAction *createAppAct; |
| 415 |
QAction *saveNoWidgetsAct; |
| 416 |
QAction *closeTabAct; |
| 417 |
QAction *printAct; |
| 418 |
QAction *createCodeGraphAct; |
| 419 |
QAction *infoAct; |
| 420 |
QAction *exitAct; |
| 421 |
QList<QAction *> openRecentAct; |
| 422 |
QAction *undoAct; |
| 423 |
QAction *redoAct; |
| 424 |
QAction *cutAct; |
| 425 |
QAction *copyAct; |
| 426 |
QAction *pasteAct; |
| 427 |
QAction *duplicateAct; |
| 428 |
QAction *joinAct; |
| 429 |
QAction *evaluateAct; |
| 430 |
QAction *evaluateSectionAct; |
| 431 |
QAction *scratchPadCsdModeAct; |
| 432 |
QAction *getToInAct; |
| 433 |
QAction *inToGetAct; |
| 434 |
QAction *midiControlAct; |
| 435 |
QAction *csladspaAct; |
| 436 |
QAction *cabbageAct; |
| 437 |
QAction *qmlAct; |
| 438 |
QAction *findAct; |
| 439 |
QAction *findAgainAct; |
| 440 |
QAction *configureAct; |
| 441 |
QAction *setShortcutsAct; |
| 442 |
QAction *editAct; |
| 443 |
QAction *runAct; |
| 444 |
QAction *testAudioSetupAct; |
| 445 |
QAction *checkSyntaxAct; |
| 446 |
QAction *runTermAct; |
| 447 |
QAction *pauseAct; |
| 448 |
QAction *stopAct; |
| 449 |
QAction *stopAllAct; |
| 450 |
QAction *recAct; |
| 451 |
QAction *renderAct; |
| 452 |
QAction *externalEditorAct; |
| 453 |
QAction *externalPlayerAct; |
| 454 |
QAction *focusEditorAct; |
| 455 |
QAction *showHelpAct; |
| 456 |
QAction *raiseHelpAct; |
| 457 |
QAction *showManualAct; |
| 458 |
QAction *showManualOnlineAct; |
| 459 |
QAction *downloadManualAct; |
| 460 |
QAction *showGenAct; |
| 461 |
QAction *showOverviewAct; |
| 462 |
QAction *showOpcodeQuickRefAct; |
| 463 |
QAction *showConsoleAct; |
| 464 |
QAction *raiseConsoleAct; |
| 465 |
QAction *viewFullScreenAct; |
| 466 |
QAction *viewEditorFullScreenAct; |
| 467 |
QAction *viewHtmlFullScreenAct; |
| 468 |
QAction *viewHelpFullScreenAct; |
| 469 |
QAction *viewWidgetsFullScreenAct; |
| 470 |
#ifdef QCS_DEBUGGER |
| 471 |
QAction *showDebugAct; |
| 472 |
#endif |
| 473 |
QAction *showVirtualKeyboardAct; |
| 474 |
QAction *showTableEditorAct; |
| 475 |
#if defined(QCS_QTHTML) |
| 476 |
QAction *showHtml5Act; |
| 477 |
QAction *raiseHtml5Act; |
| 478 |
#endif |
| 479 |
QAction *midiLearnAct; |
| 480 |
QAction *splitViewAct; |
| 481 |
QAction *showOrcAct; |
| 482 |
QAction *showScoreAct; |
| 483 |
QAction *showOptionsAct; |
| 484 |
QAction *showFileBAct; |
| 485 |
QAction *showOtherAct; |
| 486 |
QAction *showOtherCsdAct; |
| 487 |
QAction *showWidgetEditAct; |
| 488 |
QAction *setHelpEntryAct; |
| 489 |
QAction *browseBackAct; |
| 490 |
QAction *browseForwardAct; |
| 491 |
QAction *externalBrowserAct; |
| 492 |
QAction *openQuickRefAct; |
| 493 |
QAction *openDocumentationAct; |
| 494 |
QAction *showUtilitiesAct; |
| 495 |
QAction *showWidgetsAct; |
| 496 |
QAction *raiseWidgetsAct; |
| 497 |
|
| 498 |
QAction *showInspectorAct; |
| 499 |
QAction *raiseInspectorAct; |
| 500 |
QAction *showLiveEventsAct; |
| 501 |
QAction *showPythonConsoleAct; |
| 502 |
QAction *raisePythonConsoleAct; |
| 503 |
QAction *showScratchPadAct; |
| 504 |
QAction *raiseScratchPadAct; |
| 505 |
QAction *commentAct; |
| 506 |
|
| 507 |
QAction *indentAct; |
| 508 |
QAction *unindentAct; |
| 509 |
QAction *killLineAct; |
| 510 |
QAction *killToEndAct; |
| 511 |
QAction *gotoLineAct; |
| 512 |
QAction *goBackAct; |
| 513 |
QAction *aboutAct; |
| 514 |
QAction *donateAct; |
| 515 |
|
| 516 |
QAction *resetPreferencesAct; |
| 517 |
QAction *reportBugAct; |
| 518 |
QAction *reportCsoundBugAct; |
| 519 |
QAction *lineNumbersAct; |
| 520 |
QAction *parameterModeAct; |
| 521 |
QAction *autocompleteAct; |
| 522 |
|
| 523 |
QAction *openExamplesFolderAct; |
| 524 |
QSignalMapper *focusMapper; |
| 525 |
int curPage; |
| 526 |
int curCsdPage; |
| 527 |
int configureTab; |
| 528 |
QString lastUsedDir; |
| 529 |
QString lastFileDir; |
| 530 |
QString quickRefFileName; |
| 531 |
QStringList recentFiles; |
| 532 |
QStringList lastFiles; |
| 533 |
QStringList tempScriptFiles; |
| 534 |
int lastTabIndex; |
| 535 |
bool m_resetPrefs; |
| 536 |
bool m_inspectorNeedsUpdate; |
| 537 |
bool m_closing; |
| 538 |
UtilitiesDialog *utilitiesDialog; |
| 539 |
QIcon modIcon; |
| 540 |
QString currentAudioFile; |
| 541 |
QString initialDir; |
| 542 |
QMutex closemutex; |
| 543 |
QLocalServer * m_server; |
| 544 |
#ifdef MACOSX_PRE_SNOW |
| 545 |
MenuBarHandle menuBarHandle; |
| 546 |
#endif |
| 547 |
QByteArray m_preFullScreenState; |
| 548 |
QString m_fullScreenComponent; |
| 549 |
QDir m_rissetDataPath; |
| 550 |
bool isDarkPalette; |
| 551 |
QStringList m_longOptions = { |
| 552 |
"--syntax-check-only", "--control-rate=", "--messagelevel=", |
| 553 |
"--env:", "--dither", "--sched", "--omacro:", "--smacro:", |
| 554 |
"--verbose", "--sample-accurate", "--realtime", |
| 555 |
"--nchnls=", "--nchnls_i=", "--sinesize", "--daemon", |
| 556 |
"--port=", "--use-system-sr", "--ksmps=", |
| 557 |
"--limiter", "--udp-echo", "--opcode-dir=", "-+rtmidi", "-+rtaudio", |
| 558 |
"--format" |
| 559 |
}; |
| 560 |
QLabel *lineAndColumnLabel; |
| 561 |
}; |
| 562 |
|
| 563 |
class FileOpenEater : public QObject |
| 564 |
{ |
| 565 |
Q_OBJECT |
| 566 |
public: |
| 567 |
FileOpenEater() {m_mw = 0;} |
| 568 |
void setMainWindow(CsoundQt *mainWindow) { |
| 569 |
m_mw = mainWindow; |
| 570 |
while (!fileEventQueue.isEmpty()) { |
| 571 |
QString fileName = fileEventQueue.takeFirst(); |
| 572 |
qDebug() << "FileOpenEater::setMainWindow opening file" << fileName << ENDL; |
| 573 |
m_mw->loadFileFromSystem(fileName); |
| 574 |
} |
| 575 |
} |
| 576 |
QStringList fileEventQueue; |
| 577 |
protected: |
| 578 |
bool eventFilter(QObject *obj, QEvent *event) |
| 579 |
{ |
| 580 |
if (event->type() == QEvent::FileOpen) { |
| 581 |
QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event); |
| 582 |
if (m_mw == 0) { |
| 583 |
fileEventQueue << fileEvent->file(); |
| 584 |
} |
| 585 |
else { |
| 586 |
m_mw->loadFileFromSystem(fileEvent->file()); |
| 587 |
} |
| 588 |
qDebug() << "FileOpenEater::eventFilter " << fileEvent->file(); |
| 589 |
return true; |
| 590 |
} else { |
| 591 |
|
| 592 |
return QObject::eventFilter(obj, event); |
| 593 |
} |
| 594 |
} |
| 595 |
|
| 596 |
CsoundQt *m_mw; |
| 597 |
}; |
| 598 |
|
| 599 |
#endif |