EditorWindowWidget::EditorWindowWidget(QWidget *parent) : QWidget(parent), ui(new Ui::EditorWindowWidget) { ui->setupUi(this); connect(ui->plainTextEdit, SIGNAL(canRun(bool)), this, SIGNAL(canRun(bool))); connect(ui->plainTextEdit, SIGNAL(sourceCodeChanged(QString)), this, SIGNAL(sourceCodeChanged(QString))); connect(ui->plainTextEdit, SIGNAL(markovAlgorithmChanged(MarkovAlgorithm)), this, SIGNAL(markovAlgorithmChanged(MarkovAlgorithm))); connect(ui->plainTextEdit, SIGNAL(redoAvailable(bool)), this, SIGNAL(redoAvailable(bool))); connect(ui->plainTextEdit, SIGNAL(undoAvailable(bool)), this, SIGNAL(undoAvailable(bool))); connect(ui->plainTextEdit, SIGNAL(copyAvailable(bool)), this, SIGNAL(copyAvailable(bool))); connect(ui->plainTextEdit, SIGNAL(breakPointAdded(int)), this, SIGNAL(breakPointAdded(int))); connect(ui->plainTextEdit, SIGNAL(breakPointRemoved(int)), this, SIGNAL(breakPointRemoved(int))); connect(ui->plainTextEdit, SIGNAL(lineFocusWithError(int,CompilerError)), ui->widget, SLOT(lineWithErrorFocus(int, CompilerError))); connect(ui->plainTextEdit, SIGNAL(lineFocusWithoutError(int)), ui->widget, SLOT(lineWithoutErrorFocus(int))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { undoStack = new QUndoStack(this); createActions(); createMenus(); createToolBars(); createStatusBar(); createCentralWidget(); createDockWindows(); #ifndef QT_NO_DEBUG createUndoView(); #endif connect(pipelineWidget, SIGNAL(sourceCodeChanged(QString)), codeWidget, SLOT(setPlainText(QString))); connect(pipelineWidget, SIGNAL(outputPixmapChanged(QPixmap)), imageWidget, SLOT(updatePixmap(QPixmap))); setWindowTitle("Prototyping Toolkit for Image Processing"); loadImageFile(":/Images/lena.jpg"); resize(QGuiApplication::primaryScreen()->availableSize() * 3 / 5); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , showMessageTimout(3000) { createActions(); createMenus(); createToolBars(); createStatusBar(); createCentralWidget(); createDockWindows(); connect(pipelineWidget, SIGNAL(sourceCodeChanged(QString)), codeWidget, SLOT(setPlainText(QString))); connect(pipelineWidget, SIGNAL(outputPixmapChanged(QPixmap)), imageWidget, SLOT(updatePixmap(QPixmap))); setWindowTitle("Prototyping Toolkit for Image Processing"); loadImageFile(":/Images/lena.jpg"); resize(QGuiApplication::primaryScreen()->availableSize() * 3 / 5); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), _has_unsaved_data(true), _current_file(""), _can_run(false), _is_running(false), _is_debug_input(false) { ui->setupUi(this); initStyles(); updateWindowTitle(); redoAvailable(false); undoAvailable(false); copyAvailable(false); _window = this; ui->debugRun->setVisible(false); ui->runWidget->setVisible(false); registerFileType(tr("Yad.Markov.File"), tr("Markov Algorithm File"), ".yad", 1); updateDebugMenu(); //Connect MainWindow menu connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionUndo, SIGNAL(triggered()), this, SIGNAL(undo())); connect(ui->actionRedo, SIGNAL(triggered()), this, SIGNAL(redo())); connect(ui->actionSelect_All, SIGNAL(triggered()), this, SIGNAL(selectAll())); connect(ui->actionCopy, SIGNAL(triggered()), this, SIGNAL(copy())); connect(ui->actionPaste, SIGNAL(triggered()), this, SIGNAL(paste())); connect(ui->actionCut, SIGNAL(triggered()), this, SIGNAL(cut())); connect(ui->actionDelete, SIGNAL(triggered()), this, SIGNAL(deleteSelection())); connect(ui->actionNew, SIGNAL(triggered()), this, SIGNAL(newFile())); connect(ui->actionOpen, SIGNAL(triggered()), this, SIGNAL(open())); connect(ui->actionSave, SIGNAL(triggered()), this, SIGNAL(save())); connect(ui->actionSave_As, SIGNAL(triggered()), this, SIGNAL(saveAs())); connect(ui->actionTutorial, SIGNAL(triggered()), this, SLOT(tutorial())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); //Connect InputWidget and HistoryManager HistoryManager* history_manager = HistoryManager::getInstance(); connect(ui->input, SIGNAL(addToHistory(QString)), history_manager, SLOT(addToHistory(QString))); connect(history_manager, SIGNAL(wordSelected(QString)), ui->input, SLOT(setInput(QString))); //Connect HistoryWidget and HistoryManager connect(ui->history, SIGNAL(inputWordSelected(QString)), history_manager, SIGNAL(wordSelected(QString))); connect(ui->history, SIGNAL(removeFromHistory(QString)), history_manager, SLOT(removeFromHistory(QString))); connect(history_manager, SIGNAL(historyChanged(QVector<QString>)), ui->history, SLOT(historyChanged(QVector<QString>))); //Connect MainWindows and FileManager FileManager* file_manager = FileManager::getInstance(); connect(this, SIGNAL(newFile()), file_manager, SLOT(newFile())); connect(this, SIGNAL(open()), file_manager, SLOT(open())); connect(this, SIGNAL(save()), file_manager, SLOT(save())); connect(this, SIGNAL(saveAs()), file_manager, SLOT(saveAs())); connect(file_manager, SIGNAL(hasUnsavedData(bool)), this, SLOT(hasUnsavedData(bool))); connect(file_manager, SIGNAL(fileNameChanged(QString)), this, SLOT(fileNameChanged(QString))); //Connect MainWindows and EditorWindowWidget connect(this, SIGNAL(undo()), ui->editorWindow, SLOT(undo())); connect(this, SIGNAL(redo()), ui->editorWindow, SLOT(redo())); connect(this, SIGNAL(selectAll()), ui->editorWindow, SLOT(selectAll())); connect(this, SIGNAL(copy()), ui->editorWindow, SLOT(copy())); connect(this, SIGNAL(paste()), ui->editorWindow, SLOT(paste())); connect(this, SIGNAL(cut()), ui->editorWindow, SLOT(cut())); connect(this, SIGNAL(deleteSelection()), ui->editorWindow, SLOT(deleteSelection())); connect(ui->editorWindow, SIGNAL(redoAvailable(bool)), this, SLOT(redoAvailable(bool))); connect(ui->editorWindow, SIGNAL(undoAvailable(bool)), this, SLOT(undoAvailable(bool))); connect(ui->editorWindow, SIGNAL(copyAvailable(bool)), this, SLOT(copyAvailable(bool))); //Connect InputWidget and MarkovRunManager MarkovRunManager* run_manager = MarkovRunManager::getInstance(); connect(ui->input, SIGNAL(run(QString)), run_manager, SLOT(runWithoutDebug(QString))); connect(ui->input, SIGNAL(runWithDebug(QString)), run_manager, SLOT(runWithDebug(QString))); connect(run_manager, SIGNAL(runWithoutDebugStarted(QString)), ui->input, SLOT(runStarted())); connect(ui->input, SIGNAL(runWithDebugStepByStep(QString)), run_manager, SLOT(runWithDebugStepByStep(QString))); connect(run_manager, SIGNAL(debugStarted(QString)), ui->input, SLOT(runStarted())); connect(run_manager, SIGNAL(runWithoutDebugFinishFail(QString,RunError,int)), ui->input, SLOT(runFinished())); connect(run_manager, SIGNAL(runWithoutDebugFinishSuccess(QString,QString,int)), ui->input, SLOT(runFinished())); connect(run_manager, SIGNAL(debugFinishFail(QString,RunError,int)), ui->input, SLOT(runFinished())); connect(run_manager, SIGNAL(debugFinishSuccess(QString,QString,int)), ui->input, SLOT(runFinished())); connect(run_manager, SIGNAL(canRunSourceCode(bool)), ui->input, SLOT(canRunAlgorithm(bool))); //Connect SourceCodeManager and EditorWindowWidget SourceCodeManager* source_manager = SourceCodeManager::getInstance(); connect(source_manager, SIGNAL(newSourceCodeWasLoaded(QString)), ui->editorWindow, SLOT(newSourceCode(QString))); connect(ui->editorWindow, SIGNAL(sourceCodeChanged(QString)), source_manager, SLOT(setSourceCode(QString))); //Connect InputWidget and FileManager connect(ui->input, SIGNAL(save()), file_manager, SLOT(save())); //Connect MarkovRunManager and EditorWindowWidget connect(ui->editorWindow, SIGNAL(canRun(bool)), run_manager, SLOT(setCanRunSourceCode(bool))); connect(ui->editorWindow, SIGNAL(markovAlgorithmChanged(MarkovAlgorithm)), run_manager, SLOT(setAlgorithm(MarkovAlgorithm))); //Connect SourceCodeManager and FileManager connect(file_manager, SIGNAL(newSourceCodeLoaded(QString)), source_manager, SLOT(setNewSourceCodeFromFile(QString))); connect(source_manager, SIGNAL(sourceCodeChanged(QString)), file_manager, SLOT(sourceCodeChanged())); //Connect FileManager and HistoryManager connect(file_manager, SIGNAL(newHistoryLoaded(QVector<QString>)), this, SLOT(newHistoryLoaded(QVector<QString>))); connect(history_manager, SIGNAL(historyChanged(QVector<QString>)), file_manager, SLOT(historyChanged())); //Connect RunWidget and MarkovRunManager connect(run_manager, SIGNAL(runWithoutDebugStarted(QString)), ui->runWidget, SLOT(runStarted(QString))); connect(run_manager, SIGNAL(runStepsMade(int)), ui->runWidget, SLOT(runStepsMade(int))); connect(run_manager, SIGNAL(runWithoutDebugFinishFail(QString,RunError,int)), ui->runWidget, SLOT(runFailed(QString,RunError,int))); connect(run_manager, SIGNAL(runWithoutDebugFinishSuccess(QString,QString,int)), ui->runWidget, SLOT(runSuccess(QString,QString,int))); connect(run_manager, SIGNAL(debugStarted(QString)), ui->runWidget, SLOT(hide())); //Connect DebugRunWidget and MarkovRunManager connect(ui->debugRun, SIGNAL(nextStepClicked()), run_manager, SLOT(debugNextStep())); connect(ui->debugRun, SIGNAL(continueClicked()), run_manager, SLOT(debugContinue())); connect(ui->debugRun, SIGNAL(stopClicked()), run_manager, SLOT(debugStop())); connect(run_manager, SIGNAL(debugStarted(QString)), ui->debugRun, SLOT(debugStarted(QString))); connect(run_manager, SIGNAL(debugFinishSuccess(QString,QString,int)), ui->debugRun, SLOT(debugSuccess(QString,QString,int))); connect(run_manager, SIGNAL(debugFinishFail(QString,RunError,int)), ui->debugRun, SLOT(debugFailed(QString,RunError,int))); connect(run_manager, SIGNAL(debugStepFinished(int,QString,QString,MarkovRule)), ui->debugRun, SLOT(debugStepFinished(int,QString,QString,MarkovRule))); connect(run_manager, SIGNAL(debugBreakPointReached(int)), ui->debugRun, SLOT(breakPointReached(int))); connect(run_manager, SIGNAL(runWithoutDebugStarted(QString)), ui->debugRun, SLOT(hide())); connect(run_manager, SIGNAL(debugFinishFail(QString,RunError,int)), ui->runWidget, SLOT(hide())); connect(run_manager, SIGNAL(runWithoutDebugFinishFail(QString,RunError,int)), ui->debugRun, SLOT(hide())); //Connect DebugRunWidget and EditorWindowWidget connect(ui->debugRun, SIGNAL(removeBreakPoint()), ui->editorWindow, SLOT(removeLineHighlight())); connect(ui->debugRun, SIGNAL(showBreakPoint(int)), ui->editorWindow, SLOT(showLineHighlight(int))); //Connect MarkovRunManager and EditorWindowWidget connect(ui->editorWindow, SIGNAL(breakPointAdded(int)), run_manager, SLOT(addBreakPoint(int))); connect(ui->editorWindow, SIGNAL(breakPointRemoved(int)), run_manager, SLOT(removeBreakPoint(int))); //Connect top menu connect(run_manager, SIGNAL(runWithoutDebugStarted(QString)), this, SLOT(runStarted())); connect(run_manager, SIGNAL(debugStarted(QString)), this, SLOT(runStarted())); connect(run_manager, SIGNAL(runWithoutDebugFinishFail(QString,RunError,int)), this, SLOT(runFinished())); connect(run_manager, SIGNAL(runWithoutDebugFinishSuccess(QString,QString,int)), this, SLOT(runFinished())); connect(run_manager, SIGNAL(debugFinishFail(QString,RunError,int)), this, SLOT(runFinished())); connect(run_manager, SIGNAL(debugFinishSuccess(QString,QString,int)), this, SLOT(runFinished())); connect(run_manager, SIGNAL(canRunSourceCode(bool)), this, SLOT(canRunAlgorithm(bool))); connect(run_manager, SIGNAL(debugBreakPointReached(int)), this, SLOT(debugInputStarted())); connect(run_manager, SIGNAL(debugStepFinished(int,QString,QString,MarkovRule)), this, SLOT(debugInputFinished())); connect(ui->actionRun, SIGNAL(triggered()), ui->input, SLOT(runCliked())); connect(ui->actionDebug, SIGNAL(triggered()), ui->input, SLOT(runWithDebugClicked())); connect(ui->actionNext_Step, SIGNAL(triggered()), run_manager, SLOT(debugNextStep())); connect(ui->actionContinue, SIGNAL(triggered()), run_manager, SLOT(debugContinue())); connect(ui->actionStop_Debug, SIGNAL(triggered()), run_manager, SLOT(debugStop())); connect(ui->actionDebug_Step_By_Step, SIGNAL(triggered()), ui->input, SLOT(runWithDebugStepByStepClicked())); //Read file to open from command line QStringList arguments = QCoreApplication::arguments(); if(arguments.size() >= 2) { QString file_name = arguments.at(1); FileManager::getInstance()->openFile(file_name); } else { source_manager->setNewSourceCodeFromFile(tr("//Alphabet\nT = {a, b}\n\n//Rules\nab -> a\na ->. b")); } }