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:
@@ -560,7 +560,7 @@ void MainWindow::registerDefaultActions()
|
||||
mfile->addAction(cmd, Constants::G_FILE_SAVE);
|
||||
|
||||
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);
|
||||
|
||||
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()));
|
||||
|
||||
// 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);
|
||||
cmd = am->registerAction(m_newAction, Constants::NEW, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence::New);
|
||||
@@ -598,7 +598,7 @@ void MainWindow::registerDefaultActions()
|
||||
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
|
||||
|
||||
// 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);
|
||||
cmd = am->registerAction(m_openAction, Constants::OPEN, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence::Open);
|
||||
@@ -618,7 +618,7 @@ void MainWindow::registerDefaultActions()
|
||||
ac->setOnAllDisabledBehavior(ActionContainer::Show);
|
||||
|
||||
// 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);
|
||||
tmpaction->setEnabled(false);
|
||||
cmd = am->registerAction(tmpaction, Constants::SAVE, globalContext);
|
||||
@@ -665,7 +665,7 @@ void MainWindow::registerDefaultActions()
|
||||
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
|
||||
|
||||
// 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);
|
||||
cmd = am->registerAction(tmpaction, Constants::UNDO, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence::Undo);
|
||||
@@ -675,7 +675,7 @@ void MainWindow::registerDefaultActions()
|
||||
tmpaction->setEnabled(false);
|
||||
|
||||
// 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);
|
||||
cmd = am->registerAction(tmpaction, Constants::REDO, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence::Redo);
|
||||
@@ -685,7 +685,7 @@ void MainWindow::registerDefaultActions()
|
||||
tmpaction->setEnabled(false);
|
||||
|
||||
// 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);
|
||||
cmd = am->registerAction(tmpaction, Constants::CUT, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence::Cut);
|
||||
@@ -693,7 +693,7 @@ void MainWindow::registerDefaultActions()
|
||||
tmpaction->setEnabled(false);
|
||||
|
||||
// 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);
|
||||
cmd = am->registerAction(tmpaction, Constants::COPY, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence::Copy);
|
||||
@@ -701,7 +701,7 @@ void MainWindow::registerDefaultActions()
|
||||
tmpaction->setEnabled(false);
|
||||
|
||||
// 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);
|
||||
cmd = am->registerAction(tmpaction, Constants::PASTE, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence::Paste);
|
||||
@@ -731,7 +731,7 @@ void MainWindow::registerDefaultActions()
|
||||
m_optionsAction = new QAction(tr("&Options..."), this);
|
||||
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
|
||||
#ifdef Q_WS_MAC
|
||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+,"));
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
|
||||
cmd->action()->setMenuRole(QAction::PreferencesRole);
|
||||
#endif
|
||||
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
|
||||
@@ -741,7 +741,7 @@ void MainWindow::registerDefaultActions()
|
||||
// Minimize Action
|
||||
m_minimizeAction = new QAction(tr("Minimize"), this);
|
||||
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);
|
||||
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
|
||||
|
||||
@@ -757,15 +757,15 @@ void MainWindow::registerDefaultActions()
|
||||
#endif
|
||||
|
||||
// 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);
|
||||
m_toggleSideBarAction->setCheckable(true);
|
||||
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext);
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
#ifdef Q_WS_MAC
|
||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
||||
#else
|
||||
cmd->setDefaultKeySequence(QKeySequence("Alt+0"));
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+0")));
|
||||
#endif
|
||||
connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));
|
||||
m_toggleSideBarButton->setDefaultAction(cmd->action());
|
||||
@@ -777,7 +777,7 @@ void MainWindow::registerDefaultActions()
|
||||
m_toggleFullScreenAction = new QAction(tr("Full Screen"), this);
|
||||
m_toggleFullScreenAction->setCheckable(true);
|
||||
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);
|
||||
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)), this, SLOT(setFullScreen(bool)));
|
||||
#endif
|
||||
@@ -875,7 +875,7 @@ void MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags f
|
||||
if (!file && (flags & ICore::StopOnLoadFail))
|
||||
return;
|
||||
if (file && (flags & ICore::SwitchMode))
|
||||
Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT);
|
||||
Core::ModeManager::instance()->activateMode(QLatin1String(Core::Constants::MODE_EDIT));
|
||||
} else {
|
||||
QFlags<EditorManager::OpenEditorFlag> emFlags;
|
||||
if (flags & ICore::SwitchMode)
|
||||
|
||||
Reference in New Issue
Block a user