Commit 361a70ab authored by dt's avatar dt
Browse files

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

parents 19e3800c bb5759e8
......@@ -84,8 +84,11 @@ bool ClassNameValidatingLineEdit::validate(const QString &value, QString *errorM
if (errorMessage)
*errorMessage = tr("The class name must not contain namespace delimiters.");
return false;
}
if (!m_d->m_nameRegexp.exactMatch(value)) {
} else if (value.isEmpty()) {
if (errorMessage)
*errorMessage = tr("Please enter a class name.");
return false;
} else if (!m_d->m_nameRegexp.exactMatch(value)) {
if (errorMessage)
*errorMessage = tr("The class name contains invalid characters.");
return false;
......
......@@ -43,11 +43,12 @@ namespace Utils {
struct NewClassWidgetPrivate;
/* NewClassWidget: Utility widget for 'New Class' wizards. Prompts the user
/**
* NewClassWidget: Utility widget for 'New Class' wizards. Prompts the user
* to enter a class name (optionally derived from some base class) and file
* names for header, source and form files. Has some smart logic to derive
* the file names from the class name. */
* the file names from the class name.
*/
class QWORKBENCH_UTILS_EXPORT NewClassWidget : public QWidget
{
Q_DISABLE_COPY(NewClassWidget)
......@@ -115,8 +116,10 @@ public slots:
void setFormInputCheckable(bool v);
void setFormInputChecked(bool v);
/* The name passed into the new class widget will be reformatted to be a
* valid class name. */
/**
* The name passed into the new class widget will be reformatted to be a
* valid class name.
*/
void setClassName(const QString &suggestedName);
void setBaseClassName(const QString &);
void setPath(const QString &path);
......@@ -127,13 +130,15 @@ public slots:
void setAllowDirectories(bool v);
void setLowerCaseFiles(bool v);
/* Suggest a class name from the base class by stripping the leading 'Q'
/**
* Suggest a class name from the base class by stripping the leading 'Q'
* character. This will happen automagically if the base class combo
* changes until the class line edited is manually edited. */
* changes until the class line edited is manually edited.
*/
void suggestClassNameFromBase();
public slots:
// Trigger an update (after changing settings)
/** Trigger an update (after changing settings) */
void triggerUpdateFileNames();
private slots:
......
......@@ -92,6 +92,7 @@ WelcomeModePrivate::WelcomeModePrivate() :
m_projectHtmlTemplate(readFile(QLatin1String(":/core/html/recent_projects.html"))),
m_baseUrl(QUrl(QLatin1String("qrc:/core/html/welcome.html")))
{
m_webview->setContextMenuPolicy(Qt::NoContextMenu);
}
#if defined(QT_NO_WEBKIT)
......
......@@ -422,6 +422,10 @@ DebuggerSettings *theDebuggerSettings()
item->setText(QObject::tr("Use custom dumpers"));
item->setCheckable(true);
item = new DebuggerAction(instance);
instance->insertItem(Terminal, item);
item->setDefaultValue("xterm");
item->setSettingsKey("DebugMode", "Terminal");
item = new DebuggerAction(instance);
instance->insertItem(ListSourceFiles, item);
......
......@@ -141,6 +141,7 @@ enum DebuggerActionCode
GdbScriptFile,
GdbAutoRun,
GdbAutoQuit,
Terminal,
// Watchers & Locals
WatchExpression,
......
......@@ -268,6 +268,8 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
m_ui.terminalChooser->setExpectedKind(Core::Utils::PathChooser::Command);
m_ui.terminalChooser->setPromptDialogTitle(tr("Choose Location of Terminal Application"));
theDebuggerAction(GdbLocation)
->connectWidget(m_ui.gdbLocationChooser);
......@@ -275,6 +277,8 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
->connectWidget(m_ui.scriptFileChooser);
theDebuggerAction(GdbEnvironment)
->connectWidget(m_ui.environmentEdit);
theDebuggerAction(Terminal)
->connectWidget(m_ui.terminalChooser);
theDebuggerAction(AllPluginBreakpoints)
->connectWidget(m_ui.radioButtonAllPluginBreakpoints);
......@@ -328,6 +332,7 @@ void GdbOptionPage::apply()
theDebuggerAction(GdbLocation)->apply(s);
theDebuggerAction(GdbScriptFile)->apply(s);
theDebuggerAction(GdbEnvironment)->apply(s);
theDebuggerAction(Terminal)->apply(s);
theDebuggerAction(AllPluginBreakpoints)->apply(s);
theDebuggerAction(SelectedPluginBreakpoints)->apply(s);
......
......@@ -32,10 +32,21 @@
<item row="0" column="0">
<widget class="QLabel" name="labelGdbLocation">
<property name="toolTip">
<string>This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that wiull be searched in your PATH.</string>
<string>This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that will be searched in your PATH.</string>
</property>
<property name="text">
<string>Gdb Location:</string>
<string>Gdb location:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="terminalLocation">
<property name="toolTip">
<string>This is either a full abolute path leading to the terminal
you indent to use or the name of a terminal that will be searched in your PATH.</string>
</property>
<property name="text">
<string>Terminal:</string>
</property>
</widget>
</item>
......@@ -55,7 +66,7 @@
<string>This is either empty or points to a file containing gdb commands that will be executed immediately after gdb starts up.</string>
</property>
<property name="text">
<string>Gdb Startup Script:</string>
<string>Gdb startup script:</string>
</property>
</widget>
</item>
......@@ -65,6 +76,9 @@
<item row="0" column="1">
<widget class="Core::Utils::PathChooser" name="gdbLocationChooser" native="true"/>
</item>
<item row="3" column="1">
<widget class="Core::Utils::PathChooser" name="terminalChooser" native="true"/>
</item>
</layout>
</widget>
</item>
......
......@@ -250,6 +250,8 @@ private:
int cursorColumnInDocument() const;
int linesInDocument() const;
void scrollToLineInDocument(int line);
void scrollUp(int count);
void scrollDown(int count) { scrollUp(-count); }
// helper functions for indenting
bool isElectricCharacter(QChar c) const
......@@ -378,6 +380,7 @@ public:
// marks as lines
QHash<int, int> m_marks;
QString m_oldNeedle;
// vi style configuration
QHash<QString, QString> m_config;
......@@ -531,7 +534,7 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
moveLeft();
EDITOR(setTextCursor(m_tc));
EDITOR(ensureCursorVisible());
//EDITOR(ensureCursorVisible());
return result;
}
......@@ -856,21 +859,21 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
if (key == Key_Return || key == 't') { // cursor line to top of window
if (!m_mvcount.isEmpty())
setPosition(firstPositionInLine(count()));
scrollToLineInDocument(cursorLineInDocument());
scrollUp(- cursorLineOnScreen());
if (key == Key_Return)
moveToFirstNonBlankOnLine();
finishMovement();
} else if (key == '.' || key == 'z') { // cursor line to center of window
if (!m_mvcount.isEmpty())
setPosition(firstPositionInLine(count()));
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
scrollUp(linesOnScreen() / 2 - cursorLineOnScreen());
if (key == '.')
moveToFirstNonBlankOnLine();
finishMovement();
} else if (key == '-' || key == 'b') { // cursor line to bottom of window
if (!m_mvcount.isEmpty())
setPosition(firstPositionInLine(count()));
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() - 1);
scrollUp(linesOnScreen() - cursorLineOnScreen());
if (key == '-')
moveToFirstNonBlankOnLine();
finishMovement();
......@@ -1110,6 +1113,12 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_moveType = MoveInclusive;
moveToWordBoundary(true, true);
finishMovement();
} else if (key == control('e')) {
// FIXME: this should use the "scroll" option, and "count"
if (cursorLineOnScreen() == 0)
moveDown(1);
scrollDown(1);
finishMovement();
} else if (key == 'f') {
m_subsubmode = FtSubSubMode;
m_moveType = MoveInclusive;
......@@ -1857,51 +1866,56 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward)
if (oldLine != cursorLineInDocument() - cursorLineOnScreen())
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
highlightMatches(needle);
return;
}
m_tc.setPosition(forward ? 0 : lastPositionInDocument() - 1);
EDITOR(setTextCursor(m_tc));
if (EDITOR(find(needle, flags))) {
m_tc = EDITOR(textCursor());
m_tc.setPosition(m_tc.anchor());
if (oldLine != cursorLineInDocument() - cursorLineOnScreen())
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
if (forward)
showRedMessage("search hit BOTTOM, continuing at TOP");
else
showRedMessage("search hit TOP, continuing at BOTTOM");
highlightMatches(needle);
return;
} else {
m_tc.setPosition(forward ? 0 : lastPositionInDocument() - 1);
EDITOR(setTextCursor(m_tc));
if (EDITOR(find(needle, flags))) {
m_tc = EDITOR(textCursor());
m_tc.setPosition(m_tc.anchor());
if (oldLine != cursorLineInDocument() - cursorLineOnScreen())
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
if (forward)
showRedMessage("search hit BOTTOM, continuing at TOP");
else
showRedMessage("search hit TOP, continuing at BOTTOM");
highlightMatches(needle);
} else {
m_tc = orig;
showRedMessage("E486: Pattern not found: " + needle);
highlightMatches(QString());
}
}
m_tc = orig;
}
void FakeVimHandler::Private::highlightMatches(const QString &needle0)
{
if (m_config[ConfigHlSearch] == ConfigOff)
if (!hasConfig(ConfigHlSearch))
return;
if (needle0 == m_oldNeedle)
return;
m_oldNeedle = needle0;
m_searchSelections.clear();
QTextCursor tc = m_tc;
tc.movePosition(QTextCursor::Start, MoveAnchor);
if (!needle0.isEmpty()) {
QTextCursor tc = m_tc;
tc.movePosition(QTextCursor::Start, MoveAnchor);
QTextDocument::FindFlags flags = QTextDocument::FindCaseSensitively;
QString needle = needle0;
vimPatternToQtPattern(&needle, &flags);
QTextDocument::FindFlags flags = QTextDocument::FindCaseSensitively;
QString needle = needle0;
vimPatternToQtPattern(&needle, &flags);
m_searchSelections.clear();
EDITOR(setTextCursor(tc));
while (EDITOR(find(needle, flags))) {
tc = EDITOR(textCursor());
QTextEdit::ExtraSelection sel;
sel.cursor = tc;
sel.format = tc.blockCharFormat();
sel.format.setBackground(QColor(177, 177, 0));
m_searchSelections.append(sel);
tc.movePosition(Right, MoveAnchor);
EDITOR(setTextCursor(tc));
while (EDITOR(find(needle, flags))) {
tc = EDITOR(textCursor());
QTextEdit::ExtraSelection sel;
sel.cursor = tc;
sel.format = tc.blockCharFormat();
sel.format.setBackground(QColor(177, 177, 0));
m_searchSelections.append(sel);
tc.movePosition(Right, MoveAnchor);
EDITOR(setTextCursor(tc));
}
}
updateSelection();
}
......@@ -2154,9 +2168,15 @@ void FakeVimHandler::Private::scrollToLineInDocument(int line)
{
// FIXME: works only for QPlainTextEdit
QScrollBar *scrollBar = EDITOR(verticalScrollBar());
//qDebug() << "SCROLL: " << scrollBar->value() << line;
scrollBar->setValue(line);
}
void FakeVimHandler::Private::scrollUp(int count)
{
scrollToLineInDocument(cursorLineInDocument() - cursorLineOnScreen() - count);
}
int FakeVimHandler::Private::lastPositionInDocument() const
{
QTextBlock block = m_tc.block().document()->lastBlock();
......
......@@ -142,7 +142,8 @@ GitPlugin::GitPlugin() :
m_coreListener(0),
m_submitEditorFactory(0),
m_versionControl(0),
m_changeTmpFile(0)
m_changeTmpFile(0),
m_submitActionTriggered(false)
{
m_instance = this;
}
......@@ -651,6 +652,7 @@ Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const Commit
void GitPlugin::submitCurrentLog()
{
// Close the submit editor
m_submitActionTriggered = true;
QList<Core::IEditor*> editors;
editors.push_back(m_core->editorManager()->currentEditor());
m_core->editorManager()->closeEditors(editors);
......@@ -672,11 +674,14 @@ bool GitPlugin::editorAboutToClose(Core::IEditor *iEditor)
// Paranoia!
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
return true;
// Prompt user.
// Prompt user. Force a prompt unless submit was actually invoked (that
// is, the editor was closed or shutdown).
const VCSBase::VCSBaseSubmitEditor::PromptSubmitResult answer =
editor->promptSubmit(tr("Closing git editor"),
tr("Do you want to commit the change?"),
tr("The commit message check failed. Do you want to commit the change?"));
tr("The commit message check failed. Do you want to commit the change?"),
!m_submitActionTriggered);
m_submitActionTriggered = false;
switch (answer) {
case VCSBase::VCSBaseSubmitEditor::SubmitCanceled:
return false; // Keep editing and change file
......
......@@ -171,6 +171,7 @@ private:
QString m_submitRepository;
QStringList m_submitOrigCommitFiles;
QTemporaryFile *m_changeTmpFile;
bool m_submitActionTriggered;
};
} // namespace Git
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>201</width>
<height>189</height>
<width>374</width>
<height>229</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -59,26 +59,43 @@
<property name="title">
<string>Commit Information</string>
</property>
<layout class="QFormLayout" name="editFormLayout">
<item row="0" column="0">
<widget class="QLabel" name="authorLabel">
<property name="text">
<string>Author:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="authorLineEdit"/>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="authorLabel">
<property name="text">
<string>Author:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="authorLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="emailLabel">
<property name="text">
<string>Email:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="emailLineEdit"/>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="emailLabel">
<property name="text">
<string>Email:</string>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="emailLineEdit"/>
<property name="sizeHint" stdset="0">
<size>
<width>161</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
......
......@@ -175,13 +175,18 @@ PerforcePlugin::PerforcePlugin() :
m_diffProjectAction(0),
m_diffAllAction(0),
m_resolveAction(0),
m_submitAction(0),
m_submitAction(0),
m_pendingAction(0),
m_describeAction(0),
m_annotateCurrentAction(0),
m_annotateAction(0),
m_filelogCurrentAction(0),
m_filelogAction(0),
m_submitCurrentLogAction(0),
m_submitActionTriggered(false),
m_diffSelectedFiles(0),
m_undoAction(0),
m_redoAction(0),
m_changeTmpFile(0),
#ifdef USE_P4_API
m_workbenchClientUser(0),
......@@ -949,6 +954,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
void PerforcePlugin::submitCurrentLog()
{
m_submitActionTriggered = true;
Core::EditorManager *em = Core::EditorManager::instance();
em->closeEditors(QList<Core::IEditor*>() << em->currentEditor());
}
......@@ -966,11 +972,15 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
return true;
QFileInfo editorFile(fileIFace->fileName());
QFileInfo changeFile(m_changeTmpFile->fileName());
if (editorFile.absoluteFilePath() == changeFile.absoluteFilePath()) {
if (editorFile.absoluteFilePath() == changeFile.absoluteFilePath()) {
// Prompt the user. Force a prompt unless submit was actually invoked (that
// is, the editor was closed or shutdown).
const VCSBase::VCSBaseSubmitEditor::PromptSubmitResult answer =
perforceEditor->promptSubmit(tr("Closing p4 Editor"),
tr("Do you want to submit this change list?"),
tr("The commit message check failed. Do you want to submit this change list"));
tr("The commit message check failed. Do you want to submit this change list"),
!m_submitActionTriggered);
m_submitActionTriggered = false;
if (answer == VCSBase::VCSBaseSubmitEditor::SubmitCanceled)
return false;
......@@ -1010,10 +1020,10 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
m_changeTmpFile = 0;
return false;
}
QString output = QString::fromUtf8(proc.readAll());
const QString output = QString::fromUtf8(proc.readAll());
showOutput(output);
if (output.contains("Out of date files must be resolved or reverted"), true) {
QMessageBox::warning(editor->widget(), "Pending change", "Could not submit the change, because your workspace was out of date. Created a pending submit instead.");
if (output.contains(QLatin1String("Out of date files must be resolved or reverted)"))) {
QMessageBox::warning(editor->widget(), tr("Pending change"), tr("Could not submit the change, because your workspace was out of date. Created a pending submit instead."));
}
QApplication::restoreOverrideCursor();
}
......
......@@ -190,6 +190,7 @@ private:
QAction *m_filelogCurrentAction;
QAction *m_filelogAction;
QAction *m_submitCurrentLogAction;
bool m_submitActionTriggered;
QAction *m_diffSelectedFiles;
QAction *m_undoAction;
......@@ -232,7 +233,7 @@ private:
PerforceVersionControl *m_versionControl;
PerforceSettings m_settings;
friend class PerforceOutputWindow;
friend class PerforceOutputWindow; // needs openFiles()
};
} // namespace Perforce
......
......@@ -188,7 +188,8 @@ SubversionPlugin::SubversionPlugin() :
m_submitCurrentLogAction(0),
m_submitDiffAction(0),
m_submitUndoAction(0),
m_submitRedoAction(0)
m_submitRedoAction(0),
m_submitActionTriggered(false)
{
}
......@@ -463,11 +464,14 @@ bool SubversionPlugin::editorAboutToClose(Core::IEditor *iEditor)
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
return true; // Oops?!
// Prompt user.
// Prompt user. Force a prompt unless submit was actually invoked (that
// is, the editor was closed or shutdown).
const VCSBase::VCSBaseSubmitEditor::PromptSubmitResult answer =
editor->promptSubmit(tr("Closing Subversion Editor"),
tr("Do you want to commit the change?"),
tr("The commit message check failed. Do you want to commit the change?"));
tr("The commit message check failed. Do you want to commit the change?"),
!m_submitActionTriggered);
m_submitActionTriggered = false;
switch (answer) {
case VCSBase::VCSBaseSubmitEditor::SubmitCanceled:
return false; // Keep editing and change file
......@@ -922,6 +926,7 @@ void SubversionPlugin::slotDescribe()
void SubversionPlugin::submitCurrentLog()
{
m_submitActionTriggered = true;
Core::EditorManager::instance()->closeEditors(QList<Core::IEditor*>()
<< Core::EditorManager::instance()->currentEditor());
}
......
......@@ -168,6 +168,7 @@ private:
QAction *m_submitDiffAction;
QAction *m_submitUndoAction;
QAction *m_submitRedoAction;
bool m_submitActionTriggered;
static const char * const SUBVERSION_MENU;
static const char * const ADD;
......
......@@ -28,6 +28,7 @@
**************************************************************************/
#include "nicknamedialog.h"
#include "vcsbaseplugin.h"
#include "ui_nicknamedialog.h"
#include <QtCore/QDebug>
......@@ -36,13 +37,19 @@
#include <QtGui/QStandardItemModel>
#include <QtGui/QSortFilterProxyModel>
enum { NickNameRole = Qt::UserRole + 1 };
namespace VCSBase {
namespace Internal {
struct NickEntry {
// For code clarity, a struct representing the entries of a mail map file
// with parse and model functions.
struct NickNameEntry {
void clear();
bool parse(const QString &);
QString nickName() const;
QList<QStandardItem *> toModelRow() const;
static QString nickNameOf(const QStandardItem *item);
QString name;
QString email;
......@@ -50,7 +57,7 @@ struct NickEntry {
QString aliasEmail;
};
void NickEntry::clear()
void NickNameEntry::clear()
{