Skip to content

Commit

Permalink
Adapt CEF versionn 115+
Browse files Browse the repository at this point in the history
  • Loading branch information
tishion committed Sep 3, 2023
1 parent 8a6db98 commit 167231f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
15 changes: 15 additions & 0 deletions include/QCefConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class QCEFVIEW_EXPORT QCefConfig
/// </summary>
const QString cachePath() const;

#if CEF_VERSION_MAJOR < 115
/// <summary>
/// Sets the user data directory path
/// </summary>
Expand All @@ -199,6 +200,20 @@ class QCEFVIEW_EXPORT QCefConfig
/// </summary>
const QString userDataPath() const;

#else

/// <summary>
/// Gets the root cache directory path
/// </summary>
const QString rootCachePath() const;

/// <summary>
/// Sets the root cache directory path
/// </summary>
/// <param name="path">The root cache directory path</param>
void setRootCachePath(const QString& path);
#endif

/// <summary>
/// Sets the bridge object name
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions include/QCefView_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
#endif

// CEF version numbers
#define CEF_VERSION_MAJOR 113
#define CEF_VERSION_MAJOR 115
#define CEF_VERSION_MINOR 3
#define CEF_VERSION_PATCH 1
#define CEF_VERSION_PATCH 15

// clang-format on

Expand Down
18 changes: 18 additions & 0 deletions src/QCefConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ QCefConfig::cachePath() const
return QString::fromStdString(d->cachePath_);
}

#if CEF_VERSION_MAJOR < 115
void
QCefConfig::setUserDataPath(const QString& path)
{
Expand All @@ -173,6 +174,23 @@ QCefConfig::userDataPath() const
return QString::fromStdString(d->userDataPath_);
}

#else

const QString
QCefConfig::rootCachePath() const
{
Q_D(const QCefConfig);
return QString::fromStdString(d->rootCachePath_);
}

void
QCefConfig::setRootCachePath(const QString& path)
{
Q_D(QCefConfig);
d->rootCachePath_ = path.toStdString();
}
#endif

void
QCefConfig::setBridgeObjectName(const QString& name)
{
Expand Down
5 changes: 5 additions & 0 deletions src/details/QCefConfigPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@ QCefConfigPrivate::CopyToCefSettings(const QCefConfig* config, CefSettings* sett
if (!config->d_ptr->cachePath_.empty())
CefString(&settings->cache_path) = config->d_ptr->cachePath_;

#if CEF_VERSION_MAJOR < 115
if (!config->d_ptr->userDataPath_.empty())
CefString(&settings->user_data_path) = config->d_ptr->userDataPath_;
#else
if (!config->d_ptr->rootCachePath_.empty())
CefString(&settings->root_cache_path) = config->d_ptr->rootCachePath_;
#endif

if (!config->d_ptr->locale_.empty())
CefString(&settings->locale) = config->d_ptr->locale_;
Expand Down
6 changes: 6 additions & 0 deletions src/details/QCefConfigPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ class QCefConfigPrivate
std::string locale_;
std::string userAgent_;
std::string cachePath_;

#if CEF_VERSION_MAJOR < 115
std::string userDataPath_;
#else
std::string rootCachePath_;
#endif

std::string bridgeObjectName_;
std::string acceptLanguageList_;

Expand Down

0 comments on commit 167231f

Please sign in to comment.