Commit Graph

446 Commits

Author SHA1 Message Date
Eike Ziller
a40e5b5382 Core: Save less settings
Try to not save settings that weren't changed from their default, and
make it possible for defaults to change in the future.

Task-number: QTCREATORBUG-24762
Change-Id: If469b72573791bc92ed535edf00271ef09b55386
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-12-11 08:02:57 +00:00
Alessandro Portale
b2a766a79a Don't access static functions/fields via instance
Courtesy of readability-static-accessed-through-instance

Change-Id: I71f54244f1e091315dac2943d9e1bfad6efa56a9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-19 08:42:14 +00:00
Eike Ziller
5cb5d8e585 Remove usages of Core::Id
It moved to Utils.

Change-Id: Ia4d12bb07db2d59b1cb084b2ebdea20e6e3b40ad
Reviewed-by: hjk <hjk@qt.io>
2020-09-21 13:06:21 +00:00
Antonio Di Monaco
6e4ca8b6af MainWindow: ask confirmation before closing Qt Creator
When working with multiple windows, pressing the close button multiple
times can close Qt Creator too.

This patch adds a system option, asking for a confirmation before
closing the IDE. By default it's not enabled.

Fixes: QTCREATORBUG-7637
Change-Id: Ifc5e8c97511f9227ce0634c8a7064d95775c76c2
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-08-14 14:19:45 +00:00
hjk
736e6eada0 Various Qt6 compile fixes
Task-number: QTCREATORBUG-24098
Change-Id: Ia0fe92d82d4477bd8f14ee25754b114316fc878a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-22 07:04:12 +00:00
Eike Ziller
6d97c1fcb1 Unregister deleted IContext objects automatically
Change-Id: I7b84c02c8fe1e7201431116e3d993792370fb942
Reviewed-by: hjk <hjk@qt.io>
2020-05-27 06:54:54 +00:00
Ville Nummela
1194340b85 Disable "Save All" when there are no documents to be saved
Fixes: QTCREATORBUG-22072
Change-Id: I6c84e0004d1ada27bfcec59f509d066f1b03ca2c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-30 07:52:40 +00:00
Eike Ziller
c8a2ea5433 Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/qmldesigner/components/curveeditor/detail/graphicsview.cpp

Change-Id: I2a0ccb84560174c5170d5baaff526c0e095f0ba0
2020-03-19 09:35:50 +01: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
Eike Ziller
ed5e6a4999 Add some additional shortcuts for actions
Add Cmd+Shift+- for decreasing font size on macOS.
Do not add Cmd+= for increasing size, because it conflicts with the
existing shortcut for "Replace and Find Next".

Sprinkle some Backspace shortcuts in addition to Delete for removing
items. There are (laptop) keyboards that either do not have a designated
Delete key (requiring Fn+Backspace) or where the Delete key is not
conveniently located/sized, and there is no benefit in making the
distinction in that case anyhow.

Fixes: QTCREATORBUG-706
Fixes: QTCREATORBUG-13733
Change-Id: I06274a9810b82800ec6158a883c95d2a7ae2465e
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-17 09:39:37 +00:00
Eike Ziller
a6d52a6e28 Move some actions to a "View" menu
A "View" menu seems to be what many users are looking for when they want
to show or hide panes/views, so move corresponding actions there.
Window management / split actions stay in the "Window" menu.

Fixes: QTCREATORBUG-23610
Change-Id: Id683addc681de99abb35697a735fdbc9dc0d00cd
Reviewed-by: hjk <hjk@qt.io>
2020-03-06 14:01:23 +00:00
Mahmoud Badri
fb843d3442 QmlDesigner: Remove the standalone view3D window implementation
Task-number: QDS-1692
Change-Id: I6c04aaee9ab6a119cfcc22ee2e19b808bb95ae0a
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2020-03-05 11:00:11 +00:00
hjk
95623ae011 Core: Apply new settings page pattern to Tool settings page
Since the code "belonging" to the widget was split across two
classes, but isn't now, a bit of moving was necessary.

Use the opportunity to remove now-unneeded undirections to the
model and ui members.

Change-Id: I25bb96de05c67d9116f28ae342d4aebd3c4419e6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-29 08:25:31 +00:00
Mahmoud Badri
1eb72aabef Fix Edit View 3D on top of Some widgets issue
setting the main window as the parent of a widget makes it open above
the Edit View 3D. Also other dialogs (open file dialog, options dialog,
etc) open above the 3D View now.

Task-number: QDS-1446
Change-Id: I6f6325d7b81eccb5aec3c07dfadc021a17dfd26b
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-16 12:25:19 +00:00
Eike Ziller
7c35c447e1 Set application details earlier
The application details (name, organization, etc) were only set during
Core plugin startup, but that is too late for e.g. the plugin manager.

Change-Id: Id47d79e38dec9e586ab7b91a3080101e5fecb20d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-01-14 08:16:52 +00:00
Eike Ziller
be19b00289 Provide "Restart Now" functionality
And use it for the plugin dialog and when changing the UI language.

Change-Id: Ic767837d2526409f7ec46d7e4612a1499f19459e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-01-07 12:46:59 +00:00
Mahmoud Badri
f97de35dd4 Improve edit view 3D "on top" logic
- Proxy dialog removed
- When the QDS window is minimized/maximized, the edit view 3D follows.
  The opposite is not true (edit view 3D can be minimized separately).
- Edit view 3D is always on top of QDS window. Only exception is when
  a popup is shown (so that the user can handle the popup).
- External apps go normally on top of the edit view 3D.

Known (non critical) issues:
- Activating the edit view 3D doesn't raise() the QDS window, so if an
external app is on top of the edit view 3D then the view is clicked,
the external app will be in between the view and the QDS window.
- Closing the edit view 3D from the x button doesnt work (causes a
  restart). This is not in the scope of this commit.

Task-number: QDS-1179
Change-Id: I1dd72590037be295b94735de96772307ba14c59c
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-12-13 12:40:43 +00:00
Kai Koehne
36ef280db5 Set QGuiApplication::applicationDisplayName property
This is used in user-visible strings e.g. in the analytics plugin.

Change-Id: I5942e915bccba01eb2c3d7049e2b789fff9e890a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-10-29 14:40:28 +00:00
Eike Ziller
b34102ceea Add option for shortcut visibility in context menus
Fixes: QTCREATORBUG-22502
Change-Id: I49587a6a8b575a3a1453104a829cd91ad3566d7e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-09-11 08:15:16 +00:00
Eike Ziller
c67ed4d35b Add global notification area and use for UI Tour info
Adds a global info bar display above the main window's status bar that
can be accessed via ICore::infoBar().

Replace the blocking "Take UI Tour" dialog by a notification there.

Fixes: QTCREATORBUG-22819
Change-Id: I733f1bfd2d1db0295754ed2e28bb202f927d0edb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-08-12 07:15:27 +00:00
hjk
4742216feb Core: Give a hint why saving of settings are requested
Not all requests are the same, handling code might want to act
differently on different request reasons.

Main driver here is the handling of the debugger/analyzer main window
state savings which depends on actual visibility of certain windows.

Change-Id: I87b2a9149e3d09d27bc14b44aace9f2e0686db04
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-03 08:25:41 +00:00
Eike Ziller
e0d38ae414 Export Wizard values to JavaScript macro
Registers a new function "value('name')", available to the wizard json
files, which returns the value of the variable "name" as a JavaScript
object. So, variables with a string value are actual JavaScript strings,
booleans are booleans, lists are lists, and dictionaries are
dictionaries.

The patch also makes it actually possible to assign JSON lists and
dictionaries to values.

This removes some hacks involving creating complex JavaScript objects
through string substitution.

Change-Id: I4ac6da22bc5bccc9fadee97694c2fa14d44c9307
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-09 11:19:43 +00:00
Eike Ziller
3c5650e514 Add macOS touch bar support
Introduce a generic Utils::TouchBar that implements a touch bar for
macOS based on QAction. Touch bars can be nested, and one is set to be
the application's top level touch bar.

Also add an ActionContainer for the touch bar. That allows us to manage
the layout of the touch bar the same way we do with menus.

Since the touch bar is an input device with very limited space, a
command in the touch bar needs to be specifically styled for the touch
bar by setting either touchBarText or touchBarIcon (or both).

Touch bars can be nested by nesting the ActionContainers. A nested touch
bar ActionContainer needs to specify an icon and/or text to show in the
touch bar button that opens that sub-bar.

Commands are only shown in the touch bar if they are valid within the
current context.

Implementation-wise we cannot use the standard NSPopoverTouchBarItem for
nesting touch bar levels. We cannot hide items in the touch bar, because
hidden items still take up space in the touch bar. So we need to rebuild
the touch bar regularly. Since the items we show are very dynamic, every
time the items in the toplevel bar change because of a context change,
any opened sub-level touch bar closes. That is why we maintain a stack of
touch bar levels ourselves, replacing the main touch bar with the current
level, and managing opening and closing the levels manually.

This patch adds buttons for Help, Bookmarks, Header/Source, Follow
(Symbol), Decl/Def, and a sub-bar for the debugger actions.

Fixes: QTCREATORBUG-21263
Change-Id: Ib63e610f21a993f1d324fe23c83a7f2224f434ac
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
2019-01-15 14:33:56 +00:00
Orgad Shaneh
9364e4b8ec Core: Modernize (minor)
Replace 2 loops with range loops, and use nullptr.

Change-Id: I9f8920bb978ed218c5ec9ca01105652ebb51d842
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-09-21 05:28:12 +00:00
Eike Ziller
2c17fbe8dd Make Core independent from QtHelp
We don't want various plugins to depend on the Help plugin,
but we also do not want Core to depend on QtHelp.
For example when turning the Help plugin off, documentation should
actually no longer be registered through QtHelp. So we need
parts of the interface in Core, which must then be delegated
to the actual implementation in Help.

As positive side-effects the interface in Core will be slimmer,
and the code in the Help plugin can later be simplified, too,
because then we don't have the "Core" and the "Gui" help engines
separated in different plugins anymore, which should remove the
need for some setup indirections.

Task-number: QTCREATORBUG-20381
Change-Id: I634c5811c45d6a3dfd6ddc682cae270e38384cbf
Reviewed-by: hjk <hjk@qt.io>
2018-09-04 11:21:18 +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
Eike Ziller
a8c5af56a9 Remove unneeded checks for validity of mime types
mimeTypeForFile(...) is documented to never return an invalid mime type
(it will fall back to binary if everything else fails), so remove
unneeded checks.

This also removes fallback code that used text/plain in case of invalid
mime type, which is probably a relict from the old mime implementation.

Change-Id: I88ed41fa3b81704f110f9f481b0f01424a487cbb
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-25 08:08:14 +00:00
Razi Alavizadeh
f009d5f151 CorePlugin: Switch split if remote command tries to open an already opened file
It seems more natural that remote commands
don't change current editor of active view if file
is already opened in another view.

Change-Id: Ie27de0d159cae6e63fa1d477fab59887a0e6d198
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-06-22 18:04:54 +00:00
Eike Ziller
6e66b2a078 Remove some lambdas from Utils::transform calls
It is often possible to user (member) functions or members directly.
That improves readablility and potentially reduces the total number of
symbols.
Also use qobject_container_cast at places where it is appropriate.

Change-Id: Ia2591bca356591e001e2c53eeebcf753e5bc3c37
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-05-28 13:45:20 +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
Eike Ziller
f1e02c0826 Fix that menus didn't show ampersands in files names
And instead interpreted the ampersand + following character as an
accelerator key.

Task-number: QTCREATORBUG-17817
Change-Id: I327239499ce56e75fd12f2df5be60d4b04913acd
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-03-26 12:02:15 +00:00
hjk
08ba8933c6 OutputPaneManager: Use a structure for related pieces
One vector with things handled together can be better
that keeping four vectors in sync.

Change-Id: I47865a5a2147a3795a3c820aa2676fb9611cab25
Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-03-22 11:38:58 +00:00
hjk
310a2bf96f Core: Simplify MainWindow::init() signature
And adapt its only user.

Change-Id: Ifc1f6c7857951d6e1a68f5bc909146e9689c5428
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-12 11:21:14 +00:00
hjk
7fea244019 Core: Remove a few explicit uses of the global plugin pool
Change-Id: I8627af8fa132b727450ee703910a39485eea58ad
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-12 10:41:22 +00:00
Eike Ziller
5432dd1f5c Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/plugins/coreplugin/locator/locator.cpp
	src/plugins/imageviewer/imageviewerplugin.cpp
	src/plugins/remotelinux/remotelinuxplugin.cpp
	src/tools/clangbackend/source/tokeninfo.cpp
	tests/unit/unittest/data/highlightingmarks.cpp

Change-Id: I74cc3ba3a2836cb9d0e65d3380d8c4f88d720c67
2018-02-07 11:58:23 +01:00
Eike Ziller
dcfa07ba76 ModelEditor: Move export actions to File menu
Only visible when a model editor is active

Change-Id: Ia21045188867b23815bd05432d1fd4699de8bd61
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-02-05 10:43:47 +00:00
Eike Ziller
e1d2d35c20 Unify zooming actions of image viewer and model editor
Change-Id: I5761ab579beda5b2cd0b725869ed216cb97e900c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-02-05 10:42:25 +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
974022c77b Core: Reduce code path ping-pong between ICore and MainWindow
Public entry points for displaying settings dialog were in ICore,
diverting to MainWindow, and back in some cases.

Move implementation to icore.cpp instead.

Change-Id: I02cbf1dcfe6241c665d7d701b4b4af1a8a242af5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-01 13:29:58 +00:00
hjk
4c285f957b Core: Move left navigation view toggle button back to the left
Change-Id: I3f2070c6f6633b851c88d9179a4a97be1c944a7a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-30 15:30:14 +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
3c91777e48 Core: Detach status bar handling from global object pool
Instead of relying on addObject notification, provide a
StatusBarManager::addStatusBarWidget() method to create,
register and keep track of an IContext object.

That's essentially what was StatusBarWidget before, but does
not need to be known on the user side. For removal, this
provides a StatusBarManager::destroyStatusBarWidget(),
any not explicitly removed items are handled in response
to ICore::coreAboutToClose()

The StatusBarManager class is fully static now, could
be a namespace.

Change-Id: Ia2bd13b391c3f68c8dfd584b53524a9649cc0787
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-26 10:20:38 +00:00
hjk
1963122dcd Core: Cut explicit interface between MainWindow and StatusBarManager
Mechanical in preparation of 'static pattern' and avoiding the
object pool objectAdded/objectAboutToBeRemoved use

Change-Id: I1e3fc7f67c785410686d0dc7c083024e305f4abe
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-24 14:53:58 +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
Eike Ziller
ca8b727e42 Attach progress details to the toggle progress details button
The popup is corresponding to the button (and the summary progress bar),
and that automatically also moves it away from the right border a bit.

Task-number: QTCREATORBUG-19308
Change-Id: Ie6f72f19552285586395776b175ca142f56c7d6e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-01-08 08:11:35 +00:00
hjk
cc88302309 De-emphasize PluginManager::getObjects<Type>()
... by additionally keeping local (currently non-owning) pools per
"interesting" type.

Current situation:
  - The global object pool does not scale well for looking up
    objects, as iteration plus qobject_cast typically iterates
    over all pooled objects.
  - User code that can use typed results from the object
    pool need to have access to the full type definition anyway,
    i.e.  depend on the plugin of the target class anyway.

The patch here solves the scaling problem is to have local
type-specific pools to which objects register in their
constructors and deregister in their destructors.

This patch here does *not* change the ownership model of the
pooled objects, however, it opens the possibility to change
the ownership model per type (e.g. by not putting things into
the global pool at all anymore and make the local pool 'owning')
and the intent is to handle that in later patchs.

Even without the follow-up patches this here is a performance
improvement for the cases that access the local pools instead
the global one, i.e. "practically all".

Change-Id: Ib11a42df2c4ecf5e1155534730083a520dd1995b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-12-15 07:08:05 +00:00
Ulf Hermann
47886969cc Drop unused variables and lambda captures
Also, add context to connect() expressions where we are or were
capturing "this".

Change-Id: I6e006ba6f83d532478018550d148ee93eca59605
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-09-08 09:06:53 +00:00
Tobias Hunger
4ef01c961e app_version.h: Make IDE name configurable
Change-Id: I993f452c8d09cf89e9a2958fc8e36b7d2c17ee6f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-05 10:19:48 +00:00
Eike Ziller
5cf580c1f3 macOS: Fix issue with saving settings (work around Qt bug)
When closing the application via Quit from the application's context
menu in the dock, Qt sends the closeEvent twice, leading to funny issues
(QTBUG-43344).
Remember if we already successfully went through the closeEvent, and
skip it in that case.

Task-number: QTCREATORBUG-18798
Change-Id: I8c54f0695b1af2572fa0ade7487a6a993022946b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-08-28 13:44:49 +00:00
Alessandro Portale
3624a663d8 Reduce usage of qApp in favor of static function calls
Q*Application classes have unusually many static functions. In many
cases in our code, these functions are unnecessarily called as instance
functions, using the qApp helper.

This patch replaces many occurencies of qApp with the according
Q*Application classname.

Change-Id: I6099a419fa7bf969891269c37ed7a9e817ef5124
Reviewed-by: hjk <hjk@qt.io>
2017-04-24 18:36:28 +00:00