Ejemplo n.º 1
0
void PgxConsole::createActions()
{
    cut_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/cut.png")), tr("Cut"), this);
    cut_action->setShortcuts(QKeySequence::Cut);
    cut_action->setStatusTip(tr("Cut selected text and copy to clipboard"));
    connect(cut_action, SIGNAL(triggered()), this, SLOT(cut()));

    copy_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/copy.png")), tr("Copy"), this);
    copy_action->setShortcuts(QKeySequence::Copy);
    copy_action->setStatusTip(tr("Copy selected text to clipboard"));
    connect(copy_action, SIGNAL(triggered()), this, SLOT(copy()));

    paste_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/paste.png")), tr("Paste"), this);
    paste_action->setShortcuts(QKeySequence::Paste);
    paste_action->setStatusTip(tr("Paste"));
    connect(paste_action, SIGNAL(triggered()), this, SLOT(pasteAsSingleFromClipboard()));

    clear_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/clear.png")), tr("&Clear"), this);
    clear_action->setStatusTip(tr("Clear the console"));
    connect(clear_action, SIGNAL(triggered()), this, SLOT(clear()));

    find_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/search.png")), tr("Find"), this);
    find_action->setShortcuts(QKeySequence::Find);
    find_action->setStatusTip(tr("Find/replace text"));
    find_action->setCheckable(true);
    connect(find_action, SIGNAL(triggered()), this, SLOT(toggleFindBar()));

    casesensitivity_action = new QAction(tr("Cs"), this);
    casesensitivity_action->setToolTip(tr("Case sensitive"));
    casesensitivity_action->setCheckable(true);
    casesensitivity_button = new QToolButton;
    casesensitivity_button->setDefaultAction(casesensitivity_action);
    casesensitivity_button->setVisible(false);

    wholeword_action = new QAction(tr("W"), this);
    wholeword_action->setToolTip(tr("Whole word"));
    wholeword_action->setCheckable(true);
    wholeword_button = new QToolButton;
    wholeword_button->setDefaultAction(wholeword_action);
    wholeword_button->setVisible(false);

    backwards_action = new QAction(tr("B"), this);
    backwards_action->setToolTip(tr("Backwards"));
    backwards_action->setCheckable(true);
    backwards_button = new QToolButton;
    backwards_button->setDefaultAction(backwards_action);
    backwards_button->setVisible(false);
}
Ejemplo n.º 2
0
void PgxConsole::createActions()
{
    newpgxconsole_action = new QAction(QIcon(":/icons/console.png"), tr("New"), this);
    newpgxconsole_action->setShortcuts(QKeySequence::New);
    newpgxconsole_action->setStatusTip(tr("New console"));
    connect(newpgxconsole_action, SIGNAL(triggered()), this, SIGNAL(newPgxconsole()));

    cut_action = new QAction(QIcon(":/icons/cut.png"), tr("Cut"), this);
    cut_action->setShortcuts(QKeySequence::Cut);
    cut_action->setStatusTip(tr("Cut selected text and copy to clipboard"));
    connect(cut_action, SIGNAL(triggered()), SLOT(cut()));

    copy_action = new QAction(QIcon(":/icons/copy.png"), tr("Copy"), this);
    copy_action->setShortcuts(QKeySequence::Copy);
    copy_action->setStatusTip(tr("Copy selected text to clipboard"));
    connect(copy_action, SIGNAL(triggered()), SLOT(copy()));

    paste_action = new QAction(QIcon(":/icons/paste.png"), tr("Paste"), this);
    paste_action->setShortcuts(QKeySequence::Paste);
    paste_action->setStatusTip(tr("Paste"));
    connect(paste_action, SIGNAL(triggered()), SLOT(pasteAsSingleFromClipboard()));

    clear_action = new QAction(QIcon(":/icons/clear.png"), tr("&Clear"), this);
    clear_action->setStatusTip(tr("Clear the console"));
    connect(clear_action, SIGNAL(triggered()), SLOT(clear()));

    find_action = new QAction(QIcon(":/icons/search.png"), tr("Find"), this);
    find_action->setShortcuts(QKeySequence::Find);
    find_action->setStatusTip(tr("Find text"));
    find_action->setCheckable(true);
    connect(find_action, SIGNAL(triggered()), SLOT(toggleFindBar()));

    casesensitivity_action = new QAction(tr("Cs"), this);
    casesensitivity_action->setToolTip(tr("Case sensitive"));
    casesensitivity_action->setCheckable(true);
    casesensitivity_button = new QToolButton;
    casesensitivity_button->setDefaultAction(casesensitivity_action);
    casesensitivity_button->setVisible(false);

    wholeword_action = new QAction(tr("W"), this);
    wholeword_action->setToolTip(tr("Whole word"));
    wholeword_action->setCheckable(true);
    wholeword_button = new QToolButton;
    wholeword_button->setDefaultAction(wholeword_action);
    wholeword_button->setVisible(false);

    //backwards_action = new QAction(tr("B"), this);
    //backwards_action->setToolTip(tr("Backwards"));
    //backwards_action->setCheckable(true);
    //backwards_button = new QToolButton;
    //backwards_button->setDefaultAction(backwards_action);
    //backwards_button->setVisible(false);

    find_previous_action = new QAction(QIcon(":/icons/find_previous.png"), "", this);
    find_previous_action->setToolTip(tr("Find previous"));
    connect(find_previous_action, SIGNAL(triggered()), SLOT(findPrevious()));
    find_previous_button = new QToolButton;
    find_previous_button->setAutoRaise(true);
    find_previous_button->setDefaultAction(find_previous_action);
    find_previous_button->setVisible(false);

    find_next_action = new QAction(QIcon(":/icons/find_next.png"), "", this);
    find_next_action->setToolTip(tr("Find next"));
    connect(find_next_action, SIGNAL(triggered()), SLOT(findNext()));
    find_next_button = new QToolButton;
    find_next_button->setAutoRaise(true);
    find_next_button->setDefaultAction(find_next_action);
    find_next_button->setVisible(false);
}
Ejemplo n.º 3
0
void MainWindow::createToolBars()
{
    QAction *act = 0;

    m_pm_zoom = new QMenu(tr("Zoom"));
    act = m_pm_zoom->addAction(tr("Fit to width"));
    act->setData(QVariant(1));
    act = m_pm_zoom->addAction(tr("Fit to page"));
    act->setData(QVariant(2));
    m_pm_zoom->addSeparator();
    act = m_pm_zoom->addAction(tr("50%"));
    act->setData(QVariant(50));
    act = m_pm_zoom->addAction(tr("75%"));
    act->setData(QVariant(75));
    act = m_pm_zoom->addAction(tr("100%"));
    act->setData(QVariant(100));
    act = m_pm_zoom->addAction(tr("125%"));
    act->setData(QVariant(125));
    act = m_pm_zoom->addAction(tr("150%"));
    act->setData(QVariant(150));
    act = m_pm_zoom->addAction(tr("200%"));
    act->setData(QVariant(200));
    connect(m_pm_zoom, SIGNAL(triggered(QAction*)),
            this, SLOT(setZoom(QAction*)));

    m_tb_menu = addToolBar(tr("menu"));
    m_tb_menu->addAction(tr("Zoom"))->setMenu(m_pm_zoom);
    m_tb_menu->setMovable(false);

    m_tb_tool = addToolBar(tr("tool"));
    m_tb_tool->setMovable(false);
    m_tb_tool->addAction(QIcon(tr(":/fileopen")), tr("Open..."),
                         this, SLOT(openFile()));
    m_tb_tool->addSeparator();
    m_to_find = m_tb_tool->addAction(QIcon(tr(":/find")), tr("Find..."),
                                     this, SLOT(toggleFindBar()));
    m_to_find->setCheckable(true);
    m_tb_tool->addSeparator();
    m_to_full = m_tb_tool->addAction(QIcon(tr(":/fullscreen")),
                                     tr("Fullscreen"), this,
                                     SLOT(toggleFullscreen()));
    m_to_full->setCheckable(true);
    m_tb_tool->addSeparator();
    m_tb_tool->addAction(QIcon(tr(":/fastback")), tr("First page"),
                         this, SLOT(firstPage()));
    m_tb_tool->addAction(QIcon(tr(":/back")), tr("Previous page"),
                         this, SLOT(prevPage()));
    m_tb_tool->addAction(QIcon(tr(":/down")), tr("Goto Page..."),
                         this, SLOT(gotoPageDialog()));
    m_tb_tool->addAction(QIcon(tr(":/forward")), tr("Next page"),
                         this, SLOT(nextPage()));
    m_tb_tool->addAction(QIcon(tr(":/fastforward")), tr("Last page"),
                         this, SLOT(lastPage()));

    addToolBarBreak();
    m_tb_find = addToolBar(tr("search"));
    m_tb_find->setMovable(false);
    m_tb_find->hide();

    m_findedit = new QLineEdit();
    m_tb_find->addWidget(m_findedit);
    m_tb_find->addAction(QIcon(tr(":/find")), tr("Find..."),
                         this, SLOT(findText()));
    m_tb_find->addAction(QIcon(tr(":/next")), tr("Next"),
                         this, SLOT(findText()));

}
Ejemplo n.º 4
0
void PgxEditor::createActions()
{
    newpgxeditor_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/editor.png")), tr("New"), this);
    newpgxeditor_action->setShortcuts(QKeySequence::New);
    newpgxeditor_action->setStatusTip(tr("New editor"));
    connect(newpgxeditor_action, SIGNAL(triggered()), this, SIGNAL(newPgxeditor()));

    cut_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/cut.png")), tr("Cut"), this);
    cut_action->setShortcuts(QKeySequence::Cut);
    cut_action->setStatusTip(tr("Cut selected text and copy to clipboard"));
    connect(cut_action, SIGNAL(triggered()), this, SLOT(cut()));

    copy_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/copy.png")), tr("Copy"), this);
    copy_action->setShortcuts(QKeySequence::Copy);
    copy_action->setStatusTip(tr("Copy selected text to clipboard"));
    connect(copy_action, SIGNAL(triggered()), this, SLOT(copy()));

    paste_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/paste.png")), tr("Paste"), this);
    paste_action->setShortcuts(QKeySequence::Paste);
    paste_action->setStatusTip(tr("Paste text from clipboard"));
    connect(paste_action, SIGNAL(triggered()), this, SLOT(paste()));

    if(!editor_name.isEmpty()) {
        save_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/save.png")), tr("&Save"), this);
        save_action->setShortcuts(QKeySequence::Save);
        save_action->setStatusTip(tr("Save function"));
        save_action->setEnabled(false);
        connect(save_action, SIGNAL(triggered()), this, SLOT(saveFunction()));

        execute_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/execute.png")), tr("&Execute"), this);
        execute_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
        execute_action->setStatusTip(tr("Execute function"));
        connect(execute_action, SIGNAL(triggered()), this, SLOT(executeFunction()));
    }

    selected_execute_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/selected_execute.png")), tr("&Run"), this);
    selected_execute_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
    selected_execute_action->setStatusTip(tr("Execute selected text"));
    if(!editor_name.isEmpty())
        selected_execute_action->setEnabled(false);
    connect(selected_execute_action, SIGNAL(triggered()), this, SLOT(executeText()));

    wrap_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/wrap.png")), tr("Wrap/Un-wrap lines"),this);
    wrap_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
    wrap_action->setStatusTip(tr("Toggle line wrapping"));
    wrap_action->setCheckable(true);
    wrap_action->setChecked(true);
    connect(wrap_action, SIGNAL(triggered()), this, SLOT(toggleWrap()));

    find_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/find.png")), tr("Find"), this);
    find_action->setShortcuts(QKeySequence::Find);
    find_action->setStatusTip(tr("Find/replace text"));
    connect(find_action, SIGNAL(triggered()), this, SLOT(toggleFindBar()));

    casesensitivity_action = new QAction(tr("Cs"), this);
    casesensitivity_action->setToolTip(tr("Case sensitive"));
    casesensitivity_action->setCheckable(true);
    casesensitivity_button = new QToolButton;
    casesensitivity_button->setDefaultAction(casesensitivity_action);
    casesensitivity_button->setVisible(false);

    wholeword_action = new QAction(tr("W"), this);
    wholeword_action->setToolTip(tr("Whole word"));
    wholeword_action->setCheckable(true);
    wholeword_button = new QToolButton;
    wholeword_button->setDefaultAction(wholeword_action);
    wholeword_button->setVisible(false);

    backwards_action = new QAction(tr("B"), this);
    backwards_action->setToolTip(tr("Backwards"));
    backwards_action->setCheckable(true);
    backwards_button = new QToolButton;
    backwards_button->setDefaultAction(backwards_action);
    backwards_button->setVisible(false);
}