Commit Graph

251 Commits

Author SHA1 Message Date
Eike Ziller
e57b797342 ImageViewer: Add button for saving current view settings as default
Fixes: QTCREATORBUG-27816
Change-Id: I85806634ea9f10761d281ab8c8cf892dd1b65145
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-15 11:28:41 +00:00
Eike Ziller
2bfc8173e5 ImageViewer: Make "Fit to Screen" sticky
Instead of "Fit to Screen" being a single-shot action, make it a
property that sticks as long as the image is not resized by the other
buttons or the mouse wheel. Meaning that it will resize to the screen
when the viewer size changes as long as the property is on.

Task-number: QTCREATORBUG-27816
Change-Id: I3b790dd7f94e4b964a734658dac4a637c8105b84
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-15 07:45:39 +00:00
Eike Ziller
2c51e4bc17 FilePath: Return optional bytearray for file contents
For differentiating between "error" and "empty file".

Change-Id: I2c019ceac625e7be3180afa4d47ae3a24df91c1d
Reviewed-by: hjk <hjk@qt.io>
2022-09-12 11:57:04 +00:00
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
Jarek Kobus
e32ebe2146 Drop Qt5: Various plugins: Get rid of QOverload
Change-Id: I4913044f8897fd3449dbb537e4af6785eb3ad447
Reviewed-by: hjk <hjk@qt.io>
2022-07-20 13:52:38 +00:00
hjk
3de1fffbeb ImageViewer: Convert to Tr::tr
Change-Id: Id12dc265ed60be942ec68ac5a80f57144c2d086f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-12 13:37:00 +00:00
Christian Stenger
a74582a9d3 Fix qbs build
Amends b338405477.

Change-Id: I2b63dacba611b24fa9df45dd707484b1de1a3233
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-12 07:36:35 +00:00
hjk
917d7e0007 ImageViewer: Inline imageviewertoolbar.ui
Change-Id: Ie7b4c77477ce78107c5f55edccdcbd4db74b010b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-11 09:58:09 +00:00
hjk
9e363c6421 Add plugintr.h files to all plugins
Except FakeVim, which had it before.

for i in [a-eg-z]*/*.json ; do
    upper=${i##*/}
    upper=${upper/.json/}
    lower=${i%/*}
    trfile=$lower/${lower}tr.h

    cat << EOT > $lower/${lower}tr.h
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/

namespace $upper {

struct Tr
{
    Q_DECLARE_TR_FUNCTIONS($upper)
};

} // namespace $upper
EOT

    git add $trfile

    perl -pi -e "s/(${lower}_global.h)/\1\n    ${lower}tr.h/"  $lower/CMakeLists.txt

    perl -pi -e "s/(\"${lower}_global.h\",)/\1 \"${lower}tr.h\",/"  $lower/$lower.qbs

done

Change-Id: I15ebbaaa9443c57b391b9e143f592d8a0c9208a9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-27 13:34:57 +00:00
Tasuku Suzuki
8a6c033ede Imageviewer: add button to copy image as data url
Change-Id: Ia30751ebb9b567b22de9d1256bb59aa2116366ba
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-05-24 16:57:41 +00:00
Eike Ziller
cd8c4ced81 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: Ic02df53b880d0861d9d9ea0df3e0d381ae99f350
2022-03-11 09:50:48 +01:00
Eike Ziller
897907f401 ImageViewer: Handle invalid SVGs and GIFs nicely
Fail opening the file in the image viewer, like we do for other images,
so Qt Creator can offer a different editor (binary editor).

We have separate code paths/backends for SVGs and movies (including
GIFs), which didn't catch invalid images early.

Fixes: QTCREATORBUG-27121
Change-Id: I1bfbca70b7d76ee9cac3e0f35494b62e3856069e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-03-02 07:48:33 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
  utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
  wrappers, that also includes the "public" headers for MimeType et al
  from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
  utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
  back to utils/mimetypes/mimedatabase.h

Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 07:19:58 +00:00
Christian Kandeler
52e26a360b Fix newly introduced warnings
Change-Id: I0b9cf3496d536e1173fbd6587e5b491305eb876c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-23 15:26:31 +00:00
Katarina Behrens
dbfd226e85 Imageviewer: zoom in and out using fixed set of common-sense zoom values
Previously scale factor for zoom in/out was calculated as

$(currentScaleFactor)^1.2

This results in weird zoom levels such as 83.3% or 144%. Replace this
approach with using pre-defined set of 'normal' zoom level values
such as {25%, 50%, .. 100%, 150%, 200% .. }, similar to what most
graphic editors do

To find the nearest greater or lesser fixed zoom level for any given
floating point scale factor I borrowed some code from qmldesigner/
timelinewidget

I didn't know what to do with zooming using mouse wheel so I left the
old code in place

Change-Id: Id037ef99f89cce5e8dcd58bb9ad0e6f3c8536f36
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-01 17:11:30 +00:00
Eike Ziller
9d8a419d10 Remove qmake build files
Removes qmake as a build system for building Qt Creator itself.
Keep them for some tests that are not completely moved to CMake yet.

Change-Id: I846c6ef65626b6dfae6375fdc85d00677aa8c2fb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-20 12:18:15 +00:00
Eike Ziller
7bb21fcfff Merge remote-tracking branch 'origin/5.0' into 6.0
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I87b19a51b1950d19eff95086848b0728ba2f0ebd
2021-10-08 15:58:02 +02:00
Eike Ziller
69fbe0ab90 ImageViewer: Fix crash when opening invalid movie
Qt 6 sends the finished signal directly from QMovie::start, so if we
connect QMovie::finished directly to QMovie::start, we end up in
an endless recursion and stack exhaustion.

Use a queued connection, and do not restart a movie if it went
invalid.

Fixes: QTCREATORBUG-26377
Change-Id: I9980615f44d0cf7e92f85c010427bd6b67046949
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-07 13:26:58 +00:00
hjk
7c28c4f744 Utils: Introduce a FilePath constructor from char arrays
Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for
decorations in user code.

At the same time, drop some convenience constructors and functions
in CommandLine and Icon essentially serving the same purpose.

Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 05:34:10 +00:00
David Schulz
e13c2b7403 MimeDatabase: add FilePath convenience function
Change-Id: I59c825490b3b5c49f3c177584ea4cc885c4f920b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-23 12:03:28 +00:00
David Schulz
665c090039 Core: filepathify IDocument
Change-Id: I364a80d070c5f90433309c281c4906ee101a1a1a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-19 09:45:22 +00:00
Christian Kandeler
7cc2b149b1 qbs build: Make ImageViewer build with Qt 6
Change-Id: If934d2df162e043102ba65d9c3de4fb7fc121540
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 13:36:34 +00:00
Eike Ziller
6689f0e5f4 Fix dropping files onto image viewer
Interactive QGraphicsViews eat all drag&drop events. Since we don't want
the view to be "interactive" anyhow, just set it to non-interactive.
Dragging the image around if it is larger than the view is not
implemented via drag&drop events, so it still works.

Fixes: QTCREATORBUG-25462
Change-Id: Iee403bab7ba83f897b4d2cca662c4e82ae4aa529
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-06 07:15:43 +00:00
Eike Ziller
484d40258a IDocument: Simplify permission changes
Take care of handling file permission changes centrally.

TextDocument had its own, caching implementation of tracking the backing
file's read-only state. Move that into IDocument directly.

IDocument::reload with a permission-only change is not a very
interesting case, but every subclass needed to add handling of it.
Instead, remove TypePermission from the file-change types, and handle it
separately via the now unified checkPermissions() implementation.
IDocument::reloadBehavior already was never called with TypePermission.

Change-Id: I321d47ba6193bc878efa9bb50ba7a739fa492745
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-14 14:55:34 +00:00
hjk
206e9f95fb Core: Signal duplicated editors
FakeVim needs some notification even in cases where the
duplication is triggered outside the EditorManager as in
QmlDesigner's qml-editor.

Fixes: QTCREATORBUG-22344
Change-Id: Ia4950ff4b02d3f89779f03ff4c106a07ccff2106
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-14 08:31:44 +00:00
Eike Ziller
9277c58e42 Do not pop up general messages pane
General messages pane should only be opened on direct user interaction.

Task-number: QTCREATORBUG-24430
Change-Id: Ib4c72b1bb07c27aabc74eb62c56061d5548b677d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-04 12:49:11 +00:00
Jarek Kobus
fdaed3aa09 Fix qmake build against Qt 6
Change-Id: Iee5154e5b48c1e7f41d682f2ec7040202366db77
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-09 09:22:28 +00:00
Eike Ziller
5e67bc5055 Fix build with Qt6
Add missing includes for "incomplete type" issues.
Remove usage of QDesktopWidget.
Don't compile native WebKit help backend (missing native widget integration).
Add SvgWidget dependency.

Task-number: QTCREATORBUG-24098
Change-Id: I1b3afb54d385940ff283824870fa7454866212a4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-26 08:44:21 +00:00
Eike Ziller
c74714da04 Remove parent argument from IEditor constructor
Editors are owned by whoever created them via the corresponding editor
factory, usually the EditorManager.

Change-Id: I4432eab1a3a8c38ce1bba6bb10b0f9273695a524
Reviewed-by: hjk <hjk@qt.io>
2020-09-24 09:10:37 +00:00
Eike Ziller
423ea729f8 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/mcusupport/mcusupportoptions.cpp

Change-Id: I3fd0d0a6a3ff30bb990da3dc0f78e69f9e1247ef
2020-09-23 10:11:44 +02:00
Kai Koehne
87cf6400fc ImageViewer: Change license of files to Commercial/GPLv3
Task-number: QTCREATORBUG-24620
Change-Id: I8c76b312d4e93346ca70eec92b8b7ac8dfa455d1
Reviewed-by: Denis Mingulov <denis@mingulov.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-21 12:33:29 +00:00
Eike Ziller
6225d33c28 Fix build issues with Qt6
Change from QStringRef to QStringView at various places.

Task-number: QTCREATORBUG-24098
Change-Id: Ia7a634fa26464fbb2962724d5f0e188cecc68801
Reviewed-by: hjk <hjk@qt.io>
2020-09-18 14:41:32 +00:00
hjk
5363256acd Qt6: Port some uses of QApplication::desktop()->availableGeometry()
Task-number: QTCREATORBUG-24098
Change-Id: I3bf911402084fb26110a89992cb5f1d61c2f46e9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-30 05:56:00 +00:00
hjk
43b658e9e7 Utils: Drop Utils::SkipEmptyParts again
We require Qt 5.14 nowadays.

Change-Id: Iff245257d3cb19207007c0445ee13814e66152dd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-21 12:42:27 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +00: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
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
hjk
1c81a3b3e8 All: Use Utils::SkipEmptyParts
Task-number: QTCREATORBUG-24098
Change-Id: Iab45de9a9c17ddc39a0e343b1175d4f6cb94b098
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 05:55:25 +00:00
hjk
79b680e7f0 Utils: Rename PathChooser::{f,setF}ileName() to {f,setF}ilePath()
It's returning a FilePath, so it's a better fit.

Keep the old versions as inline function now to ease downstream migration.

Change-Id: I535887928018f42b92895c8b0c82527f0d55e5ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-04-09 17:30:23 +00:00
Kai Koehne
fda9955df0 Globally disable WindowContextHelpButtonHint
Do set the global application flag AA_DisableWindowContextHelpButton
to avoid having to unset the default WindowContextHelpButtonHint
in every single dialog.

AA_DisableWindowContextHelpButton was added in Qt 5.10.

Change-Id: I21fe8bc5ddfa4c01ec7a799b04bfb6ff1c9d6d86
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-25 13:26:44 +00:00
hjk
a44bfdd779 Provide an empty default IPlugin::extensionsInitialized()
And remove all empy re-implementations.

Change-Id: I19f0b4e55c042c96693ecb89766f97f0a97b54ae
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-07 10:21:34 +00:00
hjk
0b1a463c47 Core: Remove one IEditorFactory::addMimeType overload
Not overly useful in the times of QT_RESTRICTED_CAST_FROM_ASCII

Change-Id: I87032b1da9cc4e8205d2a9c8596bc9ba832acf30
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-06 08:33:53 +00:00
hjk
d7ae3b79f8 Core: Make IEditorFactory::createEditor use a function object
Also, replace or remove unneeded Q_OBJECTs, and make base
setters and adders protected.

Change-Id: I212257ef53984d8852dc8c478537199fc9483486
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-05 11:41:29 +00:00
hjk
3a5cb65128 ImageViewer: Use standard plugin setup pattern
Change-Id: Iab9536115b243563bb9a4bfd56b9d211a45f1b0b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-22 16:05:42 +00:00
Sona Kurazyan
66435024a4 Replace the deprecated QWheelEvent::delta() -> QWheelEvent::angleDelta()
Replaced the usages of deprecated QWheelEvent::delta() with
QWheelEvent::angleDelta().y(), assuming that it's acceptable to use only the
vertical component of angle delta.

Task-number: QTBUG-76491
Change-Id: I4aa0a5a0e9ba7f33321bdb879b66ffb589b53e42
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-02 13:01:30 +00:00
Alessandro Portale
0933c20de8 connect() to ambiguous signals/slots: Replace static_cast with QOverload
Change-Id: I473d7a2a16509cee944a2a21b022a3f6f02cfd8d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 14:07:03 +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
Cristian Adam
d855b84c5d Qt Creator CMake port
Based on Tobias Hunger's work from a few months ago.

The CMake configuration needs libclang and Qt paths specified as
CMAKE_PREFIX_PATH.

Auto tests are run with "ctest". At the moment the pass rate is 87%.

Change-Id: Iba98e39bf22077d52706dce6c85986be67a6eab0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 13:33:28 +00:00
Alessandro Portale
2f6d43745a ImageViewer: Don't blur the ImageViewer background pattern on HighDpi
Simply don't draw the background pattern with interpolated scaling.

Task-number: QTCREATORBUG-22280
Change-Id: Iae17f4ce663ae82ee00cbebaa9830b5bb86d5735
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-04-11 07:12:02 +00:00
Alessandro Portale
7d56d89f25 ImageView: Modernize
modernize-*

Change-Id: I7fcffa4b455355cbcdc91f7e671e0a88f1091042
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-12 17:10:11 +00:00