Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.1732
Browse files Browse the repository at this point in the history
It is based on:
* psi: 3b984219
* plugins: 3c71dec
* psimedia: e7fca88
* resources: 2ef1865
  • Loading branch information
tehnick committed Mar 31, 2024
1 parent 77fe9ae commit c53f664
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/chatview_webkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ ChatView::ChatView(QWidget *parent) : QFrame(parent), d(new ChatViewPrivate)
d->jsObject = new ChatViewJSObject(this); /* It's a session bridge between html and c++ part */
d->webView = new WebView(this);
d->webView->setFocusPolicy(Qt::NoFocus);
auto page = new ChatViewPage(d->webView);
d->webView->setPage(new ChatViewPage(d->webView));
d->webView->connectPageActions();

Expand Down
6 changes: 5 additions & 1 deletion src/chatviewtheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ ChatViewThemePrivate::ChatViewThemePrivate(ChatViewThemeProvider *provider) : Th
nam = provider->psi()->networkAccessManager();
}

ChatViewThemePrivate::~ChatViewThemePrivate() { delete wv; }
ChatViewThemePrivate::~ChatViewThemePrivate()
{
qDebug("ChatViewThemePrivate::~ChatViewThemePrivate");
delete wv;
}

bool ChatViewThemePrivate::exists()
{
Expand Down
4 changes: 2 additions & 2 deletions src/options/opt_appearance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class OptAppearanceMiscUI : public QWidget, public Ui::OptAppearanceMisc {
public:
OptAppearanceMiscUI() : QWidget()
{
setupUi(this);

// we could do that in UI. but see https://bugreports.qt.io/browse/QTBUG-123373
QObject::connect(sl_rosterop, &QSlider::valueChanged, lb_rosterop_val, qOverload<int>(&QLabel::setNum));
QObject::connect(sl_chatdlgop, &QSlider::valueChanged, lb_chatdlgop_val, qOverload<int>(&QLabel::setNum));

setupUi(this);
}
};

Expand Down
18 changes: 15 additions & 3 deletions src/psithememodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@

#include "psithememodel.h"

#include "psiiconset.h"
#include "psithememanager.h"
#include "iconset.h"
#include "psithemeprovider.h"
#include "textutil.h"
#include "theme.h"

#include <QIcon>
#include <QPixmap>
#include <QTimer>
#include <QtConcurrentMap>

class PsiThemeModel;

struct PsiThemeModel::Loader {

// we need this map just to keep themes alive. otherwise webengine (6.6.3) may crash
QMap<QString, Theme> themes; // it's cleaned a little after a theme was loaded

Loader(PsiThemeProvider *provider_) : provider(provider_) { }

typedef ThemeItemInfo result_type;
Expand All @@ -52,6 +58,7 @@ struct PsiThemeModel::Loader {
void asyncLoad(const QString &id, std::function<void(const ThemeItemInfo &)> loadCallback)
{
Theme theme = provider->theme(id);
themes.insert(id, theme);
if (!theme.isValid() || !theme.load([this, theme, loadCallback](bool success) {
qDebug("%s theme loading status: %s", qPrintable(theme.id()), success ? "success" : "failure");
// TODO invent something smarter
Expand Down Expand Up @@ -89,8 +96,12 @@ struct PsiThemeModel::Loader {
//------------------------------------------------------------------------------

PsiThemeModel::PsiThemeModel(PsiThemeProvider *provider, QObject *parent) :
QAbstractListModel(parent), provider(provider)
QAbstractListModel(parent), provider(provider), gcTimer(new QTimer(this))
{
gcTimer->setSingleShot(true);
gcTimer->setInterval(2000);
connect(gcTimer, &QTimer::timeout, this, [this]() { loader->themes.clear(); });

connect(&themeWatcher, SIGNAL(resultReadyAt(int)), SLOT(onThreadedResultReadyAt(int)));
connect(&themeWatcher, SIGNAL(finished()), SLOT(loadComplete()));
}
Expand Down Expand Up @@ -126,6 +137,7 @@ void PsiThemeModel::load()
themesInfo.append(ti);
endInsertRows();
}
gcTimer->start();
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/psithememodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

class PsiThemeProvider;
class Theme;
class QTimer;

struct ThemeItemInfo {
QString id;
Expand Down Expand Up @@ -67,6 +68,7 @@ private slots:
struct Loader;
Loader *loader = nullptr;
PsiThemeProvider *provider = nullptr;
QTimer *gcTimer = nullptr;
QFutureWatcher<ThemeItemInfo> themeWatcher;
QFuture<ThemeItemInfo> themesFuture;
QList<ThemeItemInfo> themesInfo;
Expand Down
2 changes: 2 additions & 0 deletions src/webview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ WebView::WebView(QWidget *parent) :
connectPageActions();
}

WebView::~WebView() { qDebug("WebView::~WebView"); }

void WebView::linkClickedEvent(const QUrl &url)
{
// qDebug()<<"clicked link: "<<url.toString();
Expand Down
1 change: 1 addition & 0 deletions src/webview.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class WebView : public QWebView {
Q_OBJECT
public:
WebView(QWidget *parent);
~WebView();

/** Evaluates JavaScript code */
void evaluateJS(const QString &scriptSource = "");
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.1729 (2024-03-30, 65aed7cb)
1.5.1732 (2024-03-31, 3b984219)

0 comments on commit c53f664

Please sign in to comment.