/***************************************************************************
* Copyright (C) 2007-2009 by Elad Lahav
* elad_lahav@users.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
***************************************************************************/
#include <QMenuBar>
#include <QFileDialog>
#include <QMessageBox>
#include "actions.h"
#include "mainwindow.h"
#include "editorcontainer.h"
#include "projectdialog.h"
#include "projectfilesdialog.h"
#include "managedproject.h"
#include "projectmanager.h"
#include "queryresultdock.h"
#include "configenginesdialog.h"
namespace KScope
{
namespace App
{
/**
* Class constructor.
* @param Pointer to the main window
*/
Actions::Actions(MainWindow* parent) : QObject(parent)
{
}
/**
* Class destructor.
*/
Actions::~Actions()
{
}
/**
* Creates the actions.
* Must be called after the main window's child widgets have been created.
*/
void Actions::setup()
{
QMenu* menu;
QAction* action;
QActionGroup* group;
// File menu.
menu = mainWnd()->menuBar()->addMenu(tr("&File"));
// Create a new file.
action = new QAction(tr("&New"), this);
action->setShortcut(tr("Ctrl+N"));
action->setStatusTip(tr("New file"));
connect(action, SIGNAL(triggered()), mainWnd()->editCont_,
SLOT(newFile()));
menu->addAction(action);
// Open an existing file.
action = new QAction(tr("&Open"), this);
action->setShortcut(tr("Ctrl+O"));
action->setStatusTip(tr("Open existing file"));
connect(action, SIGNAL(triggered()), mainWnd()->editCont_,
SLOT(openFile()));
menu->addAction(action);
menu->addSeparator();
// Exit the application.
action = new QAction(tr("&Quit"), this);
action->setShortcut(tr("Alt+F4"));
action->setStatusTip(tr("Exit the application"));
connect(action, SIGNAL(triggered()), mainWnd(), SLOT(close()));
menu->addAction(action);
// Edit menu.
menu = mainWnd()->menuBar()->addMenu(tr("&Edit"));
// A group for file editing actions.
// Only enabled when there is an active editor.
group = new QActionGroup(this);
connect(mainWnd()->editCont_, SIGNAL(hasActiveEditor(bool)), group,
SLOT(setEnabled(bool)));
group->setEnabled(false);
// Find text in file.
action = new QAction(tr("&Find..."), this);
action->setShortcut(tr("Ctrl+F"));
action->setStatusTip(tr("Find text in this file"));
connect(action, SIGNAL(triggered()), mainWnd()->editCont_,
SIGNAL(find()));
menu->addAction(action);
group->addAction(action);
// Find the next occurrence of the text.
action = new QAction(tr("Find &Next"), this);
action->setShortcut(tr("F3"));
action->setStatusTip(tr("Find next occurrence of text in this file"));
connect(action, SIGNAL(triggered()), mainWnd()->editCont_,
SIGNAL(findNext()));
menu->addAction(action);
group->addAction(action);
// Navigate menu.
// Enabled only when there is an active project.
menu = mainWnd()->menuBar()->addMenu(tr("&Navigate"));
menu->setEnabled(false);
connect(ProjectManager::signalProxy(), SIGNAL(hasProject(bool)), menu,
SLOT(setEnabled(bool)));
// Go to the next location in the navigation history.
action = new QAction(tr("Next &Location"), this);
action->setShortcut(tr("Alt+Right"));
action->setStatusTip(tr("Next location in navigation history"));
connect(action, SIGNAL(triggered()), mainWnd()->editCont_,
SLOT(gotoNextLocation()));
menu->addAction(action);
// Go to the previous location in the navigation history.
action = new QAction(tr("Previous L&ocation"), this);
action->setShortcut(tr("Alt+Left"));
action->setStatusTip(tr("Previous location in navigation history"));
connect(action, SIGNAL(triggered()), mainWnd()->editCont_,
SLOT(gotoPrevLocation()));
menu->addAction(action);
// Select the next query result.
action = new QAction(tr("Next &Result"), this);
action->setShortcut(tr("Alt+Down"));
action->setStatusTip(tr("Select the next query result"));
connect(action, SIGNAL(triggered()), mainWnd()->queryDock_,
SLOT(selectNextResult()));
menu->addAction(action);
// Select the previous query result.
action = new QAction(tr("Previous R&esult"), this);
action->setShortcut(tr("Alt+Up"));
action->setStatusTip(tr("Select the previous query result"));
connect(action, SIGNAL(triggered()), mainWnd()->queryDock_,
SLOT(selectPrevResult()));
menu->addAction(action);
menu->addSeparator();
// Browse location history.
action = new QAction(tr("&History"), this);
action->setShortcut(tr("Ctrl+H"));
action->setStatusTip(tr("rowse location history"));
connect(action, SIGNAL(triggered()), mainWnd()->editCont_,
SLOT(browseHistory()));
menu->addAction(action);
// Project menu.
menu = mainWnd()->menuBar()->addMenu(tr("&Project"));
// Create a new project.
action = new QAction(tr("&New..."), this);
action->setStatusTip(tr("New project"));
connect(action, SIGNAL(triggered()), this, SLOT(newProject()));
menu->addAction(action);
// Open an existing project.
action = new QAction(tr("&Open..."), this);
action->setShortcut(tr("Ctrl+P"));
action->setStatusTip(tr("Open project"));
connect(action, SIGNAL(triggered()), this, SLOT(openProject()));
menu->addAction(action);
// A group for project actions requiring an open project.
// Only enabled when there is an active project.
group = new QActionGroup(this);
connect(ProjectManager::signalProxy(), SIGNAL(hasProject(bool)), group,
SLOT(setEnabled(bool)));
group->setEnabled(false);
menu->addSeparator();
// Manage project files.
action = new QAction(tr("&Files..."), this);
action->setShortcut(tr("Ctrl+Shift+O"));
action->setStatusTip(tr("Manage project files"));
connect(action, SIGNAL(triggered()), this, SLOT(projectFiles()));
menu->addAction(action);
group->addAction(action);
// View/edit project parameters.
action = new QAction(tr("&Properties..."), this);
action->setStatusTip(tr("View/edit project parameters"));
connect(action, SIGNAL(triggered()), this, SLOT(projectProperties()));
menu->addAction(action);
group->addAction(action);
// Build the project's database.
action = new QAction(tr("&Build Database"), this);
action->setShortcut(tr("Ctrl+B"));
action->setStatusTip(tr("Build the project database"));
connect(action, SIGNAL(triggered()), mainWnd(), SLOT(buildProject()));
menu->addAction(action);
group->addAction(action);
menu->addSeparator();
// Close the active project.
action = new QAction(tr("&Close"), this);
action->setStatusTip(tr("Close the active project"));
connect(action, SIGNAL(triggered()), this, SLOT(closeProject()));
menu->addAction(action);
group->addAction(action);
// Query menu.
// Enabled only when there is an active project.
menu = mainWnd()->menuBar()->addMenu(tr("&Query"));
menu->setEnabled(false);
connect(ProjectManager::signalProxy(), SIGNAL(hasProject(bool)), menu,
SLOT(setEnabled(bool)));
// Quick definition.
// Needs an active editor to be enabled.
action = new QAction(tr("&Quick Definition"), this);
action->setShortcut(tr("Ctrl+]"));
action->setStatusTip(tr("Find symbol definition"));
connect(action, SIGNAL(triggered()), mainWnd(), SLOT(quickDefinition()));
action->setEnabled(false);
connect(mainWnd()->editCont_, SIGNAL(hasActiveEditor(bool)), action,
SLOT(setEnabled(bool)));
没有合适的资源?快使用搜索试试~ 我知道了~
kscope-1.9.1.tar.gz
需积分: 0 5 下载量 178 浏览量
2011-08-25
22:29:15
上传
评论
收藏 95KB GZ 举报
温馨提示
共118个文件
h:48个
cpp:33个
ui:12个
kscope-1.9.1.tar.gz kscope-1.9.1.tar.gz kscope-1.9.1.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
kscope-1.9.1.tar.gz (118个子文件)
ChangeLog 535B
config 762B
COPYING 18KB
actions.cpp 15KB
queryview.cpp 15KB
editorcontainer.cpp 13KB
editor.cpp 10KB
mainwindow.cpp 9KB
locationtreemodel.cpp 9KB
addfilesdialog.cpp 7KB
locationlistmodel.cpp 7KB
crossref.cpp 6KB
cscope.cpp 6KB
codebasemodel.cpp 5KB
application.cpp 5KB
locationmodel.cpp 5KB
filescanner.cpp 5KB
stackwidget.cpp 5KB
session.cpp 4KB
querydialog.cpp 4KB
queryresultdock.cpp 4KB
ctags.cpp 3KB
findtextdialog.cpp 3KB
files.cpp 3KB
configenginesdialog.cpp 3KB
projectmanager.cpp 2KB
projectfilesdialog.cpp 2KB
process.cpp 2KB
editorconfigdialog.cpp 2KB
projectdialog.cpp 2KB
progressbar.cpp 2KB
queryresultdialog.cpp 1KB
managedproject.cpp 1KB
engineconfigwidget.cpp 1KB
configwidget.cpp 1KB
main.cpp 1KB
Doxyfile 10KB
struct.gif 1KB
variable.gif 1KB
enum.gif 1KB
function.gif 1KB
define.gif 1KB
union.gif 594B
enumerator.gif 590B
typedef.gif 585B
member.gif 573B
cancel.gif 358B
include.gif 324B
parser.h 10KB
project.h 9KB
globals.h 7KB
statemachine.h 7KB
cscope.h 6KB
queryview.h 5KB
engine.h 5KB
locationmodel.h 5KB
ctags.h 5KB
filefilter.h 4KB
treeitem.h 4KB
crossref.h 4KB
buildprogress.h 4KB
locationhistory.h 4KB
managedproject.h 4KB
strings.h 3KB
projectdialog.h 3KB
session.h 3KB
stackwidget.h 3KB
editor.h 3KB
filescanner.h 3KB
projectmanager.h 3KB
locationtreemodel.h 3KB
codebasemodel.h 3KB
editorcontainer.h 3KB
locationlistmodel.h 2KB
mainwindow.h 2KB
projectconfig.h 2KB
codebase.h 2KB
version.h 2KB
files.h 2KB
queryresultdock.h 2KB
queryview.h 2KB
exception.h 2KB
findtextdialog.h 2KB
actions.h 2KB
fileiothread.h 2KB
querydialog.h 2KB
application.h 2KB
process.h 2KB
addfilesdialog.h 2KB
editorconfigdialog.h 2KB
configenginesdialog.h 2KB
progressbar.h 1KB
queryresultdialog.h 1KB
engineconfigwidget.h 1KB
projectfilesdialog.h 1KB
configwidget.h 1KB
INSTALL 927B
kscope.png 2KB
show.png 650B
close.png 293B
共 118 条
- 1
- 2
资源评论
ailinty
- 粉丝: 107
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功