Skip to content

Commit

Permalink
webengine: force AppData/Local/jami for GPU caching
Browse files Browse the repository at this point in the history
Change-Id: Ib57f2071ef02be7803c1152ea295dafc622ca60a
  • Loading branch information
atraczyk committed Apr 19, 2019
1 parent 4ce383a commit 29ff23a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
14 changes: 6 additions & 8 deletions messagewebpage.cpp
Expand Up @@ -16,18 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/

#include <QDesktopServices>

#include "messagewebpage.h"

MessageWebPage::MessageWebPage(QWidget *parent)
: QWebEnginePage(parent)
{
}
#include <QDesktopServices>

MessageWebPage::MessageWebPage(QWebEngineProfile *profile, QWidget *parent)
: QWebEnginePage(profile, parent)
{}

MessageWebPage::~MessageWebPage()
{
}
{}

bool
MessageWebPage::acceptNavigationRequest(const QUrl & url, QWebEnginePage::NavigationType type, bool isMainFrame)
Expand Down
2 changes: 1 addition & 1 deletion messagewebpage.h
Expand Up @@ -24,7 +24,7 @@ class MessageWebPage : public QWebEnginePage
{
Q_OBJECT
public:
explicit MessageWebPage(QWidget* parent = nullptr);
explicit MessageWebPage(QWebEngineProfile *profile, QWidget* parent = nullptr);
~MessageWebPage();

protected:
Expand Down
13 changes: 12 additions & 1 deletion messagewebview.cpp
Expand Up @@ -31,6 +31,7 @@
#include <QWebEngineScript>
#include <QWebEngineScriptCollection>
#include <QWebEngineSettings>
#include <QWebEngineProfile>
#include <QWebChannel>
#include <QTimer>

Expand All @@ -45,7 +46,17 @@
MessageWebView::MessageWebView(QWidget *parent)
: QWebEngineView(parent)
{
setPage(new MessageWebPage());
QWebEngineProfile* profile = QWebEngineProfile::defaultProfile();
QDir dataDir(QStandardPaths::writableLocation(
QStandardPaths::AppLocalDataLocation));
dataDir.cdUp();
auto cachePath = dataDir.absolutePath() + "/jami";
profile->setCachePath(cachePath);
profile->setPersistentStoragePath(cachePath);
profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
profile->setHttpCacheType(QWebEngineProfile::NoCache);

setPage(new MessageWebPage(profile, this));

settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
Expand Down

0 comments on commit 29ff23a

Please sign in to comment.