forked from qt-creator/qt-creator
Core: Make member functions const/static
readability-make-member-function-const finds lots of member functions that could be made const. This change just picks getter functions that really should be const. readability-convert-member-functions-to-static finds non-static member functions which do not access this. This change turns most of them into static ones, but leaves some non static to keep the class API consistent. Change-Id: I004d6f7fab4375f9902f940f29b4a4f561fc7604 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -398,7 +398,7 @@ TouchBar *ActionContainerPrivate::touchBar() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActionContainerPrivate::canAddAction(Command *action) const
|
bool ActionContainerPrivate::canAddAction(Command *action)
|
||||||
{
|
{
|
||||||
return action && action->action();
|
return action && action->action();
|
||||||
}
|
}
|
||||||
|
@@ -80,7 +80,7 @@ public:
|
|||||||
virtual bool updateInternal() = 0;
|
virtual bool updateInternal() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool canAddAction(Command *action) const;
|
static bool canAddAction(Command *action);
|
||||||
bool canAddMenu(ActionContainer *menu) const;
|
bool canAddMenu(ActionContainer *menu) const;
|
||||||
virtual bool canBeAddedToContainer(ActionContainerPrivate *container) const = 0;
|
virtual bool canBeAddedToContainer(ActionContainerPrivate *container) const = 0;
|
||||||
|
|
||||||
|
@@ -328,7 +328,7 @@ void ActionManager::unregisterAction(QAction *action, Id id)
|
|||||||
a->removeOverrideAction(action);
|
a->removeOverrideAction(action);
|
||||||
if (a->isEmpty()) {
|
if (a->isEmpty()) {
|
||||||
// clean up
|
// clean up
|
||||||
d->saveSettings(a);
|
ActionManagerPrivate::saveSettings(a);
|
||||||
ICore::mainWindow()->removeAction(a->action());
|
ICore::mainWindow()->removeAction(a->action());
|
||||||
// ActionContainers listen to the commands' destroyed signals
|
// ActionContainers listen to the commands' destroyed signals
|
||||||
delete a->action();
|
delete a->action();
|
||||||
|
@@ -55,13 +55,13 @@ public:
|
|||||||
bool hasContext(int context) const;
|
bool hasContext(int context) const;
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void saveSettings(Action *cmd);
|
static void saveSettings(Action *cmd);
|
||||||
|
|
||||||
void showShortcutPopup(const QString &shortcut);
|
static void showShortcutPopup(const QString &shortcut);
|
||||||
bool hasContext(const Context &context) const;
|
bool hasContext(const Context &context) const;
|
||||||
Action *overridableAction(Utils::Id id);
|
Action *overridableAction(Utils::Id id);
|
||||||
|
|
||||||
void readUserSettings(Utils::Id id, Action *cmd);
|
static void readUserSettings(Utils::Id id, Action *cmd);
|
||||||
|
|
||||||
void containerDestroyed();
|
void containerDestroyed();
|
||||||
void actionTriggered();
|
void actionTriggered();
|
||||||
|
@@ -70,7 +70,7 @@ protected:
|
|||||||
void setFilterText(const QString &text);
|
void setFilterText(const QString &text);
|
||||||
void setPageTitle(const QString &s);
|
void setPageTitle(const QString &s);
|
||||||
void setTargetHeader(const QString &s);
|
void setTargetHeader(const QString &s);
|
||||||
void setModified(QTreeWidgetItem *item, bool modified);
|
static void setModified(QTreeWidgetItem *item, bool modified);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool filter(const QString &filterString, QTreeWidgetItem *item);
|
bool filter(const QString &filterString, QTreeWidgetItem *item);
|
||||||
|
@@ -84,7 +84,7 @@ void BaseFileWizard::accept()
|
|||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
|
|
||||||
// Compile result list and prompt for overwrite
|
// Compile result list and prompt for overwrite
|
||||||
switch (m_factory->promptOverwrite(&m_files, &errorMessage)) {
|
switch (BaseFileWizardFactory::promptOverwrite(&m_files, &errorMessage)) {
|
||||||
case BaseFileWizardFactory::OverwriteCanceled:
|
case BaseFileWizardFactory::OverwriteCanceled:
|
||||||
reject();
|
reject();
|
||||||
return;
|
return;
|
||||||
|
@@ -203,7 +203,7 @@ bool BaseFileWizardFactory::postGenerateOpenEditors(const GeneratedFiles &l, QSt
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(GeneratedFiles *files,
|
BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(GeneratedFiles *files,
|
||||||
QString *errorMessage) const
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (debugWizard)
|
if (debugWizard)
|
||||||
qDebug() << Q_FUNC_INFO << files;
|
qDebug() << Q_FUNC_INFO << files;
|
||||||
|
@@ -109,8 +109,8 @@ protected:
|
|||||||
static QString preferredSuffix(const QString &mimeType);
|
static QString preferredSuffix(const QString &mimeType);
|
||||||
|
|
||||||
enum OverwriteResult { OverwriteOk, OverwriteError, OverwriteCanceled };
|
enum OverwriteResult { OverwriteOk, OverwriteError, OverwriteCanceled };
|
||||||
OverwriteResult promptOverwrite(GeneratedFiles *files,
|
static OverwriteResult promptOverwrite(GeneratedFiles *files,
|
||||||
QString *errorMessage) const;
|
QString *errorMessage);
|
||||||
static bool postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage = nullptr);
|
static bool postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -270,7 +270,7 @@ QObject *CorePlugin::remoteCommand(const QStringList & /* options */,
|
|||||||
});
|
});
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
IDocument *res = m_mainWindow->openFiles(
|
IDocument *res = MainWindow::openFiles(
|
||||||
args, ICore::OpenFilesFlags(ICore::SwitchMode | ICore::CanContainLineAndColumnNumbers | ICore::SwitchSplitIfAlreadyVisible),
|
args, ICore::OpenFilesFlags(ICore::SwitchMode | ICore::CanContainLineAndColumnNumbers | ICore::SwitchSplitIfAlreadyVisible),
|
||||||
workingDirectory);
|
workingDirectory);
|
||||||
m_mainWindow->raiseWindow();
|
m_mainWindow->raiseWindow();
|
||||||
|
@@ -87,7 +87,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static void addToPathChooserContextMenu(Utils::PathChooser *pathChooser, QMenu *menu);
|
static void addToPathChooserContextMenu(Utils::PathChooser *pathChooser, QMenu *menu);
|
||||||
void setupSystemEnvironment();
|
static void setupSystemEnvironment();
|
||||||
void checkSettings();
|
void checkSettings();
|
||||||
|
|
||||||
MainWindow *m_mainWindow = nullptr;
|
MainWindow *m_mainWindow = nullptr;
|
||||||
|
@@ -88,7 +88,7 @@ public:
|
|||||||
void setTools(const QMap<QString, QList<ExternalTool *> > &tools);
|
void setTools(const QMap<QString, QList<ExternalTool *> > &tools);
|
||||||
QMap<QString, QList<ExternalTool *> > tools() const { return m_tools; }
|
QMap<QString, QList<ExternalTool *> > tools() const { return m_tools; }
|
||||||
|
|
||||||
ExternalTool *toolForIndex(const QModelIndex &modelIndex) const;
|
static ExternalTool *toolForIndex(const QModelIndex &modelIndex);
|
||||||
QString categoryForIndex(const QModelIndex &modelIndex, bool *found) const;
|
QString categoryForIndex(const QModelIndex &modelIndex, bool *found) const;
|
||||||
void revertTool(const QModelIndex &modelIndex);
|
void revertTool(const QModelIndex &modelIndex);
|
||||||
QModelIndex addCategory();
|
QModelIndex addCategory();
|
||||||
@@ -97,8 +97,8 @@ public:
|
|||||||
Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; }
|
Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariant data(ExternalTool *tool, int role = Qt::DisplayRole) const;
|
static QVariant data(ExternalTool *tool, int role = Qt::DisplayRole);
|
||||||
QVariant data(const QString &category, int role = Qt::DisplayRole) const;
|
static QVariant data(const QString &category, int role = Qt::DisplayRole);
|
||||||
|
|
||||||
QMap<QString, QList<ExternalTool *> > m_tools;
|
QMap<QString, QList<ExternalTool *> > m_tools;
|
||||||
};
|
};
|
||||||
@@ -129,7 +129,7 @@ QVariant ExternalToolModel::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ExternalToolModel::data(ExternalTool *tool, int role) const
|
QVariant ExternalToolModel::data(ExternalTool *tool, int role)
|
||||||
{
|
{
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
@@ -141,7 +141,7 @@ QVariant ExternalToolModel::data(ExternalTool *tool, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ExternalToolModel::data(const QString &category, int role) const
|
QVariant ExternalToolModel::data(const QString &category, int role)
|
||||||
{
|
{
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
@@ -315,7 +315,7 @@ void ExternalToolModel::setTools(const QMap<QString, QList<ExternalTool *> > &to
|
|||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalTool *ExternalToolModel::toolForIndex(const QModelIndex &index) const
|
ExternalTool *ExternalToolModel::toolForIndex(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
return static_cast<ExternalTool *>(index.internalPointer());
|
return static_cast<ExternalTool *>(index.internalPointer());
|
||||||
}
|
}
|
||||||
@@ -547,7 +547,7 @@ void ExternalToolConfig::handleCurrentChanged(const QModelIndex &now, const QMod
|
|||||||
|
|
||||||
void ExternalToolConfig::updateButtons(const QModelIndex &index)
|
void ExternalToolConfig::updateButtons(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
ExternalTool *tool = m_model.toolForIndex(index);
|
const ExternalTool *tool = ExternalToolModel::toolForIndex(index);
|
||||||
if (!tool) {
|
if (!tool) {
|
||||||
m_ui.removeButton->setEnabled(false);
|
m_ui.removeButton->setEnabled(false);
|
||||||
m_ui.revertButton->setEnabled(false);
|
m_ui.revertButton->setEnabled(false);
|
||||||
@@ -571,7 +571,7 @@ void ExternalToolConfig::updateCurrentItem()
|
|||||||
|
|
||||||
void ExternalToolConfig::updateItem(const QModelIndex &index)
|
void ExternalToolConfig::updateItem(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
ExternalTool *tool = m_model.toolForIndex(index);
|
ExternalTool *tool = ExternalToolModel::toolForIndex(index);
|
||||||
if (!tool)
|
if (!tool)
|
||||||
return;
|
return;
|
||||||
tool->setDescription(m_ui.description->text());
|
tool->setDescription(m_ui.description->text());
|
||||||
@@ -594,7 +594,7 @@ void ExternalToolConfig::updateItem(const QModelIndex &index)
|
|||||||
void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
|
void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
updateButtons(index);
|
updateButtons(index);
|
||||||
ExternalTool *tool = m_model.toolForIndex(index);
|
const ExternalTool *tool = ExternalToolModel::toolForIndex(index);
|
||||||
if (!tool) {
|
if (!tool) {
|
||||||
m_ui.description->clear();
|
m_ui.description->clear();
|
||||||
m_ui.executable->setPath(QString());
|
m_ui.executable->setPath(QString());
|
||||||
|
@@ -417,7 +417,7 @@ private:
|
|||||||
|
|
||||||
void createGui();
|
void createGui();
|
||||||
void showCategory(int index);
|
void showCategory(int index);
|
||||||
void updateEnabledTabs(Category *category, const QString &searchText);
|
static void updateEnabledTabs(Category *category, const QString &searchText);
|
||||||
void ensureCategoryWidget(Category *category);
|
void ensureCategoryWidget(Category *category);
|
||||||
void disconnectTabWidgets();
|
void disconnectTabWidgets();
|
||||||
|
|
||||||
|
@@ -428,12 +428,10 @@ bool ShortcutSettingsWidget::updateAndCheckForConflicts(const QKeySequence &key,
|
|||||||
while (index >= item->m_keys.size())
|
while (index >= item->m_keys.size())
|
||||||
item->m_keys.append(QKeySequence());
|
item->m_keys.append(QKeySequence());
|
||||||
item->m_keys[index] = key;
|
item->m_keys[index] = key;
|
||||||
auto that = const_cast<ShortcutSettingsWidget *>(this);
|
CommandMappings::setModified(current,
|
||||||
if (cleanKeys(item->m_keys) != item->m_cmd->defaultKeySequences())
|
cleanKeys(item->m_keys) != item->m_cmd->defaultKeySequences());
|
||||||
that->setModified(current, true);
|
|
||||||
else
|
|
||||||
that->setModified(current, false);
|
|
||||||
current->setText(2, keySequencesToNativeString(item->m_keys));
|
current->setText(2, keySequencesToNativeString(item->m_keys));
|
||||||
|
auto that = const_cast<ShortcutSettingsWidget *>(this);
|
||||||
return that->markCollisions(item, index);
|
return that->markCollisions(item, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -159,7 +159,7 @@ SplitterOrView *EditorView::parentSplitterOrView() const
|
|||||||
return m_parentSplitterOrView;
|
return m_parentSplitterOrView;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorView *EditorView::findNextView()
|
EditorView *EditorView::findNextView() const
|
||||||
{
|
{
|
||||||
SplitterOrView *current = parentSplitterOrView();
|
SplitterOrView *current = parentSplitterOrView();
|
||||||
QTC_ASSERT(current, return nullptr);
|
QTC_ASSERT(current, return nullptr);
|
||||||
@@ -182,7 +182,7 @@ EditorView *EditorView::findNextView()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorView *EditorView::findPreviousView()
|
EditorView *EditorView::findPreviousView() const
|
||||||
{
|
{
|
||||||
SplitterOrView *current = parentSplitterOrView();
|
SplitterOrView *current = parentSplitterOrView();
|
||||||
QTC_ASSERT(current, return nullptr);
|
QTC_ASSERT(current, return nullptr);
|
||||||
@@ -363,7 +363,7 @@ void EditorView::listSelectionActivated(int index)
|
|||||||
EditorManagerPrivate::activateEditorForEntry(this, DocumentModel::entryAtRow(index));
|
EditorManagerPrivate::activateEditorForEntry(this, DocumentModel::entryAtRow(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorView::fillListContextMenu(QMenu *menu)
|
void EditorView::fillListContextMenu(QMenu *menu) const
|
||||||
{
|
{
|
||||||
IEditor *editor = currentEditor();
|
IEditor *editor = currentEditor();
|
||||||
DocumentModel::Entry *entry = editor ? DocumentModel::entryForDocument(editor->document())
|
DocumentModel::Entry *entry = editor ? DocumentModel::entryForDocument(editor->document())
|
||||||
|
@@ -78,8 +78,8 @@ public:
|
|||||||
~EditorView() override;
|
~EditorView() override;
|
||||||
|
|
||||||
SplitterOrView *parentSplitterOrView() const;
|
SplitterOrView *parentSplitterOrView() const;
|
||||||
EditorView *findNextView();
|
EditorView *findNextView() const;
|
||||||
EditorView *findPreviousView();
|
EditorView *findPreviousView() const;
|
||||||
|
|
||||||
int editorCount() const;
|
int editorCount() const;
|
||||||
void addEditor(IEditor *editor);
|
void addEditor(IEditor *editor);
|
||||||
@@ -123,7 +123,7 @@ private:
|
|||||||
|
|
||||||
void setParentSplitterOrView(SplitterOrView *splitterOrView);
|
void setParentSplitterOrView(SplitterOrView *splitterOrView);
|
||||||
|
|
||||||
void fillListContextMenu(QMenu *menu);
|
void fillListContextMenu(QMenu *menu) const;
|
||||||
void updateNavigatorActions();
|
void updateNavigatorActions();
|
||||||
void updateToolBar(IEditor *editor);
|
void updateToolBar(IEditor *editor);
|
||||||
void checkProjectLoaded(IEditor *editor);
|
void checkProjectLoaded(IEditor *editor);
|
||||||
|
@@ -74,7 +74,7 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void editorClicked(QTreeWidgetItem *item);
|
void editorClicked(QTreeWidgetItem *item);
|
||||||
void selectEditor(QTreeWidgetItem *item);
|
static void selectEditor(QTreeWidgetItem *item);
|
||||||
|
|
||||||
void addHistoryItems(const QList<EditLocation> &history, EditorView *view,
|
void addHistoryItems(const QList<EditLocation> &history, EditorView *view,
|
||||||
QSet<const DocumentModel::Entry *> &entriesDone);
|
QSet<const DocumentModel::Entry *> &entriesDone);
|
||||||
|
@@ -97,8 +97,8 @@ protected:
|
|||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void changeActiveEditor(int row);
|
static void changeActiveEditor(int row);
|
||||||
void makeEditorWritable();
|
static void makeEditorWritable();
|
||||||
|
|
||||||
void checkDocumentStatus();
|
void checkDocumentStatus();
|
||||||
void closeEditor();
|
void closeEditor();
|
||||||
|
@@ -182,7 +182,8 @@ public:
|
|||||||
bool isAnyFilterEnabled() const;
|
bool isAnyFilterEnabled() const;
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
void setFindFlag(Core::FindFlag flag, bool enabled);
|
void setFindFlag(Core::FindFlag flag, bool enabled);
|
||||||
void updateCompletion(const QString &text, QStringList &completions, QStringListModel *model);
|
static void updateCompletion(const QString &text, QStringList &completions,
|
||||||
|
QStringListModel *model);
|
||||||
void setupMenu();
|
void setupMenu();
|
||||||
void setupFilterMenuItems();
|
void setupFilterMenuItems();
|
||||||
void readSettings();
|
void readSettings();
|
||||||
@@ -429,7 +430,7 @@ void Find::updateFindCompletion(const QString &text, FindFlags flags)
|
|||||||
|
|
||||||
void Find::updateReplaceCompletion(const QString &text)
|
void Find::updateReplaceCompletion(const QString &text)
|
||||||
{
|
{
|
||||||
d->updateCompletion(text, d->m_replaceCompletions, &d->m_replaceCompletionModel);
|
FindPrivate::updateCompletion(text, d->m_replaceCompletions, &d->m_replaceCompletionModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindPrivate::updateCompletion(const QString &text, QStringList &completions, QStringListModel *model)
|
void FindPrivate::updateCompletion(const QString &text, QStringList &completions, QStringListModel *model)
|
||||||
|
@@ -733,7 +733,7 @@ void FindToolBar::hideAndResetFocus()
|
|||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
FindToolBarPlaceHolder *FindToolBar::findToolBarPlaceHolder() const
|
FindToolBarPlaceHolder *FindToolBar::findToolBarPlaceHolder()
|
||||||
{
|
{
|
||||||
const QList<FindToolBarPlaceHolder*> placeholders = FindToolBarPlaceHolder::allFindToolbarPlaceHolders();
|
const QList<FindToolBarPlaceHolder*> placeholders = FindToolBarPlaceHolder::allFindToolbarPlaceHolders();
|
||||||
QWidget *candidate = QApplication::focusWidget();
|
QWidget *candidate = QApplication::focusWidget();
|
||||||
|
@@ -124,7 +124,7 @@ private:
|
|||||||
void setFindFlag(FindFlag flag, bool enabled);
|
void setFindFlag(FindFlag flag, bool enabled);
|
||||||
bool hasFindFlag(FindFlag flag);
|
bool hasFindFlag(FindFlag flag);
|
||||||
FindFlags effectiveFindFlags();
|
FindFlags effectiveFindFlags();
|
||||||
FindToolBarPlaceHolder *findToolBarPlaceHolder() const;
|
static FindToolBarPlaceHolder *findToolBarPlaceHolder();
|
||||||
bool toolBarHasFocus() const;
|
bool toolBarHasFocus() const;
|
||||||
ControlStyle controlStyle(bool replaceIsVisible);
|
ControlStyle controlStyle(bool replaceIsVisible);
|
||||||
void setFindButtonStyle(Qt::ToolButtonStyle style);
|
void setFindButtonStyle(Qt::ToolButtonStyle style);
|
||||||
|
@@ -65,7 +65,7 @@ private:
|
|||||||
void updateButtonStates();
|
void updateButtonStates();
|
||||||
void updateFindFlags();
|
void updateFindFlags();
|
||||||
void updateFindFilterName(IFindFilter *filter);
|
void updateFindFilterName(IFindFilter *filter);
|
||||||
void findCompleterActivated(const QModelIndex &index);
|
static void findCompleterActivated(const QModelIndex &index);
|
||||||
|
|
||||||
void acceptAndGetParameters(QString *term, IFindFilter **filter);
|
void acceptAndGetParameters(QString *term, IFindFilter **filter);
|
||||||
|
|
||||||
|
@@ -149,7 +149,7 @@ int SearchResultTreeModel::columnCount(const QModelIndex &parent) const
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchResultTreeItem *SearchResultTreeModel::treeItemAtIndex(const QModelIndex &idx) const
|
SearchResultTreeItem *SearchResultTreeModel::treeItemAtIndex(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
return static_cast<SearchResultTreeItem*>(idx.internalPointer());
|
return static_cast<SearchResultTreeItem*>(idx.internalPointer());
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,7 @@ private:
|
|||||||
bool setCheckState(const QModelIndex &idx, Qt::CheckState checkState, bool firstCall = true);
|
bool setCheckState(const QModelIndex &idx, Qt::CheckState checkState, bool firstCall = true);
|
||||||
QModelIndex nextIndex(const QModelIndex &idx, bool *wrapped = nullptr) const;
|
QModelIndex nextIndex(const QModelIndex &idx, bool *wrapped = nullptr) const;
|
||||||
QModelIndex prevIndex(const QModelIndex &idx, bool *wrapped = nullptr) const;
|
QModelIndex prevIndex(const QModelIndex &idx, bool *wrapped = nullptr) const;
|
||||||
SearchResultTreeItem *treeItemAtIndex(const QModelIndex &idx) const;
|
static SearchResultTreeItem *treeItemAtIndex(const QModelIndex &idx);
|
||||||
|
|
||||||
SearchResultTreeItem *m_rootItem;
|
SearchResultTreeItem *m_rootItem;
|
||||||
SearchResultTreeItem *m_currentParent;
|
SearchResultTreeItem *m_currentParent;
|
||||||
|
@@ -64,10 +64,10 @@ public:
|
|||||||
void resetWarnings();
|
void resetWarnings();
|
||||||
void resetLanguage();
|
void resetLanguage();
|
||||||
|
|
||||||
bool canResetWarnings() const;
|
static bool canResetWarnings();
|
||||||
void fillLanguageBox() const;
|
void fillLanguageBox() const;
|
||||||
QString language() const;
|
static QString language();
|
||||||
void setLanguage(const QString&);
|
static void setLanguage(const QString&);
|
||||||
|
|
||||||
GeneralSettings *q;
|
GeneralSettings *q;
|
||||||
Ui::GeneralSettings m_ui;
|
Ui::GeneralSettings m_ui;
|
||||||
@@ -86,7 +86,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
|
|||||||
m_ui.showShortcutsInContextMenus->setText(
|
m_ui.showShortcutsInContextMenus->setText(
|
||||||
tr("Show keyboard shortcuts in context menus (default: %1)")
|
tr("Show keyboard shortcuts in context menus (default: %1)")
|
||||||
.arg(q->m_defaultShowShortcutsInContextMenu ? tr("on") : tr("off")));
|
.arg(q->m_defaultShowShortcutsInContextMenu ? tr("on") : tr("off")));
|
||||||
m_ui.showShortcutsInContextMenus->setChecked(q->showShortcutsInContextMenu());
|
m_ui.showShortcutsInContextMenus->setChecked(GeneralSettings::showShortcutsInContextMenu());
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0))
|
||||||
m_ui.showShortcutsInContextMenus->setVisible(false);
|
m_ui.showShortcutsInContextMenus->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
@@ -157,7 +157,7 @@ void GeneralSettingsWidget::apply()
|
|||||||
m_ui.themeChooser->apply();
|
m_ui.themeChooser->apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneralSettings::showShortcutsInContextMenu() const
|
bool GeneralSettings::showShortcutsInContextMenu()
|
||||||
{
|
{
|
||||||
return ICore::settings()
|
return ICore::settings()
|
||||||
->value(settingsKeyShortcutsInContextMenu,
|
->value(settingsKeyShortcutsInContextMenu,
|
||||||
@@ -177,7 +177,7 @@ void GeneralSettingsWidget::resetWarnings()
|
|||||||
m_ui.resetWarningsButton->setEnabled(false);
|
m_ui.resetWarningsButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneralSettingsWidget::canResetWarnings() const
|
bool GeneralSettingsWidget::canResetWarnings()
|
||||||
{
|
{
|
||||||
return InfoBar::anyGloballySuppressed()
|
return InfoBar::anyGloballySuppressed()
|
||||||
|| CheckableMessageBox::hasSuppressedQuestions(ICore::settings());
|
|| CheckableMessageBox::hasSuppressedQuestions(ICore::settings());
|
||||||
@@ -189,7 +189,7 @@ void GeneralSettingsWidget::resetLanguage()
|
|||||||
m_ui.languageBox->setCurrentIndex(0);
|
m_ui.languageBox->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GeneralSettingsWidget::language() const
|
QString GeneralSettingsWidget::language()
|
||||||
{
|
{
|
||||||
QSettings *settings = ICore::settings();
|
QSettings *settings = ICore::settings();
|
||||||
return settings->value(QLatin1String("General/OverrideLanguage")).toString();
|
return settings->value(QLatin1String("General/OverrideLanguage")).toString();
|
||||||
|
@@ -35,7 +35,7 @@ class GeneralSettings : public IOptionsPage
|
|||||||
public:
|
public:
|
||||||
GeneralSettings();
|
GeneralSettings();
|
||||||
|
|
||||||
bool showShortcutsInContextMenu() const;
|
static bool showShortcutsInContextMenu();
|
||||||
void setShowShortcutsInContextMenu(bool show);
|
void setShowShortcutsInContextMenu(bool show);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -769,7 +769,7 @@ void ICore::registerWindow(QWidget *window, const Context &context)
|
|||||||
|
|
||||||
void ICore::openFiles(const QStringList &arguments, ICore::OpenFilesFlags flags)
|
void ICore::openFiles(const QStringList &arguments, ICore::OpenFilesFlags flags)
|
||||||
{
|
{
|
||||||
m_mainwindow->openFiles(arguments, flags);
|
MainWindow::openFiles(arguments, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -227,7 +227,7 @@ QList<IWizardFactory*> IWizardFactory::allWizardFactories()
|
|||||||
return s_allFactories;
|
return s_allFactories;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IWizardFactory::runPath(const QString &defaultPath)
|
QString IWizardFactory::runPath(const QString &defaultPath) const
|
||||||
{
|
{
|
||||||
QString path = defaultPath;
|
QString path = defaultPath;
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
@@ -381,7 +381,7 @@ void IWizardFactory::clearWizardFactories()
|
|||||||
s_areFactoriesLoaded = false;
|
s_areFactoriesLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<Id> IWizardFactory::pluginFeatures() const
|
QSet<Id> IWizardFactory::pluginFeatures()
|
||||||
{
|
{
|
||||||
static QSet<Id> plugins;
|
static QSet<Id> plugins;
|
||||||
if (plugins.isEmpty()) {
|
if (plugins.isEmpty()) {
|
||||||
@@ -394,7 +394,7 @@ QSet<Id> IWizardFactory::pluginFeatures() const
|
|||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<Id> IWizardFactory::availableFeatures(Id platformId) const
|
QSet<Id> IWizardFactory::availableFeatures(Id platformId)
|
||||||
{
|
{
|
||||||
QSet<Id> availableFeatures;
|
QSet<Id> availableFeatures;
|
||||||
|
|
||||||
|
@@ -83,7 +83,7 @@ public:
|
|||||||
void addRequiredFeature(const Utils::Id &feature) { m_requiredFeatures |= feature; }
|
void addRequiredFeature(const Utils::Id &feature) { m_requiredFeatures |= feature; }
|
||||||
void setFlags(WizardFlags flags) { m_flags = flags; }
|
void setFlags(WizardFlags flags) { m_flags = flags; }
|
||||||
|
|
||||||
QString runPath(const QString &defaultPath);
|
QString runPath(const QString &defaultPath) const;
|
||||||
|
|
||||||
// Does bookkeeping and the calls runWizardImpl. Please implement that.
|
// Does bookkeeping and the calls runWizardImpl. Please implement that.
|
||||||
Utils::Wizard *runWizard(const QString &path, QWidget *parent, Utils::Id platform,
|
Utils::Wizard *runWizard(const QString &path, QWidget *parent, Utils::Id platform,
|
||||||
@@ -111,8 +111,8 @@ public:
|
|||||||
const QVariantMap &extraVariables);
|
const QVariantMap &extraVariables);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSet<Utils::Id> pluginFeatures() const;
|
static QSet<Utils::Id> pluginFeatures();
|
||||||
QSet<Utils::Id> availableFeatures(Utils::Id platformId) const;
|
static QSet<Utils::Id> availableFeatures(Utils::Id platformId);
|
||||||
|
|
||||||
virtual Utils::Wizard *runWizardImpl(const QString &path, QWidget *parent, Utils::Id platform,
|
virtual Utils::Wizard *runWizardImpl(const QString &path, QWidget *parent, Utils::Id platform,
|
||||||
const QVariantMap &variables) = 0;
|
const QVariantMap &variables) = 0;
|
||||||
|
@@ -118,7 +118,7 @@ void BaseFileFilter::prepareSearch(const QString &entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ILocatorFilter::MatchLevel BaseFileFilter::matchLevelFor(const QRegularExpressionMatch &match,
|
ILocatorFilter::MatchLevel BaseFileFilter::matchLevelFor(const QRegularExpressionMatch &match,
|
||||||
const QString &matchText) const
|
const QString &matchText)
|
||||||
{
|
{
|
||||||
const int consecutivePos = match.capturedStart(1);
|
const int consecutivePos = match.capturedStart(1);
|
||||||
if (consecutivePos == 0)
|
if (consecutivePos == 0)
|
||||||
|
@@ -76,7 +76,8 @@ protected:
|
|||||||
QSharedPointer<Iterator> fileIterator();
|
QSharedPointer<Iterator> fileIterator();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MatchLevel matchLevelFor(const QRegularExpressionMatch &match, const QString &matchText) const;
|
static MatchLevel matchLevelFor(const QRegularExpressionMatch &match,
|
||||||
|
const QString &matchText);
|
||||||
void updatePreviousResultData();
|
void updatePreviousResultData();
|
||||||
|
|
||||||
Internal::BaseFileFilterPrivate *d = nullptr;
|
Internal::BaseFileFilterPrivate *d = nullptr;
|
||||||
|
@@ -47,7 +47,7 @@ using namespace Core::Internal;
|
|||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
ILocatorFilter::MatchLevel FileSystemFilter::matchLevelFor(const QRegularExpressionMatch &match,
|
ILocatorFilter::MatchLevel FileSystemFilter::matchLevelFor(const QRegularExpressionMatch &match,
|
||||||
const QString &matchText) const
|
const QString &matchText)
|
||||||
{
|
{
|
||||||
const int consecutivePos = match.capturedStart(1);
|
const int consecutivePos = match.capturedStart(1);
|
||||||
if (consecutivePos == 0)
|
if (consecutivePos == 0)
|
||||||
|
@@ -53,7 +53,7 @@ public:
|
|||||||
void refresh(QFutureInterface<void> &) override {}
|
void refresh(QFutureInterface<void> &) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MatchLevel matchLevelFor(const QRegularExpressionMatch &match, const QString &matchText) const;
|
static MatchLevel matchLevelFor(const QRegularExpressionMatch &match, const QString &matchText);
|
||||||
|
|
||||||
bool m_includeHidden = true;
|
bool m_includeHidden = true;
|
||||||
QString m_currentDocumentDirectory;
|
QString m_currentDocumentDirectory;
|
||||||
|
@@ -156,7 +156,7 @@ public:
|
|||||||
static Qt::CaseSensitivity caseSensitivity(const QString &str);
|
static Qt::CaseSensitivity caseSensitivity(const QString &str);
|
||||||
static QRegularExpression createRegExp(const QString &text,
|
static QRegularExpression createRegExp(const QString &text,
|
||||||
Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive);
|
Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive);
|
||||||
LocatorFilterEntry::HighlightInfo highlightInfo(const QRegularExpressionMatch &match,
|
static LocatorFilterEntry::HighlightInfo highlightInfo(const QRegularExpressionMatch &match,
|
||||||
LocatorFilterEntry::HighlightInfo::DataType dataType = LocatorFilterEntry::HighlightInfo::DisplayName);
|
LocatorFilterEntry::HighlightInfo::DataType dataType = LocatorFilterEntry::HighlightInfo::DisplayName);
|
||||||
|
|
||||||
static QString msgConfigureDialogTitle();
|
static QString msgConfigureDialogTitle();
|
||||||
|
@@ -76,7 +76,7 @@ private:
|
|||||||
void showPopupDelayed();
|
void showPopupDelayed();
|
||||||
void showPopupNow();
|
void showPopupNow();
|
||||||
void acceptEntry(int row);
|
void acceptEntry(int row);
|
||||||
void showConfigureDialog();
|
static void showConfigureDialog();
|
||||||
void addSearchResults(int firstIndex, int endIndex);
|
void addSearchResults(int firstIndex, int endIndex);
|
||||||
void handleSearchFinished();
|
void handleSearchFinished();
|
||||||
void updateFilterList();
|
void updateFilterList();
|
||||||
@@ -86,7 +86,7 @@ private:
|
|||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
|
||||||
void updateCompletionList(const QString &text);
|
void updateCompletionList(const QString &text);
|
||||||
QList<ILocatorFilter*> filtersFor(const QString &text, QString &searchText);
|
static QList<ILocatorFilter*> filtersFor(const QString &text, QString &searchText);
|
||||||
void setProgressIndicatorVisible(bool visible);
|
void setProgressIndicatorVisible(bool visible);
|
||||||
|
|
||||||
LocatorModel *m_locatorModel = nullptr;
|
LocatorModel *m_locatorModel = nullptr;
|
||||||
|
@@ -148,7 +148,7 @@ MainWindow::MainWindow()
|
|||||||
|
|
||||||
QApplication::setStyle(new ManhattanStyle(baseName));
|
QApplication::setStyle(new ManhattanStyle(baseName));
|
||||||
m_generalSettings->setShowShortcutsInContextMenu(
|
m_generalSettings->setShowShortcutsInContextMenu(
|
||||||
m_generalSettings->showShortcutsInContextMenu());
|
GeneralSettings::showShortcutsInContextMenu());
|
||||||
|
|
||||||
setDockNestingEnabled(true);
|
setDockNestingEnabled(true);
|
||||||
|
|
||||||
|
@@ -89,9 +89,9 @@ public:
|
|||||||
void addContextObject(IContext *context);
|
void addContextObject(IContext *context);
|
||||||
void removeContextObject(IContext *context);
|
void removeContextObject(IContext *context);
|
||||||
|
|
||||||
IDocument *openFiles(const QStringList &fileNames,
|
static IDocument *openFiles(const QStringList &fileNames,
|
||||||
ICore::OpenFilesFlags flags,
|
ICore::OpenFilesFlags flags,
|
||||||
const QString &workingDirectory = QString());
|
const QString &workingDirectory = QString());
|
||||||
|
|
||||||
inline SettingsDatabase *settingsDatabase() const { return m_settingsDatabase; }
|
inline SettingsDatabase *settingsDatabase() const { return m_settingsDatabase; }
|
||||||
virtual QPrinter *printer() const;
|
virtual QPrinter *printer() const;
|
||||||
@@ -117,16 +117,16 @@ public:
|
|||||||
void restart();
|
void restart();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void openFileWith();
|
static void openFileWith();
|
||||||
void exit();
|
void exit();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openFile();
|
static void openFile();
|
||||||
void aboutToShowRecentFiles();
|
void aboutToShowRecentFiles();
|
||||||
void setFocusToEditor();
|
static void setFocusToEditor();
|
||||||
void aboutQtCreator();
|
void aboutQtCreator();
|
||||||
void aboutPlugins();
|
void aboutPlugins();
|
||||||
void updateFocusWidget(QWidget *old, QWidget *now);
|
void updateFocusWidget(QWidget *old, QWidget *now);
|
||||||
|
@@ -1174,7 +1174,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse) const
|
void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse)
|
||||||
{
|
{
|
||||||
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
|
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
|
||||||
if (creatorTheme()->flag(Theme::FlatToolBars)) {
|
if (creatorTheme()->flag(Theme::FlatToolBars)) {
|
||||||
|
@@ -67,7 +67,7 @@ public:
|
|||||||
void unpolish(QApplication *app) override;
|
void unpolish(QApplication *app) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse) const;
|
static void drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse);
|
||||||
|
|
||||||
ManhattanStylePrivate *d;
|
ManhattanStylePrivate *d;
|
||||||
};
|
};
|
||||||
|
@@ -121,7 +121,7 @@ MagicData MimeTypeMagicDialog::magicData() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MagicData::operator==(const MagicData &other)
|
bool MagicData::operator==(const MagicData &other) const
|
||||||
{
|
{
|
||||||
return m_priority == other.m_priority && m_rule == other.m_rule;
|
return m_priority == other.m_priority && m_rule == other.m_rule;
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const MagicData &other);
|
bool operator==(const MagicData &other) const;
|
||||||
bool operator!=(const MagicData &other) { return !(*this == other); }
|
bool operator!=(const MagicData &other) { return !(*this == other); }
|
||||||
|
|
||||||
static QByteArray normalizedMask(const Utils::Internal::MimeMagicRule &rule);
|
static QByteArray normalizedMask(const Utils::Internal::MimeMagicRule &rule);
|
||||||
|
@@ -84,7 +84,7 @@ public:
|
|||||||
class UserMimeType
|
class UserMimeType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool isValid() { return !name.isEmpty(); }
|
bool isValid() const { return !name.isEmpty(); }
|
||||||
QString name;
|
QString name;
|
||||||
QStringList globPatterns;
|
QStringList globPatterns;
|
||||||
QMap<int, QList<Utils::Internal::MimeMagicRule> > rules;
|
QMap<int, QList<Utils::Internal::MimeMagicRule> > rules;
|
||||||
|
@@ -59,7 +59,7 @@ public slots:
|
|||||||
void slotHide();
|
void slotHide();
|
||||||
void slotNext();
|
void slotNext();
|
||||||
void slotPrev();
|
void slotPrev();
|
||||||
void toggleMaximized();
|
static void toggleMaximized();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void focusInEvent(QFocusEvent *e) override;
|
void focusInEvent(QFocusEvent *e) override;
|
||||||
|
@@ -159,7 +159,7 @@ QWidget *RightPaneWidget::widget() const
|
|||||||
return m_widget;
|
return m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RightPaneWidget::storedWidth()
|
int RightPaneWidget::storedWidth() const
|
||||||
{
|
{
|
||||||
return m_width;
|
return m_width;
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ void RightPaneWidget::setShown(bool b)
|
|||||||
m_shown = b;
|
m_shown = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RightPaneWidget::isShown()
|
bool RightPaneWidget::isShown() const
|
||||||
{
|
{
|
||||||
return m_shown;
|
return m_shown;
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
void saveSettings(Utils::QtcSettings *settings);
|
void saveSettings(Utils::QtcSettings *settings);
|
||||||
void readSettings(QSettings *settings);
|
void readSettings(QSettings *settings);
|
||||||
|
|
||||||
bool isShown();
|
bool isShown() const;
|
||||||
void setShown(bool b);
|
void setShown(bool b);
|
||||||
|
|
||||||
static RightPaneWidget *instance();
|
static RightPaneWidget *instance();
|
||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
void setWidget(QWidget *widget);
|
void setWidget(QWidget *widget);
|
||||||
QWidget *widget() const;
|
QWidget *widget() const;
|
||||||
|
|
||||||
int storedWidth();
|
int storedWidth() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *) override;
|
void resizeEvent(QResizeEvent *) override;
|
||||||
|
@@ -79,7 +79,7 @@ public:
|
|||||||
QString topLevel;
|
QString topLevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
Utils::optional<VcsInfo> findInCache(const QString &dir)
|
Utils::optional<VcsInfo> findInCache(const QString &dir) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(QDir(dir).isAbsolute(), return Utils::nullopt);
|
QTC_ASSERT(QDir(dir).isAbsolute(), return Utils::nullopt);
|
||||||
QTC_ASSERT(!dir.endsWith(QLatin1Char('/')), return Utils::nullopt);
|
QTC_ASSERT(!dir.endsWith(QLatin1Char('/')), return Utils::nullopt);
|
||||||
|
Reference in New Issue
Block a user