Commit Graph

116 Commits

Author SHA1 Message Date
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Artem Sokolovskii
54628488a4 CorePlugin: Remove foreach / Q_FOREACH usage
Task-number: QTCREATORBUG-27464
Change-Id: I0d0257bbd46f3eec9b11b386d1987156e83a9dac
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-05-04 07:42:45 +00:00
Eike Ziller
e84bc5f81f Modes: Temporarily re-add a removeMode function
Partially reverts 6a142dfd95

Looks like this was used by 3rdparty plugin(s) for a mode that is only
useful for some time and then should not be shown again.

Re-add removeMode from before 5.0, but do not trigger that automatically
from the mode destructor, so it doesn't interfere at shutdown.

This patch is just a binary compatible partial revert. Since removeMode
is broken in several aspects (e.g. corresponding commands are not
removed) and we don't really support adding and removing modes during
runtime, this should be replaced later on by a different way to handle
the usecase, like a "visible" property for modes, which could be useful
in other ways too.

Fixes: QTCREATORBUG-26270
Change-Id: Ief2a36d94bd09b0511a14f528b33fdbcc4c4222b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-09-24 06:45:28 +00:00
Jarek Kobus
6a142dfd95 Fix the "Cannot remove a null widget" warning
After the 867c0b8d8a53974074b1fff5b132f3ae9f150066 got integrated
into qtbase, Qt started issuing a warning on Creator shutdown.
The reason is that mode's widget might be deleted before the
mode's destruction. Deleting the mode's widget removes it automatically
from the contained stacked layout of the mode manager. This
means that the indices inside the stacked layout and those inside
the ModeManager's d->m_modes list are now out of sync.
FancyTabWidget::removeTab() can't find the right widget for the
passed index now or returns wrong widget for it.

The fix is to remove removeMode() method (and in turn some more
unused now). The context objects don't need to be removed on
shutdown, and the remaining mode's widgets will be deleted
by Qt itself when the main windows is destroyed.

Fixes: QTCREATORBUG-25925
Change-Id: I70c2773eea2984c5d06ce3bf71a4271b267efbe0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-30 11:41:34 +00:00
Alessandro Portale
72d91dc94a Use qAsConst with non-const Qt containers in range-loops
... in various places

Change-Id: Ic6c0c1b9437a1ed402105c7a14a1f5f9454a68d4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-02-17 14:43:29 +00:00
Eike Ziller
415365dcc3 Fix ModeManager documentation after move of Id
Change-Id: Idd08616fa8e40703ec040152ec51a294ed9740c7
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-09-24 12:33:57 +00:00
Eike Ziller
1de74cceab Merge remote-tracking branch 'origin/4.13'
Change-Id: I015bac0cccdf466a923c706abdedd8bd8800b0cd
2020-07-06 10:30:54 +02:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
Eike Ziller
d9e9d783a6 Complete documentation on Core::ModeManager
Change-Id: Id1890a851e5a448665141093f49874546b785da6
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-07-03 12:13:05 +00:00
Eike Ziller
fa16071ca8 Fix "Header" documentation in Core plugin
Change-Id: If3cbe51b47a3acba32429894dfb5154cd573967d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-06-15 07:55:39 +00:00
Leena Miettinen
eecd2a5aa1 Doc: Fix QDoc warnings in Core plugin classes
Task-number: QTCREATORBUG-23620
Change-Id: Idf1fb2b3f930812c3cf18b9f8ced03fb8e0947be
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-18 13:39:43 +00:00
Christian Kandeler
e90a48e639 ProjectExplorer: Fix some problems with plugin unloading
It was not possible to return false from
ProjectExplorerPlugin::initialize() without triggering crashes.

Change-Id: I96b2f80c835e69769f64f9b9c61f473e9ff88623
Reviewed-by: hjk <hjk@qt.io>
2019-10-16 08:16:23 +00:00
Eike Ziller
8fa449126c Fix context of Locator input
- In the main window, the locator input (actually the status bar)
  visually feels like being part of the mode widget, so give
  it its context.
- In extra editor windows, the whole editor window should have
  "editor manager" context, so that is also active for the locator
  input.

Task-number: QTCREATORBUG-20626
Task-number: QTCREATORBUG-20071
Change-Id: Ib68d6a8177446572ea59c3cc057eca0706173e11
Reviewed-by: Xing Xiong
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-08-09 08:55:25 +00:00
Alessandro Portale
f36f04deba Core: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init (partially)

Change-Id: Idf10d7ffb1d98a04edc09a25c35e4e9e3abe87b5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-08-08 16:04:21 +00:00
Alessandro Portale
768f0a6209 Core: Icon-only option for the mode selection bar
This adds an icon-only mode to the mode selection bar (and action bar).
A newly introduced Action can cycle between icon+text, icon-only and
hidden.
Also, the "Window" Application menu gets a submenu with the three
styles.

Task-number: QTCREATORBUG-18845
Change-Id: I4e0c453f6d920dfbfd795b8b054f6ff392a8700a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-05-09 06:00:27 +00:00
David Schulz
0eb7bab20c Core: make useMacShortcut constexpr
Change-Id: I293b96428784b6efecac6dae4f2f9690af0027da
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-02 13:15:55 +00:00
hjk
be3f5123d6 Core: Use a ModeManagerPrivate::appendMode(IMode *)
... instead of adding-by-index. This amends 3d2db474.

Also, simplify the shortcut setting, the loop is not needed
anymore as the mode order is fixed now.

Change-Id: I87959f8b5bc5c3a0cd0ca240fb8709db75aed105
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-30 13:39:51 +00:00
hjk
3d2db474a4 Core: Force and rely on mode creation before extensionsInitialized
cf7f898db3 broke initial mode display due to the then-intentional
delay in registration. Now change the approach: Only record
the modes and the last requested start mode and do all remaining
setup triggered from MainWindow::extensionsInitialized.

This changes behavior insofar as only the last requested mode
on startup (typical Welcome, if Welcome not loaded, Edit) will
be activated.

Change-Id: I62b28342c347938b001c6d3be6a076c5a69b560b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-29 10:43:02 +00:00
hjk
cf7f898db3 Core: Keep track of modes in the ModeManager directly
... instead of having the indirection of the global object pool.

ModeManagerPrivate has been maintaining the list of instantiated
modes by tracking (all...) pool object additions / removals. This
can be achieved more directly by calling functions from the
IMode base constructor/destructor.

The pattern used deviates a bit from the otherwise used 'static
QList<Foo *> allFoos();' acessor pattern as there is some sorting
logic etc. associated each time a mode is appended.
Sticking to the preexisting structure seemed less effort for now.

Change-Id: Ic1b4e641e155f949248890acc48cafbe74025115
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-24 10:12:50 +00:00
Tobias Hunger
e492ee2b14 Core: Simplify code in ModeManager
* Fix a possible nullptr access while at it.

Change-Id: I24ba1d5ebf9873059526aa8cf7974960c6fd4c8a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-12-05 16:22:04 +00:00
Ulf Hermann
abcdadd40e ModeManager: Don't set the mode if we are already in the right one
Setting the mode means resetting all of the UI and repainting the
whole window. This can be painfully slow if the window contains some
large graphical objects, like QML profiler trace.

Change-Id: I64835de49e482826a54e3a844d59bc747ca38370
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-08-23 13:30:59 +00:00
Eike Ziller
685bc2cca1 Support modes with context menus.
If modes provide a QMenu, a little arrow is shown next to the mode icon.
If the user clicks there, the menu is shown instead of changing the
mode.

Limitations: Modes need to provide some QMenu instance already when they
are added to the object pool. Setting or removing the menu later will
not update the UI.

Change-Id: Ic4ef709e6200afcff14f41054a5dd98c37b0b849
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-05-27 09:24:02 +00:00
hjk
6fc7fb5f57 Core: Use Id() instead of 0 for invalid modes.
Fixes a regression introduced in 5e47d35.

Change-Id: I73dbf34008b616ee70b3ac8024af0197b8273a83
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-04-11 09:35:19 +00:00
hjk
5e47d35fcd Use Core::Id in ModeManager interface
Makes it more uniform to use and allows placeholder widget
creation to be independent of mode creations.

Change-Id: I4021bc9db7f8c78f0374c0cc3b3331506959afe4
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-04-08 10:38:49 +00:00
Orgad Shaneh
5646480f27 Core: Use Qt5-style connects
The heavy lifting was done by clazy.

Change-Id: I2dde14919d917816d02117338205f8f861d8af0a
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-03 07:54:02 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
hjk
12461c4110 ModeManager: Remove one use of Id::fromUniqueIdentifier and Co.
Change-Id: I9013d5de89e40fc60a5f021088fb7213eea3dc03
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-06-23 09:59:27 +00:00
Eike Ziller
c2c18b3c8e ModeManager: Remove old API that was used by old progress manager
Change-Id: Ia4083beb0b4a3eddc906af1b79e8bd5e6a36e47b
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-04-23 07:35:54 +00:00
Friedemann Kleint
54da18eaaa Clean exported headers of the Core plugin.
Change-Id: I26472d568844d5fee62323e01f5c5c12082d5450
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-03-05 07:18:14 +00:00
hjk
7f001dab1b Core: Make Context parameter to registerAction optional
... and default to C_GLOBAL. A rather common case.
Similar for ActionContainer::addSeparator().

Change-Id: I7f9ba573af201c0a472132d5a494ad17cc4175b7
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-02-26 10:09:03 +00:00
Eike Ziller
3c85058694 Update License
Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2015-01-16 12:37:56 +01:00
hjk
c81f31c72f ModeManager: Make instance return a ModeManager * again
Better for Qt5-style connects.

Change-Id: I37353c4b7697c8bb32f0cf13e2721ba78da904cd
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-10-15 22:42:56 +02:00
Eike Ziller
8295b503be License update
Change-Id: I3c22ef2685d7aa589f5d0ab74d693653a4c32082
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2014-10-09 11:41:44 +02:00
Orgad Shaneh
f81b407ca0 Core: Revert function signature change
Breaks BC with MSVC2010.

This partially reverts commit fe8ed7f5a6.

Change-Id: I36f995f992f3d12f16900c6dbe1dc94123c188bd
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-09-30 10:50:13 +02:00
Daniel Teske
fe8ed7f5a6 Session: Fix saving session data on shutdown from project mode
This was broken in d52ee686d1.

Task-number: QTCREATORBUG-13098
Change-Id: Ia075e13fdd00e561b78058a3cab0cb02d2eb5fe6
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-09-26 13:35:57 +02:00
Daniel Teske
d0e54d8e55 ModeManager: Simplify ::objectAdded/objectRemoved
No-one is using the aggregated IMode, everyone is deriving from IMode

Change-Id: Ic4f21ce983924afe80cc2180101aae838b9f590d
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-05-08 14:11:29 +02:00
Oswald Buddenhagen
52bf71fbdf Merge remote-tracking branch 'origin/3.1'
Conflicts:
	README
	tests/auto/debugger/tst_dumpers.cpp

Change-Id: Ib9aef37a246bc3bb9bca0c32a902af3b09ef3146
2014-03-11 13:39:55 +01:00
Eike Ziller
d52ee686d1 Save settings less aggressively.
Remove saving settings on auto-save, and only save settings when
switching away from projects mode, instead of any mode switch.

Change-Id: I3369b7f5ee785467d57c47e1a194a8ef989b98fb
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-03-07 15:52:04 +01:00
Eike Ziller
e58c1ab06e ActionManager: Remove QShortcut registration API
Registering QShortcuts doesn't solve any problem that is not already
solved by registering QActions, and shortcuts are in fact much more
limited (not being able to register multiple shortcuts for different
contexts).

Change-Id: I9478e601b2cbc3c5e12fb5baee43cacc20d0fb9c
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-03-03 13:07:28 +01:00
Eike Ziller
b844ef43fe Avoid raising the main window after loading project
This is especially annoying when starting Qt Creator with a session or
project from the command line.
ModeManager::setFocusToCurrentMode() should really only set the focus.
Callers that also want to raise the main window (none at the moment)
should do that explicitly.

Change-Id: Ib9c3026184bd25a6e2cd4bb557bd9981ce91d569
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Niels Weber <niels.weber@digia.com>
2014-02-20 13:40:50 +01:00
Robert Loehning
746c5d8863 Incremented year in copyright info
Change-Id: Ib5423fdd064e4546f848c0b640b0ed0514c26d3a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-01-08 08:29:47 +01:00
hjk
71affce4e4 ModeManager: Force use of static interface
Change-Id: I314ca347fd0fad30bf5ac6a6d4c67db8e5687065
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-08-30 13:30:29 +02:00
Eike Ziller
7c8db79817 Switch less often to edit mode
This change
* Removes IMode::type, ModeManager::activateModeType, and
  IEditor::preferredModeType, and adds IEditor::isDesignModePreferred
  instead
* Adapts the mode switching code in EditorManager to handle multiple
  windows, for example switching to edit mode should only happen if
  the editor/view is in the main window. Otherwise the editor window
  should be raised and focused
* Renames EditorManager::NoActivate --> DoNotChangeCurrentEditor
* Reverts the EditorManager::ModeSwitch logic to switch mode or
  make the current editor visible by default, introducing
  DoNotMakeVisible flag instead
* Fixes a few instances where EditorManager::ModeSwitch should have been
  used

One non-trivial problem left: If you open a .ui file and switch to an
external editor window, edit mode is activated, because the current
editor no longer is a .ui file, which means that the design mode gets
deactivated.

Change-Id: I76c5c2391eb4090143b778fb103acff3a5a1ff41
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-06-05 09:43:14 +02:00
Eike Ziller
9ff6490dfc Save mode visibility in a separate property.
Instead of using the actual visibility state of the widget, which might
have screwed things up if for some reason the widget itself was not
visible the moment settings are saved.

Change-Id: I7ae89259dc925f799bca413b537b65e9e689e1b7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
2013-06-03 12:35:36 +02:00
Eike Ziller
2bfcb47d63 Add an action to show/hide the mode bar on the far left.
Change-Id: If7a74eed7fc77b1d0fd5e4045671b3767fe2d7a2
Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
(cherry picked from commit bde0627e59)
2013-05-21 15:07:03 +02:00
Eike Ziller
838c0ad956 Make a few more shortcuts/actions raise the main window.
Also make registerShortcut set an application shortcut.
That is necessary when the user opened a separate editor window.

Change-Id: I366044b7acba51daca46a15a302a24b5b8e99cc1
Reviewed-by: David Schulz <david.schulz@digia.com>
(cherry picked from commit 5c8f46d25d)
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-05-21 15:06:38 +02:00
Friedemann Kleint
cf5e615f6d Clean headers in Core-plugin.
Change-Id: Ie79d334765ca5c6a034fa2f5eccff5d45b481975
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-03-27 09:31:54 +01:00
Oswald Buddenhagen
1fda2111d4 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in
	src/plugins/debugger/qtmessageloghandler.cpp
	src/plugins/debugger/qtmessagelogwindow.cpp
	src/plugins/madde/maemodeployconfigurationwidget.cpp
	src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
	src/plugins/qmldesigner/designercore/include/widgetqueryview.h
	src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
	src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
	src/plugins/qnx/bardescriptormagicmatcher.h
	src/plugins/qt4projectmanager/profilekeywords.cpp
	src/plugins/remotelinux/deployablefilesperprofile.cpp
	src/plugins/remotelinux/deployablefilesperprofile.h
	src/plugins/remotelinux/deploymentinfo.cpp
	src/plugins/remotelinux/deploymentsettingsassistant.cpp
	src/plugins/remotelinux/profilesupdatedialog.cpp
	tests/auto/icheckbuild/ichecklib.cpp
	tests/auto/icheckbuild/parsemanager.cpp
	tests/auto/icheckbuild/parsemanager.h

Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
2013-01-31 16:25:33 +01:00
Robert Loehning
298531e370 Incremented year in copyright info
Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-01-29 16:27:03 +01:00
hjk
42c16ff7d3 Core: Use the new Id methods in a few places
There are a lot more left.

Change-Id: I97d32629aa6deef0f4819f70cc0b8437f2814257
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2013-01-17 10:57:22 +01:00