/*
 *  Constructs a GotoLineDialog as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
GotoLineDialog::GotoLineDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "GotoLineDialog" );
    GotoLineDialogLayout = new QGridLayout( this, 1, 1, 11, 6, "GotoLineDialogLayout"); 

    TextLabel1 = new QLabel( this, "TextLabel1" );

    GotoLineDialogLayout->addWidget( TextLabel1, 0, 0 );

    spinLine = new QSpinBox( this, "spinLine" );
    spinLine->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, spinLine->sizePolicy().hasHeightForWidth() ) );

    GotoLineDialogLayout->addWidget( spinLine, 0, 1 );

    Layout1 = new QHBoxLayout( 0, 0, 6, "Layout1"); 
    Spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout1->addItem( Spacer2 );

    PushButton2 = new QPushButton( this, "PushButton2" );
    PushButton2->setDefault( TRUE );
    Layout1->addWidget( PushButton2 );

    PushButton1 = new QPushButton( this, "PushButton1" );
    Layout1->addWidget( PushButton1 );

    GotoLineDialogLayout->addMultiCellLayout( Layout1, 2, 2, 0, 1 );
    Spacer3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
    GotoLineDialogLayout->addItem( Spacer3, 1, 1 );
    languageChange();
    resize( QSize(243, 85).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( PushButton1, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( PushButton2, SIGNAL( clicked() ), this, SLOT( gotoLine() ) );

    // buddies
    TextLabel1->setBuddy( spinLine );
    init();
}
Пример #2
0
void Snoss2D::snoss2Dbatch( DataStation& data_station)
{
    //------------------------LOAD PARAMETRS FROM TXT-----------------------------//
    int index_S=0;

    string readPathParams= "params.txt";
    fstream readParams(readPathParams.c_str());
    string a;
    getline(gotoLine(readParams,9),a);
    stringstream pars (a);
    pars>>A1>>A2>>sigm>>B1>>B2>>SIcrit;
    //------------------------INITIALIZE SNOSS(precip,snow)-------------------------//
    int p=0;
    for(int i = 0;i<data_station.data_loaded.size();i++)
    {
        data_station.data_loaded[i];
    }


}
Пример #3
0
	bool LineBasedFile::search(const String& text, bool return_to_start)
	{
		if (!isOpen() || getOpenMode() != MODE_IN)
		{
			throw Exception::ParseError(__FILE__, __LINE__, String("File '") + getName() + "' not open for reading" , 
																	"LineBasedFile::search");
		}

		Position start_point = line_number_;
		while (readLine())
		{
			if (startsWith(text))
			{ 
				return true;
			}
		}
		
		if (return_to_start)
		{
			gotoLine(start_point);
		}
		return false;
	}
Пример #4
0
QFEHelpEditorWidget::QFEHelpEditorWidget(QWidget* parent) :
    QWidget(parent),
    ui(new Ui::QFEHelpEditorWidget)
{
    modified=false;
    newScript=true;
    ui->setupUi(this);

    ui->edtScript->getEditor()->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    ui->edtScript->getEditor()->setLineWrapMode(QTextEdit::WidgetWidth);
    connect(ui->edtScript->getEditor()->document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified()));



    highlighter=new QFHTMLHighlighter("", ui->edtScript->getEditor()->document());
    highlighter->setUseSpecial2("$(", ")$");
    highlighter->setUseSpecial1("$$", "$$");

    completer = new QCompleter(ui->edtScript->getEditor());
    completermodel=modelFromFile(ProgramOptions::getInstance()->getAssetsDirectory()+"/qtscript/completer.txt");
    completer->setModel(completermodel);
    completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setWrapAround(false);
    ui->edtScript->getEditor()->setCompleter(completer);



    recentHelpFiles=new QRecentFilesMenu(this);
    recentHelpFiles->setUseSystemFileIcons(false);
    recentHelpFiles->setAlwaysEnabled(true);
    connect(recentHelpFiles, SIGNAL(openRecentFile(QString)), this, SLOT(openScriptNoAsk(QString)));
    ui->btnOpen->setMenu(recentHelpFiles);
    connect(ui->edtScript->getEditor(), SIGNAL(cursorPositionChanged()), this, SLOT(edtScript_cursorPositionChanged()));


    actLoadAutosave=new QFActionWithNoMenuRole(tr("load last autosaved file ..."), this);
    connect(actLoadAutosave, SIGNAL(triggered()), this, SLOT(reloadLastAutosave()));

    cutAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_cut.png"), tr("Cu&t"), this);
    cutAct->setShortcut(tr("Ctrl+X"));
    cutAct->setToolTip(tr("Cut the current selection's contents to the "
                            "clipboard"));
    connect(cutAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(cut()));

    copyAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_copy.png"), tr("&Copy"), this);
    copyAct->setShortcut(tr("Ctrl+C"));
    copyAct->setToolTip(tr("Copy the current selection's contents to the "
                             "clipboard"));
    connect(copyAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(copy()));

    pasteAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_paste.png"), tr("&Paste"), this);
    pasteAct->setShortcut(tr("Ctrl+V"));
    pasteAct->setToolTip(tr("Paste the clipboard's contents into the current "
                              "selection"));
    connect(pasteAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(paste()));

    undoAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_undo.png"), tr("&Undo"), this);
    undoAct->setShortcut(tr("Ctrl+Z"));
    undoAct->setToolTip(tr("Undo the last change "));
    connect(undoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(undo()));

    redoAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_redo.png"), tr("&Redo"), this);
    redoAct->setShortcut(tr("Ctrl+Shift+Z"));
    redoAct->setToolTip(tr("Redo the last undone change "));
    connect(redoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(redo()));

    findAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find.png"), tr("&Find ..."), this);
    findAct->setShortcut(tr("Ctrl+F"));
    findAct->setToolTip(tr("Find a string in sequence "));
    connect(findAct, SIGNAL(triggered()), this, SLOT(findFirst()));

    findNextAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find_next.png"), tr("Find &next"), this);
    findNextAct->setShortcut(tr("F3"));
    findNextAct->setToolTip(tr("Find the next occurence "));
    connect(findNextAct, SIGNAL(triggered()), this, SLOT(findNext()));
    findNextAct->setEnabled(false);

    replaceAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find_replace.png"), tr("Find && &replace ..."), this);
    replaceAct->setShortcut(tr("Ctrl+R"));
    replaceAct->setToolTip(tr("Find a string in sequence and replace it with another string "));
    connect(replaceAct, SIGNAL(triggered()), this, SLOT(replaceFirst()));

    commentAct = new QFActionWithNoMenuRole(tr("&Comment text"), this);
    commentAct->setShortcut(tr("Ctrl+B"));
    commentAct->setToolTip(tr("add (single line) comment at the beginning of each line "));
    connect(commentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(comment()));

    unCommentAct = new QFActionWithNoMenuRole(tr("&Uncomment text"), this);
    unCommentAct->setShortcut(tr("Ctrl+Shift+B"));
    unCommentAct->setToolTip(tr("remove (single line) comment at the beginning of each line "));
    connect(unCommentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(uncomment()));

    indentAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_indent.png"), tr("&Increase indention"), this);
    commentAct->setShortcut(tr("Ctrl+I"));
    indentAct->setToolTip(tr("increase indention "));
    connect(indentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentInc()));

    unindentAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_unindent.png"), tr("&Decrease indention"), this);
    unindentAct->setShortcut(tr("Ctrl+Shift+I"));
    unindentAct->setToolTip(tr("decrease indention "));
    connect(unindentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentDec()));

    gotoLineAct = new QFActionWithNoMenuRole(tr("&Goto line ..."), this);
    gotoLineAct->setShortcut(tr("Alt+G"));
    gotoLineAct->setToolTip(tr("goto a line in the opened file "));
    connect(gotoLineAct, SIGNAL(triggered()), this, SLOT(gotoLine()));

    printAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_print.png"), tr("&Print ..."), this);
    printAct->setToolTip(tr("print the current SDFF file "));
    connect(printAct, SIGNAL(triggered()), this, SLOT(print()));

    actInsertIcon = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/insert_image.png"), tr("&Insert icon ..."), this);
    actInsertIcon->setToolTip(tr("print the current SDFF file "));
    connect(actInsertIcon, SIGNAL(triggered()), this, SLOT(insertIcon()));


    toEntityAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/toentity.png"), tr("&Convert characters to entities ..."), this);
    toEntityAct->setToolTip(tr("convert characters in the selected text to HTML entities"));
    connect(toEntityAct, SIGNAL(triggered()), this, SLOT(toEntity()));

    toCharAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/tochars.png"), tr("&Convert entities to characters ..."), this);
    toCharAct->setToolTip(tr("convert HTML entities in the selected text to characters"));
    connect(toCharAct, SIGNAL(triggered()), this, SLOT(toChars()));

    cutAct->setEnabled(false);
    copyAct->setEnabled(false);
    undoAct->setEnabled(false);
    redoAct->setEnabled(false);
    connect(ui->edtScript->getEditor(), SIGNAL(copyAvailable(bool)), cutAct, SLOT(setEnabled(bool)));
    connect(ui->edtScript->getEditor(), SIGNAL(copyAvailable(bool)), copyAct, SLOT(setEnabled(bool)));
    connect(ui->edtScript->getEditor(), SIGNAL(undoAvailable(bool)), undoAct, SLOT(setEnabled(bool)));
    connect(ui->edtScript->getEditor(), SIGNAL(redoAvailable(bool)), redoAct, SLOT(setEnabled(bool)));
    connect(ui->edtScript->getEditor(), SIGNAL(findNextAvailable(bool)), findNextAct, SLOT(setEnabled(bool)));


    QMenu* menuMore=new QMenu(ui->tbMoreOptions);
    menuMore->addAction(indentAct);
    menuMore->addAction(unindentAct);
    menuMore->addAction(commentAct);
    menuMore->addAction(unCommentAct);
    menuMore->addSeparator();
    menuMore->addAction(toEntityAct);
    menuMore->addAction(toCharAct);
    menuMore->addSeparator();
    menuMore->addAction(actInsertIcon);
    menuMore->addSeparator();
    menuMore->addAction(gotoLineAct);
    menuMore->addAction(findAct);
    menuMore->addAction(replaceAct);
    menuMore->addAction(findNextAct);
    menuMore->addSeparator();
    menuMore->addAction(actLoadAutosave);
    ui->tbMoreOptions->setMenu(menuMore);
    ui->tbFind->setDefaultAction(findAct);
    ui->tbFindNext->setDefaultAction(findNextAct);
    ui->tbReplace->setDefaultAction(replaceAct);
    ui->tbPrint->setDefaultAction(printAct);
    ui->tbCopy->setDefaultAction(copyAct);
    ui->tbCut->setDefaultAction(cutAct);
    ui->tbPaste->setDefaultAction(pasteAct);
    ui->tbRedo->setDefaultAction(redoAct);
    ui->tbUndo->setDefaultAction(undoAct);
    ui->tbEntity->setDefaultAction(toEntityAct);
    ui->tbChars->setDefaultAction(toCharAct);



    setScriptFilename("");
    QMenu* menu;
    menu=new QMenu(tr("directories"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$mainhelpdir$$");
    addInsertAction(menu, "$$mainhelppicdir$$");
    addInsertAction(menu, "$$assetsdir$$");
    addInsertAction(menu, "$$examplesdir$$");
    addInsertAction(menu, "$$configdir$$");
    addInsertAction(menu, "$$maindir$$");
    addInsertAction(menu, "$$sourcedir$$");

    menu=new QMenu(tr("version/copyright info"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$version.svnrevision$$");
    addInsertAction(menu, "$$version.status$$");
    addInsertAction(menu, "$$version.date$$");
    addInsertAction(menu, "$$version$$");
    addInsertAction(menu, "$$version_full$$");
    menu->addSeparator();
    addInsertAction(menu, "$$thanksto$$");
    addInsertAction(menu, "$$copyright$$");
    addInsertAction(menu, "$$author$$");
    addInsertAction(menu, "$$weblink$$");
    addInsertAction(menu, "$$license$$");
    addInsertAction(menu, "$$maillist$$");
    addInsertAction(menu, "$$maillistrequest$$");
    menu->addSeparator();
    addInsertAction(menu, "$$qfcitation$$");
    addInsertAction(menu, "$$qfcitation_bibtex$$");
    addInsertAction(menu, "$$jankrieger_phdthesis$$");
    addInsertAction(menu, "$$jankrieger_phdthesis_ref$$");

    menu=new QMenu(tr("general help links"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, tr("Link: RDR general help"), "<a href=\"$qf_ui_rdr_helpfile$$\">$$qf_ui_rdr_helpfiletitle$$</a>" );
    addInsertAction(menu, tr("Link: Evaluation general help"), "<a href=\"$$qf_ui_eval_helpfile$$\">$$qf_ui_eval_helpfiletitle$$</a>" );
    addInsertAction(menu, tr("Link: Plotter Widget general help"), "<a href=\"$$qf_ui_jkqtplotter_helpfile$$\">$$qf_ui_jkqtplotter_helpfiletitle$$</a>" );
    addInsertAction(menu, tr("Link: LaTeX parser general help"), "<a href=\"$$qf_ui_latex_helpfile$$\">$$qf_ui_latex_helpfiletitle$$</a>" );
    addInsertAction(menu, tr("Link: Expression parser help"), "<a href=\"$$qf_mathparser_helpfile$$\">$$qf_mathparser_helpfiletitle$$</a>" );
    //addInsertAction(menu, tr("Link:  help"), "<a href=\"$$aa$$\">$$aa$$</a>" );
    //addInsertAction(menu, tr("Link:  help"), QString("<a href=\"$$mainhelpdir$$aa\">aa</a>") );
    addInsertAction(menu, tr("Link: Custom color palettes help"), QString("<a href=\"$$mainhelpdir$$colorpalettes.html\">custom color paletes</a>") );
    addInsertAction(menu, tr("Link: Available color palettes"), QString("<a href=\"$$mainhelpdir$$installedcolorpalettes.html\">available color paletes</a>") );
    addInsertAction(menu, tr("Link: Regular Expressions"), QString("<a href=\"$$mainhelpdir$$qf3_qtregexp.html\">regular expressions</a>") );
    addInsertAction(menu, tr("Link: Fit Functions"), QString("<a href=\"$$mainhelpdir$$qf3_fitfunc.html\">fit functions</a>") );
    addInsertAction(menu, tr("Link: Fit Algorithms"), QString("<a href=\"$$mainhelpdir$$qf3_fitalg.html\">fit algorithms</a>") );
    addInsertAction(menu, tr("Link: File Formats"), QString("<a href=\"$$mainhelpdir$$qf3_fileformats.html\">file formats</a>") );
    addInsertAction(menu, tr("Link: GPL 3.0"), QString("<a href=\"$$mainhelpdir$$gpl3_0.html\">GPL 3.0</a>") );
    addInsertAction(menu, tr("Link: FAQs"), QString("<a href=\"$$qf_faqfile$$\">Frequently asked questions</a>") );

    menu->addSeparator();
    addInsertAction(menu, "$$qf_ui_rdr_helpfile$$");
    addInsertAction(menu, "$$qf_ui_rdr_helpfiletitle$$");
    addInsertAction(menu, "$$qf_ui_eval_helpfile$$");
    addInsertAction(menu, "$$qf_ui_eval_helpfiletitle$$");
    addInsertAction(menu, "$$qf_ui_jkqtplotter_helpfile$$");
    addInsertAction(menu, "$$qf_ui_jkqtplotter_helpfiletitle$$");
    addInsertAction(menu, "$$qf_ui_latex_helpfile$$");
    addInsertAction(menu, "$$qf_ui_latex_helpfiletitle$$");
    addInsertAction(menu, "$$qf_mathparser_helpfile$$");
    addInsertAction(menu, "$$qf_mathparser_helpfiletitle$$");
    addInsertAction(menu, "$$qf_faqfile$$");


    menu=new QMenu(tr("page header/footer"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$qf_commondoc_backtop$$");
    menu->addSeparator();
    addInsertAction(menu, "$$qf_commondoc_footer.start$$");
    addInsertAction(menu, "$$qf_commondoc_footer.end$$");
    menu->addSeparator();
    addInsertAction(menu, "$$qf_commondoc_header.start$$");
    addInsertAction(menu, "$$qf_commondoc_header.end$$");
    addInsertAction(menu, "$$qf_commondoc_header.end_notitle$$");
    addInsertAction(menu, "$$qf_commondoc_header.rdr$$");
    addInsertAction(menu, "$$qf_commondoc_header.eval$$");
    addInsertAction(menu, "$$qf_commondoc_header.extension$$");
    addInsertAction(menu, "$$qf_commondoc_header.fitfunc$$");
    addInsertAction(menu, "$$qf_commondoc_header.fitalg$$");
    addInsertAction(menu, "$$qf_commondoc_header.separator$$");


    menu=new QMenu(tr("plugin info"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$local_plugin_icon$$");
    addInsertAction(menu, "$$local_plugin_iconfilename$$");
    addInsertAction(menu, "$$local_plugin_name$$");
    addInsertAction(menu, "$$local_plugin_author$$");
    addInsertAction(menu, "$$local_plugin_copyright$$");
    addInsertAction(menu, "$$local_plugin_weblink_url$$");
    addInsertAction(menu, "$$local_plugin_weblink$$");
    addInsertAction(menu, "$$local_plugin_id$$");
    addInsertAction(menu, "$$local_plugin_subid$$");
    addInsertAction(menu, "$$local_plugin_subname$$");
    addInsertAction(menu, "$$local_plugin_subshortname$$");
    addInsertAction(menu, "$$local_plugin_tutorial_file$$");
    addInsertAction(menu, "$$local_plugin_tutorial_link$$");
    addInsertAction(menu, "$$local_plugin_mainhelp_file$$");
    addInsertAction(menu, "$$local_plugin_mainhelp_link$$");
    addInsertAction(menu, "$$local_plugin_version$$");
    addInsertAction(menu, "$$local_plugin_typehelp_link$$");
    addInsertAction(menu, "$$local_plugin_typehelp_file$$");
    addInsertAction(menu, "$$local_plugin_assets$$");
    addInsertAction(menu, "$$local_plugin_examples$$");
    addInsertAction(menu, "$$local_plugin_help$$");
    addInsertAction(menu, "$$local_plugin_config$$");
    addInsertAction(menu, "$$local_plugin_tutorials$$");
    menu->addSeparator();
    addInsertAction(menu, "$$plugin_info:help:PLUGINID$$");
    addInsertAction(menu, "$$plugin_info:tutorial:PLUGINID$$");
    addInsertAction(menu, "$$plugin_info:helpdir:PLUGINID$$");
    addInsertAction(menu, "$$plugin_info:assetsdir:PLUGINID$$");
    addInsertAction(menu, "$$plugin_info:examplesdir:PLUGINID$$");
    addInsertAction(menu, "$$plugin_info:configdir:PLUGINID$$");
    menu->addSeparator();
    addInsertAction(menu, "$$fitfunction:help:PLUGINID$$");
    addInsertAction(menu, "$$fitfunction:name:PLUGINID$$");
    addInsertAction(menu, "$$fitfunction:short_name:PLUGINID$$");
    menu->addSeparator();
    addInsertAction(menu, "$$fitalgorithm:help:PLUGINID$$");
    addInsertAction(menu, "$$fitalgorithm:name:PLUGINID$$");
    addInsertAction(menu, "$$fitalgorithm:short_name:PLUGINID$$");
    menu->addSeparator();
    addInsertAction(menu, "$$importer:help:PLUGINID$$");
    addInsertAction(menu, "$$importer:name:PLUGINID$$");
    addInsertAction(menu, "$$exporter:help:PLUGINID$$");
    addInsertAction(menu, "$$exporter:name:PLUGINID$$");



    menu=new QMenu(tr("plugin lists"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$list:extension:INTERFACENAME$$");
    addInsertAction(menu, "$$list:fitfunc:$$");
    addInsertAction(menu, "$$list:fitfunc:STARTSWITH$$");
    addInsertAction(menu, "$$list:fitfunc_inplugin:PLUGIN_ID|STARTSWITH$$");
    addInsertAction(menu, "$$list:fitfunc_inplugin:PLUGIN_ID$$");
    addInsertAction(menu, "$$list:fitalg:$$");
    addInsertAction(menu, "$$list:fitalg:STARTSWITH$$");
    addInsertAction(menu, "$$list:importers:STARTSWITH$$");
    addInsertAction(menu, "$$list:exporters:STARTSWITH$$");
    addInsertAction(menu, "$$list:plugin_tutorials:PLUGIN_ID$$");


    menu=new QMenu(tr("help lists"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$tutorials_contents$$");
    addInsertAction(menu, "$$help_contents$$");
    addInsertAction(menu, "$$settings_contents$$");


    menu=new QMenu(tr("insert files"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$insert:FILENAME$$");
    addInsertAction(menu, "$$insertglobal:FILENAME$$");


    menu=new QMenu(tr("insert Equations (LaTeX)"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$math:LATEX$$");
    addInsertAction(menu, "$(LATEX)$");
    addInsertAction(menu, "$$bmath:LATEX$$");
    addInsertAction(menu, "$[LATEX]$");


    menu=new QMenu(tr("insert Literature References"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$ref:<ID>:Text$$");
    addInsertAction(menu, "$$ref:<ID>:$$");
    addInsertAction(menu, "$$invisibleref:<ID>:Text$$");
    addInsertAction(menu, "$$references$$");


    menu=new QMenu(tr("insert Figures"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$fig:FILENAME:CAPTION$$");


    menu=new QMenu(tr("insert Info boxes"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$see:Text$$");
    addInsertAction(menu, "$$note:Text$$");
    addInsertAction(menu, "$$info:Text$$");
    addInsertAction(menu, "$$warning:Text$$");
    addInsertAction(menu, "$$example:Text$$");
    addInsertAction(menu, "$$codeexample:Text$$");
    addInsertAction(menu, "$$bqtt:Text$$");
    addInsertAction(menu, "$$bqcode:Text$$");
    menu->addSeparator();
    addInsertAction(menu, "$$startbox$$");
    addInsertAction(menu, "$$startbox_info$$");
    addInsertAction(menu, "$$startbox_note$$");
    addInsertAction(menu, "$$startbox_see$$");
    addInsertAction(menu, "$$startbox_warning$$");
    addInsertAction(menu, "$$startbox_example$$");
    addInsertAction(menu, "$$startbox:backgroundcolor:bordercolor$$");
    addInsertAction(menu, "$$startbox:lightgrey:midnightblue$$");
    addInsertAction(menu, "$$endbox$$");


    menu=new QMenu(tr("insert Tooltips"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$tooltip:PHRASE$$");


    menu=new QMenu(tr("FAQs"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, tr("FAQ entry"), "$$faq_start$$\n  <a name=\"FAQ1\"><b>Question?</b>\n$$faq_answer$$\n  Answer ...\n$$faq_end$$");
    menu->addSeparator();
    addInsertAction(menu, "$$faq_start");
    addInsertAction(menu, "$$faq_answer");
    addInsertAction(menu, "$$faq_end");

    menu=new QMenu(tr("Function References"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, tr("Function reference entry"), "$$funcref_start$$<a name=\"NAME\"/><!-- func:NAME -->\n  <b><tt><!-- template -->NAME<!-- /template --></tt> - <i> DESCRIPTION </i>:</b>\n$$funcref_description$$\n    DESCRIPTION\n  <!-- /func:NAME -->\n$$funcref_end$$");
    menu->addSeparator();
    addInsertAction(menu, "$$funcref_start");
    addInsertAction(menu, "$$funcref_description");
    addInsertAction(menu, "$$funcref_end");

    menu=new QMenu(tr("insert other markups"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$$tt:Text$$");


    menu=new QMenu(tr("LaTeX"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "\\left(%1#\\right)");
    addInsertAction(menu, "\\left[%1#\\right]");
    addInsertAction(menu, "\\left\\{%1#\\right\\}");
    addInsertAction(menu, "\\left\\langle%1#\\right\\rangle");
    menu->addSeparator();
    addInsertAction(menu, "\\sqrt{%1#}");
    menu->addSeparator();
    addInsertAction(menu, "\\sum_{#}^{}%1");
    addInsertAction(menu, "\\prod_{#}^{}%1");
    addInsertAction(menu, "\\int_{#}^{}%1\\;\\mathrm{d}x");
    addInsertAction(menu, "\\iint_{#}^{}%1\\;\\mathrm{d}^2x");
    addInsertAction(menu, "\\iiint_{#}^{}%1\\;\\mathrm{d}^3x");
    addInsertAction(menu, "\\oint_{#}^{}%1\\;\\mathrm{d}x");
    addInsertAction(menu, "\\lim_{%1#}");
    addInsertAction(menu, "\\argmin_{%1#}");
    addInsertAction(menu, "\\argmax_{%1#}");
    menu->addSeparator();
    addInsertAction(menu, "\\vec{%1#}");
    addInsertAction(menu, "\\hat{%1#}");
    addInsertAction(menu, "\\tilde{%1#}");
    addInsertAction(menu, "\\mathbf{%1#}");
    addInsertAction(menu, "\\mathrm{%1#}");
    addInsertAction(menu, "\\mathit{%1#}");
    addInsertAction(menu, "\\mathsf{%1#}");
    addInsertAction(menu, "\\mathbb{%1#}");
    addInsertAction(menu, "\\mathscript{%1#}");
    addInsertAction(menu, "\\underline{%1#}");
    //addInsertAction(menu, "$$$$");

    menu=new QMenu(tr("Special Characters"), this);
    ui->edtScript->getEditor()->addAction(menu->menuAction());
    addInsertAction(menu, "$" "&#36;");
    addInsertAction(menu, "$$" "&#36;&#36;");


    QTimer::singleShot(AUTOSAVE_INTERVAL_MSEC, this, SLOT(autosave()));

}
Пример #5
0
void TreeBuilderMW::clicked(QModelIndex idx) {   
    int lineNumber = idx.data(XmlTreeModel::LineStartRole).toInt();
    // maybe also highlight region from linestart to lineend?
    gotoLine(lineNumber);
}
Пример #6
0
void LiteEditor::createActions()
{
    LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"Editor");

    m_undoAct = new QAction(QIcon("icon:liteeditor/images/undo.png"),tr("Undo"),this);
    actionContext->regAction(m_undoAct,"Undo",QKeySequence::Undo);

    m_redoAct = new QAction(QIcon("icon:liteeditor/images/redo.png"),tr("Redo"),this);
    actionContext->regAction(m_redoAct,"Redo","Ctrl+Shift+Z; Ctrl+Y");

    m_cutAct = new QAction(QIcon("icon:liteeditor/images/cut.png"),tr("Cut"),this);
    actionContext->regAction(m_cutAct,"Cut",QKeySequence::Cut);

    m_copyAct = new QAction(QIcon("icon:liteeditor/images/copy.png"),tr("Copy"),this);
    actionContext->regAction(m_copyAct,"Copy",QKeySequence::Copy);

    m_pasteAct = new QAction(QIcon("icon:liteeditor/images/paste.png"),tr("Paste"),this);
    actionContext->regAction(m_pasteAct,"Paste",QKeySequence::Paste);

    m_selectAllAct = new QAction(tr("Select All"),this);
    actionContext->regAction(m_selectAllAct,"SelectAll",QKeySequence::SelectAll);

    m_exportHtmlAct = new QAction(QIcon("icon:liteeditor/images/exporthtml.png"),tr("Export HTML..."),this);
#ifndef QT_NO_PRINTER
    m_exportPdfAct = new QAction(QIcon("icon:liteeditor/images/exportpdf.png"),tr("Export PDF..."),this);
    m_filePrintAct = new QAction(QIcon("icon:liteeditor/images/fileprint.png"),tr("Print..."),this);
    m_filePrintPreviewAct = new QAction(QIcon("icon:liteeditor/images/fileprintpreview.png"),tr("Print Preview..."),this);
#endif
    m_gotoPrevBlockAct = new QAction(tr("Go To Previous Block"),this);
    actionContext->regAction(m_gotoPrevBlockAct,"GotoPreviousBlock","Ctrl+[");

    m_gotoNextBlockAct = new QAction(tr("Go To Next Block"),this);
    actionContext->regAction(m_gotoNextBlockAct,"GotoNextBlock","Ctrl+]");


    m_selectBlockAct = new QAction(tr("Select Block"),this);
    actionContext->regAction(m_selectBlockAct,"SelectBlock","Ctrl+U");

    m_gotoMatchBraceAct = new QAction(tr("Go To Matching Brace"),this);
    actionContext->regAction(m_gotoMatchBraceAct,"GotoMatchBrace","Ctrl+E");

    m_foldAct = new QAction(tr("Fold"),this);   
    actionContext->regAction(m_foldAct,"Fold","Ctrl+<");

    m_unfoldAct = new QAction(tr("Unfold"),this);
    actionContext->regAction(m_unfoldAct,"Unfold","Ctrl+>");

    m_foldAllAct = new QAction(tr("Fold All"),this);
    actionContext->regAction(m_foldAllAct,"FoldAll","");

    m_unfoldAllAct = new QAction(tr("Unfold All"),this);
    actionContext->regAction(m_unfoldAllAct,"UnfoldAll","");

    connect(m_foldAct,SIGNAL(triggered()),m_editorWidget,SLOT(fold()));
    connect(m_unfoldAct,SIGNAL(triggered()),m_editorWidget,SLOT(unfold()));
    connect(m_foldAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(foldAll()));
    connect(m_unfoldAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(unfoldAll()));

    m_gotoLineAct = new QAction(tr("Go To Line"),this);
    actionContext->regAction(m_gotoLineAct,"GotoLine","Ctrl+L");

    m_lockAct = new QAction(QIcon("icon:liteeditor/images/lock.png"),tr("Locked"),this);
    m_lockAct->setEnabled(false);

    m_duplicateAct = new QAction(tr("Duplicate"),this);
    actionContext->regAction(m_duplicateAct,"Duplicate","Ctrl+Shift+D");
    connect(m_duplicateAct,SIGNAL(triggered()),m_editorWidget,SLOT(duplicate()));

    m_deleteLineAct = new QAction(tr("Delete Line"),this);
    actionContext->regAction(m_deleteLineAct,"DeleteLine","Ctrl+Shift+K");
    connect(m_deleteLineAct,SIGNAL(triggered()),m_editorWidget,SLOT(deleteLine()));

    m_copyLineAct = new QAction(tr("Copy Line"),this);
    actionContext->regAction(m_copyLineAct,"CopyLine","Ctrl+Ins");
    connect(m_copyLineAct,SIGNAL(triggered()),m_editorWidget,SLOT(copyLine()));

    m_cutLineAct = new QAction(tr("Cut Line"),this);
    actionContext->regAction(m_cutLineAct,"CutLine","Shift+Del");
    connect(m_cutLineAct,SIGNAL(triggered()),m_editorWidget,SLOT(cutLine()));

    m_insertLineBeforeAct = new QAction(tr("Insert Line Before"),this);
    actionContext->regAction(m_insertLineBeforeAct,"InsertLineBefore","Ctrl+Shift+Return");
    connect(m_insertLineBeforeAct,SIGNAL(triggered()),m_editorWidget,SLOT(insertLineBefore()));

    m_insertLineAfterAct = new QAction(tr("Insert Line After"),this);
    actionContext->regAction(m_insertLineAfterAct,"InsertLineAfter","Ctrl+Return");
    connect(m_insertLineAfterAct,SIGNAL(triggered()),m_editorWidget,SLOT(insertLineAfter()));

    m_increaseFontSizeAct = new QAction(tr("Increase Font Size"),this);
    actionContext->regAction(m_increaseFontSizeAct,"IncreaseFontSize","Ctrl++");

    m_decreaseFontSizeAct = new QAction(tr("Decrease Font Size"),this);
    actionContext->regAction(m_decreaseFontSizeAct,"DecreaseFontSize","Ctrl+-");

    m_resetFontSizeAct = new QAction(tr("Reset Font Size"),this);
    actionContext->regAction(m_resetFontSizeAct,"ResetFontSize","Ctrl+0");

    m_cleanWhitespaceAct = new QAction(tr("Clean Whitespace"),this);
    actionContext->regAction(m_cleanWhitespaceAct,"CleanWhitespace","");

    m_wordWrapAct = new QAction(tr("Word Wrap (MimeType)"),this);
    m_wordWrapAct->setCheckable(true);
    actionContext->regAction(m_wordWrapAct,"WordWrap","");

    m_codeCompleteAct = new QAction(tr("Code Complete"),this);
#ifdef Q_OS_MAC
    actionContext->regAction(m_codeCompleteAct,"CodeComplete","Meta+Space");
#else
    actionContext->regAction(m_codeCompleteAct,"CodeComplete","Ctrl+Space");
#endif

    m_commentAct = new QAction(tr("Toggle Comment"),this);
    actionContext->regAction(m_commentAct,"Comment","Ctrl+/");

    m_blockCommentAct = new QAction(tr("Toggle Block Commnet"),this);
    actionContext->regAction(m_blockCommentAct,"BlockComment","Ctrl+Shift+/");

    m_autoIndentAct = new QAction(tr("Auto-indent Selection"),this);
    actionContext->regAction(m_autoIndentAct,"AutoIndent","Ctrl+I");
    m_autoIndentAct->setVisible(false);

    m_tabToSpacesAct = new QAction(tr("Tab To Spaces (MimeType)"),this);
    actionContext->regAction(m_tabToSpacesAct,"TabToSpaces","");
    m_tabToSpacesAct->setCheckable(true);

    m_lineEndingWindowAct = new QAction(tr("Line End Windows (\\r\\n)"),this);
    actionContext->regAction(m_lineEndingWindowAct,"LineEndingWindow","");
    m_lineEndingWindowAct->setCheckable(true);

    m_lineEndingUnixAct = new QAction(tr("Line End Unix (\\n)"),this);
    actionContext->regAction(m_lineEndingUnixAct,"LineEndingUnix","");
    m_lineEndingUnixAct->setCheckable(true);

    m_visualizeWhitespaceAct = new QAction(tr("Visualize Whitespace (Global)"),this);
    actionContext->regAction(m_visualizeWhitespaceAct,"VisualizeWhitespace","");
    m_visualizeWhitespaceAct->setCheckable(true);

    m_commentAct->setVisible(false);
    m_blockCommentAct->setVisible(false);

    m_moveLineUpAction = new QAction(tr("Move Line Up"),this);
    actionContext->regAction(m_moveLineUpAction,"MoveLineUp","Ctrl+Shift+Up");

    m_moveLineDownAction = new QAction(tr("Move Line Down"),this);
    actionContext->regAction(m_moveLineDownAction,"MoveLineDown","Ctrl+Shift+Down");

    m_copyLineUpAction = new QAction(tr("Copy Line Up"),this);
    actionContext->regAction(m_copyLineUpAction,"CopyLineUp","Ctrl+Alt+Up");

    m_copyLineDownAction = new QAction(tr("Copy Line Down"),this);
    actionContext->regAction(m_copyLineDownAction,"CopyLineDown","Ctrl+Alt+Down");

    m_joinLinesAction = new QAction(tr("Join Lines"),this);
    actionContext->regAction(m_joinLinesAction,"JoinLines","Ctrl+J");

    connect(m_codeCompleteAct,SIGNAL(triggered()),m_editorWidget,SLOT(codeCompleter()));
//    m_widget->addAction(m_foldAct);
//    m_widget->addAction(m_unfoldAct);
//    m_widget->addAction(m_gotoLineAct);

//    m_widget->addAction(m_gotoPrevBlockAct);
//    m_widget->addAction(m_gotoNextBlockAct);
//    m_widget->addAction(m_selectBlockAct);
//    m_widget->addAction(m_gotoMatchBraceAct);

    connect(m_editorWidget,SIGNAL(undoAvailable(bool)),m_undoAct,SLOT(setEnabled(bool)));
    connect(m_editorWidget,SIGNAL(redoAvailable(bool)),m_redoAct,SLOT(setEnabled(bool)));
    connect(m_editorWidget,SIGNAL(copyAvailable(bool)),m_cutAct,SLOT(setEnabled(bool)));
    connect(m_editorWidget,SIGNAL(copyAvailable(bool)),m_copyAct,SLOT(setEnabled(bool)));
    connect(m_editorWidget,SIGNAL(wordWrapChanged(bool)),m_wordWrapAct,SLOT(setChecked(bool)));

    connect(m_undoAct,SIGNAL(triggered()),m_editorWidget,SLOT(undo()));
    connect(m_redoAct,SIGNAL(triggered()),m_editorWidget,SLOT(redo()));
    connect(m_cutAct,SIGNAL(triggered()),m_editorWidget,SLOT(cut()));
    connect(m_copyAct,SIGNAL(triggered()),m_editorWidget,SLOT(copy()));
    connect(m_pasteAct,SIGNAL(triggered()),m_editorWidget,SLOT(paste()));
    connect(m_selectAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(selectAll()));
    connect(m_selectBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(selectBlock()));

    connect(m_exportHtmlAct,SIGNAL(triggered()),this,SLOT(exportHtml()));
#ifndef QT_NO_PRINTER
    connect(m_exportPdfAct,SIGNAL(triggered()),this,SLOT(exportPdf()));
    connect(m_filePrintAct,SIGNAL(triggered()),this,SLOT(filePrint()));
    connect(m_filePrintPreviewAct,SIGNAL(triggered()),this,SLOT(filePrintPreview()));
#endif
    connect(m_gotoPrevBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoPrevBlock()));
    connect(m_gotoNextBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoNextBlock()));
    connect(m_gotoMatchBraceAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoMatchBrace()));
    connect(m_gotoLineAct,SIGNAL(triggered()),this,SLOT(gotoLine()));
    connect(m_increaseFontSizeAct,SIGNAL(triggered()),this,SLOT(increaseFontSize()));
    connect(m_decreaseFontSizeAct,SIGNAL(triggered()),this,SLOT(decreaseFontSize()));
    connect(m_resetFontSizeAct,SIGNAL(triggered()),this,SLOT(resetFontSize()));
    connect(m_cleanWhitespaceAct,SIGNAL(triggered()),m_editorWidget,SLOT(cleanWhitespace()));
    connect(m_wordWrapAct,SIGNAL(triggered(bool)),m_editorWidget,SLOT(setWordWrapOverride(bool)));
    connect(m_commentAct,SIGNAL(triggered()),this,SLOT(comment()));
    connect(m_blockCommentAct,SIGNAL(triggered()),this,SLOT(blockComment()));
    connect(m_autoIndentAct,SIGNAL(triggered()),this,SLOT(autoIndent()));
    connect(m_tabToSpacesAct,SIGNAL(toggled(bool)),this,SLOT(tabToSpacesToggled(bool)));
    connect(m_visualizeWhitespaceAct,SIGNAL(toggled(bool)),this,SLOT(toggledVisualizeWhitespace(bool)));
    connect(m_moveLineUpAction,SIGNAL(triggered()),m_editorWidget,SLOT(moveLineUp()));
    connect(m_moveLineDownAction,SIGNAL(triggered()),m_editorWidget,SLOT(moveLineDown()));
    connect(m_copyLineUpAction,SIGNAL(triggered()),m_editorWidget,SLOT(copyLineUp()));
    connect(m_copyLineDownAction,SIGNAL(triggered()),m_editorWidget,SLOT(copyLineDown()));
    connect(m_joinLinesAction,SIGNAL(triggered()),m_editorWidget,SLOT(joinLines()));
    //connect(m_lineEndingWindowAct,SIGNAL(triggered()),this,SLOT(lineEndingWindow()));
    //connect(m_lineEndingUnixAct,SIGNAL(triggered()),this,SLOT(lineEndingUnixAct()));
    QActionGroup *group = new QActionGroup(this);
    group->addAction(m_lineEndingWindowAct);
    group->addAction(m_lineEndingUnixAct);
    connect(group,SIGNAL(triggered(QAction*)),this,SLOT(triggeredLineEnding(QAction*)));

#ifdef Q_OS_WIN
    QClipboard *clipboard = QApplication::clipboard();
    connect(clipboard,SIGNAL(dataChanged()),this,SLOT(clipbordDataChanged()));
    clipbordDataChanged();
#endif
}
Пример #7
0
LiteEditor::LiteEditor(LiteApi::IApplication *app)
    : m_liteApp(app),
      m_extension(new Extension),
      m_completer(0),
      m_bReadOnly(false)
{
    m_widget = new QWidget;
    m_editorWidget = new LiteEditorWidget(m_widget);
    m_editorWidget->setCursorWidth(2);
    //m_editorWidget->setAcceptDrops(false);

    m_defEditorPalette = m_editorWidget->palette();

    createActions();
    createToolBars();
    createMenu();

    m_editorWidget->setContextMenu(m_contextMenu);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(0);
    layout->setSpacing(0);
/*
    m_toolBar->setStyleSheet("QToolBar {border: 1px ; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #eeeeee, stop: 1 #ababab); }"\
                             "QToolBar QToolButton { border:1px ; border-radius: 1px; }"\
                             "QToolBar QToolButton::hover { background-color: #ababab;}"\
                             "QToolBar::separator {width:2px; margin-left:2px; margin-right:2px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dedede, stop: 1 #a0a0a0);}");
*/
    QHBoxLayout *toolLayout = new QHBoxLayout;
    toolLayout->setMargin(0);
    toolLayout->setSpacing(0);
    toolLayout->addWidget(m_toolBar);
    toolLayout->addWidget(m_infoToolBar);

    layout->addLayout(toolLayout);
//    QHBoxLayout *hlayout = new QHBoxLayout;
//    hlayout->addWidget(m_editorWidget);
//    hlayout->addWidget(m_editorWidget->navigateArea());
    //layout->addLayout(hlayout);
    layout->addWidget(m_editorWidget);
    m_widget->setLayout(layout);
    m_file = new LiteEditorFile(m_liteApp,this);
    m_file->setDocument(m_editorWidget->document());

//    QTextOption option =  m_editorWidget->document()->defaultTextOption();
//    option.setFlags(option.flags() | QTextOption::ShowTabsAndSpaces);
//    option.setFlags(option.flags() | QTextOption::AddSpaceForLineAndParagraphSeparators);
//    option.setTabs(tabs);

//    m_editorWidget->document()->setDefaultTextOption(option);

    setEditToolbarVisible(true);

    connect(m_file->document(),SIGNAL(modificationChanged(bool)),this,SIGNAL(modificationChanged(bool)));
    connect(m_file->document(),SIGNAL(contentsChanged()),this,SIGNAL(contentsChanged()));
    connect(m_liteApp->optionManager(),SIGNAL(applyOption(QString)),this,SLOT(applyOption(QString)));
    connect(m_liteApp->editorManager(),SIGNAL(colorStyleSchemeChanged()),this,SLOT(loadColorStyleScheme()));
    connect(m_liteApp->editorManager(),SIGNAL(editToolbarVisibleChanged(bool)),this,SLOT(setEditToolbarVisible(bool)));

    //applyOption("option/liteeditor");

    m_extension->addObject("LiteApi.ITextEditor",this);
    m_extension->addObject("LiteApi.ILiteEditor",this);
    m_extension->addObject("LiteApi.QToolBar",m_toolBar);
    m_extension->addObject("LiteApi.QPlainTextEdit",m_editorWidget);
    m_extension->addObject("LiteApi.ContextMenu",m_contextMenu);
    m_extension->addObject("LiteApi.Menu.Edit",m_editMenu);

    m_editorWidget->installEventFilter(m_liteApp->editorManager());
    connect(m_editorWidget,SIGNAL(cursorPositionChanged()),this,SLOT(editPositionChanged()));
    connect(m_editorWidget,SIGNAL(navigationStateChanged(QByteArray)),this,SLOT(navigationStateChanged(QByteArray)));
    connect(m_editorWidget,SIGNAL(overwriteModeChanged(bool)),m_overInfoAct,SLOT(setVisible(bool)));
    connect(m_editorWidget,SIGNAL(requestFontZoom(int)),this,SLOT(requestFontZoom(int)));
    connect(m_lineInfo,SIGNAL(doubleClickEvent()),this,SLOT(gotoLine()));
    connect(m_closeEditorAct,SIGNAL(triggered()),m_liteApp->editorManager(),SLOT(closeEditor()));
}
Пример #8
0
void LiteEditor::createActions()
{
    LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"Editor");

    m_undoAct = new QAction(QIcon("icon:liteeditor/images/undo.png"),tr("Undo"),this);
    actionContext->regAction(m_undoAct,"Undo",QKeySequence::Undo);

    m_redoAct = new QAction(QIcon("icon:liteeditor/images/redo.png"),tr("Redo"),this);
    actionContext->regAction(m_redoAct,"Redo","Ctrl+Shift+Z; Ctrl+Y");

    m_cutAct = new QAction(QIcon("icon:liteeditor/images/cut.png"),tr("Cut"),this);
    actionContext->regAction(m_cutAct,"Cut",QKeySequence::Cut);

    m_copyAct = new QAction(QIcon("icon:liteeditor/images/copy.png"),tr("Copy"),this);
    actionContext->regAction(m_copyAct,"Copy",QKeySequence::Copy);

    m_pasteAct = new QAction(QIcon("icon:liteeditor/images/paste.png"),tr("Paste"),this);
    actionContext->regAction(m_pasteAct,"Paste",QKeySequence::Paste);

    m_selectAllAct = new QAction(tr("Select All"),this);
    actionContext->regAction(m_selectAllAct,"SelectAll",QKeySequence::SelectAll);

    m_exportHtmlAct = new QAction(QIcon("icon:liteeditor/images/exporthtml.png"),tr("Export HTML..."),this);
#ifndef QT_NO_PRINTER
    m_exportPdfAct = new QAction(QIcon("icon:liteeditor/images/exportpdf.png"),tr("Export PDF..."),this);
    m_filePrintAct = new QAction(QIcon("icon:liteeditor/images/fileprint.png"),tr("Print..."),this);
    m_filePrintPreviewAct = new QAction(QIcon("icon:liteeditor/images/fileprintpreview.png"),tr("Print Preview..."),this);
#endif
    m_gotoPrevBlockAct = new QAction(tr("Go To Previous Block"),this);
    actionContext->regAction(m_gotoPrevBlockAct,"GotoPreviousBlock","Ctrl+[");

    m_gotoNextBlockAct = new QAction(tr("Go To Next Block"),this);
    actionContext->regAction(m_gotoNextBlockAct,"GotoNextBlock","Ctrl+]");


    m_selectBlockAct = new QAction(tr("Select Block"),this);
    actionContext->regAction(m_selectBlockAct,"SelectBlock","Ctrl+U");

    m_gotoMatchBraceAct = new QAction(tr("Go To Matching Brace"),this);
    actionContext->regAction(m_gotoMatchBraceAct,"GotoMatchBrace","Ctrl+E");

    m_foldAct = new QAction(tr("Fold"),this);   
    actionContext->regAction(m_foldAct,"Fold","Ctrl+<");

    m_unfoldAct = new QAction(tr("Unfold"),this);
    actionContext->regAction(m_unfoldAct,"Unfold","Ctrl+>");

    m_foldAllAct = new QAction(tr("Fold All"),this);
    actionContext->regAction(m_foldAllAct,"FoldAll","");

    m_unfoldAllAct = new QAction(tr("Unfold All"),this);
    actionContext->regAction(m_unfoldAllAct,"UnfoldAll","");

    connect(m_foldAct,SIGNAL(triggered()),m_editorWidget,SLOT(fold()));
    connect(m_unfoldAct,SIGNAL(triggered()),m_editorWidget,SLOT(unfold()));
    connect(m_foldAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(foldAll()));
    connect(m_unfoldAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(unfoldAll()));

    m_gotoLineAct = new QAction(tr("Go To Line"),this);
    actionContext->regAction(m_gotoLineAct,"GotoLine","Ctrl+L");

    m_lockAct = new QAction(QIcon("icon:liteeditor/images/lock.png"),tr("Locked"),this);
    m_lockAct->setEnabled(false);

    m_duplicateAct = new QAction(tr("Duplicate"),this);
    actionContext->regAction(m_duplicateAct,"Duplicate","Ctrl+D");

    connect(m_duplicateAct,SIGNAL(triggered()),m_editorWidget,SLOT(duplicate()));

    m_deleteLineAct = new QAction(tr("Delete Line"),this);
    actionContext->regAction(m_deleteLineAct,"DeleteLine","Ctrl+Shift+K");

    connect(m_deleteLineAct,SIGNAL(triggered()),m_editorWidget,SLOT(deleteLine()));

    m_insertLineBeforeAct = new QAction(tr("Insert Line Before"),this);
    actionContext->regAction(m_insertLineBeforeAct,"InsertLineBefore","Ctrl+Shift+Return");
    connect(m_insertLineBeforeAct,SIGNAL(triggered()),m_editorWidget,SLOT(insertLineBefore()));

    m_insertLineAfterAct = new QAction(tr("Insert Line After"),this);
    actionContext->regAction(m_insertLineAfterAct,"InsertLineAfter","Ctrl+Return");
    connect(m_insertLineAfterAct,SIGNAL(triggered()),m_editorWidget,SLOT(insertLineAfter()));

    m_increaseFontSizeAct = new QAction(tr("Increase Font Size"),this);
    actionContext->regAction(m_increaseFontSizeAct,"IncreaseFontSize","Ctrl++;Ctrl+=");

    m_decreaseFontSizeAct = new QAction(tr("Decrease Font Size"),this);
    actionContext->regAction(m_decreaseFontSizeAct,"DecreaseFontSize","Ctrl+-");

    m_resetFontSizeAct = new QAction(tr("Reset Font Size"),this);
    actionContext->regAction(m_resetFontSizeAct,"ResetFontSize","Ctrl+0");

    m_cleanWhitespaceAct = new QAction(tr("Clean Whitespace"),this);
    actionContext->regAction(m_cleanWhitespaceAct,"CleanWhitespace","");

    m_wordWrapAct = new QAction(tr("Word Wrap"),this);
    m_wordWrapAct->setCheckable(true);
    actionContext->regAction(m_wordWrapAct,"WordWrap","");

//    m_widget->addAction(m_foldAct);
//    m_widget->addAction(m_unfoldAct);
//    m_widget->addAction(m_gotoLineAct);

//    m_widget->addAction(m_gotoPrevBlockAct);
//    m_widget->addAction(m_gotoNextBlockAct);
//    m_widget->addAction(m_selectBlockAct);
//    m_widget->addAction(m_gotoMatchBraceAct);

    connect(m_editorWidget,SIGNAL(undoAvailable(bool)),m_undoAct,SLOT(setEnabled(bool)));
    connect(m_editorWidget,SIGNAL(redoAvailable(bool)),m_redoAct,SLOT(setEnabled(bool)));
    connect(m_editorWidget,SIGNAL(copyAvailable(bool)),m_cutAct,SLOT(setEnabled(bool)));
    connect(m_editorWidget,SIGNAL(copyAvailable(bool)),m_copyAct,SLOT(setEnabled(bool)));
    connect(m_editorWidget,SIGNAL(wordWrapChanged(bool)),m_wordWrapAct,SLOT(setChecked(bool)));

    connect(m_undoAct,SIGNAL(triggered()),m_editorWidget,SLOT(undo()));
    connect(m_redoAct,SIGNAL(triggered()),m_editorWidget,SLOT(redo()));
    connect(m_cutAct,SIGNAL(triggered()),m_editorWidget,SLOT(cut()));
    connect(m_copyAct,SIGNAL(triggered()),m_editorWidget,SLOT(copy()));
    connect(m_pasteAct,SIGNAL(triggered()),m_editorWidget,SLOT(paste()));
    connect(m_selectAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(selectAll()));
    connect(m_selectBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(selectBlock()));

    connect(m_exportHtmlAct,SIGNAL(triggered()),this,SLOT(exportHtml()));
#ifndef QT_NO_PRINTER
    connect(m_exportPdfAct,SIGNAL(triggered()),this,SLOT(exportPdf()));
    connect(m_filePrintAct,SIGNAL(triggered()),this,SLOT(filePrint()));
    connect(m_filePrintPreviewAct,SIGNAL(triggered()),this,SLOT(filePrintPreview()));
#endif
    connect(m_gotoPrevBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoPrevBlock()));
    connect(m_gotoNextBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoNextBlock()));
    connect(m_gotoMatchBraceAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoMatchBrace()));
    connect(m_gotoLineAct,SIGNAL(triggered()),this,SLOT(gotoLine()));
    connect(m_increaseFontSizeAct,SIGNAL(triggered()),this,SLOT(increaseFontSize()));
    connect(m_decreaseFontSizeAct,SIGNAL(triggered()),this,SLOT(decreaseFontSize()));
    connect(m_resetFontSizeAct,SIGNAL(triggered()),this,SLOT(resetFontSize()));
    connect(m_cleanWhitespaceAct,SIGNAL(triggered()),m_editorWidget,SLOT(cleanWhitespace()));
    connect(m_wordWrapAct,SIGNAL(triggered(bool)),m_editorWidget,SLOT(setWordWrapOverride(bool)));

    QClipboard *clipboard = QApplication::clipboard();
    connect(clipboard,SIGNAL(dataChanged()),this,SLOT(clipbordDataChanged()));
    clipbordDataChanged();
}
Пример #9
0
    virtual void customSetup(void)
    {
        QMenu *edit = toMainWidget()->getEditMenu();

        edit->addSeparator();

        IncMenu = edit->addMenu(
                      qApp->translate("toEditExtensionTool", "Incremental Search"));

        IncrementalSearch = IncMenu->addAction(qApp->translate("toEditExtensionTool",
                                               "Forward"),
                                               &toEditExtensionsSingle::Instance(),
                                               SLOT(searchForward()));
        IncrementalSearch->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S);

        ReverseSearch = IncMenu->addAction(qApp->translate("toEditExtensionTool",
                                           "Backward"),
                                           &toEditExtensionsSingle::Instance(),
                                           SLOT(searchBackward()));
        ReverseSearch->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_R);

        // ------------------------------ indentation menu

        IndentMenu = edit->addMenu(
                         qApp->translate("toEditExtensionTool", "Auto Indent"));

        IndentBlock = IndentMenu->addAction(qApp->translate(
                                                "toEditExtensionTool",
                                                "Selection"),
                                            &toEditExtensionsSingle::Instance(),
                                            SLOT(autoIndentBlock()));
        IndentBlock->setShortcut(Qt::CTRL + + Qt::ALT + Qt::Key_I);

        IndentBuffer = IndentMenu->addAction(qApp->translate(
                "toEditExtensionTool",
                "Editor"),
                                             &toEditExtensionsSingle::Instance(),
                                             SLOT(autoIndentBuffer()));
        IndentBuffer->setShortcut(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_I);

        IndentMenu->addSeparator();

        ObsBlock = IndentMenu->addAction(qApp->translate(
                                             "toEditExtensionTool",
                                             "Obfuscate Selection"),
                                         &toEditExtensionsSingle::Instance(),
                                         SLOT(obfuscateBlock()));

        ObsBuffer = IndentMenu->addAction(qApp->translate("toEditExtensionTool",
                                          "Obfuscate Editor"),
                                          &toEditExtensionsSingle::Instance(),
                                          SLOT(obfuscateBuffer()));

        // ------------------------------ case menu

        CaseMenu = edit->addMenu(
                       qApp->translate("toEditExtensionTool", "Modify Case"));

        UpperCase = CaseMenu->addAction(qApp->translate("toEditExtensionTool",
                                        "Upper"),
                                        &toEditExtensionsSingle::Instance(),
                                        SLOT(upperCase()));
        UpperCase->setShortcut(Qt::CTRL + Qt::Key_U);

        LowerCase = CaseMenu->addAction(qApp->translate("toEditExtensionTool",
                                        "Lower"),
                                        &toEditExtensionsSingle::Instance(),
                                        SLOT(lowerCase()));
        LowerCase->setShortcut(Qt::CTRL + Qt::Key_L);

        // bookmark menu
        BookmarkMenu = edit->addMenu(qApp->translate("toEditExtensionTool", "Bookmarks"));
        BookmarkSwitchAct = BookmarkMenu->addAction("Add/Remove Bookmark",
                            &toEditExtensionsSingle::Instance(),
                            SLOT(bookmarkSwitch()));
        BookmarkSwitchAct->setShortcut(Qt::CTRL + Qt::Key_B);
        BookmarkPrevAct = BookmarkMenu->addAction("Go to previous Bookmark",
                          &toEditExtensionsSingle::Instance(),
                          SLOT(bookmarkPrev()));
        BookmarkPrevAct->setShortcut(Qt::ALT + Qt::Key_PageUp);
        BookmarkNextAct = BookmarkMenu->addAction("Go to next Bookmark",
                          &toEditExtensionsSingle::Instance(),
                          SLOT(bookmarkNext()));
        BookmarkNextAct->setShortcut(Qt::ALT + Qt::Key_PageDown);

        // EOL menu
        EolMenu = edit->addMenu(qApp->translate("toEditExtensionTool", "Convert End of Lines to"));
        EolUnixAct = EolMenu->addAction("UNIX", &toEditExtensionsSingle::Instance(), SLOT(convertEol()));
        EolMacAct = EolMenu->addAction("Mac OS X", &toEditExtensionsSingle::Instance(), SLOT(convertEol()));
        EolWindowsAct = EolMenu->addAction("MS Windows", &toEditExtensionsSingle::Instance(), SLOT(convertEol()));

        // ------------------------------ etc

        Indent = edit->addAction(
                     QIcon(QPixmap(const_cast<const char**>(indent_xpm))),
                     qApp->translate("toEditExtensionTool", "Indent Block"),
                     &toEditExtensionsSingle::Instance(),
                     SLOT(indentBlock()));
#ifndef Q_WS_MAC
        Indent->setShortcut(Qt::ALT + Qt::Key_Right);
#endif

        Deindent = edit->addAction(
                       QIcon(QPixmap(const_cast<const char**>(deindent_xpm))),
                       qApp->translate("toEditExtensionTool", "De-indent Block"),
                       &toEditExtensionsSingle::Instance(),
                       SLOT(deindentBlock()));
#ifndef Q_WS_MAC
        Deindent->setShortcut(Qt::ALT + Qt::Key_Left);
#endif

        Quote = edit->addAction(qApp->translate("toEditExtensionTool",
                                                "Quote Selection"),
                                &toEditExtensionsSingle::Instance(),
                                SLOT(quoteBlock()));

        UnQuote = edit->addAction(qApp->translate("toEditExtensionTool",
                                  "UnQuote Selection"),
                                  &toEditExtensionsSingle::Instance(),
                                  SLOT(unquoteBlock()));

        Comment = edit->addAction(qApp->translate("toEditExtensionTool",
                                  "Comment or Uncomment"),
                                  &toEditExtensionsSingle::Instance(),
                                  SLOT(handleComment()),
                                  Qt::CTRL + Qt::Key_D);

        GotoLine = edit->addAction(qApp->translate("toEditExtensionTool",
                                   "Goto Line"),
                                   &toEditExtensionsSingle::Instance(),
                                   SLOT(gotoLine()));
        GotoLine->setShortcut(Qt::CTRL + Qt::Key_G);

        AutoComplete = edit->addAction(
                           qApp->translate("toEditExtensionTool",
                                           "Complete"),
                           &toEditExtensionsSingle::Instance(),
                           SLOT(autoComplete()));
        AutoComplete->setShortcut(Qt::CTRL + Qt::Key_Space);

        // add buttons to main window
        // disabled due the problems in the state of toolbars
//         toMainWidget()->addButtonApplication(Deindent);
//         toMainWidget()->addButtonApplication(Indent);

        toEditExtensionsSingle::Instance().receivedFocus(NULL);

        connect(toMainWidget(),
                SIGNAL(editEnabled(bool)),
                &toEditExtensionsSingle::Instance(),
                SLOT(editEnabled(bool)));
    }
QFESPIMB040ScriptedAcquisition::QFESPIMB040ScriptedAcquisition(QFESPIMB040MainWindow2* mainWindow, QFESPIMB040AcquisitionTools* acqTools, QFPluginLogService* log, QWidget* parent, QFPluginServices* pluginServices, QFESPIMB040OpticsSetupBase* opticsSetup, QFESPIMB040AcquisitionDescription* acqDescription, QFESPIMB040ExperimentDescription* expDescription, QString /*configDirectory*/) :
    QWidget(parent),
    ui(new Ui::QFESPIMB040ScriptedAcquisition)
{

    this->m_pluginServices=pluginServices;
    this->opticsSetup=opticsSetup;
    this->acqDescription=acqDescription;
    this->expDescription=expDescription;
    this->log=log;
    this->acqTools=acqTools;
    this->mainWindow=mainWindow;

    acquisitionTools=new QFESPIMB040ScriptedAcquisitionTools(this, mainWindow, acqTools, log, this, pluginServices, opticsSetup, acqDescription, expDescription);
    instrumentControl=new QFESPIMB040ScriptedAcquisitionInstrumentControl(this, mainWindow, acqTools, log, this, pluginServices, opticsSetup, acqDescription, expDescription);
    acquisitionControl=new QFESPIMB040ScriptedAcquisitionAcquisitionControl(this, mainWindow, acqTools, log, this, pluginServices, opticsSetup, acqDescription, expDescription);


    engine=new QScriptEngine();


    ui->setupUi(this);
    findDlg=new QFESPIMB040FindDialog(this);
    replaceDlg=new QFESPIMB040ReplaceDialog(this);

    highlighter=new QFQtScriptHighlighter("", ui->edtScript->getEditor()->document());

    completer = new QCompleter(ui->edtScript->getEditor());
    completermodel=modelFromFile(ProgramOptions::getInstance()->getAssetsDirectory()+"/qtscript/completer.txt");
    completer->setModel(completermodel);
    completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setWrapAround(false);
    ui->edtScript->getEditor()->setCompleter(completer);

    recentMaskFiles=new QRecentFilesMenu(this);
    recentMaskFiles->setUseSystemFileIcons(false);
    recentMaskFiles->setAlwaysEnabled(true);
    connect(recentMaskFiles, SIGNAL(openRecentFile(QString)), this, SLOT(openScriptNoAsk(QString)));
    ui->btnOpen->setMenu(recentMaskFiles);
    connect(ui->edtScript->getEditor(), SIGNAL(cursorPositionChanged()), this, SLOT(edtScript_cursorPositionChanged()));



    cutAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_cut.png"), tr("Cu&t"), this);
    cutAct->setShortcut(tr("Ctrl+X"));
    cutAct->setStatusTip(tr("Cut the current selection's contents to the "
                            "clipboard"));
    connect(cutAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(cut()));

    copyAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_copy.png"), tr("&Copy"), this);
    copyAct->setShortcut(tr("Ctrl+C"));
    copyAct->setStatusTip(tr("Copy the current selection's contents to the "
                             "clipboard"));
    connect(copyAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(copy()));

    pasteAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_paste.png"), tr("&Paste"), this);
    pasteAct->setShortcut(tr("Ctrl+V"));
    pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current "
                              "selection"));
    connect(pasteAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(paste()));

    undoAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_undo.png"), tr("&Undo"), this);
    undoAct->setShortcut(tr("Ctrl+Z"));
    undoAct->setStatusTip(tr("Undo the last change "));
    connect(undoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(undo()));

    redoAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_redo.png"), tr("&Redo"), this);
    redoAct->setShortcut(tr("Ctrl+Shift+Z"));
    redoAct->setStatusTip(tr("Redo the last undone change "));
    connect(redoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(redo()));

    findAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_find.png"), tr("&Find ..."), this);
    findAct->setShortcut(tr("Ctrl+F"));
    findAct->setStatusTip(tr("Find a string in sequence "));
    connect(findAct, SIGNAL(triggered()), this, SLOT(findFirst()));

    findNextAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_find_next.png"), tr("Find &next"), this);
    findNextAct->setShortcut(tr("F3"));
    findNextAct->setStatusTip(tr("Find the next occurence "));
    connect(findNextAct, SIGNAL(triggered()), this, SLOT(findNext()));
    findNextAct->setEnabled(false);

    replaceAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_find_replace.png"), tr("Find && &replace ..."), this);
    replaceAct->setShortcut(tr("Ctrl+R"));
    replaceAct->setStatusTip(tr("Find a string in sequence and replace it with another string "));
    connect(replaceAct, SIGNAL(triggered()), this, SLOT(replaceFirst()));

    commentAct = new QFActionWithNoMenuRole(tr("&Comment text"), this);
    commentAct->setShortcut(tr("Ctrl+B"));
    commentAct->setStatusTip(tr("add (single line) comment at the beginning of each line "));
    connect(commentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(comment()));

    unCommentAct = new QFActionWithNoMenuRole(tr("&Uncomment text"), this);
    unCommentAct->setShortcut(tr("Ctrl+Shift+B"));
    unCommentAct->setStatusTip(tr("remove (single line) comment at the beginning of each line "));
    connect(unCommentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(uncomment()));

    indentAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_indent.png"), tr("&Increase indention"), this);
    commentAct->setShortcut(tr("Ctrl+I"));
    indentAct->setStatusTip(tr("increase indention "));
    connect(indentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentInc()));

    unindentAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_unindent.png"), tr("&Decrease indention"), this);
    unindentAct->setShortcut(tr("Ctrl+Shift+I"));
    unindentAct->setStatusTip(tr("decrease indention "));
    connect(unindentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentDec()));

    gotoLineAct = new QFActionWithNoMenuRole(tr("&Goto line ..."), this);
    gotoLineAct->setShortcut(tr("Alt+G"));
    gotoLineAct->setStatusTip(tr("goto a line in the opened file "));
    connect(gotoLineAct, SIGNAL(triggered()), this, SLOT(gotoLine()));

    printAct = new QFActionWithNoMenuRole(QIcon(":/spimb040/script_print.png"), tr("&Print ..."), this);
    printAct->setStatusTip(tr("print the current SDFF file "));
    connect(printAct, SIGNAL(triggered()), this, SLOT(print()));

    cutAct->setEnabled(false);
    copyAct->setEnabled(false);
    undoAct->setEnabled(false);
    redoAct->setEnabled(false);
    connect(ui->edtScript->getEditor(), SIGNAL(copyAvailable(bool)), cutAct, SLOT(setEnabled(bool)));
    connect(ui->edtScript->getEditor(), SIGNAL(copyAvailable(bool)), copyAct, SLOT(setEnabled(bool)));
    connect(ui->edtScript->getEditor(), SIGNAL(undoAvailable(bool)), undoAct, SLOT(setEnabled(bool)));
    connect(ui->edtScript->getEditor(), SIGNAL(redoAvailable(bool)), redoAct, SLOT(setEnabled(bool)));
    connect(ui->edtScript->getEditor(), SIGNAL(findNextAvailable(bool)), findNextAct, SLOT(setEnabled(bool)));


    QMenu* menuMore=new QMenu(ui->tbMoreOptions);
    menuMore->addAction(indentAct);
    menuMore->addAction(unindentAct);
    menuMore->addAction(commentAct);
    menuMore->addAction(unCommentAct);
    menuMore->addSeparator();
    menuMore->addAction(gotoLineAct);
    menuMore->addAction(findAct);
    menuMore->addAction(replaceAct);
    menuMore->addAction(findNextAct);
    ui->tbMoreOptions->setMenu(menuMore);
    ui->tbFind->setDefaultAction(findAct);
    ui->tbFindNext->setDefaultAction(findNextAct);
    ui->tbReplace->setDefaultAction(replaceAct);
    ui->tbPrint->setDefaultAction(printAct);
    ui->tbCopy->setDefaultAction(copyAct);
    ui->tbCut->setDefaultAction(cutAct);
    ui->tbPaste->setDefaultAction(pasteAct);
    ui->tbRedo->setDefaultAction(redoAct);
    ui->tbUndo->setDefaultAction(undoAct);



    updateReplaces();
    //bindLineEdit(ui->edtPrefix1);
    ui->btnCancel->setVisible(false);
    ui->widProgress->setVisible(false);
    ui->labStatus->setVisible(false);
    setScriptFilename(tr("new_acquisition_script.js"));


    QDir d(QFPluginServices::getInstance()->getPluginHelpDirectory("ext_spimb040")+"acquisition_script/");
    QStringList filter;
    filter<<"*.html"<<"*.htm"<<"*.txt";
    QStringList files=d.entryList(filter, QDir::Files);
    threadsFinished=0;
    maxThreads=2;
    QList<QStringList> absFiles;

    for (int i=0; i<maxThreads; i++) {
        QStringList sl;
        absFiles.push_back(sl);
    }
    for (int i=0; i<files.size(); i++) {
        QString file=d.absoluteFilePath(files[i]);
        absFiles[i%maxThreads].append(file);
    }
    for (int i=0; i<maxThreads; i++) {
        threads.append(new QFESPIMB040ScriptedAcquisitionDocSearchThread(absFiles[i], this));
        connect(threads[i], SIGNAL(finished()), this, SLOT(threadFinished()));
        connect(threads[i], SIGNAL(foundFunction(QString,QString,QString)), this, SLOT(addFunction(QString,QString,QString)));
    }
    QTimer::singleShot(10, this, SLOT(delayedStartSearchThreads()));
}