Esempio n. 1
0
    //les actions
void MNotePad::creerAction()
{
    a_nouveauTab = new QAction(QIcon("images/nouveau.png"),tr("nouveau"),this);
    a_nouveauTab->setShortcut(tr("Ctrl+N"));
    connect(a_nouveauTab,SIGNAL(triggered()),this,SLOT(nouveauTab()));
    a_ouvrirTab = new QAction(QIcon("images/ouvrir.png"),tr("ouvrir"),this);
    a_ouvrirTab->setShortcut(tr("Ctrl+O"));
    connect(a_ouvrirTab,SIGNAL(triggered()),this,SLOT(ouvrirTab()));
    a_saveTab = new QAction(QIcon("images/save.png"),tr("save"),this);
    a_saveTab->setShortcut(tr("Ctrl+S"));
    connect(a_saveTab,SIGNAL(triggered()),this,SLOT(saveTab()));
    a_fermerTab = new QAction(tr("fermer"),this);
    a_fermerTab->setShortcut(tr("Ctrl+W"));
    connect(a_fermerTab,SIGNAL(triggered()),this,SLOT(fermerTab()));
    a_quitter = new QAction(QIcon("images/quitter.png"),tr("quitter"),this);
    a_quitter->setShortcut(tr("Ctrl+Q"));
    connect(a_quitter,SIGNAL(triggered()),qApp,SLOT(quit()));

    a_precedent = new QAction(QIcon("images/precedent.png"),tr("precedent"),this);
    a_precedent->setShortcut(tr("Ctrl+Z"));
    connect(a_precedent,SIGNAL(triggered()),this,SLOT(precedent()));
    a_suivant = new QAction(QIcon("images/suivant.png"),tr("suivant"),this);
    a_suivant->setShortcut(tr("Ctrl+F"));
    connect(a_suivant,SIGNAL(triggered()),this,SLOT(suivant()));
    a_font = new QAction(QIcon("images/font.png"),tr("font"),this);
    connect(a_font,SIGNAL(triggered()),this,SLOT(font()));

    a_apropos = new QAction(QIcon("images/apropos.png"),tr("A propos"),this);
    connect(a_apropos,SIGNAL(triggered()),this,SLOT(apropos()));
    a_aproposQt = new QAction(QIcon("images/aproposQt.png"),tr("A propos de Qt"),this);
    connect(a_aproposQt,SIGNAL(triggered()),qApp,SLOT(aboutQt()));
    }
Esempio n. 2
0
void MainWindow::on_save_triggered()
{
	if (n)
		saveTab(cur_tab);
	else
		QMessageBox::warning(ui->tabWidget,"Error","Возможно вы не открыли/создали ни одного файла",QMessageBox::Yes,QMessageBox::Yes);
}
Esempio n. 3
0
void MainWindow::on_save_all_triggered()
{
	if (!n)
		QMessageBox::warning(ui->tabWidget,"Error","Возможно вы не открыли/создали ни одного файла",QMessageBox::Yes,QMessageBox::Yes);
	for (int i = 0;i < n;i++)
		saveTab(i);
}
Esempio n. 4
0
bool ScriptableProxyHelper::saveTab(const QString &arg1)
{
    INVOKE(saveTab(arg1));
    ClipboardBrowser *c = fetchBrowser();
    if (!c)
        return false;

    const int i = m_wnd->findTabIndex( c->tabName() );
    return m_wnd->saveTab(arg1, i);
}
Esempio n. 5
0
//Закрытие таба
void MainWindow::on_tabWidget_tabCloseRequested(int index)
{
    QString format;
    switch (tabs[index]->getLang())
    {
    case CPP:
        format = ".cpp";
        break;
    case PAS:
        format = ".pas";
        break;
    case APX:
        format = ".apx";
        break;
    }
    if (tabs[index]->changed)
    {
        QMessageBox msgBox;
        msgBox.setWindowTitle("Сохранить изменения");
        msgBox.setText("Вы хотите сохранить изменения файла "+(ui->tabWidget->tabText(index))+" ?");
        msgBox.setIcon(QMessageBox::Warning);
        msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
        msgBox.setDefaultButton(QMessageBox::Cancel);
        msgBox.exec();
        res=0;
        int ret = msgBox.result();
        switch (ret)
        {
        case QMessageBox::Discard:
            ui->tabWidget->removeTab(index);
            delete tabs[index];
            tabs.erase(tabs.begin()+index);
            n--;
            break;
        case QMessageBox::Save:
            saveTab(index);
            ui->tabWidget->removeTab(index);
            delete tabs[index];
            tabs.erase(tabs.begin()+index);
            n--;
            break;
        case QMessageBox::Cancel:

            res=1;
            break;
        }
    }
	else
	{
		ui->tabWidget->removeTab(index);
		delete tabs[index];
		tabs.erase(tabs.begin()+index);
		n--;
	}
}
Esempio n. 6
0
void MainWindow::createActions() {
    mNewFileAction = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
    mNewFileAction->setShortcut(QKeySequence::New);
    mNewFileAction->setStatusTip(tr("Open a new file"));
    connect(mNewFileAction, SIGNAL(triggered()), this, SLOT(newBlankPage()));

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

    mSaveFileAction = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
    mSaveFileAction->setShortcut(QKeySequence::Save);
    mSaveFileAction->setStatusTip(tr("Save file"));
    connect(mSaveFileAction, SIGNAL(triggered()), this, SLOT(saveTab()));

    mSaveAsFileAction = new QAction(QIcon(":/images/saveAs.png"), tr("Save &As"), this);
    mSaveAsFileAction->setShortcut(QKeySequence::SaveAs);
    mSaveAsFileAction->setStatusTip(tr("Save file as"));
    connect(mSaveAsFileAction, SIGNAL(triggered()), this, SLOT(savePageAs()));

    mExitAction = new QAction(tr("&Exit"), this);
    mExitAction->setShortcut(QKeySequence::Quit);
    mExitAction->setStatusTip(tr("Exit the application"));
    connect(mExitAction, SIGNAL(triggered()), this, SLOT(close()));

    /* Project Actions */
    mNewProjectAction = new QAction(tr("New Project"), this);
    mNewFileAction->setStatusTip(tr("Creates a new Project"));
    connect(mNewProjectAction, SIGNAL(triggered()), this, SLOT(newProject()));

    mOpenProjectAction = new QAction(tr("Open Project"), this);
    mOpenProjectAction->setStatusTip(tr("Open an existing project"));

    mSaveProjectAction = new QAction(tr("Save Project"), this);
    mSaveProjectAction->setStatusTip(tr("Save current project"));

    mSaveProjectAsAction = new QAction(tr("Save Project As"), this);
    mSaveProjectAsAction->setStatusTip(tr("Save current project as"));

    mShowProjectViewAction = new QAction(tr("Show Project View"), this);
    mShowProjectViewAction->setStatusTip(tr("Show Project Settings and Properties"));
    connect(mShowProjectViewAction, SIGNAL(triggered()), this, SLOT(showProjectView()));

    mShowTransistionDiagramAction = new QAction(tr("Show Transistion Diagram"), this);
    mShowTransistionDiagramAction->setStatusTip(tr("Show the Projects Transistion Diagram"));
    connect(mShowTransistionDiagramAction, SIGNAL(triggered()), this, SLOT(showTransistionDiagram()));

    mGenerateHOLAction = new QAction(tr("Generate HOL"), this);
    mGenerateHOLAction->setStatusTip(tr("Generate all the HOL files for the project"));

    mGenerateHaskellAction = new QAction(tr("Generate Haskell"), this);
    mGenerateHaskellAction->setStatusTip(tr("Generate all the Haskell files for the project"));

    mGenerateDocAction = new QAction(tr("Generate Documentation"), this);
    mGenerateDocAction->setStatusTip(tr("Generate Documentation for project"));

    mCloseProjectAction = new QAction(tr("Close project"), this);
    mCloseProjectAction->setStatusTip(tr("Closes the current project"));

    /* Edit Actions */

    mUndoAction = new QAction(tr("&Undo"), this);
    mUndoAction->setShortcut(QKeySequence::Undo);
    mUndoAction->setStatusTip(tr("Undo"));
    connect(mUndoAction, SIGNAL(triggered()), this, SLOT(undo()));

    mRedoAction = new QAction(tr("&Redo"), this);
    mRedoAction->setShortcut(QKeySequence::Redo);
    mRedoAction->setStatusTip(tr("Redo"));
    connect(mRedoAction, SIGNAL(triggered()), this, SLOT(redo()));

    mCutAction = new QAction(tr("&Cut"), this);
    mCutAction->setShortcut(QKeySequence::Cut);
    mCutAction->setStatusTip(tr("Cut"));
    connect(mCutAction, SIGNAL(triggered()), this, SLOT(cut()));

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

    mPasteAction = new QAction(tr("&Paste"), this);
    mPasteAction->setShortcut(QKeySequence::Paste);
    mPasteAction->setStatusTip(tr("Paste"));
    connect(mPasteAction, SIGNAL(triggered()), this, SLOT(paste()));

    mSelectAllAction = new QAction(tr("Select &All"), this);
    mSelectAllAction->setShortcut(QKeySequence::SelectAll);
    mSelectAllAction->setStatusTip(tr("Select All"));
    connect(mSelectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));

    mFindReplaceAction = new QAction(tr("&Find/Replace"), this);
    mFindReplaceAction->setShortcut(QKeySequence::Find);
    mFindReplaceAction->setStatusTip(tr("Find/Replace"));
    connect(mSelectAllAction, SIGNAL(triggered()), this, SLOT(findReplace()));

    /* HOL Menu Actions */
    mHOLRestartAction = new QAction(tr("Restart HOL"), this);
    mHOLRestartAction->setStatusTip(tr("Restart the HOL buffer"));
    connect(mHOLRestartAction, SIGNAL(triggered()), mHOLWidget, SLOT(restart()));

    mHOLSendRegionToAction = new QAction(tr("Send Region to HOL"), this);
    mHOLSendRegionToAction->setStatusTip(tr("Sends the highlighted region to the HOL buffer"));
    //connect

    mHOLRunHolmakeAction = new QAction(tr("Run Holmake"), this);
    mHOLRunHolmakeAction->setStatusTip(tr("Runs Holamake in current directory"));
    connect(mHOLRunHolmakeAction, SIGNAL(triggered()), this, SLOT(runHolmake()));

    mHOLShowTypesAction = new QAction(tr("Show Types"), this);
    mHOLShowTypesAction->setStatusTip(tr("Show Types"));
    connect(mHOLShowTypesAction, SIGNAL(triggered()), mHOLWidget, SLOT(showTypes()));

    mHOLShowTypesVerboseAction = new QAction(tr("Show Types Verbosely"), this);
    mHOLShowTypesVerboseAction->setStatusTip(tr("Show Types Verbosely"));
    connect(mHOLShowTypesVerboseAction, SIGNAL(triggered()), mHOLWidget, SLOT(showTypesVerbose()));

    mHOLShowNumericalTypesAction = new QAction(tr("Show Numerical Types"), this);
    mHOLShowNumericalTypesAction->setStatusTip(tr("Show Numerical Types"));
    connect(mHOLShowNumericalTypesAction, SIGNAL(triggered()), mHOLWidget, SLOT(showNumericalTypes()));

    mHOLShowAssumptionsAction = new QAction(tr("Show Assumptions"), this);
    mHOLShowAssumptionsAction->setStatusTip(tr("Show Assumptions"));
    connect(mHOLShowAssumptionsAction, SIGNAL(triggered()), mHOLWidget, SLOT(showAssumptions()));

    /* Help Menu Actions */
    mHOLDocumentationAction = new QAction(tr("HOL Documentation"), this);
    mHOLDocumentationAction->setStatusTip(tr("Show HOL Documentation"));

    mAboutAction = new QAction(tr("About"), this);
    mAboutAction->setStatusTip(tr("About"));

    /* Transistion Diagram Actions */
    mAddStateAction = new QAction(tr("Add State"), this);
    mAddStateAction->setStatusTip("Add a new State to the Transistion Diagram");

    mDeleteStateAction = new QAction(tr("Remove State"), this);
    mDeleteStateAction->setStatusTip("Remove state from Transistion Diagram");

    mMakeLinkAction = new QAction(tr("Connect States"), this);
    mMakeLinkAction->setStatusTip("Connect two states");

    mDeleteLinkAction = new QAction(tr("Remove Link"), this);
    mDeleteLinkAction->setStatusTip("Remove the Link between two States");

    mStatePropertiesAction = new QAction(tr("State Properties"), this);
    mStatePropertiesAction->setStatusTip("Display the Properties of the State");

    mZoomInAction = new QAction(tr("Zoom In"), this);
    mZoomInAction->setStatusTip("Zoom In on the Diagrams");

    mZoomOutAction = new QAction(tr("Zoom Out"), this);
    mZoomOutAction->setStatusTip("Zoom Out on the Diagram");
}