void MainWindow::setupActions() { buildActions = new QActionGroup(this); buildActions->addAction(ui.action_Build); buildActions->addAction(ui.action_Upload); connect(ui.tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabHasChanged())); connect(ui.action_New, SIGNAL(triggered()), this, SLOT(newProject())); connect(ui.action_Open, SIGNAL(triggered()), this, SLOT(open())); connect(ui.action_Save, SIGNAL(triggered()), this, SLOT(save())); connect(ui.action_Saveas, SIGNAL(triggered()), this, SLOT(save_as())); connect(ui.action_Close, SIGNAL(triggered()), this, SLOT(closeTab())); connect(ui.actionUpPastebin, SIGNAL(triggered()), this, SLOT(uploadToPastebin())); connect(ui.actionUndo, SIGNAL(triggered()), this, SLOT(undo())); connect(ui.actionRedo, SIGNAL(triggered()), this, SLOT(redo())); connect(ui.action_Copy, SIGNAL(triggered()), this, SLOT(copy())); connect(ui.action_Cut, SIGNAL(triggered()), this, SLOT(cut())); connect(ui.action_Find, SIGNAL(triggered(bool)), this, SLOT(showFindBox(bool))); connect(ui.action_Paste, SIGNAL(triggered()), this, SLOT(paste())); connect(ui.action_Build, SIGNAL(triggered()), this, SLOT(build())); connect(ui.action_Upload, SIGNAL(triggered()), this, SLOT(upload())); connect(ui.action_Utilities, SIGNAL(triggered()), this, SLOT(toggleDock())); connect(ui.actionGo_to_the_next_tab, SIGNAL(triggered()), this, SLOT(nextTab())); connect(ui.actionGo_to_the_previous_tab, SIGNAL(triggered()), this, SLOT(previousTab())); connect(ui.action_Configure_the_IDE, SIGNAL(triggered()), this, SLOT(configure())); connect(ui.action_Contextual_help, SIGNAL(triggered()), this, SLOT(contextualHelp())); connect(ui.actionCommunityArduinoCC, SIGNAL(triggered()), this, SLOT(openCommunityArduinoCC())); connect(ui.actionCommunityArduinoForums, SIGNAL(triggered()), this, SLOT(openCommunityArduinoForums())); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui.lineFind, SIGNAL(returnPressed()), this, SLOT(find())); connect(ui.lineReplace, SIGNAL(returnPressed()), this, SLOT(find())); connect(ui.pushFind, SIGNAL(clicked()), this, SLOT(find())); connect(ui.pushReplace, SIGNAL(clicked()), this, SLOT(replace())); connect(ui.pushReplaceAll, SIGNAL(clicked()), this, SLOT(replaceAll())); connect(this, SIGNAL(tabChanged(bool)), ui.pushReplace, SLOT(setEnabled(bool))); connect(this, SIGNAL(tabChanged(bool)), ui.pushReplaceAll, SLOT(setEnabled(bool))); connect(this, SIGNAL(tabChanged(bool)), ui.checkRegExp, SLOT(setEnabled(bool))); connect(this, SIGNAL(tabChanged(bool)), ui.checkWordOnly, SLOT(setEnabled(bool))); connect(this, SIGNAL(tabChanged(bool)), ui.menu_Libraries, SLOT(setEnabled(bool))); connect(ui.action_Lib_Refresh, SIGNAL(triggered()), this, SLOT(refreshLibrariesMenu())); connect(browser, SIGNAL(newProjectRequested()), this, SLOT(newProject())); connect(browser, SIGNAL(newProjectRequested(const QString &, const QString &)), this, SLOT(newProject(const QString &, const QString &))); connect(browser, SIGNAL(openProjectRequested()), this, SLOT(open())); connect(browser, SIGNAL(openProjectRequested(const QString &)), this, SLOT(open(const QString &))); connect(browser, SIGNAL(newPageLoaded(QUrl)), this, SLOT(tabContentHasChanged())); connect(ui.action_Prev, SIGNAL(triggered()), browser, SLOT(back())); connect(ui.action_Next, SIGNAL(triggered()), browser, SLOT(forward())); connect(ideApp->projectHistory(), SIGNAL(historyUpdated(QString)), browser, SLOT(refresh())); connect(ideApp->settings(), SIGNAL(fontChanged(const QFont &)), this, SLOT(setFont(const QFont &))); connect(&pastebin, SIGNAL(finished(QNetworkReply*)), this, SLOT(pastebinUploadDone(QNetworkReply*))); }
// Unload the plugin by cleaning up the GUI void RoadGraphPlugin::unload() { // remove the GUI mQGisIface->removePluginVectorMenu( tr( "Road graph" ), mQSettingsAction ); // disconnect disconnect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( projectRead() ) ); disconnect( mQGisIface->mainWindow(), SIGNAL( newProject() ), this, SLOT( newProject() ) ); delete mQSettingsAction; delete mQShortestPathDock; } // RoadGraphPlugin::unload()
/* * Initialize the GUI interface for the plugin - this is only called once when the plugin is * added to the plugin registry in the QGIS application. */ void RoadGraphPlugin::initGui() { // create shorttest path dock mQShortestPathDock = new RgShortestPathWidget( mQGisIface->mainWindow(), this ); mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mQShortestPathDock ); // Create the action for tool mQSettingsAction = new QAction( QIcon( ":/roadgraph/road.png" ), tr( "Settings" ), this ); mQSettingsAction->setObjectName( "mQSettingsAction" ); // Set the what's this text mQSettingsAction->setWhatsThis( tr( "Road graph plugin settings" ) ); setGuiElementsToDefault(); // Connect the action to slots connect( mQSettingsAction, SIGNAL( triggered() ), this, SLOT( property() ) ); mQGisIface->addPluginToVectorMenu( tr( "Road graph" ), mQSettingsAction ); connect( mQGisIface, SIGNAL( projectRead() ), this, SLOT( projectRead() ) ); connect( mQGisIface, SIGNAL( newProjectCreated() ), this, SLOT( newProject() ) ); connect( mQGisIface, SIGNAL( projectRead() ), mQShortestPathDock, SLOT( clear() ) ); connect( mQGisIface, SIGNAL( newProjectCreated() ), mQShortestPathDock, SLOT( clear() ) ); // load settings projectRead(); } // RoadGraphPlugin::initGui()
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); m_strLanguage = tr("English"); m_spriteMgr = NULL; m_pgv = NULL; m_settings = new QSettings(QString("njfever"), STR_MY_TITLE); initLanguage(); createViews(); m_bProjectIsNull = true; m_bIsEditedWithoutSave = false; m_bIsSceneMouseEvent = false; m_strWorkDirectory = ""; createActions(); createMenus(); createToolbarButtons(); newProject(); m_actions[ActionKey::SpriteLock]->setChecked(true); lockSprites(); }
/** * Handles the "Project->Open" action. * Displays the "Open Project" dialogue. */ void MainWindow::openProject() { // If an active project exists, it needs to be closed first. if (ProjectManager::hasProject()) { QString msg = tr("The active project needs to be closed.\n" "Would you like to close it now?"); int result = QMessageBox::question(this, tr("Close Project"), msg, QMessageBox::Yes | QMessageBox::No); if (result == QMessageBox::No || !closeProject()) return; } // Show the "Open Project" dialogue. OpenProjectDialog dlg(this); switch (dlg.exec()) { case OpenProjectDialog::Open: try { ProjectManager::load<Cscope::ManagedProject>(dlg.path()); } catch (Core::Exception* e) { e->showMessage(); delete e; } break; case OpenProjectDialog::New: newProject(); break; default: ; } }
void DesktopMainWindow::createActions() { _newProjectAction = new QAction(tr("New Project"), this); _newProjectAction->setShortcut(QKeySequence::New); _newProjectAction->setStatusTip(tr("Start a new project")); connect(_newProjectAction, SIGNAL(triggered()), this, SLOT(newProject())); _openProjectAction = new QAction(QIcon(":/resources/images/open.png"), tr("&Open Project"), this); _openProjectAction->setShortcut(QKeySequence::Open); _openProjectAction->setStatusTip(tr("Open an existing file")); connect(_openProjectAction, SIGNAL(triggered()), this, SLOT(openProject())); _saveProjectAction = new QAction(QIcon(":/resources/images/save.png"), tr("&Save Project"), this); _saveProjectAction->setShortcut(QKeySequence::Save); _saveProjectAction->setStatusTip(tr("Save current project")); connect(_saveProjectAction, SIGNAL(triggered()), this, SLOT(saveProject())); _exitAction = new QAction(tr("&Exit"), this); connect(_exitAction, SIGNAL(triggered()), this, SLOT(close())); _undoAction = new QAction(QIcon(":/resources/images/undo.png"), tr("&Undo"), this); connect(_undoAction, SIGNAL(triggered()), this, SLOT(undo())); _settingsAction = new QAction(QIcon(":/resources/images/gear.png"), tr("&Options"), this); connect(_settingsAction, SIGNAL(triggered()), this, SLOT(editSettings())); _restoreLayoutAction = new QAction(tr("&Restore Layout"), this); connect(_restoreLayoutAction, SIGNAL(triggered()), this, SLOT(restoreLayout())); _aboutAction = new QAction(QIcon(":/resources/images/info.png"), tr("&About"), this); _aboutAction->setStatusTip(tr("About Godzi")); connect(_aboutAction, SIGNAL(triggered()), this, SLOT(showAbout())); }
QgisAppInterface::QgisAppInterface( QgisApp * _qgis ) : qgis( _qgis ) , mTimer( nullptr ) , legendIface( _qgis->layerTreeView() ) , pluginManagerIface( _qgis->pluginManager() ) { // connect signals connect( qgis->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) ); connect( qgis, SIGNAL( currentThemeChanged( QString ) ), this, SIGNAL( currentThemeChanged( QString ) ) ); connect( qgis, SIGNAL( composerAdded( QgsComposerView* ) ), this, SIGNAL( composerAdded( QgsComposerView* ) ) ); connect( qgis, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ), this, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ) ); connect( qgis, SIGNAL( composerRemoved( QgsComposerView* ) ), this, SIGNAL( composerRemoved( QgsComposerView* ) ) ); connect( qgis, SIGNAL( initializationCompleted() ), this, SIGNAL( initializationCompleted() ) ); connect( qgis, SIGNAL( newProject() ), this, SIGNAL( newProjectCreated() ) ); connect( qgis, SIGNAL( projectRead() ), this, SIGNAL( projectRead() ) ); connect( qgis, SIGNAL( layerSavedAs( QgsMapLayer*, QString ) ), this, SIGNAL( layerSavedAs( QgsMapLayer*, QString ) ) ); }
// Unload the plugin by cleaning up the GUI void RoadGraphPlugin::unload() { // remove the GUI mQGisIface->removePluginMenu( tr( "Road graph" ), mQSettingsAction ); mQGisIface->removePluginMenu( tr( "Road graph" ), mQShowDirectionAction ); mQGisIface->removePluginMenu( tr( "Road graph" ), mInfoAction ); mQGisIface->removeToolBarIcon( mQShowDirectionAction ); // disconnect disconnect( mQGisIface->mapCanvas(), SIGNAL( renderComplete( QPainter* ) ), this, SLOT( render( QPainter* ) ) ); disconnect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( projectRead() ) ); disconnect( mQGisIface->mainWindow(), SIGNAL( newProject() ), this, SLOT( newProject() ) ); delete mQSettingsAction; delete mQShowDirectionAction; delete mQShortestPathDock; } // RoadGraphPlugin::unload()
void MainWindow::setConnections() { connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newProject())); connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(openProject())); connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(quitProject())); connect(ui->actionRun,SIGNAL(triggered()),this,SLOT(runProject())); connect(ui->actionOptions,SIGNAL(triggered()),this,SLOT(optionsProject())); connect(ui->actionAbout_Simgrid,SIGNAL(triggered()),this,SLOT(aboutSG())); }
// Unload the plugin by cleaning up the GUI void QgsGrassPlugin::unload() { // Close mapset QString err = QgsGrass::closeMapset(); // remove the GUI qGisInterface->removePluginMenu( tr( "&GRASS" ), mOpenMapsetAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mNewMapsetAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mCloseMapsetAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mAddVectorAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mAddRasterAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mOpenToolsAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mRegionAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mEditRegionAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mEditAction ); qGisInterface->removePluginMenu( tr( "&GRASS" ), mNewVectorAction ); delete mOpenMapsetAction; delete mNewMapsetAction; delete mCloseMapsetAction; delete mAddVectorAction; delete mAddRasterAction; delete mOpenToolsAction; delete mRegionAction; delete mEditRegionAction; delete mEditAction; delete mNewVectorAction; if ( toolBarPointer ) { delete toolBarPointer; toolBarPointer = 0; } // disconnect slots of QgsGrassPlugin so they're not fired also after unload disconnect( mCanvas, SIGNAL( renderComplete( QPainter * ) ), this, SLOT( postRender( QPainter * ) ) ); disconnect( qGisInterface, SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SLOT( setEditAction() ) ); QWidget* qgis = qGisInterface->mainWindow(); disconnect( qgis, SIGNAL( projectRead() ), this, SLOT( projectRead() ) ); disconnect( qgis, SIGNAL( newProject() ), this, SLOT( newProject() ) ); }
void K3bProjectManager::addProject( K3bDoc* doc ) { if( !d->projects.containsRef( doc ) ) { kdDebug() << "(K3bProjectManager) adding doc " << doc->URL().path() << endl; d->projects.append(doc); connect( doc, SIGNAL(changed(K3bDoc*)), this, SLOT(slotProjectChanged(K3bDoc*)) ); emit newProject( doc ); }
void ManageProjectsDialog::initialize() { setupUi(this); this->updateList(); //connecting signals connect(this->closeButton,SIGNAL(clicked()),this,SLOT(close())); connect(this->newButton,SIGNAL(clicked()),this,SLOT(newProject())); connect(this->editButton,SIGNAL(clicked()),this,SLOT(editProject())); }
bool clCxxWorkspace::AddProject(const wxString& path, wxString& errMsg) { if(!m_doc.IsOk()) { errMsg = wxT("No workspace open"); return false; } wxFileName fn(path); if(!fn.FileExists()) { errMsg = wxT("File does not exist"); return false; } // Load the project into ProjectPtr newProject(new Project()); if(!newProject->Load(path)) { errMsg = wxT("Corrupted project file '"); errMsg << path << wxT("'"); return false; } // Try first to find a project with similar name in the workspace ProjectPtr proj = FindProjectByName(newProject->GetName(), errMsg); if(!proj) { // No project could be find, add it to the workspace DoAddProject(newProject); // Add an entry to the workspace file fn.MakeRelativeTo(m_fileName.GetPath()); wxXmlNode* node = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Project")); node->AddProperty(wxT("Name"), fn.GetName()); node->AddProperty(wxT("Path"), fn.GetFullPath(wxPATH_UNIX)); node->AddProperty(wxT("Active"), m_projects.size() == 1 ? wxT("Yes") : wxT("No")); m_doc.GetRoot()->AddChild(node); if(!SaveXmlFile()) { wxMessageBox( _("Failed to save workspace file to disk. Please check that you have permission to write to disk"), _("CodeLite"), wxICON_ERROR | wxOK); return false; } AddProjectToBuildMatrix(newProject); return true; } else { errMsg = wxString::Format(wxT("A project with a similar name '%s' already exists in the workspace"), proj->GetName().c_str()); return false; } }
/** * @brief NewProject::on_btnCreateProject_clicked */ void NewProjectDialog::on_btnCreateProject_clicked() { QFileInfo path(ui->editProjectPath->text()); QString name = ui->editProjectName->text().simplified().replace(QChar::Space, "_"); if (!checkName(name) || !checkPath(path)) return; emit newProject(name, path.absoluteFilePath()); App::Settings::setLastNewProjectDir(path.absoluteFilePath()); clear(); accept(); }
void QgsOfflineEditingPlugin::unload() { disconnect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( updateActions() ) ); disconnect( mQGisIface->mainWindow(), SIGNAL( newProject() ), this, SLOT( updateActions() ) ); disconnect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), this, SLOT( updateActions() ) ); // remove the GUI mQGisIface->removePluginDatabaseMenu( tr( "&Offline Editing" ), mActionConvertProject ); mQGisIface->removeDatabaseToolBarIcon( mActionConvertProject ); mQGisIface->removePluginDatabaseMenu( tr( "&Offline Editing" ), mActionSynchronize ); mQGisIface->removeDatabaseToolBarIcon( mActionSynchronize ); delete mActionConvertProject; delete mActionSynchronize; }
ProjectQmlScanMonitor::ProjectQmlScanMonitor( ProjectQmlExtension *projectHandler, Project *project, Engine *engine, QObject *parent) : QObject(parent) , m_projectHandler(projectHandler) , m_scanner(new ProjectQmlScanner(engine->engine(), engine->engineMutex(), project->lockedFileIO())) , m_project(project) , m_engine(engine) , m_projectScope(0) { connect(project, SIGNAL(pathChanged(QString)), SLOT(newProject(QString))); connect(project, SIGNAL(directoryChanged(QString)), SLOT(directoryChanged(QString))); connect(project, SIGNAL(fileChanged(QString)), SLOT(fileChanged(QString))); connect(m_scanner, SIGNAL(projectScopeReady()), SLOT(newProjectScope())); connect(m_scanner, SIGNAL(documentScopeReady(ProjectQmlScanMonitor::DocumentQmlScopeTransport*)), SLOT(newDocumentScope(ProjectQmlScanMonitor::DocumentQmlScopeTransport*))); connect(m_scanner, SIGNAL(requestObjectLoad(QString)),SLOT(loadImport(QString))); newProject(project->rootPath()); }
/*! \brief \fn cdegs_main::connectSlots */ void cdegs_main::connectSlots(){ QObject::connect(ui->actionNew_Project, SIGNAL(triggered()), this, SLOT(newProject())); QObject::connect(ui->actionNew_Config, SIGNAL(triggered()), this, SLOT(newConfig())); QObject::connect(ui->actionOpen_Project, SIGNAL(triggered()), this, SLOT(openProject())); QObject::connect(ui->actionSave_Project, SIGNAL(triggered()), this, SLOT(saveProject())); QObject::connect(ui->actionSave_Project_as, SIGNAL(triggered()), this, SLOT(saveProjectAs())); QObject::connect(ui->actionClose_Project, SIGNAL(triggered()), this, SLOT(closeProject())); QObject::connect(ui->tabProjects, SIGNAL(currentChanged(int)), this, SLOT(changeTab())); QObject::connect(ui->tabProjects, SIGNAL(tabCloseRequested(int)), this, SLOT(closeProject(int))); QObject::connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); QObject::connect(ui->actionStylesheet, SIGNAL(triggered()), this, SLOT(openStyleDialog())); QObject::connect(ui->actionOpen_Config, SIGNAL(triggered()), this, SLOT(openConfigDialog())); QObject::connect(ui->actionSave_Config, SIGNAL(triggered()), this, SLOT(saveConfig())); QObject::connect(ui->actionClose_Config, SIGNAL(triggered()), this, SLOT(closeConfig())); QObject::connect(ui->actionExport_Config, SIGNAL(triggered()), this, SLOT(exportConfig())); QObject::connect(ui->actionExport_Config_as, SIGNAL(triggered()), this, SLOT(exportConfigAs())); QObject::connect(ui->actionSave_All_Configs, SIGNAL(triggered()), this, SLOT(saveAllConfigs())); }
void K3b::ProjectManager::addProject( K3b::Doc* doc ) { kDebug() << doc; if( !d->projects.contains( doc ) ) { kDebug() << "adding doc " << doc->URL().toLocalFile(); d->projects.append( doc ); d->projectInterfaces.insert( doc, createProjectInterface( doc ) ); connect( doc, SIGNAL(changed(K3b::Doc*)), this, SLOT(slotProjectChanged(K3b::Doc*)) ); emit newProject( doc ); }
void TrayIcon::setupActions() { newProjectAction = new QAction(tr("New project"), this); connect(newProjectAction, SIGNAL(triggered()), this, SLOT(newProject())); deleteCurrentProjectAction = new QAction(tr("Delete this project"), this); connect(deleteCurrentProjectAction, SIGNAL(triggered()), this, SLOT(deleteCurrentProject())); currentProjectDetailsAction = new QAction(tr("Project details"), this); connect(currentProjectDetailsAction, SIGNAL(triggered()), this, SLOT(currentProjectDetails())); exitAction = new QAction(tr("Exit"), this); connect(exitAction, SIGNAL(triggered()), this, SLOT(exit())); }
void ProjectWindow::contextMenuEvent(QContextMenuEvent * /* event */) { if (projectFileName == "") { QMenu menu(tr("Project menu")); menu.addAction(tr("New project"), this, SLOT(newProject())); menu.addAction(tr("Open project"), this, SLOT(openProject())); menu.addAction(tr("ignore"), this, SLOT(ignore())); menu.exec(QCursor::pos()); } else { QMenu menu(tr("Project menu")); menu.addAction(tr("Add file to project"), this, SLOT(addFile())); menu.addAction(tr("Open file in editor"), this, SLOT(editFile())); menu.addAction(tr("Drop file from project"), this, SLOT(dropFile())); menu.addAction(tr("Close project"), this, SLOT(closeProject())); menu.addAction(tr("ignore"), this, SLOT(ignore())); menu.exec(QCursor::pos()); } }
void MainWindow::createMenu() { QMenu *fileMenu = menuBar()->addMenu(tr("File")); fileMenu->addAction(tr("New project"), this, SLOT(newProject()), QKeySequence::New); fileMenu->addAction(tr("Open project"), this, SLOT(openProject()), QKeySequence::Open); fileMenu->addAction(tr("Save project"), this, SLOT(saveProject()), QKeySequence::Save); fileMenu->addAction(tr("Save as.."), this, SLOT(saveAsProject()), QKeySequence::SaveAs); fileMenu->addSeparator(); fileMenu->addAction(tr("Export image"), this, SLOT(exportImage()), QKeySequence(Qt::CTRL + Qt::Key_E)); QMenu *editMenu = menuBar()->addMenu(tr("Edit")); QMenu *gridEditMenu = editMenu->addMenu(tr("Grid")); gridEditMenu->addAction(tr("Clear fields"), this, SLOT(clearFields())); gridEditMenu->addAction(tr("Clear borders"), this, SLOT(clearBorders())); }
void ProjectManager::createActions() { newProjectAct = new QAction(tr("New Project"),this); newProjectAct->setToolTip(tr("Create New Project")); connect(newProjectAct,SIGNAL(triggered()),this,SLOT(newProject())); openProjectAct = new QAction(tr("Open Project"),this); openProjectAct->setToolTip(tr("Open Project")); connect(openProjectAct,SIGNAL(triggered()),this,SLOT(openProject())); closeProjectAct = new QAction(tr("Close Project"),this); closeProjectAct->setToolTip(tr("Close Project")); connect(closeProjectAct,SIGNAL(triggered()),this,SLOT(closeProject())); QMenu *fileMenu = liteApp->mainWindow()->fileMenu(); QAction *seperator = fileMenu->insertSeparator(fileMenu->actions()[0]); fileMenu->insertActions(seperator,QList<QAction*>() << newProjectAct << openProjectAct << closeProjectAct); }
QgisAppInterface::QgisAppInterface( QgisApp * _qgis ) : qgis( _qgis ), legendIface( _qgis->legend() ) { // connect signals connect( qgis->legend(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) ); connect( qgis, SIGNAL( currentThemeChanged( QString ) ), this, SIGNAL( currentThemeChanged( QString ) ) ); connect( qgis, SIGNAL( composerAdded( QgsComposerView* ) ), this, SIGNAL( composerAdded( QgsComposerView* ) ) ); connect( qgis, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ), this, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ) ); connect( qgis, SIGNAL( initializationCompleted() ), this, SIGNAL( initializationCompleted() ) ); connect( qgis, SIGNAL( newProject() ), this, SIGNAL( newProjectCreated() ) ); connect( qgis, SIGNAL( projectRead() ), this, SIGNAL( projectRead() ) ); }
MainWindowApplication::MainWindowApplication(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowApplication) { ui->setupUi(this); materialsWindow = new MaterialDockWindow(this); ui->dockMateriales->setWidget(materialsWindow); connect(ui->action_New, SIGNAL(triggered()), this, SLOT(newProject())); connect(ui->action_Open, SIGNAL(triggered()), this, SLOT(openProject())); connect(ui->action_Save, SIGNAL(triggered()), this, SLOT(saveProject())); connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveProjectAs())); connect(ui->action_Close, SIGNAL(triggered()), this, SLOT(closeProject())); connect(ui->actionEdit_Material_defiinition, SIGNAL(triggered()), this, SLOT(editMaterialLibrary())); connect(ui->actionE_xit, SIGNAL(triggered()), this, SLOT(exitApp())); on_mdiArea_subWindowActivated(NULL); }
/* * Initialize the GUI interface for the plugin - this is only called once when the plugin is * added to the plugin registry in the QGIS application. */ void RoadGraphPlugin::initGui() { // create shorttest path dock mQShortestPathDock = new RgShortestPathWidget( mQGisIface->mainWindow() , this ); mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mQShortestPathDock ); // Create the action for tool mQSettingsAction = new QAction( QIcon( ":/roadgraph/road.png" ), tr( "Road graph settings" ), this ); mQShowDirectionAction = new QAction( QIcon( ":/roadgraph/showdirect.png" ), tr( "Show road's direction" ), this ); mInfoAction = new QAction( QIcon( ":/roadgraph/about.png" ), tr( "About" ), this ); // Set the what's this text mQSettingsAction->setWhatsThis( tr( "Road graph plugin settings" ) ); mQShowDirectionAction->setWhatsThis( tr( "Roads direction viewer" ) ); mInfoAction->setWhatsThis( tr( "About Road graph plugin" ) ); mQShowDirectionAction->setCheckable( true ); setGuiElementsToDefault(); // Connect the action to slots connect( mQSettingsAction, SIGNAL( triggered() ), this, SLOT( property() ) ); connect( mQShowDirectionAction, SIGNAL( triggered() ), this, SLOT( onShowDirection() ) ); connect( mInfoAction, SIGNAL( triggered() ), SLOT( about() ) ); // Add the icons to the toolbar mQGisIface->addToolBarIcon( mQShowDirectionAction ); mQGisIface->addPluginToMenu( tr( "Road graph" ), mQSettingsAction ); mQGisIface->addPluginToMenu( tr( "Road graph" ), mQShowDirectionAction ); mQGisIface->addPluginToMenu( tr( "Road graph" ), mInfoAction ); connect( mQGisIface->mapCanvas(), SIGNAL( renderComplete( QPainter* ) ), this, SLOT( render( QPainter* ) ) ); connect( mQGisIface, SIGNAL( projectRead() ), this, SLOT( projectRead() ) ); connect( mQGisIface, SIGNAL( newProjectCreated() ), this, SLOT( newProject() ) ); connect( mQGisIface, SIGNAL( projectRead() ), mQShortestPathDock, SLOT( clear() ) ); connect( mQGisIface, SIGNAL( newProjectCreated() ), mQShortestPathDock, SLOT( clear() ) ); // load settings projectRead(); } // RoadGraphPlugin::initGui()
void QgsOfflineEditingPlugin::initGui() { delete mActionConvertProject; // Create the action for tool mActionConvertProject = new QAction( QIcon( ":/offline_editing/offline_editing_copy.png" ), tr( "Convert to offline project" ), this ); mActionConvertProject->setObjectName( "mActionConvertProject" ); // Set the what's this text mActionConvertProject->setWhatsThis( tr( "Create offline copies of selected layers and save as offline project" ) ); // Connect the action to the run connect( mActionConvertProject, SIGNAL( triggered() ), this, SLOT( convertProject() ) ); // Add the icon to the toolbar mQGisIface->addDatabaseToolBarIcon( mActionConvertProject ); mQGisIface->addPluginToDatabaseMenu( tr( "&Offline Editing" ), mActionConvertProject ); mActionConvertProject->setEnabled( false ); mActionSynchronize = new QAction( QIcon( ":/offline_editing/offline_editing_sync.png" ), tr( "Synchronize" ), this ); mActionSynchronize->setObjectName( "mActionSynchronize" ); mActionSynchronize->setWhatsThis( tr( "Synchronize offline project with remote layers" ) ); connect( mActionSynchronize, SIGNAL( triggered() ), this, SLOT( synchronize() ) ); mQGisIface->addDatabaseToolBarIcon( mActionSynchronize ); mQGisIface->addPluginToDatabaseMenu( tr( "&Offline Editing" ), mActionSynchronize ); mActionSynchronize->setEnabled( false ); mOfflineEditing = new QgsOfflineEditing(); mProgressDialog = new QgsOfflineEditingProgressDialog( mQGisIface->mainWindow(), QgisGui::ModalDialogFlags ); connect( mOfflineEditing, SIGNAL( progressStarted() ), this, SLOT( showProgress() ) ); connect( mOfflineEditing, SIGNAL( layerProgressUpdated( int, int ) ), this, SLOT( setLayerProgress( int, int ) ) ); connect( mOfflineEditing, SIGNAL( progressModeSet( QgsOfflineEditing::ProgressMode, int ) ), this, SLOT( setProgressMode( QgsOfflineEditing::ProgressMode, int ) ) ); connect( mOfflineEditing, SIGNAL( progressUpdated( int ) ), this, SLOT( updateProgress( int ) ) ); connect( mOfflineEditing, SIGNAL( progressStopped() ), this, SLOT( hideProgress() ) ); connect( mOfflineEditing, SIGNAL( warning( QString, QString ) ), mQGisIface->messageBar(), SLOT( pushWarning( QString, QString ) ) ); connect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( updateActions() ) ); connect( mQGisIface->mainWindow(), SIGNAL( newProject() ), this, SLOT( updateActions() ) ); connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), this, SLOT( updateActions() ) ); connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), this, SLOT( updateActions() ) ); connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( updateActions() ) ); updateActions(); }
/* * Menu Bar - Open Button */ void Pixelepsy::on_actionOpen_triggered() { if (!fileSaved) newProject(); if(cancelFlag || fileSaved){ QFile file(QFileDialog::getOpenFileName(this, "Select a file to open...", "../", tr("Sprite Projects (*.ssp)"))); //as long as file can be opened, proceed if (file.exists()) { //create parameters to load from buffer int width; int height; int frames; file.open(QIODevice::ReadOnly); QTextStream fileStream(&file); fileStream >> width >> height; fileStream >> frames; int red, green, blue, alpha; Buffer* buffer = new Buffer(width, height); for (int frame = 0; frame < frames; frame++) { if (frame) buffer->current()->addFrame(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { fileStream >> red >> green >> blue >> alpha; QRgb value = qRgba(red, green, blue, alpha); buffer->get(frame, 0).setPixel(x, y, value); } } } Viewer* view = new Viewer(std::shared_ptr<Buffer>(buffer)); // Viewer* view = new Viewer(std::make_shared<Buffer>(width, height)); this->mdiArea->addSubWindow(view); view->show(); view->updateView(); }
int MainUI::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: updatePointView((*reinterpret_cast< hash_map<int,Entity*>*(*)>(_a[1]))); break; case 1: updateNodeInfo((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 2: newProject(); break; case 3: quit(); break; case 4: showAllObjects(); break; case 5: saveCurrentScreen(); break; case 6: itemView(); break; case 7: editorView(); break; case 8: filterPtsByOBAFilter(); break; case 9: classifyObjs(); break; case 10: resetEntitysType(); break; case 11: extractBuildingManual(); break; case 12: exportBuilding(); break; case 13: autoRun(); break; case 14: datasetInfo(); break; case 15: importDTM(); break; case 16: importPoint(); break; case 17: importRectangle(); break; case 18: importTIN(); break; case 19: text2las(); break; case 20: las2text(); break; case 21: about(); break; case 22: showMousePos((*reinterpret_cast< const int(*)>(_a[1])),(*reinterpret_cast< const int(*)>(_a[2]))); break; case 23: identifyObject((*reinterpret_cast< const int(*)>(_a[1])),(*reinterpret_cast< const int(*)>(_a[2]))); break; case 24: cancelBuilding((*reinterpret_cast< const int(*)>(_a[1]))); break; case 25: useEntityParam((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const int(*)>(_a[2]))); break; default: ; } _id -= 26; } return _id; }
void QgsBrowserDockWidget::showEvent( QShowEvent * e ) { // delayed initialization of the model if ( !mModel ) { mModel = new QgsBrowserModel( mBrowserView ); connect( QgisApp::instance(), SIGNAL( newProject() ), mModel, SLOT( updateProjectHome() ) ); mProxyModel = new QgsBrowserTreeFilterProxyModel( this ); mProxyModel->setBrowserModel( mModel ); mBrowserView->setSettingsSection( objectName().toLower() ); // to distinguish 2 instances ow browser mBrowserView->setModel( mProxyModel ); // provide a horizontal scroll bar instead of using ellipse (...) for longer items mBrowserView->setTextElideMode( Qt::ElideNone ); mBrowserView->header()->setResizeMode( 0, QHeaderView::ResizeToContents ); mBrowserView->header()->setStretchLastSection( false ); // selectionModel is created when model is set on tree connect( mBrowserView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection & ) ), this, SLOT( selectionChanged( const QItemSelection &, const QItemSelection & ) ) ); // objectName used by settingsSection() is not yet set in constructor QSettings settings; mPropertiesWidgetEnabled = settings.value( settingsSection() + "/propertiesWidgetEnabled", false ).toBool(); mActionPropertiesWidget->setChecked( mPropertiesWidgetEnabled ); mPropertiesWidget->setVisible( false ); // false until item is selected mPropertiesWidgetHeight = settings.value( settingsSection() + "/propertiesWidgetHeight" ).toFloat(); QList<int> sizes = mSplitter->sizes(); int total = sizes.value( 0 ) + sizes.value( 1 ); int height = ( int )total * mPropertiesWidgetHeight; sizes.clear(); sizes << total - height << height; mSplitter->setSizes( sizes ); }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: newProject(); break; case 1: openProject(); break; case 2: quitProject(); break; case 3: runProject(); break; case 4: optionsProject(); break; case 5: aboutSG(); break; case 6: setHelpFrame(); break; case 7: setSGFrame(); break; case 8: fillTree((*reinterpret_cast< QString(*)>(_a[1]))); break; case 9: enableRun((*reinterpret_cast< QString(*)>(_a[1]))); break; case 10: printOutput(); break; default: ; } _id -= 11; } return _id; }