예제 #1
0
RecentFiles::RecentFiles(QMainWindow *parent)
    : QObject(parent)
    , m_recentMenu(new QMenu(parent))
    , m_recentMenuTriggeredAction(NULL)

{
    // create the sub-menu
    m_recentMenu->setTitle("Open Recent...");
    m_recentMenu->setObjectName("RecentMenu");

    // create an action for all possible entries in the sub-menu
    for (int i=0 ; i < MaxRecentFiles; i++) {
        m_recentFileActions[i] = new QAction(m_recentMenu);
        m_recentFileActions[i]->setText("---");
        m_recentFileActions[i]->setVisible(false);
        connect(m_recentFileActions[i], SIGNAL(triggered()),
                this, SLOT(openRecentFile()));
        m_recentMenu->addAction(m_recentFileActions[i]);
    }

    // Set some defaults
    QSettings settings;

    if (! settings.value(recentFileCount).isValid() )
        settings.setValue(recentFileCount, QVariant(4));

    // If there are no recent files, initialize an empty list
    if (! settings.allKeys().contains(recentFileListId)) {
        settings.setValue(recentFileListId, QVariant(QStringList()));
    }

    updateRecentFiles(settings);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void StandardSIMPLViewApplication::updateRecentFileList(const QString& file)
{
  SIMPLViewMenuItems* menuItems = SIMPLViewMenuItems::Instance();

  for (int i = 0; i < m_SIMPLViewInstances.size(); i++)
  {
    SIMPLView_UI* window = m_SIMPLViewInstances[i];

    if (NULL != window)
    {
      QMenu* recentFilesMenu = menuItems->getMenuRecentFiles();
      QAction* clearRecentFilesAction = menuItems->getActionClearRecentFiles();

      // Clear the Recent Items Menu
      recentFilesMenu->clear();

      // Get the list from the static object
      QStringList files = QRecentFileList::instance()->fileList();
      foreach(QString file, files)
      {
        QAction* action = new QAction(recentFilesMenu);
        action->setText(QRecentFileList::instance()->parentAndFileName(file));
        action->setData(file);
        action->setVisible(true);
        recentFilesMenu->addAction(action);
        connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
      }

      recentFilesMenu->addSeparator();
      recentFilesMenu->addAction(clearRecentFilesAction);
    }
예제 #3
0
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: newFile(); break;
        case 1: open(); break;
        case 2: { bool _r = save();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 3: { bool _r = saveas();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 4: find(); break;
        case 5: goToCell(); break;
        case 6: sort(); break;
        case 7: about(); break;
        case 8: openRecentFile(); break;
        case 9: updateStatusBar(); break;
        case 10: spreadsheetModified(); break;
        default: ;
        }
        _id -= 11;
    }
    return _id;
}
예제 #4
0
파일: window.cpp 프로젝트: MaelRL/cgal
MainWindow::MainWindow() : 
QMainWindow(), Ui_MainWindow(), 
maxNumRecentFiles(15), recentFileActs(15)
{
  setupUi(this);

  // init scene
  m_scene = new Scene;
  viewer->set_scene(m_scene);

  // options
  m_verbose = 0;
  m_mchoice = 0;
  m_relevance = 1.0;
  m_use_flip = true;
  m_percent  = 100.0;
  m_relocation = 2;

  // accepts drop events
  setAcceptDrops(true);

  // Handling actions
  addRecentFiles(menuFile, actionQuit);
  connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
  connect(this, SIGNAL(openRecentFile(QString)), this, SLOT(open(QString)));
  Q_EMIT update();
  viewer->update();
}
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: newFile(); break;
        case 1: openFile(); break;
        case 2: loadFile((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: openRecentFile(); break;
        case 4: showOptions(); break;
        case 5: updateTime(); break;
        case 6: lookupAGS_ID(); break;
        case 7: lookupPCC_ID(); break;
        case 8: lookupPCC_ID((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 9: setEventType((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 10: setEventID((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 11: setEventTypeID((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 12: boo(); break;
        case 13: showError((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 14: login(); break;
        case 15: logout(); break;
        default: ;
        }
        _id -= 16;
    }
    return _id;
}
예제 #6
0
GreatWindow::GreatWindow(int monitor, bool main, QWidget *parent) :
    QMainWindow(parent), m_jumping(false), m_monitor(monitor),
    ui(new Ui::GreatWindow), m_bMainWindow(main)
{
    ui->setupUi(this);
    if(!main) {
        ui->menuBar->hide();
    } else {
        m_recentFileActions[0] = ui->actionFile1;
        m_recentFileActions[1] = ui->actionFile2;
        m_recentFileActions[2] = ui->actionFile3;
        m_recentFileActions[3] = ui->actionFile4;
        m_recentFileActions[4] = ui->actionFile5;

        for(int i=0; i<5; i++){
            connect(m_recentFileActions[i], SIGNAL(triggered()),
                    this, SLOT(openRecentFile()));
        }

        ContentMgr.loadRecentFiles();
    }

    ui->mainToolBar->hide();
    updateRecent();

    m_canvas = new CCanvas(ui->center);
    this->setCentralWidget(m_canvas);
    setupStatusBar();

    updateZoom();
}
void RecentFiles::actionRecent()
{
	QAction *action = qobject_cast<QAction *>(sender());

	if ( action )
		emit openRecentFile( action->data().toString() );
}
예제 #8
0
    MainWindow::MainWindow()
    {
        resize(640, 640);

        scroll = new QScrollArea();
        scroll->setWidgetResizable(true);
        setCentralWidget(scroll);

        editor = new EditorWidget();
        scroll->setWidget(editor);

        statusBar()->showMessage(tr("%1 - by Overkill.").arg(AppName), 2000);
        statusBar()->setStyleSheet(
            "QStatusBar {"
            "   border-top: 1px solid #CCCCCC;"
            "   background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DADBDE, stop: 1 #F6F7FA);"
            "   padding: 4px;"
            "   color: #777777;"
            "}"
        );

#ifdef Q_WS_WIN
        QKeySequence quitSequence(Qt::ALT + Qt::Key_F4);
#else
        QKeySequence quitSequence(QKeySequence::Quit);
#endif

        fileMenu = menuBar()->addMenu(tr("&File"));
        newAction = createAction(fileMenu, tr("&New"), tr("Create a new CHR."), QKeySequence::New);
        openAction = createAction(fileMenu, tr("&Open..."), tr("Open an existing CHR."), QKeySequence::Open);
        createSeparator(fileMenu);
        saveAction = createAction(fileMenu, tr("&Save..."), tr("Save the current CHR."), QKeySequence::Save);
        saveAsAction = createAction(fileMenu, tr("Save &As..."), tr("Save a copy of the current CHR."), QKeySequence::SaveAs);
        createSeparator(fileMenu);
        for(int i = 0; i < MaxRecentCount; ++i)
        {
            auto action = createAction(fileMenu, QKeySequence(Qt::ALT + Qt::Key_1 + i));
            action->setDisabled(true);
            recentFileActions[i] = action;
            connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
        }
        clearRecentAction = createAction(fileMenu, tr("Clear &Recent Files"), tr("Clear all recently opened files."), QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Delete));
        updateRecentFiles();
        createSeparator(fileMenu);
        exitAction = createAction(fileMenu, tr("E&xit"), tr("Exit the program."), quitSequence);

        helpMenu = menuBar()->addMenu(tr("&Help"));
        aboutAction = createAction(helpMenu, tr("&About..."), tr("About %1.").arg(AppName), QKeySequence::HelpContents);

        connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));
        connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
        connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
        connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));
        connect(clearRecentAction, SIGNAL(triggered()), this, SLOT(clearRecentFiles()));
        connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
        connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));

        QTimer::singleShot(0, this, SLOT(newFile()));
    }
예제 #9
0
void MainWindow::refreshOpenedFile()
{
    for (int i = 0; i < m_recentFileActions->size(); ++i)
    {
      m_fileMenu->addAction(m_recentFileActions->at(i));
      connect(m_recentFileActions->at(i),SIGNAL(triggered()),this,SLOT(openRecentFile()));
    }
}
예제 #10
0
MainWindow::MainWindow()
  : DemosMainWindow()
{
  setupUi(this);

  // Add a GraphicItem for the Circular triangulation
  agi = new CGAL::Qt::ArcsGraphicsItem<CircularKernel>(arcs, intersections);

  agi->setIntersectionsPen(QPen(Qt::red, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));

  QObject::connect(this, SIGNAL(changed()),
		   agi, SLOT(modelChanged()));

  agi->setInputPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  scene.addItem(agi);
  agi->hide();

  // Setup input handlers. They get events before the scene gets them
  // and the input they generate is passed to the triangulation with 
  // the signal/slot mechanism    
  cai = new CGAL::Qt::GraphicsViewCircularArcInput<CircularKernel>(this, &scene);

  QObject::connect(cai, SIGNAL(generate(CGAL::Object)),
		   this, SLOT(processInput(CGAL::Object)));

  // Manual handling of actions
  //
  QObject::connect(this->actionQuit, SIGNAL(triggered()), 
		   qApp, SLOT(quit()));

  // Check two actions 
  this->actionInsertCircularArc->setChecked(true);

  //
  // Setup the scene and the view
  //
  scene.setItemIndexMethod(QGraphicsScene::NoIndex);
  scene.setSceneRect(-100, -100, 100, 100);
  this->graphicsView->setScene(&scene);

  // Uncomment the following line to get antialiasing by default.
//   actionUse_Antialiasing->setChecked(true);

  // Turn the vertical axis upside down
  this->graphicsView->scale(1, -1);
                                                      
  // The navigation adds zooming and translation functionality to the
  // QGraphicsView
  this->addNavigation(this->graphicsView);

  this->setupStatusBar();
  this->setupOptionsMenu();
  this->addAboutDemo(":/cgal/help/about_Circular_kernel_2.html");
  this->addAboutCGAL();
  this->addRecentFiles(this->menuFile, this->actionQuit);
  connect(this, SIGNAL(openRecentFile(QString)),
	  this, SLOT(open(QString)));
}
예제 #11
0
MainWindow::MainWindow()
  : DemosMainWindow()
{
  setupUi(this);

  this->graphicsView->setAcceptDrops(false);

  agi = new CGAL::Qt::ApolloniusGraphGraphicsItem<Apollonius, K>(&ag);

  QObject::connect(this, SIGNAL(changed()),
		   agi, SLOT(modelChanged()));

  agi->setSitesPen(QPen(Qt::red, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  agi->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  scene.addItem(agi);

  // Setup input handlers. They get events before the scene gets them
  // and the input they generate is passed to the triangulation with 
  // the signal/slot mechanism    

  ci = new CGAL::Qt::GraphicsViewCircleInput<K>(this, &scene);
  QObject::connect(ci, SIGNAL(generate(CGAL::Object)),
		   this, SLOT(processInput(CGAL::Object)));

  scene.installEventFilter(ci);

  // 
  // Manual handling of actions
  //

  QObject::connect(this->actionQuit, SIGNAL(triggered()), 
		   this, SLOT(close()));

  //
  // Setup the scene and the view
  //
  scene.setItemIndexMethod(QGraphicsScene::NoIndex);
  scene.setSceneRect(-100, -100, 100, 100);
  this->graphicsView->setScene(&scene);
  this->graphicsView->setMouseTracking(true);

  // Turn the vertical axis upside down
  this->graphicsView->matrix().scale(1, -1);
                                                      
  // The navigation adds zooming and translation functionality to the
  // QGraphicsView
  this->addNavigation(this->graphicsView);

  this->setupStatusBar();
  this->setupOptionsMenu();
  this->addAboutDemo(":/cgal/help/about_Apollonius_graph_2.html");
  this->addAboutCGAL();

  this->addRecentFiles(this->menuFile, this->actionQuit);
  connect(this, SIGNAL(openRecentFile(QString)),
	  this, SLOT(open(QString)));
}
예제 #12
0
void MainWindow::addRecentFileActionFirst(QString fileName)
{
    QList<QAction *> la=ui->menuDocuments_recents->actions();
    QAction *newRecentFile=new QAction(reducedFileName(fileName),this);
    newRecentFile->setData(QVariant(fileName));
    if(la.length()>0) ui->menuDocuments_recents->insertAction(la[0],newRecentFile);
    else ui->menuDocuments_recents->addAction(newRecentFile);
    connect(newRecentFile,SIGNAL(triggered()),this,SLOT(openRecentFile()));
}
예제 #13
0
void MainWindow::initrecentFilesAction()
{
    for (int i = 0; i < MaxRecentFile; ++i) {
        recentFilesAction[i] = new QAction(this);
        recentFilesAction[i]->setVisible(false);
        connect(recentFilesAction[i], SIGNAL(triggered()),
                this, SLOT(openRecentFile()));
    }
}
예제 #14
0
void GLShaderDev::initializeActions()
{
    QSettings settings;

    QMenu* recent;
    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    fileMenu->addAction(QIcon(":/document-new.png"), tr("&New..."), _newFileDialog, SLOT(exec()), QKeySequence::New);
    connect(_newFileDialog, SIGNAL(accepted()), this, SLOT(newFile()));
    fileMenu->addAction(QIcon(":/document-open.png"), tr("&Open..."), this, SLOT(openFileDialog()), QKeySequence::Open);
    recent = fileMenu->addMenu(QIcon(":/document-open-recent.png"), tr("Open &Recent"));

    for (int i = 0; i < MaxRecentFiles; ++i)
        (_recentFileActions[i] = recent->addAction(tr("<Empty>"), this, SLOT(openRecentFile())))->setVisible(true);
    (_recentFileActions[MaxRecentFiles] = recent->addSeparator())->setVisible(true);
    (_recentFileActions[MaxRecentFiles + 1] = recent->addAction(tr("&Clear List"), this, SLOT(clearFileRecent())))->setEnabled(false);
    updateRecentFiles();

    fileMenu->addSeparator();
    fileMenu->addAction(QIcon(":/document-save-all.png"), tr("Save Al&l"), _editor, SLOT(saveAll()));
    fileMenu->addAction(QIcon(":/document-save.png"), tr("&Save"), _editor, SLOT(save()), QKeySequence::Save);
    fileMenu->addAction(QIcon(":/document-save-as.png"), tr("Save &As..."), this, SLOT(saveFileAs()), QKeySequence::SaveAs);
    fileMenu->addSeparator();
    fileMenu->addAction(QIcon(":/dialog-close.png"), tr("&Close"), _editor, SLOT(closeCurrentTab()), tr("Ctrl+W"));
    fileMenu->addAction(QIcon(":/dialog-close.png"), tr("Cl&ose All"), _editor, SLOT(closeAllTabs()), tr("Ctrl+Shift+W"));
    fileMenu->addSeparator();
    fileMenu->addAction(QIcon(":/application-exit.png"), tr("&Quit"), this, SLOT(close()), QKeySequence::Quit);

    QMenu* projectMenu = menuBar()->addMenu(tr("&Project"));
    projectMenu->addAction(QIcon(":/project-development-new-template.png"), tr("&New Project"), this, SLOT(newProject()));
    projectMenu->addAction(QIcon(":/project-open.png"), tr("&Open Project..."), this, SLOT(openProjectDialog()));
    recent = projectMenu->addMenu(QIcon(":/document-open-recent.png"), tr("Open &Recent"));

    for (int i = 0; i < MaxRecentProjects; ++i)
        (_recentProjectActions[i] = recent->addAction(tr("<Empty>"), this, SLOT(openRecentProject())))->setVisible(true);
    (_recentProjectActions[MaxRecentProjects] = recent->addSeparator())->setVisible(true);
    (_recentProjectActions[MaxRecentProjects + 1] = recent->addAction(tr("&Clear List"), this, SLOT(clearProjectRecent())))->setEnabled(false);
    updateRecentProjects();

    projectMenu->addSeparator();
    projectMenu->addAction(QIcon(":/configure.png"), tr("Open &Configuration..."), this, SLOT(openProjectConfiguration()));
    projectMenu->addAction(QIcon(":/run-build.png"), tr("&Build Current"), this, SLOT(buildCurrentProject()), tr("F8"));
    projectMenu->addSeparator();
    projectMenu->addAction(QIcon(":/project-development-close.png"), tr("&Close Project"), this, SLOT(closeProject()));

    menuBar()->addMenu("|")->setEnabled(false);

    QMenu* toolsMenu = menuBar()->addMenu(tr("&Tools"));
    toolsMenu->addAction(QIcon(":/preferences-other.png"), tr("&OpenGL Info..."), this, SLOT(showGLInfo()));

    QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
    settingsMenu->addAction(QIcon(":/preferences-other.png"), tr("&Preferences..."), this, SLOT(showPreferences()));

    QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
    helpMenu->addAction(QIcon(":/glsd-icon.png"), tr("&About GLShaderDev"), this, SLOT(about()));
    helpMenu->addAction(QIcon(":/qt-icon.png"), tr("About &Qt"), qApp, SLOT(aboutQt()));
}
예제 #15
0
void MainWindow::createRecentFileActions()
{
    for(int i=0;i<MaxRecentFiles;++i)
    {
        recentFileActions[i] = new QAction(this);
        recentFileActions[i]->setText(tr("xxxx"));
        recentFileActions[i]->setVisible(true);
        connect(recentFileActions[i],SIGNAL(triggered()),
                this,SLOT(openRecentFile()));
    }
}
예제 #16
0
/****** Initialization *****/
void SoulNote::createActions()
{
    for (int i = 0; i < MaxRecentFiles; ++i) {
        recentFileActs[i] = new QAction(this);
        recentFileActs[i]->setVisible(false);
        connect(recentFileActs[i], SIGNAL(triggered()),
                this, SLOT(openRecentFile()));
    }

    exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcut(tr("Ctrl+Q"));
    exitAct->setStatusTip(tr("Exit the application"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(exit_triggered()));
}
예제 #17
0
void MainWindow::addRecentFile()
{
    QFileInfo fileinfo(m_currentMindMapPath);
    m_preferences->registerValue("MindMapDirectory",fileinfo.absoluteDir().canonicalPath());
    QAction* tmp=new QAction(fileinfo.fileName(),this);
    tmp->setData(fileinfo.absoluteFilePath());
    connect(tmp,SIGNAL(triggered()),this,SLOT(openRecentFile()));

    int size=m_preferences->value("MaxSizeRecentFile",5).toInt();
    if((size<=m_recentFileActions->size())&&(size>0))
    {
        delete m_recentFileActions->at(0);
        m_recentFileActions->removeAt(0);
    }
    m_recentFileActions->append(tmp);
}
예제 #18
0
void MainWindow::createActions()
{
    openAct = new QAction(tr("&Open..."), this);
    openAct->setShortcuts(QKeySequence::Open);
    openAct->setStatusTip(tr("Open an existing file"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    for (int i = 0; i < maxRecentFiles; ++i)
    {
        recentFileActs[i] = new QAction(this);
        recentFileActs[i]->setVisible(false);
        connect(recentFileActs[i], SIGNAL(triggered()),this, SLOT(openRecentFile()));
    }
    refreshAct = new QAction(tr("Recompile scripts"), this);
    refreshAct->setShortcuts(QKeySequence::Refresh);
    connect(refreshAct, SIGNAL(triggered()), this, SLOT(refreshScripts()));
}
예제 #19
0
void MainWindow::createRFActs()
{
    while (recentFilesPath.size() > maxRecentFiles) {
        recentFilesPath.removeLast();
    }

    //remove the files moved or deleted from the list
    QStringList temp;
    foreach(QString flag, recentFilesPath) {
        if (QFileInfo(flag).exists()) {
            temp << flag;
        }
    }
    recentFilesPath = temp;

    //clean menu and actions
    recentFilesMenu->clear();
    for (int i = 0; i < recentFilesAct.size(); i++) {
        recentFilesAct.at(i)->~QAction();
    }

    //add action to clear list
    recentFilesMenu->addAction(deleteRecentFilesAct);
    recentFilesMenu->addSeparator();

    //enable/disable the menu
    recentFilesMenu->setEnabled(recentFilesPath.size() > 0);

    recentFilesAct.clear();
    if (recentFilesPath.size() > 0) {
        for (int i = 0; i < recentFilesPath.size(); i++) {
            //creo y agrego un objeto QAction con un icono generico y el nombre del archivo
            recentFilesAct << new QAction(QIcon::fromTheme("image-x-generic"), QFileInfo(recentFilesPath.at(i)).fileName(), this);

            //agrego la direccion completa a la data del QAction correspondiente
            recentFilesAct.at(i)->setData(recentFilesPath.at(i));

            //connecto la accion con el slot encargado de abrir las imagenes recientes
            connect(recentFilesAct.at(i), SIGNAL(triggered()), this, SLOT(openRecentFile()));

            //agrego la accion al menu
            recentFilesMenu->addAction(recentFilesAct.at(i));
        }
    }
}
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: eventChanged((*reinterpret_cast< AGSEventType(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 1: newFile(); break;
        case 2: openFile(); break;
        case 3: closeFile(); break;
        case 4: exportFile(); break;
        case 5: importToDatabase(); break;
        case 6: loadFile((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 7: openRecentFile(); break;
        case 8: showOptions(); break;
        case 9: updateTime(); break;
        case 10: lookupAGS_ID(); break;
        case 11: lookupPCC_ID(); break;
        case 12: lookupPCC_ID((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 13: setEventTypeID((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 14: setEvent((*reinterpret_cast< AGSEventType(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 15: setLogoutTime(); break;
        case 16: setLogoutTime((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 17: setTShirtCalc((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 18: setTimer((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 19: setTimer((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 20: boo(); break;
        case 21: showError((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 22: login(); break;
        case 23: logout(); break;
        case 24: about(); break;
        case 25: tutorial(); break;
        case 26: reportABug(); break;
        case 27: testConnection(); break;
        case 28: { QString _r = generateHeader();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; }  break;
        case 29: rewriteHeader(); break;
        default: ;
        }
        _id -= 30;
    }
    return _id;
}
예제 #21
0
void CMainWindow::iniConnect()
{
	connect(textEdit, SIGNAL(cursorPositionChanged()), 
		this, SLOT(doCursorChanged()));
	connect(actNew, SIGNAL(triggered()), 
		this, SLOT(doNew()));
	connect(actOpen, SIGNAL(triggered()), 
		this, SLOT(doOpen()));
	connect(actClose, SIGNAL(triggered()), 
		this, SLOT(doClose()));
	connect(actSave, SIGNAL(triggered()), 
		this, SLOT(doSave()));
	connect(actASave, SIGNAL(triggered()), 
		this, SLOT(doASave()));
	connect(actQuit, SIGNAL(triggered()),
		this, SLOT(doQuit()));
	connect(actUndo, SIGNAL(triggered()), 
		this, SLOT(doUndo()));
	connect(actCut, SIGNAL(triggered()), 
		this, SLOT(doCut()));
	connect(actCopy, SIGNAL(triggered()), 
		this, SLOT(doCopy()));
	connect(actPaste, SIGNAL(triggered()), 
		this, SLOT(doPast()));
	connect(actAll, SIGNAL(triggered()), 
		this, SLOT(doAll()));
	connect(actFind, SIGNAL(triggered()), 
		this, SLOT(doFind()));
	connect(textEdit->document(), SIGNAL(contentsChanged()), 
		this, SLOT(doModified()));
	separatorAct = menu_F->insertSeparator(actQuit);
	separatorAct->setVisible(false);
	for (int i = 0; i < MaxRecentFiles; ++i) 
	{
         recentFileActs[i] = new QAction(this);
		 menu_F->insertAction(separatorAct, recentFileActs[i]);
         recentFileActs[i]->setVisible(false);
         connect(recentFileActs[i], SIGNAL(triggered()),
                 this, SLOT(openRecentFile()));
     }	 
	 
	actPrint = menu_T->addAction(tr("打印文档"));
	connect(actPrint, SIGNAL(triggered()), this, SLOT(doPrint()));
}
예제 #22
0
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: newFile(); break;
        case 1: open(); break;
        case 2: save(); break;
        case 3: saveAs(); break;
        case 4: openRecentFile(); break;
        case 5: about(); break;
        default: ;
        }
        _id -= 6;
    }
    return _id;
}
예제 #23
0
void MainWindow::createActions()
{
    newAct = new QAction(tr("&New"), this);
    newAct->setShortcuts(QKeySequence::New);
    newAct->setStatusTip(tr("Create a new file"));
    connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

    openAct = new QAction(tr("&Open..."), this);
    openAct->setShortcuts(QKeySequence::Open);
    openAct->setStatusTip(tr("Open an existing file"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    saveAct = new QAction(tr("&Save"), this);
    saveAct->setShortcuts(QKeySequence::Save);
    saveAct->setStatusTip(tr("Save the document to disk"));
    connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));

    saveAsAct = new QAction(tr("Save &As..."), this);
    saveAsAct->setShortcuts(QKeySequence::SaveAs);
    saveAsAct->setStatusTip(tr("Save the document under a new name"));
    connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));

    for (int i = 0; i < MaxRecentFiles; ++i) {
        recentFileActs[i] = new QAction(this);
        recentFileActs[i]->setVisible(false);
        connect(recentFileActs[i], SIGNAL(triggered()),
                this, SLOT(openRecentFile()));
    }

    exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcuts(QKeySequence::Quit);
    exitAct->setStatusTip(tr("Exit the application"));
    connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

    aboutAct = new QAction(tr("&About"), this);
    aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    aboutQtAct = new QAction(tr("About &Qt"), this);
    aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
    connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
예제 #24
0
void RecentFilesAction::createActions()
{
	m_recentFileActions.clear();
	QAction *action;
	for (int i = 0; i < m_numOfRecentFiles; ++i)
	{
		action = new QAction(this);
		action->setVisible(false);
		connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
		m_recentFileActions.append(action);
	}

	// when the user has decreased the maximum number of recent files, then we must remove the superfluous entries
	while (m_recentFilesList.size() > m_numOfRecentFiles)
		m_recentFilesList.removeLast();

	updateMenu();

	m_recentMenu->clear(); // this also deletes all the QActions in the menu
	m_recentMenu->addActions(m_recentFileActions);
}
예제 #25
0
void MainWindow::createActions()
{
	newAction=new QAction(tr("新建"),this);
	newAction->setIcon(QIcon("F:/QT4Project/knuth.jpg"));
	newAction->setShortcut(QKeySequence::New);
	connect(newAction,SIGNAL(triggered()),this,SLOT(newFile()));

	openAction=new QAction("打开",this);
	openAction->setIcon(QIcon("F:/QT4Project/8.jpg"));
	openAction->setShortcut(QKeySequence::Open);
    connect(openAction,SIGNAL(triggered()),widget,SLOT(loadImageFile()));

	saveAction=new QAction("保存",this);
	saveAction->setIcon(QIcon("F:/QT4Project/knuth.jpg"));
	saveAction->setShortcut(QKeySequence::Save);
	connect(saveAction,SIGNAL(triggered()),this,SLOT(saveFile()));

	for(int i=0;i<5;i++)	
	{
		recentFileAction[i]=new QAction(this);
		recentFileAction[i]->setVisible(false);
		connect(recentFileAction[i],SIGNAL(triggered()),this,SLOT(openRecentFile()));
	}

	cutAction=new QAction("剪切",this);	
	cutAction->setIcon(QIcon("F:/QT4Project/knuth.jpg:/"));
	//connect(cutAction,SIGNAL(triggered()),this,SLOT())	
	
	exitAction=new QAction("关闭",this);
	exitAction->setIcon(QIcon("F:/QT4Project/knuth.jpg"));
    exitAction->setShortcut(tr("Ctrl+W"));
	connect(exitAction,SIGNAL(triggered()),this,SLOT(close()));
	localCVAction=new QAction("LocalCV分割算法",this);
	localCVAction->setIcon(QIcon("F:/QT4Project/knuth.jpg:/"));
	connect(localCVAction,SIGNAL(triggered()),this,SLOT(localCV()));
	
	sradAction=new QAction("SRAD分割算法",this);
	connect(sradAction,SIGNAL(triggered()),this,SLOT(srad()));
}
예제 #26
0
MainWindow::MainWindow()
  : DemosMainWindow(), density(12.0), ratio(1.6), integrating(1.0), sampling(1)
{
  setupUi(this);

  this->graphicsView->setAcceptDrops(false);


  // Manual handling of actions
  //

  QObject::connect(this->actionQuit, SIGNAL(triggered()), 
		   this, SLOT(close()));

  //
  // Setup the scene and the view
  //
  scene.setItemIndexMethod(QGraphicsScene::NoIndex);
  scene.setSceneRect(-100, -100, 100, 100);
  this->graphicsView->setScene(&scene);

  // Turn the vertical axis upside down
  this->graphicsView->matrix().scale(1, -1);
                                                      
  // The navigation adds zooming and translation functionality to the
  // QGraphicsView
  this->addNavigation(this->graphicsView);

  this->setupStatusBar();
  this->setupOptionsMenu();
  this->addAboutDemo(":/cgal/help/about_Stream_lines_2.html");
  this->addAboutCGAL();

  this->addRecentFiles(this->menuFile, this->actionQuit);
  connect(this, SIGNAL(openRecentFile(QString)),
	  this, SLOT(open(QString)));
}
예제 #27
0
파일: mainwindow.cpp 프로젝트: jzsun/raptor
void MainWindow::initMenuFile() {
	//connect menu "File" Action
	connect(actionNew, SIGNAL(triggered()), _documentManager, SLOT(newDocument()));
	connect(actionOpen, SIGNAL(triggered()), _documentManager, SLOT(open()));
	connect(actionSave, SIGNAL(triggered()), _documentManager, SLOT(save()));
	connect(actionSaveAs, SIGNAL(triggered()), _documentManager, SLOT(saveAs()));
	connect(actionSaveACopyAs, SIGNAL(triggered()), _documentManager, SLOT(saveACopyAs()));
	connect(actionSaveAll, SIGNAL(triggered()), _documentManager, SLOT(saveAll()));
	connect(actionClose, SIGNAL(triggered()), _documentManager, SLOT(close()));
	connect(actionCloseAll, SIGNAL(triggered()), _documentManager, SLOT(closeAll()));
	connect(actionCloseAllExceptCurrentDocument, SIGNAL(triggered()), _documentManager, SLOT(closeAllExceptCurrentDocument()));
	connect(actionReload, SIGNAL(triggered()), _documentManager, SLOT(reload()));
	connect(actionPrint, SIGNAL(triggered()), _documentManager, SLOT(print()));
	connect(actionExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

	connect(actionExportAsHTML, SIGNAL(triggered()), this, SLOT(exportDocument()));

	connect(actionNewSession, SIGNAL(triggered()), _sessionManager, SLOT(newSession()));
	connect(actionOpenSession, SIGNAL(triggered()), _sessionManager, SLOT(openSession()));
	connect(actionSwitchSession, SIGNAL(triggered()), _sessionManager, SLOT(switchSession()));
	connect(actionSaveSession, SIGNAL(triggered()), _sessionManager, SLOT(saveSession()));
	connect(actionSaveSessionAs, SIGNAL(triggered()), _sessionManager, SLOT(saveSessionAs()));
	connect(actionManageSessions, SIGNAL(triggered()), _sessionManager, SLOT(manageSessions()));

	//recent file actions
	connect(actionEmptyRecentFilesList, SIGNAL(triggered()), this, SLOT(clearRecentFile()));
	connect(actionOpenAllRecentFiles, SIGNAL(triggered()), this, SLOT(openAllRecentFile()));
	_recentFileSeparator = menuRecentFiles->addSeparator();
	for (int i = 0; i < MaxRecentFiles; ++i) {
		_recentFileActions[i] = new QAction(this);
		_recentFileActions[i]->setVisible(false);
		connect(_recentFileActions[i], SIGNAL(triggered()),this, SLOT(openRecentFile()));
		menuRecentFiles->addAction(_recentFileActions[i]);
	}
	updateRecentFileActions();
}
예제 #28
0
파일: MainWindow.C 프로젝트: bjnano/IQmol
void MainWindow::updateRecentFilesMenu()
{     
   if (m_recentFilesMenu) {
      m_recentFilesMenu->clear();
      QStringList files(Preferences::RecentFiles());
      QAction* action;
      QFileInfo info;
      
      for (int i = 0; i < files.count(); ++i) {
          info.setFile(files[i]);
          if (info.exists() && info.isReadable()) {
             action = m_recentFilesMenu->addAction(info.fileName());
             action->setData(files[i]);
             connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
          }else {
             Preferences::RemoveRecentFile(files[i]);
          }
      }
      
      m_recentFilesMenu->addSeparator();
      action = m_recentFilesMenu->addAction("Clear List");
      connect(action, SIGNAL(triggered()), this, SLOT(clearRecentFilesMenu()));
   }
}
예제 #29
0
// Menu actions
void MainWindow::createActions()
{
    Configuration& config = Persistent<Configuration>( "settings" );

    openAction = new QAction(tr("&Open..."), this);
    openAction->setShortcut(QKeySequence::Open);
    openAction->setIcon( QIcon(":/images/open16.png") );
    openAction->setStatusTip(tr("Open a file"));
    connect(openAction, SIGNAL(triggered()), this, SLOT(open()));

    // Recent files
    for (int i = 0; i < MaxRecentFiles; ++i) {
        recentFileActions[i] = new QAction(this);
        recentFileActions[i]->setVisible(false);
        connect(recentFileActions[i], SIGNAL(triggered()),
                this, SLOT(openRecentFile()));
    }

    exitAction = new QAction(tr("E&xit"), this);
    exitAction->setShortcut(tr("Ctrl+Q"));
    exitAction->setStatusTip(tr("Exit the application"));
    connect( exitAction, SIGNAL(triggered()), this, SLOT(close()) );

    copyAction = new QAction(tr("&Copy"), this);
    copyAction->setShortcut(QKeySequence::Copy);
    copyAction->setStatusTip(tr("Copy the selected line"));
    connect( copyAction, SIGNAL(triggered()), this, SLOT(copy()) );

    findAction = new QAction(tr("&Find..."), this);
    findAction->setShortcut(QKeySequence::Find);
    findAction->setStatusTip(tr("Find the text"));
    connect( findAction, SIGNAL(triggered()),
            this, SLOT( find() ) );

    overviewVisibleAction = new QAction( tr("Matches &overview"), this );
    overviewVisibleAction->setCheckable( true );
    overviewVisibleAction->setChecked( config.isOverviewVisible() );
    connect( overviewVisibleAction, SIGNAL( toggled( bool ) ),
            this, SLOT( toggleOverviewVisibility( bool )) );

    followAction = new QAction( tr("&Follow File"), this );
    followAction->setShortcut(Qt::Key_F);
    followAction->setCheckable(true);
    connect( followAction, SIGNAL(toggled( bool )),
            this, SIGNAL(followSet( bool )) );

    reloadAction = new QAction( tr("&Reload"), this );
    reloadAction->setShortcut(QKeySequence::Refresh);
    reloadAction->setIcon( QIcon(":/images/reload16.png") );
    connect( reloadAction, SIGNAL(triggered()), this, SLOT(reload()) );

    stopAction = new QAction( tr("&Stop"), this );
    stopAction->setIcon( QIcon(":/images/stop16.png") );
    stopAction->setEnabled( false );
    connect( stopAction, SIGNAL(triggered()), this, SLOT(stop()) );

    filtersAction = new QAction(tr("&Filters..."), this);
    filtersAction->setStatusTip(tr("Show the Filters box"));
    connect( filtersAction, SIGNAL(triggered()), this, SLOT(filters()) );

    optionsAction = new QAction(tr("&Options..."), this);
    optionsAction->setStatusTip(tr("Show the Options box"));
    connect( optionsAction, SIGNAL(triggered()), this, SLOT(options()) );

    aboutAction = new QAction(tr("&About"), this);
    aboutAction->setStatusTip(tr("Show the About box"));
    connect( aboutAction, SIGNAL(triggered()), this, SLOT(about()) );

    aboutQtAction = new QAction(tr("About &Qt"), this);
    aboutAction->setStatusTip(tr("Show the Qt library's About box"));
    connect( aboutQtAction, SIGNAL(triggered()), this, SLOT(aboutQt()) );
}
예제 #30
0
MainWindow::
MainWindow():
controler(NULL),
separatorAct(NULL)
{
  SoQt::init(this);
  SoVolumeRendering::init();

  for(int i = 0; i < MaxRecentFiles; ++i)
  {
    recentFileActs[i] = NULL;
  }

  SnapSurfaceManip::initClass();
  TranslateRadialManip::initClass();
  CrossHairManip::initClass();

  setupUi(this); // this sets up GUI
  switchProjectType(ProjectProperties::noneProject);
  setCentralWidget(mdiArea);
  showMaximized();

  /*
   * If all SoQt windows are closed, then probably SoQt frees up some
   * local areas. This causes a segmentation fault after a new SoQt
   * viewer is opened. To avoid this problem, here a new examiner viewer
   * is created that is not freed during the whole lifespan of the
   * application, until the application is closed.
  */
  new SoQtExaminerViewer;

  //Menu global menu signals
  connect(actionAbout, SIGNAL(triggered()),
          this, SLOT(about())); 
  connect(actionCloseProject, SIGNAL(triggered()),
          this, SLOT(closeProject())); 
  connect(actionExit, SIGNAL(triggered()),
          this, SLOT(close())); 

  setDefaultConnections();

  //set up toolbars in menus
  menuToolbars->addAction(toolBarWarpingMode->toggleViewAction());
  menuToolbars->addAction(toolBarGeneral->toggleViewAction());
  menuToolbars->addAction(toolBarModes->toggleViewAction());
  menuToolbars->addAction(toolBarOperations->toggleViewAction());

  toolBarModes->setVisible(true);
  toolBarModes->setVisible(false);
  toolBarWarpingMode->setVisible(false);
  toolBarOperations->setVisible(false);

  menuFile->removeAction(menuOpen_project->menuAction());
  statusbar->showMessage("Application started", 5000);

  for(int i = 0; i < MaxRecentFiles; ++i)
  {
    recentFileActs[i] = new QAction(this);
    recentFileActs[i]->setVisible(false);
    connect(recentFileActs[i], SIGNAL(triggered()),
	    this, SLOT(openRecentFile()));
  }
  for(int i = 0; i < MaxRecentFiles; ++i)
  {
    menuFile->insertAction(actionExit,recentFileActs[i]);
  }
  separatorAct = menuFile->insertSeparator(actionExit);
  updateRecentFileActions();
}