void QWzmViewer::actionSaveAs() { if (psModel) { filename = QFileDialog::getSaveFileName(this, tr("Choose output file"), QString::null, tr("All Compatible (*.wzm *.pie);;WZM (*.wzm);;PIE (*.pie)")); ui->actionSave->setEnabled(true); fileNameLabel->setText(QFileInfo(filename).fileName()); fileNameLabel->setToolTip(filename); actionSave(); } }
void BaseEditor::bindDocument(IDocument* doc) { if (!doc) { return; } auto updateObjectHandleCheckoutCallback = [this](const ObjectHandle& handle) {updateCheckoutState(handle);}; pImpl_->connections_.add(doc->connectUpdateEditState(updateObjectHandleCheckoutCallback)); auto updateFileCheckoutCallback = [this](const char* filePath) {updateCheckoutState(filePath); }; pImpl_->connections_.add(doc->connectUpdateEditState(updateFileCheckoutCallback)); pImpl_->connections_.add(doc->connectSave([this](const IDocument*) {actionSave(); })); pImpl_->connections_.add(doc->connectAssetDropped([this](const std::vector<std::string>& assetPaths) { onAssetsDropped(assetPaths); })); pImpl_->connections_.add(doc->connectClose([this]() { clearCheckoutState(); onClose(); })); }
SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : QMainWindow(parent) , fCentralSplitter(this) , fStatusBar(this) , fToolBar(this) , fActionOpen(this) , fActionBreakpoint(this) , fActionToggleIndexStyle(this) , fActionProfile(this) , fActionCancel(this) , fActionClearBreakpoints(this) , fActionClearDeletes(this) , fActionClose(this) , fActionCreateBreakpoint(this) , fActionDelete(this) , fActionDirectory(this) , fActionGoToLine(this) , fActionInspector(this) , fActionSettings(this) , fActionPlay(this) , fActionPause(this) , fActionRewind(this) , fActionSave(this) , fActionSaveAs(this) , fActionShowDeletes(this) , fActionStepBack(this) , fActionStepForward(this) , fActionZoomIn(this) , fActionZoomOut(this) , fMapper(this) , fListWidget(&fCentralSplitter) , fDirectoryWidget(&fCentralSplitter) , fCanvasWidget(this, &fDebugger) , fImageWidget(&fDebugger) , fMenuBar(this) , fMenuFile(this) , fMenuNavigate(this) , fMenuView(this) , fBreakpointsActivated(false) , fIndexStyleToggle(false) , fDeletesActivated(false) , fPause(false) , fLoading(false) { setupUi(this); fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection); connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(registerListClick(QListWidgetItem *))); connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile())); connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory())); connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(loadFile(QListWidgetItem *))); connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete())); connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleBreakpoint())); connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind())); connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay())); connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())); connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForward())); connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoints())); connect(&fActionToggleIndexStyle, SIGNAL(triggered()), this, SLOT(actionToggleIndexStyle())); connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector())); connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings())); connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString))); connect(&fActionProfile, SIGNAL(triggered()), this, SLOT(actionProfile())); connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel())); connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClearBreakpoints())); connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes())); connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); connect(&fSettingsWidget, SIGNAL(visibilityFilterChanged()), this, SLOT(actionCommandFilter())); #if SK_SUPPORT_GPU connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLWidget())); #endif connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(actionTextureFilter())); connect(fSettingsWidget.getRasterCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionRasterWidget(bool))); connect(fSettingsWidget.getOverdrawVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionOverdrawVizWidget(bool))); connect(fSettingsWidget.getMegaVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionMegaVizWidget(bool))); connect(fSettingsWidget.getPathOpsCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionPathOpsWidget(bool))); connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool))); connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint())); connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(int))); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), &fSettingsWidget, SLOT(updateHit(int))); connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(actionScale(float))); connect(&fCanvasWidget, SIGNAL(commandChanged(int)), &fSettingsWidget, SLOT(updateCommand(int))); connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); fInspectorWidget.setDisabled(true); fMenuEdit.setDisabled(true); fMenuNavigate.setDisabled(true); fMenuView.setDisabled(true); SkGraphics::Init(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MainWindow), m_materialDock(new MaterialDock(this)), m_transformDock(new TransformDock(this)), m_meshDock(new MeshDock(this)), m_textureDialog(new TextureDialog(this)), m_UVEditor(new UVEditor(this)), m_settings(new QSettings(this)), m_shaderSignalMapper(new QSignalMapper(this)), m_actionEnableUserShaders(nullptr), m_actionLocateUserShaders(nullptr), m_actionReloadUserShaders(nullptr) { m_ui->setupUi(this); m_pathImport = m_settings->value(WMIT_SETTINGS_IMPORTVAL, QDir::currentPath()).toString(); m_pathExport = m_settings->value(WMIT_SETTINGS_EXPORTVAL, QDir::currentPath()).toString(); m_materialDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); m_materialDock->hide(); m_transformDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); m_transformDock->hide(); m_meshDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); m_meshDock->hide(); m_UVEditor->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); m_UVEditor->hide(); addDockWidget(Qt::RightDockWidgetArea, m_materialDock, Qt::Horizontal); addDockWidget(Qt::RightDockWidgetArea, m_transformDock, Qt::Horizontal); addDockWidget(Qt::RightDockWidgetArea, m_meshDock, Qt::Horizontal); addDockWidget(Qt::LeftDockWidgetArea, m_UVEditor, Qt::Horizontal); // UI is ready and now we can load window previous state (will do nothing if state wasn't saved). // 3DView specifics are loaded later on viewerInitialized event resize(QSettings().value("Window/size", size()).toSize()); move(QSettings().value("Window/position", pos()).toPoint()); restoreState(QSettings().value("Window/state", QByteArray()).toByteArray()); m_ui->actionOpen->setIcon(QIcon::fromTheme("document-open", style()->standardIcon(QStyle::SP_DirOpenIcon))); m_ui->menuOpenRecent->setIcon(QIcon::fromTheme("document-open-recent")); m_ui->actionClearRecentFiles->setIcon(QIcon::fromTheme("edit-clear-list")); m_ui->actionSave->setIcon(QIcon::fromTheme("document-save", style()->standardIcon(QStyle::SP_DialogSaveButton))); m_ui->actionSaveAs->setIcon(QIcon::fromTheme("document-save-as")); m_ui->actionClose->setIcon(QIcon::fromTheme("window-close")); m_ui->actionExit->setIcon(QIcon::fromTheme("application-exit", style()->standardIcon(QStyle::SP_DialogCloseButton))); m_ui->actionAboutApplication->setIcon(QIcon::fromTheme("help-about")); connect(m_ui->centralWidget, SIGNAL(viewerInitialized()), this, SLOT(viewerInitialized())); connect(m_ui->menuFile, SIGNAL(aboutToShow()), this, SLOT(updateRecentFilesMenu())); connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(actionOpen())); connect(m_ui->menuOpenRecent, SIGNAL(triggered(QAction*)), this, SLOT(actionOpenRecent(QAction*))); connect(m_ui->actionClearRecentFiles, SIGNAL(triggered()), this, SLOT(actionClearRecentFiles())); connect(m_ui->actionClear_Missing_Files, SIGNAL(triggered()), this, SLOT(actionClearMissingFiles())); connect(m_ui->actionSave, SIGNAL(triggered()), this, SLOT(actionSave())); connect(m_ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(m_ui->actionClose, SIGNAL(triggered()), this, SLOT(actionClose())); connect(m_ui->actionUVEditor, SIGNAL(toggled(bool)), m_UVEditor, SLOT(setVisible(bool))); connect(m_ui->actionSetupTextures, SIGNAL(triggered()), this, SLOT(actionSetupTextures())); connect(m_ui->actionAppendModel, SIGNAL(triggered()), this, SLOT(actionAppendModel())); connect(m_ui->actionImport_Animation, SIGNAL(triggered()), this, SLOT(actionImport_Animation())); connect(m_ui->actionImport_Connectors, SIGNAL(triggered()), this, SLOT(actionImport_Connectors())); connect(m_ui->actionShowAxes, SIGNAL(toggled(bool)), m_ui->centralWidget, SLOT(setAxisIsDrawn(bool))); connect(m_ui->actionShowGrid, SIGNAL(toggled(bool)), m_ui->centralWidget, SLOT(setGridIsDrawn(bool))); connect(m_ui->actionShowLightSource, SIGNAL(toggled(bool)), m_ui->centralWidget, SLOT(setDrawLightSource(bool))); connect(m_ui->actionLink_Light_Source_To_Camera, SIGNAL(toggled(bool)), m_ui->centralWidget, SLOT(setLinkLightToCamera(bool))); connect(m_ui->actionAnimate, SIGNAL(toggled(bool)), m_ui->centralWidget, SLOT(setAnimateState(bool))); connect(m_ui->actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt())); connect(m_ui->actionSetTeamColor, SIGNAL(triggered()), this, SLOT(actionSetTeamColor())); /// Material dock m_materialDock->toggleViewAction()->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); m_ui->menuModel->insertAction(m_ui->menuModel->actions().value(0) ,m_materialDock->toggleViewAction()); connect(m_materialDock, SIGNAL(materialChanged(WZMaterial)), this, SLOT(materialChangedFromUI(WZMaterial))); /// Transform dock m_transformDock->toggleViewAction()->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T)); m_ui->menuModel->insertAction(m_ui->menuModel->actions().value(0) ,m_transformDock->toggleViewAction()); // transformations connect(m_transformDock, SIGNAL(scaleXYZChanged(double)), this, SLOT(scaleXYZChanged(double))); connect(m_transformDock, SIGNAL(scaleXChanged(double)), this, SLOT(scaleXChanged(double))); connect(m_transformDock, SIGNAL(scaleYChanged(double)), this, SLOT(scaleYChanged(double))); connect(m_transformDock, SIGNAL(scaleZChanged(double)), this, SLOT(scaleZChanged(double))); connect(m_transformDock, SIGNAL(reverseWindings()), this, SLOT(reverseWindings())); connect(m_transformDock, SIGNAL(flipNormals()), this, SLOT(flipNormals())); connect(m_transformDock, SIGNAL(applyTransformations()), &m_model, SLOT(applyTransformations())); connect(m_transformDock, SIGNAL(changeActiveMesh(int)), &m_model, SLOT(setActiveMesh(int))); connect(m_transformDock, SIGNAL(recalculateTB()), &m_model, SLOT(slotRecalculateTB())); connect(m_transformDock, SIGNAL(removeMesh()), this, SLOT(removeMesh())); connect(m_transformDock, SIGNAL(mirrorAxis(int)), this, SLOT(mirrorAxis(int))); connect(m_transformDock, SIGNAL(centerMesh(int)), this, SLOT(centerMesh(int))); connect(&m_model, SIGNAL(meshCountChanged(int,QStringList)), m_transformDock, SLOT(setMeshCount(int,QStringList))); /// Mesh dock m_meshDock->toggleViewAction()->setShortcut(QKeySequence(Qt::Key_M)); m_ui->menuModel->insertAction(m_ui->menuModel->actions().value(0), m_meshDock->toggleViewAction()); connect(m_meshDock, SIGNAL(connectorsWereUpdated()), this, SLOT(updateModelRender())); connect(&m_model, SIGNAL(meshCountChanged(int,QStringList)), m_meshDock, SLOT(setMeshCount(int,QStringList))); /// Reset state clear(); }
QEbuMainWindow::QEbuMainWindow(QWidget *parent) : QMainWindow(parent) { m_ebuCoreMain = 0; m_icon.addFile(":/images/qebu-icon_32.png"); m_icon.addFile(":/images/qebu-icon_64.png"); this->setWindowIcon(m_icon); qApp->setWindowIcon(m_icon); // Central Widget QWidget *cw = new QWidget; m_mainCentralLayout = new QVBoxLayout; m_labelNavigation = new QLabel; m_labelNavigation->setFrameStyle(QFrame::NoFrame); m_stackedWidget = new QStackedWidget; m_stackedWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); //m_stackedWidget->setMinimumSize(640,400); m_mainCentralLayout->addWidget(m_labelNavigation); m_mainCentralLayout->addWidget(m_stackedWidget); // Bottom label -> currentDocument m_currentDocument = new QLabel; m_mainCentralLayout->addWidget(m_currentDocument); cw->setLayout(m_mainCentralLayout); this->setCentralWidget(cw); // Create top menu bar QMenuBar *topMenuBar = new QMenuBar(this); QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = new QAction(tr("&Open..."), this); openAction->setShortcuts(QKeySequence::Open); QObject::connect(openAction, SIGNAL(triggered()), this, SLOT(actionOpen())); fileMenu->addAction(openAction); QAction *saveAction = new QAction(tr("&Save as..."), this); saveAction->setShortcut(QKeySequence::SaveAs); QObject::connect(saveAction, SIGNAL(triggered()), this, SLOT(actionSave())); fileMenu->addAction(saveAction); QAction *closeAction = new QAction(tr("&Close"), this); closeAction->setShortcut(QKeySequence::Close); QObject::connect(closeAction, SIGNAL(triggered()), this, SLOT(actionClose())); fileMenu->addAction(closeAction); fileMenu->addSeparator(); QAction *quitAction = new QAction(tr("&Quit"), this); quitAction->setShortcut(QKeySequence::Quit); quitAction->setMenuRole(QAction::QuitRole); QObject::connect(quitAction, SIGNAL(triggered()), this, SLOT(actionQuit())); fileMenu->addAction(quitAction); topMenuBar->addMenu(fileMenu); QMenu *helpMenu = new QMenu(tr("&Help"), this); QAction *wizardAction = new QAction(tr("&Getting started..."), this); QObject::connect(wizardAction, SIGNAL(triggered()), this, SLOT(actionWizard())); helpMenu->addAction(wizardAction); helpMenu->addSeparator(); QAction *aboutQtAction = new QAction(tr("About &Qt..."), this); aboutQtAction->setMenuRole(QAction::AboutQtRole); QObject::connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); helpMenu->addAction(aboutQtAction); QAction *aboutAction = new QAction(tr("&About QEbu..."), this); aboutQtAction->setMenuRole(QAction::AboutRole); QObject::connect(aboutAction, SIGNAL(triggered()), this, SLOT(actionAbout())); helpMenu->addAction(aboutAction); topMenuBar->addMenu(helpMenu); this->setMenuBar(topMenuBar); // Prepare main view resetView(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MainWindow), m_currentSubtitle(0), m_currentTrack(0) { m_subtitles.append(QList<Subtitle>()); m_subtitles.append(QList<Subtitle>()); m_ui->setupUi(this); Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(this); audioOutput->setVolume(QSettings().value("volume", 0.8).toReal()); m_mediaObject = new Phonon::MediaObject(this); m_mediaObject->setTickInterval(100); Phonon::createPath(m_mediaObject, m_ui->videoWidget); Phonon::createPath(m_mediaObject, audioOutput); m_ui->actionPlayPause->setIcon(QIcon::fromTheme("media-playback-start", style()->standardIcon(QStyle::SP_MediaPlay))); m_ui->actionPlayPause->setShortcut(tr("Space")); m_ui->actionPlayPause->setDisabled(true); m_ui->actionStop->setIcon(QIcon::fromTheme("media-playback-stop", style()->standardIcon(QStyle::SP_MediaStop))); m_ui->actionStop->setDisabled(true); m_fileNameLabel = new QLabel(tr("No file loaded"), this); m_fileNameLabel->setMaximumWidth(300); m_timeLabel = new QLabel("00:00.0 / 00:00.0", this); m_ui->actionOpen->setIcon(QIcon::fromTheme("document-open", style()->standardIcon(QStyle::SP_DirOpenIcon))); m_ui->actionSave->setIcon(QIcon::fromTheme("document-save", style()->standardIcon(QStyle::SP_DialogSaveButton))); m_ui->actionSaveAs->setIcon(QIcon::fromTheme("document-save-as")); m_ui->actionExit->setIcon(QIcon::fromTheme("application-exit", style()->standardIcon(QStyle::SP_DialogCloseButton))); m_ui->actionAdd->setIcon(QIcon::fromTheme("list-add")); m_ui->actionRemove->setIcon(QIcon::fromTheme("list-remove")); m_ui->actionPrevious->setIcon(QIcon::fromTheme("go-previous")); m_ui->actionNext->setIcon(QIcon::fromTheme("go-next")); m_ui->actionRescale->setIcon(QIcon::fromTheme("chronometer")); m_ui->actionAboutApplication->setIcon(QIcon::fromTheme("help-about")); m_ui->playPauseButton->setDefaultAction(m_ui->actionPlayPause); m_ui->stopButton->setDefaultAction(m_ui->actionStop); m_ui->addButton->setDefaultAction(m_ui->actionAdd); m_ui->removeButton->setDefaultAction(m_ui->actionRemove); m_ui->previousButton->setDefaultAction(m_ui->actionPrevious); m_ui->nextButton->setDefaultAction(m_ui->actionNext); m_ui->seekSlider->setMediaObject(m_mediaObject); m_ui->volumeSlider->setAudioOutput(audioOutput); m_ui->statusBar->addPermanentWidget(m_fileNameLabel); m_ui->statusBar->addPermanentWidget(m_timeLabel); resize(QSettings().value("Window/size", size()).toSize()); move(QSettings().value("Window/position", pos()).toPoint()); restoreState(QSettings().value("Window/state", QByteArray()).toByteArray()); setWindowTitle(tr("%1 - Unnamed").arg("Subtitles Editor")); connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(actionOpen())); connect(m_ui->actionSave, SIGNAL(triggered()), this, SLOT(actionSave())); connect(m_ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(m_ui->actionAdd, SIGNAL(triggered()), this, SLOT(addSubtitle())); connect(m_ui->actionRemove, SIGNAL(triggered()), this, SLOT(removeSubtitle())); connect(m_ui->actionPrevious, SIGNAL(triggered()), this, SLOT(previousSubtitle())); connect(m_ui->actionNext, SIGNAL(triggered()), this, SLOT(nextSubtitle())); connect(m_ui->actionRescale, SIGNAL(triggered()), this, SLOT(rescaleSubtitles())); connect(m_ui->actionPlayPause, SIGNAL(triggered()), this, SLOT(playPause())); connect(m_ui->actionStop, SIGNAL(triggered()), m_mediaObject, SLOT(stop())); connect(m_ui->actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt())); connect(m_ui->actionAboutApplication, SIGNAL(triggered()), this, SLOT(actionAboutApplication())); connect(m_ui->trackComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectTrack(int))); connect(m_mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State))); connect(m_mediaObject, SIGNAL(tick(qint64)), this, SLOT(tick())); connect(m_mediaObject, SIGNAL(finished()), this, SLOT(finished())); }
SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : QMainWindow(parent) , fCentralSplitter(this) , fStatusBar(this) , fToolBar(this) , fActionOpen(this) , fActionBreakpoint(this) , fActionCancel(this) , fActionClearBreakpoints(this) , fActionClearDeletes(this) , fActionClose(this) , fActionCreateBreakpoint(this) , fActionDelete(this) , fActionDirectory(this) , fActionGoToLine(this) , fActionInspector(this) , fActionSettings(this) , fActionPlay(this) , fActionPause(this) , fActionRewind(this) , fActionSave(this) , fActionSaveAs(this) , fActionShowDeletes(this) , fActionStepBack(this) , fActionStepForward(this) , fActionZoomIn(this) , fActionZoomOut(this) , fMapper(this) , fListWidget(&fCentralSplitter) , fDirectoryWidget(&fCentralSplitter) , fCanvasWidget(this, &fDebugger) , fDrawCommandGeometryWidget(&fDebugger) , fMenuBar(this) , fMenuFile(this) , fMenuNavigate(this) , fMenuView(this) , fLoading(false) { setupUi(this); fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection); connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateDrawCommandInfo())); connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile())); connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory())); connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(loadFile(QListWidgetItem *))); connect(&fDirectoryWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(populateDirectoryWidget())); connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete())); connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleBreakpoint())); connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind())); connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay())); connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())); connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForward())); connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoints())); connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector())); connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings())); connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString))); connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel())); connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClearBreakpoints())); connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes())); connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); #if SK_SUPPORT_GPU connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLSettingsChanged())); #endif connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(actionRasterSettingsChanged())); connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(actionVisualizationsChanged())); connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(actionTextureFilter())); connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool))); connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint())); connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(int))); connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))); connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(actionScale(float))); connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); fViewStateFrame.setDisabled(true); fInspectorWidget.setDisabled(true); fMenuEdit.setDisabled(true); fMenuNavigate.setDisabled(true); fMenuView.setDisabled(true); }
QWzmViewer::QWzmViewer(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow()), psModel(NULL), timer(new QTimer(this)) { QSettings settings; ui->setupUi(this); connectorsModel.setColumnCount(4); connectorsModel.setHeaderData(0, Qt::Horizontal, QString("X")); connectorsModel.setHeaderData(1, Qt::Horizontal, QString("Y")); connectorsModel.setHeaderData(2, Qt::Horizontal, QString("Z")); connectorsModel.setHeaderData(3, Qt::Horizontal, QString(tr("Type"))); animationModel.setColumnCount(8); animationModel.setHeaderData(0, Qt::Horizontal, QString(tr("Time"))); animationModel.setHeaderData(1, Qt::Horizontal, QString("Tex")); animationModel.setHeaderData(2, Qt::Horizontal, QString("Trs X")); animationModel.setHeaderData(3, Qt::Horizontal, QString("Trs Y")); animationModel.setHeaderData(4, Qt::Horizontal, QString("Trs Z")); animationModel.setHeaderData(5, Qt::Horizontal, QString("Rot X")); animationModel.setHeaderData(6, Qt::Horizontal, QString("Rot Y")); animationModel.setHeaderData(7, Qt::Horizontal, QString("Rot Z")); fileNameLabel = new QLabel(tr("No file loaded"), ui->statusBar); selectedMeshComboBox = new QComboBox(ui->statusBar); selectedMeshComboBox->setToolTip(tr("Selected Mesh")); selectedMeshComboBox->setEnabled(false); visibleMeshComboBox = new QComboBox(ui->statusBar); visibleMeshComboBox->setEnabled(false); visibleMeshComboBox->setToolTip(tr("Visible Mesh")); visibleMeshComboBox->addItem(tr("All")); teamComboBox = new QComboBox(ui->statusBar); teamComboBox->setToolTip(tr("Team Colour")); teamComboBox->addItem(tr("Green")); teamComboBox->addItem(tr("Yellow")); teamComboBox->addItem(tr("Grey")); teamComboBox->addItem(tr("Black")); teamComboBox->addItem(tr("Red")); teamComboBox->addItem(tr("Blue")); teamComboBox->addItem(tr("Pink")); teamComboBox->addItem(tr("Cyan")); scaleSlider = new QSlider(ui->statusBar); scaleSlider->setToolTip(tr("Scale")); scaleSlider->setRange(1, 1000); scaleSlider->setValue(100); scaleSlider->setOrientation(Qt::Horizontal); scaleSlider->setEnabled(false); ui->statusBar->addPermanentWidget(fileNameLabel); ui->statusBar->addPermanentWidget(selectedMeshComboBox); ui->statusBar->addPermanentWidget(visibleMeshComboBox); ui->statusBar->addPermanentWidget(teamComboBox); ui->statusBar->addPermanentWidget(scaleSlider); ui->connectorTableView->setModel(&connectorsModel); ui->animationTableView->setModel(&animationModel); ui->animationDockWidget->hide(); ui->connectorDockWidget->hide(); connect(timer, SIGNAL(timeout()), this, SLOT(tick())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(actionOpen())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(actionSave())); connect(ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(ui->actionQuit, SIGNAL(triggered()), QApplication::instance(), SLOT(quit())); connect(ui->actionImport_3DS, SIGNAL(triggered()), this, SLOT(open3DS())); connect(ui->actionWireframe, SIGNAL(triggered()), this, SLOT(toggleWireframe())); connect(ui->actionHelpContents, SIGNAL(triggered()), ui->glView, SLOT(help())); connect(ui->actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt())); connect(ui->actionAboutApplication, SIGNAL(triggered()), this, SLOT(actionAboutApplication())); connect(ui->actionAxis, SIGNAL(triggered()), ui->glView, SLOT(toggleAxisIsDrawn())); connect(ui->actionCulling, SIGNAL(triggered()), this, SLOT(toggleCulling())); connect(ui->actionAnimation, SIGNAL(triggered()), this, SLOT(toggleAnimation())); connect(ui->actionScaleModel, SIGNAL(triggered()), this, SLOT(toggleScale())); connect(selectedMeshComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setMesh(int))); connect(visibleMeshComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setVisibleMesh(int))); connect(teamComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTeam(int))); connect(ui->actionSwapYZ, SIGNAL(triggered()), this, SLOT(toggleSwapYZ())); connect(ui->actionReverseWinding, SIGNAL(triggered()), this, SLOT(toggleReverseWinding())); connect(ui->actionFlipVerticalTexCoords, SIGNAL(triggered()), this, SLOT(toggleFlipVerticalTexCoords())); connect(ui->actionFramesEditor, SIGNAL(toggled(bool)), this, SLOT(toggleEditAnimation(bool))); connect(ui->actionConnectorsEditor, SIGNAL(toggled(bool)), this, SLOT(toggleEditConnectors(bool))); connect(ui->animationDockWidget, SIGNAL(visibilityChanged(bool)), ui->actionFramesEditor, SLOT(setChecked(bool))); connect(ui->connectorDockWidget, SIGNAL(visibilityChanged(bool)), ui->actionConnectorsEditor, SLOT(setChecked(bool))); connect(ui->prependFrameButton, SIGNAL(pressed()), this, SLOT(prependFrame())); connect(ui->appendFrameButton, SIGNAL(pressed()), this, SLOT(appendFrame())); connect(ui->removeFrameButton, SIGNAL(pressed()), this, SLOT(removeFrame())); // Set defaults toggleAnimation(); ui->actionSave->setEnabled(false); ui->actionSaveAs->setEnabled(false); restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); timer->start(25); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { /****************** Menu Bar ******************/ /* * File Menu */ QAction *newAction = new QAction("&New File", this); newAction->setShortcut(tr("Ctrl+N")); connect(newAction, SIGNAL(triggered()), this, SLOT(actionNew())); QAction *openAction = new QAction("&Open File", this); openAction->setShortcut(tr("Ctrl+O")); connect(openAction, SIGNAL(triggered()), this, SLOT(actionOpen())); QAction *saveAction = new QAction("&Save File", this); saveAction->setShortcut(tr("Ctrl+S")); connect(saveAction, SIGNAL(triggered()), this, SLOT(actionSave())); QAction *quitAction = new QAction("&Quit", this); quitAction->setShortcut(tr("Ctrl+Q")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QMenu *fileMenu; fileMenu = menuBar()->addMenu("&File"); fileMenu->addAction(newAction); fileMenu->addAction(openAction); fileMenu->addAction(saveAction); fileMenu->addAction(quitAction); /* * Edit Menu */ QAction *chooseWireColorAction = new QAction("Choose Wire &Color", this); chooseWireColorAction->setShortcut(tr("Ctrl+C")); connect(chooseWireColorAction, SIGNAL(triggered()), this, SLOT(actionChooseWireColor())); QMenu *editMenu; editMenu = menuBar()->addMenu("&Edit"); editMenu->addSeparator(); editMenu->addAction(chooseWireColorAction); /* * Insert Menu */ QAction *insertWireAction = new QAction("Insert &Wire", this); insertWireAction->setShortcut(tr("Ctrl+W")); connect(insertWireAction, SIGNAL(triggered()), this, SLOT(actionInsertWire())); QAction *insertLEDAction = new QAction("Insert &LED", this); insertLEDAction->setShortcut(tr("Ctrl+L")); connect(insertLEDAction, SIGNAL(triggered()), this, SLOT(actionInsertLED())); QAction *insertICAction = new QAction("Insert &IC", this); insertICAction->setShortcut(tr("Ctrl+I")); connect(insertICAction, SIGNAL(triggered()), this, SLOT(actionInsertIC())); QAction *insertTagAction = new QAction("Insert &Tag", this); insertTagAction->setShortcut(tr("Ctrl+T")); connect(insertTagAction, SIGNAL(triggered()), this, SLOT(actionInsertTag())); QMenu *insertMenu; insertMenu = menuBar()->addMenu("&Insert"); insertMenu->addAction(insertWireAction); insertMenu->addAction(insertLEDAction); insertMenu->addAction(insertICAction); insertMenu->addSeparator(); insertMenu->addAction(insertTagAction); /* * Circuit Menu */ QAction *runCircuitAction = new QAction("&Run Circuit", this); runCircuitAction->setShortcut(tr("F5")); connect(runCircuitAction, SIGNAL(triggered()), this, SLOT(actionRunCircuit())); QAction *stopCircuitAction = new QAction("&Stop Circuit", this); stopCircuitAction->setShortcut(tr("F12")); connect(stopCircuitAction, SIGNAL(triggered()), this, SLOT(actionStopCircuit())); QAction *truthTableAction = new QAction("Generate &Truth Table", this); truthTableAction->setShortcut(tr("F6")); connect(truthTableAction, SIGNAL(triggered()), this, SLOT(actionTruthTable())); QMenu *circuitMenu; circuitMenu = menuBar()->addMenu("&Circuit"); circuitMenu->addAction(runCircuitAction); circuitMenu->addAction(stopCircuitAction); circuitMenu->addAction(truthTableAction); /* * Help Menu */ QAction *aboutAction = new QAction("&About", this); connect(aboutAction, SIGNAL(triggered()), this, SLOT(actionAbout())); QMenu *helpMenu; helpMenu = menuBar()->addMenu("&Help"); helpMenu->addAction(aboutAction); /* * Invisible Actions */ QShortcut *toggleInput1 = new QShortcut(QKeySequence(tr("Alt+1")), this); QShortcut *toggleInput2 = new QShortcut(QKeySequence(tr("Alt+2")), this); QShortcut *toggleInput3 = new QShortcut(QKeySequence(tr("Alt+3")), this); QShortcut *toggleInput4 = new QShortcut(QKeySequence(tr("Alt+4")), this); QShortcut *toggleInput5 = new QShortcut(QKeySequence(tr("Alt+5")), this); QShortcut *toggleInput6 = new QShortcut(QKeySequence(tr("Alt+6")), this); QShortcut *toggleInput7 = new QShortcut(QKeySequence(tr("Alt+7")), this); QShortcut *toggleInput8 = new QShortcut(QKeySequence(tr("Alt+8")), this); QShortcut *toggleInput9 = new QShortcut(QKeySequence(tr("Alt+9")), this); QShortcut *toggleInput0 = new QShortcut(QKeySequence(tr("Alt+0")), this); connect(toggleInput1, SIGNAL(activated()), this, SLOT(actionToggleInput1())); connect(toggleInput2, SIGNAL(activated()), this, SLOT(actionToggleInput2())); connect(toggleInput3, SIGNAL(activated()), this, SLOT(actionToggleInput3())); connect(toggleInput4, SIGNAL(activated()), this, SLOT(actionToggleInput4())); connect(toggleInput5, SIGNAL(activated()), this, SLOT(actionToggleInput5())); connect(toggleInput6, SIGNAL(activated()), this, SLOT(actionToggleInput6())); connect(toggleInput7, SIGNAL(activated()), this, SLOT(actionToggleInput7())); connect(toggleInput8, SIGNAL(activated()), this, SLOT(actionToggleInput8())); connect(toggleInput9, SIGNAL(activated()), this, SLOT(actionToggleInput9())); connect(toggleInput0, SIGNAL(activated()), this, SLOT(actionToggleInput0())); QShortcut *cheatNO_GND_VCC_sh = new QShortcut( QKeySequence(Qt::Key_N, Qt::Key_G, Qt::Key_V), this); connect(cheatNO_GND_VCC_sh, SIGNAL(activated()), this, SLOT(actionCheatNO_GND_VCC())); /*************** Central Contents ***************/ QWidget *centralWidget = new QWidget; centralWidget->setObjectName(QObject::tr("centralWidget")); console = nullptr; consoleView = new QGraphicsView(); consoleView->setFixedSize(Console::CONSOLE_WIDTH, Console::CONSOLE_HEIGHT); actionNew(); QVBoxLayout *vLayout = new QVBoxLayout; QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addStretch(1); hLayout->addWidget(consoleView); hLayout->addStretch(1); vLayout->addStretch(1); vLayout->addLayout(hLayout); vLayout->addStretch(1); centralWidget->setLayout(vLayout); setCentralWidget(centralWidget); /*************** Containers *****************/ icNameList = new QStringList; icPinsList = new QStringList; icDescList = new QStringList; icLabelList = new QStringList; /*************** Functions ******************/ parseICs(); icdialog = new ICDialog(this, icNameList, icDescList); /*************** Booleans *******************/ circuitState = false; cheatNO_GND_VCC = false; }