LibraryTreeWidget::LibraryTreeWidget(QWidget *parent) : QTreeWidget(parent) { setSelectionMode(QAbstractItemView::ExtendedSelection); setDragEnabled(true); viewport()->setAcceptDrops(true); setDropIndicatorShown(true); setDragDropMode(QAbstractItemView::InternalMove); invisibleRootItem()->setFlags(invisibleRootItem()->flags() & ~Qt::ItemIsDropEnabled); setHeaderHidden(true); setEditTriggers(QAbstractItemView::EditKeyPressed | QAbstractItemView::SelectedClicked); addNewFileAction_ = new QAction(tr("Add New File..."), this); connect(addNewFileAction_, SIGNAL(triggered()), this, SLOT(addNewFile())); importToLibraryAction_ = new QAction(tr("Add Existing Files..."), this); connect(importToLibraryAction_, SIGNAL(triggered()), this, SLOT(importToLibrary())); // newFontAction_ = new QAction(tr("New Font..."), this); // connect(newFontAction_, SIGNAL(triggered()), this, SLOT(newFont())); newFolderAction_ = new QAction(tr("New Folder"), this); connect(newFolderAction_, SIGNAL(triggered()), this, SLOT(newFolder())); removeAction_ = new QAction(tr("Remove"), this); connect(removeAction_, SIGNAL(triggered()), this, SLOT(remove())); renameAction_ = new QAction(tr("Rename"), this); //renameAction_->setShortcut(Qt::Key_F2); connect(renameAction_, SIGNAL(triggered()), this, SLOT(rename())); sortAction_ = new QAction(tr("Sort"), this); connect(sortAction_, SIGNAL(triggered()), this, SLOT(sort())); codeDependenciesAction_ = new QAction(tr("Code Dependencies..."), this); connect(codeDependenciesAction_, SIGNAL(triggered()), this, SLOT(codeDependencies())); insertIntoDocumentAction_ = new QAction(tr("Insert Into Document"), this); connect(insertIntoDocumentAction_, SIGNAL(triggered()), this, SLOT(insertIntoDocument())); projectPropertiesAction_ = new QAction(tr("Properties..."), this); connect(projectPropertiesAction_, SIGNAL(triggered()), this, SLOT(projectProperties())); automaticDownsizingAction_ = new QAction(tr("Automatic Downsizing"), this); automaticDownsizingAction_->setCheckable(true); connect(automaticDownsizingAction_, SIGNAL(triggered(bool)), this, SLOT(automaticDownsizing(bool))); excludeFromExecutionAction_ = new QAction(tr("Exclude from Execution"), this); excludeFromExecutionAction_->setCheckable(true); connect(excludeFromExecutionAction_, SIGNAL(triggered(bool)), this, SLOT(excludeFromExecution(bool))); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested (const QPoint&)), this, SLOT (onCustomContextMenuRequested(const QPoint&))); connect(this, SIGNAL(itemDoubleClicked (QTreeWidgetItem*, int)), this, SLOT (onItemDoubleClicked(QTreeWidgetItem*, int))); connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT (onCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); isModifed_ = false; xmlString_ = toXml().toString(); QTimer* timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(checkModification())); timer->start(500); }
void DGLMainWindow::createActions() { // create "QActions" - bindings between mainwindow clickable widgets, // and // local slots quitAct = new QAction(tr("&Quit"), this); quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit the application")); CONNASSERT(quitAct, SIGNAL(triggered()), this, SLOT(close())); quitAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4)); aboutAct = new QAction(tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); CONNASSERT(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutAct->setShortcut(QKeySequence(Qt::Key_F1)); newProjectAct = new QAction(tr("&New Project..."), this); newProjectAct->setStatusTip(tr("Created new debugging project")); CONNASSERT(newProjectAct, SIGNAL(triggered()), this, SLOT(newProject())); newProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); openProjectAct = new QAction(tr("&Open Project..."), this); openProjectAct->setStatusTip(tr("Opens a debugging project")); CONNASSERT(openProjectAct, SIGNAL(triggered()), this, SLOT(openProject())); //TODO: implement openProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O)); saveProjectAct = new QAction(tr("&Save Project"), this); saveProjectAct->setStatusTip(tr("Save a debugging project")); CONNASSERT(saveProjectAct, SIGNAL(triggered()), this, SLOT(saveProject())); //TODO: implement saveProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); saveAsProjectAct = new QAction(tr("&Save Project As ..."), this); saveAsProjectAct->setStatusTip(tr("Save a debugging project as as a file ...")); CONNASSERT(saveAsProjectAct, SIGNAL(triggered()), this, SLOT(saveProjectAs())); //TODO: implement saveAsProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S)); projectProperiesAct = new QAction(tr("&Project properties..."), this); projectProperiesAct->setStatusTip(tr("Change properties of current project")); CONNASSERT(projectProperiesAct, SIGNAL(triggered()), this, SLOT(projectProperties())); closeProjectAct = new QAction(tr("&Close project"), this); closeProjectAct->setStatusTip(tr("Created new debugging project")); CONNASSERT(closeProjectAct, SIGNAL(triggered()), this, SLOT(closeProject())); debugStartAct = new QAction(tr("&Start debugging"), this); debugStartAct->setStatusTip(tr("Stop debugging.")); CONNASSERT(debugStartAct, SIGNAL(triggered()), this, SLOT(debugStart())); CONNASSERT(&m_controller, SIGNAL(setDisconnected(bool)), debugStartAct, SLOT(setVisible(bool))); debugStartAct->setShortcut(QKeySequence(Qt::Key_F5)); debugStopAct = new QAction(tr("Sto&p debugging"), this); debugStopAct->setStatusTip(tr("Stop debugging.")); CONNASSERT(debugStopAct, SIGNAL(triggered()), this, SLOT(debugStop())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStopAct, SLOT(setEnabled(bool))); debugStopAct->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F5)); debugStopAct->setEnabled(false); debugTerminateAct = new QAction(tr("Terminate"), this); debugTerminateAct->setStatusTip(tr("Terminate debugged process.")); CONNASSERT(debugTerminateAct, SIGNAL(triggered()), this, SLOT(debugTerminate())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugTerminateAct, SLOT(setEnabled(bool))); debugTerminateAct->setEnabled(false); debugContinueAct = new QAction(tr("&Continue"), this); debugContinueAct->setStatusTip(tr("Continue program execution")); CONNASSERT(debugContinueAct, SIGNAL(triggered()), &m_controller, SLOT(debugContinue())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugContinueAct, SLOT(setVisible(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugContinueAct, SLOT(setEnabled(bool))); debugContinueAct->setShortcut(QKeySequence(Qt::Key_F5)); debugContinueAct->setVisible(false); debugInterruptAct = new QAction(tr("&Break on next call"), this); debugInterruptAct->setStatusTip( tr("Break program execution on GL call")); CONNASSERT(debugInterruptAct, SIGNAL(triggered()), &m_controller, SLOT(debugInterrupt())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugInterruptAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setRunning(bool)), debugInterruptAct, SLOT(setEnabled(bool))); debugInterruptAct->setShortcut(QKeySequence(Qt::Key_F6)); debugInterruptAct->setEnabled(false); debugStepAct = new QAction(tr("&Step"), this); debugStepAct->setStatusTip(tr("Step one GL call")); CONNASSERT(debugStepAct, SIGNAL(triggered()), &m_controller, SLOT(debugStep())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepAct, SLOT(setEnabled(bool))); debugStepAct->setShortcut(QKeySequence(Qt::Key_F11)); debugStepAct->setEnabled(false); debugStepDrawCallAct = new QAction(tr("&Draw step"), this); debugStepDrawCallAct->setStatusTip(tr("Step one GL drawing call")); CONNASSERT(debugStepDrawCallAct, SIGNAL(triggered()), &m_controller, SLOT(debugStepDrawCall())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepDrawCallAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepDrawCallAct, SLOT(setEnabled(bool))); debugStepDrawCallAct->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F11)); debugStepDrawCallAct->setEnabled(false); debugStepFrameAct = new QAction(tr("&Frame step"), this); debugStepFrameAct->setStatusTip(tr("Step one GL frame")); CONNASSERT(debugStepFrameAct, SIGNAL(triggered()), &m_controller, SLOT(debugStepFrame())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepFrameAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepFrameAct, SLOT(setEnabled(bool))); debugStepFrameAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11)); debugStepFrameAct->setEnabled(false); addDeleteBreakPointsAct = new QAction(tr("&Breakpoints..."), this); addDeleteBreakPointsAct->setStatusTip(tr("Add or remove breakpoints")); CONNASSERT(addDeleteBreakPointsAct, SIGNAL(triggered()), this, SLOT(addDeleteBreakPoints())); addDeleteBreakPointsAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); setBreakOnGLErrorAct = new QAction(tr("Break on GL error"), this); setBreakOnGLErrorAct->setStatusTip( tr("Break execution on GL error (glGetError() != GL_NO_ERROR)")); // this action has a state - it is checbox-like checkable DGLConfiguration& currentConfig = m_controller.getConfig(); setBreakOnGLErrorAct->setCheckable(true); setBreakOnGLErrorAct->setChecked(currentConfig.m_BreakOnGLError); CONNASSERT(setBreakOnGLErrorAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); setBreakOnDebugOutputAct = new QAction(tr("Break on debug output"), this); setBreakOnDebugOutputAct->setStatusTip( tr("Break execution on debug output message")); // this action has a state - it is checbox-like checkable setBreakOnDebugOutputAct->setCheckable(true); setBreakOnDebugOutputAct->setChecked( currentConfig.m_BreakOnGLError); CONNASSERT(setBreakOnDebugOutputAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); setBreakOnCompilerErrAct = new QAction(tr("Break on compiler/linker error"), this); setBreakOnCompilerErrAct->setStatusTip( tr("Break execution on debug GLSL compiler or linker error")); // this action has a state - it is checbox-like checkable setBreakOnCompilerErrAct->setCheckable(true); setBreakOnCompilerErrAct->setChecked( currentConfig.m_BreakOnCompilerError); CONNASSERT(setBreakOnCompilerErrAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); // Only one color scheme can be choosed - put all related actions to // action // group setColorSchemeActGroup = new QActionGroup(this); // iterate through all color schemes. for each one create one action for (uint i = 0; i < DGLNUM_COLOR_SCHEMES; i++) { setColorSchemeActs[i] = new QAction(tr(dglColorSchemes[i].name), this); setColorSchemeActs[i]->setCheckable(true); setColorSchemeActs[i]->setActionGroup(setColorSchemeActGroup); setColorSchemeActs[i]->setStatusTip(tr("Set this color scheme")); // connect all color scheme actions to one mapper, so we can connect // it // later to only one signal m_SetColorSchemeSignalMapper.setMapping(setColorSchemeActs[i], i); CONNASSERT(setColorSchemeActs[i], SIGNAL(triggered()), &m_SetColorSchemeSignalMapper, SLOT(map())); } // mapper maps connected actions to one emitted signal by int parameter. // Connect this signal to "this" CONNASSERT(&m_SetColorSchemeSignalMapper, SIGNAL(mapped(int)), this, SLOT(setColorScheme(int))); configurationAct = new QAction(tr("Configuration..."), this); configurationAct->setStatusTip(tr("Configuration options")); CONNASSERT(configurationAct, SIGNAL(triggered()), this, SLOT(configure())); prepareAndroidAct = new QAction(tr("Prepare Android device..."), this); prepareAndroidAct->setStatusTip(tr("Installs " DGL_PRODUCT " on Android device")); CONNASSERT(prepareAndroidAct, SIGNAL(triggered()), this, SLOT(androidPrepare())); }