Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
dt
2009-01-23 11:54:22 +01:00
59 changed files with 1378 additions and 212 deletions

View File

@@ -148,7 +148,7 @@ QString CoreImpl::resourcePath() const
#if defined(Q_OS_MAC)
return QDir::cleanPath(QCoreApplication::applicationDirPath()+QLatin1String("/../Resources"));
#else
return QDir::cleanPath(QCoreApplication::applicationDirPath());
return QDir::cleanPath(QCoreApplication::applicationDirPath())+"/../share/qtcreator";
#endif
}

View File

@@ -476,43 +476,43 @@ void MainWindow::registerDefaultActions()
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Advanced"), m_globalContext);
medit->addAction(cmd, Constants::G_EDIT_ADVANCED);
//Tools menu separators
// Tools menu separators
cmd = createSeparator(am, this, QLatin1String("QtCreator.Tools.Sep.Options"), m_globalContext);
mtools->addAction(cmd, Constants::G_DEFAULT_THREE);
//Return to editor shortcut: Note this requires Qt to fix up
// Return to editor shortcut: Note this requires Qt to fix up
// handling of shortcut overrides in menus, item views, combos....
m_focusToEditor = new QShortcut(this);
cmd = am->registerShortcut(m_focusToEditor, Constants::S_RETURNTOEDITOR, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_Escape));
connect(m_focusToEditor, SIGNAL(activated()), this, SLOT(setFocusToEditor()));
//New File Action
// New File Action
m_newAction = new QAction(QIcon(Constants::ICON_NEWFILE), tr("&New..."), this);
cmd = am->registerAction(m_newAction, Constants::NEW, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::New);
mfile->addAction(cmd, Constants::G_FILE_NEW);
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
//Open Action
// Open Action
m_openAction = new QAction(QIcon(Constants::ICON_OPENFILE), tr("&Open..."), this);
cmd = am->registerAction(m_openAction, Constants::OPEN, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Open);
mfile->addAction(cmd, Constants::G_FILE_OPEN);
connect(m_openAction, SIGNAL(triggered()), this, SLOT(openFile()));
//Open With Action
// Open With Action
m_openWithAction = new QAction(tr("&Open With..."), this);
cmd = am->registerAction(m_openWithAction, Constants::OPEN_WITH, m_globalContext);
mfile->addAction(cmd, Constants::G_FILE_OPEN);
connect(m_openWithAction, SIGNAL(triggered()), this, SLOT(openFileWith()));
//File->Recent Files Menu
// File->Recent Files Menu
ActionContainer *ac = am->createMenu(Constants::M_FILE_RECENTFILES);
mfile->addMenu(ac, Constants::G_FILE_OPEN);
ac->menu()->setTitle(tr("Recent Files"));
//Save Action
// Save Action
QAction *tmpaction = new QAction(QIcon(Constants::ICON_SAVEFILE), tr("&Save"), this);
cmd = am->registerAction(tmpaction, Constants::SAVE, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Save);
@@ -520,7 +520,7 @@ void MainWindow::registerDefaultActions()
cmd->setDefaultText(tr("&Save"));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
//Save As Action
// Save As Action
tmpaction = new QAction(tr("Save &As..."), this);
cmd = am->registerAction(tmpaction, Constants::SAVEAS, m_globalContext);
#ifdef Q_OS_MAC
@@ -530,7 +530,7 @@ void MainWindow::registerDefaultActions()
cmd->setDefaultText(tr("Save &As..."));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
//SaveAll Action
// SaveAll Action
m_saveAllAction = new QAction(tr("Save A&ll"), this);
cmd = am->registerAction(m_saveAllAction, Constants::SAVEALL, m_globalContext);
#ifndef Q_OS_MAC
@@ -539,19 +539,19 @@ void MainWindow::registerDefaultActions()
mfile->addAction(cmd, Constants::G_FILE_SAVE);
connect(m_saveAllAction, SIGNAL(triggered()), this, SLOT(saveAll()));
//Print Action
// Print Action
tmpaction = new QAction(tr("&Print..."), this);
cmd = am->registerAction(tmpaction, Constants::PRINT, m_globalContext);
mfile->addAction(cmd, Constants::G_FILE_PRINT);
//Exit Action
// Exit Action
m_exitAction = new QAction(tr("E&xit"), this);
cmd = am->registerAction(m_exitAction, Constants::EXIT, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q")));
mfile->addAction(cmd, Constants::G_FILE_OTHER);
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
//Undo Action
// Undo Action
tmpaction = new QAction(QIcon(Constants::ICON_UNDO), tr("&Undo"), this);
cmd = am->registerAction(tmpaction, Constants::UNDO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Undo);
@@ -559,7 +559,7 @@ void MainWindow::registerDefaultActions()
cmd->setDefaultText(tr("&Undo"));
medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
//Redo Action
// Redo Action
tmpaction = new QAction(QIcon(Constants::ICON_REDO), tr("&Redo"), this);
cmd = am->registerAction(tmpaction, Constants::REDO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Redo);
@@ -567,37 +567,37 @@ void MainWindow::registerDefaultActions()
cmd->setDefaultText(tr("&Redo"));
medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
//Cut Action
// Cut Action
tmpaction = new QAction(QIcon(Constants::ICON_CUT), tr("Cu&t"), this);
cmd = am->registerAction(tmpaction, Constants::CUT, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Cut);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
//Copy Action
// Copy Action
tmpaction = new QAction(QIcon(Constants::ICON_COPY), tr("&Copy"), this);
cmd = am->registerAction(tmpaction, Constants::COPY, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Copy);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
//Paste Action
// Paste Action
tmpaction = new QAction(QIcon(Constants::ICON_PASTE), tr("&Paste"), this);
cmd = am->registerAction(tmpaction, Constants::PASTE, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Paste);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
//Select All
// Select All
tmpaction = new QAction(tr("&Select All"), this);
cmd = am->registerAction(tmpaction, Constants::SELECTALL, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::SelectAll);
medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
//Goto Action
// Goto Action
tmpaction = new QAction(tr("&Go To Line..."), this);
cmd = am->registerAction(tmpaction, Constants::GOTO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L")));
medit->addAction(cmd, Constants::G_EDIT_OTHER);
//Options Action
// Options Action
m_optionsAction = new QAction(tr("&Options..."), this);
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, m_globalContext);
#ifdef Q_OS_MAC
@@ -607,25 +607,25 @@ void MainWindow::registerDefaultActions()
connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));
#ifdef Q_OS_MAC
//Minimize Action
// Minimize Action
m_minimizeAction = new QAction(tr("Minimize"), this);
cmd = am->registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+M"));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
//Zoom Action
// Zoom Action
m_zoomAction = new QAction(tr("Zoom"), this);
cmd = am->registerAction(m_zoomAction, Constants::ZOOM_WINDOW, m_globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
//Window separator
// Window separator
cmd = createSeparator(am, this, QLatin1String("QtCreator.Window.Sep.Size"), m_globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
#endif
// Toggle Sidebar Action
// Show Sidebar Action
m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR),
tr("Show Sidebar"), this);
m_toggleSideBarAction->setCheckable(true);
@@ -641,19 +641,16 @@ void MainWindow::registerDefaultActions()
m_toggleSideBarAction->setEnabled(false);
#if !defined(Q_OS_MAC)
// Toggle Full Screen
m_toggleFullScreenAction = new QAction(tr("Toggle Fullscreen"), this);
// Full Screen Action
m_toggleFullScreenAction = new QAction(tr("Full Screen"), this);
m_toggleFullScreenAction->setCheckable(true);
m_toggleFullScreenAction->setChecked(false);
cmd = am->registerAction(m_toggleFullScreenAction,
Constants::TOGGLE_FULLSCREEN, m_globalContext);
cmd = am->registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+F11"));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)),
this, SLOT(setFullScreen(bool)));
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)), this, SLOT(setFullScreen(bool)));
#endif
//About IDE Action
// About IDE Action
#ifdef Q_OS_MAC
tmpaction = new QAction(tr("About &Qt Creator"), this); // it's convention not to add dots to the about menu
#else
@@ -672,7 +669,7 @@ void MainWindow::registerDefaultActions()
cmd->action()->setMenuRole(QAction::ApplicationSpecificRole);
#endif
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutPlugins()));
//About Qt Action
// About Qt Action
// tmpaction = new QAction(tr("About &Qt..."), this);
// cmd = am->registerAction(tmpaction, Constants:: ABOUT_QT, m_globalContext);
// mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
@@ -937,10 +934,8 @@ void MainWindow::changeEvent(QEvent *e)
m_minimizeAction->setEnabled(!minimized);
m_zoomAction->setEnabled(!minimized);
#else
QWindowStateChangeEvent *ev =
static_cast<QWindowStateChangeEvent *>(e);
bool isFullScreen = (ev->oldState() & Qt::WindowFullScreen) != 0;
m_toggleFullScreenAction->setChecked(!isFullScreen);
bool isFullScreen = (windowState() & Qt::WindowFullScreen) != 0;
m_toggleFullScreenAction->setChecked(isFullScreen);
#endif
}
}

View File

@@ -50,7 +50,7 @@ namespace Internal {
FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPages,
QWidget *parent) :
QWizard(parent),
m_formPage(new FormTemplateWizardPagePage),
m_formPage(new FormTemplateWizardPage),
m_classPage(new FormClassWizardPage)
{
setWindowTitle(tr("Qt Designer Form Class"));
@@ -97,8 +97,8 @@ void FormClassWizardDialog::slotCurrentIdChanged(int id)
m_rawFormTemplate = m_formPage->templateContents();
// Strip namespaces from the ui class and suggest it as a new class
// name
if (FormTemplateWizardPagePage::getUIXmlData(m_rawFormTemplate, &formBaseClass, &uiClassName))
m_classPage->setClassName(FormTemplateWizardPagePage::stripNamespaces(uiClassName));
if (FormTemplateWizardPage::getUIXmlData(m_rawFormTemplate, &formBaseClass, &uiClassName))
m_classPage->setClassName(FormTemplateWizardPage::stripNamespaces(uiClassName));
}
}
@@ -107,7 +107,7 @@ FormClassWizardParameters FormClassWizardDialog::parameters() const
FormClassWizardParameters rc;
m_classPage->getParameters(&rc);
// Name the ui class in the Ui namespace after the class specified
rc.uiTemplate = FormTemplateWizardPagePage::changeUiClassName(m_rawFormTemplate, rc.className);
rc.uiTemplate = FormTemplateWizardPage::changeUiClassName(m_rawFormTemplate, rc.className);
return rc;
}

View File

@@ -45,7 +45,7 @@ namespace Internal {
struct FormClassWizardParameters;
class FormClassWizardPage;
class FormTemplateWizardPagePage;
class FormTemplateWizardPage;
class FormClassWizardDialog : public QWizard
{
@@ -73,7 +73,7 @@ private slots:
void slotCurrentIdChanged(int id);
private:
FormTemplateWizardPagePage *m_formPage;
FormTemplateWizardPage *m_formPage;
FormClassWizardPage *m_classPage;
QString m_rawFormTemplate;
};

View File

@@ -57,7 +57,7 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
const QString indent = QString(indentation, QLatin1Char(' '));
QString formBaseClass;
QString uiClassName;
if (!FormTemplateWizardPagePage::getUIXmlData(uiTemplate, &formBaseClass, &uiClassName)) {
if (!FormTemplateWizardPage::getUIXmlData(uiTemplate, &formBaseClass, &uiClassName)) {
qWarning("Unable to determine the form base class from %s.", uiTemplate.toUtf8().constData());
return false;
}
@@ -107,7 +107,7 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
if (embedding == PointerAggregatedUiClass) {
headerStr << '\n'
<< namespaceIndent << "namespace " << uiNamespaceC << " {\n"
<< namespaceIndent << indent << "class " << FormTemplateWizardPagePage::stripNamespaces(uiClassName) << ";\n"
<< namespaceIndent << indent << "class " << FormTemplateWizardPage::stripNamespaces(uiClassName) << ";\n"
<< namespaceIndent << "}\n";
}

View File

@@ -55,9 +55,9 @@
namespace Designer {
namespace Internal {
// ----------------- FormTemplateWizardPagePage
// ----------------- FormTemplateWizardPage
FormTemplateWizardPagePage::FormTemplateWizardPagePage(QWidget * parent) :
FormTemplateWizardPage::FormTemplateWizardPage(QWidget * parent) :
QWizardPage(parent),
m_newFormWidget(QDesignerNewFormWidgetInterface::createNewFormWidget(FormEditorW::instance()->designerEditor())),
m_templateSelected(m_newFormWidget->hasCurrentTemplate())
@@ -74,12 +74,12 @@ FormTemplateWizardPagePage::FormTemplateWizardPagePage(QWidget * parent) :
setLayout(layout);
}
bool FormTemplateWizardPagePage::isComplete() const
bool FormTemplateWizardPage::isComplete() const
{
return m_templateSelected;
}
void FormTemplateWizardPagePage::slotCurrentTemplateChanged(bool templateSelected)
void FormTemplateWizardPage::slotCurrentTemplateChanged(bool templateSelected)
{
if (m_templateSelected == templateSelected)
return;
@@ -87,7 +87,7 @@ void FormTemplateWizardPagePage::slotCurrentTemplateChanged(bool templateSelecte
emit completeChanged();
}
bool FormTemplateWizardPagePage::validatePage()
bool FormTemplateWizardPage::validatePage()
{
QString errorMessage;
m_templateContents = m_newFormWidget->currentTemplate(&errorMessage);
@@ -98,7 +98,7 @@ bool FormTemplateWizardPagePage::validatePage()
return true;
}
QString FormTemplateWizardPagePage::stripNamespaces(const QString &className)
QString FormTemplateWizardPage::stripNamespaces(const QString &className)
{
QString rc = className;
const int namespaceIndex = rc.lastIndexOf(QLatin1String("::"));
@@ -107,7 +107,7 @@ QString FormTemplateWizardPagePage::stripNamespaces(const QString &className)
return rc;
}
bool FormTemplateWizardPagePage::getUIXmlData(const QString &uiXml,
bool FormTemplateWizardPage::getUIXmlData(const QString &uiXml,
QString *formBaseClass,
QString *uiClassName)
{
@@ -179,7 +179,7 @@ static const char *classNameChangingSheetFormatC =
"</xsl:template>\n"
"</xsl:stylesheet>\n";
QString FormTemplateWizardPagePage::changeUiClassName(const QString &uiXml, const QString &newUiClassName)
QString FormTemplateWizardPage::changeUiClassName(const QString &uiXml, const QString &newUiClassName)
{
// Prepare I/O: Sheet
const QString xsltSheet = QString::fromLatin1(classNameChangingSheetFormatC).arg(newUiClassName);
@@ -280,7 +280,7 @@ namespace {
// of the <class> element, as name of the first <widget> element, and possibly
// in the signal/slot connections
QString FormTemplateWizardPagePage::changeUiClassName(const QString &uiXml, const QString &newUiClassName)
QString FormTemplateWizardPage::changeUiClassName(const QString &uiXml, const QString &newUiClassName)
{
QDomDocument domUi;
if (!domUi.setContent(uiXml)) {

View File

@@ -46,12 +46,12 @@ namespace Internal {
// A wizard page embedding Qt Designer's QDesignerNewFormWidgetInterface
// widget.
class FormTemplateWizardPagePage : public QWizardPage
class FormTemplateWizardPage : public QWizardPage
{
Q_DISABLE_COPY(FormTemplateWizardPagePage)
Q_DISABLE_COPY(FormTemplateWizardPage)
Q_OBJECT
public:
explicit FormTemplateWizardPagePage(QWidget * parent = 0);
explicit FormTemplateWizardPage(QWidget * parent = 0);
virtual bool isComplete () const;
virtual bool validatePage();

View File

@@ -53,7 +53,7 @@ namespace Internal {
FormWizardDialog::FormWizardDialog(const WizardPageList &extensionPages,
QWidget *parent)
: QWizard(parent),
m_formPage(new FormTemplateWizardPagePage)
m_formPage(new FormTemplateWizardPage)
{
init(extensionPages);
}
@@ -114,8 +114,8 @@ void FormFileWizardDialog::slotCurrentIdChanged(int id)
// the ui class
QString formBaseClass;
QString uiClassName;
if (FormTemplateWizardPagePage::getUIXmlData(templateContents(), &formBaseClass, &uiClassName)) {
QString fileName = FormTemplateWizardPagePage::stripNamespaces(uiClassName).toLower();
if (FormTemplateWizardPage::getUIXmlData(templateContents(), &formBaseClass, &uiClassName)) {
QString fileName = FormTemplateWizardPage::stripNamespaces(uiClassName).toLower();
fileName += QLatin1String(".ui");
m_filePage->setName(fileName);
}

View File

@@ -45,7 +45,7 @@ namespace Utils {
namespace Designer {
namespace Internal {
class FormTemplateWizardPagePage;
class FormTemplateWizardPage;
// Single-Page Wizard for new forms offering all types known to Qt Designer.
// To be used for Mode "CreateNewEditor" [not currently used]
@@ -65,7 +65,7 @@ public:
private:
void init(const WizardPageList &extensionPages);
FormTemplateWizardPagePage *m_formPage;
FormTemplateWizardPage *m_formPage;
mutable QString m_templateContents;
};

View File

@@ -105,7 +105,7 @@ enum SubMode
ChangeSubMode,
DeleteSubMode,
FilterSubMode,
ReplaceSubMode,
ReplaceSubMode, // used for R and r
YankSubMode,
IndentSubMode,
ZSubMode,
@@ -113,11 +113,13 @@ enum SubMode
enum SubSubMode
{
// typically used for things that require one more data item
// and are 'nested' behind a mode
NoSubSubMode,
FtSubSubMode, // used for f, F, t, T
MarkSubSubMode, // used for m
BackTickSubSubMode, // used for `
TickSubSubMode // used for '
TickSubSubMode, // used for '
};
enum VisualMode
@@ -188,7 +190,7 @@ private:
int count() const { return mvCount() * opCount(); }
int leftDist() const { return m_tc.position() - m_tc.block().position(); }
int rightDist() const { return m_tc.block().length() - leftDist() - 1; }
bool atEol() const { return m_tc.atBlockEnd() && m_tc.block().length()>1; }
bool atEndOfLine() const { return m_tc.atBlockEnd() && m_tc.block().length()>1; }
int lastPositionInDocument() const;
int positionForLine(int line) const; // 1 based line, 0 based pos
@@ -284,11 +286,11 @@ public:
void recordInsert(int position, const QString &data);
void recordRemove(int position, const QString &data);
void recordRemove(int position, int length);
void recordMove(int position, int nestedCount);
void recordRemoveNextChar();
void recordInsertText(const QString &data);
QString recordRemoveSelectedText();
void recordMove();
void recordBeginGroup();
void recordEndGroup();
int anchor() const { return m_anchor; }
@@ -301,7 +303,6 @@ public:
QStack<int> m_undoGroupStack;
// extra data for '.'
QString m_dotCount;
QString m_dotCommand;
// history for '/'
@@ -392,7 +393,7 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
bool handled = handleKey(key, um, ev->text());
// We fake vi-style end-of-line behaviour
m_fakeEnd = (atEol() && m_mode == CommandMode);
m_fakeEnd = (atEndOfLine() && m_mode == CommandMode);
if (m_fakeEnd)
moveLeft();
@@ -447,7 +448,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_registers[m_register] = recordRemoveSelectedText();
recordEndGroup();
m_submode = NoSubMode;
if (atEol())
if (atEndOfLine())
moveLeft();
} else if (m_submode == YankSubMode) {
m_registers[m_register] = selectedText();
@@ -468,6 +469,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_submode = NoSubMode;
} else if (m_moveType == MoveExclusive) {
moveLeft(); // correct
m_moveType = MoveInclusive;
}
m_mvcount.clear();
m_opcount.clear();
@@ -632,12 +634,6 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveDown(count());
m_moveType = MoveLineWise;
finishMovement("y");
} else if (m_submode == ReplaceSubMode) {
if (atEol())
moveLeft(KeepAnchor);
else
m_tc.deleteChar();
recordInsertText(text);
} else if (m_submode == IndentSubMode && key == '=') {
indentRegion(m_tc.block(), m_tc.block().next());
finishMovement();
@@ -655,6 +651,22 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
handleFfTt(key);
m_subsubmode = NoSubSubMode;
finishMovement(QString(QChar(m_subsubdata)) + QChar(key));
} else if (m_submode == ReplaceSubMode) {
if (count() < rightDist() && text.size() == 1
&& (text.at(0).isPrint() || text.at(0).isSpace())) {
recordBeginGroup();
setAnchor();
moveRight(count());
recordRemoveSelectedText();
recordInsertText(QString(count(), text.at(0)));
recordEndGroup();
m_moveType = MoveExclusive;
m_submode = NoSubMode;
m_dotCommand = QString("%1r%2").arg(count()).arg(text);
finishMovement();
} else {
m_submode = NoSubMode;
}
} else if (m_subsubmode == MarkSubSubMode) {
m_marks[key] = m_tc.position();
m_subsubmode = NoSubSubMode;
@@ -749,7 +761,8 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_mode = InsertMode;
recordBeginGroup();
m_lastInsertion.clear();
moveRight();
if (!atEndOfLine())
moveRight();
updateMiniBuffer();
} else if (key == 'A') {
m_mode = InsertMode;
@@ -774,7 +787,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_mode = InsertMode;
finishMovement();
} else if (key == 'd' && m_visualMode == NoVisualMode) {
if (atEol())
if (atEndOfLine())
moveLeft();
setAnchor();
recordBeginGroup();
@@ -828,7 +841,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
} else if (key == 'i') {
enterInsertMode();
updateMiniBuffer();
if (atEol())
if (atEndOfLine())
moveLeft();
} else if (key == 'I') {
setAnchor();
@@ -916,25 +929,35 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
//qDebug() << "REGISTERS: " << m_registers << "MOVE: " << m_moveType;
//qDebug() << "LINES: " << n << text << m_register;
if (n > 0) {
recordMove();
moveToStartOfLine();
if (key == 'p')
moveDown();
recordInsertText(text);
moveUp(n);
m_desiredColumn = 0;
for (int i = count(); --i >= 0; ) {
if (key == 'p')
moveDown();
recordInsertText(text);
moveUp(n);
}
} else {
if (key == 'p')
moveRight();
recordInsertText(text);
moveLeft();
m_desiredColumn = 0;
for (int i = count(); --i >= 0; ) {
if (key == 'p')
moveRight();
recordInsertText(text);
moveLeft();
}
}
recordEndGroup();
m_dotCommand = "p";
m_dotCommand = QString("%1p").arg(count());
finishMovement();
} else if (key == 'r') {
recordBeginGroup();
m_submode = ReplaceSubMode;
m_dotCommand = "r";
} else if (key == 'R') {
// FIXME: right now we repeat the insertion count() times,
// but not the deletion
recordBeginGroup();
m_lastInsertion.clear();
m_mode = InsertMode;
m_submode = ReplaceSubMode;
m_dotCommand = "R";
@@ -972,9 +995,10 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveToNextWord(true);
finishMovement("W");
} else if (key == 'x') { // = "dl"
if (atEol())
if (atEndOfLine())
moveLeft();
recordBeginGroup();
setAnchor();
m_submode = DeleteSubMode;
moveRight(qMin(count(), rightDist()));
finishMovement("l");
@@ -987,7 +1011,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
finishMovement();
} else if (key == 'y') {
m_savedYankPosition = m_tc.position();
if (atEol())
if (atEndOfLine())
moveLeft();
recordBeginGroup();
setAnchor();
@@ -1001,7 +1025,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
} else if (key == 'z') {
recordBeginGroup();
m_submode = ZSubMode;
} else if (key == '~' && !atEol()) {
} else if (key == '~' && !atEndOfLine()) {
recordBeginGroup();
setAnchor();
moveRight(qMin(count(), rightDist()));
@@ -1019,7 +1043,9 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveUp(count() * (linesOnScreen() - 2));
finishMovement();
} else if (key == Key_Delete) {
m_tc.deleteChar();
setAnchor();
moveRight(qMin(1, rightDist()));
recordRemoveSelectedText();
} else if (key == Key_Escape) {
if (m_visualMode != NoVisualMode)
leaveVisualMode();
@@ -1085,7 +1111,7 @@ bool FakeVimHandler::Private::handleInsertMode(int key, int, const QString &text
} else if (!text.isEmpty()) {
m_lastInsertion.append(text);
if (m_submode == ReplaceSubMode) {
if (atEol())
if (atEndOfLine())
m_submode = NoSubMode;
else
m_tc.deleteChar();
@@ -1620,7 +1646,7 @@ void FakeVimHandler::Private::moveToMatchingParanthesis()
#if 0
// FIXME: remove TextEditor dependency
bool undoFakeEOL = false;
if (atEol()) {
if (atEndOfLine()) {
m_tc.movePosition(Left, KeepAnchor, 1);
undoFakeEOL = true;
}
@@ -1851,8 +1877,19 @@ void FakeVimHandler::Private::recordInsertText(const QString &data)
m_tc.insertText(data);
}
void FakeVimHandler::Private::recordMove()
{
EditOperation op;
op.position = m_tc.position();
m_undoStack.push(op);
m_redoStack.clear();
//qDebug() << "MOVE: " << op;
//qDebug() << "\nSTACK: " << m_undoStack;
}
void FakeVimHandler::Private::recordOperation(const EditOperation &op)
{
//qDebug() << "OP: " << op;
// No need to record operations that actually do not change anything.
if (op.from.isEmpty() && op.to.isEmpty() && op.itemCount == 0)
return;
@@ -1861,14 +1898,7 @@ void FakeVimHandler::Private::recordOperation(const EditOperation &op)
return;
m_undoStack.push(op);
m_redoStack.clear();
}
void FakeVimHandler::Private::recordMove(int position, int nestedCount)
{
EditOperation op;
op.position = position;
op.itemCount = nestedCount;
recordOperation(op);
//qDebug() << "\nSTACK: " << m_undoStack;
}
void FakeVimHandler::Private::recordInsert(int position, const QString &data)

View File

@@ -446,7 +446,7 @@ void HelpPlugin::extensionsInitialized()
#if defined(Q_OS_MAC)
+ QLatin1String("/../Resources/doc/qtcreator.qch"));
#else
+ QLatin1String("/../doc/qtcreator.qch"));
+ QLatin1String("../../share/doc/qtcreator/qtcreator.qch"));
#endif
QHelpEngineCore hc(fi.absoluteFilePath());
hc.setupData();