/** * Parses the command line, after it was stripped of its KDE options. * The command line may contain one of the following options: * 1. A project file (named cscope.proj) * 2. A Cscope cross-reference database * 3. A list of source files * @param pArgs Command line arguments */ void KScope::parseCmdLine(KCmdLineArgs* pArgs) { QString sArg; QFileInfo fi; int i; // Loop over all arguments for (i = 0; i < pArgs->count(); i++) { // Verify the argument is a file or directory name sArg = pArgs->arg(i); fi.setFile(sArg); if (!fi.exists()) continue; // Handle the current argument if (fi.isFile()) { if (fi.fileName() == "cscope.proj") { // Open a project file openProject(fi.dirPath(true)); return; } else if (openCscopeOut(sArg)) { // Opened the file as a cross-reference database return; } else { // Assume this is a source file slotShowEditor(sArg, 0); } } else if (fi.isDir()) { // Treat the given path as a project directory openProject(fi.absFilePath()); return; } } }
/* Restore the app to its state before it was shut down. */ void MainWindow::readSettings() { QSettings settings("MakingThings", "mcbuilder"); settings.beginGroup("MainWindow"); QSize size = settings.value( "size" ).toSize( ); if( size.isValid( ) ) resize( size ); QList<QVariant> splitterSettings = settings.value( "splitterSizes" ).toList( ); QList<int> splitterSizes; if( !splitterSettings.isEmpty( ) ) { for( int i = 0; i < splitterSettings.count( ); i++ ) splitterSizes.append( splitterSettings.at(i).toInt( ) ); splitter->setSizes( splitterSizes ); } if(settings.value("checkForUpdates", true).toBool()) updater->checkForUpdates(APPUPDATE_BACKGROUND); QString lastProject = settings.value("lastOpenProject").toString(); if(!lastProject.isEmpty()) openProject(lastProject); settings.endGroup(); QPoint mainWinPos = settings.value("mainwindow_pos").toPoint(); if(!mainWinPos.isNull()) move(mainWinPos); }
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())); }
void BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues) { Q_UNUSED(platform); Q_UNUSED(extraValues); // Create dialog and launch d->parameterPages = createParameterPages(path); Internal::CheckoutWizardDialog dialog(d->parameterPages, parent); if (!d->progressTitle.isEmpty()) dialog.setTitle(d->progressTitle); if (!d->startedStatus.isEmpty()) dialog.setStartedStatus(d->startedStatus); d->dialog = &dialog; connect(&dialog, SIGNAL(progressPageShown()), this, SLOT(slotProgressPageShown())); dialog.setWindowTitle(displayName()); if (dialog.exec() != QDialog::Accepted) return; // Now try to find the project file and open const QString checkoutPath = d->checkoutPath; d->clear(); QString errorMessage; const QString projectFile = openProject(checkoutPath, &errorMessage); if (projectFile.isEmpty()) { QMessageBox msgBox(QMessageBox::Warning, tr("Cannot Open Project"), tr("Failed to open project in \"%1\".").arg(QDir::toNativeSeparators(checkoutPath))); msgBox.setDetailedText(errorMessage); msgBox.addButton(QMessageBox::Ok); msgBox.exec(); } }
/* Called when the "open" action is triggered. Prompt the user for which project they'd like to open. */ void MainWindow::onOpen( ) { QString projectPath = QFileDialog::getExistingDirectory(this, tr("Open Project"), Preferences::workspace(), QFileDialog::ShowDirsOnly); if( !projectPath.isNull() ) // user cancelled openProject(projectPath); }
void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues) { Q_UNUSED(platform); Q_UNUSED(extraValues); // Create dialog and launch Utils::FileName checkoutPath; { QScopedPointer<BaseCheckoutWizard> wizard(m_wizardCreator(Utils::FileName::fromString(path), parent)); wizard->setWindowTitle(displayName()); checkoutPath = wizard->run(); } if (checkoutPath.isEmpty()) return; // Now try to find the project file and open QString errorMessage; const QString projectFile = openProject(checkoutPath, &errorMessage); if (projectFile.isEmpty()) { QMessageBox msgBox(QMessageBox::Warning, tr("Cannot Open Project"), tr("Failed to open project in \"%1\".").arg(checkoutPath.toUserOutput())); msgBox.setDetailedText(errorMessage); msgBox.addButton(QMessageBox::Ok); msgBox.exec(); } }
void MainWindow::playGame(const QString& gameId) { GluonPlayer::AllGameItemsModel *model = qobject_cast<GluonPlayer::AllGameItemsModel*>(GluonPlayer::GameManager::instance()->allGamesModel()); const QString projectPath = model->data(gameId, GluonPlayer::AllGameItemsModel::UriRole).toString(); openProject(projectPath); }
void MyApplication::MessageReceived(BMessage *msg) { switch(msg->what) { case B_CANCEL: case MSG_CANCEL: if(state == StateNoProjectLoaded) { title_window->Show(); } break; case MSG_OPEN: openProject(); break; case MSG_CREATE: case MSG_NEW: createNewProject(msg); break; case MSG_SHOW_CONSOLE: case MSG_HIDE_CONSOLE: showConsole(msg->what); break; case MSG_QUIT: be_app->PostMessage(B_QUIT_REQUESTED); break; default: break; }; }
void MainWindow::openRecentProject() { QAction *action = qobject_cast<QAction *>(sender()); if (action != 0) openProject(action->data().toString()); }
void TupMainWindow::setupFileActions() { TAction *newProject = new TAction(QPixmap(THEME_DIR + "icons/new.png"), tr("New project"), QKeySequence(tr("Ctrl+N")), this, SLOT(newProject()), m_actionManager); newProject->setStatusTip(tr("Open new project")); m_actionManager->insert(newProject, "newproject", "file"); TAction *openFile = new TAction(QPixmap(THEME_DIR + "icons/open.png"), tr("Open project"), QKeySequence(tr("Ctrl+O")), this, SLOT(openProject()), m_actionManager); m_actionManager->insert( openFile, "openproject", "file" ); openFile->setStatusTip(tr("Load existent project")); TAction *openNetFile = new TAction(QPixmap(THEME_DIR + "icons/net_document.png"), tr("Open project from server..."), tr(""), this, SLOT(openProjectFromServer()), m_actionManager); m_actionManager->insert(openNetFile, "opennetproject", "file"); TAction *importNetFile = new TAction(QPixmap(THEME_DIR + "icons/import_project.png"), tr("Export project to server..."), tr(""), this, SLOT(importProjectToServer()), m_actionManager); m_actionManager->insert(importNetFile, "exportprojectserver", "file"); TAction *save = new TAction(QPixmap(THEME_DIR + "icons/save.png"), tr( "Save project" ), QKeySequence(tr("Ctrl+S")), this, SLOT(saveProject()), m_actionManager); m_actionManager->insert(save, "saveproject", "file"); save->setStatusTip(tr("Save current project in current location")); TAction *saveAs = new TAction(QPixmap(THEME_DIR + "icons/save_as.png"), tr("Save project &As..."), QKeySequence(tr("Ctrl+Shift+S")), m_actionManager); connect(saveAs, SIGNAL(triggered()), this, SLOT(saveAs())); saveAs->setStatusTip(tr("Open dialog box to save current project in any location")); m_actionManager->insert(saveAs, "saveprojectas", "file"); TAction *close = new TAction(QPixmap(THEME_DIR + "icons/close.png"), tr("Cl&ose project"), QKeySequence(tr("Ctrl+W")), m_actionManager); connect(close, SIGNAL(triggered()), this, SLOT(closeProject())); close->setStatusTip(tr("Close active project")); m_actionManager->insert(close, "closeproject", "file"); // Import Palette action TAction *importPalette = new TAction(QPixmap(THEME_DIR + "icons/import.png"), tr("&Import GIMP palettes"), QKeySequence(tr("Ctrl+G")), this, SLOT(importPalettes()), m_actionManager); importPalette->setStatusTip(tr("Import palettes")); m_actionManager->insert(importPalette, "importpalettes", "file"); // Export Project action TAction *exportProject = new TAction(QPixmap(THEME_DIR + "icons/export.png"), tr("&Export Project"), QKeySequence(tr("Ctrl+R")), this, SLOT(exportProject()), m_actionManager); exportProject->setStatusTip(tr("Export project to several video formats")); m_actionManager->insert(exportProject, "export", "file"); // Exit action TAction *exit = new TAction(QPixmap(THEME_DIR + "icons/exit.png"), tr("E&xit"), QKeySequence(tr("Ctrl+Q")), qApp, SLOT(closeAllWindows()), m_actionManager); exit->setStatusTip(tr("Close application")); m_actionManager->insert(exit, "exit", "file"); // when the last window is closed, the application should quit connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); }
/** * Handles the "Project->New..." command. * Prompts the user for the name and folder for the project, and then creates * the project. */ void KScope::slotCreateProject() { NewProjectDlg dlg(true, this); ProjectBase::Options opt; QString sProjPath; // Prompt the user to close any active projects if (m_pProjMgr->curProject()) { if (KMessageBox::questionYesNo(0, i18n("The current project needs to be closed before a new one is" " created.\nWould you like to close it now?")) != KMessageBox::Yes) { return; } // Try to close the project. if (!slotCloseProject()) return; } // Display the "New Project" dialog if (dlg.exec() != QDialog::Accepted) return; // Create and open the new project dlg.getOptions(opt); if (m_pProjMgr->create(dlg.getName(), dlg.getPath(), opt, sProjPath)) openProject(sProjPath); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->actionNew_project, SIGNAL(triggered()), SLOT(addNewProject())); connect(ui->actionOpen_project, SIGNAL(triggered()), SLOT(openProject())); connect(ui->actionSave_project, SIGNAL(triggered()), SLOT(saveProject())); connect(ui->actionSave_project_as, SIGNAL(triggered()), SLOT(saveProjectAs())); connect(ui->actionClose_project, SIGNAL(triggered()), SLOT(closeProject())); connect(ui->actionUndo, SIGNAL(triggered()), SLOT(undo())); connect(ui->actionRedo, SIGNAL(triggered()), SLOT(redo())); connect(ui->actionImport, SIGNAL(triggered()), SLOT(importProject())); connect(ui->actionExport, SIGNAL(triggered()), SLOT(exportProject())); connect(ui->actionAbout, SIGNAL(triggered()), SLOT(showAbout())); connect(ui->actionAbout_Qt, SIGNAL(triggered()), SLOT(showAboutQt())); QString fileName = //"/home/gogi/Downloads/pcsc_pcsc_00001.vcf"; "G:\\pcsc_pcsc_00001.vcf"; QFile file(fileName); //showProject(new VCardProject(file)); updateProjectState(); }
void MainWindow::loadProject(){ QString dir = QFileDialog::getExistingDirectory(this, tr("Open Project Directory"), "",QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) return; //User canceled QFileDialog openProject(dir); }
void MainWindow::openProject() { QString fileName = QFileDialog::getOpenFileName(this, QString(), QString(), tr("Project File (*.qcode)")); if (!fileName.isEmpty()) openProject(fileName); }
void MainWindow:: setDefaultConnections() { connect(actionOpenValueTarget, SIGNAL(triggered()), this, SLOT(openValueTarget())); connect(actionOpenMeshTarget, SIGNAL(triggered()), this, SLOT(openMeshTarget())); connect(actionOpenSurfaceTarget, SIGNAL(triggered()), this, SLOT(openSurfaceTarget())); connect(actionOpenCompositeTarget, SIGNAL(triggered()), this, SLOT(openCompositeTarget())); connect(actionOpenValueSource, SIGNAL(triggered()), this, SLOT(openValueSource())); connect(actionOpenSurfaceSource, SIGNAL(triggered()), this, SLOT(openSurfaceSource())); connect(actionOpenMeshSource, SIGNAL(triggered()), this, SLOT(openMeshSource())); connect(actionTile, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); connect(actionCascade, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows())); connect(actionOptions, SIGNAL(triggered()), this, SLOT(options())); connect(actionOpenProject, SIGNAL(triggered()), this, SLOT(openProject())); }
void Atlas::openProjectDialog(bool) { QString file_name = QFileDialog::getOpenFileName(this, tr("Open Project"), "", tr("Files (*.apro)")); openProject(file_name); }
void MainWindow::openRecentFile() { QAction* action = qobject_cast<QAction*>(sender()); if(action) { QString fileName = action->data().toString(); if(QFile::exists(fileName)) { if(fileName.endsWith(".chmvp")) { openProject(fileName); currentSaveFile = fileName; } else { parser->setFileName(fileName); loadFile(); currentSaveFile = ""; } recentlyOpenedFiles.removeAll(fileName); recentlyOpenedFiles.prepend(fileName); updateRecentFiles(); } else { error("Unable to open " + fileName + ". The file has been moved."); updateRecentFiles(); } } }
void GLShaderDev::openRecentProject() { QAction* action = qobject_cast<QAction*>(sender()); if (action) openProject(action->data().toString()); }
void KTMainWindow::openRecentProject() { QAction *action = qobject_cast<QAction *>(sender()); if ( action ) { openProject( action->text() ); } }
void KTMainWindow::openProject() { QString package = QFileDialog::getOpenFileName ( this, tr("Import project package"), REPOSITORY, tr("KToon Project Package (*.ktn)")); if ( package.isEmpty() ) return; openProject( package ); }
bool MainWindow::importProject() { ImportProject dialog(this); if (!dialog.exec()) return false; return openProject(dialog.fileName(), dialog.sourceDirectory(), dialog.buildDirectory()); }
void GLShaderDev::loadSettings() { QSettings settings; QString lastProject = settings.value("lastProject").toString(); if (!lastProject.isEmpty()) openProject(lastProject); }
void Atlas::action_OpenRecentProject() { QAction *action = qobject_cast<QAction *>(sender()); if (action) { openProject(action->data().toString()); } }
void KexiWelcomeAssistant::emitOpenProject(KexiProjectData *data) { bool opened = false; emit openProject(*data, projects()->shortcutPath(*data), &opened); if (opened) { // update recent projects view data->setLastOpened(QDateTime::currentDateTime()); d->m_mainWelcomePage->updateRecentProjects(); } }
void StartScreen::setSignals(QObject *l) { //Связывание сигналов кнопок стартового экрана с сигналами windowManager WindowManager *m = qobject_cast<WindowManager*>(l); QObject::connect(this->Exit,SIGNAL(clicked()),this,SLOT(close())); QObject::connect(this->newProject,SIGNAL(clicked()),m,SLOT(openWorkBench())); QObject::connect(this->loadProject,SIGNAL(clicked()),m,SLOT(openProject())); }
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())); }
void ProjectOperationHandler::openProject() { QString filename = QFileDialog::getOpenFileName( m_parent, tr("Open Project"), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), tr("Project Files (*.darkproj)") ); if(filename != "") emit openProject(filename); }
void MainWindow::loadDirectory() { QFile inputFile(LAST_FILE); if (inputFile.open(QIODevice::ReadOnly)) { QTextStream in(&inputFile); lastfile = in.readLine(); inputFile.close(); if (QDir(lastfile).exists()) openProject(lastfile); } }
void MainWindow::createMenus() { setMenuBar(new QMenuBar(this)); // ============= file ============= QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openPrjAction = new QAction(tr("Open &project"), this); openPrjAction->setStatusTip(tr("Opens a project as directory")); openPrjAction->setShortcut(QKeySequence::Open); fileMenu->addAction(openPrjAction); connect(openPrjAction, SIGNAL(triggered()), this, SLOT(openProject())); }
/* Called when the "new project" action is triggered. Create a new project directory and project file within it. */ void MainWindow::onNewProject( ) { QString workspace = Preferences::workspace(); QString newProjPath = QFileDialog::getSaveFileName(this, tr("Create Project"), workspace, "", 0, QFileDialog::ShowDirsOnly); if(!newProjPath.isNull()) { QString newProject = projectManager.createNewProject(newProjPath); if(!newProject.isEmpty()) openProject(newProject); else return statusBar()->showMessage(tr("Couldn't create new project. Make sure there are no spaces in the path specified."), 3000); } }