forked from qt-creator/qt-creator
CorePlugin: Compile with QT_NO_CAST_FROM_ASCII.
- Wrap literals in QLatin1String()/QLatin1Char(). - Extract some string constants avoiding repeated QString construction. - Fix repeated invocation of Container.end() in loops. Change-Id: If737735507aaf82e53063adda53f54c46418f42f Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -405,7 +405,11 @@ bool MenuActionContainer::updateInternal()
|
|||||||
if (ActionContainerPrivate *container = qobject_cast<ActionContainerPrivate*>(item)) {
|
if (ActionContainerPrivate *container = qobject_cast<ActionContainerPrivate*>(item)) {
|
||||||
actions.removeAll(container->menu()->menuAction());
|
actions.removeAll(container->menu()->menuAction());
|
||||||
if (container == this) {
|
if (container == this) {
|
||||||
qWarning() << Q_FUNC_INFO << "container" << (this->menu() ? this->menu()->title() : "") << "contains itself as subcontainer";
|
QByteArray warning = Q_FUNC_INFO + QByteArray(" container '");
|
||||||
|
if (this->menu())
|
||||||
|
warning += this->menu()->title().toLocal8Bit();
|
||||||
|
warning += "' contains itself as subcontainer";
|
||||||
|
qWarning("%s", warning.constData());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (container->updateInternal()) {
|
if (container->updateInternal()) {
|
||||||
|
@@ -311,7 +311,7 @@ ActionContainer *ActionManagerPrivate::createMenu(const Id &id)
|
|||||||
return it.value();
|
return it.value();
|
||||||
|
|
||||||
QMenu *m = new QMenu(m_mainWnd);
|
QMenu *m = new QMenu(m_mainWnd);
|
||||||
m->setObjectName(id.name());
|
m->setObjectName(QLatin1String(id.name()));
|
||||||
|
|
||||||
MenuActionContainer *mc = new MenuActionContainer(id);
|
MenuActionContainer *mc = new MenuActionContainer(id);
|
||||||
mc->setMenu(m);
|
mc->setMenu(m);
|
||||||
|
@@ -151,7 +151,7 @@ void CommandMappings::finish()
|
|||||||
void CommandMappings::commandChanged(QTreeWidgetItem *current)
|
void CommandMappings::commandChanged(QTreeWidgetItem *current)
|
||||||
{
|
{
|
||||||
if (!current || !current->data(0, Qt::UserRole).isValid()) {
|
if (!current || !current->data(0, Qt::UserRole).isValid()) {
|
||||||
m_page->targetEdit->setText("");
|
m_page->targetEdit->setText(QString());
|
||||||
m_page->targetEditGroup->setEnabled(false);
|
m_page->targetEditGroup->setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -182,7 +182,7 @@ QString CoreImpl::userResourcePath() const
|
|||||||
{
|
{
|
||||||
// Create qtcreator dir if it doesn't yet exist
|
// Create qtcreator dir if it doesn't yet exist
|
||||||
const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
|
const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
|
||||||
const QString urp = configDir + "/qtcreator";
|
const QString urp = configDir + QLatin1String("/qtcreator");
|
||||||
|
|
||||||
QFileInfo fi(urp + QLatin1Char('/'));
|
QFileInfo fi(urp + QLatin1Char('/'));
|
||||||
if (!fi.exists()) {
|
if (!fi.exists()) {
|
||||||
|
@@ -130,8 +130,8 @@ DesignMode::DesignMode()
|
|||||||
setDisplayName(tr("Design"));
|
setDisplayName(tr("Design"));
|
||||||
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Design.png")));
|
setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Design.png")));
|
||||||
setPriority(Constants::P_MODE_DESIGN);
|
setPriority(Constants::P_MODE_DESIGN);
|
||||||
setId(Constants::MODE_DESIGN);
|
setId(QLatin1String(Constants::MODE_DESIGN));
|
||||||
setType(Constants::MODE_DESIGN_TYPE);
|
setType(QLatin1String(Constants::MODE_DESIGN_TYPE));
|
||||||
|
|
||||||
ExtensionSystem::PluginManager::instance()->addObject(d->m_coreListener);
|
ExtensionSystem::PluginManager::instance()->addObject(d->m_coreListener);
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
|
|||||||
if (!mimeEditorAvailable) {
|
if (!mimeEditorAvailable) {
|
||||||
setActiveContext(Context());
|
setActiveContext(Context());
|
||||||
if (ModeManager::instance()->currentMode() == this)
|
if (ModeManager::instance()->currentMode() == this)
|
||||||
ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT);
|
ModeManager::instance()->activateMode(QLatin1String(Core::Constants::MODE_EDIT));
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
d->m_currentEditor = QWeakPointer<Core::IEditor>();
|
d->m_currentEditor = QWeakPointer<Core::IEditor>();
|
||||||
emit actionsUpdated(d->m_currentEditor.data());
|
emit actionsUpdated(d->m_currentEditor.data());
|
||||||
|
@@ -339,12 +339,14 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
|
|||||||
tool->setDisplayCategory(category);
|
tool->setDisplayCategory(category);
|
||||||
tool->setDisplayName(tr("New Tool"));
|
tool->setDisplayName(tr("New Tool"));
|
||||||
tool->setDescription(tr("This tool prints a line of useful text"));
|
tool->setDescription(tr("This tool prints a line of useful text"));
|
||||||
|
//: Sample external tool text
|
||||||
|
const QString text = tr("Useful text");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
tool->setExecutables(QStringList() << "cmd");
|
tool->setExecutables(QStringList(QLatin1String("cmd")));
|
||||||
tool->setArguments(tr("/c echo Useful text"));
|
tool->setArguments(QLatin1String("/c echo ") + text);
|
||||||
#else
|
#else
|
||||||
tool->setExecutables(QStringList() << "echo");
|
tool->setExecutables(QStringList(QLatin1String("echo")));
|
||||||
tool->setArguments(tr("Useful text"));
|
tool->setArguments(text);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int pos;
|
int pos;
|
||||||
@@ -463,8 +465,8 @@ void ExternalToolConfig::setTools(const QMap<QString, QList<ExternalTool *> > &t
|
|||||||
itemCopy.append(new ExternalTool(tool));
|
itemCopy.append(new ExternalTool(tool));
|
||||||
toolsCopy.insert(it.key(), itemCopy);
|
toolsCopy.insert(it.key(), itemCopy);
|
||||||
}
|
}
|
||||||
if (!toolsCopy.contains(QString("")))
|
if (!toolsCopy.contains(QString()))
|
||||||
toolsCopy.insert(QString(""), QList<ExternalTool *>());
|
toolsCopy.insert(QString(), QList<ExternalTool *>());
|
||||||
m_model->setTools(toolsCopy);
|
m_model->setTools(toolsCopy);
|
||||||
ui->toolTree->expandAll();
|
ui->toolTree->expandAll();
|
||||||
}
|
}
|
||||||
|
@@ -219,7 +219,7 @@ void ShortcutSettings::removeTargetIdentifier()
|
|||||||
void ShortcutSettings::importAction()
|
void ShortcutSettings::importAction()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(0, tr("Import Keyboard Mapping Scheme"),
|
QString fileName = QFileDialog::getOpenFileName(0, tr("Import Keyboard Mapping Scheme"),
|
||||||
ICore::instance()->resourcePath() + "/schemes/",
|
ICore::instance()->resourcePath() + QLatin1String("/schemes/"),
|
||||||
tr("Keyboard Mapping Scheme (*.kms)"));
|
tr("Keyboard Mapping Scheme (*.kms)"));
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ void ShortcutSettings::exportAction()
|
|||||||
{
|
{
|
||||||
QString fileName = FileManager::instance()->getSaveFileNameWithExtension(
|
QString fileName = FileManager::instance()->getSaveFileNameWithExtension(
|
||||||
tr("Export Keyboard Mapping Scheme"),
|
tr("Export Keyboard Mapping Scheme"),
|
||||||
ICore::instance()->resourcePath() + "/schemes/",
|
ICore::instance()->resourcePath() + QLatin1String("/schemes/"),
|
||||||
tr("Keyboard Mapping Scheme (*.kms)"));
|
tr("Keyboard Mapping Scheme (*.kms)"));
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
CommandsFile cf(fileName);
|
CommandsFile cf(fileName);
|
||||||
@@ -325,7 +325,7 @@ void ShortcutSettings::initialize()
|
|||||||
|
|
||||||
if (c->action()) {
|
if (c->action()) {
|
||||||
QString text = c->hasAttribute(Command::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text();
|
QString text = c->hasAttribute(Command::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text();
|
||||||
text.remove(QRegExp("&(?!&)"));
|
text.remove(QRegExp(QLatin1String("&(?!&)")));
|
||||||
s->m_key = c->action()->shortcut();
|
s->m_key = c->action()->shortcut();
|
||||||
item->setText(1, text);
|
item->setText(1, text);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1270,10 +1270,10 @@ int extractLineNumber(QString *fileName)
|
|||||||
}
|
}
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
return -1;
|
return -1;
|
||||||
if (fileName->at(i) == ':' || fileName->at(i) == '+') {
|
const QChar c = fileName->at(i);
|
||||||
int result = fileName->mid(i+1).toInt();
|
if (c == QLatin1Char(':') || c == QLatin1Char('+')) {
|
||||||
if (result) {
|
if (const int result = fileName->mid(i + 1).toInt()) {
|
||||||
*fileName = fileName->left(i);
|
fileName->truncate(i);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1386,7 +1386,7 @@ void EditorManager::switchToPreferedMode()
|
|||||||
preferedMode = d->m_currentEditor->preferredModeType();
|
preferedMode = d->m_currentEditor->preferredModeType();
|
||||||
|
|
||||||
if (preferedMode.isEmpty())
|
if (preferedMode.isEmpty())
|
||||||
preferedMode = Constants::MODE_EDIT_TYPE;
|
preferedMode = QLatin1String(Constants::MODE_EDIT_TYPE);
|
||||||
|
|
||||||
ModeManager::instance()->activateModeType(preferedMode);
|
ModeManager::instance()->activateModeType(preferedMode);
|
||||||
}
|
}
|
||||||
@@ -1672,14 +1672,15 @@ void EditorManager::vcsOpenCurrentEditor()
|
|||||||
void EditorManager::updateWindowTitle()
|
void EditorManager::updateWindowTitle()
|
||||||
{
|
{
|
||||||
QString windowTitle = tr("Qt Creator");
|
QString windowTitle = tr("Qt Creator");
|
||||||
|
const QString dashSep = QLatin1String(" - ");
|
||||||
if (!d->m_titleAddition.isEmpty()) {
|
if (!d->m_titleAddition.isEmpty()) {
|
||||||
windowTitle.prepend(d->m_titleAddition + " - ");
|
windowTitle.prepend(d->m_titleAddition + dashSep);
|
||||||
}
|
}
|
||||||
IEditor *curEditor = currentEditor();
|
IEditor *curEditor = currentEditor();
|
||||||
if (curEditor) {
|
if (curEditor) {
|
||||||
QString editorName = curEditor->displayName();
|
QString editorName = curEditor->displayName();
|
||||||
if (!editorName.isEmpty())
|
if (!editorName.isEmpty())
|
||||||
windowTitle.prepend(editorName + " - ");
|
windowTitle.prepend(editorName + dashSep);
|
||||||
QString filePath = QFileInfo(curEditor->file()->fileName()).absoluteFilePath();
|
QString filePath = QFileInfo(curEditor->file()->fileName()).absoluteFilePath();
|
||||||
if (!filePath.isEmpty())
|
if (!filePath.isEmpty())
|
||||||
d->m_core->mainWindow()->setWindowFilePath(filePath);
|
d->m_core->mainWindow()->setWindowFilePath(filePath);
|
||||||
@@ -1771,7 +1772,7 @@ void EditorManager::updateActions()
|
|||||||
|
|
||||||
QString quotedName;
|
QString quotedName;
|
||||||
if (!fName.isEmpty())
|
if (!fName.isEmpty())
|
||||||
quotedName = '"' + fName + '"';
|
quotedName = QLatin1Char('"') + fName + QLatin1Char('"');
|
||||||
|
|
||||||
d->m_saveAsAction->setText(tr("Save %1 &As...").arg(quotedName));
|
d->m_saveAsAction->setText(tr("Save %1 &As...").arg(quotedName));
|
||||||
d->m_saveAction->setText(tr("&Save %1").arg(quotedName));
|
d->m_saveAction->setText(tr("&Save %1").arg(quotedName));
|
||||||
|
@@ -100,7 +100,7 @@ OpenEditorsWidget::OpenEditorsWidget()
|
|||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
setWindowTitle(tr("Open Documents"));
|
setWindowTitle(tr("Open Documents"));
|
||||||
setWindowIcon(QIcon(Constants::ICON_DIR));
|
setWindowIcon(QIcon(QLatin1String(Constants::ICON_DIR)));
|
||||||
setFocusProxy(m_ui.editorList);
|
setFocusProxy(m_ui.editorList);
|
||||||
m_ui.editorList->viewport()->setAttribute(Qt::WA_Hover);
|
m_ui.editorList->viewport()->setAttribute(Qt::WA_Hover);
|
||||||
m_ui.editorList->setItemDelegate((m_delegate = new OpenEditorsDelegate(this)));
|
m_ui.editorList->setItemDelegate((m_delegate = new OpenEditorsDelegate(this)));
|
||||||
|
@@ -823,9 +823,10 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
|
|||||||
}
|
}
|
||||||
qDeleteAll(m_tools);
|
qDeleteAll(m_tools);
|
||||||
QMapIterator<QString, QAction *> remainingActions(m_actions);
|
QMapIterator<QString, QAction *> remainingActions(m_actions);
|
||||||
|
const QString externalToolsPrefix = QLatin1String("Tools.External.");
|
||||||
while (remainingActions.hasNext()) {
|
while (remainingActions.hasNext()) {
|
||||||
remainingActions.next();
|
remainingActions.next();
|
||||||
am->unregisterAction(remainingActions.value(), Id("Tools.External." + remainingActions.key()));
|
am->unregisterAction(remainingActions.value(), Id(externalToolsPrefix + remainingActions.key()));
|
||||||
delete remainingActions.value();
|
delete remainingActions.value();
|
||||||
}
|
}
|
||||||
m_actions.clear();
|
m_actions.clear();
|
||||||
@@ -847,7 +848,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
|
|||||||
if (m_containers.contains(containerName)) {
|
if (m_containers.contains(containerName)) {
|
||||||
container = m_containers.take(containerName); // remove to avoid deletion below
|
container = m_containers.take(containerName); // remove to avoid deletion below
|
||||||
} else {
|
} else {
|
||||||
container = am->createMenu(Id("Tools.External.Category." + containerName));
|
container = am->createMenu(Id(QLatin1String("Tools.External.Category.") + containerName));
|
||||||
}
|
}
|
||||||
newContainers.insert(containerName, container);
|
newContainers.insert(containerName, container);
|
||||||
mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE);
|
mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE);
|
||||||
@@ -860,13 +861,13 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
|
|||||||
Command *command = 0;
|
Command *command = 0;
|
||||||
if (m_actions.contains(toolId)) {
|
if (m_actions.contains(toolId)) {
|
||||||
action = m_actions.value(toolId);
|
action = m_actions.value(toolId);
|
||||||
command = am->command(Id("Tools.External." + toolId));
|
command = am->command(Id(externalToolsPrefix + toolId));
|
||||||
} else {
|
} else {
|
||||||
action = new QAction(tool->displayName(), this);
|
action = new QAction(tool->displayName(), this);
|
||||||
action->setData(toolId);
|
action->setData(toolId);
|
||||||
m_actions.insert(toolId, action);
|
m_actions.insert(toolId, action);
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(menuActivated()));
|
connect(action, SIGNAL(triggered()), this, SLOT(menuActivated()));
|
||||||
command = am->registerAction(action, Id("Tools.External." + toolId), Context(Constants::C_GLOBAL));
|
command = am->registerAction(action, Id(externalToolsPrefix + toolId), Context(Constants::C_GLOBAL));
|
||||||
command->setAttribute(Command::CA_UpdateText);
|
command->setAttribute(Command::CA_UpdateText);
|
||||||
}
|
}
|
||||||
action->setText(tool->displayName());
|
action->setText(tool->displayName());
|
||||||
|
@@ -682,11 +682,11 @@ QString FileManager::getSaveFileName(const QString &title, const QString &pathIn
|
|||||||
if (selectedFilter && *selectedFilter != QCoreApplication::translate(
|
if (selectedFilter && *selectedFilter != QCoreApplication::translate(
|
||||||
"Core", Constants::ALL_FILES_FILTER)) {
|
"Core", Constants::ALL_FILES_FILTER)) {
|
||||||
// Mime database creates filter strings like this: Anything here (*.foo *.bar)
|
// Mime database creates filter strings like this: Anything here (*.foo *.bar)
|
||||||
QRegExp regExp(".*\\s+\\((.*)\\)$");
|
QRegExp regExp(QLatin1String(".*\\s+\\((.*)\\)$"));
|
||||||
const int index = regExp.lastIndexIn(*selectedFilter);
|
const int index = regExp.lastIndexIn(*selectedFilter);
|
||||||
bool suffixOk = false;
|
bool suffixOk = false;
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
const QStringList &suffixes = regExp.cap(1).remove('*').split(' ');
|
const QStringList &suffixes = regExp.cap(1).remove(QLatin1Char('*')).split(QLatin1Char(' '));
|
||||||
foreach (const QString &suffix, suffixes)
|
foreach (const QString &suffix, suffixes)
|
||||||
if (fileName.endsWith(suffix)) {
|
if (fileName.endsWith(suffix)) {
|
||||||
suffixOk = true;
|
suffixOk = true;
|
||||||
|
@@ -90,7 +90,8 @@ static bool hasQmFilesForLocale(const QString &locale, const QString &creatorTrP
|
|||||||
static const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
static const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||||
|
|
||||||
const QString trFile = QLatin1String("qt_") + locale + QLatin1String(".qm");
|
const QString trFile = QLatin1String("qt_") + locale + QLatin1String(".qm");
|
||||||
return QFile::exists(qtTrPath+'/'+trFile) || QFile::exists(creatorTrPath+'/'+trFile);
|
return QFile::exists(qtTrPath + QLatin1Char('/') + trFile)
|
||||||
|
|| QFile::exists(creatorTrPath + QLatin1Char('/') + trFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettings::fillLanguageBox() const
|
void GeneralSettings::fillLanguageBox() const
|
||||||
|
@@ -447,7 +447,7 @@ QStringList HelpManagerPrivate::documentationFromInstaller()
|
|||||||
documentationFiles << pathInfo.absoluteFilePath();
|
documentationFiles << pathInfo.absoluteFilePath();
|
||||||
} else if (pathInfo.isDir()) {
|
} else if (pathInfo.isDir()) {
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
foreach (const QFileInfo &fileInfo, dir.entryInfoList(QStringList() << "*.qch",
|
foreach (const QFileInfo &fileInfo, dir.entryInfoList(QStringList(QLatin1String("*.qch")),
|
||||||
QDir::Files | QDir::Readable)) {
|
QDir::Files | QDir::Readable)) {
|
||||||
documentationFiles << fileInfo.absoluteFilePath();
|
documentationFiles << fileInfo.absoluteFilePath();
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,7 @@ QString Id::toString() const
|
|||||||
|
|
||||||
Context::Context(const char *id, int offset)
|
Context::Context(const char *id, int offset)
|
||||||
{
|
{
|
||||||
d.append(Id(QString(id) + QString::number(offset)).uniqueIdentifier());
|
d.append(Id(QLatin1String(id) + QString::number(offset)).uniqueIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::add(const char *id)
|
void Context::add(const char *id)
|
||||||
|
@@ -560,7 +560,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
mfile->addAction(cmd, Constants::G_FILE_SAVE);
|
mfile->addAction(cmd, Constants::G_FILE_SAVE);
|
||||||
|
|
||||||
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Print"), globalContext);
|
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Print"), globalContext);
|
||||||
QIcon icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(Constants::ICON_CUT));
|
QIcon icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT)));
|
||||||
mfile->addAction(cmd, Constants::G_FILE_PRINT);
|
mfile->addAction(cmd, Constants::G_FILE_PRINT);
|
||||||
|
|
||||||
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Close"), globalContext);
|
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Close"), globalContext);
|
||||||
@@ -590,7 +590,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
connect(m_focusToEditor, SIGNAL(activated()), this, SLOT(setFocusToEditor()));
|
connect(m_focusToEditor, SIGNAL(activated()), this, SLOT(setFocusToEditor()));
|
||||||
|
|
||||||
// New File Action
|
// New File Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(Constants::ICON_NEWFILE));
|
icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(Constants::ICON_NEWFILE)));
|
||||||
m_newAction = new QAction(icon, tr("&New File or Project..."), this);
|
m_newAction = new QAction(icon, tr("&New File or Project..."), this);
|
||||||
cmd = am->registerAction(m_newAction, Constants::NEW, globalContext);
|
cmd = am->registerAction(m_newAction, Constants::NEW, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::New);
|
cmd->setDefaultKeySequence(QKeySequence::New);
|
||||||
@@ -598,7 +598,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
|
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
|
||||||
|
|
||||||
// Open Action
|
// Open Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(Constants::ICON_OPENFILE));
|
icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(QLatin1String(Constants::ICON_OPENFILE)));
|
||||||
m_openAction = new QAction(icon, tr("&Open File or Project..."), this);
|
m_openAction = new QAction(icon, tr("&Open File or Project..."), this);
|
||||||
cmd = am->registerAction(m_openAction, Constants::OPEN, globalContext);
|
cmd = am->registerAction(m_openAction, Constants::OPEN, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Open);
|
cmd->setDefaultKeySequence(QKeySequence::Open);
|
||||||
@@ -618,7 +618,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
ac->setOnAllDisabledBehavior(ActionContainer::Show);
|
ac->setOnAllDisabledBehavior(ActionContainer::Show);
|
||||||
|
|
||||||
// Save Action
|
// Save Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(Constants::ICON_SAVEFILE));
|
icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(QLatin1String(Constants::ICON_SAVEFILE)));
|
||||||
QAction *tmpaction = new QAction(icon, tr("&Save"), this);
|
QAction *tmpaction = new QAction(icon, tr("&Save"), this);
|
||||||
tmpaction->setEnabled(false);
|
tmpaction->setEnabled(false);
|
||||||
cmd = am->registerAction(tmpaction, Constants::SAVE, globalContext);
|
cmd = am->registerAction(tmpaction, Constants::SAVE, globalContext);
|
||||||
@@ -665,7 +665,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
|
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
|
||||||
|
|
||||||
// Undo Action
|
// Undo Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("edit-undo"), QIcon(Constants::ICON_UNDO));
|
icon = QIcon::fromTheme(QLatin1String("edit-undo"), QIcon(QLatin1String(Constants::ICON_UNDO)));
|
||||||
tmpaction = new QAction(icon, tr("&Undo"), this);
|
tmpaction = new QAction(icon, tr("&Undo"), this);
|
||||||
cmd = am->registerAction(tmpaction, Constants::UNDO, globalContext);
|
cmd = am->registerAction(tmpaction, Constants::UNDO, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Undo);
|
cmd->setDefaultKeySequence(QKeySequence::Undo);
|
||||||
@@ -675,7 +675,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
tmpaction->setEnabled(false);
|
tmpaction->setEnabled(false);
|
||||||
|
|
||||||
// Redo Action
|
// Redo Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("edit-redo"), QIcon(Constants::ICON_REDO));
|
icon = QIcon::fromTheme(QLatin1String("edit-redo"), QIcon(QLatin1String(Constants::ICON_REDO)));
|
||||||
tmpaction = new QAction(icon, tr("&Redo"), this);
|
tmpaction = new QAction(icon, tr("&Redo"), this);
|
||||||
cmd = am->registerAction(tmpaction, Constants::REDO, globalContext);
|
cmd = am->registerAction(tmpaction, Constants::REDO, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Redo);
|
cmd->setDefaultKeySequence(QKeySequence::Redo);
|
||||||
@@ -685,7 +685,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
tmpaction->setEnabled(false);
|
tmpaction->setEnabled(false);
|
||||||
|
|
||||||
// Cut Action
|
// Cut Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(Constants::ICON_CUT));
|
icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT)));
|
||||||
tmpaction = new QAction(icon, tr("Cu&t"), this);
|
tmpaction = new QAction(icon, tr("Cu&t"), this);
|
||||||
cmd = am->registerAction(tmpaction, Constants::CUT, globalContext);
|
cmd = am->registerAction(tmpaction, Constants::CUT, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Cut);
|
cmd->setDefaultKeySequence(QKeySequence::Cut);
|
||||||
@@ -693,7 +693,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
tmpaction->setEnabled(false);
|
tmpaction->setEnabled(false);
|
||||||
|
|
||||||
// Copy Action
|
// Copy Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("edit-copy"), QIcon(Constants::ICON_COPY));
|
icon = QIcon::fromTheme(QLatin1String("edit-copy"), QIcon(QLatin1String(Constants::ICON_COPY)));
|
||||||
tmpaction = new QAction(icon, tr("&Copy"), this);
|
tmpaction = new QAction(icon, tr("&Copy"), this);
|
||||||
cmd = am->registerAction(tmpaction, Constants::COPY, globalContext);
|
cmd = am->registerAction(tmpaction, Constants::COPY, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Copy);
|
cmd->setDefaultKeySequence(QKeySequence::Copy);
|
||||||
@@ -701,7 +701,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
tmpaction->setEnabled(false);
|
tmpaction->setEnabled(false);
|
||||||
|
|
||||||
// Paste Action
|
// Paste Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(Constants::ICON_PASTE));
|
icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(QLatin1String(Constants::ICON_PASTE)));
|
||||||
tmpaction = new QAction(icon, tr("&Paste"), this);
|
tmpaction = new QAction(icon, tr("&Paste"), this);
|
||||||
cmd = am->registerAction(tmpaction, Constants::PASTE, globalContext);
|
cmd = am->registerAction(tmpaction, Constants::PASTE, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Paste);
|
cmd->setDefaultKeySequence(QKeySequence::Paste);
|
||||||
@@ -731,7 +731,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
m_optionsAction = new QAction(tr("&Options..."), this);
|
m_optionsAction = new QAction(tr("&Options..."), this);
|
||||||
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
|
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+,"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
|
||||||
cmd->action()->setMenuRole(QAction::PreferencesRole);
|
cmd->action()->setMenuRole(QAction::PreferencesRole);
|
||||||
#endif
|
#endif
|
||||||
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
|
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
|
||||||
@@ -741,7 +741,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
// Minimize Action
|
// Minimize Action
|
||||||
m_minimizeAction = new QAction(tr("Minimize"), this);
|
m_minimizeAction = new QAction(tr("Minimize"), this);
|
||||||
cmd = am->registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext);
|
cmd = am->registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+M"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
|
||||||
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
|
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
|
||||||
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
|
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
|
||||||
|
|
||||||
@@ -757,15 +757,15 @@ void MainWindow::registerDefaultActions()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Show Sidebar Action
|
// Show Sidebar Action
|
||||||
m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR),
|
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
|
||||||
tr("Show Sidebar"), this);
|
tr("Show Sidebar"), this);
|
||||||
m_toggleSideBarAction->setCheckable(true);
|
m_toggleSideBarAction->setCheckable(true);
|
||||||
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext);
|
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext);
|
||||||
cmd->setAttribute(Command::CA_UpdateText);
|
cmd->setAttribute(Command::CA_UpdateText);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
||||||
#else
|
#else
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Alt+0"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+0")));
|
||||||
#endif
|
#endif
|
||||||
connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));
|
connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));
|
||||||
m_toggleSideBarButton->setDefaultAction(cmd->action());
|
m_toggleSideBarButton->setDefaultAction(cmd->action());
|
||||||
@@ -777,7 +777,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
m_toggleFullScreenAction = new QAction(tr("Full Screen"), this);
|
m_toggleFullScreenAction = new QAction(tr("Full Screen"), this);
|
||||||
m_toggleFullScreenAction->setCheckable(true);
|
m_toggleFullScreenAction->setCheckable(true);
|
||||||
cmd = am->registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
|
cmd = am->registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+F11"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
|
||||||
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
|
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
|
#endif
|
||||||
@@ -875,7 +875,7 @@ void MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags f
|
|||||||
if (!file && (flags & ICore::StopOnLoadFail))
|
if (!file && (flags & ICore::StopOnLoadFail))
|
||||||
return;
|
return;
|
||||||
if (file && (flags & ICore::SwitchMode))
|
if (file && (flags & ICore::SwitchMode))
|
||||||
Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT);
|
Core::ModeManager::instance()->activateMode(QLatin1String(Core::Constants::MODE_EDIT));
|
||||||
} else {
|
} else {
|
||||||
QFlags<EditorManager::OpenEditorFlag> emFlags;
|
QFlags<EditorManager::OpenEditorFlag> emFlags;
|
||||||
if (flags & ICore::SwitchMode)
|
if (flags & ICore::SwitchMode)
|
||||||
|
@@ -293,7 +293,7 @@ QPair<int, int> MagicRule::fromOffset(const QString &offset)
|
|||||||
\sa Core::Internal::BaseMimeTypeParser, Core::Internal::MimeTypeParser
|
\sa Core::Internal::BaseMimeTypeParser, Core::Internal::MimeTypeParser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString MagicStringRule::kMatchType("string");
|
const QString MagicStringRule::kMatchType(QLatin1String("string"));
|
||||||
|
|
||||||
MagicStringRule::MagicStringRule(const QString &s, int startPos, int endPos) :
|
MagicStringRule::MagicStringRule(const QString &s, int startPos, int endPos) :
|
||||||
MagicRule(startPos, endPos), m_pattern(s.toUtf8())
|
MagicRule(startPos, endPos), m_pattern(s.toUtf8())
|
||||||
@@ -311,7 +311,7 @@ QString MagicStringRule::matchType() const
|
|||||||
|
|
||||||
QString MagicStringRule::matchValue() const
|
QString MagicStringRule::matchValue() const
|
||||||
{
|
{
|
||||||
return m_pattern;
|
return QLatin1String(m_pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MagicStringRule::matches(const QByteArray &data) const
|
bool MagicStringRule::matches(const QByteArray &data) const
|
||||||
@@ -1664,20 +1664,26 @@ QList<MimeType> MimeDatabasePrivate::readUserModifiedMimeTypes()
|
|||||||
QHash<int, MagicRuleList> rules;
|
QHash<int, MagicRuleList> rules;
|
||||||
QXmlStreamReader reader(&file);
|
QXmlStreamReader reader(&file);
|
||||||
QXmlStreamAttributes atts;
|
QXmlStreamAttributes atts;
|
||||||
|
const QString mimeTypeAttribute = QLatin1String(mimeTypeAttributeC);
|
||||||
|
const QString patternAttribute = QLatin1String(patternAttributeC);
|
||||||
|
const QString matchValueAttribute = QLatin1String(matchValueAttributeC);
|
||||||
|
const QString matchTypeAttribute = QLatin1String(matchTypeAttributeC);
|
||||||
|
const QString matchOffsetAttribute = QLatin1String(matchOffsetAttributeC);
|
||||||
|
const QString priorityAttribute = QLatin1String(priorityAttributeC);
|
||||||
while (!reader.atEnd()) {
|
while (!reader.atEnd()) {
|
||||||
switch (reader.readNext()) {
|
switch (reader.readNext()) {
|
||||||
case QXmlStreamReader::StartElement:
|
case QXmlStreamReader::StartElement:
|
||||||
atts = reader.attributes();
|
atts = reader.attributes();
|
||||||
if (reader.name() == mimeTypeTagC) {
|
if (reader.name() == mimeTypeTagC) {
|
||||||
mimeType.setType(atts.value(mimeTypeAttributeC).toString());
|
mimeType.setType(atts.value(mimeTypeAttribute).toString());
|
||||||
const QString &patterns = atts.value(patternAttributeC).toString();
|
const QString &patterns = atts.value(patternAttribute).toString();
|
||||||
mimeType.setGlobPatterns(toGlobPatterns(patterns.split(kSemiColon)));
|
mimeType.setGlobPatterns(toGlobPatterns(patterns.split(kSemiColon)));
|
||||||
} else if (reader.name() == matchTagC) {
|
} else if (reader.name() == matchTagC) {
|
||||||
const QString &value = atts.value(matchValueAttributeC).toString();
|
const QString &value = atts.value(matchValueAttribute).toString();
|
||||||
const QString &type = atts.value(matchTypeAttributeC).toString();
|
const QString &type = atts.value(matchTypeAttribute).toString();
|
||||||
const QString &offset = atts.value(matchOffsetAttributeC).toString();
|
const QString &offset = atts.value(matchOffsetAttribute).toString();
|
||||||
QPair<int, int> range = MagicRule::fromOffset(offset);
|
QPair<int, int> range = MagicRule::fromOffset(offset);
|
||||||
const int priority = atts.value(priorityAttributeC).toString().toInt();
|
const int priority = atts.value(priorityAttribute).toString().toInt();
|
||||||
|
|
||||||
MagicRule *magicRule;
|
MagicRule *magicRule;
|
||||||
if (type == MagicStringRule::kMatchType)
|
if (type == MagicStringRule::kMatchType)
|
||||||
@@ -1729,10 +1735,19 @@ void MimeDatabasePrivate::writeUserModifiedMimeTypes(const QList<MimeType> &mime
|
|||||||
writer.setAutoFormatting(true);
|
writer.setAutoFormatting(true);
|
||||||
writer.writeStartDocument();
|
writer.writeStartDocument();
|
||||||
writer.writeStartElement(QLatin1String(mimeInfoTagC));
|
writer.writeStartElement(QLatin1String(mimeInfoTagC));
|
||||||
|
const QString mimeTypeTag = QLatin1String(mimeTypeTagC);
|
||||||
|
const QString matchTag = QLatin1String(matchTagC);
|
||||||
|
const QString mimeTypeAttribute = QLatin1String(mimeTypeAttributeC);
|
||||||
|
const QString patternAttribute = QLatin1String(patternAttributeC);
|
||||||
|
const QString matchValueAttribute = QLatin1String(matchValueAttributeC);
|
||||||
|
const QString matchTypeAttribute = QLatin1String(matchTypeAttributeC);
|
||||||
|
const QString matchOffsetAttribute = QLatin1String(matchOffsetAttributeC);
|
||||||
|
const QString priorityAttribute = QLatin1String(priorityAttributeC);
|
||||||
|
|
||||||
foreach (const MimeType &mimeType, allModifiedMimeTypes) {
|
foreach (const MimeType &mimeType, allModifiedMimeTypes) {
|
||||||
writer.writeStartElement(mimeTypeTagC);
|
writer.writeStartElement(mimeTypeTag);
|
||||||
writer.writeAttribute(mimeTypeAttributeC, mimeType.type());
|
writer.writeAttribute(mimeTypeAttribute, mimeType.type());
|
||||||
writer.writeAttribute(patternAttributeC,
|
writer.writeAttribute(patternAttribute,
|
||||||
fromGlobPatterns(mimeType.globPatterns()).join(kSemiColon));
|
fromGlobPatterns(mimeType.globPatterns()).join(kSemiColon));
|
||||||
const QList<QSharedPointer<IMagicMatcher> > &matchers = mimeType.magicMatchers();
|
const QList<QSharedPointer<IMagicMatcher> > &matchers = mimeType.magicMatchers();
|
||||||
foreach (const QSharedPointer<IMagicMatcher> &matcher, matchers) {
|
foreach (const QSharedPointer<IMagicMatcher> &matcher, matchers) {
|
||||||
@@ -1741,13 +1756,13 @@ void MimeDatabasePrivate::writeUserModifiedMimeTypes(const QList<MimeType> &mime
|
|||||||
dynamic_cast<MagicRuleMatcher *>(matcher.data())) {
|
dynamic_cast<MagicRuleMatcher *>(matcher.data())) {
|
||||||
const MagicRuleMatcher::MagicRuleList &rules = ruleMatcher->magicRules();
|
const MagicRuleMatcher::MagicRuleList &rules = ruleMatcher->magicRules();
|
||||||
foreach (const MagicRuleMatcher::MagicRuleSharedPointer &rule, rules) {
|
foreach (const MagicRuleMatcher::MagicRuleSharedPointer &rule, rules) {
|
||||||
writer.writeStartElement(matchTagC);
|
writer.writeStartElement(matchTag);
|
||||||
writer.writeAttribute(matchValueAttributeC, rule->matchValue());
|
writer.writeAttribute(matchValueAttribute, rule->matchValue());
|
||||||
writer.writeAttribute(matchTypeAttributeC, rule->matchType());
|
writer.writeAttribute(matchTypeAttribute, rule->matchType());
|
||||||
writer.writeAttribute(matchOffsetAttributeC,
|
writer.writeAttribute(matchOffsetAttribute,
|
||||||
MagicRule::toOffset(
|
MagicRule::toOffset(
|
||||||
qMakePair(rule->startPos(), rule->endPos())));
|
qMakePair(rule->startPos(), rule->endPos())));
|
||||||
writer.writeAttribute(priorityAttributeC,
|
writer.writeAttribute(priorityAttribute,
|
||||||
QString::number(ruleMatcher->priority()));
|
QString::number(ruleMatcher->priority()));
|
||||||
writer.writeEndElement();
|
writer.writeEndElement();
|
||||||
}
|
}
|
||||||
|
@@ -218,9 +218,9 @@ void ModeManager::objectAdded(QObject *obj)
|
|||||||
bool currentlyHasDefaultSequence = (currentCmd->keySequence()
|
bool currentlyHasDefaultSequence = (currentCmd->keySequence()
|
||||||
== currentCmd->defaultKeySequence());
|
== currentCmd->defaultKeySequence());
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
currentCmd->setDefaultKeySequence(QKeySequence(QString("Meta+%1").arg(i+1)));
|
currentCmd->setDefaultKeySequence(QKeySequence(QString::fromLatin1("Meta+%1").arg(i+1)));
|
||||||
#else
|
#else
|
||||||
currentCmd->setDefaultKeySequence(QKeySequence(QString("Ctrl+%1").arg(i+1)));
|
currentCmd->setDefaultKeySequence(QKeySequence(QString::fromLatin1("Ctrl+%1").arg(i+1)));
|
||||||
#endif
|
#endif
|
||||||
if (currentlyHasDefaultSequence)
|
if (currentlyHasDefaultSequence)
|
||||||
currentCmd->setKeySequence(currentCmd->defaultKeySequence());
|
currentCmd->setKeySequence(currentCmd->defaultKeySequence());
|
||||||
|
@@ -200,7 +200,7 @@ void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> fact
|
|||||||
d->m_shortcutMap.insert(shortcut, id);
|
d->m_shortcutMap.insert(shortcut, id);
|
||||||
|
|
||||||
Command *cmd = am->registerShortcut(shortcut,
|
Command *cmd = am->registerShortcut(shortcut,
|
||||||
Id(QLatin1String("QtCreator.Sidebar.") + id.name()), navicontext);
|
Id(QLatin1String("QtCreator.Sidebar.") + QLatin1String(id.name())), navicontext);
|
||||||
cmd->setDefaultKeySequence(factory->activationSequence());
|
cmd->setDefaultKeySequence(factory->activationSequence());
|
||||||
d->m_commandMap.insert(id, cmd);
|
d->m_commandMap.insert(id, cmd);
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ void NavigationWidget::restoreSettings(QSettings *settings)
|
|||||||
|
|
||||||
int version = settings->value(QLatin1String("Navigation/Version"), 1).toInt();
|
int version = settings->value(QLatin1String("Navigation/Version"), 1).toInt();
|
||||||
QStringList viewIds = settings->value(QLatin1String("Navigation/Views"),
|
QStringList viewIds = settings->value(QLatin1String("Navigation/Views"),
|
||||||
QStringList("Projects")).toStringList();
|
QStringList(QLatin1String("Projects"))).toStringList();
|
||||||
|
|
||||||
bool restoreSplitterState = true;
|
bool restoreSplitterState = true;
|
||||||
if (version == 1) {
|
if (version == 1) {
|
||||||
|
@@ -114,8 +114,8 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) :
|
|||||||
m_lastIndex(-1),
|
m_lastIndex(-1),
|
||||||
m_outputWidgetPane(new QStackedWidget),
|
m_outputWidgetPane(new QStackedWidget),
|
||||||
m_opToolBarWidgets(new QStackedWidget),
|
m_opToolBarWidgets(new QStackedWidget),
|
||||||
m_minimizeIcon(":/core/images/arrowdown.png"),
|
m_minimizeIcon(QLatin1String(":/core/images/arrowdown.png")),
|
||||||
m_maximizeIcon(":/core/images/arrowup.png"),
|
m_maximizeIcon(QLatin1String(":/core/images/arrowup.png")),
|
||||||
m_maximised(false)
|
m_maximised(false)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Output"));
|
setWindowTitle(tr("Output"));
|
||||||
@@ -212,20 +212,20 @@ void OutputPaneManager::init()
|
|||||||
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
|
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
|
||||||
|
|
||||||
cmd = am->registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalcontext);
|
cmd = am->registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalcontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Shift+F6"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6")));
|
||||||
m_prevToolButton->setDefaultAction(cmd->action());
|
m_prevToolButton->setDefaultAction(cmd->action());
|
||||||
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
|
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
|
||||||
|
|
||||||
cmd = am->registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalcontext);
|
cmd = am->registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalcontext);
|
||||||
m_nextToolButton->setDefaultAction(cmd->action());
|
m_nextToolButton->setDefaultAction(cmd->action());
|
||||||
cmd->setDefaultKeySequence(QKeySequence("F6"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("F6")));
|
||||||
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
|
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
|
||||||
|
|
||||||
cmd = am->registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalcontext);
|
cmd = am->registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalcontext);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+9"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+9")));
|
||||||
#else
|
#else
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Alt+9"));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+9")));
|
||||||
#endif
|
#endif
|
||||||
cmd->setAttribute(Command::CA_UpdateText);
|
cmd->setAttribute(Command::CA_UpdateText);
|
||||||
cmd->setAttribute(Command::CA_UpdateIcon);
|
cmd->setAttribute(Command::CA_UpdateIcon);
|
||||||
@@ -270,7 +270,7 @@ void OutputPaneManager::init()
|
|||||||
|
|
||||||
m_opToolBarWidgets->addWidget(toolButtonsContainer);
|
m_opToolBarWidgets->addWidget(toolButtonsContainer);
|
||||||
|
|
||||||
QString actionId = QString("QtCreator.Pane.%1").arg(outPane->displayName().simplified());
|
QString actionId = QLatin1String("QtCreator.Pane.") + outPane->displayName().simplified();
|
||||||
actionId.remove(QLatin1Char(' '));
|
actionId.remove(QLatin1Char(' '));
|
||||||
QAction *action = new QAction(outPane->displayName(), this);
|
QAction *action = new QAction(outPane->displayName(), this);
|
||||||
|
|
||||||
@@ -450,7 +450,7 @@ void OutputPaneManager::showPage(int idx, bool focus)
|
|||||||
if (!OutputPanePlaceHolder::getCurrent()) {
|
if (!OutputPanePlaceHolder::getCurrent()) {
|
||||||
// In this mode we don't have a placeholder
|
// In this mode we don't have a placeholder
|
||||||
// switch to the output mode and switch the page
|
// switch to the output mode and switch the page
|
||||||
ModeManager::instance()->activateMode(Constants::MODE_EDIT);
|
ModeManager::instance()->activateMode(QLatin1String(Constants::MODE_EDIT));
|
||||||
}
|
}
|
||||||
if (OutputPanePlaceHolder::getCurrent()) {
|
if (OutputPanePlaceHolder::getCurrent()) {
|
||||||
// make the page visible
|
// make the page visible
|
||||||
@@ -534,7 +534,7 @@ OutputPaneToggleButton::OutputPaneToggleButton(int number, const QString &text,
|
|||||||
QFont fnt = QApplication::font();
|
QFont fnt = QApplication::font();
|
||||||
setFont(fnt);
|
setFont(fnt);
|
||||||
setStyleSheet(
|
setStyleSheet(
|
||||||
"QToolButton { border-image: url(:/core/images/panel_button.png) 2 2 2 19;"
|
QLatin1String("QToolButton { border-image: url(:/core/images/panel_button.png) 2 2 2 19;"
|
||||||
" border-width: 2px 2px 2px 19px; padding-left: -17; padding-right: 4 } "
|
" border-width: 2px 2px 2px 19px; padding-left: -17; padding-right: 4 } "
|
||||||
"QToolButton:checked { border-image: url(:/core/images/panel_button_checked.png) 2 2 2 19 } "
|
"QToolButton:checked { border-image: url(:/core/images/panel_button_checked.png) 2 2 2 19 } "
|
||||||
"QToolButton::menu-indicator { width:0; height:0 }"
|
"QToolButton::menu-indicator { width:0; height:0 }"
|
||||||
@@ -543,7 +543,7 @@ OutputPaneToggleButton::OutputPaneToggleButton(int number, const QString &text,
|
|||||||
"QToolButton:pressed:hover { border-image: url(:/core/images/panel_button_pressed.png) 2 2 2 19 } "
|
"QToolButton:pressed:hover { border-image: url(:/core/images/panel_button_pressed.png) 2 2 2 19 } "
|
||||||
"QToolButton:hover { border-image: url(:/core/images/panel_button_hover.png) 2 2 2 19 } "
|
"QToolButton:hover { border-image: url(:/core/images/panel_button_hover.png) 2 2 2 19 } "
|
||||||
#endif
|
#endif
|
||||||
);
|
));
|
||||||
if (m_action)
|
if (m_action)
|
||||||
connect(m_action, SIGNAL(changed()), this, SLOT(updateToolTip()));
|
connect(m_action, SIGNAL(changed()), this, SLOT(updateToolTip()));
|
||||||
}
|
}
|
||||||
|
@@ -216,7 +216,7 @@ void FutureProgress::cancel()
|
|||||||
|
|
||||||
void FutureProgress::updateToolTip(const QString &text)
|
void FutureProgress::updateToolTip(const QString &text)
|
||||||
{
|
{
|
||||||
setToolTip("<b>" + title() + "</b><br>" + text);
|
setToolTip(QLatin1String("<b>") + title() + QLatin1String("</b><br>") + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FutureProgress::setStarted()
|
void FutureProgress::setStarted()
|
||||||
|
@@ -173,20 +173,20 @@ void RightPaneWidget::resizeEvent(QResizeEvent *re)
|
|||||||
|
|
||||||
void RightPaneWidget::saveSettings(QSettings *settings)
|
void RightPaneWidget::saveSettings(QSettings *settings)
|
||||||
{
|
{
|
||||||
settings->setValue("RightPane/Visible", isShown());
|
settings->setValue(QLatin1String("RightPane/Visible"), isShown());
|
||||||
settings->setValue("RightPane/Width", m_width);
|
settings->setValue(QLatin1String("RightPane/Width"), m_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightPaneWidget::readSettings(QSettings *settings)
|
void RightPaneWidget::readSettings(QSettings *settings)
|
||||||
{
|
{
|
||||||
if (settings->contains("RightPane/Visible")) {
|
if (settings->contains(QLatin1String("RightPane/Visible"))) {
|
||||||
setShown(settings->value("RightPane/Visible").toBool());
|
setShown(settings->value(QLatin1String("RightPane/Visible")).toBool());
|
||||||
} else {
|
} else {
|
||||||
setShown(false); //TODO set to false
|
setShown(false); //TODO set to false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->contains("RightPane/Width")) {
|
if (settings->contains(QLatin1String("RightPane/Width"))) {
|
||||||
m_width = settings->value("RightPane/Width").toInt();
|
m_width = settings->value(QLatin1String("RightPane/Width")).toInt();
|
||||||
if (!m_width)
|
if (!m_width)
|
||||||
m_width = 500;
|
m_width = 500;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -112,7 +112,7 @@ SettingsDatabase::SettingsDatabase(const QString &path,
|
|||||||
fileName += application;
|
fileName += application;
|
||||||
fileName += QLatin1String(".db");
|
fileName += QLatin1String(".db");
|
||||||
|
|
||||||
d->m_db = QSqlDatabase::addDatabase("QSQLITE", QLatin1String("settings"));
|
d->m_db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), QLatin1String("settings"));
|
||||||
d->m_db.setDatabaseName(fileName);
|
d->m_db.setDatabaseName(fileName);
|
||||||
if (!d->m_db.open()) {
|
if (!d->m_db.open()) {
|
||||||
qWarning().nospace() << "Warning: Failed to open settings database at " << fileName << " ("
|
qWarning().nospace() << "Warning: Failed to open settings database at " << fileName << " ("
|
||||||
|
@@ -154,8 +154,10 @@ void SideBar::setCloseWhenEmpty(bool value)
|
|||||||
|
|
||||||
void SideBar::makeItemAvailable(SideBarItem *item)
|
void SideBar::makeItemAvailable(SideBarItem *item)
|
||||||
{
|
{
|
||||||
QMap<QString, QWeakPointer<SideBarItem> >::const_iterator it = d->m_itemMap.constBegin();
|
typedef QMap<QString, QWeakPointer<SideBarItem> >::const_iterator Iterator;
|
||||||
while (it != d->m_itemMap.constEnd()) {
|
|
||||||
|
const Iterator cend = d->m_itemMap.constEnd();
|
||||||
|
for (Iterator it = d->m_itemMap.constBegin(); it != cend ; ++it) {
|
||||||
if (it.value().data() == item) {
|
if (it.value().data() == item) {
|
||||||
d->m_availableItemIds.append(it.key());
|
d->m_availableItemIds.append(it.key());
|
||||||
d->m_availableItemTitles.append(it.value().data()->title());
|
d->m_availableItemTitles.append(it.value().data()->title());
|
||||||
@@ -165,7 +167,6 @@ void SideBar::makeItemAvailable(SideBarItem *item)
|
|||||||
//updateWidgets();
|
//updateWidgets();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,10 +271,10 @@ void SideBar::saveSettings(QSettings *settings, const QString &name)
|
|||||||
views.append(iter.key());
|
views.append(iter.key());
|
||||||
}
|
}
|
||||||
|
|
||||||
settings->setValue(prefix + "Views", views);
|
settings->setValue(prefix + QLatin1String("Views"), views);
|
||||||
settings->setValue(prefix + "Visible", true);
|
settings->setValue(prefix + QLatin1String("Visible"), true);
|
||||||
settings->setValue(prefix + "VerticalPosition", saveState());
|
settings->setValue(prefix + QLatin1String("VerticalPosition"), saveState());
|
||||||
settings->setValue(prefix + "Width", width());
|
settings->setValue(prefix + QLatin1String("Width"), width());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBar::closeAllWidgets()
|
void SideBar::closeAllWidgets()
|
||||||
@@ -288,8 +289,9 @@ void SideBar::readSettings(QSettings *settings, const QString &name)
|
|||||||
|
|
||||||
closeAllWidgets();
|
closeAllWidgets();
|
||||||
|
|
||||||
if (settings->contains(prefix + "Views")) {
|
const QString viewsKey = prefix + QLatin1String("Views");
|
||||||
QStringList views = settings->value(prefix + "Views").toStringList();
|
if (settings->contains(viewsKey)) {
|
||||||
|
QStringList views = settings->value(viewsKey).toStringList();
|
||||||
if (views.count()) {
|
if (views.count()) {
|
||||||
foreach (const QString &id, views)
|
foreach (const QString &id, views)
|
||||||
insertSideBarWidget(d->m_widgets.count(), id);
|
insertSideBarWidget(d->m_widgets.count(), id);
|
||||||
@@ -302,29 +304,33 @@ void SideBar::readSettings(QSettings *settings, const QString &name)
|
|||||||
insertSideBarWidget(d->m_widgets.count(), id);
|
insertSideBarWidget(d->m_widgets.count(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->contains(prefix + "Visible"))
|
const QString visibleKey = prefix + QLatin1String("Visible");
|
||||||
setVisible(settings->value(prefix + "Visible").toBool());
|
if (settings->contains(visibleKey))
|
||||||
|
setVisible(settings->value(visibleKey).toBool());
|
||||||
|
|
||||||
if (settings->contains(prefix + "VerticalPosition"))
|
const QString positionKey = prefix + QLatin1String("VerticalPosition");
|
||||||
restoreState(settings->value(prefix + "VerticalPosition").toByteArray());
|
if (settings->contains(positionKey))
|
||||||
|
restoreState(settings->value(positionKey).toByteArray());
|
||||||
|
|
||||||
if (settings->contains(prefix + "Width")) {
|
const QString widthKey = prefix + QLatin1String("Width");
|
||||||
|
if (settings->contains(widthKey)) {
|
||||||
QSize s = size();
|
QSize s = size();
|
||||||
s.setWidth(settings->value(prefix + "Width").toInt());
|
s.setWidth(settings->value(widthKey).toInt());
|
||||||
resize(s);
|
resize(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBar::activateItem(SideBarItem *item)
|
void SideBar::activateItem(SideBarItem *item)
|
||||||
{
|
{
|
||||||
QMap<QString, QWeakPointer<SideBarItem> >::const_iterator it = d->m_itemMap.constBegin();
|
typedef QMap<QString, QWeakPointer<SideBarItem> >::const_iterator Iterator;
|
||||||
|
|
||||||
QString id;
|
QString id;
|
||||||
while (it != d->m_itemMap.constEnd()) {
|
const Iterator cend = d->m_itemMap.constEnd();
|
||||||
|
for (Iterator it = d->m_itemMap.constBegin(); it != cend ; ++it) {
|
||||||
if (it.value().data() == item) {
|
if (it.value().data() == item) {
|
||||||
id = it.key();
|
id = it.key();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id.isEmpty())
|
if (id.isEmpty())
|
||||||
|
@@ -56,8 +56,6 @@ static inline VersionControlList allVersionControls()
|
|||||||
return ExtensionSystem::PluginManager::instance()->getObjects<IVersionControl>();
|
return ExtensionSystem::PluginManager::instance()->getObjects<IVersionControl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QChar SLASH('/');
|
|
||||||
|
|
||||||
// ---- VCSManagerPrivate:
|
// ---- VCSManagerPrivate:
|
||||||
// Maintains a cache of top-level directory->version control.
|
// Maintains a cache of top-level directory->version control.
|
||||||
|
|
||||||
@@ -100,10 +98,10 @@ public:
|
|||||||
VcsInfo *findUpInCache(const QString &directory)
|
VcsInfo *findUpInCache(const QString &directory)
|
||||||
{
|
{
|
||||||
VcsInfo *result = 0;
|
VcsInfo *result = 0;
|
||||||
|
const QChar slash = QLatin1Char('/');
|
||||||
// Split the path, trying to find the matching repository. We start from the reverse
|
// Split the path, trying to find the matching repository. We start from the reverse
|
||||||
// in order to detected nested repositories correctly (say, a git checkout under SVN).
|
// in order to detected nested repositories correctly (say, a git checkout under SVN).
|
||||||
for (int pos = directory.size() - 1; pos >= 0; pos = directory.lastIndexOf(SLASH, pos) - 1) {
|
for (int pos = directory.size() - 1; pos >= 0; pos = directory.lastIndexOf(slash, pos) - 1) {
|
||||||
const QString directoryPart = directory.left(pos);
|
const QString directoryPart = directory.left(pos);
|
||||||
result = findInCache(directoryPart);
|
result = findInCache(directoryPart);
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
@@ -147,10 +145,15 @@ public:
|
|||||||
m_vcsInfoList.append(newInfo);
|
m_vcsInfoList.append(newInfo);
|
||||||
|
|
||||||
QString tmpDir = dir;
|
QString tmpDir = dir;
|
||||||
|
const QChar slash = QLatin1Char('/');
|
||||||
while (tmpDir.count() >= topLevel.count() && tmpDir.count() > 0) {
|
while (tmpDir.count() >= topLevel.count() && tmpDir.count() > 0) {
|
||||||
m_cachedMatches.insert(tmpDir, newInfo);
|
m_cachedMatches.insert(tmpDir, newInfo);
|
||||||
int slashPos = tmpDir.lastIndexOf(SLASH);
|
const int slashPos = tmpDir.lastIndexOf(slash);
|
||||||
tmpDir = slashPos >= 0 ? tmpDir.left(tmpDir.lastIndexOf(SLASH)) : QString();
|
if (slashPos >= 0) {
|
||||||
|
tmpDir.truncate(slashPos);
|
||||||
|
} else {
|
||||||
|
tmpDir.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +205,8 @@ void VcsManager::resetVersionControlForDirectory(const QString &inputDirectory)
|
|||||||
IVersionControl* VcsManager::findVersionControlForDirectory(const QString &inputDirectory,
|
IVersionControl* VcsManager::findVersionControlForDirectory(const QString &inputDirectory,
|
||||||
QString *topLevelDirectory)
|
QString *topLevelDirectory)
|
||||||
{
|
{
|
||||||
|
typedef QPair<QString, IVersionControl *> StringVersionControlPair;
|
||||||
|
typedef QList<StringVersionControlPair> StringVersionControlPairs;
|
||||||
if (inputDirectory.isEmpty())
|
if (inputDirectory.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -217,12 +222,12 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
|||||||
|
|
||||||
// Nothing: ask the IVersionControls directly.
|
// Nothing: ask the IVersionControls directly.
|
||||||
const VersionControlList versionControls = allVersionControls();
|
const VersionControlList versionControls = allVersionControls();
|
||||||
QList<QPair<QString, IVersionControl *> > allThatCanManage;
|
StringVersionControlPairs allThatCanManage;
|
||||||
|
|
||||||
foreach (IVersionControl * versionControl, versionControls) {
|
foreach (IVersionControl * versionControl, versionControls) {
|
||||||
QString topLevel;
|
QString topLevel;
|
||||||
if (versionControl->managesDirectory(directory, &topLevel))
|
if (versionControl->managesDirectory(directory, &topLevel))
|
||||||
allThatCanManage.push_back(qMakePair(topLevel, versionControl));
|
allThatCanManage.push_back(StringVersionControlPair(topLevel, versionControl));
|
||||||
}
|
}
|
||||||
|
|
||||||
// To properly find a nested repository (say, git checkout inside SVN),
|
// To properly find a nested repository (say, git checkout inside SVN),
|
||||||
@@ -240,11 +245,14 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
|||||||
|
|
||||||
// Register Vcs(s) with the cache
|
// Register Vcs(s) with the cache
|
||||||
QString tmpDir = directory;
|
QString tmpDir = directory;
|
||||||
for (QList<QPair<QString, IVersionControl *> >::const_iterator i = allThatCanManage.constBegin();
|
const QChar slash = QLatin1Char('/');
|
||||||
i != allThatCanManage.constEnd(); ++i) {
|
const StringVersionControlPairs::const_iterator cend = allThatCanManage.constEnd();
|
||||||
|
for (StringVersionControlPairs::const_iterator i = allThatCanManage.constBegin(); i != cend; ++i) {
|
||||||
d->cache(i->second, i->first, tmpDir);
|
d->cache(i->second, i->first, tmpDir);
|
||||||
tmpDir = i->first;
|
tmpDir = i->first;
|
||||||
tmpDir = tmpDir.left(tmpDir.lastIndexOf(SLASH));
|
const int slashPos = tmpDir.lastIndexOf(slash);
|
||||||
|
if (slashPos >= 0)
|
||||||
|
tmpDir.truncate(slashPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return result
|
// return result
|
||||||
|
Reference in New Issue
Block a user