Commit Graph

178 Commits

Author SHA1 Message Date
hjk
fd0f6fd5e6 Utils: FilePathify RemoveFileDialog
Change-Id: I3402fb7b44ec556d7de79d42b3ddcb606048780d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-19 04:29:46 +00:00
hjk
ef1653698e ProjectExplorer: Use FilePath for ProjectNode::{path,directory}
... and let the fallout trickle down a bit.

Change-Id: I1a2f79e281725c4a121cc2fbbc0377e881616ce5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-06 08:09:26 +00:00
hjk
906cfb060b Core: Use FilePath in some functions related to opening files
Change-Id: I9610855a914d315d7934996c755fb69ad399320f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-29 11:14:46 +00:00
hjk
9b250ea2c0 ProjectExplorer: Use FilePath in ProjectExplorer::openProject{,s}()
Change-Id: Ibfb7ab5ef7226b85452bd37b840408708935453b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-27 11:35:47 +00:00
hjk
1bde4ddbec ProjectExplorer: Use FilePaths in project tree nodes
Change-Id: I31b15c428d9b962333947b1e32641fd80f61d069
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-16 13:45:06 +00:00
David Schulz
f66df921d7 Core: filepathify file renaming
Change-Id: I3d4f39e34e65cde3df7b7c19570e3a54d0625d53
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-17 11:13:51 +00:00
David Schulz
410b02f8c5 Core: filepathify expected document changes
Change-Id: Ifa9341e55c79459db9ecef3c441da9b2816695bf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-17 06:30:51 +00:00
Alessandro Portale
afc2fda8a9 ProjectExplorer: Use qAsConst w/ non-const Qt containers in range-loops
Change-Id: I6422b3e40a6925504a231be2d47b3214d86c6e06
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-17 11:19:21 +00:00
hjk
824c30438b Project: Change File System view activation shortcut
From Alt+Y to Alt+Y,Alt+F. "Toplevel shortcut namespace" is a rare
resource.

Fixes: QTCREATORBUG-25124
Change-Id: I6268760f45e34f973b3b38b19d2577c0c655b000
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-06 09:22:37 +00:00
Alessandro Portale
267309b254 ProjectExplorer: Native dir in separators FolderNavigationWidget tooltip
Change-Id: I9abc43e407b70377fe398ded87518c1a5e5ccb19
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-12-22 11:08:18 +00:00
Eike Ziller
c898047880 ProjectExplorer: Don't save defaults to settings
Writes less settings and makes it possible to change defaults in the
future.

Task-number: QTCREATORBUG-24762
Change-Id: I73873b3684827b4fe27cfa5ea2f62a76003f9750
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-12-16 08:40:24 +00:00
Alessandro Portale
a3857a996a Don't access static functions/fields via instance
Courtesy of readability-static-accessed-through-instance

Amends: b2a766a79a

Round #2: This time done with Qt Creator's Analyzer, which
found other occurences than run-clang-tidy.py

Change-Id: I479e280c7abcf2d24baccbb0af69ae4bda05198e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-27 13:26:07 +00:00
Jarek Kobus
6d5e302157 Use typed syntax in calls to QMetaObject::invokeMethod
We do it wherever possible. Some places can't be fixed
since they still rely on dynamic introspection
(mainly QQuickItem cases).

Change-Id: Ia00b4a04d8b995c9a43b7bf2dbe76a60364bb8ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-16 13:45:02 +00:00
Eike Ziller
e5bb7d1ffe Remove unnecessary removeContextObject calls
They are removed on deletion now.

Change-Id: I08461ea4938e24ab450df013a0f8f820032381da
Reviewed-by: hjk <hjk@qt.io>
2020-05-27 08:42:00 +00:00
hjk
ddf0dd8734 Utils: Add a FilePath::isDir() convenience function
Change-Id: I1df0ee1b136299ae6e4f2e5bd0bdc24bfeca33dd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-11 12:46:10 +00:00
Ville Nummela
63e4180242 ProjectExplorer: Add special handling for removing files
... from a project which are pulled in via wildcards.
Such files cannot be removed from a project file, because they are
not listed verbatim. This kind of failure should not be reported to the
user if the file is also deleted, as the file list will have the correct
state after the next reparse.

Fixes: QTCREATORBUG-22586
Done-with: Christian Kandeler <christian.kandeler@qt.io>
Change-Id: I3dc66fe9a6594be7d0b86f46d830cd099ee49fd7
Reviewed-by: hjk <hjk@qt.io>
2019-06-25 11:53:58 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
hjk
19e1cf1520 Replace uses of qVariantFromValue with QVariant::fromValue
Deprecated in Qt 5.14, alternative has been around since Qt 4 at least.

Change-Id: I4e3a53c289088368609e0d0ce2405a832d311308
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-05-27 12:33:29 +00:00
hjk
88c495976c Utils: RemoveFileName::{size,count,length}
Use .toString().{size,count,length} instead.

Change-Id: Ib697155f441a8297fb179921bcd3397719a44073
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-10 12:36:27 +00:00
hjk
729c74379a ProjectExplorer: Merge Node::isFileNodeType and asFileNode
They were identifying the same set of nodes.

Change-Id: I3316cbc434ff740547bcf0baf9e5f1544f6e3f56
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-03-01 08:44:22 +00:00
hjk
ad4e2562fa ProjectExplorer: Replace Node::setNodeType by virtual functions
Not the usual direction of change, but currently there are
several systems to identify or invoke node functionality.

Virtual functions are likely to stay in this context, so this
here attempts to help consolidation by reducing the influence
of the node type flags, hopefully leading to full removal
by making remaining functionality available through the
other mechanisms (virtual functions, asFooNode() 'casts',
less so the FileType flag).

Change-Id: I12a17ce30b3c8883995b29b4720408020ee0fa3e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-03-01 08:32:14 +00:00
hjk
6f37348b4c Replace static_casts by QOverload where possible
Mainly to get rid of the QProcess::finished deprecation warning.

Also adjust coding style in the surrounding connects when needed.

Change-Id: I12f9b248c7974b892c4a069356e578e80f8c59e9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-26 15:18:14 +00:00
Eike Ziller
8eac37ae76 Fix crash when renaming file in file system view
Do not actually rename while iterating through the folders, first test,
rename later.
Fix-up of 0c9c747d92 which looks like it
actually tried to do that, but confused the two method calls.

Fixes: QTCREATORBUG-21741
Change-Id: I779e526e76651b61ffc75be6b4dfce1765bb758b
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2018-12-20 15:20:31 +00:00
Eike Ziller
d1430c9542 Merge remote-tracking branch 'origin/4.7' into 4.8
Change-Id: I6780d8103a88e31f42c674a96d0f6bcbba16e4bb
2018-10-24 13:39:21 +02:00
Eike Ziller
e3021b7178 Fix crash in folder navigation widget
We want to delay updating the crumble path, but we may not keep and pass
around the QModelIndex, since that can become invalid.

Change-Id: Id0c1ffb046dda1fb3bc09801fd1952787f9919fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-10-23 05:46:25 +00:00
Eike Ziller
9f60cdcdaa Merge remote-tracking branch 'origin/4.7'
Change-Id: I15962a85b0cc37c5a00e15ef7eac0445aad6c295
2018-08-20 09:05:18 +02:00
Eike Ziller
4e1a3b0029 File System View: Fix scroll position and bread crumb in some cases
Use a model index from the right model, and update the bread crumb, when
updating the scroll position delayed, for the case where the directory
for the file was not already loaded in the file system model yet.

Broke with introduction of the folder vs alphabetic sorting.

Task-number: QTCREATORBUG-20897
Change-Id: Ifc912184b4910ed546c0141044eead3650b98c87
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-08-15 12:29:44 +00:00
Eike Ziller
db9837fa6c Merge remote-tracking branch 'origin/4.7'
Conflicts:
	src/plugins/clangtools/clangtoolruncontrol.cpp
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: Ib1e8abf066898b50c90fc1ccba4697fe983e8a8f
2018-08-15 13:53:28 +02:00
Eike Ziller
58747b2de1 Fix hiding file system view's bread crumb
When hiding the bread crumbs in the filter option dropdown, there was
some spacing and the separator line left.
With this patch, the spacing and line are hidden too, making the layout
nicer and more similar to before the bread crumbs feature existed.

Task-number: QTCREATORBUG-20733
Change-Id: I560b4414804c8cd25e88d645aa3042acb1b8e06c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-15 09:41:14 +00:00
Alessandro Portale
8d19333075 ProjectExplorer: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default
modernize-use-transparent-functors

Change-Id: Iebed22caa2e733d292f334e956e3d16b844e14e3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-16 10:01:53 +00:00
Eike Ziller
dfd2dcb156 Add Collapse All action to context menu of file system view
Task-number: QTCREATORBUG-19212
Change-Id: Ia8771a27dbcf77c956f013ed001c7890d6fe6e9a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-18 15:12:32 +00:00
Eike Ziller
845541c89d Fix compiler warning
Some compilers are picky with types used in ternary operators

Fixup of d44ed66a9f

Change-Id: I73b64592b7741269c6d3631fd0b14cd99c4a3c2a
Reviewed-by: hjk <hjk@qt.io>
2018-04-13 10:56:05 +00:00
Eike Ziller
d44ed66a9f File System View: Add option to show folders on top
Task-number: QTCREATORBUG-7818
Change-Id: I37a36a03c9baf6fba7b3eedcb52ee5912a57a47a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-11 06:51:48 +00:00
Eike Ziller
6f91ce1c52 File System view: Add "New Folder" to context menu
Task-number: QTCREATORBUG-17358
Change-Id: I64b3d34ca0432369630382c40cf749f3cc1a08df
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-11 06:43:26 +00:00
Eike Ziller
7ba225cb79 Merge remote-tracking branch 'origin/4.6'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: Ifd9524b0155067faf9d8a90858cc5f7da6b651bf
2018-03-19 13:13:31 +01:00
Eike Ziller
6e7540988e Fix scrolling in file system view
The style can set the scroll bar to scroll by item, which breaks
the automatic scrolling that adapts for size changes of the bread crumbs.
Force the tree view to allow pixel-exact scrolling.

Task-number: QTCREATORBUG-19800
Change-Id: If61640a1b6e3b4a777269fb129bdc2689bad19c2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-03-16 09:47:11 +00:00
Nikita Baryshnikov
3eb71d95f8 ProjectExplorer: return back actions text
for Add New, Rename and Remove File actions.

FolderNavigationWidgetFactory::registerActions with empty action text is
called before ProjectExplorerPlugin::initialize with proper action
registration

Change-Id: I719f58735d672ad0831162a5f0cccebf73354976
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-03-09 10:16:12 +00:00
Eike Ziller
d47237084d Make syncing of root in file system view optional
Unconditional syncing of the root if editor syncing is enabled
can make usage of Computer/Home/Projects root inconvenient,
because selecting a file from an open project navigates away
from that wider-scope root.

Task-number: QTCREATORBUG-19322
Change-Id: I34f282590b3e1dfe228f5481b5612753816cc114
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-03-07 15:31:07 +00:00
Eike Ziller
7c3cfa166d Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/plugins/coreplugin/helpmanager.cpp

Change-Id: I2feb60ec0afb2f22f75dc137a01c3fa217b299d8
2018-02-23 10:56:52 +01:00
Eike Ziller
912d4616f5 File system view: Fix that bread crumbs could hide selected top item
If the current item is at the top, and the bread crumbs widget needs
more space, we may not just scroll, because that would scroll the
current item under the larger bread crumbs widget. We have to do the
delayed layouting in that case.

Task-number: QTCREATORBUG-19800
Change-Id: I93072c1932099501e99963220efdd975c255f586
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-02-22 07:04:49 +00:00
Eike Ziller
d55271bc50 Increase timeout for relayout in file system view
Possibly a bit less annoying in case this happens.

Task-number: QTCREATORBUG-19800
Change-Id: Ib4fe1cb577ff493a5e7a563d22b645889ce71e88
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-02-19 11:35:57 +00:00
Eike Ziller
41efaf1253 Fix translation issue
The model doesn't have a translation context and it makes more sense to
use the one from the widget anyhow.

Change-Id: I9847e4651bc7482c1e460fddd9c6890178f806bd
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-02-19 09:16:44 +00:00
Eike Ziller
36ccfbc8a7 Add option to disable bread crumbs in file system view
Looks like some people are annoyed by it, and another checkable action
for it is little effort and little clutter.

Change-Id: Ia2f3a070b30890e239f7f0a6ad859afc44c62016
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-02-13 13:28:49 +00:00
Eike Ziller
c7fdb93865 Merge remote-tracking branch 'origin/4.6'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp

Change-Id: I2445882a270731b866b04f28ff87d161224c539a
2018-02-13 13:37:37 +01:00
Eike Ziller
e6e7f8015c Use constants for settings keys
Change-Id: I81449a208840b4b00442e197501f13a0986fa1c5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-02-13 11:21:32 +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
Eike Ziller
44ee8b9068 Add "Add New..." to file system view
Since we do not have a specific project node where to add the file(s),
the user has to rely on the guess that is already done by the project
management wizard page.

Task-number: QTCREATORBUG-19213
Change-Id: I4ee2f81cd7b8d7ac2391d2c11eb53a695968233c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-12-19 09:12:47 +00:00
Eike Ziller
7b6943e578 Add "Remove File" to file system view
Task-number: QTCREATORBUG-19208
Change-Id: Iacf1e1468018fa8dd3426bc1325f36bb39a4b4e2
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-12-12 10:50:29 +00:00
Eike Ziller
0c9c747d92 Add "Rename" to file system view
Renames the file on disk, notifies editors, and tries to change the file
in all open projects that had it (and support renaming).

Task-number: QTCREATORBUG-19209
Change-Id: I165e9468c7235f9f503a3820bda3eb00f3c086d0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-30 14:43:41 +00:00
Eike Ziller
cf781640cf Fix that double-click in file system view sometimes does not work
When clicking on an item that changes the height of the crumble path, a
double-click has great chances of not succeeding, because before the
second click, the item might move away from under the mouse.

If the tree has a scroll bar that can move wide enough, we solve that by
scrolling the tree such that the same item remains under cursor when the
crumble path height changes. (We have to synchronize the scroll bar
value change with the relayouting though, to avoid flicker.)

If there is no scroll bar, or it cannot move enough in the needed
direction, we delay the re-layouting by the maximum double-click
interval to guarantee a double-click will still have the same item under
the mouse.

Change-Id: I3b296925d9be2d2ab5affbbb64df67173d9715d4
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-24 12:51:44 +00:00