diff options
author | Marco Bubke <marco.bubke@qt.io> | 2021-05-06 15:27:51 +0000 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2021-05-06 15:30:02 +0000 |
commit | f0a86d45104f585b7aeef07fcc68cea24061aedb (patch) | |
tree | 6f2bb2de1ed9a81b420c20198c7c629a6f69a802 | |
parent | 53c0b82a93df3e79ae1f8f896e9cd164148bebf8 (diff) |
Revert "Merge remote-tracking branch 'origin/4.15'"
This reverts commit 888ca0dd20ff647970fc85340e108cfa34d78c3a.
Reason for revert: wrong patchset
Change-Id: I1291789938601aaf606c59917ff938e3c24c78dd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
42 files changed, 334 insertions, 414 deletions
diff --git a/qbs/modules/sqlite_sources/sqlite-sources.qbs b/qbs/modules/sqlite_sources/sqlite-sources.qbs index ea80e58b1b..559c3ec865 100644 --- a/qbs/modules/sqlite_sources/sqlite-sources.qbs +++ b/qbs/modules/sqlite_sources/sqlite-sources.qbs @@ -9,7 +9,16 @@ Module { Depends { name: "cpp" } cpp.defines: [ - "_HAVE_SQLITE_CONFIG_H", "SQLITE_CORE" + "SQLITE_THREADSAFE=2", "SQLITE_ENABLE_FTS5", "SQLITE_ENABLE_UNLOCK_NOTIFY", + "SQLITE_ENABLE_JSON1", "SQLITE_DEFAULT_FOREIGN_KEYS=1", "SQLITE_TEMP_STORE=2", + "SQLITE_DEFAULT_WAL_SYNCHRONOUS=1", "SQLITE_MAX_WORKER_THREADS", "SQLITE_DEFAULT_MEMSTATUS=0", + "SQLITE_OMIT_DEPRECATED", "SQLITE_OMIT_DECLTYPE", + "SQLITE_MAX_EXPR_DEPTH=0", "SQLITE_OMIT_SHARED_CACHE", "SQLITE_USE_ALLOCA", + "SQLITE_ENABLE_MEMORY_MANAGEMENT", "SQLITE_ENABLE_NULL_TRIM", "SQLITE_OMIT_EXPLAIN", + "SQLITE_OMIT_LOAD_EXTENSION", "SQLITE_OMIT_UTF16", "SQLITE_DQS=0", + "SQLITE_ENABLE_STAT4", "HAVE_ISNAN", "HAVE_FDATASYNC", "HAVE_MALLOC_USABLE_SIZE", + "SQLITE_DEFAULT_MMAP_SIZE=268435456", "SQLITE_CORE", "SQLITE_ENABLE_SESSION", "SQLITE_ENABLE_PREUPDATE_HOOK", + "SQLITE_LIKE_DOESNT_MATCH_BLOBS", ].concat(buildSharedLib ? "BUILD_SQLITE_LIBRARY" : "BUILD_SQLITE_STATIC_LIBRARY") cpp.dynamicLibraries: base.concat((qbs.targetOS.contains("unix") && !qbs.targetOS.contains("bsd")) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp index 51b265a593..30aec5b0c9 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp @@ -23,25 +23,24 @@ ** ****************************************************************************/ -#include "iconrenderer/iconrenderer.h" -#include "import3d/import3d.h" - -#include <qt5nodeinstanceclientproxy.h> -#ifdef MULTILANGUAGE_TRANSLATIONPROVIDER -#include <sqlitelibraryinitializer.h> -#endif - -#include <QQmlComponent> -#include <QQmlEngine> #include <QDebug> + #include <QApplication> #include <QStringList> #include <QFileInfo> #include <iostream> + #include <stdio.h> #include <stdlib.h> +#include "iconrenderer/iconrenderer.h" +#include "import3d/import3d.h" +#include <qt5nodeinstanceclientproxy.h> + +#include <QQmlComponent> +#include <QQmlEngine> + #ifdef ENABLE_QT_BREAKPAD #include <qtsystemexceptionhandler.h> #endif @@ -275,10 +274,6 @@ int main(int argc, char *argv[]) && qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE") && qgetenv("QT_QUICK_CONTROLS_STYLE") != "Desktop"; -#ifdef MULTILANGUAGE_TRANSLATIONPROVIDER - Sqlite::LibraryInitializer::initialize(); -#endif - if (useGuiApplication) { QGuiApplication application(argc, argv); return internalMain(&application); diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/RegExpValidator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/RegExpValidator.qml deleted file mode 100644 index f9ace424d9..0000000000 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/RegExpValidator.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.15 - -RegularExpressionValidator { - id: root - property alias regExp: root.regularExpression -} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml index 19e319be32..54bbe34362 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml @@ -28,8 +28,10 @@ import QtQuick 2.10 QtObject { readonly property int width: 1920 readonly property int height: 1080 - - property FontLoader controlIcons: FontLoader { + readonly property FontLoader mySystemFont: FontLoader { + name: "Arial" + } + readonly property FontLoader controlIcons: FontLoader { source: "icons.ttf" } @@ -148,12 +150,12 @@ QtObject { }) readonly property font font: Qt.font({ - "family": "Arial", + "family": mySystemFont.name, "pointSize": Qt.application.font.pixelSize }) readonly property font largeFont: Qt.font({ - "family": "Arial", + "family": mySystemFont.name, "pointSize": Qt.application.font.pixelSize * 1.6 }) } diff --git a/src/libs/3rdparty/sqlite/config.h b/src/libs/3rdparty/sqlite/config.h deleted file mode 100644 index 19757d3f8e..0000000000 --- a/src/libs/3rdparty/sqlite/config.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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. -** -****************************************************************************/ - -#pragma once - -#include <string.h> - -#if __has_include(<unistd.h>) -#include <unistd.h> -#endif - -#if __has_include(<utime.h>) -#define HAVE_UTIME 1 -#endif - -#if (_XOPEN_SOURCE >= 500) && !(_POSIX_C_SOURCE >= 200809L) || _DEFAULT_SOURCE || _BSD_SOURCE -#define HAVE_USLEEP 1 -#endif - -#ifdef _GNU_SOURCE -#define HAVE_STRCHRNUL 1 -#endif - -#if _POSIX_C_SOURCE >= 199309L || _XOPEN_SOURCE >= 500 -#define HAVE_FDATASYNC 1 -#endif - -#if _POSIX_C_SOURCE >= 1 || _BSD_SOURCE -#define HAVE_LOCALTIME_R 1 -#else -#define HAVE_LOCALTIME_S 1 -#endif - -#define HAVE_MALLOC_USABLE_SIZE 1 -#define HAVE_ISNAN 1 - -#define SQLITE_THREADSAFE 2 -#define SQLITE_ENABLE_FTS5 1 -#define SQLITE_ENABLE_UNLOCK_NOTIFY 1 -#define SQLITE_ENABLE_JSON1 1 -#define SQLITE_DEFAULT_FOREIGN_KEYS 1 -#define SQLITE_TEMP_STORE 2 -#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1 -#define SQLITE_MAX_WORKER_THREADS 1 -#define SQLITE_DEFAULT_MEMSTATUS 0 -#define SQLITE_OMIT_DEPRECATED 1 -#define SQLITE_OMIT_DECLTYPE 1 -#define SQLITE_MAX_EXPR_DEPTH 0 -#define SQLITE_OMIT_SHARED_CACHE 1 -#define SQLITE_USE_ALLOCA 1 -#define SQLITE_ENABLE_MEMORY_MANAGEMENT 1 -#define SQLITE_ENABLE_NULL_TRIM 1 -#define SQLITE_OMIT_EXPLAIN 1 -#define SQLITE_OMIT_LOAD_EXTENSION 1 -#define SQLITE_OMIT_UTF16 1 -#define SQLITE_DQS 0 -#define SQLITE_ENABLE_STAT4 1 -#define SQLITE_DEFAULT_MMAP_SIZE 268435456 -#define SQLITE_ENABLE_SESSION 1 -#define SQLITE_ENABLE_PREUPDATE_HOOK 1 -#define SQLITE_LIKE_DOESNT_MATCH_BLOBS 1 -#define SQLITE_OMIT_AUTOINIT 1 diff --git a/src/libs/3rdparty/sqlite/sqlite.h b/src/libs/3rdparty/sqlite/sqlite.h deleted file mode 100644 index ba06815b4d..0000000000 --- a/src/libs/3rdparty/sqlite/sqlite.h +++ /dev/null @@ -1,29 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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. -** -****************************************************************************/ - -#pragma once - -#include "config.h" -#include "sqlite3ext.h" diff --git a/src/libs/3rdparty/sqlite/sqlite.pri b/src/libs/3rdparty/sqlite/sqlite.pri index e869f4fc56..ffc3a706e6 100644 --- a/src/libs/3rdparty/sqlite/sqlite.pri +++ b/src/libs/3rdparty/sqlite/sqlite.pri @@ -1,12 +1,6 @@ INCLUDEPATH *= $$PWD -linux:DEFINES += _POSIX_C_SOURCE=200809L _GNU_SOURCE -osx:DEFINES += _BSD_SOURCE - - HEADERS += $$PWD/sqlite3.h \ - $$PWD/config.h \ - $$PWD/sqlite.h \ $$PWD/sqlite3ext.h SOURCES += $$PWD/sqlite3.c \ diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 8e364fa6be..344b39d14e 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -1366,9 +1366,7 @@ bool Check::visit(Block *ast) && !cast<WhileStatement *>(p) && !cast<IfStatement *>(p) && !cast<SwitchStatement *>(p) - && !isCaseOrDefault(p) - && !cast<WithStatement *>(p) - && hasVarStatement(ast)) { + && !cast<WithStatement *>(p)) { addMessage(WarnBlock, ast->lbraceToken); } if (!ast->statements @@ -1658,33 +1656,6 @@ bool Check::isQtQuick2Ui() const return _doc->language() == Dialect::QmlQtQuick2Ui; } -bool Check::isCaseOrDefault(Node *n) -{ - if (!cast<StatementList *>(n)) - return false; - if (Node *p = parent(1)) - return p->kind == Node::Kind_CaseClause || p->kind == Node::Kind_DefaultClause; - return false; -} - -bool Check::hasVarStatement(AST::Block *b) const -{ - QTC_ASSERT(b, return false); - StatementList *s = b->statements; - while (s) { - if (auto var = cast<VariableStatement *>(s->statement)) { - VariableDeclarationList *declList = var->declarations; - while (declList) { - if (declList->declaration && declList->declaration->scope == VariableScope::Var) - return true; - declList = declList->next; - } - } - s = s->next; - } - return false; -} - bool Check::visit(NewExpression *ast) { checkNewExpression(ast->expression); diff --git a/src/libs/qmljs/qmljscheck.h b/src/libs/qmljs/qmljscheck.h index ec20862248..e5e110c5f9 100644 --- a/src/libs/qmljs/qmljscheck.h +++ b/src/libs/qmljs/qmljscheck.h @@ -122,9 +122,6 @@ private: bool isQtQuick2() const; bool isQtQuick2Ui() const; - bool isCaseOrDefault(AST::Node *n); - bool hasVarStatement(AST::Block *b) const; - AST::Node *parent(int distance = 0); Document::Ptr _doc; diff --git a/src/libs/sqlite/CMakeLists.txt b/src/libs/sqlite/CMakeLists.txt index 42de2ce9e9..4bf3ae91df 100644 --- a/src/libs/sqlite/CMakeLists.txt +++ b/src/libs/sqlite/CMakeLists.txt @@ -1,7 +1,16 @@ add_qtc_library(Sqlite PUBLIC_DEFINES BUILD_SQLITE_LIBRARY - SQLITE_CORE + SQLITE_THREADSAFE=2 SQLITE_ENABLE_FTS5 SQLITE_ENABLE_UNLOCK_NOTIFY + SQLITE_ENABLE_JSON1 SQLITE_DEFAULT_FOREIGN_KEYS=1 SQLITE_TEMP_STORE=2 + SQLITE_DEFAULT_WAL_SYNCHRONOUS=1 SQLITE_MAX_WORKER_THREADS SQLITE_DEFAULT_MEMSTATUS=0 + SQLITE_OMIT_DEPRECATED SQLITE_OMIT_DECLTYPE + SQLITE_MAX_EXPR_DEPTH=0 SQLITE_OMIT_SHARED_CACHE SQLITE_USE_ALLOCA + SQLITE_ENABLE_MEMORY_MANAGEMENT SQLITE_ENABLE_NULL_TRIM SQLITE_OMIT_EXPLAIN + SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_UTF16 SQLITE_DQS=0 + SQLITE_ENABLE_STAT4 HAVE_ISNAN HAVE_FDATASYNC HAVE_MALLOC_USABLE_SIZE + SQLITE_DEFAULT_MMAP_SIZE=268435456 SQLITE_CORE SQLITE_ENABLE_SESSION SQLITE_ENABLE_PREUPDATE_HOOK + SQLITE_LIKE_DOESNT_MATCH_BLOBS DEPENDS Qt5::Core Threads::Threads ${CMAKE_DL_LIBS} PUBLIC_INCLUDES "${CMAKE_CURRENT_LIST_DIR}" @@ -10,8 +19,6 @@ add_qtc_library(Sqlite ../3rdparty/sqlite/sqlite3.c ../3rdparty/sqlite/sqlite3.h ../3rdparty/sqlite/carray.c - ../3rdparty/sqlite/config.h - ../3rdparty/sqlite/sqlite.h constraints.h createtablesqlstatementbuilder.cpp createtablesqlstatementbuilder.h lastchangedrowid.h @@ -39,13 +46,4 @@ add_qtc_library(Sqlite utf8stringvector.cpp utf8stringvector.h sqliteblob.h sqlitetimestamp.h - sqlitelibraryinitializer.cpp sqlitelibraryinitializer.h ) - -extend_qtc_library(Sqlite DEFINES _HAVE_SQLITE_CONFIG_H) - -if (APPLE) -extend_qtc_library(Sqlite DEFINES _BSD_SOURCE) -elseif (UNIX) -extend_qtc_library(Sqlite DEFINES _POSIX_C_SOURCE=200809L _GNU_SOURCE _DEFAULT_SOURCE) -endif() diff --git a/src/libs/sqlite/createtablesqlstatementbuilder.cpp b/src/libs/sqlite/createtablesqlstatementbuilder.cpp index de77eec576..07008a9a1d 100644 --- a/src/libs/sqlite/createtablesqlstatementbuilder.cpp +++ b/src/libs/sqlite/createtablesqlstatementbuilder.cpp @@ -248,9 +248,7 @@ void CreateTableSqlStatementBuilder::bindColumnDefinitionsAndTableConstraints() columnDefinitionStrings.reserve(m_columns.size()); for (const Column &column : m_columns) { - Utils::SmallString columnDefinitionString = {column.name, - SqlStatementBuilder::columnTypeToString( - column.type)}; + Utils::SmallString columnDefinitionString = {column.name, " ", column.typeString()}; ContraintsVisiter visiter{columnDefinitionString}; diff --git a/src/libs/sqlite/sqlite-lib.pri b/src/libs/sqlite/sqlite-lib.pri index 59d34a61c2..87b63eb388 100644 --- a/src/libs/sqlite/sqlite-lib.pri +++ b/src/libs/sqlite/sqlite-lib.pri @@ -15,7 +15,6 @@ SOURCES += \ $$PWD/sqlitedatabasebackend.cpp \ $$PWD/sqliteexception.cpp \ $$PWD/sqliteglobal.cpp \ - $$PWD/sqlitelibraryinitializer.cpp \ $$PWD/sqlitesessionchangeset.cpp \ $$PWD/sqlitesessions.cpp \ $$PWD/sqlstatementbuilder.cpp \ @@ -26,7 +25,6 @@ SOURCES += \ HEADERS += \ $$PWD/constraints.h \ $$PWD/sqliteblob.h \ - $$PWD/sqlitelibraryinitializer.h \ $$PWD/sqlitetimestamp.h \ $$PWD/tableconstraints.h \ $$PWD/createtablesqlstatementbuilder.h \ @@ -52,7 +50,16 @@ HEADERS += \ $$PWD/sqliteindex.h \ $$PWD/sqlitebasestatement.h -DEFINES += _HAVE_SQLITE_CONFIG_H SQLITE_CORE +DEFINES += SQLITE_THREADSAFE=2 SQLITE_ENABLE_FTS5 SQLITE_ENABLE_UNLOCK_NOTIFY \ + SQLITE_ENABLE_JSON1 SQLITE_DEFAULT_FOREIGN_KEYS=1 SQLITE_TEMP_STORE=2 \ + SQLITE_DEFAULT_WAL_SYNCHRONOUS=1 SQLITE_MAX_WORKER_THREADS SQLITE_DEFAULT_MEMSTATUS=0 \ + SQLITE_OMIT_DEPRECATED SQLITE_OMIT_DECLTYPE \ + SQLITE_MAX_EXPR_DEPTH=0 SQLITE_OMIT_SHARED_CACHE SQLITE_USE_ALLOCA \ + SQLITE_ENABLE_MEMORY_MANAGEMENT SQLITE_ENABLE_NULL_TRIM SQLITE_OMIT_EXPLAIN \ + SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_UTF16 SQLITE_DQS=0 \ + SQLITE_ENABLE_STAT4 HAVE_ISNAN HAVE_FDATASYNC HAVE_MALLOC_USABLE_SIZE \ + SQLITE_DEFAULT_MMAP_SIZE=268435456 SQLITE_CORE SQLITE_ENABLE_SESSION SQLITE_ENABLE_PREUPDATE_HOOK \ + SQLITE_LIKE_DOESNT_MATCH_BLOBS CONFIG(debug, debug|release): DEFINES += SQLITE_ENABLE_API_ARMOR diff --git a/src/libs/sqlite/sqlitebasestatement.cpp b/src/libs/sqlite/sqlitebasestatement.cpp index 28ebbb8d2e..6e60133511 100644 --- a/src/libs/sqlite/sqlitebasestatement.cpp +++ b/src/libs/sqlite/sqlitebasestatement.cpp @@ -29,7 +29,7 @@ #include "sqlitedatabasebackend.h" #include "sqliteexception.h" -#include "sqlite.h" +#include "sqlite3.h" #include <condition_variable> #include <mutex> diff --git a/src/libs/sqlite/sqlitebasestatement.h b/src/libs/sqlite/sqlitebasestatement.h index c96fb3fade..019a7a44f3 100644 --- a/src/libs/sqlite/sqlitebasestatement.h +++ b/src/libs/sqlite/sqlitebasestatement.h @@ -29,6 +29,7 @@ #include "sqliteblob.h" #include "sqliteexception.h" +#include "sqlitetransaction.h" #include "sqlitevalue.h" #include <utils/smallstringvector.h> @@ -37,6 +38,7 @@ #include <utils/span.h> #include <cstdint> +#include <exception> #include <functional> #include <memory> #include <tuple> @@ -91,6 +93,7 @@ public: void bind(int index, Utils::span<const char *> values); void bind(int index, Utils::SmallStringView value); void bind(int index, const Value &value); + void bind(int index, ValueView value); void bind(int index, BlobView blobView); void bind(int index, uint value) { bind(index, static_cast<long long>(value)); } @@ -162,13 +165,14 @@ extern template SQLITE_EXPORT Utils::PathString BaseStatement::fetchValue<Utils: template<typename BaseStatement, int ResultCount> class StatementImplementation : public BaseStatement { + struct Resetter; public: using BaseStatement::BaseStatement; void execute() { - Resetter resetter{*this}; + Resetter resetter{this}; BaseStatement::next(); resetter.reset(); } @@ -178,15 +182,14 @@ public: template<typename... ValueType> void bindValues(const ValueType&... values) { - int index = 0; - (BaseStatement::bind(++index, values), ...); + bindValuesByIndex(1, values...); } template<typename... ValueType> void write(const ValueType&... values) { - Resetter resetter{*this}; - bindValues(values...); + Resetter resetter{this}; + bindValuesByIndex(1, values...); BaseStatement::next(); resetter.reset(); } @@ -194,7 +197,7 @@ public: template<typename ResultType> std::vector<ResultType> values(std::size_t reserveSize) { - Resetter resetter{*this}; + Resetter resetter{this}; std::vector<ResultType> resultValues; resultValues.reserve(std::max(reserveSize, m_maximumResultCount)); @@ -211,7 +214,7 @@ public: template<typename ResultType, typename... QueryTypes> auto values(std::size_t reserveSize, const QueryTypes &...queryValues) { - Resetter resetter{*this}; + Resetter resetter{this}; std::vector<ResultType> resultValues; resultValues.reserve(std::max(reserveSize, m_maximumResultCount)); @@ -230,13 +233,13 @@ public: template<typename ResultType, typename... QueryTypes> auto value(const QueryTypes &...queryValues) { - Resetter resetter{*this}; + Resetter resetter{this}; Utils::optional<ResultType> resultValue; bindValues(queryValues...); if (BaseStatement::next()) - resultValue = assignValue<Utils::optional<ResultType>>(); + resultValue = createOptionalValue<Utils::optional<ResultType>>(); resetter.reset(); @@ -258,7 +261,7 @@ public: template<typename Callable, typename... QueryTypes> void readCallback(Callable &&callable, const QueryTypes &...queryValues) { - Resetter resetter{*this}; + Resetter resetter{this}; bindValues(queryValues...); @@ -272,10 +275,10 @@ public: resetter.reset(); } - template<int ResultTypeCount = 1, typename Container, typename... QueryTypes> + template<typename Container, typename... QueryTypes> void readTo(Container &container, const QueryTypes &...queryValues) { - Resetter resetter{*this}; + Resetter resetter{this}; bindValues(queryValues...); @@ -285,39 +288,187 @@ public: resetter.reset(); } + template<typename ResultType, typename... QueryTypes> + auto range(const QueryTypes &...queryValues) + { + return SqliteResultRange<ResultType>{*this, queryValues...}; + } + + template<typename ResultType, typename... QueryTypes> + auto rangeWithTransaction(const QueryTypes &...queryValues) + { + return SqliteResultRangeWithTransaction<ResultType>{*this, queryValues...}; + } + + template<typename ResultType> + class BaseSqliteResultRange + { + public: + class SqliteResultIteratator + { + public: + using iterator_category = std::input_iterator_tag; + using difference_type = int; + using value_type = ResultType; + using pointer = ResultType *; + using reference = ResultType &; + + SqliteResultIteratator(StatementImplementation &statement) + : m_statement{statement} + , m_hasNext{m_statement.next()} + {} + + SqliteResultIteratator(StatementImplementation &statement, bool hasNext) + : m_statement{statement} + , m_hasNext{hasNext} + {} + + SqliteResultIteratator &operator++() + { + m_hasNext = m_statement.next(); + return *this; + } + + void operator++(int) { m_hasNext = m_statement.next(); } + + friend bool operator==(const SqliteResultIteratator &first, + const SqliteResultIteratator &second) + { + return first.m_hasNext == second.m_hasNext; + } + + friend bool operator!=(const SqliteResultIteratator &first, + const SqliteResultIteratator &second) + { + return !(first == second); + } + + value_type operator*() const { return m_statement.createValue<ResultType>(); } + + private: + StatementImplementation &m_statement; + bool m_hasNext = false; + }; + + using value_type = ResultType; + using iterator = SqliteResultIteratator; + using const_iterator = iterator; + + template<typename... QueryTypes> + BaseSqliteResultRange(StatementImplementation &statement, const QueryTypes &...queryValues) + : m_statement{statement} + { + statement.bindValues(queryValues...); + } + + BaseSqliteResultRange(BaseSqliteResultRange &) = delete; + BaseSqliteResultRange &operator=(BaseSqliteResultRange &) = delete; + + BaseSqliteResultRange(BaseSqliteResultRange &&other) + : m_statement{std::move(other.resetter)} + {} + BaseSqliteResultRange &operator=(BaseSqliteResultRange &&) = delete; + + iterator begin() & { return iterator{m_statement}; } + iterator end() & { return iterator{m_statement, false}; } + + const_iterator begin() const & { return iterator{m_statement}; } + const_iterator end() const & { return iterator{m_statement, false}; } + + private: + StatementImplementation &m_statement; + }; + + template<typename ResultType> + class SqliteResultRange : public BaseSqliteResultRange<ResultType> + { + public: + template<typename... QueryTypes> + SqliteResultRange(StatementImplementation &statement, const QueryTypes &...queryValues) + : BaseSqliteResultRange<ResultType>{statement} + , resetter{&statement} + + { + statement.bindValues(queryValues...); + } + + ~SqliteResultRange() + { + if (!std::uncaught_exceptions()) + resetter.reset(); + } + + private: + Resetter resetter; + }; + + template<typename ResultType> + class SqliteResultRangeWithTransaction : public BaseSqliteResultRange<ResultType> + { + public: + template<typename... QueryTypes> + SqliteResultRangeWithTransaction(StatementImplementation &statement, + const QueryTypes &...queryValues) + : BaseSqliteResultRange<ResultType>{statement} + , m_transaction{statement.database()} + , resetter{&statement} + { + statement.bindValues(queryValues...); + } + + ~SqliteResultRangeWithTransaction() + { + if (!std::uncaught_exceptions()) { + resetter.reset(); + m_transaction.commit(); + } + } + + private: + DeferredTransaction m_transaction; + Resetter resetter; + }; + protected: ~StatementImplementation() = default; private: struct Resetter { - Resetter(StatementImplementation &statement) + Resetter(StatementImplementation *statement) : statement(statement) {} + Resetter(Resetter &) = delete; + Resetter &operator=(Resetter &) = delete; + + Resetter(Resetter &&other) + : statement{std::exchange(other.statement, nullptr)} + {} + void reset() { try { - statement.reset(); + if (statement) + statement->reset(); } catch (...) { - shouldReset = false; + statement = nullptr; throw; } - shouldReset = false; + statement = nullptr; } ~Resetter() noexcept { try { - if (shouldReset) - statement.reset(); + if (statement) + statement->reset(); } catch (...) { } } - StatementImplementation &statement; - bool shouldReset = true; + StatementImplementation *statement; }; struct ValueGetter @@ -339,6 +490,11 @@ private: int column; }; + constexpr int resultCount(int localResultCount) const + { + return ResultCount < 0 ? localResultCount : ResultCount; + } + template<typename ContainerType, int... ColumnIndices> void emplaceBackValues(ContainerType &container, std::integer_sequence<int, ColumnIndices...>) { @@ -351,17 +507,28 @@ private: emplaceBackValues(container, std::make_integer_sequence<int, ResultCount>{}); } - template <typename ResultOptionalType, - int... ColumnIndices> - ResultOptionalType assignValue(std::integer_sequence<int, ColumnIndices...>) + template<typename ResultOptionalType, int... ColumnIndices> + ResultOptionalType createOptionalValue(std::integer_sequence<int, ColumnIndices...>) { return ResultOptionalType(Utils::in_place, ValueGetter(*this, ColumnIndices)...); } template<typename ResultOptionalType> - ResultOptionalType assignValue() + ResultOptionalType createOptionalValue() + { + return createOptionalValue<ResultOptionalType>(std::make_integer_sequence<int, ResultCount>{}); + } + + template<typename ResultType, int... ColumnIndices> + ResultType createValue(std::integer_sequence<int, ColumnIndices...>) + { + return ResultType{ValueGetter(*this, ColumnIndices)...}; + } + + template<typename ResultType> + ResultType createValue() { - return assignValue<ResultOptionalType>(std::make_integer_sequence<int, ResultCount>{}); + return createValue<ResultType>(std::make_integer_sequence<int, ResultCount>{}); } template<typename Callable, int... ColumnIndices> @@ -376,6 +543,19 @@ private: return callCallable(callable, std::make_integer_sequence<int, ResultCount>{}); } + template<typename ValueType> + void bindValuesByIndex(int index, const ValueType &value) + { + BaseStatement::bind(index, value); + } + + template<typename ValueType, typename... ValueTypes> + void bindValuesByIndex(int index, const ValueType &value, const ValueTypes &...values) + { + BaseStatement::bind(index, value); + bindValuesByIndex(index + 1, values...); + } + void setMaximumResultCount(std::size_t count) { m_maximumResultCount = std::max(m_maximumResultCount, count); diff --git a/src/libs/sqlite/sqlitecolumn.h b/src/libs/sqlite/sqlitecolumn.h index 35a5e0f25c..1775a68307 100644 --- a/src/libs/sqlite/sqlitecolumn.h +++ b/src/libs/sqlite/sqlitecolumn.h @@ -39,7 +39,7 @@ public: Column(Utils::SmallStringView tableName, Utils::SmallStringView name, - ColumnType type = ColumnType::None, + ColumnType type, Constraints &&constraints = {}) : constraints(std::move(constraints)) , name(name) diff --git a/src/libs/sqlite/sqlitedatabasebackend.cpp b/src/libs/sqlite/sqlitedatabasebackend.cpp index 9c096364cb..0101e82626 100644 --- a/src/libs/sqlite/sqlitedatabasebackend.cpp +++ b/src/libs/sqlite/sqlitedatabasebackend.cpp @@ -35,7 +35,7 @@ #include <QThread> #include <QDebug> -#include "sqlite.h" +#include "sqlite3.h" #include <chrono> #include <thread> diff --git a/src/libs/sqlite/sqliteglobal.h b/src/libs/sqlite/sqliteglobal.h index cefdebd8d0..0bdb3c2aef 100644 --- a/src/libs/sqlite/sqliteglobal.h +++ b/src/libs/sqlite/sqliteglobal.h @@ -39,7 +39,7 @@ namespace Sqlite { -enum class ColumnType : char { None, Numeric, Integer, Real, Text, Blob }; +enum class ColumnType : char { Numeric, Integer, Real, Text, Blob, None }; enum class ConstraintType : char { NoConstraint, PrimaryKey, Unique, ForeignKey }; diff --git a/src/libs/sqlite/sqlitelibraryinitializer.cpp b/src/libs/sqlite/sqlitelibraryinitializer.cpp deleted file mode 100644 index c42d126966..0000000000 --- a/src/libs/sqlite/sqlitelibraryinitializer.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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. -** -****************************************************************************/ - -#include "sqlitelibraryinitializer.h" - -#include "sqlitedatabasebackend.h" - -namespace Sqlite { - -void LibraryInitializer::initialize() -{ - static LibraryInitializer initializer; -} - -LibraryInitializer::LibraryInitializer() -{ - DatabaseBackend::initializeSqliteLibrary(); -} - -LibraryInitializer::~LibraryInitializer() -{ - DatabaseBackend::shutdownSqliteLibrary(); -} - -} // namespace Sqlite diff --git a/src/libs/sqlite/sqlitelibraryinitializer.h b/src/libs/sqlite/sqlitelibraryinitializer.h deleted file mode 100644 index 6df8b19a22..0000000000 --- a/src/libs/sqlite/sqlitelibraryinitializer.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 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. -** -****************************************************************************/ - -#pragma once - -#include "sqliteglobal.h" - -namespace Sqlite { - -class LibraryInitializer -{ -public: - SQLITE_EXPORT static void initialize(); - -private: - LibraryInitializer(); - ~LibraryInitializer(); -}; - -} // namespace Sqlite diff --git a/src/libs/sqlite/sqlitesessionchangeset.cpp b/src/libs/sqlite/sqlitesessionchangeset.cpp index eef98bc5d5..76fc088f92 100644 --- a/src/libs/sqlite/sqlitesessionchangeset.cpp +++ b/src/libs/sqlite/sqlitesessionchangeset.cpp @@ -29,7 +29,7 @@ #include <utils/smallstringio.h> -#include <sqlite.h> +#include <sqlite3ext.h> namespace Sqlite { diff --git a/src/libs/sqlite/sqlitesessions.cpp b/src/libs/sqlite/sqlitesessions.cpp index 5162a9fa59..df668fdc59 100644 --- a/src/libs/sqlite/sqlitesessions.cpp +++ b/src/libs/sqlite/sqlitesessions.cpp @@ -28,7 +28,7 @@ #include "sqlitesessionchangeset.h" #include "sqlitetable.h" -#include <sqlite.h> +#include <sqlite3ext.h> #include <memory> diff --git a/src/libs/sqlite/sqlitetable.h b/src/libs/sqlite/sqlitetable.h index 35453945f2..9883415a9f 100644 --- a/src/libs/sqlite/sqlitetable.h +++ b/src/libs/sqlite/sqlitetable.h @@ -72,7 +72,7 @@ public: } Column &addColumn(Utils::SmallStringView name, - ColumnType type = ColumnType::None, + ColumnType type = ColumnType::Numeric, Constraints &&constraints = {}) { m_sqliteColumns.emplace_back(m_tableName, name, type, std::move(constraints)); diff --git a/src/libs/sqlite/sqlstatementbuilder.cpp b/src/libs/sqlite/sqlstatementbuilder.cpp index 7a6cc1a81a..ecef170a34 100644 --- a/src/libs/sqlite/sqlstatementbuilder.cpp +++ b/src/libs/sqlite/sqlstatementbuilder.cpp @@ -179,18 +179,12 @@ bool SqlStatementBuilder::isBuild() const Utils::SmallString SqlStatementBuilder::columnTypeToString(ColumnType columnType) { switch (columnType) { - case ColumnType::Numeric: - return " NUMERIC"; - case ColumnType::Integer: - return " INTEGER"; - case ColumnType::Real: - return " REAL"; - case ColumnType::Text: - return " TEXT"; - case ColumnType::Blob: - return " BLOB"; - case ColumnType::None: - return {}; + case ColumnType::Numeric: return "NUMERIC"; + case ColumnType::Integer: return "INTEGER"; + case ColumnType::Real: return "REAL"; + case ColumnType::Text: return "TEXT"; + case ColumnType::Blob: return "BLOB"; + case ColumnType::None: return {}; } Q_UNREACHABLE(); diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index c90ee9f270..ec30204f91 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -49,7 +49,6 @@ #include <coreplugin/icore.h> #include <coreplugin/iversioncontrol.h> #include <coreplugin/vcsmanager.h> -#include <coreplugin/editormanager/documentmodel.h> #include <projectexplorer/buildmanager.h> #include <projectexplorer/kitmanager.h> @@ -1074,23 +1073,6 @@ QStringList Project::availableQmlPreviewTranslations(QString *errorMessage) }); } -QList<Core::IDocument *> Project::modifiedDocuments() const -{ - QList<Core::IDocument *> modifiedProjectDocuments; - - for (Core::IDocument *doc : Core::DocumentModel::openedDocuments()) { - if (doc->isModified() && isKnownFile(doc->filePath())) - modifiedProjectDocuments.append(doc); - } - - return modifiedProjectDocuments; -} - -bool Project::isModified() const -{ - return !modifiedDocuments().isEmpty(); -} - #if defined(WITH_TESTS) } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 31cb6e12b9..c16af95946 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -185,9 +185,6 @@ public: QStringList availableQmlPreviewTranslations(QString *errorMessage); - QList<Core::IDocument *> modifiedDocuments() const; - bool isModified() const; - signals: void projectFileIsDirty(const Utils::FilePath &path); diff --git a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp index 92ac7fdf8f..7032a26ef7 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp @@ -25,23 +25,22 @@ #include "quick2propertyeditorview.h" -#include "aligndistribute.h" -#include "annotationeditor/annotationeditor.h" -#include "bindingeditor/actioneditor.h" -#include "bindingeditor/bindingeditor.h" +#include "propertyeditorvalue.h" #include "fileresourcesmodel.h" #include "gradientmodel.h" -#include "gradientpresetcustomlistmodel.h" #include "gradientpresetdefaultlistmodel.h" +#include "gradientpresetcustomlistmodel.h" #include "itemfiltermodel.h" -#include "propertyeditorcontextobject.h" -#include "propertyeditorqmlbackend.h" -#include "propertyeditorvalue.h" -#include "qmlanchorbindingproxy.h" -#include "richtexteditor/richtexteditorproxy.h" #include "simplecolorpalettemodel.h" +#include "bindingeditor/bindingeditor.h" +#include "bindingeditor/actioneditor.h" +#include "annotationeditor/annotationeditor.h" +#include "qmlanchorbindingproxy.h" #include "theme.h" +#include "aligndistribute.h" +#include "propertyeditorcontextobject.h" #include "tooltip.h" +#include "richtexteditor/richtexteditorproxy.h" namespace QmlDesigner { @@ -72,11 +71,6 @@ void Quick2PropertyEditorView::registerQmlTypes() Tooltip::registerDeclarativeType(); EasingCurveEditor::registerDeclarativeType(); RichTextEditorProxy::registerDeclarativeType(); - QUrl regExpUrl = QUrl::fromLocalFile(PropertyEditorQmlBackend::propertyEditorResourcesPath() - + "/RegExpValidator.qml"); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - qmlRegisterType(regExpUrl, "HelperWidgets", 2, 0, "RegExpValidator"); -#endif } } diff --git a/src/plugins/qmldesigner/designercore/include/propertycontainer.h b/src/plugins/qmldesigner/designercore/include/propertycontainer.h index ae38f9aafc..5eebf01fbd 100644 --- a/src/plugins/qmldesigner/designercore/include/propertycontainer.h +++ b/src/plugins/qmldesigner/designercore/include/propertycontainer.h @@ -66,4 +66,8 @@ private: mutable QVariant m_value; }; +QMLDESIGNERCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const QList<PropertyContainer> &propertyContainerList); +QMLDESIGNERCORE_EXPORT QDataStream &operator>>(QDataStream &stream, QList<PropertyContainer> &propertyContainerList); +QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, QList<PropertyContainer> &propertyContainerList); + } //namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index 0e40c8edab..f196f5ca40 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -203,7 +203,7 @@ static bool isIdToAvoid(const QString& id) static bool idContainsWrongLetter(const QString& id) { - static QRegularExpression idExpr(QStringLiteral("^[a-z_][a-zA-Z0-9_]*$")); + static QRegularExpression idExpr(QStringLiteral("^[a-z_][a-zA-Z0-9_]+$")); return !id.contains(idExpr); } diff --git a/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp b/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp index 440b91ffa0..ae62b4d0e6 100644 --- a/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp +++ b/src/plugins/qmldesigner/designercore/model/propertycontainer.cpp @@ -113,5 +113,37 @@ QDebug operator<<(QDebug debug, const PropertyContainer &propertyContainer) return debug.space(); } +QDataStream &operator<<(QDataStream &stream, const QList<PropertyContainer> &propertyContainerList) +{ + stream << propertyContainerList.count(); + foreach (const PropertyContainer &propertyContainer, propertyContainerList) + stream << propertyContainer; + + return stream; +} + +QDataStream &operator>>(QDataStream &stream, QList<PropertyContainer> &propertyContainerList) +{ + int count; + stream >> count; + Q_ASSERT(count >= 0); + for ( int i = 0; i < count; i++) { + PropertyContainer propertyContainer; + stream >> propertyContainer; + propertyContainerList.append(propertyContainer); + } + + return stream; +} + +QDebug operator<<(QDebug debug, QList<PropertyContainer> &propertyContainerList) +{ + foreach (const PropertyContainer &propertyContainer, propertyContainerList) + debug << propertyContainer; + + return debug.space(); +} + + } //namespace QmlDesigner diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index 489d7951c1..91d760339b 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -55,19 +55,18 @@ #include <coreplugin/actionmanager/command.h> #include <coreplugin/coreconstants.h> #include <coreplugin/designmode.h> -#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/icore.h> #include <coreplugin/idocument.h> #include <coreplugin/messagebox.h> #include <coreplugin/modemanager.h> +#include <coreplugin/editormanager/editormanager.h> #include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginspec.h> -#include <projectexplorer/project.h> +#include <qmljs/qmljsmodelmanagerinterface.h> #include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/session.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> -#include <sqlitelibraryinitializer.h> -#include <qmljs/qmljsmodelmanagerinterface.h> +#include <projectexplorer/session.h> #include <utils/hostosinfo.h> #include <utils/qtcassert.h> @@ -212,9 +211,7 @@ QmlDesignerPlugin::~QmlDesignerPlugin() //////////////////////////////////////////////////// bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage/* = 0*/) { - Sqlite::LibraryInitializer::initialize(); - - QDir{}.mkpath(Core::ICore::cacheResourcePath()); + QDir{}.mkpath(Core::ICore::cacheResourcePath().toString()); if (!Utils::HostOsInfo::canCreateOpenGLContext(errorMessage)) return false; @@ -222,8 +219,10 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e if (DesignerSettings::getValue(DesignerSettingsKey::STANDALONE_MODE).toBool()) GenerateResource::generateMenuEntry(); - QString fontPath = Core::ICore::resourcePath() + - QStringLiteral("/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf"); + const QString fontPath + = Core::ICore::resourcePath( + "qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf") + .toString(); if (QFontDatabase::addApplicationFont(fontPath) < 0) qCWarning(qmldesignerLog) << "Could not add font " << fontPath << "to font database"; diff --git a/src/plugins/qmlpreview/qmldebugtranslationclient.cpp b/src/plugins/qmlpreview/qmldebugtranslationclient.cpp index e383784ef5..3ef4351d49 100644 --- a/src/plugins/qmlpreview/qmldebugtranslationclient.cpp +++ b/src/plugins/qmlpreview/qmldebugtranslationclient.cpp @@ -26,8 +26,6 @@ #include "qmldebugtranslationclient.h" #include <qmldebug/qpacketprotocol.h> -#include <QUrl> - #ifdef FOUND_QML_DEBUG_TRANSLATION_PROTOCOL #include <private/qqmldebugtranslationprotocol_p.h> #endif diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp index 7439980df3..1c49995618 100644 --- a/src/plugins/texteditor/codeassist/codeassistant.cpp +++ b/src/plugins/texteditor/codeassist/codeassistant.cpp @@ -407,7 +407,7 @@ void CodeAssistantPrivate::finalizeProposal() bool CodeAssistantPrivate::isDisplayingProposal() const { - return m_proposalWidget != nullptr && m_proposalWidget->proposalIsVisible(); + return m_proposalWidget != nullptr && m_proposalWidget->isVisible(); } bool CodeAssistantPrivate::isWaitingForProposal() const diff --git a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp index e96071cec5..149fba33fa 100644 --- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp +++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp @@ -219,15 +219,10 @@ void FunctionHintProposalWidget::closeProposal() abort(); } -bool FunctionHintProposalWidget::proposalIsVisible() const -{ - return d->m_popupFrame->isVisible(); -} - void FunctionHintProposalWidget::abort() { qApp->removeEventFilter(this); - if (proposalIsVisible()) + if (d->m_popupFrame->isVisible()) d->m_popupFrame->close(); deleteLater(); } diff --git a/src/plugins/texteditor/codeassist/functionhintproposalwidget.h b/src/plugins/texteditor/codeassist/functionhintproposalwidget.h index a37905bbad..99def1676a 100644 --- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.h +++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.h @@ -52,8 +52,6 @@ public: void updateProposal(const QString &prefix) override; void closeProposal() override; - bool proposalIsVisible() const override; - protected: bool eventFilter(QObject *o, QEvent *e) override; diff --git a/src/plugins/texteditor/codeassist/iassistproposalwidget.h b/src/plugins/texteditor/codeassist/iassistproposalwidget.h index d178fc4b5e..0b7fdc0ddd 100644 --- a/src/plugins/texteditor/codeassist/iassistproposalwidget.h +++ b/src/plugins/texteditor/codeassist/iassistproposalwidget.h @@ -57,8 +57,6 @@ public: virtual void updateProposal(const QString &prefix) = 0; virtual void closeProposal() = 0; - virtual bool proposalIsVisible() const { return isVisible(); } - int basePosition() const; void setBasePosition(int basePosition); diff --git a/tests/unit/unittest/CMakeLists.txt b/tests/unit/unittest/CMakeLists.txt index 49050ae2f3..5a2c21c03c 100644 --- a/tests/unit/unittest/CMakeLists.txt +++ b/tests/unit/unittest/CMakeLists.txt @@ -225,14 +225,6 @@ endforeach() extend_qtc_test_with_target_sources(Sqlite) -extend_qtc_test(unittest DEFINES _HAVE_SQLITE_CONFIG_H) - -if (APPLE) -extend_qtc_test(unittest DEFINES _BSD_SOURCE) -elseif (UNIX) -extend_qtc_test(unittest DEFINES _POSIX_C_SOURCE=200809L _GNU_SOURCE _DEFAULT_SOURCE) -endif() - # Do not work on the source directory data add_custom_command(TARGET unittest POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory diff --git a/tests/unit/unittest/gtest-creator-printing.cpp b/tests/unit/unittest/gtest-creator-printing.cpp index af8fc6c0eb..f0f6a04ad7 100644 --- a/tests/unit/unittest/gtest-creator-printing.cpp +++ b/tests/unit/unittest/gtest-creator-printing.cpp @@ -72,7 +72,7 @@ #include <variantproperty.h> #include <qmldesigner/designercore/imagecache/imagecachestorageinterface.h> -#include <sqlite.h> +#include <sqlite3ext.h> namespace { ClangBackEnd::FilePathCaching *filePathCache = nullptr; diff --git a/tests/unit/unittest/sqlitedatabasebackend-test.cpp b/tests/unit/unittest/sqlitedatabasebackend-test.cpp index f6c6a62bb2..2390bd4a3c 100644 --- a/tests/unit/unittest/sqlitedatabasebackend-test.cpp +++ b/tests/unit/unittest/sqlitedatabasebackend-test.cpp @@ -30,7 +30,7 @@ #include <sqliteexception.h> #include <sqlitewritestatement.h> -#include <sqlite.h> +#include <sqlite3.h> #include <QDir> diff --git a/tests/unit/unittest/sqlitetable-test.cpp b/tests/unit/unittest/sqlitetable-test.cpp index 2faebd844c..b916ad5bc8 100644 --- a/tests/unit/unittest/sqlitetable-test.cpp +++ b/tests/unit/unittest/sqlitetable-test.cpp @@ -93,9 +93,7 @@ TEST_F(SqliteTable, InitializeTable) table.addColumn("name"); table.addColumn("value"); - EXPECT_CALL(databaseMock, - execute(Eq( - "CREATE TEMPORARY TABLE IF NOT EXISTS testTable(name, value) WITHOUT ROWID"))); + EXPECT_CALL(databaseMock, execute(Eq("CREATE TEMPORARY TABLE IF NOT EXISTS testTable(name NUMERIC, value NUMERIC) WITHOUT ROWID"))); table.initialize(databaseMock); } @@ -109,7 +107,7 @@ TEST_F(SqliteTable, InitializeTableWithIndex) table.addIndex({column}); table.addIndex({column2}); - EXPECT_CALL(databaseMock, execute(Eq("CREATE TABLE testTable(name, value)"))); + EXPECT_CALL(databaseMock, execute(Eq("CREATE TABLE testTable(name NUMERIC, value NUMERIC)"))); EXPECT_CALL(databaseMock, execute(Eq("CREATE INDEX IF NOT EXISTS index_testTable_name ON testTable(name)"))); EXPECT_CALL(databaseMock, execute(Eq("CREATE INDEX IF NOT EXISTS index_testTable_value ON testTable(value)"))); @@ -301,7 +299,9 @@ TEST_F(SqliteTable, AddPrimaryTableContraint) const auto &nameColumn = table.addColumn("name"); table.addPrimaryKeyContraint({idColumn, nameColumn}); - EXPECT_CALL(databaseMock, execute(Eq("CREATE TABLE testTable(id, name, PRIMARY KEY(id, name))"))); + EXPECT_CALL(databaseMock, + execute( + Eq("CREATE TABLE testTable(id NUMERIC, name NUMERIC, PRIMARY KEY(id, name))"))); table.initialize(databaseMock); } diff --git a/tests/unit/unittest/sqlstatementbuilder-test.cpp b/tests/unit/unittest/sqlstatementbuilder-test.cpp index 1e24faeded..654439fbcd 100644 --- a/tests/unit/unittest/sqlstatementbuilder-test.cpp +++ b/tests/unit/unittest/sqlstatementbuilder-test.cpp @@ -137,11 +137,11 @@ TEST(SqlStatementBuilder, ClearBinding) TEST(SqlStatementBuilder, ColumnType) { - ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Numeric), " NUMERIC"); - ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Integer), " INTEGER"); - ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Real), " REAL"); - ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Text), " TEXT"); - ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Blob), " BLOB"); + ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Numeric), "NUMERIC"); + ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Integer), "INTEGER"); + ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Real), "REAL"); + ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Text), "TEXT"); + ASSERT_THAT(SqlStatementBuilder::columnTypeToString(ColumnType::Blob), "BLOB"); ASSERT_TRUE(SqlStatementBuilder::columnTypeToString(ColumnType::None).isEmpty()); } diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro index d00920fdb5..0f6c0d3bce 100644 --- a/tests/unit/unittest/unittest.pro +++ b/tests/unit/unittest/unittest.pro @@ -37,9 +37,6 @@ QMAKE_LFLAGS += -fno-merge-debug-strings -fuse-ld=gold CONFIG(release, debug|release):QMAKE_LFLAGS += -Wl,--strip-debug } -CONFIG(debug, debug|release): DEFINES += SQLITE_DEBUG - - gcc:!clang: QMAKE_CXXFLAGS += -Wno-noexcept-type msvc{ QMAKE_CXXFLAGS += /bigobj /wd4267 /wd4141 /wd4146 /wd4624 diff --git a/tests/unit/unittest/unittests-main.cpp b/tests/unit/unittest/unittests-main.cpp index 5f5146de79..26993dd9de 100644 --- a/tests/unit/unittest/unittests-main.cpp +++ b/tests/unit/unittest/unittests-main.cpp @@ -26,8 +26,6 @@ #include "googletest.h" #include <sqlitedatabase.h> -#include <sqlitelibraryinitializer.h> - #include <sqliteglobal.h> #include <utils/temporarydirectory.h> @@ -54,7 +52,6 @@ public: int main(int argc, char *argv[]) { - Sqlite::LibraryInitializer::initialize(); Sqlite::Database::activateLogging(); QGuiApplication application(argc, argv); |