forked from qt-creator/qt-creator
Fix build with macOS deployment target < 10.14
As is used for the Qt 5 based prebuilt binaries. std::optional is only fully supported out of the box since 10.14. Change-Id: Ide8bd9ac8b66b05e1bb6e9b350edf3e7ffdaf97e Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -115,7 +115,7 @@ void AsynchronousExplicitImageCache::clean()
|
|||||||
clearEntries();
|
clearEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<AsynchronousExplicitImageCache::RequestEntry> AsynchronousExplicitImageCache::getEntry()
|
Utils::optional<AsynchronousExplicitImageCache::RequestEntry> AsynchronousExplicitImageCache::getEntry()
|
||||||
{
|
{
|
||||||
std::unique_lock lock{m_mutex};
|
std::unique_lock lock{m_mutex};
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ void AsynchronousImageCache::clean()
|
|||||||
m_generator.clean();
|
m_generator.clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<AsynchronousImageCache::Entry> AsynchronousImageCache::getEntry()
|
Utils::optional<AsynchronousImageCache::Entry> AsynchronousImageCache::getEntry()
|
||||||
{
|
{
|
||||||
std::unique_lock lock{m_mutex};
|
std::unique_lock lock{m_mutex};
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void AsynchronousImageFactory::waitForEntries()
|
|||||||
m_condition.wait(lock, [&] { return m_entries.size() || m_finishing; });
|
m_condition.wait(lock, [&] { return m_entries.size() || m_finishing; });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<AsynchronousImageFactory::Entry> AsynchronousImageFactory::getEntry()
|
Utils::optional<AsynchronousImageFactory::Entry> AsynchronousImageFactory::getEntry()
|
||||||
{
|
{
|
||||||
std::unique_lock lock{m_mutex};
|
std::unique_lock lock{m_mutex};
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,12 @@
|
|||||||
|
|
||||||
#include "imagecacheauxiliarydata.h"
|
#include "imagecacheauxiliarydata.h"
|
||||||
|
|
||||||
|
#include <utils/optional.h>
|
||||||
#include <utils/smallstring.h>
|
#include <utils/smallstring.h>
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
ImageCache::AuxiliaryData &&auxiliaryData);
|
ImageCache::AuxiliaryData &&auxiliaryData);
|
||||||
bool isRunning();
|
bool isRunning();
|
||||||
void waitForEntries();
|
void waitForEntries();
|
||||||
std::optional<Entry> getEntry();
|
Utils::optional<Entry> getEntry();
|
||||||
void request(Utils::SmallStringView name,
|
void request(Utils::SmallStringView name,
|
||||||
Utils::SmallStringView extraId,
|
Utils::SmallStringView extraId,
|
||||||
ImageCache::AuxiliaryData auxiliaryData,
|
ImageCache::AuxiliaryData auxiliaryData,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
#include <sqlitetimestamp.h>
|
#include <sqlitetimestamp.h>
|
||||||
|
#include <utils/optional.h>
|
||||||
#include <utils/smallstringview.h>
|
#include <utils/smallstringview.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -36,8 +37,8 @@ namespace QmlDesigner {
|
|||||||
class ImageCacheStorageInterface
|
class ImageCacheStorageInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using ImageEntry = std::optional<QImage>;
|
using ImageEntry = Utils::optional<QImage>;
|
||||||
using IconEntry = std::optional<QIcon>;
|
using IconEntry = Utils::optional<QIcon>;
|
||||||
|
|
||||||
virtual ImageEntry fetchImage(Utils::SmallStringView name,
|
virtual ImageEntry fetchImage(Utils::SmallStringView name,
|
||||||
Sqlite::TimeStamp minimumTimeStamp) const = 0;
|
Sqlite::TimeStamp minimumTimeStamp) const = 0;
|
||||||
|
|||||||
@@ -27,11 +27,12 @@
|
|||||||
|
|
||||||
#include "asynchronousimagecacheinterface.h"
|
#include "asynchronousimagecacheinterface.h"
|
||||||
|
|
||||||
|
#include <utils/optional.h>
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -80,7 +81,7 @@ private:
|
|||||||
RequestType requestType = RequestType::Image;
|
RequestType requestType = RequestType::Image;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::optional<RequestEntry> getEntry();
|
Utils::optional<RequestEntry> getEntry();
|
||||||
void addEntry(Utils::PathString &&name,
|
void addEntry(Utils::PathString &&name,
|
||||||
Utils::SmallString &&extraId,
|
Utils::SmallString &&extraId,
|
||||||
ImageCache::CaptureImageCallback &&captureCallback,
|
ImageCache::CaptureImageCallback &&captureCallback,
|
||||||
|
|||||||
@@ -27,11 +27,12 @@
|
|||||||
|
|
||||||
#include "asynchronousimagecacheinterface.h"
|
#include "asynchronousimagecacheinterface.h"
|
||||||
|
|
||||||
|
#include <utils/optional.h>
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -90,7 +91,7 @@ private:
|
|||||||
RequestType requestType = RequestType::Image;
|
RequestType requestType = RequestType::Image;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::optional<Entry> getEntry();
|
Utils::optional<Entry> getEntry();
|
||||||
void addEntry(Utils::PathString &&name,
|
void addEntry(Utils::PathString &&name,
|
||||||
Utils::SmallString &&extraId,
|
Utils::SmallString &&extraId,
|
||||||
ImageCache::CaptureImageCallback &&captureCallback,
|
ImageCache::CaptureImageCallback &&captureCallback,
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ TEST_F(ImageCacheStorageSlowTest, FetchNonExistingImageIsEmpty)
|
|||||||
{
|
{
|
||||||
auto image = storage.fetchImage("/path/to/component", {123});
|
auto image = storage.fetchImage("/path/to/component", {123});
|
||||||
|
|
||||||
ASSERT_THAT(image, Eq(std::nullopt));
|
ASSERT_THAT(image, Eq(Utils::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImageCacheStorageSlowTest, FetchSameTimeImage)
|
TEST_F(ImageCacheStorageSlowTest, FetchSameTimeImage)
|
||||||
@@ -324,7 +324,7 @@ TEST_F(ImageCacheStorageSlowTest, DoNotFetchOlderImage)
|
|||||||
|
|
||||||
auto image = storage.fetchImage("/path/to/component", {124});
|
auto image = storage.fetchImage("/path/to/component", {124});
|
||||||
|
|
||||||
ASSERT_THAT(image, Eq(std::nullopt));
|
ASSERT_THAT(image, Eq(Utils::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImageCacheStorageSlowTest, FetchNewerImage)
|
TEST_F(ImageCacheStorageSlowTest, FetchNewerImage)
|
||||||
@@ -340,7 +340,7 @@ TEST_F(ImageCacheStorageSlowTest, FetchNonExistingSmallImageIsEmpty)
|
|||||||
{
|
{
|
||||||
auto image = storage.fetchSmallImage("/path/to/component", {123});
|
auto image = storage.fetchSmallImage("/path/to/component", {123});
|
||||||
|
|
||||||
ASSERT_THAT(image, Eq(std::nullopt));
|
ASSERT_THAT(image, Eq(Utils::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImageCacheStorageSlowTest, FetchSameTimeSmallImage)
|
TEST_F(ImageCacheStorageSlowTest, FetchSameTimeSmallImage)
|
||||||
@@ -358,7 +358,7 @@ TEST_F(ImageCacheStorageSlowTest, DoNotFetchOlderSmallImage)
|
|||||||
|
|
||||||
auto image = storage.fetchSmallImage("/path/to/component", {124});
|
auto image = storage.fetchSmallImage("/path/to/component", {124});
|
||||||
|
|
||||||
ASSERT_THAT(image, Eq(std::nullopt));
|
ASSERT_THAT(image, Eq(Utils::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImageCacheStorageSlowTest, FetchNewerSmallImage)
|
TEST_F(ImageCacheStorageSlowTest, FetchNewerSmallImage)
|
||||||
@@ -397,7 +397,7 @@ TEST_F(ImageCacheStorageSlowTest, FetchNonExistingIconIsEmpty)
|
|||||||
{
|
{
|
||||||
auto image = storage.fetchIcon("/path/to/component", {123});
|
auto image = storage.fetchIcon("/path/to/component", {123});
|
||||||
|
|
||||||
ASSERT_THAT(image, Eq(std::nullopt));
|
ASSERT_THAT(image, Eq(Utils::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImageCacheStorageSlowTest, FetchSameTimeIcon)
|
TEST_F(ImageCacheStorageSlowTest, FetchSameTimeIcon)
|
||||||
@@ -415,7 +415,7 @@ TEST_F(ImageCacheStorageSlowTest, DoNotFetchOlderIcon)
|
|||||||
|
|
||||||
auto image = storage.fetchIcon("/path/to/component", {124});
|
auto image = storage.fetchIcon("/path/to/component", {124});
|
||||||
|
|
||||||
ASSERT_THAT(image, Eq(std::nullopt));
|
ASSERT_THAT(image, Eq(Utils::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImageCacheStorageSlowTest, FetchNewerIcon)
|
TEST_F(ImageCacheStorageSlowTest, FetchNewerIcon)
|
||||||
|
|||||||
Reference in New Issue
Block a user